CPU extensions (Z80N & CSpect)
Beyond the standard and undocumented Z80 instruction sets, FantASM supports two opt-in extension sets.
Z80N — ZX Spectrum Next
The Next’s CPU adds extended opcodes such as NEXTREG, MUL, PUSH nnnn, LDIX and LDWS. Enable them in any of these ways:
-N,--z80non the command line;!target zxnext(the Next target enables Z80N);!opt z80n onfrom source.
!target zxnext
nextreg $07, 3 ; set the CPU speed register
mul d, e ; 8×8 → 16-bit multiply
push $4000 ; push an immediate wordSee the instruction set reference for the full list of Z80N opcodes.
CSpect
The CSpect emulator recognises two debugging instructions that FantASM can emit:
| Instruction | Purpose |
|---|---|
BREAK | Trigger the CSpect debugger at this point. |
EXIT | Exit the emulator. |
Enable them with -c, --cspect or !opt cspect on:
!opt cspect on
break ; drop into the CSpect debugger hereThese are also useful when producing test builds; strip them from release builds by gating on a define.