修改中断向量ESC退出
a.读取键盘输入同时屏蔽Ctrl+C,其实是修改23号中断向量;
b.mov ah,35h读取原来的中断向量,mov ah,25h是设置新的中断向量;
代码
CR = 0DH
LF = 0AH
ESCAPE = 1BH
CODES SEGMENT
ASSUME CS:CODES,DS:CODES
NEW23H:IRET
START:
PUSH CS
POP DS
MOV DX,OFFSET NEW23H
MOV AX,2523H
INT 21H
@@:
MOV AH,8
INT 21H
CMP AL,ESCAPE
JZ EXIT
MOV DL,AL
MOV AH,2
INT 21H
CMP DL,CR
JNZ @B
MOV DL,LF
MOV AH,2
INT 21H
JMP @B
EXIT:
MOV AH,4CH
INT 21H
CODES ENDS
END START