I have a program written in 8086 targeting MSDOS which is supposed to draw a pixel under the mouse pointer whenever the left mouse button is pressed. It's like a primitive paint program.
data segment
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
mov ax, data
mov ds, ax
; Set video mode to 640x400
mov al, 12h
mov ah, 0
mov bh, 0
int 10h
; initialize mouse
mov ax, 0
int 33h
cmp ax, 0
je end
; Show mouse pointer
mov ax, 1
int 33h
; Limit mouse speed (doesn't fix a thing)
mov cx, 16
mov dx, 32
mov ax, 0fh
int 33h
main:
mov bx, 0
; Get mouse status
mov ax, 3
int 33h
cmp bx, 0
je mouse_skip ; mouse did nothing go back to main
cmp bx, 1
jne mouse_skip ; if anything else other than m1 pressed go back to main
mov al, 1100b ; <-- m1 pressed, draw pixel under mouse pointer
mov ah, 0ch
int 10h
mouse_skip:
jmp main ; repeat
end:
; return control to the operating system
mov ah, 4ch
mov al, 0
int 21h
The pixels have very apparent and visible gaps in between them. It fails to draw a lot of pixels (I think like 5/6 are not drawn). Is this because it's too busy doing all the mouse stuff so it doesn't care for the 10h interrupt? Or am I just missing something crucial?