COA Notes
Detailed study of Intel 8086 architecture, register set, bus interface, and memory segmentation.
Introduction
The Intel 8086, released in 1978, is where the x86 story begins. Every modern Intel and AMD processor — from the Pentium to the latest Core i9 — traces its instruction set lineage directly to this 16-bit chip. Understanding the 8086 is not just history; many of its design decisions (segmented memory, backward compatibility priorities) still influence how computers work today. The 8086 introduced concepts that became standard in computer architecture, and it remains a staple of university COA courses because its complexity is manageable enough to study completely while illustrating real-world design trade-offs.
Architecture Overview
The 8086 is divided into two independent functional units that operate in parallel:
Bus Interface Unit (BIU)
The BIU handles all external bus operations:
- Fetches instructions from memory and places them in the 6-byte prefetch queue
- Generates 20-bit physical addresses from segment:offset pairs
- Handles all memory read/write and I/O operations
- Operates independently — fetches ahead while EU processes current instructions
Execution Unit (EU)
The EU handles instruction execution:
- Reads instructions from the prefetch queue (no direct memory access)
- Decodes instructions and executes them using the ALU
- Manages the general-purpose registers and flags
This BIU/EU split is an early form of pipelining — while the EU executes one instruction, the BIU fetches the next ones.
Register Set
General Purpose Registers (16-bit, split into 8-bit halves)
| Register | Full | High | Low | Primary Purpose |
|---|---|---|---|---|
| AX | Accumulator | AH | AL | Arithmetic, I/O, multiply/divide |
| BX | Base | BH | BL | Base address for memory access |
| CX | Count | CH | CL | Loop counter, shift count |
| DX | Data | DH | DL | I/O port address, multiply overflow |
Pointer and Index Registers (16-bit only)
| Register | Purpose |
|---|---|
| SP | Stack Pointer — top of stack |
| BP | Base Pointer — base of stack frame |
| SI | Source Index — string source address |
| DI | Destination Index — string destination |
Segment Registers (16-bit)
| Register | Purpose | Default Pairing |
|---|---|---|
| CS | Code Segment — where instructions live | IP (Instruction Pointer) |
| DS | Data Segment — where variables live | BX, SI, DI |
| SS | Stack Segment — where stack lives | SP, BP |
| ES | Extra Segment — additional data access | DI (string operations) |
Instruction Pointer and Flags
- IP (Instruction Pointer): Offset of next instruction within CS (equivalent to PC in other architectures)
- FLAGS (16-bit):
- CF (Carry), PF (Parity), AF (Auxiliary Carry), ZF (Zero), SF (Sign)
- OF (Overflow), DF (Direction), IF (Interrupt Enable), TF (Trap/Single-step)
Memory Segmentation
The 8086 has a 20-bit address bus (1 MB addressable) but only 16-bit registers. How do you reach 1 MB with 16-bit values? Segmentation.
Physical Address Calculation
Example:
This gives a 20-bit result (00000h to FFFFFh = 1 MB range).
Why Segmentation?
Intel needed to address 1 MB (20-bit addresses) with 16-bit registers. Rather than adding a larger register (which would break the 16-bit design), they used segment registers as a "base" that gets shifted left by 4 bits. This was a pragmatic engineering compromise — it works but creates overlapping segments (many segment:offset pairs point to the same physical address).
Segment Overlap
| Segment 1000h | 0000h = Physical 10000h |
| Segment 0FFFh | 0010h = Physical 10000h (same address!) |
| Segment 0000h | 10000h = invalid! (offset > 16 bits) |
Multiple logical addresses can map to the same physical address. The maximum segment size is 64 KB (16-bit offset limit).
Instruction Set Categories
The 8086 instruction set has approximately 117 instructions:
Data Transfer
- MOV (register/memory/immediate transfers)
- PUSH/POP (stack operations)
- XCHG (swap two operands)
- IN/OUT (I/O port access)
- LEA (Load Effective Address — calculates address, does not access memory)
Arithmetic
- ADD, ADC (add with carry), SUB, SBB (subtract with borrow)
- MUL/IMUL (unsigned/signed multiply)
- DIV/IDIV (unsigned/signed divide)
- INC, DEC, NEG (negate), CMP
Logic and Shift
- AND, OR, XOR, NOT, TEST
- SHL/SAL, SHR, SAR (arithmetic right shift)
- ROL, ROR, RCL, RCR (rotate through carry)
String Operations
- MOVSB/MOVSW (move string byte/word)
- CMPSB/CMPSW (compare strings)
- SCASB/SCASW (scan string)
- LODSB/STOSB (load/store string)
- REP prefix (repeat CX times)
Control Flow
- JMP (unconditional jump)
- Conditional jumps: JZ, JNZ, JG, JL, JC, JNC, etc.
- LOOP (decrement CX, jump if not zero)
- CALL/RET (subroutine call/return)
- INT/IRET (software interrupt/return)
Bus Cycles and Timing
The 8086 runs at 5-10 MHz. Each bus cycle takes 4 clock cycles (T1-T4):
| T1 | Address output on bus |
| T2 | Bus direction set, address removed from data bus |
| T3 | Data transfer (read or write) |
| T4 | Bus released, status updated |
| Tw | Wait states inserted if memory is slow |
Minimum/Maximum Mode
- Minimum Mode (MN/MX pin high): 8086 generates its own control signals. Used in simple single-processor systems.
- Maximum Mode (MN/MX pin low): External bus controller (8288) generates control signals. Required for multiprocessor systems with 8087 coprocessor.
Interrupt System
The 8086 supports 256 interrupt types (0-255):
Interrupt Priority (highest to lowest)
- Division error, INT n, INTO (internal)
- NMI (non-maskable interrupt)
- INTR (maskable hardware interrupt)
- Single-step (TF flag)
Interrupt Sequence
- Complete current instruction
- Push FLAGS, CS, IP onto stack
- Clear IF and TF flags
- Load CS:IP from interrupt vector table
- Begin executing ISR (Interrupt Service Routine)
Real-World Legacy
The 8086's design decisions echo through modern computing:
- Backward compatibility: Every x86 processor since 1978 can still run 8086 code
- Segment registers: Evolved into protected-mode selectors in 80286/80386
- Little-endian: Low byte at low address — still used by all x86/x64 processors
- Real mode: Modern CPUs still boot in 8086-compatible real mode before switching to protected/long mode
- I/O port space: Separate from memory space (IN/OUT instructions), still supported
Key Takeaways
- The 8086's BIU/EU split represents primitive pipelining — fetching and executing overlap
- Memory segmentation (Segment × 16 + Offset) was a clever hack to get 20-bit addresses from 16-bit registers
- The register set design (AX/AH/AL split) provided backward compatibility with 8-bit 8080 code
- 256 interrupt vectors with the IVT at fixed address 0 established the PC interrupt architecture
- The x86 instruction set, born here, became the world's most commercially successful ISA through relentless backward compatibility
- Understanding 8086 helps you understand why modern x86 has the quirks it does (variable-length instructions, complex decode, legacy modes)
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Intel 8086 Architecture.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Computer Organization & Architecture topic.
Search Terms
computer-organization, computer organization & architecture, computer, organization, case, studies, intel, 8086
Related Computer Organization & Architecture Topics