Mouse

There are generally 3 things you want to do.
  1. Show the mouse
  2. Hide the mouse
  3. Get the position for the mouse

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.

Show the mouse

This is the assembler code :
    mov ax,01
    int 33h
Easy, huh?

Hide the mouse

This is assembler code :
    mov ax,0
    int 33h


getting position of the mouse

    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 :
  1. Left button is pressed
  2. right button is pressed
  3. both buttons is pressed
If no button is pressed, mb will have the value 0.
You can download a file, mouse.h
This document was created 1996-12-21