Answer to Question #262391 in Assembler for bluwhale

Question #262391

Explain the following in the context of 8086 Microprocessor:

(i) Physical address calculation in code and data segment

(ii) Interrupt vector table and its use

(iii)Based Indexed addressing mode with the help of an example


1
Expert's answer
2021-11-07T10:12:53-0500

Explain the following in the context of 8086 Microprocessor:

(i)                 Physical address calculation in code and data segment

Segment registers work together with general purpose register to access any memory value. For

example if we would like to access memory at the physical address 12345h (hexadecimal), we should set the

DS = 1230h and SI = 0045h.

CPU makes a calculation of physical address by multiplying the segment register by 10h and adding general purpose register to it (1230h * 10h + 45h = 12345h)

The offset of the CS Register is the IP register.

The effective address of the memory location pointed by the CS register is calculated as follows:

Effective address= Base address of CS register * 10H + Address of IP

 

(ii)               Interrupt vector table and its use

An interrupt is a condition that halts the microprocessor temporarily to work on a different task and then return to its previous task. Whenever an interrupt occurs the processor completes the execution of the current instruction and starts the execution of an Interrupt Service Routine (ISR) or Interrupt Handler. ISR is a program that tells the processor what to do when the interrupt occurs. After the execution of ISR, control returns back to the main routine where it was interrupted.

Each interrupt that requires special processing by the processor is assigned a unique identification number called a vector number

An interrupt vector table (IVT) is a data structure that associates a list of interrupt handlers with a list of interrupt requests in a table of interrupt vectors. Each entry of the interrupt vector table, called an interrupt vector, is the address of an interrupt handler.

Each interrupt type is given a number between 0 to 255 and the address of each interrupt is found by multiplying the type by 4 e.g. for type 11, interrupt address is 11 x 4 = 4410= 0002CH

When the 8086 responds to an interrupt, it automatically goes to the specified location in the Interrupt Vector Table in 8086 to get the starting address of interrupt service routine.

 

(iii)             Based Indexed addressing mode with the help of an example

Base-Plus-Index Addressing

This type of addressing uses one base register (BP or BX), and one index register (DI or SI) to indirectly address memory. The base register holds the beginning location of a memory array, while the index register holds the relative position of an element in the array.

Example. Size of array elements=double word.

.data

arrayZero DWORD 10 DUP(?)

 

.code

           xor eax, eax                            ; eax=0

mov ebx, offset array            ; ebx = base address of arrayZero

           mov edi, 0                              ; edi = index

           mov [ebx+edi], eax                ; write 0 to arrayZero[0]

           add edi, 4                               ; next item of arrayZero

           mov [ebx+edi], eax                ; write 0 to arrayZero[1]


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS