Mouse: Int 33h
In this tutorial I'll cover mouse usage in DOS applications. If you want to test the program in real DOS mode (without windows running) you'll need CuteMouse drivers that can be downloaded here.
int 33h ; mouse interrupt
; (ifi AX=FFFFh mouse is installed, if 0000 not, DX - number of mouse buttons)
ja pmouse ;
if AX > 0 lets start!
int 21h ;else just exit
mov ax,03 ; function to get mouse position and buttons
mov ax,dx ; Y coord to AX
mul dx ; multiply AX by 320
add ax,cx ; add X coord
; (Now currsor position is in AX, lets draw the pixel there)
mov dl,12 ; red color ;)
mov es:[di],dl ; and we have the pixel drawn
By default mouse resolution is 640x200, lets set it to 320x200 (monitor height is already set, lets just set the width)
mov ax, 7
mov cx,0 ; min pos
mov dx,320 ; max pos
And height can be set:
mov ax, 8
The source for this tutorial can be found here.