News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

mouse maze

Started by asafeliyahu3, March 29, 2013, 09:12:19 AM

Previous topic - Next topic

asafeliyahu3

hi i have to build an assembly program as my final project..
i started building a mouse maze
built the drawings of the maze..
stuck on the routing that runs after the drawing, that runs in a loop, showing the mouse pointer's cordinates on cx and dx
my question is: how do i conteniue from this point? any ideas for a condition inside that loop to set the exact parameters of the maze and when the mouse pointer hits them the game will pause or something?
im in the real need of help over here!
the project is do to the day after tommorow
plz some mercy
heres the code:
.model small
.stack 100h
.data
mp1x dw ?
mp1y dw ?
mp2x dw ?
mp2y dw ?
mp3x dw ?
mp3y dw ? 
mp4x dw ?
mp4y dw ?   
mp5x dw ?
mp5y dw ?
mp6x dw ?
mp6y dw ?
mp7x dw ?
mp7y dw ?
mp8x dw ?
mp8y dw ?
mp9x dw ?
mp9y dw ?
mp10x dw ?
mp10y dw ?
.code
start:
mov ax,@data
mov ds,ax

call line1
call line2
call line3
call line4
call line5 
call line6
call line7
call line8
call line9
call line10   
call line11

call endless

mov ax,4c00h
int 21h
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line1 proc
mov ax,0019
int 10h      ;putting the emu into graphical mode
mov cx,1;starting x
mov dx,4;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson2:
inc bx
add cx,2
int 10h
cmp bx,7Ah
je labelson
loop loopingson2
labelson:
mov mp1x,cx;here i move the x position after the drawings of the line
mov mp1y,dx;here i move the y position after the drawings of the line   
ret
line1 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line2 proc
mov cx,1;starting x
mov dx,17;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson3:
inc bx
add cx,2
int 10h
cmp bx,63h
je labelson2
loop loopingson3
labelson2:
mov mp2x,cx;here i move the x position after the drawings of the line
mov mp2y,dx;here i move the y position after the drawings of the line
ret
line2 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line3 proc
mov cx,mp1x;starting x
mov dx,mp1y;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson4:
inc bx
inc cx
inc dx
int 10h
cmp bx,65h
je labelson3
loop loopingson4
labelson3:
mov mp3x,cx;here i move the x position after the drawings of the line
mov mp3y,dx;here i move the y position after the drawings of the line
ret
line3 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line4 proc
mov cx,mp2x;starting x
mov dx,mp2y;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson5:
inc bx
inc cx
inc dx
int 10h
cmp bx,82h
je labelson4
loop loopingson5
labelson4:
mov mp4x,cx;here i move the x position after the drawings of the line
mov mp4y,dx;here i move the y position after the drawings of the line
ret
line4 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line5 proc
mov cx,mp3x;starting x
mov dx,mp3y;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson6:
inc bx
add cx,2
int 10h
cmp bx,69h
je labelson5
loop loopingson6
labelson5:
mov mp5x,cx;here i move the x position after the drawings of the line
mov mp5y,dx;here i move the y position after the drawings of the line
ret
line5 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line6 proc
mov cx,mp4x;starting x
mov dx,mp4y;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson7:
inc bx
add cx,2
int 10h
cmp bx,8Eh
je labelson6
loop loopingson7
labelson6:
mov mp6x,cx;here i move the x position after the drawings of the line
mov mp6y,dx;here i move the y position after the drawings of the line
ret
line6 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line7 proc
mov cx,mp5x;starting x
mov dx,mp5y;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson8:
inc bx
inc cx
dec dx
int 10h
cmp bx,3Ah
je labelson7
loop loopingson8
labelson7:
mov mp7x,cx;here i move the x position after the drawings of the line
mov mp7y,dx;here i move the y position after the drawings of the line
ret
line7 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line8 proc
mov cx,mp6x;starting x
mov dx,mp6y;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson9:
inc bx
inc cx
dec dx
int 10h
cmp bx,5Ah
je labelson8
loop loopingson9
labelson8:
mov mp8x,cx;here i move the x position after the drawings of the line
mov mp8y,dx;here i move the y position after the drawings of the line
ret
line8 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line9 proc
mov cx,mp7x;starting x
mov dx,mp7y;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson10:
inc bx
add cx,2
int 10h
cmp bx,2Ch
je labelson9
loop loopingson10
labelson9:
mov mp9x,cx;here i move the x position after the drawings of the line
mov mp9y,dx;here i move the y position after the drawings of the line
ret
line9 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line10 proc
mov cx,mp8x;starting x
mov dx,mp8y;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson11:
inc bx
add cx,2
int 10h
cmp cx,mp9x
je labelson10
loop loopingson11
labelson10:
mov mp10x,cx;here i move the x position after the drawings of the line
mov mp10y,dx;here i move the y position after the drawings of the line
ret
line10 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
line11 proc
mov cx,mp9x;starting x
mov dx,mp9y;starting y
mov ah,0ch;because we have to
mov al,7;color
xor bx,bx
loopingson12:
inc bx
inc cx
inc dx
int 11h
cmp dx,mp10y
je labelson11
loop loopingson12:
labelson11:
ret
line11 endp
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
endless proc
mov ax, 2
int 33h

mov ax,3h
int 33h
loopingson:
inc cx
int 33h
loop loopingson
ret
endless endp 
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
end start

goofprog

I used to use modulus to find a clicking area.  Like mousexpos % xposition.  I do not like helping people with homework unless they give me a reference.. ha ha ha j/k