Keyboard input/Flush the keyboard buffer: Difference between revisions

Content added Content deleted
No edit summary
(Added solution for Action!)
Line 397: Line 397:
kk
kk
End program OK.
End program OK.
</pre>

=={{header|Action!}}==
<lang Action!>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</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Flush_the_keyboard_buffer.png Screenshot from Atari 8-bit computer]
<pre>
Program is halted for 200 frames.
Type character to fill the buffer.

The buffer stores internal key: 63.
Flush the buffer.
The buffer is empty.
</pre>
</pre>


Line 421: Line 458:
Put_Line (Get_Line);
Put_Line (Get_Line);
end Flushtest;</lang>
end Flushtest;</lang>

=={{header|ARM Assembly}}==
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
{{works with|as|Raspberry Pi}}