Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Mouse Question #1 Which INT number is used for the mouse?"— Presentation transcript:

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

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

3 Question #1A Unlike DOS INT 21h, or BIOS INT10h, with the mouse BIOS functions, the function number is selected through the _________ register.

4 Question #1A Unlike DOS INT 21h, or BIOS INT10h, with the mouse BIOS functions, the function number is selected through the ____AL_____ register.

5 Question #2 Write ASM statements that reset the mouse and get the mouse status.

6 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

7 Resetting Mouse Returns If mouse is found, –AX = FFFFh –BX = number of mouse buttons If no mouse found, –AX = 0

8 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

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

10 Question #3 Which INT 33h function shows and hides the mouse pointer?

11 Question #3 Solutions Which INT 33h function shows and hides the mouse pointer? Function 1 – show Function 2- hide

12 Question #4 Write ASM statements that hide the mouse pointer.

13 Question #4 Write ASM statements that hide the mouse pointer. Mov ax, 2 Int 33h

14 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.

15 Question #5 Which INT 33h function gets the mouse position and status?

16 Question #5 Which INT 33h function gets the mouse position and status? Function 3

17 Question #6 Write ASM statements that get the mouse position and store it in the variables mouseX and mouseY.

18 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

19 Question #6 Solutions Write ASM statements that get the mouse position and store it in the variables mouseX and mouseY. mov ax, 3 int 33h mov mouseX, CX movmouseY, DX

20 Question #7 Which INT 33h function sets the mouse position?

21 Question #7 Which INT 33h function sets the mouse position? Function 4

22 Question #8 Write ASM statements that set the mouse pointer to X=100 and Y = 400.

23 Before Answering Need to know… What to send… CX = X-Coordinate DX = Y-Coordinate

24 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

25 Question #9 Which INT 33h function gets the mouse button press information?

26 Question #9 Which INT 33h function gets the mouse button press information? Function 5

27 Question #10 Write ASM statements that jump to label Button1 when the left mouse button has been pressed.

28 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

29 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 int33h tst ax, 0 jzButton1

30 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.

31 Question #11 Which INT 33h function gets button release information?

32 Question #11 Which INT 33h function gets button release information? Function 6

33 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.

34 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, 6 mov bx, 1 int33h mov mouseX, CX mov mouseY, DX

35 Question #13 Write ASM statements that set the vertical limits of the mosue to 200 and 400.

36 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

37 Question #14 Write ASM statements that set the horizontal limits of the mouse to 300 and 600.

38 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 int33h


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

Similar presentations


Ads by Google