Interrupt Structure of 8086
Interrupt Structure of 8086
• Nested interrupts.
1.External interrupts
– These interrupts are generated by external devices
i.e out side the processor (uing NMI, INTR pins). Eg:
Keyboard interrupt.
1.Internal interrupts
– It is generated internally by the process circuit or
by the execution of an interrupt instruction. Eg: INT
instruction, overflow interrupt, divide by zero. At
the end of each instruction cycle, the 8086 checks
to see if any interrupts have been requested.
8086 Interrupt Vector Table
– The first 1Kbyte of memory of 8086 (00000 to
003FF) is set aside as a table for storing the
starting addresses of Interrupt Service Procedures
(ISP).
3.Priority Resolver:-
This unit determines the priorities of the interrupt requests
appearing simultaneously.
The highest priority is selected & stored into the
corresponding bit during INTA pulse.
IR0 - highest priority
IR7 - lowest priority ; in fixed priority.
4. Interrupt Mask Register (IMR):-
This register stores the bits required to mask
the interrupts inputs. IMR operates on IRR at
the direction of the Priority Resolver.
1. One or more IR lines are raised high that set corresponding IRR bits.
4. Upon receiving an INTA signal from the CPU, the highest priority ISR
bit is set and the corresponding IRR bit is reset. The 8259A does not
drive data bus during this period.
5. The 8086 will initiate a second INTA pulse. During this period 8259A
releases an 8-bit pointer on to data bus from where it is read by the
CPU.
6. This completes the interrupt cycle. The ISR bit is reset at the end of
the second INTA pulse if automatic end of interrupt (AEOI) mode is
programmed. Otherwise ISR bit remains set until an appropriate EOI
command is issued at the end of interrupt subroutine.
Command Words of 8259A
• The command words of 8259A are classified in two groups
1. Initialization Command Words (ICWs)
2. Operation Command Words (OCWs)
b) IMR is cleared
A0 D7 D6 D5 D4 D3 D2 D1 D0
1=ICW4 Needed
0= No ICW4 Needed
A0 D7 D6 D5 D4 D3 D2 D1 D0
1 T7 T6 T5 T4 T3 A10 A9 A8
A0 D7 D6 D5 D4 D3 D2 D1 D0
1 S7 S6 S5 S4 S3 S2 S1 S0
A0 D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 0 0 ID2 ID1 ID0
A0 D7 D6 D5 D4 D3 D2 D1 D0
1= 8259 is Master
1= Buffered mode 0= 8259 is slave
0= Un buffered mode If BUF=0, M/S is neglected
Operation command words (OCWs)
• Automatic Rotation
– This is used in the applications where all the interrupting
devices are of equal priority.
IR0 --- 2
• Poll command
– In this mode, the INT output is neglected.
– The poll mode is entered by setting P=1 in OCW3.
The 8259A is polled by using software execution by
µp instead of the requests on INT input. It is not
used in 8086.
• Special Fully Nested Mode (SFNM)
– This mode is used in more complicated systems, where cascading
is used and the priority has to be programmed in the master
using ICW4.
– In this mode the master interrupts the µp only when the interrupt
device has a higher or the same priority than the one currently
being served.
• Buffered Mode
– When the 8259A is used in the systems in which bus driving
buffers are used on data buses (e.g. cascade systems) the
problem of enabling the buffers arises. The 8259A sends a buffer
enable signal on SP / EN pin whenever data is placed on the bus.
• Cascade Mode
– The master controls the slaves using CAS0-CAS2 which act as
chip select inputs for slave. In this mode, the slave INT output
are connected with master IR inputs. EOI issued twice one for
master other for slave.
Interfacing 8259A with
A9 8086
A8
A7
A6
A10
+Vcc
G1
G2 G3
M/IO A5 A4
A2 74LS IR0
A3 CS
A1 138 Y0 IR1
A2 A0 IR2
8086 WR WR IR3
RD RD 8259
IR4
INTA INTA IR5
INTR INT IR6
A1 A0 IR7
D0-D7
GND
Interfacing and Programming 8259
Problem:
Show 8259A interfacing connections with 8086 at the
address 07x. Write an ALP to initialize the 8259A in single
level triggered mode, with call address interval of 4, non-
buffered, no special fully nested mode. Then set the
8259A to operate with IR6 masked, IR4 as bottom priority
level, with special EOI mode. Set special mask mode of
8259A. Read IRR and ISR into registers BH and BL
respectively. IR0 of 8259 will have type 80h.
7. OCW3 (to set Special Mask Mode, and read IRR, ISR)
A0 D7
a) OCW3 = 0 0 1 1 0 1 0 1 0 = 6Ah (to read IRR)
b) OCW3 = 0 0 1 1 0 1 0 1 1 = 6Bh (to read ISR)
ALP program:
CODE SEGMENT
ASSUME CS:CODE
START:
MOV DX, 0070h
MOV AL, IFh ; for ICW1
OUT DX, AL
IN AL,DX
MOV BH,AL
MOV AH,4Ch ;Return to DOS
INT 21H
CODE ENDS
END START
DOS & BIOS Interrupts
BIOS Interrupts
Ex:
MOV AH, 03h ; Request curser location
MOV BH, 00h ; Page No: is 0
INT 10h
Eg:
MOV AH, 07h ; request keyboard input
INT 21h