!ô > 6502.ProgTips.StackWS/src +ô Demonstrate using stack for workspace 1ô Use *TESTROM to call the demonstration code (: 2: <OSASCI=&FFE3:OSWORD=&FFF1 FÞ mcode% &1000 P ã P=0 ¸ 1 ZP%=&8000:O%=mcode% d[OPT P*3+4 n\ Boilerplate x\ ----------- ‚BRK:BRK:BRK:JMP Service Œ!EQUB &82:EQUB Copyright-&8000 –EQUB &00:EQUS "TESTROM"  .Copyright ªEQUB &00:EQUS "(C)" ´ EQUB &00 ¾\ ----------- È: Ò: Ü"\ Demo command, print the time æ"\ ---------------------------- ð .Demo ú@TSX:TXA:TYA:SEC:SBC #32:TAX:TXS :\ Reserve 32 bytes on stack =TYA:PHA :\ Save old stack pointer YLDY #1:INX :\ XY=>space on the stack, &100,X=>space on the stack ALDA #0:STA &100,X :\ (XY+0)=0 - read RTC string "TLDA #14:JSR OSWORD :\ Read the RTC. We must assume A/X/Y corrupted. ,OTSX:INX:INX :\ X points to the space on the stack again 64LDA &100,X:BEQ NoTime :\ No RTC exists @ .DemoLp J@LDA &100,X:JSR OSASCI :\ Print the returned string TINX:CMP #13:BNE DemoLp ^ .NoTime h