INT 16H 01H: Query Keyboard Status / Preview Key
[XT] [AT]
Expects: AH 01H
──────────────────────────────────────────────────────────────────
Returns: ZF ZR = no keys in buffer
NZ = key is ready
AH (if ZR) scan code
AL (if ZR) ASCII character code or extended ASCII keystroke
──────────────────────────────────────────────────────────────────
Info: Checks to see if a key is available in the keyboard buffer, and
if so, returns its keycode in AX. It DOES NOT remove the
keystroke from the buffer.
This can be used to avoid dropping into a BIOS loop while waiting
for a keystroke. For instance:
waitForKey: mov ah,01H
int 16H
jnz gotKey ;jmp if key is ready
call doSomething ;do processing while waiting
jmp waitForKey ;loop back and check for a key
gotKey: mov ah, 00H ;key is ready, get it
int 16H ;now process the key
.
:
Notes: ■ Extended key filtering: For compatibility with older 83-key
'boards, this converts duplicated keys into their older
equivalent keys. Use INT 16H 11H to get unfiltered key codes.
See Also: INT 16H (BIOS keyboard services)
BIOS Data Area
ROM-BIOS Functions
-♦-