0
votes

im working on project to school. My project is a Calculator which includes some elemntaric actions. I Drew a BitMap and loades it into the screen, once i ask for input everything works fine. In the second time im asking to input nothing happens im attaching the relevantic procedures Thank you alot

`proc ActiveMouse
push ax
xor ax,ax
int 33h;starting mouse
mov ax,1
int 33h;Mouse Pointer active
pop ax
ret
endp ActiveMouse


proc getClick
push ax
push bx
push dx
push cx
ror bx,1
LeftClickStatus:
rol bx,1
mov ax,3h
int 33h;get click status
ror bx,1
jnc LeftClickStatus
mov [word ptr YCoordinate],dx;dx is max 200
mov ax,cx
mov cx,2
xor dx,dx
div cx
mov [XCoordinate],ax
pop cx
pop dx
pop bx
pop ax
ret
endp getClick`
1

1 Answers

0
votes

The code that you provided doesn't contain much for the problem you might have.
Below are some observations though:

proc ActiveMouse
 push ax
 xor ax,ax
 int 33h;starting mouse
 mov ax,1
 int 33h;Mouse Pointer active
 pop ax
 ret
endp ActiveMouse

The ActiveMouse procedure should also preserve BX as the AX=0 call returns a button count in it.


mov ax,cx
mov cx,2
xor dx,dx
div cx
mov [XCoordinate],ax

Why don't you simplify this division by 2 ???

shr cx, 1
mov [XCoordinate], cx

ror bx,1
LeftClickStatus:
rol bx,1

These BX manipulations don't do anything useful. BX is returned by the AX=3 call, but is not one of its input parameters.


Make sure the GetClick procedure has access to the DS segment. If required use a segment override prefix on:

mov [cs:YCoordinate], dx
mov [cs:XCoordinate], cx