Microprocessors and Interfacing
8086 Registers; Segment Registers and Physical Address; 8086 Flag Register
C-CAT
8086 Registers
24.1 General-Purpose Registers (16-bit, splittable into 8-bit halves)
| 16-bit | High 8 | Low 8 | Primary role |
|---|---|---|---|
| AX | AH | AL | Accumulator — arithmetic, I/O |
| BX | BH | BL | Base — base address in data segment |
| CX | CH | CL | Counter — loop counter (LOOP instruction) |
| DX | DH | DL | Data/I/O — I/O port address for IN/OUT |
Valid pairs: AX, BX, CX, DX (each 16-bit as a whole).
24.2 Pointer and Index Registers
| Register | Segment | Function |
|---|---|---|
| SP | SS | Stack Pointer — offset into stack segment |
| BP | SS | Base Pointer — offset for stack frame access |
| SI | DS (default) | Source Index — string/data source offset |
| DI | ES (default) | Destination Index — string/data destination offset |
24.3 Instruction Pointer (IP)
- 16-bit offset into code segment
- Points to next instruction to execute
Combined with CS to form physical address of instruction
- Analogous to 8085 PC but segment-relative
24.4 Segment Registers
| Register | Holds base of… |
|---|---|
| CS | Code Segment |
| DS | Data Segment |
| SS | Stack Segment |
| ES | Extra Segment |
Each is 16 bits wide but represents the upper 16 bits of a 20-bit segment base (shifted left by 4).
Segment Registers and Physical Address
25.1 Segmented Memory Model
The 8086 divides the 1 MB address space into logical segments of up to 64 KB each (since offset is 16-bit: 0000H–FFFFH).
25.2 Physical Address Formula
Physical Address = (Segment Register × 10H) + Offset
= (Segment Register × 16) + Offset
The segment value is shifted left 4 bits (one hex digit) and added to the 16-bit offset.
25.3 Worked Example 1 — Code Fetch
CS = 2000H, IP = 2345H
Physical Address = 2000H × 10H + 2345H
= 20000H + 2345H
= 22345H
25.4 Worked Example 2 — Stack Access
SS = 2450H, SP = 0024H
Physical Address = 2450H × 10H + 0024H
= 24500H + 0024H
= 24524H
25.5 Worked Example 3 — Data Access
DS = 3000H, BX = 0500H
Physical Address = 3000H × 10H + 0500H
= 30000H + 0500H
= 30500H
25.6 Segment Overlap
Because segment base is multiplied by 16 (not 64K), segments can overlap. Multiple segment:offset pairs can map to the same physical address:
1000H : 5000H → 10000H + 5000H = 15000H
1500H : 0000H → 15000H + 0000H = 15000H (same physical address!)
8086 Flag Register
The 8086 has 9 flags in a 16-bit flag register, divided into conditional flags (6) and control flags (3).
26.1 Conditional Flags (Status Flags)
| Flag | Name | Set when… |
|---|---|---|
| CF | Carry | Carry/borrow out of MSB (unsigned overflow) |
| PF | Parity | Even parity in lower 8 bits of result |
| AF | Auxiliary Carry | Carry from bit 3 to bit 4 (BCD) |
| ZF | Zero | Result = 0 |
| SF | Sign | MSB of result = 1 |
| OF | Overflow | Signed overflow (result exceeds signed range) |
8086 adds Overflow (OF) — not present in 8085's five flags.
26.2 Control Flags
| Flag | Name | Function |
|---|---|---|
| TF | Trap | Single-step debugging (one instruction at a time) |
| IF | Interrupt Enable | Allow (IF=1) or block (IF=0) maskable interrupts |
| DF | Direction | String operation direction: 0 = forward (increment SI/DI), 1 = backward |
26.3 8085 vs 8086 Flags Comparison
| 8085 (5 flags) | 8086 equivalent | 8086-only |
|---|---|---|
| S | SF | |
| Z | ZF | | |
| AC | AF | | |
| P | PF | | |
| CY | CF | | |
| — | — | OF, TF, IF, DF |
Continue learning
Related notes
Put this topic into timed practice
Open mock tests when you want full-exam pacing, or keep drilling in practice mode.