Introduction
An SZX file is a snapshot of a ZX Spectrum in the ZX-State format designed for the Spectaculator emulator and written by Fuse and other emulators too. Unlike the .Z80 and .SNA snapshots it is a list of blocks, one for each part of the machine that has state (the Z80, the ULA and memory paging, each RAM page, the sound chip, the joysticks, the interfaces), so new hardware can be added without breaking old readers: a reader that does not know a block skips it. RAM pages and ROMs are compressed with zlib.
Structure
An 8-byte header and then any number of blocks, each an id, a size and that many bytes.
0Header “ZXST”, version, machine, flags8 bytes8Block a 4-character id, a 32-bit size, the data8 + size…More blocks in any order; usually CRTR, Z80R, SPCR, the RAM pages, then sound chip and interfaces
In the explorer
Drop a .szx file on the explorer to see:
- the tree: the header and each block with its id, size and data; the blocks this viewer knows show their fields;
- a table of the blocks with a name for each id and where the id is known from, and the RAM pages with how they are stored;
- when the file holds the Z80 registers and the RAM pages: the screen drawn with the border colour, and the CPU’s view of RAM disassembled with our Z80 decoder, the program counter labelled, with the Spectrum’s system names;
- the problems found: a block cut short, a zlib page that does not decode to 16 KiB, a flag that excludes another, a page twice, RAM without registers.
The options bar picks the RAM bank shown at $C000 on a 128K-style machine (the file’s port $7FFD value by default).
Not described
Known, not yet covered
- Reference and viewer: the layouts of the other blocks (the Interface 1, Beta 128, +D, Opus, +3 and Microdrive disks and tapes, Multiface, General Sound, Spectranet, uSpeech, the dock, the LEC, the ATASP, ZXCF, SIDE and ZX Printer blocks): their ids are listed, their bytes are shown, their fields are not decoded.
- Viewer: the custom ROM is checked for size and decoding but not shown as code; the disassembly decodes every byte as an instruction and does not follow the program; only RAM banks 0 to 7 are shown in the bank option (the Pentagon 512/1024 and Scorpion have more pages).
- Viewer: the Timex screen modes and the shadow screen of the ZS Scorpion are not drawn; only the normal Spectrum screen is.
Unknown
- Reference: the ids marked “memory” on the blocks page were written from memory and not checked against the specification pages; the specification’s own header page gives the minor version as 4 and its title says 1.5 (real files say 3 and 5).
Links
Software
- Spectaculator – the ZX Spectrum emulator the format was made for (Windows, macOS)
- Fuse – ZX Spectrum emulator that reads and writes SZX (Windows, macOS, Linux)
Reference
- zx-state specification (Spectaculator) – the main source of these pages, read through a summarising fetch, so the numbers are “our words”
- libspectrum’s test files (GPL-2), read in place, give the real block ids and sizes used to check the pages