我怎样才能做 DOSBox 程序集鼠标事件
How can i do DOSBox Assembly mouse events
我刚刚开始学习 "assembly" 语言。
如何在每次用鼠标左键单击时打印 "Hello World" 并在 DOSBox 上每次右键单击时打印 "Bad World"。
我想我找到了解决问题的方法。
program SEGMENT
ASSUME CS:program,DS:program
ORG 100h
首先我们需要为目录http://stanislavs.org/helppc/int_33.html
调用鼠标cursor.Check
start:
MOV AX,01
INT 33h
http://stanislavs.org/helppc/int_33-5.html
除了最后两位,我们不会使用其他位,所以我们用 AND 运算符将其余位设为零。
loop:
MOV AX,03
INT 33h
AND BX,3h
我们比较旋转后的值,并根据结果发送函数
CMP BX,1
JE left
CMP BX,2
JE right
cmp BX,0
je endss
cmp bx,3
je endss
right:
MOV DX,OFFSET stringright
MOV AH,09h
INT 21h
jmp endss
left:
MOV DX,OFFSET stringleft
MOV AH,09h
INT 21h
endss:
jmp loop
stringright DB "Right Clicked $"
stringleft DB "Left Clicked $"
INT 20h
program ENDS
END start
我刚刚开始学习 "assembly" 语言。
如何在每次用鼠标左键单击时打印 "Hello World" 并在 DOSBox 上每次右键单击时打印 "Bad World"。
我想我找到了解决问题的方法。
program SEGMENT
ASSUME CS:program,DS:program
ORG 100h
首先我们需要为目录http://stanislavs.org/helppc/int_33.html
调用鼠标cursor.Check start:
MOV AX,01
INT 33h
http://stanislavs.org/helppc/int_33-5.html 除了最后两位,我们不会使用其他位,所以我们用 AND 运算符将其余位设为零。
loop:
MOV AX,03
INT 33h
AND BX,3h
我们比较旋转后的值,并根据结果发送函数
CMP BX,1
JE left
CMP BX,2
JE right
cmp BX,0
je endss
cmp bx,3
je endss
right:
MOV DX,OFFSET stringright
MOV AH,09h
INT 21h
jmp endss
left:
MOV DX,OFFSET stringleft
MOV AH,09h
INT 21h
endss:
jmp loop
stringright DB "Right Clicked $"
stringleft DB "Left Clicked $"
INT 20h
program ENDS
END start