Professional Documents
Culture Documents
Lecture 07
Interrupt Cycles
Interrupt Types
Interrupt Programming
ECEg - 4501 1
Basics
AAiT
After executing ISR, the control is transferred back again to the main
program which was being executed at the time of interruption.
ECEg - 4501 2
Interrupt Cycle AAiT
ECEg - 4501 3
Interrupt Cyclecntd
AAiT
ECEg - 4501 4
Interrupt Cyclecntd AAiT
ECEg - 4501 5
Interrupt Cyclecntd AAiT
ECEg - 4501 6
Interrupt Cyclecntd AAiT
Main line
Program ISR
PUSH FLAGS
CLEAR IF
CLEAR TF
PUSH CS
Interrupt PUSH IP
FETCH ISR ADDRESS
IRET
POP IP
POP CS
POP FLAGS
ECEg - 4501 7
Interrupt typescntd AAiT
ECEg - 4501 8
Interrupt typescntd AAiT
ECEg - 4501 9
Interrupt typescntd AAiT
3FF
3FC
Available Interrupts
(224)
84
Reserved Interrupts
(27)
10
0C
Dedicated Interrupts
(5) 08
04
00
ECEg - 4501 10
Interrupt Priority AAiT
ECEg - 4501 11
Interrupt Prioritycntd AAiT
Datasheet
Priority of 8086 interrupts. (Intel Corporation, 1978)
ECEg - 4501 12
example AAiT
This program:
reads a string form the key board and convert the
characters into upper case letters and display on the
screen.
ECEg - 4501 13
example AAiT
;data segment
msg1 db 'Enter the String ',0Ah,0Dh,'$'
msg2 db 0ah,'The String in Caps is :, '$' stop:mov str[bx],'$'
str db 80 dup(0) mov dx, offset msg2
data ends mov ah,09h
up: mov ah,01
;code segment int 21h
int 21h
assume cs:code, ds:data mov dx,offset str
cmp al,0Dh
start: mov ax,data mov ah,09h
je stop
mov ds,ax int 21h
cmp al,60H
lea dx,msg1 mov ah,4ch
jc dwn
mov ah,09h int 21h
sub al,20H
int 21h code ends
dwn: mov [bx],al
mov bx,offset str ;end start
inc bx
mov str[bx],0ah
inc bx jmp up
ECEg - 4501 14
More on Assembly language
AAiT
Whats a macro?
ECEg - 4501 15
Macros AAiT
ECEg - 4501 17
Class exercise AAiT
ECEg - 4501 18
Solution to the exercises
AAiT
1. cntd
1. cntd
do: mov dx, [bx] ;element to be displayed in dx
int 21h ;display interrupt (with ah=2)
mov dx, , ;print comma b/n the numbers
int 21h
Inc bx ;point to the next element
loop do ;do this 5 times
More to do: Modify this prog. to take any length of array from the
user. Prompt the user for the length of the array and the elements
So the display looks like this:
Enter the length of the array: 4
Enter the elements of the array: 2 9 7 5
The array in increasing order is: 2, 5, 7, 9
ECEg - 4501 21
Solution to the exercises
AAiT
ECEg - 4501 22