Join Whatsapp Channel for Ignou latest updates JOIN NOW

How is IVT used in the 8086 microprocessor for Input/Output? Write a program using 8086 assembly language to input a string: “8086 Microprocessor was a 16-bit processor.”

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:

  1. When an input/output operation needs to be performed, the appropriate device raises an interrupt signal to the CPU.
  2. The CPU responds to the interrupt by suspending the current program execution and transferring control to the ISR associated with the interrupt.
  3. The ISR executes the necessary input/output operations and any other required tasks.
  4. 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:

  1. Set up the data segment register (DS) with the address of the data segment.
  2. Use DOS interrupt 21h function 0Ah to input a string into the buffer.
  3. Use DOS interrupt 21h function 09h to display the input string on the screen.
  4. Use DOS interrupt 21h function 4Ch 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.”

error: Content is protected !!