1.测试练习打字速度
要求:
(1)屏幕提示字符,键盘输入字符,回车结束.
(2)用日时钟中断,55 ms定时.
DATA SEGMENT
Mes1 DB 'Please input a character : $'
Mes2 db 'Input character numbers: $'
Mes3 db ' Times: $'
Mes4 db 0ah,0dh,'$'
ICOUNT DB 0
Count db 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
CLI
MOV AX,351CH ;调用21H中断的35H子功能保存
INT 21H ;原中断向量
MOV INTSEG,ES
MOV INTOFF,BX
PUSH DS ;调用21H中断的25H子功能
MOV AX,SEG INTPROC ;设置中断向量表内容
MOV DS,AX
MOV DX,OFFSET INTPROC
MOV AX,251CH
INT 21H
POP DS
STI
MOV DX, OFFSET MES1
CALL DISP
SCAN: MOV AH,1
INT 21H
INC COUNT
CMP
JNZ SCAN
CLI
MOV DX,INTOFF ;恢复1CH中断向量
MOV AX,INTSEG
MOV DS,AX
MOV AX,251CH
INT 21H
MOV DX, OFFSET MES2
CALL DISP
MOV
CALL DISPP
MOV DX, OFFSET MES4
CALL DISP
MOV DX, OFFSET MES3
CALL DISP
MOV AL, ICOUNT
CALL DISPP
STI
MOV AH,4CH ;返回DOS
INT 21H
INTPROC PROC
PUSH AX
PUSH DS
STI
MOV AX,DATA
MOV DS,AX
INC ICOUNT ;中断计数
EXIT: CLI
POP DS
POP AX
IRET
INTPROC ENDP
DISP PROC
MOV AH, 9
INT 21H
RET
DISP ENDP
DISPP PROC
PUSH AX
MOV CL, 4
SHR AL, CL
AND AL, 0FH
ADD AL, 30H
MOV BL, AL
POP AX
AND AL,0FH
ADD AL, 30H
PUSH AX
MOV DL , BL
MOV AH, 2
INT 21H
POP AX
MOV DL,
MOV AH, 2
INT 21H
RET
DISPP ENDP
CODE ENDS
END START