Introduction

FantASM is a modern, cross-platform Z80 assembler written in Rust — a fast, correct two-pass core that assembles the complete Z80 instruction set for any Z80 target, with first-class support for the ZX Spectrum and ZX Spectrum Next. It runs on macOS, Windows and Linux, and pairs raw output for bare-metal Z80 work with the conveniences you expect from a contemporary toolchain.

Why FantASM

  • Complete Z80, plus Z80N. The full standard and undocumented Z80 instruction sets, and native support for the ZX Spectrum Next’s extended Z80N opcodes (NEXTREG, MUL, LDIX, LDWS, and the rest).
  • Output for any Z80 target. Raw binary and Intel HEX for bare-metal Z80 systems, plus intelligent defaults, .sna snapshots and Next .nex executables for the ZX Spectrum family (zx16, zx48, zx128, zxnext).
  • A real language, not just a mnemonic translator. Macros, structures, enums, conditional assembly, expressions, and character-set translation for ZX Spectrum glyphs.
  • Made for a debug loop. CSpect BREAK/EXIT hooks, source-level debugging data (SLD), and first-class output for running straight in an emulator.
  • Scriptable and testable. An embedded Rhai engine for build logic and custom directives, plus integrated !test blocks that run on a built-in Z80 simulator.
  • Editor-aware. A built-in Language Server (LSP) brings diagnostics, hover and completion to VS Code, Zed, Vim and other modern editors.

Where it fits

FantASM is one of three TwistedRaven Z80 tools, designed to stand alone yet work together:

  • Zinc — a modern language that compiles to Z80, using FantASM as its backend.
  • FantASM — the assembler that turns source, hand-written or generated, into a runnable .nex.
  • Bizmuth — a cycle-accurate Next emulator and source-level debugger for running and stepping through what you build.

The command-line tool is fantasm (lowercase); the project is FantASM.

About these docs

This site is the definitive reference for FantASM. If you’re new, start with Installation then the Quick Start. From there, the Guide covers everyday use, Language documents the syntax and directives, and Reference is the exhaustive instruction, diagnostic and format tables.