Progress0 / 7
Topic 05 8 min read
8086/8088 & Microprocessor Families
8086/8088 Microprocessor Architecture
The 8086 is a 16-bit microprocessor with a 20-bit address bus, fourteen 16-bit registers and separate bus interface and execution units. The 8088 keeps the same core but uses an 8-bit external data bus. These notes cover the programming model, flags, segment arithmetic, prefetch queue and the 80286-to-Pentium advances that exam questions target.
01
BIU and EU
- The bus interface unit (BIU) talks to memory and I/O: it fetches instructions and operands, computes 20-bit physical addresses and fills the instruction queue.
- The BIU holds CS, DS, SS, ES and IP; the queue is 6 bytes on the 8086 and 4 bytes on the 8088.
- The execution unit (EU) decodes and executes instructions; it contains the ALU, the general-purpose registers and FLAGS.
- The EU has no direct memory path; it requests operands from the BIU and takes prefetched bytes from the queue.
- Fetch and execute overlap: while the EU executes one instruction, the BIU fetches the next.
- A jump, call or return discards the queue, so a control transfer pays a refill penalty.
02
Register set
All 8086 registers are 16 bits wide. AX to DX can each be split into two 8-bit halves, written as AH/AL, BH/BL, CH/CL and DH/DL.
- Fourteen 16-bit registers: AX, BX, CX, DX; SP, BP; SI, DI; CS, DS, SS, ES; IP; FLAGS.
- AX is the accumulator, BX a base register, CX the loop and shift counter, and DX data plus the high half of products and I/O port numbers.
- SP points to the stack top, BP addresses data on the stack, SI is the source index and DI the destination index for string moves.
- CS:IP addresses the next instruction, SS:SP the stack top, DS:BX or DS:SI data, and ES:DI extra data.
- The stack is last-in, first-out (LIFO); PUSH, POP, CALL and RET use it.
8086 register set
| Register | Name | Function |
|---|---|---|
| AX | Accumulator | Arithmetic, logic, string and I/O operations; AH/AL halves |
| BX | Base | Memory addressing; BH/BL halves |
| CX | Count | Loop counter and shift/rotate count; CH/CL halves |
| DX | Data | Data, high half of multiply/divide, I/O port number; DH/DL halves |
| SP | Stack pointer | Offset of the current stack top |
| BP | Base pointer | Offset for data stored on the stack |
| SI | Source index | Source pointer for string and block moves |
| DI | Destination index | Destination pointer for string and block moves |
| CS | Code segment | Base of the current code segment |
| DS | Data segment | Base of the default data segment |
| SS | Stack segment | Base of the stack segment |
| ES | Extra segment | Base of an additional data segment |
| IP | Instruction pointer | Offset of the next instruction; used as CS:IP |
| FLAGS | Status/control | Result status bits plus control bits |
03
Flags
- CF (carry): set when an unsigned result carries out of the most significant bit or borrows.
- PF (parity): set when the low byte of the result contains an even number of 1 bits.
- AF (auxiliary carry): set on a carry from bit 3 to bit 4; used by BCD arithmetic.
- ZF (zero): set when the result is zero.
- SF (sign): copy of the most significant bit; set for a negative signed result.
- OF (overflow): set when a signed result does not fit in the destination.
- TF, IF and DF are control flags: trap/single-step, interrupt enable and string direction.
Flags
MOV AX, 0FFFFh
ADD AX, 0001h
; AX = 0000h, CF = 1, AF = 1, ZF = 1, PF = 1, SF = 0, OF = 004
Segmentation and physical address
- The 8086 has 1 MB (2^20 bytes) of address space but only 16-bit registers, so memory is divided into overlapping segments of up to 64 KB.
- A segment register stores the segment base divided by 16; the processor shifts it left 4 bits (multiplies by 10h) and adds the 16-bit offset.
- Standard pairs: CS:IP for instructions, SS:SP for the stack, DS:BX or DS:SI for data, and ES:DI for extra data.
- Different segment:offset pairs can name the same byte, so the 20-bit physical address is the unique value.
- The 8086 has no protected mode or memory protection; any program can write any address.
Segmentation and physical address
Physical address = (segment x 10h) + offset
CS = 348Ah, IP = 4214h
348Ah x 10h = 348A0h
348A0h + 4214h = 38AB4h
38AB4h = 3x65536 + 8x4096 + 10x256 + 11x16 + 4 = 232,116
Check: 3800h:0AB4h -> 38000h + 0AB4h = 38AB4h05
Pipelining and the 8088 bus
- Pipelining overlaps instruction fetch with execution; the BIU prefetches ahead while the EU works.
- The queue holds 6 bytes on the 8086 and 4 bytes on the 8088, roughly two or three instructions.
- Straight-line code keeps the queue full; a taken branch flushes it and forces a fresh fetch.
- The 8088 is internally 16-bit but has an 8-bit external data bus, so a 16-bit transfer takes two bus cycles.
- The narrower bus allowed cheaper 8-bit support chips, which is why IBM used the 8088 in the 1981 PC.
- A bus cycle is one complete transfer over the address, data and control lines; wait states extend it.
06
80286 to Pentium
- 80286 (1982): 24-bit address bus, 16 MB, protected mode, descriptor tables and virtual memory; real mode keeps 8086 compatibility.
- 80386DX (1985): 32-bit registers, ALU, data bus and address bus; 4 GB, paging and virtual 8086 mode.
- 80386SX: 32-bit internal core with a 16-bit external data bus and a 24-bit address bus (16 MB).
- 80486 (1989): integrated floating-point unit, 8 KB on-chip cache and pipelined execution.
- Pentium (1993): superscalar U and V integer pipelines, 64-bit external data bus, split 8 KB caches and branch prediction.
Generation milestones
| CPU | Year | Address space | Key addition |
|---|---|---|---|
| 8086 | 1978 | 20-bit, 1 MB | 16-bit data bus, 6-byte queue |
| 8088 | 1979 | 20-bit, 1 MB | 8-bit external data bus, 4-byte queue |
| 80286 | 1982 | 24-bit, 16 MB | Protected mode, descriptor tables |
| 80386DX | 1985 | 32-bit, 4 GB | 32-bit registers, paging |
| 80486 | 1989 | 32-bit, 4 GB | Integrated FPU, 8 KB cache |
| Pentium | 1993 | 32-bit, 4 GB | Superscalar dual pipelines |
Exam points
- BIU fetches and addresses; EU decodes and executes; the EU never reads memory directly.
- The 8086 has fourteen 16-bit registers: AX-DX, SP, BP, SI, DI, CS-ES, IP and FLAGS.
- Physical address = segment x 10h + offset, giving a 20-bit address in a 1 MB space.
- CF, ZF, SF, OF, PF and AF are status flags; TF, IF and DF are control flags.
- 8086 queue = 6 bytes, 8088 queue = 4 bytes, and the 8088 has an 8-bit external data bus.
- 80286 added protected mode, 80386 32-bit addressing, 80486 an FPU and cache, Pentium superscalar execution.
Key terms
- Bus interface unit
- The 8086 unit that fetches instructions and operands, computes 20-bit physical addresses and fills the instruction queue.
- Physical address
- The actual 20-bit address placed on the memory bus, calculated as segment x 10h + offset.
- Superscalar
- A processor design that can issue more than one instruction per clock cycle through multiple pipelines, as the Pentium does with its U and V pipes.
Check yourself
Quick check
01
CS = 2000h and IP = 0030h. From which physical address does the 8086 fetch the next instruction?
02
Which processor introduced protected mode with descriptor tables?