SET 19 PROGRAMMING THE MOUSE Mouse Features All

  • Slides: 10
Download presentation
SET 19 PROGRAMMING THE MOUSE

SET 19 PROGRAMMING THE MOUSE

Mouse Features • All mouse operations within a program are performed by standard INT

Mouse Features • All mouse operations within a program are performed by standard INT 33 H functions of the form: MOV AX, function. . . INT 33 h ; request mouse function ; set arguments, if any ; call mouse driver Note that INT 33 h functions are loaded in the full AX register (not just AH).

00 h: Initialize the mouse The First mouse function used in a program to

00 h: Initialize the mouse The First mouse function used in a program to initialize the mouse. Input: AX = 0

00 h: Initialize the mouse (Cont. ) Operations performed by mouse initialization: • Sets

00 h: 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)

01 h: Display Mouse Pointer Input: Output: AX = 01 h none This function

01 h: Display Mouse Pointer Input: Output: AX = 01 h 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.

01 h: display the mouse (Cont. ) • If counter >= 0 display the

01 h: 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 01 h increments the counter (making it zero) to display the mouse.

 • Used to conceal the mouse • pointer. Decrements the counter (making it

• Used to conceal the mouse • pointer. Decrements the counter (making it 1). • Input: AX = 02 h Output: 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 U e d t o c o n c e a l t h 02 h: Conceal Mouse Pointer

03 h: Get Button Status and Pointer Location Gets current button status and pointer

03 h: Get Button Status and Pointer Location Gets current button status and pointer location. Input: Output: AX = 03 h 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.

04 h: Set Pointer Location Use this operation to set the horizontal and vertical

04 h: 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 = 04 h CX = horizontal location*2 (Note again, double the X coord) DX = vertical location

Textbook Reading (Jones): None

Textbook Reading (Jones): None