E N D
SET 19 PROGRAMMING THE MOUSE
Mouse Features • All mouse operations within a program are performed by standard INT 33H functions of the form: MOV AX, function ; request mouse function ... ; set arguments, if any INT 33h ; call mouse driverNote that INT 33h functions are loaded in the full AX register (not just AH).
00h: Initialize the mouse The First mouse function used in a program to initialize the mouse. Input: AX = 0
00h: Initialize the mouse (Cont.) • Operations performed by mouse initialization: • Sets mouse pointer to center screen • Conceals mouse pointer, if visible • Sets mouse pointer according to screen mode • (text or graphics)
01h:Display Mouse Pointer Input: AX = 01hOutput: none This function causes the mouse pointer to be displayed. The mouse driver uses a counter to determine whether or not to display the mouse.
01h: display the mouse (Cont.) • If counter >= 0 display the mouse • Otherwise, do not display the mouse • When the mouse is initialized, the counter is set to -1. • Function 01h increments the counter (making it zero) to display the mouse.
Ued to conceal the mouse pointer. Decrements the counter (making it -1). Input: AX = 02hOutput: none 02h: Conceal Mouse Pointer • Used to conceal the mouse • pointer. Decrements the counter (making it -1). • Input: AX = 02hOutput: none • Do not use fn. 1 to display the mouse when it is already displayed or fn. 2 to conceal the mouse when it already concealed. Otherwise if, for instance, you employ fn. 2 three times to conceal the mouse, then you will have to use fn. 1 three times to display it
03h: Get Button Status and Pointer Location • Gets current button status and pointer location. • Input: AX = 03hOutput: BX = Button status • bit 0 = left button (0 = up, 1 = down) • bit 1 = right button (0 = up, 1 = down) • CX = horizontal position * 2 (x coordinate*2)DX = vertical position (y coordinate) • Note: For some reason CX supplies twice times the X coord.
04h: Set Pointer Location Use this operation to set the horizontal and vertical coordinates for the mouse pointer on the screen (the values for the location are in terms of pixels). Input: AX = 04h CX = horizontal location*2 (Note again, double the X coord) DX = vertical location