8087 Emulation on 8086 Systems

· coding hardware ai · Source ↗

TLDR

  • How Intel and Microsoft cooperated assemblers, linkers, and runtime libs to emulate the 8087 FPU on bare 8086/8088 machines without hardware.

Key Takeaways

  • Intel shipped the E8087 software emulation package alongside the 8087 chip in 1980, enabling developers to write FPU code without hardware.
  • The emulation chain required three-layer cooperation: the compiler emitted regular 8087 opcodes plus special fix-ups; the linker rewrote those ESC instructions into software INTs at link time.
  • Intel used 8 interrupt vectors (INT 18h-1Fh); Microsoft’s DOS reimplementation expanded to 10 vectors (INT 34h-3Dh) to also emulate WAIT and ES-segment-override FPU instructions.
  • Microsoft added self-patching: on a machine with a real 8087, the emulator detected it at startup and replaced each INT stub with the original hardware instruction on first execution, recovering near-100% native speed.
  • MASM 1.x silently miscompiled FSTSW DS:[BP] (dropped the segment prefix) and rejected SS/CS overrides entirely; MASM 3.0 (1984) fixed all of these.

Hacker News Comment Review

  • The single comment questions whether the 8087’s high price was a deliberate Intel market strategy or driven by fabrication complexity; the article treats the price as a given constraint, not a strategic choice.
  • No further technical discussion has emerged yet on emulation correctness, the fix-up arithmetic, or Microsoft vs. Intel interrupt vector choices.

Original | Discuss on HN