Professional Documents
Culture Documents
Ahmed H. Zahran
8086 Interrupts
Contents
1 Introduction to Interrupts 2 8086 Interrupts
2.1 2.2 8086 Interrupt vector Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 4
4 4
Introduction to Interrupts
Interrupts are special type of CALLS. That is to say that interrupts stops instruction sequential execution to execute a subroutine (usually called
Interrupt handler).
ELC-203: Computer II
Lecture Notes
Ahmed H. Zahran
table.
Interrupt vector
Software generated interrupts; e.g. INT 21. Software interrupts are commonly used to perform system procedures. hardware generated interrupts. For example interrupts generated by external devices such as the keyboard and mouse.
ELC-203: Computer II
Lecture Notes
Ahmed H. Zahran
INTA is used to acknwledge the interrupt by the processor. the processor performs the following operations if
FLAGS is pushed onto the stack Both the interrupt (IF) and trap (TF) ags are cleared, which disables the INTR pin and the trap or single-step feature. The CS and IP are pushed onto the stack. The processor generates
IN T A
receiving the type of the interrupt in the second The interrupt vector contents starting at and execution resumes in the ISR.
IN T A
cycle
IRET
(Interrupt
On executing the IRET instruction, CS, IP and FLAGS are popped freom the stack.4 IF and TF are set to the state prior to the interrupt.
ELC-203: Computer II
Lecture Notes
Ahmed H. Zahran
2
2.1
8086 Interrupts
8086 Interrupt vector
Vector number Description
2.2
Type 0: Divide Error (Division by zero) Type 1: Debug Interrupt (Single step) Type 2: NMI Interrupt (Emergency events) Type 3: Breakpoint (e.g. INT 3 in the code) Type 4: Interrupt on overow
Type codes 5 through 31 are reserved by the Intel (actually many of them are used in the following Intel processors) Type codes 32-255 can be used.
Example
in al , 3 7 8 ; cmp al , 6 0 j l low cmp al , 8 0 j l e ok jg high low : mov al , 1 out 1 2 7 , al ; t u r n "on" h e a t e r @ p o r t 1 2 7 . jmp ok high : mov al , 0 out 1 2 7 , al ; t u r n " o f f " h e a t e r @ p o r t 1 2 7 ok : IRET ; mov mov mov mov mul mov mov mov add mov
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ax , 0 ;
CISR :
ELC-203: Computer II
2.2
Example
Ahmed H. Zahran
References
ELC-203: Computer II
Lecture Notes