## 6.28  THE 'END OF INTERRUPT' SIGNAL

Interrupts 8 to 15 (corresponding to IRQ0 to 7) and interrupts 70 hex to
77 hex
(corresponding to IRQ8 to 15) are generated by hardware devices.  An
interrupt
service routine for these interrupts must inform the 8259 PIC(s) when the
devicewhich generated the interrupt has been serviced, so that the PIC can
reset its
priority structure.  This is done using a non-specific EOI (end of
interrupt)
command to the PIC.  For int 8 to 15 (IRQ0 to IRQ7), a single EOI is used:

        outportb(0x20, 0x20);           in C, or

        mov al,20h
        out 20h,al                      in assembler.

For int 70 hex to 77 hex (IRQ8 to IRQ15), two EOIs are used:

        outportb(0xA0, 0x20);
        outportb(0x20, 0x20);           in C, or

        mov al,20h
        out 0A0h,al
        out 20h,al                      in assembler.

For IRQ8 through IRQ15, the EOI is typically sent to the secondary PIC
first,
as in these examples, though I don't bel

You can use the specific EOI command if you prefer - the value is 60 hex
plus
the IRQ number within the PIC, for example to send a specific EOI for
IRQ4:

        outportb(0x20, 0x64);

and to send a specific EOI for IRQ11:

        outportb(0xA0, 0x63);   /* IRQ11 is input 3 on the second PIC */
        outportb(0x20, 0x62);   /* The chain IRQ is IRQ2 */




IntHandler:     sti
                push    ax
                push    other registers
                ; ... interrupt processing here
                pop     other registers
IntFinished:    mov     al,20h
                cli
                out     20h,al
                pop     ax
                iret


## 6.32  WRITING INTERRUPT HANDLERS IN ASSEMBLY LANGUAGE

Here are some guidelines and warnings that you should heed if you are
coding
an interrupt handler in assembly language.

On entry to the interrupt handler, the only registers that will be known
are
CS and IP.  DS is undefined.  You must preserve any other registers that
you
modify, except the flags (which will be restored by the IRET).


