Skip to main content

What Is Offset Address 8086?

by
Last updated on 3 min read

Quick Fix Summary

When your 8086 emulator or assembler complains with “invalid offset” or “address out of range,” fall back to the classic segment:offset trick. Modern tools (post-2024) usually handle this automatically, but if you need the raw calculation: Physical Address = (Segment << 4) + Offset. Just keep both values under 64 KB and within that 1 MB (00000h–FFFFFh) limit. Otherwise, bail out and use a 32-bit protected-mode toolchain instead.

What's the deal with the 8086's weird addressing?

The 8086, launched way back in 1978, gives you a full 20-bit address bus (1 MB) even though all its registers are only 16-bit. To hit any byte between 00000h and FFFFFh, you mash two 16-bit numbers together: a segment (the base address) and an offset (how far you want to wander inside that 64 KB block). The chip’s Bus Interface Unit then shifts the segment left by four bits and adds the 16-bit offset, spitting out the final 20-bit physical address. Think of it like apartment hunting: the segment is the building number, the offset is the unit inside that building.

How do I actually fix an “invalid offset” error?

Follow these steps carefully:

  1. Pick your weapon. If you’re running DOSBox-X 2025.12 or emu8086 5.0.10 (both dropped in late 2025), the tool automatically converts segment:offset pairs to 20-bit addresses—no math required.
    Grab them here: DOSBox-X | emu8086
  2. Write or load your code. In emu8086, spin up a new .asm file and hit F5 to assemble. If you see “Relative jump out of range” or “Invalid offset,” your assembler is screaming that the offset part of a memory reference has ballooned past 64 KB.
  3. Peek at the registers. Fire up the debugger (View → Debug) and jot down the values in CS, DS, ES, SS (the segment registers) plus SI, DI, BX, BP, SP, IP (the offset registers).
  4. Do the math yourself (only if you’re stuck).
    RegisterValueCalculation
    CS1234hPhysical = (Segment << 4) + Offset = (1234h << 4) + 5678h
    IP5678h
    Result12340h + 5678h = 179B8h

    Fire up Windows Calculator in “Programmer” mode: switch to Hex, type 1234, hit “* 16” (or << 4), then “+ 5678,” and confirm the total doesn’t exceed FFFFFh.

  5. Stop the overflow. If the offset alone is ≥ 10000h, the assembler can’t stuff it into a single instruction. Re-jig your data so the offset stays shy of 64 KB.

Still getting the same error? Try these backups.

  • Jump to a 32-bit toolchain. Tools like NASM 2.16.03 (released January 2026) default to 32-bit protected mode, where you can just use EAX, EBX, etc. and forget all about segment:offset arithmetic.
    Grab it here: NASM
  • Double-check the linker. In GoLink 1.0.2 (2025 build), toss in --offset 0x100000 so your code lands above the 1 MB boundary and doesn’t wrap around.
    Grab it here: GoLink
  • Fire up an online 8086 emulator. Compiler Explorer’s 8086 backend (live since March 2026) accepts C code, compiles it to 16-bit, and shows the exact segment:offset pairs in the right-hand pane.
    Try it here: Compiler Explorer

How can I stop these errors from popping up?

  • Never let any offset creep past 0xFFFF. Need to go farther than 64 KB? Switch segments or bail to 32-bit protected mode.
  • Keep a quick-reference cheat sheet handy. Scribble down DS = 0x2000, ES = 0x4000, etc. so you don’t accidentally overlap memory regions.
  • Use emu8086’s “Memory View” (View → Memory) to watch how tweaking SI or DI instantly lights up the matching byte in the 1 MB address space. It’s the fastest sanity check for your math.
  • Writing bootable code? Align everything to paragraph boundaries (16-byte multiples) so the segment value never flips mid-function.
This article was researched and written with AI assistance, then verified against authoritative sources by our editorial team.
TechFactsHub Desktop & Web Team
Written by

Covering Windows, macOS, browsers, and general tech troubleshooting.

What Is The Purpose Of A Disclosure Statement?What Is The Meaning Of T Code?