Some languages have built in functions for the mouse, but we don't like them. We like assembler more, it's often even easier than the built in functions.
This is the assembler code :
mov ax,01
int 33h
Easy, huh?
This is assembler code :
mov ax,0
int 33h
mov ax,03
int 33h
mov mb,bx
mov mx,cx
mov my,dx
The x-coordinate for the position would be placed in the variable mx, and the y-coordinate in my. mb tells you what happens with the mouse buttons. A two-button mouse give these values in mb :
- Left button is pressed
- right button is pressed
- both buttons is pressed
If no button is pressed, mb will have the value 0.