Reprogramming interrupt in c / asm x86

My problem is that I have to reprogram interrupts without using system libraries like dos.h, so I cannot use functions like getvect or setvect. I made a working program in C (with asm inserts), but it uses DOS functions. How to do this without dos.h and use asm instead?

I thought about writing a program in a fixed place in memory, and then I change adres in the interrupt vector table, but I have no idea how to do this - especially this program is mainly in C.

I need to reprogram the system clock interrupt and LPT interrupt. The system clock timer has been accelerated, so every few times I have to generate an initial system interrupt.

+4
source share
1 answer

As far as I remember, the interrupt table started at 0000: 0000h. There are 4 bytes per interrupt entry: 2 bytes for segment 2 for offset.

xor ax, ax mov es, ax mov bx, interrupt_number mov ax, cs mov es[bx*4], ax mov es[bx*4+2], offset yourSubroutine 

It should be something like this, although I do not really remember

+3
source

Source: https://habr.com/ru/post/1400878/


All Articles