编写并测试一个MASM程序以等待鼠标左键单击并在客户区域的确切单击位置显示文本字符串。我知道可以在03h,33h处找到鼠标坐标,但它会返回16位位置。我已经通过近似的方式编写了代码,但无法正常工作。
;3. Write and test a MASM program to wait for left mouse clicks
;and display a text string at the exact clicked spot in the client area.
include mtab.asm
.model small .stack 100h
.data
prompt db "Hello$"
.code
main proc
mov ax,@data
mov ds,ax
@input:
mov ax,13h
int 13h
mov ah,03h ; bx has left or right cx (ho) dx (ver) has coordinates
int 33h
and bx,1
; jz @input
;left mouse clicked then set coordinates and print text
shr cx,1
shr cx,1
shr cx,1
shr cx,1
or dx,cx
mov ah,13h
mov al,01h
mov bh,00h
mov bl,00h
lea bp,prompt
mov cx,5
int 10h
exitp
main end
end main