Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>_bios_keybrd</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_bios_keybrd
============

Syntax
------

     #include <bios.h>
     
     unsigned _bios_keybrd(unsigned cmd);

Description
-----------

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'
     Read the next key pressed

`_NKEYBRD_READ'
     Read the next extended key pressed

`_KEYBRD_READY'
     Check if the next key in the keyboard buffer

`_NKEYBRD_READY'
     Check if the next extended key in the keyboard buffer

`_KEYBRD_SHIFTSTATUS'
     Read keyboard shift state (0x0040:0x0017 byte):

          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'
     Read keyboard shift and extended shift state (0x0040:0x0017 word):

          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.

Example
-------

     while( !_bios_keybrd(_KEYBRD_READY) )
       try_to_do_something();


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson