Implement the housekeeping verbs, and stop the REPL spinning after an error
NEW, CLR, CONT, SWAP, TRON, TROFF and HELP. None is in the Go reference, so what each means here is recorded beside it. Testing CONT turned up a hang that predates this: the runtime's error class is deliberately sticky, and with run_finished_mode REPL every later step re-entered REPL and printed READY -- overwriting the QUIT that end of input had just set. An interactive session that hit one runtime error printed READY forever instead of exiting. RESTORE and RENUMBER are deferred with reasons; RESTORE turns out to need a DATA pointer this port does not have, which is a defect in its own right. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
22
tests/language/housekeeping/verbs.bas
Normal file
22
tests/language/housekeeping/verbs.bas
Normal file
@@ -0,0 +1,22 @@
|
||||
10 REM Group B: the housekeeping verbs. None of these is in the Go reference --
|
||||
20 REM they are on its own unimplemented list -- so what each one means here is
|
||||
30 REM a decision, recorded in src/runtime_housekeeping.c beside the verb.
|
||||
40 A# = 1 : B# = 2
|
||||
50 PRINT A# : PRINT B#
|
||||
60 SWAP A#, B#
|
||||
70 PRINT A# : PRINT B#
|
||||
80 REM SWAP exchanges the variables, so an array goes with its dimensions.
|
||||
90 DIM P#(3)
|
||||
100 DIM Q#(3)
|
||||
110 P#(2) = 7 : Q#(2) = 9
|
||||
120 SWAP P#, Q#
|
||||
130 PRINT P#(2) : PRINT Q#(2)
|
||||
140 REM TRON prints each line number inline before the line runs, as a C128 does.
|
||||
150 TRON
|
||||
160 PRINT "TRACED"
|
||||
170 TROFF
|
||||
180 PRINT "NOT TRACED"
|
||||
190 REM CLR drops the variables and keeps the program.
|
||||
200 CLR
|
||||
210 PRINT A#
|
||||
220 PRINT "STILL RUNNING"
|
||||
Reference in New Issue
Block a user