Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

8086 addressing modes

Clear, exam-focused notes on 8086 addressing modes: definitions, exact rules for effective and physical addresses, syntax to remember, worked examples (EA and physical address calculations), common student mistakes, and exam-style question guidance.

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

8086 addressing modes show how the CPU finds data and instructions in memory. Engineers use these rules when writing assembly, designing assemblers/linkers, and when doing address decoding for memory-mapped hardware.

Key ideas

Start with the simplest terms.

  • Addressing mode: the method an instruction uses to specify the operand (data or target address). This determines how the CPU computes the memory address or finds the register holding data.

  • Effective address (EA): the 16-bit value computed from register(s) and displacement that selects a location within a segment. The EA is used together with a segment base to form a 20-bit physical address on the 8086.

  • Segment: a 16-bit value held in one of the segment registers (CS, DS, SS, ES). The segment provides a 16-byte-aligned base for a 64 KB logical segment in the 8086 memory model.

  • Physical (absolute) address: the 20-bit address on the system bus obtained by combining a segment and offset. On the 8086 it is computed as segment·16 + offset.

Exact rules and commonly tested facts (state these exactly in exams):

  1. The 8086 computes physical address = (Segment × 16) + Offset. The multiplication by 16 is equivalent to shifting the 16-bit segment left by 4 bits and adding the 16-bit offset. Produce a 20-bit result.

  2. Which segment register is used as the base depends on the addressing form:

    • If the effective address uses the BP register (BP, BP+..., etc.), the default segment is SS (stack segment) unless an explicit segment override prefix appears.
    • For other memory addressing forms (using BX, SI, DI, or direct memory), the default segment is DS (data segment), unless overridden. Exception: String instructions (MOVS/CMPS/LODS/STOS/SCAS) use DS:SI for the source and ES:DI for the destination (destination defaults to ES, not DS).
  3. The allowed 8086 register combinations for forming EA (these are the only legal combinations used by the 8086 addressing forms):

    • BX + SI
    • BX + DI
    • BP + SI
    • BP + DI
    • SI or DI alone
    • BP or BX alone
    • any of the above plus a displacement (8-bit or 16-bit) or with zero displacement (direct register indirect)
    • Direct memory addressing (16-bit displacement only) is also allowed.
  4. Displacement (often called displacement or offset extension): can be 8-bit (sign-extended to 16 bits) or 16-bit (used as-is; no sign extension). In instruction encoding, an 8-bit displacement is sign-extended when forming the 16-bit EA.

  5. Relative addressing for jumps uses signed displacements. Short jumps (relative) encode an 8-bit signed displacement with range −128 to +127 (bytes relative to the address following the instruction). On 8086, near JMP and CALL use a 16-bit signed displacement (range −32768 to +32767); conditional jumps and LOOP/JCXZ are only available in short (8-bit) form. Far JMP/CALL use an absolute segment:offset operand, not a displacement.

Diagrams to draw in an exam (describe exactly):

  • Draw a two-row block: top row labelled "Segment register (16-bit)" showing e.g. DS = 0x2000; bottom row labelled "Offset / Effective Address (16-bit)" showing EA = 0x0123. Draw an arrow from both into a small box labelled "Adder x16" or write the operation Segment << 4 then a + sign, then the Offset. Label the result 20-bit physical address, for example 0x20123.
  • For EA formation, draw boxes for registers BX, SI, DI, BP and arrows showing legal pairings (BX+SI, BX+DI, BP+SI, BP+DI) and single-register forms SI, DI, BP, BX, then an optional box for displacement added.

Formulas

List of syntax / formulas to remember (each on its own line): Physical = Segment * 16 + Offset — Physical is 20-bit address, Segment and Offset are 16-bit values (use when converting segment:offset to physical address). EA = base + index + displacement — base ∈ {BX, BP}, index ∈ {SI, DI}; displacement is optional (disp8 sign-extended, or disp16 used as-is). MOV dest, [BX+SI+disp] — Example syntax: memory operand formed by BX+SI and an optional displacement disp. Jump short: JMP rel8 — rel8 is signed 8-bit displacement, range −128..+127 relative to address following the instruction. Use for short jumps.

Symbols:

  • Segment, Offset, EA: 16-bit values (Segment yields a 20-bit when shifted and added).
  • disp or displacement: an immediate constant added to base/index; may be 8-bit signed or 16-bit.
  • rel8: 8-bit signed relative offset for short jumps; rel16: 16-bit signed relative offset for near JMP/CALL on 8086.

Worked examples

Example 1 — Compute a physical address (simple segmentation) Given: CS = 1234h, IP = 0100h. Compute physical address of the next instruction. Step 1: Formula: Physical = Segment × 16 + Offset. Step 2: Substitute: Segment = 0x1234, Offset = 0x0100. Step 3: Segment × 16 = 0x1234 × 0x10 = 0x12340. Step 4: Add Offset: 0x12340 + 0x0100 = 0x12440. Answer: Physical address = 12440h.

Example 2 — Effective address then physical (BP uses SS) Given: DS = 2000h, SS = 3000h, instruction: MOV AX, [BP + DI + 0100h], with BP = 0020h, DI = 0030h. Step 1: Compute EA = BP + DI + displacement = 0x0020 + 0x0030 + 0x0100 = 0x0150. Step 2: Since EA uses BP, default segment = SS = 0x3000. Step 3: Physical = SS × 16 + EA = 0x3000 × 0x10 + 0x0150 = 0x30000 + 0x0150 = 0x30150. Answer: EA = 0150h, physical address = 30150h.

Example 3 — Short relative jump Instruction: JMP +0xFE (rel8 given as FEh). Assume next instruction address is 0x1000 (address after JMP opcode and operand). Interpret FEh as signed 8-bit: FEh = −2. Step 1: rel8 = −2. Target = next_address + rel8 = 0x1000 + (−2) = 0x0FFE. Answer: Target address = 0FFEh.

Common mistakes

  • Misinterpreting 8-bit displacement as always positive — it is signed and must be sign-extended when forming 16-bit EA.
  • Using illegal register combinations as EA (e.g., BX+BX or SI+SI are not valid on 8086).
  • For relative jumps, forgetting that rel8 is relative to the address after the instruction, not the current IP value before fetching operand.

For your exam

Types of questions you will see:

  • Definitions: define EA, physical address, segment, and list allowed EA forms.
  • Short notes: describe default segment rules and why segmentation gives 20-bit addresses on a 16-bit processor.
  • Derivations: derive physical address from segment:offset and show why overlapping segments occur (explain segment granularity 16 bytes).
  • Numericals: compute EA and physical address for given registers and displacements; interpret signed displacements for jumps.
  • Diagrams: draw segment + offset adder and show where EA comes from.
  • Assembly trace: given instruction(s) and register values, find memory addresses accessed.

What a full-marks answer includes:

  • Precise definition of terms, correct formula Physical = Segment * 16 + Offset.
  • Correct default segment selection rule (BP uses SS; others use DS) and note about segment override prefix.
  • Correct computation steps showing binary/hex arithmetic where required, sign-extending 8-bit displacements when necessary.
  • Correct diagrams labelled with register names, values and final 20-bit address.

Quick check

  1. Which register is the default segment for EA that includes BP?
  2. Compute physical address for Segment = 0x0ABC, Offset = 0x0100.
  3. Is BX+BX a valid 8086 effective address form?
    Answers: 1) SS. 2) Physical = 0x0ABC0 + 0x0100 = 0x0ACC0. 3) No — invalid (8086 allows only BX+SI, BX+DI, BP+SI, BP+DI, SI, DI, BP, BX and direct displacement).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?