Calling a BIOS Interrupt to Determine the Scan Code of a Key
ID: Q38878
|
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
This article includes an example of a CALL INTERRUPT routine that
determines the scan code of a key. This program only reports the scan
codes for keys that are supported in the ROM BIOS of the machine.
Keys such as F11 and F12 do not return scan codes using this
interrupt. There are other interrupts that can be used to get the
scan codes of extended keys, but they are only supported on machines
with extended ROM BIOS. This example program is generic and runs on
any PC compatible.
MORE INFORMATION
The interrupt called is "READ STATUS." This is ROM BIOS Interrupt 16h, Function 1h.
Example
' To try this example in VBDOS.EXE:
' 1. From the File menu, choose New Project.
' 2. Copy the code example to the Code window.
' 3. Press F5 to run the program.
'
' To run this program in the environment, you must invoke the
' environment with the /L switch to load the default Quick library:
' VBDOS.EXE /L for Visual Basic 1.0 for MS-DOS
' QB /L QB.QLB for QuickBasic for MS-DOS
'
' Use the following include file for Visual Basic 1.0 for MS-DOS:
REM $INCLUDE: 'VBDOS.BI'
' Use the following include file for QuickBasic for MS-DOS:
REM $INCLUDE: 'QB.BI'
'Use the following include file for Basic PDS for MS-DOS:
REM $INCLUDE: 'QBX.BI'
DIM inregs AS regtype
DIM outregs AS regtype
inregs.ax = &H1 ' Function 1
DO
CALL INTERRUPT(&H16, inregs, outregs) ' Call Interrupt 16h
PRINT "Scan Code is "; outregs.ax \ 256, ' AH
PRINT "ASCII is "; outregs.ax AND 255 ' AL
LOOP
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 :