Page 1 of 1

IRQ handler Ok?

Posted: Sun Dec 29, 2002 3:50 pm
by jrfritz
I would like to know if this IRQ handler is OK...anything special I should add/anything missing?

Code: Select all

IRQ_0:      ;PIT (Programmable Interrupt Timer)
   ;****************************************************
   ;* A sample of how to handle a interrupt from IRQ 0 *
   ;****************************************************
   PUSHA
   CALL PIT_Handler
   MOV AL, 0x20
   OUT 0x20, AL
   POPA
   IRET

IRQ_1:      ;Keyboard
   ;*****************************************************
   ;* A sample of how to handle an interrupt from IRQ 1 *
   ;*****************************************************
   PUSHA
   CALL KHan
   MOV AL, 0x20
   OUT 0x20, AL
   POPA
   IRET

Re:IRQ handler Ok?

Posted: Sun Dec 29, 2002 5:02 pm
by Unexpected
I think all ok ;D

Re:IRQ handler Ok?

Posted: Mon Dec 30, 2002 2:03 am
by K.J.
Looks good... though you might want to save/change cs, ds, es, or ds later on when you get multiple rings.

K.J.

Re:IRQ handler Ok?

Posted: Mon Dec 30, 2002 5:59 am
by Whatever5k
I would recommend to save (push) all registers and load them with a selector that is known to be ok. Something like this:

Code: Select all

...
pusha
mov eax, DS_SELECTOR
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
...