0% found this document useful (0 votes)
142 views8 pages

Physical Address Generation

The document explains how to calculate physical addresses from logical addresses using segment and offset values in a segmented memory model. It details the processes for the Code Segment, Data Segment, and Stack Segment, including how offsets are determined and how they relate to the segment registers. The document also highlights the behavior of the stack in relation to memory addressing and manipulation through PUSH and POP operations.

Uploaded by

Sampada Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views8 pages

Physical Address Generation

The document explains how to calculate physical addresses from logical addresses using segment and offset values in a segmented memory model. It details the processes for the Code Segment, Data Segment, and Stack Segment, including how offsets are determined and how they relate to the segment registers. The document also highlights the behavior of the stack in relation to memory addressing and manipulation through PUSH and POP operations.

Uploaded by

Sampada Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8

Example Address Calculation

• If the data segment starts at location 1000h


and a data reference contains the address
29h where is the actual data?
2 9

Offset: 0000000000101001

Segment: 0001000000000000 0000

Address: 0001000000000010 1001


Segment:Offset Address
• Logical Address is specified as segment:offset
• Physical address is obtained by shifting the segment
address 4 bits to the left and adding the offset address
• Thus the physical address of the logical address
A4FB:4872 is
A4FB0
+ 4872
A9822
The Code Segment
0H

4000H
CS: 0400H

IP 0056H 4056H
CS:IP = 4000:56
Logical Address

Memory
0400 0
Segment Register

Offset + 0056
Physical or 04056H 0FFFFFH
Absolute Address

The offset is the distance in bytes from the start of the segment.
The offset is given by the IP for the Code Segment.
Instructions are always fetched with using the CS register.

The physical address is also called the absolute address.


The Data Segment

0H

05C00H
DS: 05C0

05C50H
EA 0050 DS:EA

Memory
05C0 0
Segment Register

Offset + 0050

Physical Address 05C50H 0FFFFFH

Data is usually fetched with respect to the DS register.


The effective address (EA) is the offset.
The EA depends on the addressing mode.
The Stack Segment
0H

0A00 0A000H
SS:

0A100H
SP 0100 SS:SP

Memory
0A00 0
Segment Register

Offset + 0100

Physical Address 0A100H 0FFFFFH

The offset is given by the SP register.


The stack is always referenced with respect to the stack segment register.
The stack grows toward decreasing memory locations.
The SP points to the last or top item on the stack.

PUSH - pre-decrement the SP


POP - post-increment the SP
Friday, April 4, 2025 9

You might also like