Home »
Embedded Systems
Problems on physical address calculation in 8086 Microprocessor
In this tutorial, we are going to solve some problems on calculating the physical address (also known as effective address) of 20 bits using the different segment registers and their respective offsets.
By Monika Sharma Last updated : May 22, 2023
Question 1
The value of Code Segment (CS) Register is 4042H and the value of different offsets is as follows:
BX: 2025H , IP: 0580H , DI: 4247H
Calculate the effective address of the memory location pointed by the CS register.
Answer
The offset of the CS Register is the IP register.
Therefore, the effective address of the memory location pointed by the CS register is calculated as follows:
Effective address= Base address of CS register X 10H + Address of IP
= 4042H X 10H + 0580H
= (40420 + 0580)H
= 41000H
Question 2
Calculate the effective address for the following register:
SS: 3860H, SP: 1735H, BP: 4826H
Answer
Both SP and BP are the offsets for Stack Register (SS). The address calculated when BP is taken as the offset gives the starting address of the stack. The address when SP is taken as the offset denotes the memory location where the top of the stack lies.
Therefore, the effective address for both these cases is:
(SS X 10H) + SP = 3640H X 10H + 1735H
= 36400H + 1735H
= 38135H
(SS X 10H) + BP = 3640H X 10H + 4826H
= 36400H + 4826H
= 41226H
Question 3
The value of the DS register is 3032H. And the BX register contains a 16 bit value which is equal to 3032H. 0008H is added to BX.
ADD BX, 0008H
The register AX contains some value which needs to be stored at a location as follows:
MOV [BX], AX
Calculate the address at which the value of the AX will be stored.
Answer
After executing the first instruction, the value of BX Register is as follows:
BX = 3040H
The BX register is an offset of the Data Segment (DS) register. So, the location at which the value of the AX register will be stored is calculated as follows:
(DS X 10H) + BX = 3032H X 10H +3040H
= 30320H + 3040H
= 33360H
Question 4
You are provided the following values:
DS: 3056H, IP: 1023H, BP: 2322H and SP: 3029H
Can you calculate the effective address of the memory location as per the DS register?
Answer
No, the effective address of the DS register cannot be calculated from the given values because none of the given offset is an offset of the DS Register. This can be done only in the case of segment override prefix, but as it is not mentioned here, we will not follow that.