#include <bios.h> unsigned _bios_keybrd(unsigned cmd);
The _bios_keybrd routine uses INT 0x16 to access the keyboard services. The cmd argument can be any of the following manifest constants:
_KEYBRD_READ
_NKEYBRD_READ
_KEYBRD_READY
_NKEYBRD_READY
_KEYBRD_SHIFTSTATUS
7654 3210 Meaning ---- ---X Right SHIFT is pressed ---- --X- Left SHIFT is pressed ---- -X-- CTRL is pressed ---- X--- ALT is pressed ---X ---- Scroll Lock locked --X- ---- Num Lock locked -X-- ---- Caps Lock locked X--- ---- Insert locked
_NKEYBRD_SHIFTSTATUS
FEDC BA98 7654 3210 Meaning ---- ---- ---- ---X Right SHIFT is pressed ---- ---- ---- --X- Left SHIFT is pressed ---- ---- ---- -X-- CTRL is pressed ---- ---- ---- X--- ALT is pressed ---- ---- ---X ---- Scroll Lock locked ---- ---- --X- ---- Num Lock locked ---- ---- -X-- ---- Caps Lock locked ---- ---- X--- ---- Insert locked ---- ---X ---- ---- Left CTRL is pressed ---- --X- ---- ---- Left ALT is pressed ---- -X-- ---- ---- Right CTRL is pressed ---- X--- ---- ---- Right ALT is pressed ---X ---- ---- ---- Scroll Lock is pressed --X- ---- ---- ---- Num Lock is pressed -X-- ---- ---- ---- Caps Lock is pressed X--- ---- ---- ---- SysReq is pressed
Return Value
With the ???_READ and ???_SHIFTSTATUS arguments, the _bios_keybrd function returns the contents of the AX register after the BIOS call.
With the ???_READY argument, _bios_keybrd returns 0 if there is no key. If there is a key, _bios_keybrd returns the key waiting to be read (that is, the same value as _KEYBRD_READ).
With the ???_READ and ???_READY arguments, the _bios_keybrd function returns -1 if CTRL+BREAK has been pressed and is the next keystroke to be read.
not ANSI, not POSIX
while( !_bios_keybrd(_KEYBRD_READY) ) try_to_do_something();
Go to the first, previous, next, last section, table of contents.