📄 dzyx.asm.txt
字号:
inc si
cmp [si],ah
je gobackto_di
cmp present_position,78d
je from_one
jmp nextsi
from_one:mov present_position,01h
jmp gobackto_si
recycle:mov letter_counter,00h
mov present_position,01d
lea si,position_flag
mov cx,00h
mov ah,00h
clearsi: mov [si],ah
inc cx
cmp cx,78d
je nextcycle
inc si
jmp clearsi
nextcycle:
lea di,letters
lea si,position_flag
add present_position,31d
cmp present_position,78
ja from_front
gobackto_si:
add si,word ptr present_position
dec si
mov ah,[si]
cmp ah,01h
je find_zero
gobackto_di:
mov ah,01h
mov [si],ah
add di,word ptr present_position
dec di
mov dl,present_position
mov ah,02h
mov bh,00h
mov dh,01h
int 10h
mov cx,00h
nextrow: push cx
mov cx,00h
out_cycle: ; 延迟
push cx
mov cx,00h
in_cycle:
add cx,01h
cmp cx,1000
jne in_cycle
push dx
mov ah,06h ;从键盘输入字符
mov dl,0ffh
int 21h
pop dx
jz pass
cmp al,1bh ;如果键入ESC,则返回主菜单
je to_start1
cmp al," " ;如果键入SPACE,则游戏暂停
je pause
cmp al,[di] ;输入字母正确!则字母消失
je disappear
pass: pop cx
inc cx
cmp cx,speed
je print
jmp out_cycle
pause: push dx ;暂停处理
mov ah,06h
mov dl,0ffh
int 21h
pop dx
cmp al," "
jne pause
jmp pass
to_start1: ;返回主菜单
jmp start
print:
mov ah,0ah ;在当前光标位置写空格
mov al," "
mov bh,00h
mov cx,01h
int 10h
inc dh
mov ah,02h ;改变光标位置
mov bh,00h
int 10h
mov ah,0ah ;在当前光标位置写字母
mov al,[di]
mov bh,00h
mov cx,01h
int 10h
pop cx
inc cx
cmp cx,21d
je print_next_letter
jmp nextrow ;下一行
disappear: ;击中字母后输出空格
pop cx
pop cx
mov ah,0ah
mov al," "
mov bh,00h
mov cx,01h
int 10h
jmp hit
print_next_letter:
lea si,life_flag
add si,word ptr present_position
dec si
mov ah,0ah
mov al," "
mov bh,00h
mov cx,01h
int 10h
inc dh
mov ah,02h
mov bh,00h
int 10h
mov ah,0ah
mov al," "
mov bh,00h
mov cx,01h
int 10h
mov ah,1
mov [si],ah
hit: mov ah,02h
mov bh,00h
mov dh,01h
mov dl,present_position
int 10h
mov al,[di] ; 出现下一个新字母的数法
add al,7
cmp al,7ah
ja convey_letter
mov ah,0ah
mov bh,00h
mov cx,01h
int 10h
mov [di],al
add letter_counter,01h
jmp nextcycle
convey_letter:
sub al,7ah
add al,61h
mov ah,0ah
mov bh,00h
mov cx,01h
int 10h
mov [di],al
add letter_counter,01h
jmp nextcycle
clear_screen 01,01,23,78
mov ah,02h
mov bh,00h
mov dh,11d
mov dl,20d
int 10h
inc dh
inc dh
mov ah,02h
mov bh,00h
int 10h
notkey:
mov ah,07h
int 21h
cmp al,0dh
je to_start
cmp al,1bh
je over
jmp notkey
to_start:
clear_screen 00,00,24,79
jmp start
over: clear_screen 01,01,23,78
mov ah,02h
mov bh,00h
mov dh,11d
mov dl,15h
int 10h
mov ah,02h
mov bh,00h
mov dh,13d
mov dl,15h
int 10h
mov ah,07h
int 21h
mov ah,07h
int 21h
clear_screen 00,00,24,79
mov ax,4c00h
int 21h
main endp
code ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -