A note on 8086/88 Memory Segmentation

Since the 8086/88 has only 16-bit registers, its Mega (220) byte of address space is split into segments - logical units of memory that may be up to 64K (216) bytes long. Each segment is made up of contiguous memory locations and is an independent, seperately-addressible unit. Every segment is assigned (by software) a base address, which is its starting location in the memory space. Apart from having to begin on 16-byte memory boundaries, there are no restrictions on segment locations.

Physical Address Generation
Every memory location has two kinds of address - physical and logical. A physical address is the 20-bit value that uniquely identifies each byte location in the Megabyte memory space. These may range from 0 to FFFFF Hex. All exchanges between the CPU and memory components use this physical address.

Programs deal with logical, rather than physical, addresses. A logical address consists of a segment base value and an offset value. For any given memory location, the segment base value locates the first byte of the containing segment and the offset value is the distance, in bytes, of the target location from the beginning of the segment. Segment base and offset values are unsigned 16-bit quantities; the lowest-addressed byte in a segment has an offset of 0. Whenever memory is accessed, a physical address is generated from a logical address. This is done by shifting the segment base value four bit positions to the left (hence 16 (24) -byte boundaries) and adding the offset, as illustrated.

 diagram

So Logical Address 2135:4A corresponds to Physical Address 2139A


[ Back to Finding out ... ]


last updated: 15-Apr-97 Ian Harries <ih@doc.ic.ac.uk>