# Problems on physical address calculation in 8086 Microprocessor

In this article, 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.
Submitted by Monika Sharma, on July 11, 2019

Q1) 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.

Ans:

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:

```    = 4042H X 10H + 0580H
= (40420 + 0580)H
= 41000H
```

Q2) Calculate the effective address for the following register:
SS: 3860H, SP: 1735H, BP: 4826H

Ans:

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
```

Q3) 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.
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.

Ans:

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
```

Q4) 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?

Ans:

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.

What's New

Top Interview Coding Problems/Challenges!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates