Article ID: 68121 - Last Review: August 16, 2005 - Revision: 2.1 Checking Game Port with CALL INTERRUPT If STICK & STRIG FailThis article was previously published under Q68121 On This PageSUMMARY
If you are experiencing problems with Basic's game port (or joystick)
routines, such as STICK or STRIG, this article provides information
that may help you to diagnose whether the symptom is the result of a
ROM BIOS problem. This information applies only if your computer has
an Intel 80286 or 80386 microprocessor chip.
MORE INFORMATION
The way in which Basic SIC handles joystick commands (which include the
STICK function, STRIG function, and STRIG statement) depends on which
kind of Intel microprocessor chip the computer uses. If the computer
has an 8086/8088 or 80186/80188 microprocessor, the joystick commands
talk directly to the hardware without going through the ROM BIOS. If
the computer has either an Intel 80286 or 80386 microprocessor, the
joystick commands are handled by going through ROM BIOS Interrupt 15h.
Because of errors in some ROM BIOS joystick functions on some computers,
STICK or STRIG may not work at all, or may not work properly.
If your computer has an Intel 80286 or 80386 microprocessor chip, you can use the code example below to determine if the problem you are having is ROM BIOS related. The program accesses the game port by directly calling INTERRUPT &H15 with function &H84, which is the ROM BIOS joystick routine. If the problem still occurs when calling the ROM BIOS joystick routine directly, then the problem is with the computer's ROM BIOS joystick function and not with Basic's STICK or STRIG routines. To access the ROM BIOS joystick routines, you call Interrupt &H15 (21 decimal). The AH register should contain &H84 (132 decimal) to indicate the game port support function. Register values prior to issuing interrupt &H15 should be the following: Depending on the value of DX when you make the call, different parameters will be returned by the interrupt. If DX = 1, then upon returning from Interrupt &H15, the registers will contain the following: Code exampleThe following code example shows how to use the CALL INTERRUPT routine to directly call the ROM BIOS joystick routines.To try this example in VBDOS.EXE:
VBDOS.EXE /L Note: The INTERRUPT routine is considered an external subroutine by the compiler. The routine is located in the files QB.LIB and QB.QLB for QuickBasic for MS-DOS 4.x and in QBX.LIB and QBX.QLB in Basic PDS for MS-DOS 7.x. Programs that execute a CALL INTERRUPT statement when compiled in the QB.EXE editor require the presence of the QB.QLB or QBX.QLB Quick library. This means that QB.EXE and QBX.EXE must be invoked with the /L option, which automatically loads the correct Quick library. Compiled programs that execute CALL INTERRUPT must be linked with the file QB.LIB or QBX.LIB. More information on the use of CALL INTERRUPT can be found under the CALL statement in the language reference manual for each Basic product. For more information on how to use CALL INTERRUPT, query on the following words:
CALL and INTERRUPT and application and note and QuickBasic
JOYSTICK.BASREFERENCES
For a description of the dependency of STICK and STRIG on computers
with certain Intel chips, query on the following words in the
Microsoft Knowledge Base:
STICK and STRIG and BIOS
It may be possible to avoid using the ROM BIOS routines altogether by
directly accessing the game port using GET and PUT functions. (Basic's
INP and OUT statements cannot do this because of the speed required to
read the port.) It may be possible for you to write an assembly
subroutine, which could be called from Basic to talk directly to the
game port.
Information on programming the game port can be found in the following references:
APPLIES TO
| Article Translations
|

Back to the top
