DATA SEGMENT SCORE DB 5 DUP('0'),'$' PADMSG DB 44 DUP(219) ENDMSG DB 0DH,0AH,'GOOD BYE!',0DH,0AH,'$' crmsg db 13,10,'$'
SG3 DB 'Do you want to play again?(Yes/No)'
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 temleft1 cmp al,'s' jz temdown1 cmp al,'d' jz temright1 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 temflag1
sexit1: jmp sexit2
temleft1: jmp left
temdown1: jmp down
temright1: jmp right
temflag1: jmp nflag2
addnum2: add al,1 jmp nflag2
nflag2: add si,3 jmp tempflag2
tgameover1: mov initrow,10 mov initcol,24 mov mrow,1 mov mcol,3 jmp gameover
tempflag2: cmp byte ptr [si+2],3 jz addnum3 jmp nflag3
addnum3: add al,1 jmp nflag3
nflag3: add al,'0' mov score[4],al push ax call dispscore pop ax sub al,'0'
cmp al,3 jz oflag1
jmp hflag1
oflag1: mov ah,0 int 16h cmp al,1bh jz eexit jmp oflag1
eexit: mov ax,0003h int 10h MOV BP,OFFSET SG3 MOV CX,34 MOV DX,0H MOV BH,0H MOV AL,0H MOV BL,00001111B MOV AH,13H INT 10H MOV AH,0 INT 16H cmp al,'y' jz tgameover1 cmp al,'Y' jz tgameover1 jmp exit
sexit2: 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 jmp tempflag3
tgameover2: jmp gameover
tempflag3: push ax call dispscore pop ax sub al,'0'
cmp al,3 jz oflag2
jmp hflag2
oflag2: mov ah,0 int 16h cmp al,1bh jz eeexit jmp oflag2
eeexit: mov ax,0003h int 10h MOV BP,OFFSET SG3 MOV CX,34 MOV DX,0H MOV BH,0H MOV AL,0H MOV BL,00001111B MOV AH,13H INT 10H MOV AH,0 INT 16H cmp al,'y' jz tgameover2
cmp al,'Y' jz tgameover2
jmp exit
hflag2: 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
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
最后于 2019-6-5 14:52
被再战江湖编辑
,原因: 完善代码功能