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-bitHigh 8Low 8Primary role
AXAHALAccumulator — arithmetic, I/O
BXBHBLBase — base address in data segment
CXCHCLCounter — loop counter (LOOP instruction)
DXDHDLData/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

RegisterSegmentFunction
SPSSStack Pointer — offset into stack segment
BPSSBase Pointer — offset for stack frame access
SIDS (default)Source Index — string/data source offset
DIES (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

RegisterHolds base of…
CSCode Segment
DSData Segment
SSStack Segment
ESExtra 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)

FlagNameSet when…
CFCarryCarry/borrow out of MSB (unsigned overflow)
PFParityEven parity in lower 8 bits of result
AFAuxiliary CarryCarry from bit 3 to bit 4 (BCD)
ZFZeroResult = 0
SFSignMSB of result = 1
OFOverflowSigned overflow (result exceeds signed range)

8086 adds Overflow (OF) — not present in 8085's five flags.

26.2 Control Flags

FlagNameFunction
TFTrapSingle-step debugging (one instruction at a time)
IFInterrupt EnableAllow (IF=1) or block (IF=0) maskable interrupts
DFDirectionString operation direction: 0 = forward (increment SI/DI), 1 = backward

26.3 8085 vs 8086 Flags Comparison

8085 (5 flags)8086 equivalent8086-only
SSF

| 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.