1. Mice Reading
- Posted by Mathew Hounsell <mfh03 at UOW.EDU.AU>
May 31, 1999
-
Last edited Jun 01, 1999
--Message-Boundary-9180
Content-type: text/plain; charset=US-ASCII
Content-disposition: inline
Content-description: Attachment information.
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.
---- File information -----------
File: C_MOUSE.E
Date: 18 Oct 1997, 21:21
Size: 27909 bytes.
Type: Unknown
--Message-Boundary-9180
Content-type: Application/Octet-stream; name="C_MOUSE.E"; type=Unknown
2. Mice Reading
- Posted by Mathew Hounsell <mfh03 at UOW.EDU.AU>
May 31, 1999
-
Last edited Jun 01, 1999
I have included my mouse code and info on mouse interrupts.
This is my function for reading te mouses position...
It was written some time ago. I'm not sure if it's perfect.
global function get_mouse_pos()
sequence reg_list, vid_inf
object val
val = MS_NOMOUSE
if MS_INSTALLED then // If mouse was found
val = repeat(0,2) // Generate return
sequence
reg_list = repeat(0,10) // Generate Register sequence
vid_inf = video_config() // Get video info
reg_list[REG_AX] = #0003 // AX = 0003h
reg_list = dos_interrupt(#33,reg_list) // Interrupt
if vid_inf[VC_MODE] >= 4 and vid_inf[VC_MODE] != 7 then --graphics
val[1] = reg_list[REG_CX] // Prepare return result
val[2] = reg_list[REG_DX]
else -- text
val[1] = floor(reg_list[REG_DX] / 8) + 1 //Prepeare return result
val[2] = floor(reg_list[REG_CX] / 8) + 1
end if
end if
return val
end function
-------------------------
Sincerely,
Mathew Hounsell
mat.hounsell at excite.com
3. Mice Reading
- Posted by Mathew Hounsell <mfh03 at UOW.EDU.AU>
May 31, 1999
-
Last edited Jun 01, 1999
Mouse Function Calls
Complete set of interrupt functions and subfunctions.
Most of this information is retrieved from the shareware utility "HelpPC",
by David Jurgens (CIS 71270,2422).
Collected and uploaded to CIS/MSLANG by:
Ernest Vogelsinger, CIS PPN 100015,551.
03/04/93
----------------------------------------------------------------------
INT 33 - Mouse Function Calls
For more information see the following topics:
INT 33,0 Mouse Reset/Get Mouse Installed Flag
INT 33,1 Show Mouse Cursor
INT 33,2 Hide Mouse Cursor
INT 33,3 Get Mouse Position and Button Status
INT 33,4 Set Mouse Cursor Position
INT 33,5 Get Mouse Button Press Information
INT 33,6 Get Mouse Button Release Information
INT 33,7 Set Mouse Horizontal Min/Max Position
INT 33,8 Set Mouse Vertical Min/Max Position
INT 33,9 Set Mouse Graphics Cursor
INT 33,A Set Mouse Text Cursor
INT 33,B Read Mouse Motion Counters
INT 33,C Set Mouse User Defined Subroutine and Input Mask
INT 33,D Mouse Light Pen Emulation On
INT 33,E Mouse Light Pen Emulation Off
INT 33,F Set Mouse Mickey Pixel Ratio
INT 33,10 Mouse Conditional OFF
INT 33,13 Set Mouse Double Speed Threshold
INT 33,14 Swap interrupt subroutines
INT 33,15 Get mouse driver state and memory requirements
INT 33,16 Save mouse driver state
INT 33,17 Restore mouse driver state
INT 33,18 Set alternate subroutine call mask and address
INT 33,19 Get user alternate interrupt address
INT 33,1A Set mouse sensitivity
INT 33,1B Get mouse sensitivity
INT 33,1C Set mouse interrupt rate (InPort only)
INT 33,1D Set mouse CRT page
INT 33,1E Get mouse CRT page
INT 33,1F Disable mouse driver
INT 33,20 Enable mouse driver
INT 33,21 Reset mouse software
INT 33,22 Set language for messages
INT 33,23 Get language number
INT 33,24 Get driver version, mouse type & IRQ number
- function is specified in AX
- a mickey is 1/200 inches
- for additional information see your vendor documentation
- function number occupies all of AX rather than AH
Mouse functions can be broken down into the following classes:
Mouse Driver Control / Feedback Functions
INT 33,0 Mouse Reset/Get Mouse Installed Flag
INT 33,15 Get Mouse Driver State and Memory Requirements
INT 33,16 Save Mouse Driver State
INT 33,17 Restore Mouse Driver State
INT 33,1C Set Mouse Interrupt Rate (InPort only)
INT 33,1F Disable Mouse Driver
INT 33,20 Enable Mouse Driver
INT 33,21 Reset Mouse Software
INT 33,24 Get Driver Version, Mouse Type & IRQ Number
Mouse Cursor Control Functions
INT 33,1 Show Mouse Cursor
INT 33,2 Hide Mouse Cursor
INT 33,4 Set Mouse Cursor Position
INT 33,7 Set Mouse Horizontal Min/Max Position
INT 33,8 Set Mouse Vertical Min/Max Position
INT 33,9 Set Mouse Graphics Cursor
INT 33,A Set Mouse Text Cursor
INT 33,F Set Mouse Mickey Pixel Ratio
INT 33,10 Mouse Conditional OFF
INT 33,13 Set Mouse Double Speed Threshold
INT 33,1A Set Mouse Sensitivity
INT 33,1B Get Mouse Sensitivity
Mouse Button and Position Feedback Functions
INT 33,3 Get Mouse Position and Button Status
INT 33,5 Get Mouse Button Press Information
INT 33,6 Get Mouse Button Release Information
INT 33,B Read Mouse Motion Counters
Video Control and Feedback Functions
INT 33,1D Set Mouse CRT Page
INT 33,1E Get Mouse CRT Page
Mouse Interrupt Setup Functions
INT 33,C Set Mouse User Defined Subroutine and Input Mask
INT 33,14 Swap Interrupt Subroutines
Alternate Mouse Interrupt Setup Functions
INT 33,18 Set Alternate Subroutine Call Mask and Address
INT 33,19 Get User Alternate Interrupt Address
Light Pen Emulation Functions
INT 33,D Mouse Light Pen Emulation On
INT 33,E Mouse Light Pen Emulation Off
International Language Support Functions
INT 33,22 Set Language for Messages
INT 33,23 Get Language Number
INT 33,0 - Mouse Reset/Get Mouse Installed Flag
AX = 00
on return:
AX = 0000 mouse driver not installed
FFFF mouse driver installed
BX = number of buttons
- resets mouse to default driver values:
. mouse is positioned to screen center
. mouse cursor is reset and hidden
. no interrupts are enabled (mask = 0)
. double speed threshold set to 64 mickeys per second
. horizontal mickey to pixel ratio (8 to 8)
. vertical mickey to pixel ratio (16 to 8)
. max width and height are set to maximum for video mode
INT 33,1 - Show Mouse Cursor
AX = 01
returns nothing
- increments the cursor flag; the cursor is displayed if flag
is zero; default flag value is -1
INT 33,2 - Hide Mouse Cursor
AX = 02
returns nothing
- decrements cursor flag; hides cursor if flag is not zero
INT 33,3 - Get Mouse Position and Button Status
AX = 03
on return:
CX = horizontal (X) position (0..639)
DX = vertical (Y) position (0..199)
BX = button status:
|F-8|7|6|5|4|3|2|1|0| Button Status
| | | | | | | | +---- left button (1 = pressed)
| | | | | | | +----- right button (1 = pressed)
+------------------- unused
- values returned in CX, DX are the same regardless of video mode
INT 33,4 - Set Mouse Cursor Position
AX = 4
CX = horizontal position
DX = vertical position
returns nothing
- default cursor position is at the screen center
- the position must be within the range of the current video mode
- the position may be rounded to fit screen mode resolution
INT 33,5 - Get Mouse Button Press Information
AX = 5
BX = 0 left button
1 right button
on return:
BX = count of button presses (0-32767), set to zero after call
CX = horizontal position at last press
DX = vertical position at last press
AX = status:
|F-8|7|6|5|4|3|2|1|0| Button Status
| | | | | | | | +---- left button (1 = pressed)
| | | | | | | +----- right button (1 = pressed)
+------------------- unused
INT 33,6 - Get Mouse Button Release Information
AX = 6
BX = 0 left button
1 right button
on return:
BX = count of button releases (0-32767), set to zero after call
CX = horizontal position at last release
DX = vertical position at last release
AX = status
|F-8|7|6|5|4|3|2|1|0| Button status
| | | | | | | | +---- left button (1 = pressed)
| | | | | | | +----- right button (1 = pressed)
+------------------- unused
INT 33,7 - Set Mouse Horizontal Min/Max Position
AX = 7
CX = minimum horizontal position
DX = maximum horizontal position
returns nothing
- restricts mouse horizontal movement to window
- if min value is greater than max value they are swapped
INT 33,8 - Set Mouse Vertical Min/Max Position
AX = 8
CX = minimum vertical position
DX = maximum vertical position
returns nothing
- restricts mouse vertical movement to window
- if min value is greater than max value they are swapped
INT 33,9 - Set Mouse Graphics Cursor
AX = 9
BX = horizontal hot spot (-16 to 16)
CX = vertical hot spot (-16 to 16)
ES:DX = pointer to screen and cursor masks (16 byte bitmap)
returns nothing
- screen mask is AND'ed to screen Cursor Mask is XOR'ed
- bytes 0-7 form the screen mask bitmap
- bytes 8-F form the cursor mask bitmap
INT 33,A - Set Mouse Text Cursor
AX = 0A
BX = 00 software cursor
01 hardware cursor
CX = start of screen mask or hardware cursor scan line
DX = end of screen mask or hardware cursor scan line
returns nothing
INT 33,B - Read Mouse Motion Counters
AX = 0B
on return:
CX = horizontal mickey count (-32768 to 32767)
DX = vertical mickey count (-32768 to 32767)
- count values are 1/200 inch intervals (1/200 in. = 1 mickey)
INT 33,C - Set Mouse User Defined Subroutine and Input Mask
AX = 0C
ES:DX = far pointer to user interrupt
CX = user interrupt mask:
|F-5|4|3|2|1|0| user interrupt mask in CX
| | | | | +--- cursor position changed
| | | | +---- left button pressed
| | | +----- left button released
| | +------ right button pressed
| +------- right button released
+--------- unused
returns nothing
- routine at ES:DX is called if an event occurs and the
corresponding bit specified in user mask is set
- routine at ES:DX receives parameters in the following
registers:
AX = condition mask causing call
CX = horizontal cursor position
DX = vertical cursor position
DI = horizontal counts
SI = vertical counts
DS = mouse driver data segment
BX = button state:
|F-2|1|0|
| | +--- left button (1 = pressed)
| +---- right button (1 = pressed)
+------ unused
- initial call mask and user routine should be restore on exit
from user program
- user program may need to set DS to its own segment
- user routine should return via RETF instead of IRET
- see INT 33,14
INT 33,D - Mouse Light Pen Emulation On
AX = 0D
returns nothing
- turns on light pen emulation; the light pen is considered
down when both buttons are down; when both buttons are
up the pen is considered off screen
- see INT 33,E
INT 33,E - Mouse Light Pen Emulation Off
AX = 0E
returns nothing
- disables light pen emulation
- see INT 33,D
INT 33,F - Set Mouse Mickey Pixel Ratio
AX = 0F
CX = horizontal ratio (1..32767, default 8)
DX = vertical ratio (1..32767, default 16)
returns nothing
- sets the ratio between physical cursor movement (mickeys) and
screen coordinate changes
- CX and DX must be unsigned (high bit must be 0)
INT 33,10 - Mouse Conditional OFF
AX = 10h
CX = upper X screen coordinate
DX = upper Y screen coordinate
SI = lower X screen coordinate
DI = lower Y screen coordinate
returns nothing
- defines screen region for updating in which the mouse is hidden
if found these coordinates (INT 33,1 must be used to turn cursor
on again)
- see INT 33,1
INT 33,13 - Set Mouse Double Speed Threshold
AX = 13h
DX = threshold speed (mickeys per second, default 64)
returns nothing
- cursor speed is doubled when the cursor moves across the screen
at the threshold speed
INT 33,14 - Swap Interrupt Subroutines
AX = 14h
ES:DX = far pointer to user routine
CX = user interrupt mask:
|F-8|7|6|5|4|3|2|1|0| user interrupt mask in CX
| | | | | | | | +--- cursor position changed
| | | | | | | +---- left button pressed
| | | | | | +----- left button released
| | | | | +------ right button pressed
| | | | +------- right button released
+--------------- unused
on return:
CX = previous user interrupt mask
ES:DX = far pointer to previous user interrupt
- routine at ES:DX is called if an event occurs and the
corresponding bit specified in user mask is set
- routine at ES:DX receives parameters in the following
registers:
AX = condition mask causing call
CX = horizontal cursor position
DX = vertical cursor position
DI = horizontal counts
SI = vertical counts
DS = mouse driver data segment
BX = button state:
|F-2|1|0|
| | +--- left button (1 = pressed)
| +---- right button (1 = pressed)
+------ unused
- initial call mask and user routine should be restore on exit
from user program
- user program may need to set DS to its own segment
- see INT 33,C
INT 33,15 - Get Mouse Driver State and Memory Requirements
AX = 15h
on return
BX = buffer size need to hold current mouse state
- used before mouse functions 16h and 17h to determine memory
needed to save mouse state before giving up control of mouse
to another program
INT 33,16 - Save Mouse Driver State
AX = 16h
ES:DX = far pointer to mouse state save buffer
returns nothing
- used to save mouse information before relinquishing control
to another programs mouse handler
- see INT 33,15 INT 33,17
INT 33,17 - Restore Mouse Driver State
AX = 17h
ES:DX = far pointer to mouse state save buffer
returns nothing
- used to restore mouse information after regaining control
from another programs mouse handler
- see INT 33,15 INT 33,16
INT 33,18 - Set alternate subroutine call mask and address
AX = 18h
DX = offset to function
CX = user interrupt mask:
|F-8|7|6|5|4|3|2|1|0| user interrupt mask in CX
| | | | | | | | +--- alt key pressed during event
| | | | | | | +---- ctrl key pressed during event
| | | | | | +----- shift key pressed during event
| | | | | +------ right button up event
| | | | +------- right button down event
| | | +-------- left button up event
| | +--------- left button down event
| +---------- cursor moved
+------------ unused
- entire mask is set to zero when INT 33,0 is called
- up to three handlers may be defined with this call
- mask should be cleared before program exit
- when handler is called it receives parameters in the following
registers:
AX = condition mask causing call
CX = horizontal cursor position
DX = vertical cursor position
DI = horizontal counts
SI = vertical counts
DS = mouse driver data segment
BX = button state:
|F-2|1|0|
| | +--- left button (1 = pressed)
| +---- right button (1 = pressed)
+------ unused
INT 33,19 - Get User Alternate Interrupt Address
AX = 19h
CX = user interrupt call mask (see below)
on return:
BX:DX = user interrupt vector
CX = user interrupt call mask or zero if not found
|F-8|7|6|5|4|3|2|1|0| user interrupt mask in CX
| | | | | | | | +--- alt key pressed during event
| | | | | | | +---- ctrl key pressed during event
| | | | | | +----- shift key pressed during event
| | | | | +------ right button up event
| | | | +------- right button down event
| | | +-------- left button up event
| | +--------- left button down event
| +---------- cursor moved
+------------ unused
- returns vector to function defined by INT 33,18
- searches the event handlers defined by INT 33,18 for a routine
with a call mask matching CX
INT 33,1A - Set Mouse Sensitivity
AX = 1A
BX = horizontal coordinates per pixel (<= 100)
CX = vertical coordinates per pixel (<= 100)
DX = double speed threshold
returns nothing
- sets mouse sensitivity by setting the ratio of the mouse
coordinates per screen pixel
- provides same results as calls to both INT 33,F and INT 33,13
- these values are not reset by INT 33,0
INT 33,1B - Get Mouse Sensitivity
AX = 1B
on return:
BX = horizontal coordinates per pixel (<= 100)
CX = vertical coordinates per pixel (<= 100)
DX = double speed threshold
- returns mouse sensitivity information as the number of mouse
coordinates per screen pixel
INT 33,1C - Set Mouse Interrupt Rate (InPort only)
AX = 1C
BX = rate code
= 0 no interrupts
= 1 30 interrupts per second
= 2 50 interrupts per second
= 3 100 interrupts per second
= 4 200 interrupts per second
- work with the InPort mouse only
- sets the rate the mouse status is polled by the mouse driver
- faster rates provide better resolution but take away CPU time
- values in BX > 4 can cause unpredicatable results
INT 33,1D - Set Mouse CRT Page
AX = 1D
BX = CRT page number
returns nothing
- sets the CRT page which the mouse cursor is displayed
- see VIDEO PAGES
INT 33,1E - Get Mouse CRT Page
AX = 1E
on return:
BX = CRT page number cursor is displayed on
- see VIDEO PAGES
INT 33,1F - Disable Mouse Driver
AX = 1F
on return:
AX = 001F if successful
FFFF if error
ES:BX = previous INT 33 vector
- restores vectors for INT 10 and INT 71 (8088/86) or INT 74 (286+)
- INT 33 interrupt vector (software) is not affected
- use of the vector returned in ES:BX to restore the previous INT 33
vector can cause problems since it contains the value of INT 33
before the driver was installed; any other hooks into INT 33 set
after driver installation will not receive service
INT 33,20 - Enable Mouse Driver
AX = 20h
returns nothing
- reinstalls the mouse drivers interrupt vectors for INT 10 and
INT 71 (8088/86) and INT 74 (286/386)
- see INT 33,1F
INT 33,21 - Reset Mouse Software
AX = 21h
on return:
AX = 0021 mouse driver not installed
FFFF mouse driver installed
BX = 2 mouse driver installed
- similar to INT 33,0 but does not reset the mouse hardware or
display variables
- both AX and BX must be correct for successful reset
- interrupt routines set through INT 33,18 are preserved
- resets the mouse to the following defaults:
. mouse is positioned to screen center
. mouse cursor is reset and hidden
. no interrupts are enabled (mask = 0)
. double speed threshold set to 64 mickeys per second
. horizontal mickey to pixel ratio (8 to 8)
. vertical mickey to pixel ratio (16 to 8)
. max width and height are set to maximum for video mode
INT 33,22 - Set Language for Messages
AX = 22h
BX = language number (with /L switch value):
= 0 English n/a
= 1 French F
= 2 Dutch NL
= 3 German D
= 4 Swedish S
= 5 Finnish SF
= 6 Spanish E
= 7 Portuguese P
= 8 Italian I
returns nothing
- only works with international version of the mouse driver
- see INT 33,23
INT 33,23 - Get Language Number
AX = 23h
on return:
BX = language number (with /L switch value):
= 0 English n/a
= 1 French F
= 2 Dutch NL
= 3 German D
= 4 Swedish S
= 5 Finnish SF
= 6 Spanish E
= 7 Portuguese P
= 8 Italian I
- only works with international version of the mouse driver
- returns English (0) if not international version
- see INT 33,22
INT 33,24 - Get Driver Version, Mouse Type & IRQ Number
AX = 24h
on return:
BH = major version (see below)
BL = minor version (see below)
CH = mouse type:
= 1 bus mouse
= 2 serial mouse
= 3 InPort mouse
= 4 PS/2 mouse
= 5 Hewlett Packard mouse
CL = IRQ number:
= 0 PS/2
= 2 IRQ 2
= 5 IRQ 5
= 7 IRQ 7
- version 6.1 would be represented as BH = 06h, BL = 10h