How to Make MOUSE CALLs in Hercules Graphics Mode, SCREEN 3 (30856)
The information in this article applies to:
- Microsoft QuickBASIC 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBASIC 4.5
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
This article was previously published under Q30856 SUMMARY
You can design Basic programs that make CALLs to the Microsoft Mouse
driver on Hercules Monochrome SCREEN 3 in MS-DOS, but you must follow
the steps below. (MOUSE CALLs let you change the mouse cursor, detect
the mouse position, detect mouse-button status, etc.)
Appendix D of the "Microsoft Mouse Programmer's Reference Guide"
mentions three steps, but they are shown in the wrong order to work
with QuickBasic. The steps shown on Page D-1 should be performed in
the following order for QuickBasic:
The order 1, 2, 3 should be used for other languages.
MORE INFORMATION
The following information applies to QuickBasic Versions 4.00, 4.00b,
and 4.50 and Microsoft Basic Compiler Versions 6.00 and 6.00b running
under MS-DOS.
When making CALLs to the Microsoft Mouse driver on a computer with a
Hercules Monochrome Graphics Adapter, do the following:
- In the AUTOEXEC.BAT file, invoke the Microsoft MOUSE.COM driver
before the QBHERC.COM or MSHERC.COM Hercules Graphics driver. If
QBHERC or MSHERC is mistakenly loaded first, the Hercules graphics
cursor appears as several small horizontal (broken) lines in the
graphics screen (or it does not appear at all), and the graphics
drawing boundaries are confined to 640 x 200 pixels. (Normal SCREEN
3 resolution is 720 x 348.)
MSHERC.COM is shipped with QuickBasic Version 4.50. QBHERC.COM is
shipped with Microsoft QuickBasic Versions 4.00 and 4.00b and with
Microsoft Basic Compiler Versions 6.00 and 6.00b.
- Perform one of the following steps, but not both:
- Start QB.EXE by typing QB /L MOUSE to load the Quick Library
MOUSE.QLB into memory.
You can use LINK /Q to make MOUSE.QLB from the MOUSE.LIB that
comes on a disk along with the "Microsoft Mouse Programmer's
Reference Guide." This guide can be ordered by returning the
card in the Microsoft Mouse package.
or
- Start QB.EXE by typing QB /L QB.QLB and use CALL INTERRUPT or
CALL INT86OLD to access the mouse driver. To find out how to
use CALL INTERRUPT or CALL INT86OLD to program the mouse,
search for a separate article with the following words:
INTERRUPT and INT86OLD and 51 and MOUSE
- To tell the mouse driver that you are in CRT Page 0, define the
segment address (DEF SEG) at hex 40 and POKE a 6 into offset hex
49. You must store 5 into memory offset hex 49 to use CRT Page 1.
The following is an example:
DEF SEG = &H40
POKE &H49, 6 ' CRT page 0
DEF SEG
- Call the mouse function 0 to initialize, as follows:
CALL mouse(0,0,0,0) ' initialize mouse
- Put the card into the graphics mode (i.e., change to SCREEN mode
3), as follows:
SCREEN 3, , 0, 0
- CALL the mouse to turn the mouse cursor on, as follows:
CALL mouse(1, 0, 0, 0) ' turn mouse cursor on
QuickBasic Versions 3.00 and earlier do not support Hercules
Monochrome Graphics SCREEN 3.
The techniques explained in this article do not work under the DOS box
(real mode) of MS OS/2 (nor do they work in protected mode, which
requires OS/2 MOU... API function calls from Microsoft Basic Compiler
6.00 or 6.00b to program the mouse). OS/2 normally loads its own mouse
driver for the DOS box, and even if this driver isn't loaded, OS/2
still reserves interrupt 33 for itself. If you install MOUSE.COM in
the DOS box, OS/2 will tell you that the interrupt is owned by the
system, and although a program can display the mouse cursor on
Hercules SCREEN 3 (such as the Code Example below), the pointer will
not move. You cannot program the mouse in Hercules graphics SCREEN 3
in the DOS box (real mode) of MS OS/2. You can, however, program the
mouse in other graphics screen modes in the DOS box of OS/2.
Code Example
The following example can be compiled with QuickBasic Versions 4.00,
4.00b, and 4.50 and with Microsoft Basic Compiler Versions 6.00 and
6.00b in MS-DOS:
DEFINT A-Z
DEF SEG = &H40
POKE &H49, 6 ' CRT page 0
DEF SEG
CALL mouse(0, 0, 0, 0) ' Initialize Mouse
SCREEN 3, , 0, 0 ' Switch to Hercules Graphics mode, page 0
m1 = 1
CALL mouse(m1, m2, m3, m4) ' Turn on mouse cursor (m1 = 1)
WHILE INKEY$="":WEND
CALL mouse(2, 0, 0, 0) ' Turn off mouse cursor
END
Modification Type: | Minor | Last Reviewed: | 1/8/2003 |
---|
Keywords: | KB30856 |
---|
|