是否有可能使大会自定义中断? [英] Is it possible to make a custom Interrupt in Assembly?

查看:139
本文介绍了是否有可能使大会自定义中断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在汇编语言中,我们有DOS中断INT 21H,这不是一个硬件中断。

In Assembly Language we have the DOS interrupt INT 21h, which is not a hardware interrupt.

我想知道是否有可能写我自己的中断并调用它。

I was wondering if it was possible to write my own interrupt and call it.

如果可能的话,请建议链接或方法。

If possible, please suggest links or methods.

推荐答案

是的,你可以创建自己的interrput处理程序,并调用它,只要你想。
您将需要设置中断向量(它开始于0000地址:0000)。指向你自己的中断处理程序

Yes, you can create your own interrput handler and call it whenever you want. You will need to set up the interrupt vector (which starts at address 0000:0000) to point to your own interrupt handler.

指针到每个处理器占用4个字节(偏移和段),所以如果比如你要设置你的INT 22H中断处理程序,你会在位置0000更新interrput载体:0088H指向你的处理程序

The pointer to each handler consumes 4 bytes (offset and segment) so if for example you want to setup your interrupt handler for INT 22h you would update the interrput vector at location 0000:0088h to point to your handler.

Brown的中断列表检查未使用的中断号(至少一个不使用硬件interrput )。

Check Ralph Brown's interrupt list to check an unused interrupt number (at least one that is not used by a hardware interrput).

下面去的如何设置中断22小时的处理程序的例子:

Here goes an example of how to set up a handler for interrupt 22h:

INITIALIZE: 
      XOR AX,AX
      MOV ES,AX
      CLI ; Disable interrupts, might not be needed if seting up a software-only interrupt
      MOV WORD PTR ES:[136], OFFSET INT22  ; setups offset of handler 22h
      MOV WORD PTR ES:[138], CS            ; Here I'm assuming segment of handler is current CS
      STI ; Reenable interrupts
      ; End of setup


INT22  PROC FAR
       ; Here goes the body of your handler
       IRET
INT22  ENDP

这篇关于是否有可能使大会自定义中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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