Page 1 of 1

How to set address of the interrupt handler

Posted: Mon Aug 18, 2003 11:00 pm
by The_Pro
I'm writing a protected mode os. I've jumped into the protected mode. I have planned to write the interrupts now. I have written an interrupt handler and i'm struck with how to assign the address of the handler in the IDT, since, the offset0_15 and offset16_31 are to be assigned seperately. I have given the coding.

idt:

offset0_15 dw ?
selector0_15 dw 08h
zero_byte db 0
iflags db 8eh
offset16_31 dw ? ; how to assign

idt_end:


     Consider this as an interrupt handler.

demo_int:
mov ax, 10h
mov ds, ax
mov ss, ax
mov esp, 090000h
mov byte [0xb8000], 'A'
mov byte [0xb8001], 1Bh
iretd


And another question is what is the second word selector0_15 called ? Please help me out of this two problems.

Thank  you.

RE:How to set address of the interrupt handler

Posted: Mon Aug 18, 2003 11:00 pm
by Adek336
It is quite simple to divide long word into words:

mov eax, demo_int

mov [offset0_15], ax
shr eax, 16
mov [offset16_31], ax

selector0_15 is the segment selector for the isr, it should be a code segment.

Cheers,
Adrian.

PS I wonder why so many people ask about setting an interrupt lately?