04-22-2021, 12:39 PM
I'm trying to work out exactly how all of these things interact. Here's a short example program:
The DELAY 8,8 (equivalent to INF,INF) keeps the displayed text on screen until you press a key. Pressing END LINE to dismiss the "TEST 1" display moves on to displaying "TEST 2". So far so good. Pressing END LINE again to dismiss "TEST 2" causes the END LINE keystroke to "fall through" to the INPUT, and you get an error message about numeric input being required.
Adding line 35 to empty the keyboard buffer prevents this from happening, but is there a more elegant way to handle this?
Also, it's somewhat disconcerting to press a key to dismiss DISP and have nothing on the display change indicating that the keystroke was accepted and the program has continued. For example:
What I'd like is a simple, clean way to make DISP behave like this:
1. Clear the keyboard buffer
2. Display its argument(s) and wait for a keystroke
3. Either display an indication that it's waiting for a keystroke, or clear the display after a key is pressed and the program continues (Sharp pocket computers opt for clearing the display after PRINT is dismissed)
4. Clear the keyboard buffer
Code:
10 DELAY 8,8
20 DISP "TEST 1"
30 DISP "TEST 2"
40 INPUT "?";T
The DELAY 8,8 (equivalent to INF,INF) keeps the displayed text on screen until you press a key. Pressing END LINE to dismiss the "TEST 1" display moves on to displaying "TEST 2". So far so good. Pressing END LINE again to dismiss "TEST 2" causes the END LINE keystroke to "fall through" to the INPUT, and you get an error message about numeric input being required.
Adding line 35 to empty the keyboard buffer prevents this from happening, but is there a more elegant way to handle this?
Code:
10 DELAY 8,8
20 DISP "TEST 1"
30 DISP "TEST 2"
35 IF KEY$#"" THEN 35
40 INPUT "?";T
Also, it's somewhat disconcerting to press a key to dismiss DISP and have nothing on the display change indicating that the keystroke was accepted and the program has continued. For example:
Code:
10 DELAY 8,8
20 DISP "TEST 1"
30 FOR I=1 TO 500 @ NEXT I
40 DISP "TEST 2"
What I'd like is a simple, clean way to make DISP behave like this:
1. Clear the keyboard buffer
2. Display its argument(s) and wait for a keystroke
3. Either display an indication that it's waiting for a keystroke, or clear the display after a key is pressed and the program continues (Sharp pocket computers opt for clearing the display after PRINT is dismissed)
4. Clear the keyboard buffer