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