Using stack for workspace ========================= J.G.Harston - 15-Mar-2002 TSX:TXA:TYA:SEC:SBC #32:TAX:TXS :\ Reserve 32 bytes on stack TYA:PHA :\ Save old stack pointer LDY #1:INX :\ XY=>space on the stack, &100,X=>space on the stack \ \ We now have XY=>32 bytes of workspace on the stack \ The space is also accessible with &100,X \ \ \ The following is a demo of using this workspace \ LDA #0:STA &100,X :\ (XY+0)=0 - read RTC string LDA #14:JSR OSWORD :\ Read the RTC. We must assume A/X/Y corrupted. TSX:INX:INX :\ X points to the space on the stack again LDA &100,X:BEQ NoTime :\ No RTC exists .TimeLp LDA &100,X:JSR OSASCI :\ Print the returned string INX:CMP #13:BNE TimeLp .NoTime \ \ \ To restore the stack, pop off the saved stack pointer \ PLA:TAX:TXS :\ Restore stack pointer