Post Reply 
71B: DISP, KEY$, and keyboard buffer
04-22-2021, 12:39 PM
Post: #1
71B: DISP, KEY$, and keyboard buffer
I'm trying to work out exactly how all of these things interact. Here's a short example program:

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
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
71B: DISP, KEY$, and keyboard buffer - Dave Britten - 04-22-2021 12:39 PM



User(s) browsing this thread: 1 Guest(s)