Re: A89: Starting out assembly, need help


[Prev][Next][Index][Thread]

Re: A89: Starting out assembly, need help




>>
>>In a message dated 11/30/98 4:06:13 PM Eastern Standard Time,
>>TurboSoft@aol.com writes:
>>
>>> >  have this effect: move.w #10,-(a0) will decrement a0 (the pointer) by
>a
>>>  word
>>>  >  and then move the word 10 into the new (a0).
>>
>>if it moves #10 into the new a0 AFTER it decrements a0, what's the point of
>>decrementing it in the first place?
>
>if you put a word into (a0-2), then it will fill the two bytes before a0.
>This is what you want to do when you push something to the stack.  since a7
>points to the byte where the currently pushed object is, you want to have
>the newly pushed object before that, and a new stack pointer pointing to the
>new top of the stack.

The stack pointer points to the first empty element above the stack.
Because of this you _must_ use the -(a0) syntax or subtract from the stack
pointer before you store the data.  Otherwise if an intrupt occured between
the store and subtract that value would be overwritten by the OS.

	--Nate


References: