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

Usage

   #include <bios.h>
   int _bios_keybrd(int flag);
   int bioskey(int flag);

Description


   These names refer to the same function. The two spellings are for
   compatibility with other compilers. bioskey passes flag to the BIOS
   interrupt 0x14 (20) - the keyboard interrupt. The values for flag are:

       0   Read the next key value from the keyboard input buffer.
           Wait for one if there are not any available.
       1   Determine if any keys are in the keyboard input buffer.
       2   Read the status of the shift keys.

Example 

   #include <bios.h>
   #include <stdio.h>
   #include <stdlib.h>

   int main()
   {
       int key,shift;
       int lastshift = 0;
       while (1)

       {
           shift = bioskey(2);
   /* If shift status changes */
           if (shift != lastshift)
               printf("shift = 0x%02x\n",shift);
   /* If a key is available */
           if (bioskey(1))
           {
               /* Read the key */
               key = _bios_keybrd(0);
               if ((key & 0xFF) == 'q')
                   break;
               printf("key = 0x%04x\n",key);
           }
           lastshift = shift;
       }
       return EXIT_SUCCESS;
   }

Return Value


   If flag is 0, the value returned is the key value. The ASCII value of the
   key is returned in the low byte, and the scan code in the high byte. If
   the low byte is 0, then the key value is not an ASCII key (it might be an
   arrow or function key). If flag is 1, 0 is returned if there are no keys
   in the input buffer, otherwise the next key value is returned. The key
   value is not removed from the input buffer, and is still available to be
   read. If flag is 2, the value returned is the state of the shift keys
   encoded into the bits as follows:

       0x01    Right shift key is down
       0x02    Left shift key is down
       0x04    Ctrl key is down
       0x08    Alt key is down
       0x10    Scroll Lock is toggled
       0x20    Num Lock is toggled
       0x40    Caps Lock is toggled
       0x80    Ins is toggled

See Also

   BIOS Package



See Also: _bios_disk _bios_memsize _bios_printer _bios_serialcom

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