Prev: A389 Up: Map Next: A3B8
A38A: search the stack for FOR or GOSUB activity
Used by the routines at A742, A8D2 and AD1E.
return Zb=1 if FOR variable found
A38A BA TSX copy stack pointer
A38B E8 INX +1 pass return address
A38C E8 INX +2 pass return address
A38D E8 INX +3 pass calling routine return address
A38E E8 INX +4 pass calling routine return address
A38F BD 01 01 LDA $0101,X get the token byte from the stack
A392 C9 81 CMP #$81 is it the FOR token
A394 D0 21 BNE $A3B7 if not FOR token just exit
it was the FOR token
A396 A5 4A LDA $4A get FOR/NEXT variable pointer high byte
A398 D0 0A BNE $A3A4 branch if not null
A39A BD 02 01 LDA $0102,X get FOR variable pointer low byte
A39D 85 49 STA $49 save FOR/NEXT variable pointer low byte
A39F BD 03 01 LDA $0103,X get FOR variable pointer high byte
A3A2 85 4A STA $4A save FOR/NEXT variable pointer high byte
A3A4 DD 03 01 CMP $0103,X compare variable pointer with stacked variable pointer high byte
A3A7 D0 07 BNE $A3B0 branch if no match
A3A9 A5 49 LDA $49 get FOR/NEXT variable pointer low byte
A3AB DD 02 01 CMP $0102,X compare variable pointer with stacked variable pointer low byte
A3AE F0 07 BEQ $A3B7 exit if match found
A3B0 8A TXA copy index
A3B1 18 CLC clear carry for add
A3B2 69 12 ADC #$12 add FOR stack use size
A3B4 AA TAX copy back to index
A3B5 D0 D8 BNE $A38F loop if not at start of stack
A3B7 60 RTS
Prev: A389 Up: Map Next: A3B8