1 PROGRAMMER'S REFERENCE FOR GENIUS MOUSE DRIVER
3 *** 1 : BRIEF DESCRIPTION
5 The Genius Mouse Driver enables you to use mouse hardware to move an on-screen
6 cursor and control its movement through a software program. Various functions
7 allow you to determine cursor placement, cursor shape, and button status.
9 In order for you to interface your Genius Mouse with an application program, the
10 following information on the Genius Driver has been provided.
12 *** 2 : GRAPHICS AND TEXT CURSORS
14 GMOUSE Driver supports a hardware text cursor, a software text cursor, and
15 a graphics cursor. A hardware text cursor is a blinking cursor which moves from
16 one character to another on-screen. This blinking cursor may take the form of a
17 block or underscore. A software text cursor makes use of display attributes to
18 change the visual appearance of a character on-screen. Movement is from
19 character to character. A graphics cursor is a shape that moves over on-screen
22 You can choose any of these three cursors to use on-screen, however, only one
23 cursor can be displayed at a given time. Also, within your application program,
24 you can switch back and forth between cursors.
27 Display the Graphics Cursor
29 The cursor appears on-screen or disappears from the screen through the calling
30 program. This cursor consists of a block of pixels. As this block moves
31 on-screen and affects the pixels beneath it, the cursor shape and background are
32 created. This interaction is defined by two 16-by-16 bit arrays;
33 one is the screen mask and the other is the cursor mask. The screen mask
34 determines what part of the cursor pixel is to be the shape, and what part is
35 is to be the background. The cursor mask determines which pixels contribute to
36 the color of the cursor. Whenever changes are made to the screen which lie
37 directly beneath the cursor, the cursor should be concealed so that old values
38 are not restored to the screen.
40 Please note that with a high resolution mode, you have a 16-by-16 pixel block;
41 with a medium resolution (four color) mode, you have a 8-by-16 pixel block; with
42 a medium resolution (sixteen color) mode, you have a 4-by-16 pixel block.
46 To create the cursor, the software uses data from the computer's screen memory
47 which defines the color of each pixel on-screen. Operations are performed that
48 affect individual screen bits. Software ANDs the screen mask defining the
49 pixels under the cursor and XORs the cursor mask with the result of the AND
52 Note the results when:
61 Screen Mask Bit is Cursor Mask Bit is Resulting Screen Bit is
62 ------------------ ------------------ -----------------------
68 With each mouse function, a reference to the graphics cursor location is in
69 reference to a point on-screen directly beneath the cursor. This point that the
70 mouse software uses to determine the cursor coordinates is known as the cursor's
72 Generally, the upper_left hand corner of the cursor block is designated as the
73 coordinates for the cursor default value. ((0,0) are the upper_left hand corner
78 You can use this text cursor when your computer is in one of the text modes. By
79 changing the character attributes beneath the cursor, the appearance of the
80 character is influenced on-screen. This effect on the text cursor can be
81 defined by two 16-bit mask values. These bits can be described as follows:
82 bit 15 sets the blinking (1) or non-blinking (0) character ; bit 12 - 14 set the
83 background (1); bits 8 - 10 set the foreground color; and bits 0 - 7 set the
84 character code. These values in the screen mask and the cursor mask
85 determine the character's new attributes when the cursor is covering the
86 character. The screen mask decides which of the character's attributes are
87 maintained. The cursor mask decides in what manner the attributes are altered
88 to produce the cursor.
90 In creating this cursor, the software works from data which defines each
91 character on the screen. The software first ANDs the screen mask and the screen
92 data bit for the character beneath the cursor. Next, the software XORs the
93 cursor mask and the result of the AND operation.
95 When a function refers to the text cursor location, it gives the coordinates of
96 the character beneath the cursor.
102 This cursor is also available when the computer is in one of the text modes.
103 This cursor is the one seen on-screen when the computer is powered on. It
104 consists of 8 pixels wide and 8 to 14 pixels tall. Software allows you to use
105 this cursor for your needs. Scan lines determine a cursor's appearance
106 on-screen. A scan line consists of a horizontal set of pixels.
107 If a line is on, there will be flashing on the screen. If a line is off, there
108 is no effect. Scan lines are numbered from 0 to 7, or 0 to 11 depending on the
109 type of display used. 0 indicates the top scan line.
111 Refer to function 10.
113 *** 2.1 : Mouse Buttons
115 Mouse functions can give the status of the mouse buttons and the number of times
116 a certain button has been pressed and released. The button status is given as
117 an integer. If a bit is set to 1 the button is down; if a bit is set to 0, the
121 Bit 0 - Left Button Status
122 Bit 1 - Right Button Status
123 Bit 2 - Middle Button Status
124 Each time a mouse button is pressed, a counter records the number of presses and
125 releases. The software sets the counter to zero once it has been read or after
128 *** 2.2 : Unit of Distance - Mouse Motion
130 The motion of the mouse can be expressed in a unit of distance (mouse motion)
131 and is approximately 1/200 of an inch.
133 With mouse movement, mouse software determines a horizontal and vertical mouse
134 motion count. This count is used by the software to move a cursor a certain
135 number of pixels on-screen. Software defines mouse motion sensitivity (the
136 number of mouse motions needed to move the cursor 8 pixels on-screen) and this
137 sensitivity determines the rate at which the cursor moves on-screen.
139 Refer to function 15.
141 *** 2.3 : Internal Cursor Flag
143 Mouse software supports an internal flag. This flag determines when the cursor
144 should appear on-screen. If the flag equals 0, the cursor appears on-screen; if
145 the flag is any other number, the cursor disappears from the screen.
147 You can call functions 1 and 2 a number of times, however, if you call function
148 2, you must call function 1 later. This is necessary to restore the flag's
151 Refer to functions 1 and 2.
153 *** 3 : CALLING FROM ASSEMBLY LANGUAGE PROGRAMS
155 To make mouse function calls:
157 Load the appropriate registers (AX, BX, CX, DX) with the parameter values.
158 These correspond to G1%, G2%, G3%, and G4% as shown in the BASIC example to
159 follow. Then execute software interrupt 51 (33H). The values given by the
160 mouse functions will be installed in the registers.
165 ; * set cursor to location (150,100)
166 Mov AX,4 ;(function call 4)
167 Mov CX,150 ;(set horizontal to 150)
168 Mov DX,100 ;(set vertical to 100)
169 Int 51(33H) ;(interrupt to mouse)
171 It is important to note that before using INT 33H, one should verify the
172 presence of the mouse driver. Executing an INT 33H will cause uncertain results
173 if the mouse driver is not loaded. Assume a mouse driver is present when INT
174 33H vector is non-zero and the vector does not point to an IRET instruction.
176 Note: When making a mouse call in Assembly Language, expect somewhat of a
177 different value for the fourth parameter (when compared with calls using a BASIC
178 program) involving functions 9, 12, and 16.
181 *** 4 : CALLING FROM BASIC LANGUAGE PROGRAM
183 To make mouse function calls:
185 Set a pair of integer variables in your program for the offset and the segment
186 of the mouse driver entry point.
188 In order to obtain the offset and segment values, the following statements
189 must be inserted into your program before any calls to mouse functions:
192 15 ' GET GMOUSE ENTRY POINT
193 20 GMSEG = PEEK( 51*4 + 2 ) + 256 * PEEK( 51*4 + 3 ) ' GET SEGMENT ENTRY
194 30 GMOUSE = 2 + PEEK( 51*4 ) + 256 * PEEK( 51*4 + 1 ) ' GET OFFSET ENTRY
195 40 DEF SEG = GMSEG ' SET SEGMENT REGISTER AS THE SEGMENT OF GMOUSE
197 To enter the mouse driver, use the CALL statement:
199 CALL GMOUSE (G1%, G2%, G3%, G4%)
201 GMOUSE contains the entry offset of the mouse driver. G1%, G2%, G3%, and G4%
202 are the integer variables given in the call. These four must be specified in
203 the CALL statement even if a value is not assigned. When a value is assigned,
204 it must be an integer, that is, a whole number.
208 50 ' Find the Activated Mode of Genius Mouse
210 70 CALL GMOUSE ( G1%, G2%, G3%, G4% )
211 80 IF G2% AND 2 THEN PRINT "Genius Mouse ( 2_Button Mode ) Enable"
212 90 IF G2% AND 3 THEN PRINT "Genius Mouse ( 3_Button Mode ) Enable"
213 100 IF NOT G1% THEN PRINT "Can't Find Genius Mouse"
215 *** 5 : MOUSE FUNCTIONS
217 These functions listed apply to the Genius Mouse. Further descriptions of each
218 mouse function will be given in the following pages.
220 Functions Function Number
221 -----------------------------------------------------------------
222 Reset Genius Mouse Driver 0
223 Enable Cursor Display 1
224 Disable Cursor Display 2
225 Read Cursor Location & Button State of Genius Mouse 3
226 Set Cursor Location of Genius Mouse 4
227 Read Button Press State of Genius Mouse 5
228 Read Button Release State of Genius Mouse 6
229 Define Horizontal (X) Range of Cursor Location 7
230 Define Vertical (Y) Range of Cursor Location 8
231 Define Graphics Mode Cursor Style 9
232 Define Text Mode Cursor Style 10
233 Read Genius Mouse Motion Number 11
234 Define Event Handler Entry Location 12
235 Enable Light Pen Emulation Function 13
236 Disable Light Pen Emulation Function 14
237 Define Sensitivity (Mouse Motion/Pixel) of Genius Mouse 15
241 Disable Cursor Display in Special Range 16
242 Define Double-Speed Threshold 19
244 EGA functions are described in Section *** 7.
246 *** 6 : DESCRIPTION OF THE MOUSE FUNCTIONS
248 You'll notice that with the following mouse function descriptions, the
249 parameters needed to make the calls and the expected outcome (return) for each
250 is indicated. Also, any special conditions regarding any of the mouse functions
251 have been included. Further, an example of a program has been provided in order
252 for you to understand how to make the call.
254 The input and return values are presented for 8086 registers and for BASIC in
257 It is important to note that each mouse function call needs four parameters.
258 The Genius Mouse software does not verify any input values, and therefore, if
259 any incorrect values are given, uncertain results will occur.
261 Function 0: Reset Genius Mouse Driver
263 Function 0 gives the current status of the mouse hardware plus the current
264 status of the mouse software. The calling program is able to determine the
265 presence of a mouse driver and/or a serial port.
267 This function resets the mouse driver to the following default status as
271 ------------------------------------------------------------------------------
272 internal cursor flag -1 (cursor concealed)
273 graphics cursor shape horizontal oval
274 text cursor reverse video
275 user-defined call mask all zeroes
276 light pen emulation mode enabled
277 vertical mouse motion/pixel ratio 16 to 8
278 horizontal mouse motion/pixel ratio 8 to 8
279 vertical min/max cursor coordinates 0/current display mode y values minus 1
280 horizontal min/max cursor coordinates 0/current display mode x values minus 1
284 Return: AX = mouse state (-1: installed, 0: not installed)
285 BX = number of buttons (2 button mode, 3 button mode)
289 Return: G1% = mouse state (-1: installed, 0: not installed)
290 G2% = number of buttons (2 button mode, 3 button mode)
292 Example: Used initially to determine if the GMOUSE driver is present and to
301 50 ' Find the Actived Mode of Genius Mouse
303 70 CALL GMOUSE ( G1%, G2%, G3%, G4% )
304 80 IF G2% AND 2 THEN PRINT "Genius Mouse ( 2_Button Mode ) Enable"
305 90 IF G2% AND 3 THEN PRINT "Genius Mouse ( 3_Button Mode ) Enable"
306 100 IF NOT G1% THEN PRINT "Can't Find Genius Mouse"
308 Function 1: Enable Cursor Display
310 Function 1 increments the internal cursor flag counter. If the counter is zero,
311 the cursor is enabled and appears on-screen.
313 The default value is -1 which indicates a concealed cursor. Function 1 must be
314 called to display the cursor. In case the internal cursor flag is already zero,
315 a call to this function produces no effect.
327 110 ' Enable Genius Mouse's Cursor
329 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
331 Function 2: Disable Cursor Display
333 Function 2 disables the cursor by removing it from the screen and decrementing
334 the internal cursor flag. Even though the cursor cannot be seen, it still
335 tracks any motion made with the mouse.
337 You should use this function before changing any portion of the screen
338 containing the cursor. You will avoid the problem of the cursor affecting
341 Keep in mind that whenever your program calls function 2, it must later call
342 function 1 to return the internal cursor flag to its default value. In
343 addition, if your program changes the screen mode, function 2 is called
344 automatically. Therefore, the cursor's movement is enabled the next time it is
347 Call function 2 at the end of a program in order to conceal the cursor. This
348 ensures that nothing remains on-screen.
361 110 ' Disable Genius Mouse's Cursor
363 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
365 Function 3: Read Cursor Location & Button State of Genius Mouse
367 Function 3 gives the status of mouse buttons, plus cursor location.
369 Button status consists of a single integer value:
370 Bit 0 = left button (2 button mode, 3 button mode)
371 Bit 1 = right button (2 button mode, 3 button mode)
372 Bit 2 = middle button (3 button mode)
374 The bit is 1 when the button is pressed. The bit is 0 when the button is
379 Return: BX = button status
380 CX = horizontal cursor coordinate
381 DX = vertical cursor coordinate
385 Return: G2% = button status
386 G3% = horizontal cursor coordinate
387 G4% = vertical cursor coordinate
391 110 ' Read Genius Mouse Location & Button State
393 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
394 140 PRINT "Genius Mouse Location : X_Coord=" G3% " Y_Coord=" G4%
395 150 IF G2% AND 1 THEN PRINT "Left Button"
396 160 IF G2% AND 2 THEN PRINT "Right Button"
397 170 IF G2% AND 4 THEN PRINT "Middle Button"
400 Function 4: Set Cursor Location of Genius Mouse
402 Function 4 sets the current cursor location. Values must be within the
403 coordinate ranges for the virtual screen and, if necessary, are rounded to the
404 nearest values allowed for the current screen mode.
406 Screen Display Virtual Cell Bits/Pixel
407 Mode Adapter Screen (XxY) Size Graphics Mode
408 --------- ------------ --------------- -------- ----------------
409 0 C, E, 3270 640 x 200 16 x 8 -
410 1 C, E, 3270 640 x 200 16 x 8 -
411 2 C, E, 3270 640 x 200 8 x 8 -
412 3 C, E, 3270 640 x 200 8 x 8 -
413 4 C, E, 3270 640 x 200 2 x 1 2
414 5 C, E, 3270 640 x 200 2 x 1 2
415 6 C, E, 3270 640 x 200 1 x 1 1
416 7 M, E, 3270 640 x 200 8 x 8 -
421 D E 640 x 200 16 x 8 2
422 E E 640 x 200 1 x 1 1
423 F E 640 x 350 1 x 1 1
424 10 E 640 x 350 1 x 1 1
425 30 3270 720 x 350 1 x 1 1
429 M = IBM Monochrome Display/Printer Adapter
430 C = IBM Color/Graphics Adapter
431 E = IBM Enhanced Graphics Adapter
432 3270 = IBM All Points Addressable Graphics Adapter (3270 PC)
433 H = Hercules Monochrome Graphics Card
437 CX = new horizontal cursor coordinate
438 DX = new vertical cursor coordinate
443 G3% = new horizontal cursor coordinate
444 G4% = new vertical cursor coordinate
449 110 ' Set Cursor Location at the Upper_Left Corner of Screen
451 130 G3% = 0 : G4% = 0
452 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
454 Function 5: Read Button Press State of Genius Mouse
456 Function 5 provides status on the specified button, gives the number of button
457 presses since the last call, and produces the location of the cursor at last
460 Button status consists of a single integer value. Again, as in function 3:
461 Bit 0 = left button (2 button mode, 3 button mode)
462 Bit 1 = right button (2 button mode, 3 button mode)
463 Bit 2 = middle button (3 button mode)
465 The bit is 1 when the button is pressed. The bit is 0 when the button is
468 The number of button presses will always fall in the range of 0 to 32767. There
469 is no indicator for overflow. Following this function call, the count is reset
474 BX = button status (left = 0, right = 1, middle = 2)
475 Return: AX = button status
476 BX = number of button presses
477 CX = horizontal cursor coordinate at last press
478 DX = vertical cursor coordinate at last press
483 G2% = button status (left = 0, right = 1, middle = 2)
484 Return: G1% = button status
485 G2% = number of button presses
486 G3% = horizontal cursor coordinate at last press
487 G4% = vertical cursor coordinate at last press
491 110 ' Read the Left Button Press State of Genius Mouse
492 120 G1% = 5 : G2% = 2
493 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
494 140 IF G1% AND 2 THEN PRINT "The Middle Button Pressed at X_loc=" G3%
496 Function 6: Read Button Release State of Genius Mouse
498 Function 6 provides status on the specified button, gives the number of button
499 releases since the last call, and provides the location of the cursor at the
502 Button status consists of a single integer value. Again, as in function 3:
503 Bit 0 = left button (2 button mode, 3 button mode)
504 Bit 1 = right button (2 button mode, 3 button mode)
505 Bit 2 = middle button (3 button mode)
507 The bit is 1 when the button is pressed. The bit is 0 when the button is
510 The number of button releases will always fall in the range of 0 to 32767.
511 There is no indicator for overflow. Following this function call, the count is
516 BX = button status (left = 0, right = 1, middle = 2)
517 Return: AX = button status
518 BX = number of button releases
519 CX = horizontal cursor coordinate at last release
520 DX = vertical cursor coordinate at last release
524 G2% = button status (left = 0, right = 1, middle = 2)
525 Return: G1% = button status
526 G2% = number of button releases
527 G3% = horizontal cursor coordinate at last release
528 G4% = vertical cursor coordinate at last release
532 110 ' Read the Left Button Release State of Genius Mouse
533 120 G1% = 6 : G2% = 2
534 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
535 140 IF NOT G1% OR &HFFFB THEN PRINT "The Middle Button Released at X_loc=" G3%
541 Function 7: Define Horizontal (X) Range of Cursor Location
543 Function 7 defines the horizontal range of the cursor on-screen. As a result,
544 cursor movement is limited to this specified area. If a cursor happens to be
545 outside of this area when a call is made, the cursor is moved to just inside the
550 CX = minimum horizontal cursor coordinate
551 DX = maximum horizontal cursor coordinate
556 G3% = minimum horizontal cursor coordinate
557 G4% = maximum horizontal cursor coordinate
562 110 ' Enable Cursor in Horizontal Range between 100 to 200
564 130 G2% = 100 : G3% = 200
565 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
567 Function 8: Define Vertical (Y) Range of Cursor Location
569 Function 8 defines the vertical range of the cursor on-screen. As a result,
570 cursor movement is limited to this specified area. If a cursor happens to be
571 outside of this area when a call is made, the cursor is moved to just inside the
576 CX = minimum vertical cursor coordinate
577 DX = maximum vertical cursor coordinate
582 G3% = minimum vertical cursor coordinate
583 G4% = maximum vertical cursor coordinate
588 110 ' Enable Cursor in Vertical Range between 100 to 200
590 130 G2% = 100 : G3% = 200
591 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
593 Function 9: Define Graphics Mode Cursor Style
595 Function 9 defines the style of the cursor in terms of color, shape, and center
596 for the graphics. As mentioned before, this cursor is a 16-by-16 pixel block
597 and is defined by two 16-bit arrays (the screen mask bit and the cursor mask
598 bit). Cursor coordinates for the hot spot must be in the range of -16 to +16.
603 BX = horizontal cursor hot spot
604 CX = vertical cursor hot spot
605 DX = pointer to screen and cursor mask
610 G2% = horizontal cursor hot spot
611 G3% = vertical cursor hot spot
612 G4% = pointer to screen and cursor mask
617 10 ' Define the screen mask
619 30 cursor (0,0) = &HFFFF '1111111111111111
620 40 cursor (1,0) = &HFFFF '1111111111111111
621 50 cursor (2,0) = &HFFFF '1111111111111111
622 60 cursor (3,0) = &HFFFF '1111111111111111
623 70 cursor (4,0) = &HFFFF '1111111111111111
624 80 cursor (5,0) = &HF00F '1111000000001111
625 90 cursor (6,0) = &H0000 '0000000000000000
626 100 cursor (7,0) = &H0000 '0000000000000000
627 110 cursor (8,0) = &H0000 '0000000000000000
628 120 cursor (9,0) = &H0000 '0000000000000000
629 130 cursor (10,0) = &HF00F '1111000000001111
630 140 cursor (11,0) = &HFFFF '1111111111111111
631 150 cursor (12,0) = &HFFFF '1111111111111111
632 160 cursor (13,0) = &HFFFF '1111111111111111
633 170 cursor (14,0) = &HFFFF '1111111111111111
634 180 cursor (15,0) = &HFFFF '1111111111111111
636 200 ' Define the cursor mask
638 220 cursor (0,1) = &H0000 '0000000000000000
639 230 cursor (1,1) = &H0000 '0000000000000000
640 240 cursor (2,1) = &H0000 '0000000000000000
641 250 cursor (3,1) = &H0000 '0000000000000000
642 260 cursor (4,1) = &H0000 '0000000000000000
643 270 cursor (5,1) = &H0000 '0000000000000000
644 280 cursor (6,1) = &H07E0 '0000011111100000
645 290 cursor (7,1) = &H7FFE '0111111111111110
646 300 cursor (8,1) = &H7FFE '0111111111111110
647 310 cursor (9,1) = &H07E0 '0000011111100000
648 320 cursor (10,1) = &H0000 '0000000000000000
649 330 cursor (11,1) = &H0000 '0000000000000000
650 340 cursor (12,1) = &H0000 '0000000000000000
651 350 cursor (13,1) = &H0000 '0000000000000000
652 360 cursor (14,1) = &H0000 '0000000000000000
653 370 cursor (15,1) = &H0000 '0000000000000000
655 390 ' Set the cursor style and hot spot number of Genius Mouse
663 430 G2% = 6 ' horizontal hot spot
664 440 G3% = 5 ' vertical hot spot
665 450 CALL GMOUSE ( G1%, G2%, G3%, cursor (0,0))
667 Function 10: Define Text Mode Cursor Style
669 Function 10 chooses the hardware or the software text cursor.
671 For example, if BX (G2%) is 1, the hardware cursor is selected and the hardware
672 is set up with the first and last scan lines which define the cursor.
673 (Values for CX (G3%) and DX (G4%) range from 0 to 7 for the color display and 0
674 to 11 for the monochrome display.)
676 If BX (G2%) is 0, the software cursor is selected; and CX (G3%) and DX (G4%)
677 must specify the screen and cursor masks. (These masks give the attributes and
678 character code of the cursor, and their values are dependent on the type of
683 BX = select cursor (0: software text, 1: hardware text)
684 CX = screen mask value/scan line start
685 DX = cursor mask value/scan line stop
690 G2% = select cursor (0: software text, 1: hardware text)
691 G3% = screen mask value/scan line start
692 G4% = cursor mask value/scan line stop
697 110 ' Enable an Inverting Cursor
700 140 G3% = &HFFFF : G4% = &H7700
701 150 CALL GMOUSE ( G1%, G2%, G3%, G4% )
703 Function 11: Read Genius Mouse Motion Number
705 Function 11 gives the mouse motion number since the last call. A positive
706 horizontal number indicates rightward movement (negative shows leftward
707 movement). A positive vertical number indicates downward movement (negative
708 shows upward movement).
709 The number is always in the range of -32768 to 32767. Overflow is disregarded.
710 Once the call is completed, the number is set to 0.
714 Return: CX = horizontal number
723 Return: G3% = horizontal number
724 G4% = vertical number
728 110 ' Read Genius Mouse Motion Number
730 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
731 140 IF G3% > 0 THEN PRINT "Genius Mouse is Moving to Right"
732 150 IF G4% > 0 THEN PRINT "Genius Mouse is Moving Down"
734 Function 12: Define Event Handler Entry Location
736 Function 12 defines the address entry location of an event handler routine which
737 is called when a certain event (defined by the call mask) occurs. The program
738 is temporarily interrupted by the mouse driver. At the end of the event handler
739 routine the program continues at the point it was interrupted.
741 The call mask is a single integer value defining the conditions which will cause
744 A specific condition corresponds to a bit in the call mask:
747 --------------------------------------------------
748 0 cursor location changed
749 1 left button pressed
750 2 left button released
751 3 right button pressed
752 4 right button released
753 5 middle button pressed
754 6 middle button released
757 In order to call the event handler routine, set the mask bit to 1 and put the
758 mask in at CX (G3%). To disable, set the mask bit to 0 and put the mask in at
759 CX (G3%). Always be sure to set the call mask to 0 before the program finishes.
760 (Leave the system in the same state upon exit as if was upon entrance.)
765 ES:DX = pointer to event handler routine
771 G4% = pointer to event handler routine
781 110 ' Active BUTTDOWN Event Handler Routine, When One or More Buttons Pressed
783 130 G3% = &H002A : G4% = BUTTDOWN%
784 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
786 Function 13: Enable Light Pen Emulation Function
788 Function 13 permits the mouse to act like a light pen. When in this mode, calls
789 to the pen function will give the cursor coordinates at the last pen down
792 Note that the status of "pen down" and "pen off-screen" is controlled by the
793 mouse buttons: all buttons up, pen off-screen; one button pressed, pen down.
795 Light pen emulation is ON after each call to function 0 (Reset Mouse Driver).
807 110 ' Enable Light Pen Emulation Function
809 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
811 Function 14: Disable Light Pen Emulation Function
813 Function 14 turns off the light pen emulation mode. When disabled, any call to
814 the pen function will give information only about a real light pen.
826 110 ' Disable Light Pen Emulation Function
828 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
830 Function 15: Define Sensitivity (Mouse Motion/Pixel) of Genius Mouse
832 Function 15 defines mouse sensitivity as determined by the mouse motion/pixel
833 ratio. This is a way of setting the amount of cursor motion wanted for mouse
834 movement. These ratios specify mouse motion per 8 pixels. These values must
835 be in the range of 1 to 32767. With a larger ratio, the cursor movement is
836 shortened for each mouse movement.
841 Default values: horizontal ratio - 8 mouse motions to 8 pixels
842 vertical ratio - 16 mouse motions to 8 pixels
844 Note: 1 mouse motion = 1/200 of an inch increment
848 CX = horizontal mouse motion counts to pixel ratio
849 DX = vertical mouse motion counts to pixel ratio
854 G3% = horizontal mouse motion counts to pixel ratio
855 G4% = vertical mouse motion counts to pixel ratio
860 110 ' Define Horizontal Sensitivity as 8
861 120 ' Define Vertical Sensitivity as 16
865 160 CALL GMOUSE ( G1%, G2%, G3%, G4% )
867 Function 16: Disable Cursor Display in Special Range
869 Function 16 sets up a special range on-screen. If the cursor moves to this area
870 or is in this area, it will be disabled. After a call is made to this function,
871 it is necessary to call function 1 to enable the cursor again.
873 Define the special range with screen location values using four components:
876 --------------------------------------------------------
877 1 Left horizontal screen location
878 2 Upper vertical screen location
879 3 Right horizontal screen location
880 4 Lower vertical screen location
884 ES:DX = pointer to special range
889 G4% = pointer to special range
894 110 ' Disable Cursor Display in (0,0) to (100,100) Range
896 130 RANGE%(1) = 0 : RANGE%(2) = 0
897 140 RANGE%(3) = 100 : RANGE%(4) = 100
898 150 CALL GMOUSE ( G1%, G2%, G3%, RANGE%(0) )
905 500 ' Enable Cursor Display Again
907 520 CALL GMOUSE ( G1%, G2%, G3%, G4% )
909 Function 19: Define Double-Speed Threshold
911 Function 19 defines the threshold value (mouse motion per second) for doubling
912 the cursor's motion. Should the mouse move faster than the DX (G4%) value, the
913 cursor motion doubles. The default value is 64 mouse motions per second.
915 If you should want to disable double-speed, just set the threshold to 32767
916 (7FFFH) mouse motions/second.
920 DX = threshold speed in mouse motions/second
925 G4% = threshold speed in mouse motions/second
930 110 ' Define Double-Speed Threshold as 20 Mouse Motions/Second
933 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
939 500 ' Disable Double-Speed Threshold Function
941 520 G4% = 256 'MAX. VALUE
942 530 CALL GMOUSE ( G1%, G2%, G3%, G4% )
944 *** 7 : USING GENIUS MOUSE WITH IBM ENHANCED GRAPHICS ADAPTER
946 Within the Genius Mouse driver, you'll find nine EGA functions. These functions
947 permit your program to write to and read from write-only registers.
949 The cursor in use is defined as a monochrome cursor with one bit per pixel. The
950 bit masks are determined by function 9 and apply to all active planes.
952 In order to make an EGA function call from an Assembly-Language program, first
953 load the AX, BX, CX, DX, and ES registers with the values indicated for the
954 parameters. Note that five values must be given for a high level language
955 program. Next, execute software interrupt 16 (10h). The values that are
956 returned are intalled in the registers by EGA functions.
961 Upon start with DOS, PC BIOS will verify if the EGA BIOS exists. When this is
962 verified, the PC will execute the EGA BIOS, booting up the program to write the
963 INT 10h entry vector to the address of the INT 42h vector. Now, EGA BIOS
964 address will be written to INT 10h. Following this, you are able to call EGA
965 BIOS (by using INT 10h) and PC video BIOS (by using INT 42h).
967 There are twenty functions in EGA BIOS. (PC BIOS has only 16.) The EGA BIOS
968 routines only intercept the BIOS ROM video routines (INT 10h, AH = 13h or less).
970 The following indicates nine EGA functions and the corresponding function
973 Function Number (HEX)
974 -----------------------------------------------------------------
975 Retrieve Single Data F0
977 Retrieve Registers on a Specified Port F2
978 Save Registers on a Specified Port F3
979 Retrieve Several Registers Data F4
980 Save Several Registers Data F5
981 Reset All Registers as Initial Values F6
982 Set Initial Values F7
983 Get Version Number of Genius Mouse Driver FA
985 In the above functions, the EGA I/O port number and address are as follows:
987 Port No. Register Name No. of Registers Index No. Address Select Register
988 ------------------------------------------------------------------------------
989 00H CRT Controller 25 0 - 24 3x4H
990 08H Sequencer 5 0 - 4 3C4H
991 10H Graphics Controller 9 0 - 8 3CEH
992 18H Attribute Controlle 20 0 - 19 3C0H
994 20H Miscellaneous Output 1 ignored 3C2H
995 28H Feature Control 1 ignored 3xAH
996 30H Graphics 1 Position 1 ignored 3CCH
997 38H Graphics 2 Position 1 ignored 3CAH
999 Note: x = B or D depending on the base I/O address;
1000 determined by Miscellaneous Output Register bit 1.
1002 Function F0: Retrieve Single Data
1004 This function retrieves data from a single register.
1009 Return: BL = Retrieved data from EGA register
1013 FUN_F0 EQU 0f0H ; Function F0
1015 GR_CONTR EQU 010H ; Graphics Controller
1016 MODE_REG EQU 005H ; Mode Regisiter
1021 GR1_PORT EQU 030H ; Graphics 1 Position Register
1022 GR2_PORT EQU 038H ; Graphics 2 Position Register
1024 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
1028 ; Retrieve the Mode Register in Graphics Controller
1038 ; Retrieve Graphics 1 Position Data
1047 Function F1: Save Single Data
1049 This function saves data to an EGA register. Upon finishing a call to this
1050 function, the BH and DX values are altered.
1053 BL = Index number (Non-single register only)
1054 = Data (Single register only)
1055 BH = Data (Non-single register only)
1056 = Disregard (Single register only)
1062 FUN_F1 EQU 0f1H ; Function F1
1064 SEQUENCE EQU 008H ; Sequencer
1065 MASK_REG EQU 002H ; Map Mask Register
1067 FEAT_PORT EQU 028H ; Feature Control Register
1069 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
1070 ; Save Map Mask Register of Sequencer
1082 ; Save Feature Control Register
1091 Function F2: Retrieve Registers on a Specified Port
1093 This function retrieves data from registers on a specifiã port. Upon finishing
1094 a call to this function, the CX value is altered.
1097 CH = Starting index number
1098 CL = Number of registers
1100 ES:BX = Destination of returned data
1101 Return: Returned data to destination address
1105 FUN_F2 EQU 0f2H ; Function F2
1107 GR_CONTR EQU 010H ; Graphics Controller
1109 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
1113 ; Retrieve Four Registers Data from Graphics Controller
1114 GRAPH_POOL DB 04 DUP (0)
1120 MOV BX, OFFSET GRAPH_POOL
1125 Function F3: Save Registers on a Specified Port
1127 This function saves data from registers on a specifiã port. Upon finishing a
1128 call to this function, the BX, CX, and DX values are altered.
1131 CH = Starting index number
1132 CL = Number of register
1134 ES:BX = Address source of incoming data
1141 FUN_F3 EQU 0f3H ; Function F3
1143 ATTR_CONTR EQU 018H ; Attribute Controller
1145 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
1149 ; Save Four Registers Data into Attribute Controller
1150 PALET_DATA DB 1, 2, 4, 3
1156 MOV BX, OFFSET PALET_DATA
1161 Function F4: Retrieve Several Registers Data At The Same Time
1163 This function retrieves data from several registers at the same time. Upon
1164 finishing a call to this function, the CX value is altered.
1167 CX = Number of registers (more than 1)
1168 ES:BX = Address of register packet (each consists of 4 bytes;
1169 port address, byte 1-2; index number, byte 3;
1170 returned data, byte 4)
1171 Return: Returned data is saved into byte 4
1175 FUN_F4 EQU 0f4H ; Function F4
1177 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
1178 ; Retrieve Follow Registers Data
1179 TABLE DW 030H ; Graphics 1 Position Register
1180 DB 00 ; Single Register
1181 DB 00 ; Retrieved Data
1183 DW 010H ; Graphics Controller
1184 DB 05 ; Mode Register
1185 DB 00 ; Retrieved Data
1191 MOV BX, OFFSET TABLE
1197 Function F5: Save Several Registers Data At The Same Time
1201 This function saves data from several registers at the same time. Upon
1202 finishing a call to this function, the CX value is altered.
1205 CX = Number of registers (more than 1)
1206 ES:BX = Address of register packet (each consists of 4 bytes;
1207 port number, byte 1-2; index number, byte 3;
1208 output data, byte 4)
1213 FUN_F5 EQU 0f5H ; Function F5
1215 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
1218 ; Save Follow Registers Data
1219 TABLE DW 20H ; Miscellaneous
1220 DB 00 ; Single Register
1223 DW 18H ; Attribute Controller
1224 DB 12H ; Color Plane Enable
1231 MOV BX, OFFSET TABLE
1236 Function F6: Reset All Registers as Initial Values
1238 This function resets all values to default values for the specific registers.
1239 Function 7 sets the default values.
1246 FUN_F6 EQU 0f6H ; Function F6h
1248 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
1254 Function F7: Set Initial Values
1256 This function sets the initial default values. Upon finishing a call to this
1257 function, the BX and DX values are altered.
1263 ES:BX = Table of output data
1268 FUN_F7 EQU 0f7H ; Function F7
1270 ATTR_CONTR EQU 018H ; Attribute Controller
1272 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
1276 ; Setting Initial Values for the Attribute Controller
1277 ATTR_DATA DB 1, 2, 4, 3, 5, 6, 0, 7
1278 DB 0, 0, 0, 0, 0, 0, 0, 0
1285 MOV BX, OFFSET ATTR_DATA
1289 Function FA: Get Version Number of Genius Mouse Driver
1291 This function will give the Genius Mouse driver version number.
1295 Return: ES:BX = Pointer to Genius Mouse driver version number.