notesonly.in

One notebook for every subject — open it anywhere.

Log in

8086 Architecture and Memory Segmentation For students.

The Intel 8086 (1978) was the first 16-bit processor of the x86 family that still powers most desktops and laptops. Its signature idea is memory segmentation: memory is viewed through movable 64 KB windows called segments instead of one flat space. This concept shaped DOS, early Windows, and how generations of engineers think about memory.

The 8086 matters as the bridge from the tiny 8085 world to modern computing. Segment registers, offset arithmetic and the "segment × 16 + offset" formula explain real quirks — like two different addresses hitting the same byte — that puzzled programmers for a decade and still surface in embedded x86.

Key Concepts

  • 16-bit core, 20-bit address: 16-bit registers and ALU, but 20 address lines → 2^20 = 1 MB addressable.
  • Segment registers: CS (code), DS (data), SS (stack), ES (extra) — each bases a 64 KB segment aligned to a 16-byte paragraph.
  • Offsets: IP pairs with CS; SP/BP with SS; SI/DI/BX with DS by default.
  • General registers: AX, BX, CX, DX (splittable into AH/AL etc.) plus a 16-bit flag register with carry, zero, sign, overflow and direction flags.
  • Physical address: segment × 16 + offset, written segment:offset (e.g. 2000:0100). The BIU computes it on every access.
  • Overlapping segments: segments start every 16 bytes, so 2000:0100 and 2010:0000 map to the same physical byte.

Formulas

Physical address = segment × 10H + offset (10H = 16; multiplying by it appends a hex zero). Example: CS = 1A2BH, IP = 00F0H → 1A2B0H + 00F0H = 1A3A0H. Total memory = 2^20 = 1,048,576 bytes = 1 MB; each segment spans 2^16 = 64 KB. The top logical address FFFF:FFFF = 10FFEFH wraps to 0FFEFH on the 20-bit bus — the quirk behind the infamous A20 gate problem.

Worked Example

Show two logical addresses reaching one physical byte. Address 1: 1A20:00A0 → 1A20H × 10H + 00A0H = 1A200H + 00A0H = 1A2A0H. Address 2: 1A2A:0000 → 1A2A0H + 0000H = 1A2A0H. Identical. Because segments slide in 16-byte steps, they overlap like transparencies rather than sitting in neat boxes — which is why DOS programmers thought in paragraphs and why aliasing bugs were so common.

Common Misconceptions

  • "Each segment:offset pair is unique." The mapping is many-to-one, as shown above — aliasing caused endless subtle DOS bugs.
  • "A program can easily use the full 1 MB." One segment is only 64 KB; more needs juggling segment registers across the tiny/small/compact/medium/large/huge memory models.
  • "Segmentation is obsolete, skip it." Every x86-64 chip still boots in real mode with segmentation live, and DOSBox or embedded-x86 debugging rewards understanding it.

Real-World Applications

  • x86 foundation: every Core i7 and Ryzen starts in 8086-compatible real mode at reset.
  • Legacy DOS: industrial machines running DOS still use segmented memory models.
  • Embedded x86: 80186/80188 descendants served in routers and controllers for decades.
  • Teaching: segmentation motivates why the 80286 added descriptors and privilege levels.

The 8086 addressed 1 MB with 16-bit registers by pairing each segment with an offset in hardware. Overlapping segments caused a decade of headaches, but the base-plus-offset model they established underlies all modern memory management.