A89: More ASM help please
[Prev][Next][Index][Thread]
A89: More ASM help please
Can someone explan the following code excerpt from the hello world program?
move.w #2,-(a7) ; use font #2 (large font)
<<<ok, I think this moves 2 into (a7), but what is the negative sign? is that
like variable-- in C++?>>>
jsr tios::FontSetSys ; set the font
<<< I'm guessing 2 is pushed into the stack and FontSetSys uses 2 as a
parameter, right? When FontSetSys is called, is the 2 popped out or does it
stay there?>>>
add.l #2,a7 ; clean up the stack
<<< How does adding 2 to a7 clean up the stack? What's going on? >>>
move.w #4,-(a7) ; move the first param to the stack
<<< Ok, here's another parameter, but for what? >>>
lea string(pc),a0 ; move adress of string to the stack
<<< What does lea do and why does string have a (pc) next to it? >>>
move.l a0,-(a7)
<<< String is being pushed into the stack via a0, but why did we have to use
a0 when it seems logical enough to just push string in directly?>>>
move.w #0,-(a7) ; push position
<<< Pushes 0 into stack as Y-position parameter >>>
move.w #0,-(a7) ; push position
<<< Pushes 0 into stack as X-position parameter >>>
jsr tios::DrawStrXY ; call the DrawStrXY ROM function
<<< Once again, is everything popped outta the stack, or is it still there?
>>>
add.l #10,a7 ; restore the stack pointer
<<< How does this work too? What does it mean by clearing and restoring the
stack? >>>
Thanks.