38
Mouse Question #1 • Which INT number is used for the mouse?

Mouse Question #1 Which INT number is used for the mouse?

Embed Size (px)

Citation preview

Page 1: Mouse Question #1 Which INT number is used for the mouse?

Mouse Question #1

• Which INT number is used for the mouse?

Page 2: Mouse Question #1 Which INT number is used for the mouse?

Mouse Question#1

• Which INT number is used for the mouse?

33h

Page 3: Mouse Question #1 Which INT number is used for the mouse?

Question #1A

• Unlike DOS INT 21h, or BIOS INT10h, with the mouse BIOS functions, the function number is selected through the _________ register.

Page 4: Mouse Question #1 Which INT number is used for the mouse?

Question #1A

• Unlike DOS INT 21h, or BIOS INT10h, with the mouse BIOS functions, the function number is selected through the ____AL_____ register.

Page 5: Mouse Question #1 Which INT number is used for the mouse?

Question #2

• Write ASM statements that reset the mouse and get the mouse status.

Page 6: Mouse Question #1 Which INT number is used for the mouse?

Need to find out…

• Which INT 33h function handles resetting the mouse and getting the status?– Look at slides – Look in book – page 566-574

Page 7: Mouse Question #1 Which INT number is used for the mouse?

Resetting Mouse Returns

• If mouse is found,– AX = FFFFh– BX = number of mouse buttons

• If no mouse found,– AX = 0

Page 8: Mouse Question #1 Which INT number is used for the mouse?

Question #2 Solutions

Write ASM statements that reset the mouse and get the mouse status.

• Mov ax, 0 ;int 33h, function 0

• Int 33h ;status returned in ax

• Cmp ax, 0 ;if ax=0, mouse not available

Page 9: Mouse Question #1 Which INT number is used for the mouse?

Comments about resetting mouse

• If mouse is found: – It is centered on the screen– It’s display page is set to video page 0– It’s pointer is hidden– It’s mickey’s are set to pixels ratio– It’s speed is set to default values– It’s range of movement is set to the entire

screen area.

Page 10: Mouse Question #1 Which INT number is used for the mouse?

Question #3

• Which INT 33h function shows and hides the mouse pointer?

Page 11: Mouse Question #1 Which INT number is used for the mouse?

Question #3 Solutions

• Which INT 33h function shows and hides the mouse pointer?

Function 1 – show

Function 2 - hide

Page 12: Mouse Question #1 Which INT number is used for the mouse?

Question #4

• Write ASM statements that hide the mouse pointer.

Page 13: Mouse Question #1 Which INT number is used for the mouse?

Question #4

• Write ASM statements that hide the mouse pointer.

Mov ax, 2

Int 33h

Page 14: Mouse Question #1 Which INT number is used for the mouse?

Comments about mouse pointer

• Mouse driver keeps a counter – Incremented (if nonzero) by calls to function 1– Decremented by calls to function 2

• When counter is 0, pointer is displayed

• Function 0 (reset mouse pointer) sets counter to –1.

Page 15: Mouse Question #1 Which INT number is used for the mouse?

Question #5

• Which INT 33h function gets the mouse position and status?

Page 16: Mouse Question #1 Which INT number is used for the mouse?

Question #5

• Which INT 33h function gets the mouse position and status?

Function 3

Page 17: Mouse Question #1 Which INT number is used for the mouse?

Question #6

• Write ASM statements that get the mouse position and store it in the variables mouseX and mouseY.

Page 18: Mouse Question #1 Which INT number is used for the mouse?

Before Answering,Need to Know…..

• What is returned

• BX = mouse button status• If bit 0 is set, left button is down

• If bit 1 is set, right button is down

• If bit 2 is set, middle button is down

• CX = X-Coordinate

• DX = Y-Coordinate

Page 19: Mouse Question #1 Which INT number is used for the mouse?

Question #6 Solutions

• Write ASM statements that get the mouse position and store it in the variables mouseX and mouseY.

mov ax, 3int 33hmov mouseX, CXmov mouseY, DX

Page 20: Mouse Question #1 Which INT number is used for the mouse?

Question #7

• Which INT 33h function sets the mouse position?

Page 21: Mouse Question #1 Which INT number is used for the mouse?

Question #7

• Which INT 33h function sets the mouse position?

Function 4

Page 22: Mouse Question #1 Which INT number is used for the mouse?

Question #8

• Write ASM statements that set the mouse pointer to X=100 and Y = 400.

Page 23: Mouse Question #1 Which INT number is used for the mouse?

Before Answering Need to know…

What to send…

• CX = X-Coordinate

• DX = Y-Coordinate

Page 24: Mouse Question #1 Which INT number is used for the mouse?

Question #8

• Write ASM statements that set the mouse pointer to X=100 and Y = 400.

Mov ax, 4

mov cx, 100

mov dx, 400

int 33h

Page 25: Mouse Question #1 Which INT number is used for the mouse?

Question #9

• Which INT 33h function gets the mouse button press information?

Page 26: Mouse Question #1 Which INT number is used for the mouse?

Question #9

• Which INT 33h function gets the mouse button press information?

Function 5

Page 27: Mouse Question #1 Which INT number is used for the mouse?

Question #10

• Write ASM statements that jump to label Button1 when the left mouse button has been pressed.

Page 28: Mouse Question #1 Which INT number is used for the mouse?

Before Answering,Need to know …

• What to send…• BX = Button ID (0=left, 1=right, 2=center)

• What is returned….• AX = button status• BX = button press counter• CX = X-coordinate of last button press• DX = Y-coordinate of last button press

Page 29: Mouse Question #1 Which INT number is used for the mouse?

Question #10 Solutions

• Write ASM statements that jump to label Button1 when the left mouse button has been pressed.

mov ax, 5

mov bx, 0

int 33h

tst ax, 0

jz Button1

Page 30: Mouse Question #1 Which INT number is used for the mouse?

Comments about Button Press

• In an event-driven programming environment, a drag event always begins with a button press.

• Once a call is made to this function for a particular button, the button’s state is reset, and a second call to the function returns nothing.

Page 31: Mouse Question #1 Which INT number is used for the mouse?

Question #11

• Which INT 33h function gets button release information?

Page 32: Mouse Question #1 Which INT number is used for the mouse?

Question #11

• Which INT 33h function gets button release information?

Function 6

Page 33: Mouse Question #1 Which INT number is used for the mouse?

Question #12

• Write ASM statements that get the mouse position at the point when the right button was released, and store the position in the variables mouseX and mouseY.

Page 34: Mouse Question #1 Which INT number is used for the mouse?

Question #12

• Write ASM statements that get the mouse position at the point when the right button was released, and store the position in the variables mouseX and mouseY.

mov ax, 6mov bx, 1int 33hmov mouseX, CXmov mouseY, DX

Page 35: Mouse Question #1 Which INT number is used for the mouse?

Question #13

• Write ASM statements that set the vertical limits of the mosue to 200 and 400.

Page 36: Mouse Question #1 Which INT number is used for the mouse?

Question #13

• Write ASM statements that set the vertical limits of the mouse to 200 and 400.

mov ax, 8

mov CX, 200

mov DX, 400

int 33h

Page 37: Mouse Question #1 Which INT number is used for the mouse?

Question #14

• Write ASM statements that set the horizontal limits of the mouse to 300 and 600.

Page 38: Mouse Question #1 Which INT number is used for the mouse?

Question #14

• Write ASM statements that set the horizontal limits of the mouse to 300 and 600.

mov ax, 7

mov cx, 300

mov dx, 400

int 33h