如何使用DOS中断21h / AH = 25h(设置中断向量)? [英] How do I use DOS interrupt 21h/AH=25h (set interrupt vector)?

查看:833
本文介绍了如何使用DOS中断21h / AH = 25h(设置中断向量)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提示用户输入:

mov ah, 0Ah
mov dx, OFFSET buffer
int 21h

我的作业告诉我ctrl-c应该通过适当的错误消息中止程序。

My assignment tells me that ctrl-c should "abort the program with an appropriate error message".

有人告诉我,只要调用或检测到ctrl-c,就会调用int 23h。显然,我可以通过int 21h / ah = 25h注册自己的中断处理程序。

I was told that int 23h is called whenever ctrl-c is called or detected. Apparently I can register my own interrupt handler via int 21h / ah=25h.

但是我不知道如何制作中断处理程序,也不知道应该在代码中将其放置在什么地方。谢谢您的帮助,在此先感谢您。

But I don't know how to make an interrupt handler, nor do I know where this is supposed to go in my code. Assistance would be appreciated, thank you in advance.

推荐答案

执行以下操作以编写您的自定义中断处理程序

do followings to write your custom interrupt handler

SettingIntVector:
     mov ah,25h      ;Here set your ah register for calling Interrupt vector
     mov al,22h      ;Your Interrupt Address
     mov dx,IntHandlerCode   ;Interrupt Handler
     int 21h                 ;Dos Interrupt 



 IntHandlerCode:
    mov ah,9
    mov dx, offset our_text
     mov ah,9
    int 21h   
    iret

our_text db "new Interrupt Handler... $"

我希望这有助于弄清事物的工作原理。该中断只需在屏幕上写新的中断处理程序

I hope this helped to figure out how stuff works. This Interrupt Just write "new Interrupt Handler " to screen

这篇关于如何使用DOS中断21h / AH = 25h(设置中断向量)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆