home *** CD-ROM | disk | FTP | other *** search
-
- NOTES ON USING MOUSE
-
- First a little backgound on the mouse. According to the Microsoft mouse
- users guide, the mouse supports IBM CGA, EGA, Mono, 3270 and Hercules
- graphics adapters. I have not had a chance to test these routines on all of
- these type of monitors, but have tested them on CGA, and some of the routines
- on Hercules. I will be able to finish checking all the routines on the
- hercules shortly, but do not anticipate any problems. The mouse driver
- software automatically senses the character cell size of different video
- modes. In text mode, the mouse will always give the characters upper left
- pixel as the position. For example, on a CGA card in 80 column mode, the
- character cells are 8 pixels by 8 pixels. If the mouse cursor is at
- 10,5 (starting from 0,0) the mouse will give the position 80,40.
-
- The mouse uses 3 types of cursors:
-
- graphics cursor-a shape that moves over the images on the screen.
-
- software text cursor-a character attribute that moves from
- character to character.
-
- hardware text cursor - a flashing block or partial block that
- moves from character to character.
-
- The graphics cursor is used in graphics mode. Usually, it is
- defined as a block of pixels in a 16 x 16 pixel area. The mouse cursor's
- appearance against the background depends on the mask used. The default
- appearance in graphics mode is an arrow. Mouse function 9 let's you change
- the mask. The mask is defined in an array of 32 integers, the first 16
- defining the screen mask, and the second 16 defining the cursor mask.
- This table from the users guide shows the effects of the masks.
-
- SCREEN MASK CURSOR MASK RESULTING SCREEN BIT
- 0 0 0
- 0 1 1
- 1 0 Unchanged
- 1 1 Inverted
-
- When defining a graphics cursor, you also define a hot spot, meaning the
- individual pixel that the mouse software will use in determining its
- location.
-
- The software text cursor also has a mask defining its effect on the
- screen. The screen mask determines which of the characters attributes
- are preserved. The cursor mask defines how the attributes are changed
- to show the cursor. The 16 bits of each mask are:
-
- 15- set blinking or nonblinking
- 14-12 background color
- 11 intensity
- 10-8 foreground color
- 7-0 ascii value of char
-
- The mouse can also use the hardware cursor in text mode, in which case
- you can define the start/stop scan lines, to display a partial of full
- block blinking cursor. The number of scan lines depends on the type
- of video display.
-
- The mouse software keeps some internal counters. It increments a seperate
- counter each time a button is pressed or released, resetting them to 0
- after they have been read or after function 0, initialization. It also
- keeps an internal cursor flag, which is always 0 or less. When the flag
- is 0 the mouse cursor is displayed. Each call to hide the cursor decrements
- the flag. Thus if you call Function 2 twice, you must call Function 1
- twice to get it to show again.
-
- The mouse measures distance in values called mickey's. A mickey is
- approximately 1/200th of an inch. There are functions which let you change
- the mickey/pixel ration (how far you have to move the
- mouse to move the same distance on the screen) and to change the speed
- doubling threshold (Default 64 mickeys/second).
-
-
- SPECIAL NOTES:
- For the mouse graphics cursor to show on a hercules graphics board, my
- understanding is that you have to poke 6 into location 40:49 hex for
- page 0, or a 5 for page 1. I have not had a chance to test it yet,
- but that is the information I got from the Microsoft forum on CIS.
-
- | When printing to or updating the screen while the mouse cursor is showing,
- | the mouse sometimes has problems not obliterating your changes when it moves
- | away after you wrote directly across where the mouse cursor was. It is
- | usually best to hide the cursor momentarily while you update the screen.
- | sure is slow this way though.
-
- MOUSE FUNCTIONS
- ---------------
-
- Function 0
- Initializes the mouse software to its defaults,:
- cursor in the center of the screen,
- internal cursor flag -1 (not showing),
- graphics cursor/arrow, -1, -1 hot spot
- text cursor an inverting box,
- horizontal mickey/pixel ratio of 8:8,
- vertical mickey/pixel ratio of 16:8
- minimum and maximum horizontal and vertical positions usually the entire
- screen.
-
- Returns 0 if mouse software not installed.
- Returns 2 if MS-DOS version < 2.0
-
-
- Function 1
- Show the cursor. Increments the internal cursor flag.
-
-
- Function 2
- Hide the cursor. Decrements the internal cursor flag.
-
-
- Function 3
- Get mouse position and status.
- gives button status and current position.
- status: 1=left button pressed, 2=right, 3=both
-
-
- Function 4
- Position the mouse on the screen. It wants the pixel coordinates, not just
- character positions.
-
-
- Function 5
- Gets the current status of the button,(0=left,1=right,2=center)
- and the number of times the button was pressed since the last call to this
- function. Also returns the position of the mouse the last time the button
- was pressed.
-
-
- Function 6
- Like function 5, but checks button releases instead.
-
-
- Function 7
- Set the left and right limits for the mouse to travel.
-
-
- Function 8
- Set the top and bottom limits for the mouse to travel.
-
-
- Function 9
- Sets the graphics cursor's hot spot and mask which defines what the
- graphics cursor will look like. The cursor hot spot must be within
- the range -16 to +16 pixels relative to the cursor. The mask values
- could be something like:
-
- int xmask[32]={0x07e0,0x0000,0x0180,0x700e,0x0000,0x1c38,0xc003,0x0660,
- 0xf00f,0x03c0,0xc003,0x0660,0x0000,0x1c38,0x0180,0x700e,
- 0x07e0,0x0000,0xffff,0x0000,0xffff,0x0000,0xffff,0x0000,
- 0xffff,0x0000,0xffff,0x0000,0xffff,0x0000,0xffff,0x0000 };
-
- defines a graphics cursor like an x. See the reference earlier in this
- file for the table of the mask values effects on the screen.
-
-
- Function 10
- sets the mouse text cursor to hardware or software cursor mode. The first
- integer defines the mode, 0= use software cursor, 1=use hardware cursor.
- The second 2 integers define either the screen and cursor masks (software
- mode) or the start and stop scan lines of the hardware cursor.
- Typical mask values might be 0,0xFFFF,0x7700.
-
-
- Function 11
- This function reads the motion counters since the last call to this function.
- Returns the motion in "mickeys", always within the range of -32768 to +32767.
-
-
- Function 12
- This function sets a subroutine to be conditionally called by the mouse
- software. The condition of execution is defined by the mask.
-
- Bit 0 cursor position changes
- 1 left button pressed
- 2 left button released
- 3 right button pressed
- 4 right button released
- 5 center button pressed
- 6 center button released
- 7-15 unused
-
- To disable an interrupt for a specified condition, call function again
- with the corresponding bit set to zero. Calling mouse Function 0 also
- resets everything.
-
- The subroutine to be called must be a far procedure, must save all
- registers, and must not do any dos or bios calls.
-
-
- Functions 13,14
- These functions turn the light pen emulation mode on or off. I don't know
- of any programs that use light pen emulation, but the functions were easy
- to implement and included for completeness. A zero parameter turns on
- emulation, any other parameter turns it off.
-
-
- Function 15
- Sets the mickey / pixel ratio vertically and horizontally. Default values
- are horizontal 8 mickeys to 8 pixels, vertically 16 to 8.
-
-
- Function 16
- This function is similar to Function 2, but only turns off the cursor
- if it is in the area defined when this function is called. If this function
- hides the cursor, Function 1 must be called again later on to show the
- cursor again.
-
-
- Function 19
- This function sets how fast the mouse must move before its relative cursor
- movements on the screen are doubled. Default value is 64 mickeys per second.