这是我检查两台印刷机的代码。我不明白为什么第二个按钮不起作用
proc whatPress
pusha
call setUpMagicNumbers
call startscreen
mov ax,00
int 33h
mov ax,01
int 33h
waitforpress:
;call Esc_end
mov ax, 3
int 33h
cmp cx, 112
jb waitforpress
cmp cx, 452
ja waitforpress
cmp dx, 81
jb waitforpress
cmp dx, 153
ja waitforpress
cmp bx, 1h
je startt
;-----------
check_second_button:; Check for the second button press
cmp cx, 336
jb waitforpress
cmp cx, 624
ja waitforpress
cmp dx, 157
jb waitforpress
cmp dx, 198
ja waitforpress
cmp bx, 1h
je Rulejump
jmp waitforpress
startt:
mov ax,02
int 33h
call clean
call GamePlay
popa
ret
Rulejump:
call RuleWaitPress
popa
ret
endp whatPress
我不明白为什么第二个按钮不起作用
这是两个按钮在屏幕上的近似位置:
**********************
* *
* button 1 *
* *
**********************
*******************
* button 2 *
*******************
为了让你的程序执行到达
check_second_button:
,需要满足5个条件。 CX和DX中的坐标必须落在第一个按钮内,并且不能有鼠标左键单击。waitforpress:
mov ax, 0003h
int 33h ; -> BX CX DX
test bx, 1
jnz waitforpress ; Wait for left mouse button to be pressed
check_first_button:
cmp cx, 112
jb check_second_button
cmp cx, 452
ja check_second_button
cmp dx, 81
jb check_second_button
cmp dx, 153
ja check_second_button
; startt:
mov ax, 0002h
int 33h
call clean
call GamePlay
popa
ret
check_second_button:
cmp cx, 336
jb waitforpress
cmp cx, 624
ja waitforpress
cmp dx, 157
jb waitforpress
cmp dx, 198
ja waitforpress
; Rulejump:
call RuleWaitPress
popa
ret