1 PROGRAMMER'S REFERENCE FOR GENIUS MOUSE DRIVER
\r
3 *** 1 : BRIEF DESCRIPTION
\r
5 The Genius Mouse Driver enables you to use mouse hardware to move an on-screen
\r
6 cursor and control its movement through a software program. Various functions
\r
7 allow you to determine cursor placement, cursor shape, and button status.
\r
9 In order for you to interface your Genius Mouse with an application program, the
\r
10 following information on the Genius Driver has been provided.
\r
12 *** 2 : GRAPHICS AND TEXT CURSORS
\r
14 GMOUSE Driver supports a hardware text cursor, a software text cursor, and
\r
15 a graphics cursor. A hardware text cursor is a blinking cursor which moves from
\r
16 one character to another on-screen. This blinking cursor may take the form of a
\r
17 block or underscore. A software text cursor makes use of display attributes to
\r
18 change the visual appearance of a character on-screen. Movement is from
\r
19 character to character. A graphics cursor is a shape that moves over on-screen
\r
22 You can choose any of these three cursors to use on-screen, however, only one
\r
23 cursor can be displayed at a given time. Also, within your application program,
\r
24 you can switch back and forth between cursors.
\r
27 Display the Graphics Cursor
\r
29 The cursor appears on-screen or disappears from the screen through the calling
\r
30 program. This cursor consists of a block of pixels. As this block moves
\r
31 on-screen and affects the pixels beneath it, the cursor shape and background are
\r
32 created. This interaction is defined by two 16-by-16 bit arrays;
\r
33 one is the screen mask and the other is the cursor mask. The screen mask
\r
34 determines what part of the cursor pixel is to be the shape, and what part is
\r
35 is to be the background. The cursor mask determines which pixels contribute to
\r
36 the color of the cursor. Whenever changes are made to the screen which lie
\r
37 directly beneath the cursor, the cursor should be concealed so that old values
\r
38 are not restored to the screen.
\r
40 Please note that with a high resolution mode, you have a 16-by-16 pixel block;
\r
41 with a medium resolution (four color) mode, you have a 8-by-16 pixel block; with
\r
42 a medium resolution (sixteen color) mode, you have a 4-by-16 pixel block.
\r
44 Refer to function 9.
\r
46 To create the cursor, the software uses data from the computer's screen memory
\r
47 which defines the color of each pixel on-screen. Operations are performed that
\r
48 affect individual screen bits. Software ANDs the screen mask defining the
\r
49 pixels under the cursor and XORs the cursor mask with the result of the AND
\r
52 Note the results when:
\r
61 Screen Mask Bit is Cursor Mask Bit is Resulting Screen Bit is
\r
62 ------------------ ------------------ -----------------------
\r
68 With each mouse function, a reference to the graphics cursor location is in
\r
69 reference to a point on-screen directly beneath the cursor. This point that the
\r
70 mouse software uses to determine the cursor coordinates is known as the cursor's
\r
72 Generally, the upper_left hand corner of the cursor block is designated as the
\r
73 coordinates for the cursor default value. ((0,0) are the upper_left hand corner
\r
76 Software Text Cursor
\r
78 You can use this text cursor when your computer is in one of the text modes. By
\r
79 changing the character attributes beneath the cursor, the appearance of the
\r
80 character is influenced on-screen. This effect on the text cursor can be
\r
81 defined by two 16-bit mask values. These bits can be described as follows:
\r
82 bit 15 sets the blinking (1) or non-blinking (0) character ; bit 12 - 14 set the
\r
83 background (1); bits 8 - 10 set the foreground color; and bits 0 - 7 set the
\r
84 character code. These values in the screen mask and the cursor mask
\r
85 determine the character's new attributes when the cursor is covering the
\r
86 character. The screen mask decides which of the character's attributes are
\r
87 maintained. The cursor mask decides in what manner the attributes are altered
\r
88 to produce the cursor.
\r
90 In creating this cursor, the software works from data which defines each
\r
91 character on the screen. The software first ANDs the screen mask and the screen
\r
92 data bit for the character beneath the cursor. Next, the software XORs the
\r
93 cursor mask and the result of the AND operation.
\r
95 When a function refers to the text cursor location, it gives the coordinates of
\r
96 the character beneath the cursor.
\r
98 Refer to function 10.
\r
100 Hardware Text Cursor
\r
102 This cursor is also available when the computer is in one of the text modes.
\r
103 This cursor is the one seen on-screen when the computer is powered on. It
\r
104 consists of 8 pixels wide and 8 to 14 pixels tall. Software allows you to use
\r
105 this cursor for your needs. Scan lines determine a cursor's appearance
\r
106 on-screen. A scan line consists of a horizontal set of pixels.
\r
107 If a line is on, there will be flashing on the screen. If a line is off, there
\r
108 is no effect. Scan lines are numbered from 0 to 7, or 0 to 11 depending on the
\r
109 type of display used. 0 indicates the top scan line.
\r
111 Refer to function 10.
\r
113 *** 2.1 : Mouse Buttons
\r
121 Mouse functions can give the status of the mouse buttons and the number of times
\r
122 a certain button has been pressed and released. The button status is given as
\r
123 an integer. If a bit is set to 1 the button is down; if a bit is set to 0, the
\r
125 Bit 0 - Left Button Status
\r
126 Bit 1 - Right Button Status
\r
127 Bit 2 - Middle Button Status
\r
128 Each time a mouse button is pressed, a counter records the number of presses and
\r
129 releases. The software sets the counter to zero once it has been read or after
\r
132 *** 2.2 : Unit of Distance - Mouse Motion
\r
134 The motion of the mouse can be expressed in a unit of distance (mouse motion)
\r
135 and is approximately 1/200 of an inch.
\r
137 With mouse movement, mouse software determines a horizontal and vertical mouse
\r
138 motion count. This count is used by the software to move a cursor a certain
\r
139 number of pixels on-screen. Software defines mouse motion sensitivity (the
\r
140 number of mouse motions needed to move the cursor 8 pixels on-screen) and this
\r
141 sensitivity determines the rate at which the cursor moves on-screen.
\r
143 Refer to function 15.
\r
145 *** 2.3 : Internal Cursor Flag
\r
147 Mouse software supports an internal flag. This flag determines when the cursor
\r
148 should appear on-screen. If the flag equals 0, the cursor appears on-screen; if
\r
149 the flag is any other number, the cursor disappears from the screen.
\r
151 You can call functions 1 and 2 a number of times, however, if you call function
\r
152 2, you must call function 1 later. This is necessary to restore the flag's
\r
155 Refer to functions 1 and 2.
\r
157 *** 3 : CALLING FROM ASSEMBLY LANGUAGE PROGRAMS
\r
159 To make mouse function calls:
\r
161 Load the appropriate registers (AX, BX, CX, DX) with the parameter values.
\r
162 These correspond to G1%, G2%, G3%, and G4% as shown in the BASIC example to
\r
163 follow. Then execute software interrupt 51 (33H). The values given by the
\r
164 mouse functions will be installed in the registers.
\r
168 ; * set cursor to location (150,100)
\r
169 Mov AX,4 ;(function call 4)
\r
170 Mov CX,150 ;(set horizontal to 150)
\r
171 Mov DX,100 ;(set vertical to 100)
\r
172 Int 51(33H) ;(interrupt to mouse)
\r
174 It is important to note that before using INT 33H, one should verify the
\r
175 presence of the mouse driver. Executing an INT 33H will cause uncertain results
\r
176 if the mouse driver is not loaded. Assume a mouse driver is present when INT
\r
177 33H vector is non-zero and the vector does not point to an IRET instruction.
\r
181 Note: When making a mouse call in Assembly Language, expect somewhat of a
\r
182 different value for the fourth parameter (when compared with calls using a BASIC
\r
183 program) involving functions 9, 12, and 16.
\r
185 *** 4 : CALLING FROM BASIC LANGUAGE PROGRAM
\r
187 To make mouse function calls:
\r
189 Set a pair of integer variables in your program for the offset and the segment
\r
190 of the mouse driver entry point.
\r
192 In order to obtain the offset and segment values, the following statements
\r
193 must be inserted into your program before any calls to mouse functions:
\r
196 15 ' GET GMOUSE ENTRY POINT
\r
197 20 GMSEG = PEEK( 51*4 + 2 ) + 256 * PEEK( 51*4 + 3 ) ' GET SEGMENT ENTRY
\r
198 30 GMOUSE = 2 + PEEK( 51*4 ) + 256 * PEEK( 51*4 + 1 ) ' GET OFFSET ENTRY
\r
199 40 DEF SEG = GMSEG ' SET SEGMENT REGISTER AS THE SEGMENT OF GMOUSE
\r
201 To enter the mouse driver, use the CALL statement:
\r
203 CALL GMOUSE (G1%, G2%, G3%, G4%)
\r
205 GMOUSE contains the entry offset of the mouse driver. G1%, G2%, G3%, and G4%
\r
206 are the integer variables given in the call. These four must be specified in
\r
207 the CALL statement even if a value is not assigned. When a value is assigned,
\r
208 it must be an integer, that is, a whole number.
\r
212 50 ' Find the Activated Mode of Genius Mouse
\r
213 60 G1% = 0 : G2% = 0
\r
214 70 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
215 80 IF G2% AND 2 THEN PRINT "Genius Mouse ( 2_Button Mode ) Enable"
\r
216 90 IF G2% AND 3 THEN PRINT "Genius Mouse ( 3_Button Mode ) Enable"
\r
217 100 IF NOT G1% THEN PRINT "Can't Find Genius Mouse"
\r
219 *** 5 : MOUSE FUNCTIONS
\r
221 These functions listed apply to the Genius Mouse. Further descriptions of each
\r
222 mouse function will be given in the following pages.
\r
224 Functions Function Number
\r
225 -----------------------------------------------------------------
\r
226 Reset Genius Mouse Driver 0
\r
227 Enable Cursor Display 1
\r
228 Disable Cursor Display 2
\r
229 Read Cursor Location & Button State of Genius Mouse 3
\r
230 Set Cursor Location of Genius Mouse 4
\r
231 Read Button Press State of Genius Mouse 5
\r
232 Read Button Release State of Genius Mouse 6
\r
233 Define Horizontal (X) Range of Cursor Location 7
\r
234 Define Vertical (Y) Range of Cursor Location 8
\r
235 Define Graphics Mode Cursor Style 9
\r
236 Define Text Mode Cursor Style 10
\r
237 Read Genius Mouse Motion Number 11
\r
241 Define Event Handler Entry Location 12
\r
242 Enable Light Pen Emulation Function 13
\r
243 Disable Light Pen Emulation Function 14
\r
244 Define Sensitivity (Mouse Motion/Pixel) of Genius Mouse 15
\r
245 Disable Cursor Display in Special Range 16
\r
246 Define Double-Speed Threshold 19
\r
247 Swap Event Handler Entry Location 20
\r
248 Get Mouse Driver State Storage Size 21
\r
249 Save Mouse Driver state 22
\r
250 Restore Mouse Driver state 23
\r
251 Set CRT Page Number 29
\r
252 Read CRT Page Number 30
\r
254 EGA functions are described in Section *** 7.
\r
256 *** 6 : DESCRIPTION OF THE MOUSE FUNCTIONS
\r
258 You'll notice that with the following mouse function descriptions, the
\r
259 parameters needed to make the calls and the expected outcome (return) for each
\r
260 is indicated. Also, any special conditions regarding any of the mouse functions
\r
261 have been included. Further, an example of a program has been provided in order
\r
262 for you to understand how to make the call.
\r
264 The input and return values are presented for 8086 registers and for BASIC in
\r
265 the following pages.
\r
267 It is important to note that each mouse function call needs four parameters.
\r
268 The Genius Mouse software does not verify any input values, and therefore, if
\r
269 any incorrect values are given, uncertain results will occur.
\r
271 Function 0: Reset Genius Mouse Driver
\r
273 Function 0 gives the current status of the mouse hardware plus the current
\r
274 status of the mouse software. The calling program is able to determine the
\r
275 presence of a mouse driver and/or a serial port.
\r
277 This function resets the mouse driver to the following default status as
\r
281 ------------------------------------------------------------------------------
\r
282 internal cursor flag -1 (cursor concealed)
\r
283 graphics cursor shape horizontal oval
\r
284 text cursor reverse video
\r
285 user-defined call mask all zeroes
\r
286 light pen emulation mode enabled
\r
287 vertical mouse motion/pixel ratio 16 to 8
\r
288 horizontal mouse motion/pixel ratio 8 to 8
\r
289 vertical min/max cursor coordinates 0/current display mode y values minus 1
\r
290 horizontal min/max cursor coordinates 0/current display mode x values minus 1
\r
294 Return: AX = mouse state (-1: installed, 0: not installed)
\r
295 BX = number of buttons (2 button mode, 3 button mode)
\r
303 Return: G1% = mouse state (-1: installed, 0: not installed)
\r
304 G2% = number of buttons (2 button mode, 3 button mode)
\r
306 Example: Used initially to determine if the GMOUSE driver is present and to
\r
309 50 ' Find the Actived Mode of Genius Mouse
\r
310 60 G1% = 0 : G2% = 0
\r
311 70 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
312 80 IF G2% AND 2 THEN PRINT "Genius Mouse ( 2_Button Mode ) Enable"
\r
313 90 IF G2% AND 3 THEN PRINT "Genius Mouse ( 3_Button Mode ) Enable"
\r
314 100 IF NOT G1% THEN PRINT "Can't Find Genius Mouse"
\r
316 Function 1: Enable Cursor Display
\r
318 Function 1 increments the internal cursor flag counter. If the counter is zero,
\r
319 the cursor is enabled and appears on-screen.
\r
321 The default value is -1 which indicates a concealed cursor. Function 1 must be
\r
322 called to display the cursor. In case the internal cursor flag is already zero,
\r
323 a call to this function produces no effect.
\r
335 110 ' Enable Genius Mouse's Cursor
\r
337 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
339 Function 2: Disable Cursor Display
\r
341 Function 2 disables the cursor by removing it from the screen and decrementing
\r
342 the internal cursor flag. Even though the cursor cannot be seen, it still
\r
343 tracks any motion made with the mouse.
\r
345 You should use this function before changing any portion of the screen
\r
346 containing the cursor. You will avoid the problem of the cursor affecting
\r
349 Keep in mind that whenever your program calls function 2, it must later call
\r
350 function 1 to return the internal cursor flag to its default value. In
\r
351 addition, if your program changes the screen mode, function 2 is called
\r
352 automatically. Therefore, the cursor's movement is enabled the next time it is
\r
355 Call function 2 at the end of a program in order to conceal the cursor. This
\r
356 ensures that nothing remains on-screen.
\r
371 110 ' Disable Genius Mouse's Cursor
\r
373 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
375 Function 3: Read Cursor Location & Button State of Genius Mouse
\r
377 Function 3 gives the status of mouse buttons, plus cursor location.
\r
379 Button status consists of a single integer value:
\r
380 Bit 0 = left button (2 button mode, 3 button mode)
\r
381 Bit 1 = right button (2 button mode, 3 button mode)
\r
382 Bit 2 = middle button (3 button mode)
\r
384 The bit is 1 when the button is pressed. The bit is 0 when the button is
\r
389 Return: BX = button status
\r
390 CX = horizontal cursor coordinate
\r
391 DX = vertical cursor coordinate
\r
395 Return: G2% = button status
\r
396 G3% = horizontal cursor coordinate
\r
397 G4% = vertical cursor coordinate
\r
401 110 ' Read Genius Mouse Location & Button State
\r
403 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
404 140 PRINT "Genius Mouse Location : X_Coord=" G3% " Y_Coord=" G4%
\r
405 150 IF G2% AND 1 THEN PRINT "Left Button"
\r
406 160 IF G2% AND 2 THEN PRINT "Right Button"
\r
407 170 IF G2% AND 4 THEN PRINT "Middle Button"
\r
408 180 PRINT "Pressed"
\r
410 Function 4: Set Cursor Location of Genius Mouse
\r
412 Function 4 sets the current cursor location. Values must be within the
\r
413 coordinate ranges for the virtual screen and, if necessary, are rounded to the
\r
414 nearest values allowed for the current screen mode.
\r
421 Screen Display Virtual Cell Bits/Pixel
\r
422 Mode Adapter Screen (XxY) Size Graphics Mode
\r
423 --------- ------------ --------------- -------- ----------------
\r
424 0 C, E, 3270 640 x 200 16 x 8 -
\r
425 1 C, E, 3270 640 x 200 16 x 8 -
\r
426 2 C, E, 3270 640 x 200 8 x 8 -
\r
427 3 C, E, 3270 640 x 200 8 x 8 -
\r
428 4 C, E, 3270 640 x 200 2 x 1 2
\r
429 5 C, E, 3270 640 x 200 2 x 1 2
\r
430 6 C, E, 3270 640 x 200 1 x 1 1
\r
431 7 M, E, 3270 640 x 200 8 x 8 -
\r
432 D E 640 x 200 16 x 8 2
\r
433 E E 640 x 200 1 x 1 1
\r
434 F E 640 x 350 1 x 1 1
\r
435 10 E 640 x 350 1 x 1 1
\r
436 30 3270 720 x 350 1 x 1 1
\r
437 H 720 x 348 1 x 1 1
\r
440 M = IBM Monochrome Display/Printer Adapter
\r
441 C = IBM Color/Graphics Adapter
\r
442 E = IBM Enhanced Graphics Adapter
\r
443 3270 = IBM All Points Addressable Graphics Adapter (3270 PC)
\r
444 H = Hercules Monochrome Graphics Card
\r
448 CX = new horizontal cursor coordinate
\r
449 DX = new vertical cursor coordinate
\r
454 G3% = new horizontal cursor coordinate
\r
455 G4% = new vertical cursor coordinate
\r
460 110 ' Set Cursor Location at the Upper_Left Corner of Screen
\r
462 130 G3% = 0 : G4% = 0
\r
463 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
465 Function 5: Read Button Press State of Genius Mouse
\r
467 Function 5 provides status on the specified button, gives the number of button
\r
468 presses since the last call, and produces the location of the cursor at last
\r
471 Button status consists of a single integer value. Again, as in function 3:
\r
472 Bit 0 = left button (2 button mode, 3 button mode)
\r
473 Bit 1 = right button (2 button mode, 3 button mode)
\r
474 Bit 2 = middle button (3 button mode)
\r
476 The bit is 1 when the button is pressed. The bit is 0 when the button is
\r
481 The number of button presses will always fall in the range of 0 to 32767. There
\r
482 is no indicator for overflow. Following this function call, the count is reset
\r
487 BX = button status (left = 0, right = 1, middle = 2)
\r
488 Return: AX = button status
\r
489 BX = number of button presses
\r
490 CX = horizontal cursor coordinate at last press
\r
491 DX = vertical cursor coordinate at last press
\r
495 G2% = button status (left = 0, right = 1, middle = 2)
\r
496 Return: G1% = button status
\r
497 G2% = number of button presses
\r
498 G3% = horizontal cursor coordinate at last press
\r
499 G4% = vertical cursor coordinate at last press
\r
503 110 ' Read the Left Button Press State of Genius Mouse
\r
504 120 G1% = 5 : G2% = 2
\r
505 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
506 140 IF G1% AND 2 THEN PRINT "The Middle Button Pressed at X_loc=" G3%
\r
508 Function 6: Read Button Release State of Genius Mouse
\r
510 Function 6 provides status on the specified button, gives the number of button
\r
511 releases since the last call, and provides the location of the cursor at the
\r
512 last button release.
\r
514 Button status consists of a single integer value. Again, as in function 3:
\r
515 Bit 0 = left button (2 button mode, 3 button mode)
\r
516 Bit 1 = right button (2 button mode, 3 button mode)
\r
517 Bit 2 = middle button (3 button mode)
\r
519 The bit is 1 when the button is pressed. The bit is 0 when the button is
\r
522 The number of button releases will always fall in the range of 0 to 32767.
\r
523 There is no indicator for overflow. Following this function call, the count is
\r
528 BX = button status (left = 0, right = 1, middle = 2)
\r
529 Return: AX = button status
\r
530 BX = number of button releases
\r
531 CX = horizontal cursor coordinate at last release
\r
532 DX = vertical cursor coordinate at last release
\r
536 G2% = button status (left = 0, right = 1, middle = 2)
\r
541 Return: G1% = button status
\r
542 G2% = number of button releases
\r
543 G3% = horizontal cursor coordinate at last release
\r
544 G4% = vertical cursor coordinate at last release
\r
548 110 ' Read the Left Button Release State of Genius Mouse
\r
549 120 G1% = 6 : G2% = 2
\r
550 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
551 140 IF NOT G1% OR &HFFFB THEN PRINT "The Middle Button Released at X_loc=" G3%
\r
553 Function 7: Define Horizontal (X) Range of Cursor Location
\r
555 Function 7 defines the horizontal range of the cursor on-screen. As a result,
\r
556 cursor movement is limited to this specified area. If a cursor happens to be
\r
557 outside of this area when a call is made, the cursor is moved to just inside the
\r
562 CX = minimum horizontal cursor coordinate
\r
563 DX = maximum horizontal cursor coordinate
\r
568 G3% = minimum horizontal cursor coordinate
\r
569 G4% = maximum horizontal cursor coordinate
\r
574 110 ' Enable Cursor in Horizontal Range between 100 to 200
\r
576 130 G2% = 100 : G3% = 200
\r
577 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
579 Function 8: Define Vertical (Y) Range of Cursor Location
\r
581 Function 8 defines the vertical range of the cursor on-screen. As a result,
\r
582 cursor movement is limited to this specified area. If a cursor happens to be
\r
583 outside of this area when a call is made, the cursor is moved to just inside the
\r
588 CX = minimum vertical cursor coordinate
\r
589 DX = maximum vertical cursor coordinate
\r
594 G3% = minimum vertical cursor coordinate
\r
595 G4% = maximum vertical cursor coordinate
\r
603 110 ' Enable Cursor in Vertical Range between 100 to 200
\r
605 130 G2% = 100 : G3% = 200
\r
606 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
608 Function 9: Define Graphics Mode Cursor Style
\r
610 Function 9 defines the style of the cursor in terms of color, shape, and center
\r
611 for the graphics. As mentioned before, this cursor is a 16-by-16 pixel block
\r
612 and is defined by two 16-bit arrays (the screen mask bit and the cursor mask
\r
613 bit). Cursor coordinates for the hot spot must be in the range of -16 to +16.
\r
616 BX = horizontal cursor hot spot
\r
617 CX = vertical cursor hot spot
\r
618 DX = pointer to screen and cursor mask
\r
623 G2% = horizontal cursor hot spot
\r
624 G3% = vertical cursor hot spot
\r
625 G4% = pointer to screen and cursor mask
\r
630 10 ' Define the screen mask
\r
632 30 cursor (0,0) = &HFFFF '1111111111111111
\r
633 40 cursor (1,0) = &HFFFF '1111111111111111
\r
634 50 cursor (2,0) = &HFFFF '1111111111111111
\r
635 60 cursor (3,0) = &HFFFF '1111111111111111
\r
636 70 cursor (4,0) = &HFFFF '1111111111111111
\r
637 80 cursor (5,0) = &HF00F '1111000000001111
\r
638 90 cursor (6,0) = &H0000 '0000000000000000
\r
639 100 cursor (7,0) = &H0000 '0000000000000000
\r
640 110 cursor (8,0) = &H0000 '0000000000000000
\r
641 120 cursor (9,0) = &H0000 '0000000000000000
\r
642 130 cursor (10,0) = &HF00F '1111000000001111
\r
643 140 cursor (11,0) = &HFFFF '1111111111111111
\r
644 150 cursor (12,0) = &HFFFF '1111111111111111
\r
645 160 cursor (13,0) = &HFFFF '1111111111111111
\r
646 170 cursor (14,0) = &HFFFF '1111111111111111
\r
647 180 cursor (15,0) = &HFFFF '1111111111111111
\r
649 200 ' Define the cursor mask
\r
661 220 cursor (0,1) = &H0000 '0000000000000000
\r
662 230 cursor (1,1) = &H0000 '0000000000000000
\r
663 240 cursor (2,1) = &H0000 '0000000000000000
\r
664 250 cursor (3,1) = &H0000 '0000000000000000
\r
665 260 cursor (4,1) = &H0000 '0000000000000000
\r
666 270 cursor (5,1) = &H0000 '0000000000000000
\r
667 280 cursor (6,1) = &H07E0 '0000011111100000
\r
668 290 cursor (7,1) = &H7FFE '0111111111111110
\r
669 300 cursor (8,1) = &H7FFE '0111111111111110
\r
670 310 cursor (9,1) = &H07E0 '0000011111100000
\r
671 320 cursor (10,1) = &H0000 '0000000000000000
\r
672 330 cursor (11,1) = &H0000 '0000000000000000
\r
673 340 cursor (12,1) = &H0000 '0000000000000000
\r
674 350 cursor (13,1) = &H0000 '0000000000000000
\r
675 360 cursor (14,1) = &H0000 '0000000000000000
\r
676 370 cursor (15,1) = &H0000 '0000000000000000
\r
678 390 ' Set the cursor style and hot spot number of Genius Mouse
\r
682 430 G2% = 6 ' horizontal hot spot
\r
683 440 G3% = 5 ' vertical hot spot
\r
684 450 CALL GMOUSE ( G1%, G2%, G3%, cursor (0,0))
\r
686 Function 10: Define Text Mode Cursor Style
\r
688 Function 10 chooses the hardware or the software text cursor.
\r
690 For example, if BX (G2%) is 1, the hardware cursor is selected and the hardware
\r
691 is set up with the first and last scan lines which define the cursor.
\r
692 (Values for CX (G3%) and DX (G4%) range from 0 to 7 for the color display and 0
\r
693 to 11 for the monochrome display.)
\r
695 If BX (G2%) is 0, the software cursor is selected; and CX (G3%) and DX (G4%)
\r
696 must specify the screen and cursor masks. (These masks give the attributes and
\r
697 character code of the cursor, and their values are dependent on the type of
\r
702 BX = select cursor (0: software text, 1: hardware text)
\r
703 CX = screen mask value/scan line start
\r
704 DX = cursor mask value/scan line stop
\r
709 G2% = select cursor (0: software text, 1: hardware text)
\r
710 G3% = screen mask value/scan line start
\r
711 G4% = cursor mask value/scan line stop
\r
721 110 ' Enable an Inverting Cursor
\r
724 140 G3% = &HFFFF : G4% = &H7700
\r
725 150 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
727 Function 11: Read Genius Mouse Motion Number
\r
729 Function 11 gives the mouse motion number since the last call. A positive
\r
730 horizontal number indicates rightward movement (negative shows leftward
\r
731 movement). A positive vertical number indicates downward movement (negative
\r
732 shows upward movement).
\r
733 The number is always in the range of -32768 to 32767. Overflow is disregarded.
\r
734 Once the call is completed, the number is set to 0.
\r
738 Return: CX = horizontal number
\r
739 DX = vertical number
\r
743 Return: G3% = horizontal number
\r
744 G4% = vertical number
\r
748 110 ' Read Genius Mouse Motion Number
\r
750 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
751 140 IF G3% > 0 THEN PRINT "Genius Mouse is Moving to Right"
\r
752 150 IF G4% > 0 THEN PRINT "Genius Mouse is Moving Down"
\r
754 Function 12: Define Event Handler Entry Location
\r
756 Function 12 defines the address entry location of an event handler routine which
\r
757 is called when a certain event (defined by the call mask) occurs. The program
\r
758 is temporarily interrupted by the mouse driver. At the end of the event handler
\r
759 routine the program continues at the point it was interrupted.
\r
761 The call mask is a single integer value defining the conditions which will cause
\r
764 A specific condition corresponds to a bit in the call mask:
\r
767 --------------------------------------------------
\r
768 0 cursor location changed
\r
769 1 left button pressed
\r
770 2 left button released
\r
771 3 right button pressed
\r
772 4 right button released
\r
773 5 middle button pressed
\r
774 6 middle button released
\r
781 In order to call the event handler routine, set the mask bit to 1 and put the
\r
782 mask in at CX (G3%). To disable, set the mask bit to 0 and put the mask in at
\r
783 CX (G3%). Always be sure to set the call mask to 0 before the program finishes.
\r
784 (Leave the system in the same state upon exit as if was upon entrance.)
\r
789 ES:DX = pointer to event handler routine
\r
795 G4% = pointer to event handler routine
\r
801 110 ' Active BUTTDOWN Event Handler Routine, When One or More Buttons Pressed
\r
803 130 G3% = &H002A : G4% = BUTTDOWN%
\r
804 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
806 Function 13: Enable Light Pen Emulation Function
\r
808 Function 13 permits the mouse to act like a light pen. When in this mode, calls
\r
809 to the pen function will give the cursor coordinates at the last pen down
\r
812 Note that the status of "pen down" and "pen off-screen" is controlled by the
\r
813 mouse buttons: all buttons up, pen off-screen; one button pressed, pen down.
\r
815 Light pen emulation is ON after each call to function 0 (Reset Mouse Driver).
\r
827 110 ' Enable Light Pen Emulation Function
\r
829 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
831 Function 14: Disable Light Pen Emulation Function
\r
833 Function 14 turns off the light pen emulation mode. When disabled, any call to
\r
834 the pen function will give information only about a real light pen.
\r
849 110 ' Disable Light Pen Emulation Function
\r
851 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
853 Function 15: Define Sensitivity (Mouse Motion/Pixel) of Genius Mouse
\r
855 Function 15 defines mouse sensitivity as determined by the mouse motion/pixel
\r
856 ratio. This is a way of setting the amount of cursor motion wanted for mouse
\r
857 movement. These ratios specify mouse motion per 8 pixels. These values must
\r
858 be in the range of 1 to 32767. With a larger ratio, the cursor movement is
\r
859 shortened for each mouse movement.
\r
861 Default values: horizontal ratio - 8 mouse motions to 8 pixels
\r
862 vertical ratio - 16 mouse motions to 8 pixels
\r
864 Note: 1 mouse motion = 1/200 of an inch increment
\r
868 CX = horizontal mouse motion counts to pixel ratio
\r
869 DX = vertical mouse motion counts to pixel ratio
\r
874 G3% = horizontal mouse motion counts to pixel ratio
\r
875 G4% = vertical mouse motion counts to pixel ratio
\r
880 110 ' Define Horizontal Sensitivity as 8
\r
881 120 ' Define Vertical Sensitivity as 16
\r
885 160 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
887 Function 16: Disable Cursor Display in Special Range
\r
889 Function 16 sets up a special range on-screen. If the cursor moves to this area
\r
890 or is in this area, it will be disabled. After a call is made to this function,
\r
891 it is necessary to call function 1 to enable the cursor again.
\r
893 Define the special range with screen location values using four components:
\r
902 --------------------------------------------------------
\r
903 1 Left horizontal screen location
\r
904 2 Upper vertical screen location
\r
905 3 Right horizontal screen location
\r
906 4 Lower vertical screen location
\r
910 ES:DX = pointer to special range
\r
915 G4% = pointer to special range
\r
920 110 ' Disable Cursor Display in (0,0) to (100,100) Range
\r
922 130 RANGE%(1) = 0 : RANGE%(2) = 0
\r
923 140 RANGE%(3) = 100 : RANGE%(4) = 100
\r
924 150 CALL GMOUSE ( G1%, G2%, G3%, RANGE%(0) )
\r
929 500 ' Enable Cursor Display Again
\r
931 520 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
933 Function 19: Define Double-Speed Threshold
\r
935 Function 19 defines the threshold value (mouse motion per second) for doubling
\r
936 the cursor's motion. Should the mouse move faster than the DX (G4%) value, the
\r
937 cursor motion doubles. The default value is 64 mouse motions per second.
\r
939 If you should want to disable double-speed, just set the threshold to 32767
\r
940 (7FFFH) mouse motions/second.
\r
944 DX = threshold speed in mouse motions/second
\r
949 G4% = threshold speed in mouse motions/second
\r
954 110 ' Define Double-Speed Threshold as 20 Mouse Motions/Second
\r
963 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
968 500 ' Disable Double-Speed Threshold Function
\r
970 520 G4% = 256 'MAX. VALUE
\r
971 530 CALL GMOUSE ( G1%, G2%, G3%, G4% )
\r
973 Function 20: Swap Event Handler Entry Location
\r
975 Function 20 sets new values for the call mask and event handler routine
\r
976 address for mouse hardware interrupts and return the values that were
\r
977 previously specified.
\r
979 For detail information to reference Function 12 description.
\r
984 ES:DX = new pointer to event handler routine
\r
985 Return: CX = old call mask
\r
986 ES:DX = old pointer to event handler routine
\r
991 G4% = pointer to event handler routine
\r
992 Return: G3% = old call mask
\r
993 G4% = old pointer to event handler routine
\r
997 100 ' Swap Event Handler Entry Location
\r
998 110 ' Active BUTTDOWN Event Handler Routine, When One or More Buttons Pressed
\r
1000 130 G3% = &H002A : G4% = BUTTDOWN%
\r
1001 140 CALL MOUSE ( G1%, G2%, G3%, G4% )
\r
1003 Function 21: Get Mouse Driver State Storage Size
\r
1005 Function 21 returns the size of the buffer required to store the current state
\r
1006 of the mouse driver. It is used with functions 22 and 23 when you want to
\r
1007 temporarily interrupt a program that is using the mouse and execute another
\r
1008 that also uses the mouse.
\r
1013 Return: BX = buffer size required for mouse driver state
\r
1021 Return: G2% = buffer size required for mouse driver state
\r
1025 110 ' Get Mouse Driver State Storage Size
\r
1027 130 CALL MOUSE ( G1%, G2%, G3%, G4% )
\r
1028 140 STATESIZE% = G2%
\r
1030 Function 22: Save Mouse Driver state
\r
1032 Function 22 saves the current mouse driver state in a buffer allocated by your
\r
1033 program. It is used with functions 21 and 23 when you want to temporarily
\r
1034 interrupt a program that is using the mouse and execute another program that
\r
1035 also uses the mouse.
\r
1037 Before your program calls function 22, the program should call function 21 to
\r
1038 determine the buffer size required for saving the mouse driver state, then
\r
1039 allocate the appropriate amount of memory.
\r
1043 ES:DX = pointer to the buffer
\r
1048 G4% = pointer to the buffer
\r
1053 110 ' Save The Mouse Driver State
\r
1056 140 ' Assume BUFPTR contains the address of the buffer
\r
1057 150 CALL MOUSE ( G1%, G2%, G3%, G4% )
\r
1059 Function 23: Restore Mouse Driver State
\r
1061 Function 23 restores the last mouse driver state saved by function 22. It is
\r
1062 used with functions 21 and 22 when you want to temporarily interrupt a program
\r
1063 that is using the mouse and execute another program that also uses the mouse.
\r
1064 To restore the mouse driver state saved by function 22, call function 23 at the
\r
1065 end of the interrupt program.
\r
1069 ES:DX = pointer to the buffer
\r
1074 G4% = pointer to the buffer
\r
1081 110 ' Restore The Mouse Driver State
\r
1084 140 ' Assume BUFPTR contains the address of the buffer
\r
1085 150 CALL MOUSE ( G1%, G2%, G3%, G4% )
\r
1087 Function 29: Set CRT Page Number
\r
1089 Function 29 specifies the CRT page on which the mouse cursor will be displayed.
\r
1091 For information on the number of CRT pages available in each display mode your
\r
1092 adapter supports, see the documentation that came with the graphics adapter.
\r
1096 BX = CRT page for mouse cursor display
\r
1101 G2% = CRT page for mouse cursor display
\r
1106 110 ; Set CRT page 2 for display mouse cursor
\r
1109 140 CALL MOUSE ( G1%, G2%, G3%, G4% )
\r
1114 500 ; Enable Cursor Display Again
\r
1116 520 CALL MOUSE ( G1%, G2%, G3%, G4% )
\r
1118 Function 30: Read CRT Page Number
\r
1120 Function 30 returns the number of the CRT page on which the mouse cursor is
\r
1126 Return: BX = CRT page number of current cursor display
\r
1131 Return: G2% = CRT page number of current cursor display
\r
1135 110 ; Read CRT page number
\r
1137 130 CALL MOUSE ( G1%, G2%, G3%, G4% )
\r
1141 *** 7 : USING GENIUS MOUSE WITH IBM ENHANCED GRAPHICS ADAPTER
\r
1143 Within the Genius Mouse driver, you'll find nine EGA functions. These functions
\r
1144 permit your program to write to and read from write-only registers.
\r
1146 The cursor in use is defined as a monochrome cursor with one bit per pixel. The
\r
1147 bit masks are determined by function 9 and apply to all active planes.
\r
1149 In order to make an EGA function call from an Assembly-Language program, first
\r
1150 load the AX, BX, CX, DX, and ES registers with the values indicated for the
\r
1151 parameters. Note that five values must be given for a high level language
\r
1152 program. Next, execute software interrupt 16 (10h). The values that are
\r
1153 returned are intalled in the registers by EGA functions.
\r
1155 Upon start with DOS, PC BIOS will verify if the EGA BIOS exists. When this is
\r
1156 verified, the PC will execute the EGA BIOS, booting up the program to write the
\r
1157 INT 10h entry vector to the address of the INT 42h vector. Now, EGA BIOS
\r
1158 address will be written to INT 10h. Following this, you are able to call EGA
\r
1159 BIOS (by using INT 10h) and PC video BIOS (by using INT 42h).
\r
1161 There are twenty functions in EGA BIOS. (PC BIOS has only 16.) The EGA BIOS
\r
1162 routines only intercept the BIOS ROM video routines (INT 10h, AH = 13h or less).
\r
1164 The following indicates nine EGA functions and the corresponding function
\r
1167 Function Number (HEX)
\r
1168 -----------------------------------------------------------------
\r
1169 Retrieve Single Data F0
\r
1170 Save Single Data F1
\r
1171 Retrieve Registers on a Specified Port F2
\r
1172 Save Registers on a Specified Port F3
\r
1173 Retrieve Several Registers Data F4
\r
1174 Save Several Registers Data F5
\r
1175 Reset All Registers as Initial Values F6
\r
1176 Set Initial Values F7
\r
1177 Get Version Number of Genius Mouse Driver FA
\r
1179 In the above functions, the EGA I/O port number and address are as follows:
\r
1181 Port No. Register Name No. of Registers Index No. Address Select Register
\r
1182 ------------------------------------------------------------------------------
\r
1183 00H CRT Controller 25 0 - 24 3x4H
\r
1184 08H Sequencer 5 0 - 4 3C4H
\r
1185 10H Graphics Controller 9 0 - 8 3CEH
\r
1186 18H Attribute Controlle 20 0 - 19 3C0H
\r
1187 Singular Registers
\r
1188 20H Miscellaneous Output 1 ignored 3C2H
\r
1189 28H Feature Control 1 ignored 3xAH
\r
1190 30H Graphics 1 Position 1 ignored 3CCH
\r
1191 38H Graphics 2 Position 1 ignored 3CAH
\r
1193 Note: x = B or D depending on the base I/O address;
\r
1194 determined by Miscellaneous Output Register bit 1.
\r
1201 Function F0: Retrieve Single Data
\r
1203 This function retrieves data from a single register.
\r
1208 Return: BL = Retrieved data from EGA register
\r
1213 FUN_F0 EQU 0f0H ; Function F0
\r
1215 GR_CONTR EQU 010H ; Graphics Controller
\r
1216 MODE_REG EQU 005H ; Mode Regisiter
\r
1218 GR1_PORT EQU 030H ; Graphics 1 Position Register
\r
1219 GR2_PORT EQU 038H ; Graphics 2 Position Register
\r
1221 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
\r
1223 ; Retrieve the Mode Register in Graphics Controller
\r
1233 ; Retrieve Graphics 1 Position Data
\r
1242 Function F1: Save Single Data
\r
1244 This function saves data to an EGA register. Upon finishing a call to this
\r
1245 function, the BH and DX values are altered.
\r
1248 BL = Index number (Non-single register only)
\r
1249 = Data (Single register only)
\r
1250 BH = Data (Non-single register only)
\r
1251 = Disregard (Single register only)
\r
1261 FUN_F1 EQU 0f1H ; Function F1
\r
1263 SEQUENCE EQU 008H ; Sequencer
\r
1264 MASK_REG EQU 002H ; Map Mask Register
\r
1266 FEAT_PORT EQU 028H ; Feature Control Register
\r
1268 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
\r
1270 ; Save Map Mask Register of Sequencer
\r
1281 ; Save Feature Control Register
\r
1290 Function F2: Retrieve Registers on a Specified Port
\r
1292 This function retrieves data from registers on a specifiã port. Upon finishing
\r
1293 a call to this function, the CX value is altered.
\r
1296 CH = Starting index number
\r
1297 CL = Number of registers
\r
1299 ES:BX = Destination of returned data
\r
1300 Return: Returned data to destination address
\r
1304 FUN_F2 EQU 0f2H ; Function F2
\r
1306 GR_CONTR EQU 010H ; Graphics Controller
\r
1308 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
\r
1311 ; Retrieve Four Registers Data from Graphics Controller
\r
1312 GRAPH_POOL DB 04 DUP (0)
\r
1322 MOV BX, OFFSET GRAPH_POOL
\r
1327 Function F3: Save Registers on a Specified Port
\r
1329 This function saves data from registers on a specifiã port. Upon finishing a
\r
1330 call to this function, the BX, CX, and DX values are altered.
\r
1333 CH = Starting index number
\r
1334 CL = Number of register
\r
1336 ES:BX = Address source of incoming data
\r
1341 FUN_F3 EQU 0f3H ; Function F3
\r
1343 ATTR_CONTR EQU 018H ; Attribute Controller
\r
1345 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
\r
1348 ; Save Four Registers Data into Attribute Controller
\r
1349 PALET_DATA DB 1, 2, 4, 3
\r
1354 MOV DX, ATTR_CONTR
\r
1355 MOV BX, OFFSET PALET_DATA
\r
1360 Function F4: Retrieve Several Registers Data At The Same Time
\r
1362 This function retrieves data from several registers at the same time. Upon
\r
1363 finishing a call to this function, the CX value is altered.
\r
1366 CX = Number of registers (more than 1)
\r
1367 ES:BX = Address of register packet (each consists of 4 bytes;
\r
1368 port address, byte 1-2; index number, byte 3;
\r
1369 returned data, byte 4)
\r
1370 Return: Returned data is saved into byte 4
\r
1374 FUN_F4 EQU 0f4H ; Function F4
\r
1376 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
\r
1381 ; Retrieve Follow Registers Data
\r
1382 TABLE DW 030H ; Graphics 1 Position Register
\r
1383 DB 00 ; Single Register
\r
1384 DB 00 ; Retrieved Data
\r
1386 DW 010H ; Graphics Controller
\r
1387 DB 05 ; Mode Register
\r
1388 DB 00 ; Retrieved Data
\r
1394 MOV BX, OFFSET TABLE
\r
1400 Function F5: Save Several Registers Data At The Same Time
\r
1402 This function saves data from several registers at the same time. Upon
\r
1403 finishing a call to this function, the CX value is altered.
\r
1406 CX = Number of registers (more than 1)
\r
1407 ES:BX = Address of register packet (each consists of 4 bytes;
\r
1408 port number, byte 1-2; index number, byte 3;
\r
1409 output data, byte 4)
\r
1414 FUN_F5 EQU 0f5H ; Function F5
\r
1416 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
\r
1418 ; Save Follow Registers Data
\r
1419 TABLE DW 20H ; Miscellaneous
\r
1420 DB 00 ; Single Register
\r
1423 DW 18H ; Attribute Controller
\r
1424 DB 12H ; Color Plane Enable
\r
1431 MOV BX, OFFSET TABLE
\r
1441 Function F6: Reset All Registers as Initial Values
\r
1443 This function resets all values to default values for the specific registers.
\r
1444 Function 7 sets the default values.
\r
1451 FUN_F6 EQU 0f6H ; Function F6h
\r
1453 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
\r
1458 Function F7: Set Initial Values
\r
1460 This function sets the initial default values. Upon finishing a call to this
\r
1461 function, the BX and DX values are altered.
\r
1465 ES:BX = Table of output data
\r
1470 FUN_F7 EQU 0f7H ; Function F7
\r
1472 ATTR_CONTR EQU 018H ; Attribute Controller
\r
1474 VIDEO EQU 010H ; BIOS ROM Video Routine Entry
\r
1476 ; Setting Initial Values for the Attribute Controller
\r
1477 ATTR_DATA DB 1, 2, 4, 3, 5, 6, 0, 7
\r
1478 DB 0, 0, 0, 0, 0, 0, 0, 0
\r
1484 MOV DX, ATTR_CONTR
\r
1485 MOV BX, OFFSET ATTR_DATA
\r
1489 Function FA: Get Version Number of Genius Mouse Driver
\r
1491 This function will give the Genius Mouse driver version number.
\r
1495 Return: ES:BX = Pointer to Genius Mouse driver version number.
\r