In the 8086 microprocessor, the Interrupt Vector Table (IVT) is used for handling interrupts, including input/output operations.
The IVT is a table of interrupt vectors located in memory, with each entry pointing to the memory address of the interrupt service routine (ISR) for a specific interrupt.
Here’s how IVT is used for input/output in the 8086 microprocessor:
- When an input/output operation needs to be performed, the appropriate device raises an interrupt signal to the CPU.
- The CPU responds to the interrupt by suspending the current program execution and transferring control to the ISR associated with the interrupt.
- The ISR executes the necessary input/output operations and any other required tasks.
- After completing the input/output operation, the ISR returns control to the main program by using the
IRET
instruction.
Now, let’s write an assembly language program for the 8086 microprocessor to input a string:
.model small
.stack 100h
.data
buffer db 100, ?, 100 dup('$') ; buffer to store input string
.code
main:
mov ax, @data ; load data segment address to AX
mov ds, ax ; set data segment register
mov ah, 0Ah ; AH = 0Ah (DOS function for buffered input)
lea dx, buffer ; DX = address of buffer
int 21h ; call DOS interrupt for buffered input
mov ah, 09h ; AH = 09h (DOS function for displaying string)
lea dx, buffer+2 ; DX = address of input string (skip the length byte)
int 21h ; call DOS interrupt for displaying string
mov ah, 4Ch ; AH = 4Ch (DOS function for program termination)
int 21h ; call DOS interrupt for program termination
end main
This program uses DOS interrupts to input a string and display it on the screen. Here’s a breakdown of the program:
- Set up the data segment register (
DS
) with the address of the data segment. - Use DOS interrupt
21h
function0Ah
to input a string into the buffer. - Use DOS interrupt
21h
function09h
to display the input string on the screen. - Use DOS interrupt
21h
function4Ch
to terminate the program.
Compile and run this program using an 8086 assembler and emulator to input the string “8086 Microprocessor was a 16-bit processor.”