Microsoft KB Archive/59006
Article ID: 59006
Article Last Modified on 8/16/2005
- Microsoft Visual Basic for MS-DOS
- Microsoft QuickBasic 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBasic 4.5 for MS-DOS
- Microsoft BASIC Compiler 6.0
- Microsoft BASIC Compiler 6.0b
- Microsoft BASIC Professional Development System 7.0
This article was previously published under Q59006
The following code example demonstrates how to determine whether an enhanced or standard keyboard is connected to a machine by calling certain ROM interrupts. The information about Interrupt 16h, with Functions 2h and 12h, also applies to any language that can call ROM BIOS interrupts.
The information for the interrupts was taken from Pages 581-586 of the book "Advanced MS-DOS Programming, Second Edition," by Ray Duncan, (Microsoft Press, 1988). This information can also be found on Pages 105-112 of the "Programmer's Quick Reference Series: IBM ROM BIOS," by Ray Duncan (Microsoft Press, 1988).
The information about the address for the PEEK statement was taken from Pages 137 and 138 of the book "The New Peter Norton Programmer's Guide to the IBM PC and PS/2," by Peter Norton and Richard Wilton, (Microsoft Press, 1988).
To compile and link the program in Microsoft Visual Basic for MS-DOS, version 1.0, do the following:
BC Keytest.BAS; LINK Keytest,,,VBDOS.LIB;
To compile and link the program in Microsoft QuickBasic for MS-DOS, verison 4.5, do the following:
BC Keytest.bas ; LINK Keytest,,,BRUN45.LIB+QB.LIB ;
' Use the following include file for Visual Basic for MS-DOS 1.0: REM $INCLUDE: 'VBDOS.BI' ' Use the following include file for QuickBasic for MS-DOS 4.5: ' REM $INCLUDE: 'qb.bi' ' Use the following include file for Basic PDS for MS-DOS 7.0: ' REM $INCLUDE: 'qbx.bi' DIM inregs AS regtype, outregs AS regtype CLS inregs.ax = &H1200 CALL interrupt(&H16, inregs, outregs) key2% = outregs.ax DEF SEG = &H40 test% = PEEK(&H17) DEF SEG LOCATE 13, 23 IF key2% <> test% THEN PRINT "You have a Standard Keyboard" IF key2% = test% THEN PRINT "You have an Enhanced Keyboard" LOCATE 25, 20 PRINT "Hit a key to end test" SLEEP CLS END
Additional query words: VBmsdos QuickBas BasicCom 1.00 4.00 4.00b 4.50 6.00 6.00b 7.00