Post Reply 
71B: DISP, KEY$, and keyboard buffer
04-23-2021, 01:10 AM (This post was last modified: 04-23-2021 01:12 AM by Dave Britten.)
Post: #4
RE: 71B: DISP, KEY$, and keyboard buffer
Here's a little mockup that behaves the way I'd like it to work.

Code:
10 DELAY 8,8 @ ! MAKE DISP WAIT FOR A KEYSTROKE
20 DISP "TEST 1"
30 CALL CL @ ! CLEAR DISPLAY AND KB BUFFER
40 FOR I=1 TO 300 @ NEXT I @ ! SOME FAKE PROCESSING
50 DISP "TEST 2"
60 CALL CL @ ! CLEAR DISPLAY AND KB SO KEYSTROKE DOESN'T AFFECT INPUT
70 INPUT T
80 END
90 ! READ DELAY ROUTINE FROM 71B USERS LIBRARY UTILITIES
100 SUB DELAY(D,C)
110 A$=PEEK$("2F946",4)
120 DEF FNR(B$)
130 IF B$="FF" THEN FNR=INF ELSE FNR=HTD(B$)/32
140 END DEF
150 D=FNR(A$[4]&A$[3,3])
160 C=FNR(A$[2,2]&A$[1,1])
170 END SUB
180 SUB CL @ ! CLEAR DISPLAY AND KB BUFFER
190 CALL DELAY(D1,D2)
200 DELAY 0,0 @ DISP @ DELAY D1,D2 @ ! CLEAR DISPLAY
210 IF KEY$#"" THEN 210 @ ! THROW AWAY KB BUFFER CONTENTS
220 END SUB

As you can see, it's a lot of code, so I'm wondering if there's a more elegant way to do this. Smile Maybe a LEX file with a DISP replacement that behaves this way?

In other words, this process flow:

1. Display something on screen.
2. Stop and wait for a keystroke before continuing (don't care which key is pressed - any results from using KEY$ or KEYWAIT$ for this purpose can be discarded).
3. Clear the display to indicate that the program has resumed running.
4. Clear out the keyboard buffer so whatever key was pressed to continue after the pause isn't seen by any subsequent INPUT, or the command line, etc.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: 71B: DISP, KEY$, and keyboard buffer - Dave Britten - 04-23-2021 01:10 AM



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