0% found this document useful (0 votes)
47 views

MOUSE

This document contains assembly language code to initialize and control video modes, the mouse, keyboard, and display cursor position on the screen. It sets the video mode, resets and checks for mouse availability, and displays the cursor position. It then enters a loop to get keyboard and mouse input, checking the mouse position and sounding an alert if over the cursor, and exiting or toggling the mouse pointer display based on key presses.

Uploaded by

anon_180818200
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

MOUSE

This document contains assembly language code to initialize and control video modes, the mouse, keyboard, and display cursor position on the screen. It sets the video mode, resets and checks for mouse availability, and displays the cursor position. It then enters a loop to get keyboard and mouse input, checking the mouse position and sounding an alert if over the cursor, and exiting or toggling the mouse pointer display based on key presses.

Uploaded by

anon_180818200
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8

SET VIDEO MODE

MOV AH,00H
MOV AL,VIDEO MODE
INT 10H

AL=12 640 BY 480 GRAPHICS MODE


AL=02 80 BY 25 TEXT MODE
RESET MOUSE AND GET STATUS
MOV AX,0000H
INT 33H

AX=FFFFH
BX=NUMBER OF MOUSE BUTTONS
IF MOUSE SUPPORT IS AVAILABLE

AX=0000H IF MOUSE SUPPORT IS NOT AVAILABLE


SET CURSOR POSITION
MOV AH,02H
MOV BH,00H PAGE NUMBER
MOV DH,02H ROW (Y COORDINATE)
MOV DL,70H COLUMN (X COORDINATE)
INT 10H
GET KEYBOARD STATUS
MOV AH,01H
INT 16H

RETURNS
IF KEY WAITING TO BE INPUT
ZERO FLAG =CLEAR
AH=KEYBOARD SCAN CODE
AL=CHARACTER

IF NO KEY WAITING
ZERO FLAG=SET
GET MOUSE POSITION AND BUTTON STATUS
MOV AX,0003H
INT 33H

RETURNS
BX MOUSE BUTTON STATUS
BIT 0 IF SET LEFT BUTTON DOWN
BIT 1 IF SET RIGHT BUTTON DOWN
BIT 2 CENTER BUTTON DOWN
BIT 3-15 RESERVED
CX=X COORDINATE
DX=Y COORDINATE
SHOW MOUSE POINTER
MOV AX,0001H
INT 33H

HIDE MOUSE POINTER


MOV AX,0002H
INT 33H

TO BEEP SPEAKER
MOV DL,7 07H IS CODE FOR BELL
MOV AH,2
INT 21H
WRITE CHARACTER IN TELETYPE MODE IN GRAPHICS
MODE

MOV AH,0EH
MOV AL, CHARACTER/DIGIT
MOV BH,00 PAGE NUMBER
MOV BL,02H FOREGROUND COLOR
INT10H
Step 1: set video mode

Step 2: reset mouse and check mouse availability

Step 3: if mouse not available display erro


else goto step 4

Step 4:Display x & y coordinate and * on screen

Step 5: get keyboard status


if key press then goto step7
else step 6
Step6: get mouse status and check
if mouse position is at * sound beep & goto step 5
else if mouse position is 00 then exit
else display x and y coordinate & goto step 5
Step 7:get keyboard character without echo
if key pressed is ‘h’ then hide mouse pointer & goto step 5
if key pressed is ‘s’ then show mouse pointer & goto step 5
if key pressed is ‘q’ then exit
Exit set text mode and exit

You might also like