]> 4ch.mooo.com Git - 16.git/blob - 16/PCGPE10/GMOUSE.DOC
modified: 16/DOS_GFX.OBJ
[16.git] / 16 / PCGPE10 / GMOUSE.DOC
1              PROGRAMMER'S  REFERENCE  FOR  GENIUS  MOUSE  DRIVER\r
2 \r
3 *** 1 : BRIEF DESCRIPTION\r
4 \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
8 \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
11 \r
12 *** 2 : GRAPHICS AND TEXT CURSORS\r
13 \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
20 images.\r
21 \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
25 \r
26 \r
27 Display the Graphics Cursor\r
28 \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
39 \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
43 \r
44 Refer to function 9.\r
45 \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
50 operation.\r
51 \r
52 Note the results when:\r
53 \r
54 \r
55 \r
56 \r
57 \r
58 \r
59                                  page 1\r
60 \f\r
61 Screen Mask Bit is      Cursor Mask Bit is      Resulting Screen Bit is\r
62 ------------------      ------------------      -----------------------\r
63         0                        0                         0\r
64         0                        1                         1\r
65         1                        0                     unchanged\r
66         1                        1                      inverted\r
67 \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
71 hot spot.\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
74 coordinates.)\r
75 \r
76 Software Text Cursor\r
77 \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
89 \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
94 \r
95 When a function refers to the text cursor location, it gives the coordinates of\r
96 the character beneath the cursor.\r
97 \r
98 Refer  to function 10.\r
99 \r
100 Hardware Text Cursor\r
101 \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
110 \r
111 Refer to function 10.\r
112 \r
113 *** 2.1 : Mouse Buttons\r
114 \r
115 \r
116 \r
117 \r
118 \r
119                                  page 2\r
120 \f\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
124 button is up.\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
130 a reset.\r
131 \r
132 *** 2.2 : Unit of Distance - Mouse Motion\r
133 \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
136 \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
142 \r
143 Refer to function 15.\r
144 \r
145 *** 2.3 : Internal Cursor Flag\r
146 \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
150 \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
153 previous value.\r
154 \r
155 Refer to functions 1 and 2.\r
156 \r
157 *** 3 : CALLING FROM ASSEMBLY LANGUAGE PROGRAMS\r
158 \r
159 To make mouse function calls:\r
160 \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
165 \r
166 Example:\r
167 \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
173 \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
178 \r
179                                  page 3\r
180 \f\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
184 \r
185 *** 4 : CALLING FROM BASIC LANGUAGE PROGRAM\r
186 \r
187 To make  mouse function calls:\r
188 \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
191 \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
194 \r
195 10 DEF SEG = 0\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
200 \r
201 To enter the mouse driver, use the CALL statement:\r
202 \r
203   CALL GMOUSE (G1%, G2%, G3%, G4%)\r
204 \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
209 \r
210 Example:\r
211 \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
218 \r
219 *** 5 : MOUSE FUNCTIONS\r
220 \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
223 \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
238 \r
239                                  page 4\r
240 \f\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
253 \r
254 EGA functions are described in Section *** 7.\r
255 \r
256 *** 6 : DESCRIPTION OF THE MOUSE FUNCTIONS\r
257 \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
263 \r
264 The input and return values are presented for 8086 registers and for BASIC in\r
265 the following pages.\r
266 \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
270 \r
271 Function 0: Reset Genius Mouse Driver\r
272 \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
276 \r
277 This function resets the mouse driver to the following default status as\r
278 indicated:\r
279 \r
280 Variable                                Value\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
291 \r
292 8086 Register\r
293 Input:  AX = 0\r
294 Return: AX = mouse state (-1: installed, 0: not installed)\r
295         BX = number of buttons (2 button mode, 3 button mode)\r
296 \r
297 \r
298 \r
299                                  page 5\r
300 \f\r
301 BASIC\r
302 Input:  G1% = 0\r
303 Return: G1% = mouse state (-1: installed, 0: not installed)\r
304         G2% = number of buttons (2 button mode, 3 button mode)\r
305 \r
306 Example:  Used initially to determine if the GMOUSE driver is present and to\r
307           reset GMOUSE.\r
308 \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
315 \r
316 Function 1: Enable Cursor Display\r
317 \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
320 \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
324 \r
325 8086 Register\r
326 Input:  AX = 1\r
327 Return: none\r
328 \r
329 BASIC\r
330 Input:  G1% = 1\r
331 Return: none\r
332 \r
333 Example:\r
334 \r
335 110  ' Enable Genius Mouse's Cursor\r
336 120  G1% = 1\r
337 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
338 \r
339 Function 2: Disable Cursor Display\r
340 \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
344 \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
347 screen data.\r
348 \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
353 displayed.\r
354 \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
357 \r
358 \r
359                                  page 6\r
360 \f\r
361 8086 Register\r
362 Input:  AX = 2\r
363 Return: none\r
364 \r
365 BASIC\r
366 Input:  G1% = 2\r
367 Return: none\r
368 \r
369 Example:\r
370 \r
371 110  ' Disable Genius Mouse's Cursor\r
372 120  G1% = 2\r
373 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
374 \r
375 Function 3: Read Cursor Location & Button State of Genius Mouse\r
376 \r
377 Function 3 gives the status of mouse buttons, plus cursor location.\r
378 \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
383 \r
384 The bit is 1 when the button is pressed.  The bit is 0 when the button is\r
385 released.\r
386 \r
387 8086 Register\r
388 Input:  AX = 3\r
389 Return: BX = button status\r
390         CX = horizontal cursor coordinate\r
391         DX = vertical cursor coordinate\r
392 \r
393 BASIC\r
394 Input:  G1% = 3\r
395 Return: G2% = button status\r
396         G3% = horizontal cursor coordinate\r
397         G4% = vertical cursor coordinate\r
398 \r
399 Example:\r
400 \r
401 110  ' Read Genius Mouse Location & Button State\r
402 120  G1% = 3\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
409 \r
410 Function 4: Set Cursor Location of Genius Mouse\r
411 \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
415 \r
416 \r
417 \r
418 \r
419                                  page 7\r
420 \f\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
438 \r
439 Display Adapter:\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
445 \r
446 8086 Register\r
447 Input:  AX = 4\r
448         CX = new horizontal cursor coordinate\r
449         DX = new vertical cursor coordinate\r
450 Return: none\r
451 \r
452 BASIC\r
453 Input:  G1% = 4\r
454         G3% = new horizontal cursor coordinate\r
455         G4% = new vertical cursor coordinate\r
456 Return: none\r
457 \r
458 Example:\r
459 \r
460 110  ' Set Cursor Location at the Upper_Left Corner of Screen\r
461 120 G1% = 4\r
462 130 G3% = 0 : G4% = 0\r
463 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
464 \r
465 Function 5: Read Button Press State of Genius Mouse\r
466 \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
469 button press.\r
470 \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
475 \r
476 The bit is 1 when the button is pressed.  The bit is 0 when the button is\r
477 released.\r
478 \r
479                                  page 8\r
480 \f\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
483 to zero.\r
484 \r
485 8086 Register\r
486 Input:  AX = 5\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
492 \r
493 BASIC\r
494 Input:  G1% = 5\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
500 \r
501 Example:\r
502 \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
507 \r
508 Function 6: Read Button Release State of Genius Mouse\r
509 \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
513 \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
518 \r
519 The bit is 1 when the button is pressed.  The bit is 0 when the button is\r
520 released.\r
521 \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
524 reset to zero.\r
525 \r
526 8086 Register\r
527 Input:  AX = 6\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
533 \r
534 BASIC\r
535 Input:  G1% = 6\r
536         G2% = button status (left = 0, right = 1, middle = 2)\r
537 \r
538 \r
539                                  page 9\r
540 \f\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
545 \r
546 Example:\r
547 \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
552 \r
553 Function 7: Define Horizontal (X) Range of Cursor Location\r
554 \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
558 area.\r
559 \r
560 8086 Register\r
561 Input:  AX = 7\r
562         CX = minimum horizontal cursor coordinate\r
563         DX = maximum horizontal cursor coordinate\r
564 Return: none\r
565 \r
566 BASIC\r
567 Input:  G1% = 7\r
568         G3% = minimum horizontal cursor coordinate\r
569         G4% = maximum horizontal cursor coordinate\r
570 Return: none\r
571 \r
572 Example:\r
573 \r
574 110 ' Enable Cursor in Horizontal Range between 100 to 200\r
575 120 G1% = 7\r
576 130 G2% = 100 : G3% = 200\r
577 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
578 \r
579 Function 8: Define Vertical (Y) Range of Cursor Location\r
580 \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
584 area.\r
585 \r
586 8086 Register\r
587 Input:  AX = 8\r
588         CX = minimum vertical cursor coordinate\r
589         DX = maximum vertical cursor coordinate\r
590 Return: none\r
591 \r
592 BASIC\r
593 Input:  G1% = 8\r
594         G3% = minimum vertical cursor coordinate\r
595         G4% = maximum vertical cursor coordinate\r
596 Return: none\r
597 \r
598 \r
599                                  page 10\r
600 \f\r
601 Example:\r
602 \r
603 110 ' Enable Cursor in Vertical Range between 100 to 200\r
604 120 G1% = 8\r
605 130 G2% = 100 : G3% = 200\r
606 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
607 \r
608 Function 9: Define Graphics Mode Cursor Style\r
609 \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
614 8086 Register\r
615 Input:  AX = 9\r
616         BX = horizontal cursor hot spot\r
617         CX = vertical cursor hot spot\r
618         DX = pointer to screen and cursor mask\r
619 Return: none\r
620 \r
621 BASIC\r
622 Input:  G1% = 9\r
623         G2% = horizontal cursor hot spot\r
624         G3% = vertical cursor hot spot\r
625         G4% = pointer to screen and cursor mask\r
626 Return: none\r
627 \r
628 Example:\r
629 \r
630 10  ' Define the screen mask\r
631 20  '\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
648 190 '\r
649 200 ' Define the cursor mask\r
650 210 '\r
651 \r
652 \r
653 \r
654 \r
655 \r
656 \r
657 \r
658 \r
659                                  page 11\r
660 \f\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
677 380 '\r
678 390 ' Set the cursor style and hot spot number of Genius Mouse\r
679 400 '\r
680 410 '\r
681 420   G1% = 9\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
685 \r
686 Function 10: Define Text Mode Cursor Style\r
687 \r
688 Function 10 chooses the hardware or the software text cursor.\r
689 \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
694 \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
698 display in use.)\r
699 \r
700 8086 Register\r
701 Input:  AX = 10\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
705 Return: none\r
706 \r
707 BASIC\r
708 Input:  G1% = 10\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
712 Return: none\r
713 \r
714 Example:\r
715 \r
716 \r
717 \r
718 \r
719                                  page 12\r
720 \f\r
721 110 ' Enable an Inverting Cursor\r
722 120 G1% = 10\r
723 130 G2% = 0\r
724 140 G3% = &HFFFF  :  G4% = &H7700\r
725 150 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
726 \r
727 Function 11: Read Genius Mouse Motion Number\r
728 \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
735 \r
736 8086 Registers\r
737 Input:  AX = 11\r
738 Return: CX = horizontal number\r
739         DX = vertical number\r
740 \r
741 BASIC\r
742 Input:  G1% = 11\r
743 Return: G3% = horizontal number\r
744         G4% = vertical number\r
745 \r
746 Example:\r
747 \r
748 110 ' Read Genius Mouse Motion Number\r
749 120 G1% = 11\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
753 \r
754 Function 12: Define Event Handler Entry Location\r
755 \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
760 \r
761 The call mask is a single integer value defining the conditions which will cause\r
762 an interrupt.\r
763 \r
764 A specific condition corresponds to a bit in the call mask:\r
765 \r
766 Mask Bit                Condition\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
775    7 - 15               not used\r
776 \r
777 \r
778 \r
779                                  page 13\r
780 \f\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
785 \r
786 8086 Register\r
787 Input:  AX = 12\r
788         CX = call mask\r
789         ES:DX = pointer to event handler routine\r
790 Return: none\r
791 \r
792 BASIC\r
793 Input:  G1% = 12\r
794         G3% = call mask\r
795         G4% = pointer to event handler routine\r
796 Return: none\r
797 \r
798 Example:\r
799 \r
800 \r
801 110 ' Active BUTTDOWN Event Handler Routine, When One or More Buttons Pressed\r
802 120 G1% = 12\r
803 130 G3% = &H002A  :  G4% = BUTTDOWN%\r
804 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
805 \r
806 Function 13: Enable Light Pen Emulation Function\r
807 \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
810 location.\r
811 \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
814 \r
815 Light pen emulation is ON after each call to function 0 (Reset Mouse Driver).\r
816 \r
817 8086 Register\r
818 Input:  AX = 13\r
819 Return: none\r
820 \r
821 BASIC\r
822 Input:  G1% = 13\r
823 Return: none\r
824 \r
825 Example:\r
826 \r
827 110 ' Enable Light Pen Emulation Function\r
828 120 G1% = 13\r
829 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
830 \r
831 Function 14: Disable Light Pen Emulation Function\r
832 \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
835 \r
836 8086 Register\r
837 Input:  AX = 14\r
838 \r
839                                  page 14\r
840 \f\r
841 Return: none\r
842 \r
843 BASIC\r
844 Input:  G1% = 14\r
845 Return: none\r
846 \r
847 Example:\r
848 \r
849 110 ' Disable Light Pen Emulation Function\r
850 120 G1% = 14\r
851 130 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
852 \r
853 Function 15: Define Sensitivity (Mouse Motion/Pixel) of Genius Mouse\r
854 \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
860 \r
861 Default values:   horizontal ratio - 8  mouse motions to 8 pixels\r
862                   vertical ratio   - 16 mouse motions to 8 pixels\r
863 \r
864 Note: 1 mouse motion = 1/200 of an inch increment\r
865 \r
866 8086 Register\r
867 Input:  AX = 15\r
868         CX = horizontal mouse motion counts to pixel ratio\r
869         DX = vertical mouse motion counts to pixel ratio\r
870 Return: none\r
871 \r
872 BASIC\r
873 Input:  G1% = 15\r
874         G3% = horizontal mouse motion counts to pixel ratio\r
875         G4% = vertical mouse motion counts to pixel ratio\r
876 Return: none\r
877 \r
878 Example:\r
879 \r
880 110 ' Define Horizontal Sensitivity as 8\r
881 120 ' Define Vertical Sensitivity as 16\r
882 130 G1% = 15\r
883 140 G3% =  8\r
884 150 G4% = 16\r
885 160 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
886 \r
887 Function 16: Disable Cursor Display in Special Range\r
888 \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
892 \r
893 Define the special range with screen location values using four components:\r
894 \r
895 \r
896 \r
897 \r
898 \r
899                                  page 15\r
900 \f\r
901 Components          Values\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
907 \r
908 8086 Register\r
909 Input:  AX = 16\r
910         ES:DX = pointer to special range\r
911 Return: none\r
912 \r
913 BASIC\r
914 Input:  G1% = 16\r
915         G4% = pointer to special range\r
916 Return: none\r
917 \r
918 Example:\r
919 \r
920 110 ' Disable Cursor Display in (0,0) to (100,100) Range\r
921 120 G1% = 16\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
925  .\r
926  .\r
927  .\r
928 \r
929 500 ' Enable Cursor Display Again\r
930 510 G1% = 1\r
931 520 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
932 \r
933 Function 19: Define Double-Speed Threshold\r
934 \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
938 \r
939 If you should want to disable double-speed, just set the threshold to 32767\r
940 (7FFFH) mouse motions/second.\r
941 \r
942 8086 Register\r
943 Input:  AX = 19\r
944         DX = threshold speed in mouse motions/second\r
945 Return: none\r
946 \r
947 BASIC\r
948 Input:  G1% = 19\r
949         G4% = threshold speed in mouse motions/second\r
950 Return: none\r
951 \r
952 Example:\r
953 \r
954 110 ' Define Double-Speed Threshold as 20 Mouse Motions/Second\r
955 \r
956 \r
957 \r
958 \r
959                                  page 16\r
960 \f\r
961 120 G1% = 19\r
962 130 G4% = 20\r
963 140 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
964 .\r
965 .\r
966 .\r
967 \r
968 500 ' Disable Double-Speed Threshold Function\r
969 510 G1% = 19\r
970 520 G4% = 256 'MAX. VALUE\r
971 530 CALL GMOUSE ( G1%, G2%, G3%, G4% )\r
972 \r
973 Function 20: Swap Event Handler Entry Location\r
974 \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
978 \r
979 For detail information to reference Function 12 description.\r
980 \r
981 8086 Register\r
982 Input:  AX = 20\r
983         CX = new call mask\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
987 \r
988 BASIC\r
989 Input:  G1% = 20\r
990         G3% = call mask\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
994 \r
995 Example:\r
996 \r
997 100 ' Swap Event Handler Entry Location\r
998 110 ' Active BUTTDOWN Event Handler Routine, When One or More Buttons Pressed\r
999 120 G1% = 20\r
1000 130 G3% = &H002A  :  G4% = BUTTDOWN%\r
1001 140 CALL MOUSE ( G1%, G2%, G3%, G4% )\r
1002 \r
1003 Function 21: Get Mouse Driver State Storage Size\r
1004 \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
1009 \r
1010 8086 Register\r
1011 Input:  AX = 21\r
1012 \r
1013 Return: BX = buffer size required for mouse driver state\r
1014 \r
1015 BASIC\r
1016 Input:  G1% = 21\r
1017 \r
1018 \r
1019                                  page 17\r
1020 \f\r
1021 Return: G2% = buffer size required for mouse driver state\r
1022 \r
1023 Example:\r
1024 \r
1025 110 ' Get Mouse Driver State Storage Size\r
1026 120 G1% = 21\r
1027 130 CALL MOUSE ( G1%, G2%, G3%, G4% )\r
1028 140 STATESIZE% = G2%\r
1029 \r
1030 Function 22: Save Mouse Driver state\r
1031 \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
1036 \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
1040 \r
1041 8086 Register\r
1042 Input:  AX = 22\r
1043         ES:DX = pointer to the buffer\r
1044 Return: None\r
1045 \r
1046 BASIC\r
1047 Input:  G1% = 22\r
1048         G4% = pointer to the buffer\r
1049 Return: None\r
1050 \r
1051 Example:\r
1052 \r
1053 110 ' Save The Mouse Driver State\r
1054 120 G1% = 22\r
1055 130 G4% =  BUFPTR\r
1056 140 ' Assume BUFPTR contains the address of the buffer\r
1057 150 CALL MOUSE ( G1%, G2%, G3%, G4% )\r
1058 \r
1059 Function 23: Restore Mouse Driver State\r
1060 \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
1066 \r
1067 8086 Register\r
1068 Input:  AX = 23\r
1069         ES:DX = pointer to the buffer\r
1070 Return: None\r
1071 \r
1072 BASIC\r
1073 Input:  G1% = 23\r
1074         G4% = pointer to the buffer\r
1075 Return: None\r
1076 \r
1077 Example:\r
1078 \r
1079                                  page 18\r
1080 \f\r
1081 110 ' Restore The Mouse Driver State\r
1082 120 G1% = 23\r
1083 130 G4% =  BUFPTR\r
1084 140 ' Assume BUFPTR contains the address of the buffer\r
1085 150 CALL MOUSE ( G1%, G2%, G3%, G4% )\r
1086 \r
1087 Function 29: Set CRT Page Number\r
1088 \r
1089 Function 29 specifies the CRT page on which the mouse cursor will be displayed.\r
1090 \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
1093 \r
1094 8086 Register\r
1095 Input:  AX = 29\r
1096         BX = CRT page for mouse cursor display\r
1097 Return: none\r
1098 \r
1099 BASIC\r
1100 Input:  G1% = 29\r
1101         G2% = CRT page for mouse cursor display\r
1102 Return: none\r
1103 \r
1104 Example:\r
1105 \r
1106 110 ; Set CRT page 2 for display mouse cursor\r
1107 120 G1% = 29\r
1108 130 G2% = 2\r
1109 140 CALL MOUSE ( G1%, G2%, G3%, G4% )\r
1110  .\r
1111  .\r
1112  .\r
1113 \r
1114 500 ; Enable Cursor Display Again\r
1115 510 G1% = 1\r
1116 520 CALL MOUSE ( G1%, G2%, G3%, G4% )\r
1117 \r
1118 Function 30: Read CRT Page Number\r
1119 \r
1120 Function 30 returns the number of the CRT page on which the mouse cursor is\r
1121 displayed.\r
1122 \r
1123 8086 Register\r
1124 Input:  AX = 30\r
1125 \r
1126 Return: BX = CRT page number of current cursor display\r
1127 \r
1128 BASIC\r
1129 Input:  G1% = 30\r
1130 \r
1131 Return: G2% = CRT page number of current cursor display\r
1132 \r
1133 Example:\r
1134 \r
1135 110 ; Read CRT page number\r
1136 120 G1% = 30\r
1137 130 CALL MOUSE ( G1%, G2%, G3%, G4% )\r
1138 \r
1139                                  page 19\r
1140 \f\r
1141 *** 7 : USING GENIUS MOUSE WITH IBM ENHANCED GRAPHICS ADAPTER\r
1142 \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
1145 \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
1148 \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
1154 \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
1160 \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
1163 \r
1164 The following indicates nine EGA functions and the corresponding function\r
1165 number:\r
1166 \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
1178 \r
1179 In the above functions, the EGA I/O port number and address are as follows:\r
1180 \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
1192 \r
1193   Note: x = B or D depending on the base I/O address;\r
1194         determined by Miscellaneous Output Register bit 1.\r
1195 \r
1196 \r
1197 \r
1198 \r
1199                                  page 20\r
1200 \f\r
1201 Function F0: Retrieve Single Data\r
1202 \r
1203 This function retrieves data from a single register.\r
1204 \r
1205 Input:  AH = F0H\r
1206         BX = Index number\r
1207         DX = Port number\r
1208 Return: BL = Retrieved data from EGA register\r
1209 \r
1210 \r
1211 Example:\r
1212 \r
1213 FUN_F0     EQU     0f0H         ; Function F0\r
1214 ;\r
1215 GR_CONTR   EQU     010H         ; Graphics Controller\r
1216 MODE_REG   EQU     005H         ; Mode Regisiter\r
1217 ;\r
1218 GR1_PORT   EQU     030H         ; Graphics 1 Position Register\r
1219 GR2_PORT   EQU     038H         ; Graphics 2 Position Register\r
1220 ;\r
1221 VIDEO      EQU     010H         ; BIOS ROM Video Routine Entry\r
1222 \r
1223            ; Retrieve the Mode Register in Graphics Controller\r
1224 MODE_REG   DB      00\r
1225            ;\r
1226            MOV     DX, GR_CONTR\r
1227            MOV     BX, MODE_REG\r
1228            MOV     AH, FUN_F0\r
1229            INT     VIDEO\r
1230            MOV     MODE_REG, BL\r
1231 \r
1232 \r
1233            ; Retrieve Graphics 1 Position Data\r
1234 GR1_POS    DB      00\r
1235            ;\r
1236            MOV     DX, GR1_POS\r
1237            MOV     AH, FUN_F0\r
1238            INT     VIDEO\r
1239            MOV     GR1_POS, NL\r
1240 \r
1241 \r
1242 Function F1: Save Single Data\r
1243 \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
1246 \r
1247 Input:  AH = F1H\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
1252         DX = Port number\r
1253 Return: None\r
1254 \r
1255 \r
1256 Example:\r
1257 \r
1258 \r
1259                                  page 21\r
1260 \f\r
1261 FUN_F1     EQU     0f1H         ; Function F1\r
1262 ;\r
1263 SEQUENCE   EQU     008H         ; Sequencer\r
1264 MASK_REG   EQU     002H         ; Map Mask Register\r
1265 ;\r
1266 FEAT_PORT  EQU     028H         ; Feature Control Register\r
1267 ;\r
1268 VIDEO      EQU     010H         ; BIOS ROM Video Routine Entry\r
1269 \r
1270            ; Save Map Mask Register of Sequencer\r
1271 MAP_MASK   EQU     03H\r
1272            ;\r
1273            MOV     DX, SEQUENCE\r
1274            MOV     BL, MASK_REG\r
1275            MOV     BH, MAP_MASK\r
1276            MOV     AH, FUN_F1\r
1277            INT     VIDEO\r
1278            MOV     MAP_MASK, BL\r
1279 \r
1280 \r
1281            ; Save Feature Control Register\r
1282 FEATURE    DB      02H\r
1283            ;\r
1284            MOV     DX, FEAT_PORT\r
1285            MOV     BL, FEATURE\r
1286            MOV     AH, FUN_F1\r
1287            INT     VIDEO\r
1288            MOV     FEATURE, BL\r
1289 \r
1290 Function F2: Retrieve Registers on a Specified Port\r
1291 \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
1294 \r
1295 Input:  AH = F3H\r
1296         CH = Starting index number\r
1297         CL = Number of registers\r
1298         DX = Port number\r
1299         ES:BX = Destination of returned data\r
1300 Return: Returned data to destination address\r
1301 \r
1302 Example:\r
1303 \r
1304 FUN_F2     EQU     0f2H         ; Function F2\r
1305 ;\r
1306 GR_CONTR   EQU     010H         ; Graphics Controller\r
1307 ;\r
1308 VIDEO      EQU     010H         ; BIOS ROM Video Routine Entry\r
1309 \r
1310 \r
1311            ; Retrieve Four Registers Data from Graphics Controller\r
1312 GRAPH_POOL DB      04   DUP (0)\r
1313            ;\r
1314            MOV     DX, DS\r
1315            MOV     ES, DX\r
1316            ;\r
1317 \r
1318 \r
1319                                  page 22\r
1320 \f\r
1321            MOV     DX, GR_CONTR\r
1322            MOV     BX, OFFSET GRAPH_POOL\r
1323            MOV     CX, 04H\r
1324            MOV     AH, FUN_F2\r
1325            INT     VIDEO\r
1326 \r
1327 Function F3: Save Registers on a Specified Port\r
1328 \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
1331 \r
1332 Input:  AH = F3H\r
1333         CH = Starting index number\r
1334         CL = Number of register\r
1335         DX = Port number\r
1336         ES:BX = Address source of incoming data\r
1337 Return: None\r
1338 \r
1339 Example:\r
1340 \r
1341 FUN_F3     EQU     0f3H         ; Function F3\r
1342 ;\r
1343 ATTR_CONTR EQU     018H         ; Attribute Controller\r
1344 ;\r
1345 VIDEO      EQU     010H         ; BIOS ROM Video Routine Entry\r
1346 \r
1347 \r
1348            ; Save Four Registers Data into Attribute Controller\r
1349 PALET_DATA DB      1, 2, 4, 3\r
1350            ;\r
1351            MOV     DX, DS\r
1352            MOV     ES, DX\r
1353            ;\r
1354            MOV     DX, ATTR_CONTR\r
1355            MOV     BX, OFFSET PALET_DATA\r
1356            MOV     CX, 08\r
1357            MOV     AH, FUN_F3\r
1358            INT     VIDEO\r
1359 \r
1360 Function F4: Retrieve Several Registers Data At The Same Time\r
1361 \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
1364 \r
1365 Input:  AH = F4H\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
1371 \r
1372 Example:\r
1373 \r
1374 FUN_F4     EQU     0f4H         ; Function F4\r
1375 ;\r
1376 VIDEO      EQU     010H         ; BIOS ROM Video Routine Entry\r
1377 \r
1378 \r
1379                                  page 23\r
1380 \f\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
1385             ;\r
1386             DW     010H         ; Graphics Controller\r
1387             DB      05          ; Mode Register\r
1388             DB      00          ; Retrieved Data\r
1389             ;\r
1390             ;\r
1391             MOV    DX, DS\r
1392             MOV    ES, DX\r
1393             ;\r
1394             MOV    BX, OFFSET TABLE\r
1395             MOV    CX, 02\r
1396             MOV    AH, FUN_F4\r
1397             INT    VIDEO\r
1398 \r
1399 \r
1400 Function F5: Save Several Registers Data At The Same Time\r
1401 \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
1404 \r
1405 Input:  AH = F5H\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
1410 Return: None\r
1411 \r
1412 Example:\r
1413 \r
1414 FUN_F5     EQU     0f5H         ; Function F5\r
1415 ;\r
1416 VIDEO      EQU     010H         ; BIOS ROM Video Routine Entry\r
1417 \r
1418             ; Save Follow Registers Data\r
1419 TABLE       DW      20H         ; Miscellaneous\r
1420             DB      00          ; Single Register\r
1421             DB      01          ; Data\r
1422             ;\r
1423             DW      18H         ; Attribute Controller\r
1424             DB      12H         ; Color Plane Enable\r
1425             DB      07H         ; Data\r
1426             ;\r
1427             ;\r
1428             MOV    DX, DS\r
1429             MOV    ES, DX\r
1430             ;\r
1431             MOV    BX, OFFSET TABLE\r
1432             MOV    CX, 02\r
1433             MOV    AH, FUN_F5\r
1434             INT    VIDEO\r
1435 \r
1436 \r
1437 \r
1438 \r
1439                                  page 24\r
1440 \f\r
1441 Function F6: Reset All Registers as Initial Values\r
1442 \r
1443 This function resets all values to default values for the specific registers.\r
1444 Function 7 sets the default values.\r
1445 \r
1446 Input:  AH = F6H\r
1447 Return: None\r
1448 \r
1449 Example:\r
1450 \r
1451 FUN_F6     EQU     0f6H         ; Function F6h\r
1452 ;\r
1453 VIDEO      EQU     010H         ; BIOS ROM Video Routine Entry\r
1454 \r
1455            MOV     AH, FUN_F6\r
1456            INT     VIDEO\r
1457 \r
1458 Function F7: Set Initial Values\r
1459 \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
1462 \r
1463 Input:  AH = F7H\r
1464         DX = Port number\r
1465         ES:BX = Table of output data\r
1466 Return: None\r
1467 \r
1468 Example:\r
1469 \r
1470 FUN_F7     EQU     0f7H         ; Function F7\r
1471 ;\r
1472 ATTR_CONTR EQU     018H         ; Attribute Controller\r
1473 ;\r
1474 VIDEO      EQU     010H         ; BIOS ROM Video Routine Entry\r
1475 \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
1479            DB      0,  0, 0fh, 0\r
1480            ;\r
1481            MOV     DX, DS\r
1482            MOV     ES, DX\r
1483            ;\r
1484            MOV     DX, ATTR_CONTR\r
1485            MOV     BX, OFFSET ATTR_DATA\r
1486            MOV     AH, FUN_F7\r
1487            INT     VIDEO\r
1488 \r
1489 Function FA: Get Version Number of Genius Mouse Driver\r
1490 \r
1491 This function will give the Genius Mouse driver version number.\r
1492 \r
1493 Input:  AH = FAH\r
1494         BX = 00H\r
1495 Return: ES:BX = Pointer to Genius Mouse driver version number.\r
1496 \r
1497 \r
1498 \r
1499                                  page 25\r
1500 \f\r
1501 \1a