Add event-driven programming: ON TIMER(n) GOSUB with TIMER ON/OFF/STOP, ON KEY(n) GOSUB with KEY(n) ON/OFF/STOP for F1-F10. Fix F-key escape sequence parser (F9/F10 detection, push back consumed bytes on unmatched sequences). Add EDIT statement for TUI line editing. Guard key trap polling so keystrokes aren't consumed when no traps are configured.
17 lines
437 B
QBasic
17 lines
437 B
QBasic
10 REM TIMER STOP queues events, TIMER ON fires pending
|
|
20 COUNT = 0
|
|
30 ON TIMER(1) GOSUB 200
|
|
40 TIMER STOP
|
|
50 T0 = TIMER
|
|
60 IF TIMER - T0 < 2 THEN 60
|
|
70 PRINT "Before TIMER ON: count ="; COUNT
|
|
80 TIMER ON
|
|
90 REM Small busy-wait for pending event to fire
|
|
95 FOR I = 1 TO 10000: NEXT I
|
|
100 PRINT "After TIMER ON: count ="; COUNT
|
|
110 TIMER OFF
|
|
120 IF COUNT >= 1 THEN PRINT "PASS" ELSE PRINT "FAIL"
|
|
130 END
|
|
200 COUNT = COUNT + 1
|
|
210 RETURN
|