CE 302 Lecture notes Week 12 v4N
CE 302 Lecture notes Week 12 v4N
Interrupts
These lecture notes are based on the book by Muhammed Ali Mazidi,
Janice Gillispie Mazidi, Danny Causey; «The x86 PC assembly language,
design, ad interfacing», 5the Ed., Prentice Hall
8088/86 INTERRUPTS
u An interrupt is an external event that
informs the CPU that a device needs its
service.
u In 8088/86 there are a total of 256 interrupts.
u INT 00, INT 01, ..., INT FF (sometimes called TYPEs).
https://www.tutorialspoint.com/microprocessor/microprocessor_8086_interrupts.htm
8088/86 INTERRUPTS
categories of interrupts
u Three x86 pins are associated with hardware interrupts...
u INTR (interrupt request)
u NMI (non-maskable interrupt)
u INTA (interrupt acknowledge)
u INTR is a CPU input signal, which can be masked (ignored) &
unmasked through use CLI and STI.
u NMI, also an input signal into the CPU, cannot be masked and
unmasked using CLI & STI.
u For this reason, it is called a non-maskable interrupt.
8088/86 INTERRUPTS
hardware interrupts
u INTR and NMI are activated externally by putting 5V on the x86
microprocessor NMI & INTR pins.
u On activation of either interrupt, x86:
u Finishes the instruction it is executing.
u Pushes FR & CS:IP of the next instruction onto the stack.
u Jumps to a fixed location in the interrupt vector table and fetches the CS:IP
for the interrupt service routine (ISR) associated with that interrupt.
• At the end of the ISR, IRET causes the CPU to get (pop)
back its original FR and CS:IP from the stack.
– Forcing the CPU to continue at the instruction where it left off
when the interrupt came in.
8088/86 INTERRUPTS
hardware interrupts
u Intel has embedded "INT 02" in x86, only for NMI.
u When the NMI pin is activated, the CPU location 00008 to get the
address (CS:IP) of the ISR.
u Memory locations 00008, 00009, 0000A, and 0000B contain the 4 bytes of
CS:IP of the ISR belonging to NMI.
u There is no specific location in the vector table assigned to
INTR.
u Allowed to use any "INT nn" not previously assigned.
u The INTR interrupt is usually activated by an external hardware device
u The 8259 programmable interrupt controller (PIC) chip can be
connected to INTR to expand the number of hardware interrupts to 64.
Example HW interrupt
Example
If an interrupt C2H is to be issued, what would be the values 2A4-1A1?
D2 is always set
low (= 0) for x86.
D3 chooses between level
triggering or edge triggering
of the input signals IR0–IR7.
D4 must always be high.
D5, D6, and D7 are all low
for x86 processors.
(a) Find the ICWs of the 8259 if it is used with an 8088/86 CPU, single, level
triggering IRs, and IR0 is assigned “INT 50H.” The 8259 is in slave buffered mode
with normal EOI.
(b) Show the program to initialize the 8259 using the port addresses 26H
(c) Find the addresses associated with IR0, IR1, and IR2 in the interrupt vector
table.
Note: This example is not PC-compatible and is given only for an exercise
Solution (a)
ICW1 1BH
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 1 1 0 1 1
ICW2 50H
D7 D6 D5 D4 D3 D2 D1 D0
0 1 0 1 0 0 0 0
ICW4 09H
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 1 0 0 1
Solution (b) and ( c )
8259 INTERRUPT CONTROLLER
masking/prioritization IR0–IR7 interrupts
Figure 14-9
PC Sources of Hardware Interrupts
USE OF THE 8259 CHIP IN x86 PCs
sources of NMI
u The NMI, nonmaskable interrupt, is a CPU pin, and cannot be masked (disabled)
by software.
u There are three sources of activation of the NMI:
1. NPIRQ. (numerical processor interrupt request)
2. Read/write PCK. (parity check)
3. IOCHK. (input/output channel check)
u The PC recognizes which of interrupt requests has been activated by checking
input port C of the 8255.
USE OF THE 8259 CHIP IN x86 PCs
sources of NMI