8086 Memory Segmentation
8086 Memory Segmentation
LANGUAGE
CSE 311
TOPIC: MEMORY SEGMENTATION
Shaila Rahman
Assistant Professor
8086 MEMORY
SHAILA RAHMAN 2
MEMORY CAPACITY
• 8086 memory capacity is 1 MB
• Capacity can be defined as,
• = No of bytes*size
• For 20-bit address lines it is 2 20
• Thus total capacity
220 *1 byte = 1 MB
• Thus physical address is 20-bit, as all registers are 16-bit, so 8086 generates a
32-bit logical address combination.
• 16-bit segment : 16-bit offset
• 16-bit segment value is given by appropriate segment register. Actually the upper
16-bit of a segment starting address is given by a segment register.
• And 16-bit offset is the displacement of data from segment base.
SHAILA RAHMAN 3
MEMORY SEGMENTATION
SHAILA RAHMAN 4
PHYSICAL ADDRESS CALCULATION
Segment value is 4-bit left
shifted then added with offset.
A segment offset may
range from 0000H to FFFFH.
SHAILA RAHMAN 5
AN EXAMPLE OF PROCEDURE
SHAILA RAHMAN 6
FINDING THE STARTING AND ENDING
ADDRESSES
SHAILA RAHMAN 7
ADVANTAGES OF SEGMENTATION
i. Managing memory efficiently
ii. keeping different data in different address spaces. E.g. data, code, stack
iii. Searching easy and fast.
iv. Faster access and thus execution.
v. Helps and improves multiprogramming
vi. Possible to access 1 MB memory using 16-bit structure.
SHAILA RAHMAN 8
MEMORY SEGMENTATION
SHAILA RAHMAN 9
SEGMENT REGISTERS
SHAILA RAHMAN 10
SEGMENT REGISTERS
SHAILA RAHMAN 11
EXAMPLE
The 20-bit address of a byte is called its Physical
Address.
But, it is specified as a Logical Address.
Logical address is in the form of:
Base Address : Offset
Offset is the displacement of the memory location
from the starting location of the segment.
SHAILA RAHMAN 12
EXAMPLE
SHAILA RAHMAN 13
EXAMPLE
SHAILA RAHMAN 14
EXAMPLE (CONTD.)
SHAILA RAHMAN 15
EXAMPLE (CONTD.)
Therefore:
EA = 22220 H
+ 0016 H
22236 H
SHAILA RAHMAN 16
EXAMPLE (CONTD.)
SHAILA RAHMAN 17
MAX. SIZE OF SEGMENT
SHAILA RAHMAN 19
QUESTION
The contents of the following registers are:
CS = 1111 H
DS = 3333 H
SS = 2526 H
IP = 1232 H
SP = 1100 H
DI = 0020 H
Calculate the corresponding physical addresses for
the address bytes in CS, DS and SS.
SHAILA RAHMAN 20
SOLUTION
1. CS = 1111 H
2. DS = 3333 H
3. SS = 2526 H
SHAILA RAHMAN 21