First page Back Continue Last page Overview Graphics
Passing Parameters on the Stack
Passing parameters from the calling routine:
ldaa Var1 ;push data to be passed
ldd Var2 ;more data to be passed
leas 3,sp ;clean up stack
In this example the byte value in Var1 and the word value in Var2 are pushed on the stack before the subroutine ProcessVals is called. After returning from the subroutine, three is added to the stack pointer to restore the state of the stack to what it was before the psha and pshd instructions were executed.