Light Pen Won't Work with Mouse Installed

ID: Q10619

1.x 2.x 3.x 4.x 5.x 6.x 7.x 8.x MS-DOS kbhw

The information in this article applies to:

SUMMARY

If you have both a mouse and a light pen installed, you may get conflicts between the two. This is because the Microsoft Mouse can be used to emulate a light pen.

When installed, the mouse driver is initialized with "light pen emulation mode" turned on. Pressing both mouse buttons simultaneously indicates pen touching the screen; releasing the buttons indicates pen off the screen.

If a light pen is installed with the mouse driver in the above condition, the light pen cannot function correctly. Light pen information is collected using an INT 10h DOS call, code 4. With the mouse's pen emulation mode turned on, the pen does not appear to work properly because the mouse driver is pointing that interrupt's vector to its own routine instead of to the regular light pen handler.

For the pen to work properly with the mouse driver installed, mouse function 14 must be called to turn pen emulation mode off. Once disabled, emulation mode is reenabled by calling mouse function 13. See the Microsoft Mouse Programmer's Reference for documentation of the mouse function calls.

MORE INFORMATION

The following is a short BASIC program you can run to disable or enable the mouse's light pen emulation mode:

10 INPUT "(1) Disable or (2) Enable light pen emulation";P% 20 IF P% <> 1 AND P% <> 2 THEN PRINT "WRONG RESPONSE, TRY AGAIN":GOTO

   10
25 DEF SEG =0 30 MSEG = 256 * PEEK(51*4+3) + PEEK(51*4+2) 40 MOUSE = 256 * PEEK(51*4+1) + PEEK(51*4)+2 50 IF MSEG AND MOUSE THEN 70 60 PRINT "MOUSE DRIVER NOT FOUND":END 70 DEF SEG = MSEG 80 IF P% = 1 THEN M1% = 14 ELSE M1% = 13 90 CALL MOUSE(M1%,M2%,M3%,M4%)
100 DEF SEG          'restore segment to BASIC's data segment

Line 90 contains Mx% because the mouse function calls are expecting four parameters to be passed, even if no value is assigned to one or more of them.

KBCategory: kbhw KBSubcategory: Additional reference words: 7.00 7.04 7.05 8.00 8.10 8.20 9.00

Version           : 1.x 2.x 3.x 4.x 5.x 6.x 7.x 8.x
Platform          : MS-DOS

Last Reviewed: September 17, 1996