home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name KBGETKEY -- Return character and scan code from the
- * keyboard.
- *
- * Synopsis ch = kbgetkey (pscan);
- *
- * int ch Character code of key pressed.
- *
- * int *pscan Returned scan code of key pressed.
- *
- * Description This function waits for a key sequence to be pressed
- * (unless one is already waiting in the BIOS typeahead
- * buffer) and then returns both the ASCII and scan
- * codes for the character.
- *
- * If the global variable b_kbusex is set to KB_USE_EXTEND
- * and if the extended BIOS keyboard services are
- * available, then they are used. Otherwise the
- * traditional keyboard service is used.
- *
- * Returns ch Character code of key pressed.
- * pscan Scan code of key pressed.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1987,1989
- *
- **/
-
- #include <dos.h>
-
- #include <bkeybrd.h>
-
- int kbgetkey (pscan)
- int *pscan;
- {
- union REGS regs;
-
- /* Set up for BIOS call to retrieve key from */
- /* keyboard buffer, or wait for a key if none is */
- /* present. */
- regs.h.ah = (( b_kbusex != KB_USE_NORMAL
- && kbequip() == KB_EXTENDED) ? 0x10 : 0x00);
-
- /* Do the call. */
- int86 (KB_BIOS_INT, ®s, ®s);
-
- /* Return appropriate values: scan and character */
- /* codes. */
- *pscan = (int) regs.h.ah;
- return ((int) regs.h.al);
- }