I want to allow the user to click on his chosen submarine (which are already located:)) and then he clicks another time on the screen and the submarine appers there. For some reason no matter what i click on or where the same submarine (submarine 4) appers and after i move my mouse some of it sidappers:(. In addition i made a loop that should run 5 times, but after one iteration my code is moving on.
proc UseMouse
push ax ; mouse register
push cx ; x cordinates (for future submarine)
push dx ; y cordinates (for future submarine)
push bx
;mov ax,0h
;int 33h
;shr cx,1
wait_for_leftclick:
;mov ax,1h
;int 33h
mov ax,3h
int 33h
cmp bx, 01h
je loop3
jmp wait_for_leftclick ; This begin loop works for sure
loop3:
Tnai1:
mov ax,3h
int 33h
cmp bx, 01h
jne wait_for_leftclick
mov ah,0Dh
int 10h
cmp al, 4
je Printsub1
jmp Tnai2
Tnai2:
mov ax,3h
int 33h
cmp bx, 01h
jne wait_for_leftclick
mov ah,0Dh
int 10h
cmp al, 5
je printsub2
jmp Tnai3
Tnai3:
mov ax,3h
int 33h
cmp bx, 01h
jne wait_for_leftclick
mov ah,0Dh
int 10h
cmp al, 6
je printsub3
jmp printsub4
Tnai4:
mov ax,3h
int 33h
cmp bx, 01h
jne wait_for_leftclick
mov ah,0Dh
int 10h
cmp al, 7
je Printsub4
jmp Tnai5
Tnai5:
mov ax,3h
int 33h
cmp bx, 01h
jne wait_for_leftclick
mov ah,0Dh
int 10h
cmp al, 8
je Printsub5
jmp Finish
Printsub1:
;shr cx, 1
;mov ax,1h
;int 33h
wait_click1:
mov ax, 3h
int 33h
cmp bx, 01h
jne wait_click1
shr cx, 1
mov [Var1], cx
mov [Var2], dx
push 23
push 40
push 4
push [Var2]
push [Var1]
push offset submarine1
call Sprite_Figure
jmp Finish
printsub2:
;shr cx, 1
;mov ax,1h
;int 33h
wait_click2:
mov ax, 3h
int 33h
cmp bx, 01h
jne wait_click2
shr cx, 1
mov [Var1], cx
mov [Var2], dx
push 23
push 40
push 5
push [Var2]
push [Var1]
push offset submarine2
call Sprite_Figure
jmp Finish
printsub3:
;shr cx, 1
;mov ax,1h
;int 33h
wait_click3:
mov ax, 3h
int 33h
cmp bx, 01h
jne wait_click3
shr cx, 1
mov [Var1], cx
mov [Var2], dx
push 23
push 40
push 6
push [Var2]
push [Var1]
push offset submarine3
call Sprite_Figure
jmp Finish
printsub4:
call setPixel
;shr cx, 1
;mov ax,1h
;int 33h
wait_click4:
mov ax, 3h
int 33h
cmp bx, 01h
jne wait_click4 ; we know for sure this works
shr cx,1
push 23
push 40
push 7
push dx
push cx
push offset submarine4
call Sprite_Figure
jmp Finish
Printsub5:
;shr cx, 1
;mov ax,1h
;int 33h
wait_click5:
mov ax, 3h
int 33h
cmp bx, 01h
jne wait_click5
shr cx, 1
mov [var1], cx
mov [var2], dx
push 23
push 40
push 8
push [Var2]
push [Var1]
push offset submarine5
call Sprite_Figure
jmp Finish
Finish:
pop bx
pop dx
pop cx
pop ax
ret
endp UseMouse
The function
mov ah, 5
timeX5:
dec ah
call UseMouse
cmp ah, 0
jne timeX5
How i call the function
i tried looking yp online for some clues and ask some friends but with no luck. Thanks in advance:)