Keyboard input/Flush the keyboard buffer: Difference between revisions
Keyboard input/Flush the keyboard buffer (view source)
Revision as of 01:52, 3 February 2020
, 4 years agoAdded Commodore BASIC
(Added Commodore BASIC) |
|||
Line 66:
==={{header|Applesoft BASIC}}===
<lang ApplesoftBasic>10 IF PEEK (49152) > 127 THEN C = PEEK (49168): GOTO 10</lang>
==={{header|Commodore BASIC}}===
GET will fetch a single byte from the keyboard buffer, if one is present. The keyboard buffer will hold up to ten bytes before ignoring additional input.
<lang coomodorebasicv2>10 print chr$(147);chr$(14)
25 get k$:if k$<>"" then 25:rem empty buffer
40 print chr$(19):print " Program halted for 10000 counts. "
45 print:print " Type characters to fill the buffer."
50 for i=1 to 10000:next
60 print:print " Characters in the buffer are:":print:print " ";
65 get k$:print k$;
70 for t=1 to 100:next
75 if k$<>"" then 65
80 print
85 end</lang>
{{out}}
<pre>
Program halted for 10000 counts.
Type characters to fill the buffer.
Characters in the buffer are:
abCdefGH12
ready.
</pre>
==={{header|Locomotive Basic}}===
|