8086 architecture and registers
Clear, exam-focused notes on the Intel 8086 microprocessor architecture and its registers, covering segmentation, addressing, register roles, flags, addressing modes, worked examples, common mistakes and likely exam questions.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
The Intel 8086 is the classic 16-bit microprocessor whose design introduced the segmentation scheme, register model and bus organisation that many later x86 designs inherited. Engineers use 8086 concepts to understand segmentation, addressing modes, register usage and low-level system design (memory layout, interrupts, I/O), which helps when studying later processors (80386 protected/virtual modes) or low-level embedded software.
Key ideas
Register: a small, fast storage location inside the CPU used for operands, addresses, or control.
Segment: a 64 KB block of memory defined by a 16-bit segment register value; together with a 16-bit offset it forms a logical address.
Physical address (in 8086): the 20-bit address placed on the address bus to access memory.
Core architectural facts (exact statements you should memorise):
- The 8086 is a 16-bit processor with 16-bit general-purpose registers and a 20-bit physical address space. Assume 1 MB = 2^20 = 1,048,576 bytes of addressable memory.
- A logical (segment:offset) address is formed by a 16-bit segment register and a 16-bit offset. The mapping to the 20-bit physical address is: physical = (segment << 4) + offset. This provides overlapping 64 KB segments.
- The 8086 register set (names and roles):
- General-purpose registers (16-bit): AX (accumulator), BX (base), CX (count), DX (data). Each can be used as 16-bit or split into two 8-bit halves: AX -> AH (high 8-bit), AL (low 8-bit), similarly for BX (BH/BL), CX (CH/CL), DX (DH/DL).
- Index and pointer registers (16-bit): SP (stack pointer), BP (base pointer), SI (source index), DI (destination index).
- Segment registers (16-bit): CS (code segment), DS (data segment), ES (extra segment), SS (stack segment).
- IP (instruction pointer): 16-bit offset into CS that points to next instruction.
- Flags register: 16-bit status/control flags (carry, parity, auxiliary carry, zero, sign, trap, interrupt enable, direction, overflow, etc.).
Default segment rules (write them down — exam questions often ask these):
- Memory references without an explicit segment override normally use DS as the default segment. In 8086, any effective address that uses BP (BP, BP+SI, or BP+DI, with or without a displacement) uses SS as the default segment; other addressing forms use DS unless a segment override is present.
- Stack operations (PUSH, POP, CALL, RET, etc.) use SS as the default segment with the SP register.
- Instructions that read from code (e.g., fetching immediate data following a CALL) or perform relative operations use CS:IP.
- String operations: source memory uses DS:SI by default (a segment-override prefix may change the source segment), and the destination always uses ES:DI (the destination segment cannot be overridden).
Addressing modes (what you must be able to derive on the paper):
- Register addressing: operand is in register (e.g., MOV AX, BX).
- Immediate addressing: operand encoded in instruction (e.g., MOV AX, 0x1234).
- Direct (memory) addressing: instruction gives a 16-bit offset; effective address EA = offset, segment default DS unless override.
- Register indirect and based/indexed addressing (common forms): EA computed from register sums and optionally a displacement. Common EA forms to remember for 8086 (draw a box and label registers used):
- [BX]
- [BX + SI]
- [BX + DI]
- [BP]
- [BP + SI]
- [BP + DI]
- [SI]
- [DI]
- Any of these can have a displacement: [BX + SI + disp], where disp is an 8-bit signed displacement (sign-extended) or a 16-bit displacement (added as 16 bits) depending on instruction encoding.
- The final physical address = (segment << 4) + EA (EA is 16-bit result of the register/displacement computation).
Bus and pin-level notes (basic):
- The 8086 has a multiplexed address/data bus AD0–AD15 (these carry low 16 bits of address during the first part of bus cycle and data later). Use ALE (address latch enable) to demultiplex. The 8086 is little-endian: the low-order byte of a word is stored at the lower address.
- There are separate A16–A19 address/status lines to provide the upper 4 address bits; BHE# (Bus High Enable, active low) is used with A0 to select the upper (D15–D8) and/or lower (D7–D0) byte lanes during word transfers.
- Two operating modes: minimum mode (single processor) and maximum mode (for co-processors / multi-processor configurations) selected by the MN/MX# pin; this changes control signal meanings. Internally, the 8086 has a Bus Interface Unit (BIU) and an Execution Unit (EU) operating in parallel; the BIU uses a 6-byte prefetch queue for instructions (4 bytes on the 8088).
Flags — definitions you should write out and be able to explain (what the flag means): CF (Carry Flag), PF (Parity Flag), AF (Auxiliary Carry), ZF (Zero Flag), SF (Sign Flag), TF (Trap Flag), IF (Interrupt Enable Flag), DF (Direction Flag), OF (Overflow Flag). The flags are updated by arithmetic, logic and some other instructions; some flags can be tested or used in conditional jumps.
Important behavioural points to remember (make exact):
- Segments overlap (because segment * 16 creates a 64 KB sliding window every 16 bytes). This is why many different segment:offset pairs can map to the same physical address.
- When (segment << 4) + offset exceeds 20 bits the physical address wraps modulo 2^20 on the original 8086 (i.e., addresses above 0xFFFFF wrap to low addresses). Later chips introduced A20 gating — verify if your exam expects mention. On reset, the CPU begins execution at CS=FFFFh and IP=0000h (physical address FFFF0h).
Formulas
Physical = (Segment << 4) + Offset — Segment and Offset are 16-bit unsigned integers; resulting address is interpreted modulo 2^20 (20-bit physical address). Units: bytes.
Maximum addressable memory = 2^20 = 1,048,576 bytes = 1 MB — applies to the 8086 real-address bus.
Segment size = 64 KB = 2^16 bytes — because offset is 16-bit.
EA (example) = BX + SI + Disp — EA is a 16-bit effective address used with the default segment (DS usually). Disp is an 8-bit signed displacement (sign-extended) or a 16-bit displacement (added as 16 bits) depending on encoding; units: bytes.
(There are no complex mathematical laws here; memorise these mapping formulas and register sizes.)
Worked examples
Physical address calculation (simple)
- Given: CS = 0x1234, IP = 0x0100. Compute physical address of instruction pointed by CS:IP.
- Formula: Physical = (Segment << 4) + Offset.
- Calculation: Physical = (0x1234 << 4) + 0x0100 = 0x12340 + 0x0100 = 0x12440.
- Final: Physical address = 0x12440 (in hex), which is 74816 in decimal.
Wrap-around example (showing 20-bit wrap)
- Given: Segment = 0xFFFF, Offset = 0x0010.
- Compute: Physical = (0xFFFF << 4) + 0x0010 = 0xFFFF0 + 0x0010 = 0x100000.
- Since 8086 has 20-bit addresses, 0x100000 modulo 2^20 = 0x00000.
- Final: Physical address = 0x00000 (wrap-around). Note: some later systems gate A20 to prevent wrap; the original 8086 wraps. Verify if your exam expects mention of A20.
Effective + physical address from indexed addressing
- Given registers: DS = 0x2000, BX = 0x1000, SI = 0x0020, displacement = 0x0010.
- EA = BX + SI + displacement = 0x1000 + 0x0020 + 0x0010 = 0x1030.
- Physical = (DS << 4) + EA = (0x2000 << 4) + 0x1030 = 0x20000 + 0x1030 = 0x21030.
- Final: EA = 0x1030, Physical address = 0x21030.
Show step-by-step arithmetic in exams: write the formula first, then substitute hex values, add with carries and state final hex and decimal if requested.
Common mistakes
- Not applying modulo 2^20 wrap when segment<<4 + offset exceeds 0xFFFFF (or wrongly assuming no wrap exists).
- Mixing up default segment registers (e.g., using DS when the stack instruction uses SS) — memorise defaults.
- Treating AH/AL as independent registers without remembering that writing AL affects AX and AH remains unchanged only for the unaffected bits.
- Incorrect EA forms: forgetting which register pairs are valid in 8086 (e.g., BP often implies using SS as segment by default in some cases — verify behaviour required by the question).
- Misremembering flag bit positions; it is safer to state flag names and meanings rather than exact bit numbers unless asked.
For your exam
Kinds of questions you will see:
- Definitions and short notes: define registers, explain segmentation and explain the bus organisation. Full-mark answers give the definition, sizes in bits/bytes and an example.
- Derivations: show how to compute a physical address from segment:offset step-by-step; include wrap-around behaviour if asked.
- Numericals: compute EA from registers + displacement and then physical address; show all arithmetic in hex.
- Diagrams: draw the register layout (label AX split into AH/AL, show general purpose, index/pointer, segment registers and IP/flags). For segmentation, draw: a 20-bit address bus box labelled A0–A19; show segment register shifted left by 4 bits, add offset, produce physical address; annotate with sizes (segment 16-bit, offset 16-bit, physical 20-bit).
- Short programs/assembly: explain the use of CX for loop count, e.g., MOV CX, N; LABEL: ... LOOP LABEL;
What a full-marks answer includes:
- Exact definitions with sizes (bits/bytes), the mapping formula, worked numeric steps in hex with units, defaults for segments, and mention of wrap or A20 if question asks about address space beyond 1 MB. If a diagram is required, label all buses and registers clearly.
Quick check
- What is the size of the physical address space of the 8086 in bytes?
- Compute physical address for segment = 0x3000, offset = 0x00FF.
- Which segment register is used by default for PUSH/POP operations?
Answers: 1) 1,048,576 bytes (1 MB). 2) Physical = 0x30000 + 0x00FF = 0x300FF. 3) SS (stack segment).
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?