我提示用户输入:
mov ah, 0Ah
mov dx, OFFSET buffer
int 21h
我的作业告诉我 control-c 应该“用适当的错误消息中止程序”。这是如何完成的?
提前谢谢您。
最佳答案
始终引用 Ralf Brown 的 16 位编程中断列表。
Int 21/AH=0Ah (BUFFERED INPUT)说:
Notes: ^C/^Break are checked, and INT 23 is called if either detected.
Int 23h (CONTROL-C/CONTROL-BREAK HANDLER)说:
Any DOS call may safely be made within the INT 23 handler, although the handler must check for a recursive invocation if it does call DOS.
使用Int 21/AH=25h (SET INTERRUPT VECTOR)注册您自己的中断处理程序,您可以在其中打印消息并退出。
相关:
关于assembly - 使用 DOS 中断 0Ah 中止输入 (ctrl-c) 时显示错误消息(读取输入到缓冲区),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19395905/