agon-bbc-basic icon indicating copy to clipboard operation
agon-bbc-basic copied to clipboard

RESTORE nnn does not work correctly

Open fp64lib opened this issue 5 months ago • 0 comments

The RESTORE nnn statement does not always correctly position to the right line. Error can be recreated with the following test program TEST.BAS

100 CLS:OSCLI("VERSION")
110 RESTORE 50000
120 READ A$
130 PRINT A$;
140 IF INSTR(A$,"50000")>1 THEN PRINT " OK" ELSE PRINT " NOK"
150 RESTORE 49000
160 READ A$
170 PRINT A$;
180 IF INSTR(A$,"49000")>1 THEN PRINT " OK" ELSE PRINT " NOK"
190 RESTORE 50000
200 PRINT "AGAIN ";A$;
210 IF INSTR(A$,"50000")>1 THEN PRINT " OK" ELSE PRINT " NOK"
220 END
48000 DATA "DATA NEVER READ AT 48000"
49000 DATA "SECOND DATA AT 49000"
50000 DATA "FIRST DATA AT 50000"
51000 DATA "DATA NEVER READ AT 51000"
LOAD "bin/bbcbasic.bin"
RUN
LOAD "TEST.BAS"
RUN

will return the following output:

BBC BASIC (Agon) Version 1.06
FIRST DATA AT 50000 OK
SECOND DATA AT 49000 OK
AGAIN SECOND DATA AT 49000 NOK

Expected would be that the third RESTORE statement at line 190 would again return the data line at 50000. In BBCBASIC24, it's even worse at the current V1.03 will throw a "TYPE MISMATCH" error for a RESTORE nnn statement.

fp64lib avatar Sep 18 '24 14:09 fp64lib