How to Distinguish Between a Standard and Enhanced Keyboard
ID: Q59006
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
-
Microsoft QuickBASIC for MS-DOS, versions 4.0, 4.0b, 4.5
-
Microsoft BASIC Compiler for MS-DOS, versions 6.0, 6.0b
-
Microsoft BASIC Professional Development System (PDS) for MS-DOS, version 7.0
SUMMARY
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.
MORE INFORMATION
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 ;
Code Example
' 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
Keywords :
Version : MS-DOS:1.0,4.0,4.0b,4.5; :6.0,6.0b,7.0
Platform : MS-DOS
Issue type :