代码如下:
DSEG SEGMENT
SPACES DB 20H, 20H, 20H, 20H, 24H
LINE DB 0DH, 0AH, 24H
DSEG ENDS
SSEG SEGMENT PARA STACK
DW 256 DUP(?)
SSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
BEGIN:
MOV AX, DSEG
MOV DS, AX
LOOP1:
MOV AH, 08H
INT 21H
; 判断回车键
MOV DL, AL
CMP DL, 0DH
JNE LOOP3
MOV DX, OFFSET LINE
MOV AH, 9
INT 21H
JMP LOOP1
LOOP3:
; 判断 SHIFT 键
MOV DL, AL
CMP DL, 0EH
JNE LOOP2
MOV DX, OFFSET SPACES
MOV AH, 9
INT 21H
JMP LOOP1
LOOP2:
; 判断 ESC 键
MOV DL, AL
CMP DL, 1BH
JE EXIT
; 显示字符
MOV DL, AL
MOV AH, 02H
INT 21H
JMP LOOP1
EXIT:
MOV AH, 4CH
INT 21H
CSEG ENDS
END BEGIN
这个比较花时间,要找回MASM,及在DOS上运行调试。网上有这资料。