Code: Select all
10 FORI=1TO4
20 IFI=3GOTO40
30 NEXT
40 FORU=1TO2:FORI=1TO2:PRINTI,U:NEXT:NEXT
Code: Select all
1 1
2 1
?NEXT WITHOUT FOR ERROR
IN 40
The same behaviour occurs on the C64.
Moderator: Moderators
Code: Select all
10 FORI=1TO4
20 IFI=3GOTO40
30 NEXT
40 FORU=1TO2:FORI=1TO2:PRINTI,U:NEXT:NEXT
Code: Select all
1 1
2 1
?NEXT WITHOUT FOR ERROR
IN 40
Code: Select all
LAB_C742
LDA #$80 ; set FNX
STA LAB_10 ; set subscript/FNX flag
JSR LAB_C9A5 ; perform LET
JSR LAB_C38A ; search the stack for FOR or GOSUB activity
BNE LAB_C753 ; branch if FOR, this variable, not found
; FOR, this variable, was found so first we dump the old one
TXA ; copy index
ADC #$0F ; add FOR structure size-2
TAX ; copy to index
TXS ; set stack (dump FOR structure (-2 bytes))
etc...
Actively purging the stack from all dangling FOR loops would be a slightly better description of what happens here.chysn wrote:[...] it's basically losing track of "FOR U" data at that point [...]
Code: Select all
17 IFPEEK(G+D(H))<>219ORRND(1)<.1THENI=C:GOSUB41
[...]
41 FORT=1TO4:I=(I+1)AND3:IFPEEK(G+D(I))=219THENH=I:RETURN
42 NEXT:RETURN
Code: Select all
10 FORI=1TO4
20 IFI=3THEN DISPOSE NEXT :GOTO40
30 NEXT
40 FORU=1TO2:FORI=1TO2:PRINTI,U:NEXT:NEXT