Sunteți pe pagina 1din 17

Interrupts in 8086

Learning Objectives

After going through this part of the lesson, you


will be able to:

 Understand what is Interrupt & Interrupt Vector Table.


 Explains the response of 8086 when an interrupt occurs.
What is an Interrupt

An interrupt is the method of processing the microprocessor


by peripheral device. An interrupt is used to cause a
temporary halt in the execution of program.

Microprocessor responds to the interrupt with an interrupt


service routine, which is short program or subroutine that
instructs the microprocessor on how to handle the interrupt.
Interrupts

 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.
 An IRET instruction at the end of the interrupt
service procedure returns execution to the
interrupted program.
Sources of Interrupts

1. external signal applied to the non- mask able interrupt (NMI)


input pin or to the interrupt(INTR) input pin.

2. execution of the interrupt instruction.

3. some error condition produced in the 8086 by the execution of


an instruction
How Microprocessor knows about Interrupt
Occurrence

At the end of each instruction cycle, the 8086 checks to see if any
interrupts have been requested, the 8086 responds to the interrupt
By stepping through the following series of major actions.
How 8086 responds to Interrupts

1. It decrements the stack pointer by 2 and pushes the flag register


on the stack.

2. It disables the 8086 INTR interrupt input by clearing the


interrupt flag in the flag register.

3. It resets the trap flag in the flag register.


How 8086 responds to Interrupts

4. It decrements the stack pointer by 2 and pushes the current


code segment register contents on the stack.

5. It decrements the stack pointer again by 2 and pushes the


current instruction pointer contents on the stack.

6. It does an indirect far jump to the start of the procedure the


user has written to response to the interrupt.
8086 Interrupt Response

Main line program

Push Flags
Clear IF
Clear TF
Push CS
Push IP
Fetch ISR address

Pop IP
Pop CS
Pop Flags
Interrupt Vector Table

256 interrupts
1. 0-4 dedicated
2. 5-31 reserved for system
use
08-0FH -8259
10-1FH- BIOS
3. 32-255 reserved for users
20-3FH –DOS
40-FFH open
Interrupt Vector Table

 The interrupt vector table contains 256 four byte entries,


containing the CS:IP Interrupt vectors for each of the 256
possible interrupts.

 The table is used to locate the interrupt service routine


addresses for each of those interrupts.

 The Interrupt vector table is located in the first 1024 bytes of


memory at addresses 00000H-003FFH.It contains the
address(segment and offset)of the interrupt service provider.
Interrupt Vector Table

 So it takes 1024 bytes (1 kb) memory for interrupt vector table.

 the call to interrupt service routine is similar to far procedure


call.
Dedicated Interrupts

1. DIVIDE-BY-ZERO INTERRUPT-TYPE 0.

2. SINGLE STEP INTERRUPT-TYPE 1.

3. NONMASKABLE INTERRUPT-TYPE 2.

4. BREAKPOINT/INT INSTRUCTION INTERRUPT-TYPE 3.

5. OVERFLOW INTERRUPT-TYPE4.
Reserved Interrupts

Interrupts 5-31 are reserved by Intel for use in most complex


microprocessors such as 80286,80386,80486.
32-255 reserved for users
20-3FH –DOS
40-FFH open
Available Interrupts

Interrupts 32-255 are available for you to use for Hardware or


Software interrupts.

08-0FH -8259A
10-1FH- BIOS
Int 17H
Summary

 Interrupt responses.

 Interrupt Vector table is used to load the starting address of the


ISRs.

 Types of Interrupts.

Source: Microprocessors and Interfacing,


Douglas V Hall, TMH publications.
Thank You

S-ar putea să vă placă și