[原创]推箱子
DATA SEGMENTSCORE DB 5 DUP('0'),'$'
PADMSG DB 44 DUP(219)
ENDMSG DB 0DH,0AH,'GOOD BYE!',0DH,0AH,'$'
crmsg db 13,10,'$'
circle DB 00H,00H,07H,0C0H,1FH,0F0H,3FH,0F8H,3FH,0F8H,7FH,0FCH,7FH,0FCH,7FH,0FCH
DB 7FH,0FCH,7FH,0FCH,3FH,0F8H,3FH,0F8H,1FH,0F8H,07H,0C0H,00H,00H,00H,00H
row db 10
col db 26
initrow db 10
initcol db 24
mrow db 1
mcol db 3
rflag dw 0
cflag dw 0
aimmsg DB 3 DUP(?,?,?)
SCOREMSG1 DB 201,11 DUP(205),187
SCOREMSG2 DB 186,'SCORE: ',186
SCOREMSG3 DB 204,11 DUP(205),185
SCOREMSG4 DB 186,'LEFT : A ',186
SCOREMSG5 DB 186,'RIGHT : D ',186
SCOREMSG6 DB 186,'UP : W ',186
SCOREMSG7 DB 186,'DOWN : S ',186
SCOREMSG8 DB 186,'-----------',186
SCOREMSG9 DB 186,'EXIT : ESC',186
SCOREMSG10 DB 200,11 DUP(205),188
num dw ?
num1 dw ?
num2 dw ?
num3 dw ?
SG DB 'http://bbs.bccn.net/'
FORM DB 2,2,2,2,2,2,2,2,2
DB 2,2,0,0,0,0,0,2,2
DB 2,2,0,0,0,2,2,2,2
DB 2,2,2,0,0,0,0,0,2
DB 2,0,0,0,2,0,2,0,2
DB 2,0,0,0,2,0,0,0,2
DB 2,0,0,0,2,2,2,2,2
DB 2,2,2,2,2,2,2,2,2
DATA ENDS
stack segment stack
db 200 dup(?)
stack ends
code segment
assume cs:code,ds:data,es:data,ss:stack
start:
mov ax,data
mov ds,ax
push ds
gameover:
mov ah,00h
mov al,12h
int 10h
mov ah,0bh
mov bh,01
mov bl,00h
int 10h
call initgame
call aim
call man
call dispscore
keyboard:
mov ah,0
int 16h
push ax
mov ah,1
int 16h
jz keyboard2
pop ax
jmp keyboard
keyboard2:
pop ax
cmp al,1bh
jz sexit1
cmp al,'a'
jz left
cmp al,'s'
jz down
cmp al,'d'
jz right
cmp al,'w'
jz up
jmp keyboard
up:
call up1
mov si,offset aimmsg
mov al,0h
cmp byte ptr [si+2],3
jz addnum1
jmp nflag1
addnum1:
add al,1
jmp nflag1
nflag1:
add si,3
cmp byte ptr [si+2],3
jz addnum2
jmp nflag2
addnum2:
add al,1
jmp nflag2
nflag2:
add si,3
cmp byte ptr [si+2],3
jz addnum3
jmp nflag3
addnum3:
add al,1
jmp nflag3
nflag3:
add al,'0'
mov score[4],al
call dispscore
jmp hflag1
sexit1:
jmp exit
hflag1:
jmp keyboard
down:
call down1
jmp keyboard
left:
call left1
jmp keyboard
right:
call right1
mov si,offset aimmsg
mov al,0h
cmp byte ptr [si+2],3
jz adddnum1
jmp nfflag1
adddnum1:
add al,1
jmp nfflag1
nfflag1:
add si,3
cmp byte ptr [si+2],3
jz adddnum2
jmp nfflag2
adddnum2:
add al,1
jmp nfflag2
nfflag2:
add si,3
cmp byte ptr [si+2],3
jz adddnum3
jmp nfflag3
adddnum3:
add al,1
jmp nfflag3
nfflag3:
add al,'0'
mov score[4],al
call dispscore
jmp keyboard
exit:
mov ax,0003h
int 10h
mov ax,4c00h
int 21h
down1 proc near
mov si,offset form
mov al,initrow
sub al,8
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
cmp byte ptr [si],3
jnz dno3
jmp dbcircle
dno3:
cmp byte ptr[si],4
jnz dflag1
jmp dacircle
dflag1:
cmp byte ptr [si],2
jnz dflag2
jmp dwcircle
dflag2:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
inc initrow
call man1
cmp initcol,26
jz dagcircle1
jmp ddirectflag1
dagcircle1:
cmp initrow,11
jz dagcircle2
jmp ddirectflag1
dagcircle2:
push ax
mov al,initcol
mov col,al
pop ax
mov si,offset circle
call show
jmp ddirectflag1
ddirectflag1:
mov rflag,1
mov si,offset form
mov al,initrow
sub al,9
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
cmp byte ptr [si],4
jnz dmodify1
jmp dfflag1
dmodify1:
mov byte ptr [si],1
cmp byte ptr [si-9],4
jnz dmodify2
jmp dfflag1
dmodify2:
mov byte ptr [si-9],0
jmp dfflag1
dfflag1:
mov si,offset form
mov al,initrow
sub al,8
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
jmp exit1
dbcircle:
mov si,offset form
mov al,initrow
sub al,7
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
cmp byte ptr [si],3
jnz dno33
jmp dbcircle1
dno33:
cmp byte ptr [si],4
jnz dflag3
jmp dacircle1
dflag3:
cmp byte ptr [si],2
jnz dflag4
jmp dwcircle1
dflag4:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
inc initrow
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man1
mov si,offset form
mov al,initrow
sub al,9
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
cmp byte ptr [si],4
jnz dmodify3
jmp dfflag2
dmodify3:
mov byte ptr [si],1
jmp dfflag2
dfflag2:
mov dh,initrow
inc dh
mov dl,initcol
mov bh,00
mov bl,01010101b
call dispcell
cmp byte ptr [si+9],2
jnz modify1
jmp dfflag3
modify1:
mov byte ptr [si+9],3
cmp byte ptr [si-9],4
jnz dmodify4
jmp dfflag3
dmodify4:
mov byte ptr [si-9],0
jmp dfflag3
dfflag3:
jmp flag2
flag2:
mov rflag,1
jmp exit1
dbcircle1:
push ax
push bx
push cx
push dx
push di
push si
mov rflag,0
jmp exit1
dacircle1:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
inc initrow
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man1
mov dh,initrow
inc dh
mov dl,initcol
mov bh,0
mov bl,01011110b
call dispcell
mov rflag,1
jmp exit1
dwcircle1:
push ax
push bx
push cx
push dx
push di
push si
mov rflag,0
jmp exit1
dacircle:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
inc initrow
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man1
mov rflag,1
jmp exit1
dwcircle:
push ax
push bx
push cx
push dx
push di
push si
mov rflag,0
jmp exit1
exit1:
cmp rflag,0
jnz dmmodify1
jmp dexit1
dmmodify1:
inc mrow
mov rflag,0
jmp dexit1
dexit1:
pop si
pop di
pop dx
pop cx
pop bx
pop ax
ret
down1 endp
up1 proc near
mov si,offset form
mov al,initrow
sub al,10
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
cmp byte ptr [si],3
jnz duno3
jmp ubcircle
duno3:
cmp byte ptr[si],4
jnz dflag5
jmp uacircle
dflag5:
cmp byte ptr [si],2
jnz dflag6
jmp uwcircle
dflag6:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
dec initrow
call man1
mov rflag,1
mov si,offset form
mov al,initrow
sub al,9
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
cmp byte ptr [si],4
jnz umodify1
jmp ufflag1
umodify1:
mov byte ptr [si],1
cmp byte ptr [si+9],4
jnz umodify2
jmp ufflag1
umodify2:
mov byte ptr [si+9],0
jmp ufflag1
ufflag1:
mov si,offset form
mov al,initrow
sub al,9
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
jmp exit2
ubcircle:
mov si,offset form
mov al,initrow
sub al,10
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
cmp byte ptr [si-9],3
jnz duno33
jmp ubcircle1
duno33:
cmp byte ptr [si-9],4
jnz dflag7
jmp uacircle1
dflag7:
cmp byte ptr [si-9],2
jnz dflag8
jmp uwcircle1
dflag8:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
dec initrow
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man1
mov rflag,1
mov si,offset form
mov al,initrow
sub al,9
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
cmp byte ptr [si],4
jnz umodify3
jmp ufflag2
umodify3:
mov byte ptr [si],1
jmp ufflag2
ufflag2:
mov dh,initrow
dec dh
mov dl,initcol
mov bh,00
mov bl,01010101b
call dispcell
cmp byte ptr [si-9],2
jnz modify2
jmp ufflag3
modify2:
mov byte ptr [si-9],3
cmp byte ptr [si+9],4
jnz umodify4
jmp ufflag3
umodify4:
mov byte ptr [si+9],0
jmp ufflag3
ufflag3:
jmp flag3
flag3:
jmp exit2
ubcircle1:
push ax
push bx
push cx
push dx
push di
push si
mov rflag,0
jmp exit2
uacircle1:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
dec initrow
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man1
mov si,offset form
mov al,initrow
sub al,9
mov bl,9
mul bl
add si,ax
mov al,mcol
inc al
mov ah,0h
add si,ax
sub si,1
mov byte ptr [si],1
mov byte ptr [si+9],0
mov rflag,1
mov dh,initrow
dec dh
mov dl,initcol
mov bh,0
mov bl,01011011b
call dispcell
mov si,offset aimmsg
mov byte ptr [si+2],3
jmp exit2
uwcircle1:
push ax
push bx
push cx
push dx
push di
push si
mov rflag,0
jmp exit2
uacircle:
push ax
push bx
push cx
push dx
push di
push si
mov si,offset aimmsg
cmp byte ptr [si+2],3
jz uaeexit1
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
dec initrow
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man2
mov rflag,1
uaeexit1:
jmp exit2
uwcircle:
push ax
push bx
push cx
push dx
push di
push si
mov rflag,0
jmp exit2
exit2:
cmp rflag,0
jnz ummodify1
jmp uexit1
ummodify1:
dec mrow
mov rflag,0
jmp uexit1
uexit1:
pop si
pop di
pop dx
pop cx
pop bx
pop ax
ret
up1 endp
right1 proc near
mov si,offset form
mov al,initcol
shr al,1
sub al,7
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si],3
jnz rno3
jmp rbcircle
rno3:
cmp byte ptr[si],4
jnz dflag13
jmp racircle
dflag13:
cmp byte ptr [si],2
jnz dflag14
jmp rwcircle
dflag14:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
inc initcol
inc initcol
call man1
mov si,offset form
mov al,initcol
shr al,1
sub al,8
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si],4
jnz rmodify1
jmp rfflag1
rmodify1:
mov byte ptr [si],1
cmp byte ptr [si-1],4
jnz rmodify2
jmp rfflag1
rmodify2:
mov byte ptr [si-1],0
jmp rfflag1
rfflag1:
mov si,offset form
mov al,initcol
shr al,1
sub al,7
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
mov cflag,1
jmp exit4
rbcircle:
mov si,offset form
mov al,initcol
shr al,1
sub al,7
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si+1],3
jnz rno33
jmp rbcircle1
rno33:
cmp byte ptr [si+1],4
jnz dflag15
jmp racircle1
dflag15:
cmp byte ptr [si+1],2
jnz dflag16
jmp rwcircle1
dflag16:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
inc initcol
inc initcol
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man1
mov si,offset form
mov al,initcol
shr al,1
sub al,7
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
sub si,1
mov byte ptr [si],1
mov dh,initrow
mov dl,initcol
inc dl
inc dl
mov bh,00
mov bl,01010101b
call dispcell
cmp byte ptr [si-1],2
jnz modify4
jmp rfflag2
modify4:
mov byte ptr [si-1],0
cmp byte ptr [si+1],4
jnz rmodify3
jmp rfflag2
rmodify3:
mov byte ptr [si+1],3
jmp rfflag2
rfflag2:
jmp flag5
flag5:
mov cflag,1
jmp exit4
rbcircle1:
push ax
push bx
push cx
push dx
push di
push si
mov cflag,0
jmp exit3
racircle1:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
inc initcol
inc initcol
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man1
mov si,offset form
mov al,initcol
shr al,1
sub al,8
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si],4
jnz rmodify4
jmp rfflag3
rmodify4:
mov byte ptr [si],1
jmp rfflag3
rfflag3:
mov dh,initrow
mov dl,initcol
inc dl
inc dl
mov bh,0
mov bl,01011011b
call dispcell
cmp byte ptr [si-1],2
jnz rcmp1
jmp rfflag4
rcmp1:
cmp byte ptr [si-1],4
jnz rmodify5
jmp rfflag4
rmodify5:
mov byte ptr [si-1],0
cmp byte ptr [si+1],4
jnz rmodify6
jmp rfflag4
rmodify6:
mov byte ptr [si+1],3
jmp rfflag4
rfflag4:
mov cflag,1
mov si,offset aimmsg
mov byte ptr [si+2],3
jmp reexit1
reexit1:
jmp exit4
rwcircle1:
push ax
push bx
push cx
push dx
push di
push si
mov cflag,0
jmp exit4
racircle:
push ax
push bx
push cx
push dx
push di
push si
mov si,offset aimmsg
mov al,initcol
shr al,1
sub al,12
mov ah,0h
mov bl,3
mul bl
add si,ax
cmp byte ptr [si+2],3
jz rfffflag1
jmp raacircle1
rfffflag1:
mov al,initcol
shr al,1
sub al,12
cmp al,2
jb rfffffflag1
jmp reexit3
rfffffflag1:
add si,3
cmp byte ptr [si+2],3
jz rmtflag1
jmp rffflag2
rffflag2:
mov si,offset form
mov al,initcol
shr al,1
sub al,7
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si+1],2
jnz rfffflag2
jmp reexit3
rfffflag2:
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
jmp rfffffffffflag1
rmtflag1:
jmp rmtflag2
rfffffffffflag1:
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
inc dl
inc dl
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
inc initcol
inc initcol
call man2
cmp mcol,4
jnb ragcircle2
jmp rfffffffflag1
ragcircle2:
push ax
mov al,initcol
mov col,al
dec col
dec col
pop ax
mov si,offset circle
call show
jmp rfffffffflag1
rmtflag2:
jmp rmflag1
rfffffffflag1:
mov si,offset form
mov al,initcol
shr al,1
sub al,8
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
jmp rfffffflag2
rmflag1:
jmp reexit3
rfffffflag2:
sub si,1
cmp byte ptr [si-1],4
jnz rmmodify2
jmp rffflag3
rmmodify2:
mov byte ptr [si-1],0
jmp rffflag3
rffflag3:
mov si,offset aimmsg
mov al,initcol
shr al,1
sub al,12
mov ah,0h
mov bl,3
mul bl
add si,ax
mov byte ptr [si+2],3
sub si,3
mov byte ptr [si+2],0
rffflag4:
mov dh,initrow
mov dl,initcol
inc dl
inc dl
mov bh,0
mov bl,01011011b
call dispcell
cmp initcol,26
jz rmmmodify3
jmp rffflag5
rmmmodify3:
mov si,offset form
mov al,initcol
dec al
dec al
shr al,1
sub al,8
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
mov byte ptr [si],0
jmp rffflag5
rffflag5:
jmp reexit2
raacircle1:
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
inc initcol
inc initcol
call man2
mov si,offset form
mov al,initcol
shr al,1
sub al,8
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si],4
jnz rmmmodify1
jmp rdirectflag1
rmmmodify1:
mov byte ptr [si],0
jmp printf1
printf1:
jmp rdirectflag1
rdirectflag1:
mov si,offset mcol
cmp mcol,4
jnb ragcircle1
jmp reexit2
ragcircle1:
push ax
mov al,initcol
mov col,al
dec col
dec col
pop ax
mov si,offset circle
call show
jmp reexit2
reexit2:
mov cflag,1
jmp reexit4
reexit3:
mov cflag,0
jmp reexit4
reexit4:
jmp exit4
rwcircle:
push ax
push bx
push cx
push dx
push di
push si
mov cflag,0
jmp exit4
exit4:
cmp cflag,0
jnz rmmodify3
jmp rexit1
rmmodify3:
inc mcol
jmp rexit1
rexit1:
mov si,offset mcol
pop si
pop di
pop dx
pop cx
pop bx
pop ax
ret
right1 endp
left1 proc near
mov si,offset form
mov al,initcol
shr al,1
sub al,9
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si],3
jnz lno3
jmp lbcircle
lno3:
cmp byte ptr[si],4
jnz dflag9
jmp lacircle
dflag9:
cmp byte ptr [si],2
jnz dflag10
jmp lwcircle
dflag10:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
dec initcol
dec initcol
call man1
cmp mcol,4
jz ljflag1
jmp lfffffflag1
ljflag1:
cmp initrow,10
jnz lfffffflag1
push ax
mov al,initcol
mov col,al
inc col
inc col
pop ax
mov si,offset circle
call show
lfffffflag1:
mov si,offset form
mov al,initcol
shr al,1
sub al,8
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si],4
jnz lmodify1
jmp lfflag1
lmodify1:
mov byte ptr [si],1
cmp byte ptr [si+1],4
jnz lmodify2
jmp lfflag1
lmodify2:
mov byte ptr [si+1],0
jmp lfflag1
lfflag1:
mov si,offset form
mov al,initcol
shr al,1
sub al,9
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
mov cflag,1
jmp exit3
lbcircle:
mov si,offset form
mov al,initcol
shr al,1
sub al,9
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si-1],3
jnz lno33
jmp lbcircle1
lno33:
cmp byte ptr [si-1],4
jnz dflag11
jmp lacircle1
dflag11:
cmp byte ptr [si-1],2
jnz dflag12
jmp lwcircle1
dflag12:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
dec initcol
dec initcol
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man1
mov si,offset form
mov al,initcol
shr al,1
sub al,8
mov ah,0h
add si,ax
mov al,mrow
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si],4
jnz lmodify3
jmp lfflag2
lmodify3:
mov byte ptr [si],1
jmp lfflag2
lfflag2:
mov dh,initrow
mov dl,initcol
dec dl
dec dl
mov bh,00
mov bl,01010101b
call dispcell
cmp byte ptr [si-1],2
jnz modify3
jmp lfflag3
modify3:
mov byte ptr [si-1],3
cmp byte ptr [si+1],4
jnz lmodify4
jmp lfflag3
lmodify4:
mov byte ptr [si+1],0
jmp lfflag3
lfflag3:
jmp flag4
flag4:
mov cflag,1
jmp exit3
lbcircle1:
push ax
push bx
push cx
push dx
push di
push si
mov cflag,0
jmp exit3
lacircle1:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
dec initcol
dec initcol
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
call man1
mov si,offset form
mov al,initcol
shr al,1
sub al,8
mov ah,0h
add si,ax
mov al,1
mov bl,9
mul bl
add si,ax
sub si,1
cmp byte ptr [si],4
jnz lmodify5
jmp lflag4
lmodify5:
mov byte ptr [si],1
jmp lflag4
lflag4:
mov dh,initrow
mov dl,initcol
dec dl
mov bh,0
mov bl,01011110b
call dispcell
cmp byte ptr [si-1],2
jnz lcmp1
jmp lfflag5
lcmp1:
cmp byte ptr [si-1],4
jnz lmodify6
jmp lfflag5
lmodify6:
mov byte ptr [si-1],3
cmp byte ptr [si+1],4
jnz lmodify7
jmp lfflag5
lmodify7:
mov byte ptr [si+1],0
jmp lfflag5
lfflag5:
mov cflag,1
jmp exit3
lwcircle1:
push ax
push bx
push cx
push dx
push di
push si
mov cflag,0
jmp exit3
lacircle:
push ax
push bx
push cx
push dx
push di
push si
mov bp,offset padmsg
mov cx,02
mov dh,initrow
mov dl,initcol
mov bh,00
mov al,0
mov bl,01010000b
mov ax,1300h
int 10h
dec initcol
dec initcol
call man2
cmp mcol,4
jnb lagcircle1
jmp lfffflag1
lagcircle1:
push ax
mov al,initcol
mov col,al
inc col
inc col
pop ax
mov si,offset circle
call show
jmp lfffflag1
lfffflag1:
mov cflag,1
jmp exit3
lwcircle:
push ax
push bx
push cx
push dx
push di
push si
mov cflag,0
jmp exit3
exit3:
cmp cflag,0
jnz lmmodify1
jmp lexit1
lmmodify1:
dec mcol
mov cflag,0
jmp lexit1
lexit1:
mov si,offset mcol
pop si
pop di
pop dx
pop cx
pop bx
pop ax
ret
left1 endp
DISPSCORE PROC NEAR
MOV AX,DATA
MOV ES,AX
MOV BP,OFFSET SCORE
MOV CX,05H
MOV DX,0643H
MOV BH,0H
MOV AL,0H
MOV BL,00110100B
MOV AH,13H
INT 10H
RET
DISPSCORE ENDP
CLS PROC NEAR
MOV CX,0
MOV DH,24
MOV DL,79
MOV BH,0
MOV AX,600H
INT 10H
RET
CLS ENDP
DISPPAD PROC NEAR ;BX BH=PAGE BL=COLOR
MOV CX,NUM
MOV DH,12
MOV DL,24
CALL DISPCELL
mov dh,14
mov dl,22
call dispcell
mov dh,13
mov dl,28
call dispcell
RET
DISPPAD ENDP
DISPCELL PROC NEAR;DH=ROW DL=COL BH=PAGE BL=COLOR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH DI
PUSH SI
MOV BP,OFFSET PADMSG
MOV CX,02H
MOV AX,1300H
INT 10H
CMP BL,0H
JE SKIP20
;CALC ROW
MOV AH,0H
MOV AL,DH
MOV CL,16
MUL CL
MOV SI,AX
;CALC COL
MOV AH,0H
MOV AL,DL
MOV CL,8
MUL CL
MOV DI,AX
;DRAW
MOV AX,0C00H
MOV DX,SI
ADD DX,15
MOV CX,16
LOOP21: ADD CX,DI
DEC CX
INT 10H
INC CX
SUB CX,DI
LOOP LOOP21
jmp flag1
skip20:
jmp skip21
flag1:
MOV DX,SI
MOV CX,15
ADD DI,15
LOOP22: PUSH CX
MOV CX,DI
INT 10H
INC DX
POP CX
LOOP LOOP22
SUB DI,2
DEC DX
MOV CX,13
LOOP23: PUSH CX
DEC DX
MOV CX,DI
INT 10H
SUB CX,12
MOV AL,07H
INT 10H
MOV AL,00H
POP CX
LOOP LOOP23
MOV AX,0C07H
MOV DX,SI
ADD DX,1
MOV CX,12
SUB DI,12
LOOP24: ADD CX,DI
INT 10H
SUB CX,DI
LOOP LOOP24
mov ax,0c00h
mov dx,si
add dx,15
mov cx,8
loop25:
add cx,7
add cx,di
int 10h
dec dx
sub cx,di
sub cx,7
loop loop25
mov ax,0c07h
mov cx,7
loop26:
add cx,1
add cx,di
int 10h
dec dx
sub cx,di
sub cx,1
loop loop26
mov ax,0c00h
mov dx,si
mov cx,8
loop27:
add cx,7
add cx,di
int 10h
inc dx
sub cx,di
sub cx,7
loop loop27
mov ax,0c07h
mov cx,7
loop28:
add cx,di
int 10h
inc dx
sub cx,di
loop loop28
SKIP21: POP SI
POP DI
POP DX
POP CX
POP BX
POP AX
RET
DISPCELL ENDP
INITGAME PROC NEAR
CALL CLS
;DRAW TEXTFRAME
MOV AX,DATA
MOV ES,AX
MOV CX,10
MOV BP,OFFSET SCOREMSG1
MOV DX,053CH
LOOP72: PUSH CX
MOV CX,13
MOV AL,0H
MOV BH,0H
MOV BL,01011010B
MOV AH,13H
INT 10H
ADD BP,13
INC DH
POP CX
LOOP LOOP72
MOV AX,DATA
MOV ES,AX
MOV BP,OFFSET SG
MOV DX,1430H
PUSH CX
MOV CX,20
MOV AL,0H
MOV BH,0H
MOV BL,01011010B
MOV AH,13H
INT 10H
POP CX
;DRAW BOARDFRAME
MOV BP,OFFSET PADMSG
MOV CX,0044
MOV DX,0304H
MOV BH,0H
MOV AL,0H
MOV BL,00110100B
MOV AH,13H
INT 10H
MOV DX,1804H
INT 10H
mov dx,0404h
int 10h
mov dx,1704h
int 10h
mov dx,0504h
int 10h
mov dx,1604h
int 10h
mov dx,0604h
int 10h
mov dx,1504h
int 10h
mov dx,0704h
int 10h
mov dx,1404h
int 10h
mov dx,0804h
int 10h
mov dx,1304h
int 10h
mov dx,0904h
int 10h
mov dx,1204h
int 10h
mov dx,1004h
int 10h
mov dx,1104h
int 10h
MOV CX,6
MOV DX,0904H
LOOP4: MOV SI,CX
MOV CX,02
INC DH
INT 10H
MOV CX,SI
LOOP LOOP4
MOV CX,6
MOV DX,092EH
INITGAME1: MOV SI,CX
MOV CX,02
INC DH
INT 10H
MOV CX,SI
LOOP INITGAME1
mov cx,6
mov dx,0906h
loop5:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop loop5
mov cx,6
mov dx,092ch
initgame2:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop initgame2
mov cx,6
mov dx,0908h
loop6:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop loop6
mov cx,6
mov dx,092ah
initgame3:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop initgame3
mov cx,6
mov dx,090ah
loop7:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop loop7
mov cx,6
mov dx,0928h
initgame4:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop initgame4
mov cx,6
mov dx,090ch
loop8:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop loop8
mov cx,6
mov dx,0926h
initgame5:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop initgame5
mov cx,6
mov dx,090eh
loop9:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop loop9
mov cx,6
mov dx,0924h
initgame6:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop initgame6
mov cx,6
mov dx,0910h
loop10:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop loop10
mov cx,6
mov dx,0922h
initgame7:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop initgame7
mov cx,6
mov dx,0912h
loop111:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop loop111
mov cx,2
mov dx,0920h
initgame8:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop initgame8
mov dx,0e20h
inc dh
mov cx,2
int 10h
mov cx,3
mov dx,0914h
loop112:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop loop112
mov cx,1
mov dx,091eh
inc dh
initgame9:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop initgame9
mov dx,0c1eh
inc dh
mov cx,2
int 10h
mov dx,0e1eh
inc dh
mov cx,2
int 10h
mov cx,1
mov dx,0916h
loop113:
mov si,cx
mov cx,2
inc dh
inc dh
inc dh
int 10h
mov cx,si
loop loop113
mov cx,1
mov dx,091ch
inc dh
initgame10:
mov si,cx
mov cx,2
inc dh
int 10h
mov cx,si
loop initgame10
mov dx,0e1ch
inc dh
mov cx,2
int 10h
mov dx,0c1ah
inc dh
mov cx,2
int 10h
mov dx,0c1ah
inc dh
inc dh
mov cx,2
int 10h
mov dx,0c1ah
inc dh
inc dh
inc dh
mov cx,2
int 10h
;FORMAT SCORE
MOV DI,OFFSET SCORE
MOV AL,'0'
MOV CX,05H
REP STOSB
MOV NUM,3
MOV SI,OFFSET FORM
MOV CX,72
IN1:
MOV AL,[SI]
CMP AL,1
JNZ IN2
MOV BYTE PTR [SI],0
JMP IN4
IN2:
CMP AL,3
JNZ IN3
MOV BYTE PTR [SI],0
jmp in4
in3:
cmp al,4
jnz in4
mov byte ptr [si],0
jmp in4
IN4:
INC SI
LOOP IN1
MOV SI,OFFSET FORM
ADD SI,12
MOV BYTE PTR [SI],1
mov si,offset form
add si,30
mov byte ptr [si],3
mov si,offset form
add si,47
mov byte ptr [si],3
mov si,offset form
add si,41
mov byte ptr [si],3
mov si,offset form
add si,13
mov byte ptr [si],4
mov si,offset form
add si,14
mov byte ptr [si],4
mov si,offset form
add si,15
mov byte ptr [si],4
mov si,offset aimmsg
mov byte ptr [si],10
mov byte ptr [si+1],26
mov byte ptr [si+2],0
add si,3
mov byte ptr[si],10
mov byte ptr[si+1],28
mov byte ptr [si+2],0
add si,3
mov byte ptr [si],10
mov byte ptr [si+1],30
mov byte ptr [si+2],0
mov num3,0
MOV BL,01010101B
call disppad
RET
INITGAME ENDP
[此贴子已经被作者于2019-5-31 12:32编辑过]