源代码如下:
DATA SEGMENT
;******** 控制类 ********
HANGID DB 5 ; 行号
POSITION DB 0 ; 字母出现的起始列数
WHICH DB 0 ; SI指针的定位
TOTAL DB 0 ; MODE1下落字母的总数或者是MODE2按键的次数
DELAYTIME DB 03H ; 下落延时(难度控制)
BLANK DB ' ', 0H ; 覆盖用的空格
OUTFLAG DB 0 ; 记录退出选项
DIFFICULTYFLAG DB 0 ; 难度选项
MODEFLAG DB 0 ; 模式选项
;******** 数据类 ********
ARTICLE DB 'Human vision like that of other primates has evolved in an arboreal environment In the dense complex world of a tropical forest it is more important to see well that to develop an acute sense of smell'
LIST DB 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
TIPS1 DB 'I', 0EH, 'N', 0EH, 'S', 0EH, 'T', 0EH, 'R', 0EH, 'U', 0EH, 'C', 0EH, 'T', 0EH, 'I', 0EH, 'O', 0EH, 'N', 0EH, ':', 0EH
TIPS2 DB 'D',0EH, 'I',0EH, 'F',0EH,'F',0EH,'I',0EH,'C',0EH,'U',0EH,'L',0EH,'T',0EH,'Y',0EH,' ',0EH,'S',0EH,'E',0EH,'L',0EH,'E',0EH,'C',0EH,'T',0EH
TIPS3 DB 'MODE SELECT'
TIPS4 DB 'DON''T USE BACKSPACE OR ARROWS, JUST TYPE THE LETTERS!!'
TIPS5 DB 'PRESS ESC TO QUIT'
CONTENT DB 'MODE1: SPEED TYPING; MODE2: EXERCISE TYPING'
STR1 DB 'YOU HAVE SELECTED ', '$'
STR2 DB ' PRESS ANYKEY TO START GAME!', '$'
STR3 DB 'GAME FINISHED! YOUR RANK IS '
STR4 DB 'PRESS ESC TO DIPLAY THE MENU'
STR5 DB 'START TIME: '
STR6 DB 'ACCURACY: '
STR7 DB 'END TIME: '
MAX DB '100 %'
INFO DB 'VERSION: 0.2 PRODUCED BY: Sure'
NORMAL DB 'NORMAL'
HARD DB ' HARD '
MODE1 DB 'MODE1'
MODE2 DB 'MODE2'
YESQUIT DB ' I WANT TO QUIT!! '
NOTQUIT DB 'CONTINUE TO PLAY!!'
ENDL DB 0DH, 0AH, '$'
RANK DB 0
SCORE DB 'SCORE:'
HIT DB 'HIT:'
MISS DB 'MISS:'
SCORENUMBER DB 0 ; 得分
HITNUMBER DB 0
MISSNUMBER DB 0
TEMP DB 2 DUP(0) ; 暂存计算所得的成绩(10进制)
HOUR DB 0 ; 存储小时
MINUTE DB 0 ; 存储分钟
SECOND DB 0 ; 存储秒
THANKS DB 'THANK YOU FOR PLAYING! ^O^'
JIESHU DB 'PRESS ANY KEY TO QUIT...'
DATA ENDS
STACK SEGMENT PARA STACK
DW 100 DUP(0)
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE, SS:STACK, DS:DATA, ES:DATA
BEGIN: MOV AX, DATA
MOV DS, AX
MOV ES, AX
MOV BX, 0 ; 保存当前显示方式
MOV AH, 0FH
INT 10H
PUSH AX
PUSH BX
MOV AL, 03H ; 置显示模式
MOV AH, 0
INT 10H
;********************************开始界面********************************
;**********显示欢迎信息(打字效果)**********
MOV AH, 0EH
MOV BH, 0
MOV AL, 'W'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'E'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'L'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'C'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'O'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'M'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'E'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, ' '
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'T'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'O'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, ' '
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'T'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'H'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'E'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, ' '
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'G'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'A'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'M'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'E'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, ' '
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'W'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'O'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'R'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'L'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, 'D'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, ' '
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, '!'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, ' '
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, '^'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, '_'
INT 10H
CALL DELAY
MOV AH, 0EH
MOV BH, 0
MOV AL, '^'
INT 10H
; **********显示其它提示信息************
MOV BP, OFFSET INFO
MOV CX, 32D
MOV DH, 0
MOV DL, 46D
MOV AL, 1
MOV BL, 0BH
MOV AH, 13H
INT 10H
CALL END