home *** CD-ROM | disk | FTP | other *** search
-
- /* kybdext.c source code for iskybdext() and isbioskybdext() */
-
-
- /******************************************************************************
-
- NAME iskybdext - tells if the extended keyboard is installed
- isbioskybdext - tells if the BIOS supports the extended keyboard
-
- USAGE #include "kybdext.h"
- int iskybdext(void);
- int isbioskybdext(void);
-
- PROTOTYPE kybdext.h
-
- DESCRIPTION iskybdext returns 1 if the extended keyboard is installed
- (zero if not installed)
- isbioskybdext returns 1 if the BIOS supports the extended
- keyboard (zero if it does not support)
-
- See the test program included in this file for
- an example usage.
-
- RETURNS 1 or zero (see description)
-
- NOTE
-
- PORTABILITY MS-DOS specific, Turbo-C specific
-
- AUTHOR Jim Drash
- Software Development and Consulting
- 2256 Beechmont Avenue
- Cincinnati, OH, 45230
- Compuserve ID: 76607,70
-
- ******************************************************************************/
-
- #include <dos.h>
-
- #define BIOS_DATA_SEG 0x0000
- #define KYBD_TYPE_OFF 0x0496
- #define KYBD_STAT_OFF 0x0417
- #define EXTENDED_KYDB 0x10
- #define INS_MODE_TOGGLE 0x80
- #define BIOS_KYBD_FUNCTION 0x16
- #define KYBD_GET_EXT_STATUS 0x12
-
- int iskybdext(void)
- {
- if (peekb(BIOS_DATA_SEG, KYBD_TYPE_OFF) & EXTENDED_KYDB)
- return(1);
- else
- return(0);
- }
-
- int isbioskybdext(void)
- {
- char al;
-
- /* check to see if the extended status service works */
-
- _AX = 0;
- _AH = KYBD_GET_EXT_STATUS;
- geninterrupt(BIOS_KYBD_FUNCTION);
- al = _AL;
-
- /* check to see that the service reports the right stuff */
-
- if (al != peekb(BIOS_DATA_SEG, KYBD_STAT_OFF))
- return(0);
-
- /* toggle the insert mode */
-
- pokeb(BIOS_DATA_SEG, KYBD_STAT_OFF, \
- peekb(BIOS_DATA_SEG, KYBD_STAT_OFF) ^ INS_MODE_TOGGLE);
-
- /* check to see if the extended status service works again */
-
- _AX = 0;
- _AH = KYBD_GET_EXT_STATUS;
- geninterrupt(BIOS_KYBD_FUNCTION);
- al = _AL;
-
- /* check to see that the service reports the right stuff again */
-
- if (al != peekb(BIOS_DATA_SEG, KYBD_STAT_OFF))
- return(0);
-
- /* toggle the insert mode back */
-
- pokeb(BIOS_DATA_SEG, KYBD_STAT_OFF, \
- peekb(BIOS_DATA_SEG, KYBD_STAT_OFF) ^ INS_MODE_TOGGLE);
-
- return(1);
- }
-
- /***********************************************************************/
-
- /* #define TEST 1 */
-
- #ifdef TEST
- #include <stdio.h>
-
- main()
- {
- if (iskybdext())
- printf("Extended Keyboard is installed\n");
- else
- printf("Extended Keyboard is not installed\n");
-
- if (isbioskybdext())
- printf("BIOS supports extended keyboard\n");
- else
- printf("BIOS does not support extended keyboard\n");
- }
- #endif