Difference between revisions of "Microsoft KB Archive/59006"

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - "&" to "&")
 
(2 intermediate revisions by the same user not shown)
Line 79: Line 79:
 
DIM inregs AS regtype, outregs AS regtype
 
DIM inregs AS regtype, outregs AS regtype
 
CLS
 
CLS
inregs.ax = &H1200
+
inregs.ax = &H1200
CALL interrupt(&H16, inregs, outregs)
+
CALL interrupt(&H16, inregs, outregs)
 
key2% = outregs.ax
 
key2% = outregs.ax
DEF SEG = &H40
+
DEF SEG = &H40
test% = PEEK(&H17)
+
test% = PEEK(&H17)
 
DEF SEG
 
DEF SEG
 
LOCATE 13, 23
 
LOCATE 13, 23
IF key2% <> test% THEN PRINT "You have a Standard Keyboard"
+
IF key2% <> test% THEN PRINT &quot;You have a Standard Keyboard&quot;
 
IF key2% = test% THEN PRINT &quot;You have an Enhanced Keyboard&quot;
 
IF key2% = test% THEN PRINT &quot;You have an Enhanced Keyboard&quot;
 
LOCATE 25, 20
 
LOCATE 25, 20

Latest revision as of 14:14, 21 July 2020

Knowledge Base


How to Distinguish Between a Standard and Enhanced Keyboard

Article ID: 59006

Article Last Modified on 8/16/2005



APPLIES TO

  • 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

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: KB59006