Category:68000 Assembly: Difference between revisions

m
m (→‎Alignment: Provided an example of a "dummy read")
Line 78:
 
====The Stack====
The 68000's stack is commonly referred to as <code>SP</code> but it is also address register <code>A7</code>. This register is handled differently than the other address registers when pushing bytes onto the stack. A byte value pushed onto the stack will be padded to the <b>right</b> with zeroes. The stack needs to pad byte-length data so that it can stay word-aligned at all times. Otherwise the CPU would crash as soon as you tried to use the stack for anything other than a byte! If a byte is popped, the zeroes are placed on the left side of the lower word of the data register, and the actual byte goes in the right side.
 
<lang 68000devpac>MOVE.B #$FF,-(SP) ;push #$FF then #$00 onto the stack, in that order.
1,489

edits