I am using a procedure in TASM that waits for a left click from the mouse, and then exits. When debugging, the problem appears to work fine in the first time but from the second time on the previous values are reused for no visible reason. Does anyone have any ideas? Thanks!
Here is the code of the function:
proc WaitForLeftClick
ContinueWaitForLeftClick:
mov ax, 3
int 33h
and bx, 00000001b
jnz ExitWaitForLeftClick
jmp ContinueWaitForLeftClick
ExitWaitForLeftClick:
ret
endp WaitForLeftClick
The problem appears when debugging the following part:
Valid_Press:
cmp [First_Round], 0
je Skip_Plus_Two ; the first round variable is to determine if the first card on pile was discard card
cmp [Last_Value], -4 ; check for +2
je Check_For_Two
Skip_Plus_Two:
mov [First_Round], 1 ; change it to one so it works only once
xor ax, ax
call WaitForLeftClick ; first wait for left click
Clicked:
shr cx, 1 ; actual x
; check for draw
cmp dx, 70
jb Maybe_Card
cmp dx, 120
ja Maybe_Card
; now cmp x
cmp cx, 30
jb Maybe_Card
cmp cx, 60
ja Maybe_Card
; if all conditions not reached, press was on picture
jmp Draw_One_Card
Maybe_Card:
push [Interval] ; interval
push dx
push cx
call Is_On_Card ; check for press on card
cmp ax, 0FFFFh ; the check
je Press_Is_Card
xor bx, bx
xor cx, cx
xor dx, dx
jmp Valid_Press ; input not card