Function 0 - Reset
PSS ID Number: Q19950
Article last modified on 06-23-1993
PSS database name: H_Mouse

3.x 4.x 5.x 6.x 7.x 8.x 9.00

MS-DOS


--------------------------------------------------------------------
The information in this article applies to:

 - Microsoft Mouse Driver for MS-DOS, versions 3.x, 4.x, 5.x, 6.x,
   7.x, 8.x, and 9.0
--------------------------------------------------------------------

Summary:

This article explains Mouse Function 00, which sets the Mouse Installed 
flag.

MOUSE FUNCTION 00

   Inputs: AX = 0

   Outputs: AX = 0000h/0 (FALSE)  --> hardware & software not installed
            AX = ffffh/-1 (TRUE)  --> installed
            BX = 2 (number of buttons)

Note: If AX = 0 on return from the interrupt, BX is meaningless. 

Calling function 0 sets the following default parameters: 

   Cursor Position                       screen center
   Internal cursor flag                  -1 (not displayed)
   Graphics cursor                       arrow (hot spot top left)
   Text cursor                           inverting box
   Interrupt call mask                   all 0 (no interrupts)
   Light Pen emulation mode              enabled
   Mickey/Pixel ratio (horizontal        8 to 8
   Mickey/Pixel ratio (vertical)         16 to 8
   Min/max cursor position (horizontal)  depends on card/mode
   Min/max cursor position (vertical)    depends on card/mode
    (these normally leave the Mouse at the center of the screen)
   Double speed threshold                64 mickeys/second

Note: It is a good idea to verify the following before calling Function 
0:

1. Get the interrupt 33h (51d) vector and make sure that it is not 
   pointing at location 0000:0000h (as it would if uninitialized under
   MS-DOS 2.x); also make sure it does not point at an IRET instruction. 

   An IRET instruction has a value of 207 decimal / cfh (one-byte 
   instruction).

2. The interrupt vector lies at address 0000:00cch - 0000:00cfh.

3. The interrupt segment is at 0000:00cch - 0000:00ceh

4. The interrupt offset is at 0000:00cch - 0000:00ceh

      0000:00cch = 204 decimal
      0000:00ceh = 206 decimal

NOTES:
-----

1. Microsoft recommends that you use MS-DOS interrupt 21h function GET 
   VECTOR, rather than reading the vector locations directly. 

2. Function 0 resets the hardware (serial mouse only) and some software 
   variables. It does not reinstall the hardware or verify that
   it exists. 

3. Function 0 may be called from a Function 12 subroutine; however, 
   the F12 routine should terminate as soon as possible after Function 
   0.

4. Issuing a Function 0 after the Mouse state has been saved (via
   Function 22) is not recommended because a subsequent Function 23
   (Restore State) cannot completely return the Mouse driver to its
   original context. Most significantly, Function 12 routines are
   eliminated if Function 0 is called, even if the Mouse state is 
   saved and restored. 

5. Since the cursor flag value is not available via any Mouse function
   (except for Function 0, which resets it to -1), applications that 
   need to have cursor Hide/Show status should track an external
   variable based upon the number of Hide and Show Cursor functions. 
   It is advisable that an application leave the Mouse cursor hidden 
   (-1) once upon exit. 

Additional reference words: zero mice function program 

Copyright Microsoft Corporation 1993.