The code below lets you draw on screen with mouse, and works perfect. My problem is why does CX need to be divided by 2? Why is it doubled in the first place?
code segment
main proc far
mov al, 12h
mov ah, 0 ; set graphics video mode.
int 10h
mov ax, 1 ;shows mouse cursor
int 33h
Next:
mov ax, 3 ;get cursor positon in cx,dx
int 33h
call putpix ;call procedure
jmp Next
mov ah,4ch
int 21h
main endp
;procedure to print
putpix proc
mov al, 7 ;color of pixel
mov ah, 0ch
shr cx,1 ; cx will get double so we divide it by two
int 10h ; set pixel.
ret
putpix endp
code ends
Next screenshot of emu8086 and your code will help us to understand what is going on:
shr cx, 1).
It looks you've encountered a bug in your emulator (or its mouse driver). When I run your program on DOSBox and under MS-DOS 6.22 running both under VirtualBox and directly on a PC, your program only draws pixels on the left hand side of the display.

You might want to file a bug report with the people who wrote your emulator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With