0% found this document useful (0 votes)
24 views13 pages

CH 8

The document discusses interrupts in computers. An interrupt suspends the currently running program to service another program with higher priority. When the interrupt service routine finishes, it returns execution back to the original program. The 8086 microprocessor supports two types of interrupts - predefined interrupts from errors, and user-defined interrupts from hardware signals or software instructions. When an interrupt occurs, the 8086 pushes registers to the stack, loads the interrupt service routine address from a table, services the interrupt, then pops registers and returns.

Uploaded by

Gcross NG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views13 pages

CH 8

The document discusses interrupts in computers. An interrupt suspends the currently running program to service another program with higher priority. When the interrupt service routine finishes, it returns execution back to the original program. The 8086 microprocessor supports two types of interrupts - predefined interrupts from errors, and user-defined interrupts from hardware signals or software instructions. When an interrupt occurs, the 8086 pushes registers to the stack, loads the interrupt service routine address from a table, services the interrupt, then pops registers and returns.

Uploaded by

Gcross NG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

INTERRUPTS

CHAPTER 8
What is an interrupt?
 capability to suspend the execution of running
program and execution of another program to fulfill
specific requirement upon request.

 after finishing the second program, automatically


return to the first program and start execution from
where it was left.
• Most microprocessors allow normal program
execution to be interrupted by some external signal or
by a special instruction in the program.

• In response to an interrupt, the microprocessor stops


executing its current program and calls a procedure
which “services” the interrupt.

• A special instruction --- IRET(interrupt return) --- at


the end of interrupt-service procedure returns
execution to the interrupted main program.
8086 interrupts can be classified into two types:
• 1) Predefined interrupt
some error condition produced by execution of an
instruction, e.g., trying to divide some number by
zero.
• 2) User defined interrupt
– i) hardware interrupt
– An external signal applied to INTR pin
– ii) software interrupt
– execution of interrupt instruction INT
• At the end of each instruction cycle, 8086 checks to see if
any interrupts have been requested.

• If yes, then 8086 responds to the interrupt by stepping


through the following series of major actions:
1. It decremented SP by 2 and pushes Flag register on
the stack.
2. It disables 8086 INTR input by clearing IF flag in
Flag register
3. It resets the TF (trap) flag in Flag register
4. It decremented SP again by 2 and pushes current
CS contents on the stack.
5. It decremented SP again by 2 and pushes current IP
contents on the stack.
6. It does an indirect far jump to the start of the
procedure written to respond to the interrupt.
Con.. 1. Push FLAGS Interrupt Service
main
Program 2. Clear IF Routine (ISR)
3. Clear TF
4. Push CS PUSH registers
5. Push IP ...
6. Fetch ISR ...
address ...
....
...
POP IP
....
POP CS ...
POP FLAGS ....
POP registers
IRET
• How does 8086 get to Interrupt Service
Routine?

Simple. It loads its CS and IP registers


with the address of ISR.

So, the next instruction to be executed


is the first instruction of ISR
• How does 8086 get the address of Interrupt Service
Routine (ISR)?
– It goes to specified memory location to fetch
four consecutive bytes
• higher two bytes to be used as CS
• lower two bytes to be used as IP
• How does 8086 get the address of that
specified memory location?
– In an 8086 system, the first 1Kbytes of
memory, from 00000 to 003FF, is set aside
as a Table for storing the starting addresses
of interrupt service routines.
– Since 4 bytes are required to store CS and
IP values for each ISR, the Table can hold
the starting addresses for up to 256 ISRs.
• The starting address of an ISR is often
called
– the interrupt vector or
– the interrupt pointer.
• So the Table is referred to as
– interrupt-vector table or
– interrupt-pointer table.
What happens if two or more
interrupts occur at the same time?

• higher priority interrupts will be served


first
Priorities of 8086 interrupts

Interrupt Type Priority


DIVIDE ERROR, INT n, INT0 HIGHEST
NMI
INTR
SINGLE STEP LOWEST

You might also like