INT33 Mouse System call in DOS
MS DOS is non-graphical command line based operating system. However it supports mouse interfacing system calls. Mouse support is provided by an application called MOUSE.COM. Mouse is widely used in graphical applications and in games. DOS implements mouse interfacing subsystem through software interrupt INT 0x33 call. Below are the list of subroutines under this interrupt vector.
- 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 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 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
Mouse programming library in C
Mouse programming library is a collection of APIs to interface mouse subsystem. These routines are implemented using C with the help of int86 calls.
Mouse detect system calls
detect_mouse() - Detect if mouse driver loaded in DOS.
Show mouse pointer
show_mouse() - In this function AX is set to "1". When this function is called in main() it displays the mouse pointer. The position of the pointer can be changed by using the mouse.
Hide mouse pointer
hide_mouse() - In this function AX is set to "2".When this function is called in main() it hides the mouse pointer. This function is useful while drawing figures, first the mouse pointer is kept hidden, then the figure is been drawn and again the mouse pointer is been called.
Get mouse position and button status
get_mouse_status() - In this function AX is set to "3". This function returns the position of the mouse pointer. It contains three parameters,they are xpos,ypos,click. xpos and ypos returns the position of x co-ordinate and y co-ordinate respectively. Click is the integer variable which returns the values 1,2,3 corresponding to the button pressed on the mouse and 0 for buttons being not pressed. If any key is pressed kbhit returns nonzero integer; if not it returns zero.
Set mouse pointer position
set_mouse_pos() - In this function AX is set to "4". This function sets the mouse pointer to specific position . CX is been loaded by x co-ordinate of the mouse pointer and DX is been loaded with the y co-ordinate of the mouse pointer.
Set horizontal limits for pointer
set_mouse_hlimits() - In this function AX is set to "7". This function sets horizontal boundary of mouse. CX is been loaded by lower x co-ordinate boundary of the mouse pointer and DX is been loaded with the higher x co-ordinate boundary.
Set vertical limits for pointer
set_mouse_vlimits()- In this function AX is set to "8". This function sets vertical boundary of mouse. CX is been loaded by lower y co-ordinate boundary of the mouse pointer and DX is been loaded with the higher y co-ordinate boundary.
Mouse interfacing C code
Let us see a basic mouse demo program to test all of the above interfaces. We can copy these routines in a file named as mouse_library.c and compile along with mouse.c file.
Text mode mouse program
This demo application checks if mouse driver is present or not. Once it gets a success it switches to VGA/graphics mode and calls mouse show function. It sets the mouse position to the middle of the screen and later retrieves
Graphics mouse programThis demo application checks if mouse driver is present or not. Once it gets a success it switches to VGA/graphics mode and calls mouse show function. It sets the mouse position to the middle of the screen and later retrieves
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Draw on printer Free alt softwares