Re: A92: Re: Quitting ASM or not -- please answer these q


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

Re: A92: Re: Quitting ASM or not -- please answer these q




{{ > The parameters to these functions aren't put into any registers, they are
>  pushed onto the stack, and, this is very important, THEY ARE PUSHED IN
>  REVERSE ORDER.
>  
>  Here's an example using
>    void tios::DrawStrXY(WORD x,WORD y,BYTE *string,WORD color)
>  
>       move.w #4,-(a7)    ; push fourth parameter, WORD color
>       move.l  mylabel,-(a7)    ; push third parameter, BYTE *string
>       move.w #64,-(a7)    ; push second parameter, WORD y
>       move.w #10,-(a7)    ; push first parameter, WORD x
>       jsr tios::DrawStrXY    ; call rom function
>       lea   10(a7),a7    ; update stack pointer (2+4+2+2 = 10)

okay so whenever the call DOES NOT SHOW the arguments in the .h or .htm files
or whatever, then it means that you use the stack to pass info to them?
wouldn't it be faster to use registers? }}

A) The program you are calling sometimes uses the registers for other purposes
B) If they used the registers instead of the stack, the registers would be
taken up by the program you are calling and you wouldn't have room to program
anything using those registers (making you need the stack instead of the
program needing the stack =)
C) The size of your program is shortened when you PUSH variables instead of
MOVing variables into registers (in some cases)

-Rob
p.s.  I hope I got this right =)