Reads the first character in the keyboard buffer.
KeyTest n
KeyTest n is similar to InKey$, that is to say, it reads a character from the keyboard when a key - other than Alt, Ctrl, Shift or Caps Lock - is pressed. If no key was pressed a 0 is returned. Otherwise the ASCII and scan code of the character is returned
Bit 0 to 7 - ASCII-Code
Bit 8 to 15 - Scan-Code.
For a list of Scan and ASCII codes, see Key Codes and ASCII Values.
KeyTest returns immediately; it doesn't wait for a keyboard hit. You should never use KeyTest in a serious program. KeyTest was built in to offer an easy function to use in simple test programs to get a character of the keyboard.
OpenW 1
Local n%
Repeat
KeyTest n%
If Byte(n%)
Print Byte(n%),
Print LoByte(n%),
Print HiByte(n%)
EndIf
Until Byte(n%) = 27
CloseW # 1
The program loops until the ESCAPE key is pressed.
{Created by Sjouke Hamstra; Last updated: 11/10/2014 by James Gaite}