8086 Microprocessor Interrupts
8086 Microprocessor Interrupts
8086 Microprocessor Interrupts
Contents
*Introduction
*Interrupts
*Types of interrupts
* Hardware Interrupts
* Maskable & Non-Maskable Interrupts
* Software Interrupts
* 256 Interrupts
Introduction
The meaning of ‘interrupts’ is to break the sequence of operation.
After finishing the interrupt service return to normal operation i.e. keep moving
forward again.
The processor can be interrupted in the following ways
Software Interrupt
Hardware Interrupts
(INT n)
Non-Maskable
Maskable Interrupts Interrupts 256 Types Of
Software Interrupts
Hardware Interrupts
• The interrupts initiated by external hardware by sending an appropriate signal to
the interrupt pin of the processor is called hardware interrupt.
• The 8086 processor has two interrupt pins INTR and NMI. The interrupts
initiated by applying appropriate signal to these pins are called hardware
interrupts of 8086.
Interrupts
Hardware
Interrupts
Maskable Non-
Interrupts Maskable
Interrupts
Interrupts
Hardware
Interrupts
Maskable Non-
Interrupts Maskable
Interrupts
Interrupts
Hardware
Interrupts
Maskable Non-
Maskable
Interrupts Interrupts
Hardware Interrupts
LEA: Load Effective Address loads the specified register with the offset
of a memory location.
Syntax:
LEA register,memory variable
Dx Offset and LEA instruction
0x50 0x51 0x52 0x53 0x54 0x56 0x57 0x58 0x59 0x60 0x61
0 1 2 3 4 5 6 7 8 9 10
H e l l o W o r l d
ends
end start
data segment mov ax, 4c00h
str1 db "Hello World int 21h
",13,10,'$'
ends ends
end start
stack segment
dw 128 dup(0) Output:
Ends
code segment
start:
mov ax,@data
mov ds,ax
mov bx,2
lea dx,str1+bx
mov ah,09h
int 21h
Difference of LEA and Offset instruction
stack segment
dw 128 dup(0)
ends
code segment
start:
mov ax,@data
mov ds,ax
lea dx,mesg
mov ah,09h
int 21h
OR
ends
end start
Function 01 - Read a character input with Echo from
keyboard
Reads a character from the standard input device and echoes it to
The standard output device. If no character is ready it waits until
one is available.
mov ah, 01H ; input key function
INT 21H ; get ASCII code in AL
On entry: Ah= 01H
Returns: AL= 8 bit data input
When a character is pressed, AL will contain its ASCII code if any other key is pressed, such
as an arrow key or F0-F10 and so on, AL will contain 0.
Function 08 - Read a character input without Echo
from keyboard
Reads a character from the standard input device without copying it
to the display. If no character is ready it waits until one is available.
MOV AH, 08h ; Input key function
INT 21h ; get ASCII code in AL.
On entry: ; Ah= 01H
Returns: ; AL= 8 bit data input.
Function 02 - Display a Character on Screen
To display a character ‘A’ on screen execute the following instruction, actually DL must contain
the ASCII code of Character that is to be displayed. In this example DL will contain ASCI code of
‘A’.
MOV AH, 2 ; display character function
MOV DL, ‘A’ ; character is A
INT 21H ; display character
On entry:
AH = 02h
DL = 8 bit data (usually ASCII character)
Returns:
Nothing
Practice Exercise
Displaying an integer 0-9
• We can print character only
• ASCII of 0-9 is 30h-39h respectively
• First convert the digit into its ASCII by adding 30h then print it like a character