SET 19 PROGRAMMING THE MOUSE. Mouse Features All mouse operations within a program are performed by...

10
SET 19 PROGRAMMING THE MOUSE

Transcript of SET 19 PROGRAMMING THE MOUSE. Mouse Features All mouse operations within a program are performed by...

Page 1: 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.

SET 19

PROGRAMMING THE MOUSE

Page 2: 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.

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 driver

Note that INT 33h functions are loaded in the full AX register (not just AH).

Page 3: 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.

00h: Initialize the mouse

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

   

Page 4: 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.

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)

Page 5: 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.

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.

Page 6: 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.

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.

Page 7: 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.

02h:  Conceal Mouse Pointer

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

1).• Input:    AX = 02h

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

Ued to conceal the mouse pointer.  Decrements the counter (making it -1).

Input:    AX = 02h

Output:   none

Page 8: 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.

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.

Page 9: 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.

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

Page 10: 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.

Textbook Reading (Jones): None