NEX & SNA File Viewer (ZX Spectrum Next)
A read-only VS Code viewer for ZX Spectrum Next .nex files and ZX Spectrum .sna / .snx snapshots.
NEX files
Open any *.nex file and the viewer shows it in five tabs:
- Overview: every header field, decoded (V1.0–V1.2, plus the unofficial V1.3 fields written by sjasmplus). It also shows a file layout table with offsets and sizes, and validation results:
- magic and version
- truncated files
- bank count
- CRC-32C
- Loading Screen: the loading screen with its border colour, 1×–4× zoom and PNG export. Supported screen types:
- Layer 2 256×192, 320×256 and 640×256
- ULA
- LoRes
- Timex HiRes and HiColour
- Tilemap
- Palette: all 256 colours of the 9-bit palette. If the file has no palette, the default Next palette is shown.
- Banks & Data: every 16K bank in file order, plus copper code, custom (appended) data, the header, palette and screen blocks. Clicking an entry opens a hex dump; offsets can be shown as file offset, block offset or CPU address. The copper block is decoded into its 16-bit instructions (WAIT / MOVE / NOOP / HALT) with Next register names; a hex dump of it is one click away.
- Disassembly: the first 100 Z80 instructions from the start address (PC). This covers undocumented opcodes and the ZX Next extended instructions (
NEXTREG, MUL D,E, PUSH nn, LDIRX and others).
Snapshots (.sna / .snx)
Open any *.sna or *.snx file and the viewer shows it in four tabs:
- Overview: type (48K or 128K), start address, border, interrupt mode and IFF2, all Z80 registers including the shadow set and the decoded flag bits, the 128K paging state from port
$7FFD (bank at $C000, normal or shadow screen, ROM, paging lock, TR-DOS), a screen preview and the file layout.
- Screen: the ULA screen from bank 5 and, for 128K snapshots, the shadow screen from bank 7. The screen that was on display is shown first. Zoom and PNG export work as for NEX files.
- Memory & Data: hex dump of every stored bank, the register header and any appended data. Banks that are paged in can be shown with their CPU address.
- Disassembly: the first 100 Z80 instructions from the start address.
48K snapshots (49179 bytes) do not store PC: it is pushed onto the stack, so the viewer reads it from memory at SP. 128K snapshots (131103 bytes, or 147487 when bank 5 or 2 is the paged one) keep PC, port $7FFD and the TR-DOS flag in a short block after the first three banks.
.snx files have the same layout as a 128K .sna; NextZXOS only keeps file handle 0 open for them, so a program can read private data appended to the file. The viewer lists such data as "Appended data".
NEX versions
| Version |
Handling |
| V1.0 – V1.2 |
Header bytes 0–141 are decoded. Bytes 142–511 are reserved; the viewer warns if they are not zero. |
| V1.3 |
Not part of the official specification, but written by sjasmplus when V1.3 features are used. The viewer additionally decodes the extended fields: expansion bus, CRC-32C, banks offset, CLI buffer, 320/640/tilemap screens, copper code and loading bar Y. |
Copper code
The copper block is always 2048 bytes, i.e. 1024 instructions of 16 bit each (big endian): %1hhhhhhv %vvvvvvvv is a WAIT for a raster position, %0rrrrrrr %vvvvvvvv writes a value to a Next register, $0000 is NOOP and $FFFF halts. Header byte 153 only says whether the block is present; there is no separate switch for using it. When it is present, the loader starts the copper in mode %01 (counter reset, then run) after the loading screen is shown, so the program repeats from instruction 0.
| |