RosettaCodeData/Task/Keyboard-input-Flush-the-keyboard-buffer/Action-/keyboard-input-flush-the-keyboard-buffer.action
2023-07-01 13:44:08 -04:00

25 lines
489 B
Text

PROC Wait(BYTE frames)
BYTE RTCLOK=$14
frames==+RTCLOK
WHILE frames#RTCLOK DO OD
RETURN
PROC Main()
BYTE CH=$02FC ;Internal hardware value for last key pressed
PrintE("Program is halted for 200 frames.")
PrintE("Type character to fill the buffer.")
Wait(200)
PutE()
DO
IF CH=$FF THEN
PrintE("The buffer is empty.")
EXIT
ELSE
PrintF("The buffer stores internal key: %B.%E",CH)
PrintE("Flush the buffer.")
CH=$FF
FI
OD
RETURN