Introduction
A .z80 file is a snapshot of a ZX Spectrum: the Z80 processor's registers and the contents of its
RAM at one moment, which an emulator restores to carry on from there. The format comes from Gerton Lunter's Z80
emulator, and has three versions. Version 1 holds a 48K machine only. Versions 2 and 3 add a second header that says which
machine it is (48K, 128K, +3 and others), the 128K memory paging, the sound chip's registers and, in version 3, the
timing and the disk interfaces. The RAM is stored in blocks, usually compressed with a simple scheme for runs of
equal bytes. It is the format that most Spectrum emulators and game archives use for snapshots, next to
SNA.
The extension .z80 is also used by some assemblers for Z80 source text. The explorer tells them apart by
reading the structure: a snapshot has a header whose program counter, extra-header length and first memory block fit, or a
version 1 body of exactly 49152 bytes (or one that ends in the marker 00 ED ED 00); text never does.
A .z80 snapshot dropped on any page of this site opens in the explorer, which shows the header fields,
the registers, every memory block, the screen as a picture (with its border), the interrupt set-up and the Z80 disassembly of the RAM as the CPU sees it, with the
names of the Spectrum ROM routines and system variables (names) and of each RAM bank on a 128K
machine.
Structure
A 30-byte header of registers. If its program counter (offset 6) is not zero the file is version 1 and the 48 KiB of RAM follows at once. If the program counter is zero the file is version 2 or 3: a two-byte length (23 for version 2, 54 or 55 for version 3) comes next with the extra header, and then memory blocks, each with its length and page number.
0Header registers, flags, interrupt mode30 bytes30Extra header length, real PC, hardware mode, port$7FFD, AY registers, timers (versions 2 and 3)25, 56 or 57 bytes…Memory blocks length, page, data (versions 2 and 3); or one block of RAM (version 1)varies
Variants
- Version 1 – a 30-byte header and 48 KiB of RAM, compressed or not, ending in
00 ED ED 00when compressed. 48K machines only. - Version 2 – the extra header is 23 bytes; memory in 16 KiB pages; hardware modes 0 to 4 name the 48K, Interface I, SamRam and 128K machines.
- Version 3 – the extra header is 54 bytes (55 in files that also store port
$1FFD); adds the T-state counters, the Disciple and Plus D interfaces and a user-defined joystick. Hardware mode numbers 3 and above mean different machines than in version 2.
Some programs also add data after the memory blocks (the .slt extension); the viewer marks it and does not read it.
Links
Software
- Fuse – ZX Spectrum emulator that loads and saves Z80 snapshots (Windows, macOS, Linux)
- ZEsarUX – emulator of the Spectrum and other machines (Windows, macOS, Linux)
- Spectaculator – ZX Spectrum emulator (Windows)
Reference
- Z80 format – World of Spectrum's description of versions 1, 2 and 3
- libspectrum – the library Fuse uses to read and write snapshots and tapes; its source was used to check the explorer's reader
Not described
The header, the hardware modes, the memory pages and the compression are described on the header and memory pages pages. What remains:
Known, not yet covered
- Reference: what the +3, Pentagon, Scorpion, Timex and Didaktik machines do with ports
$1FFD,$F4,$FF(only the bytes are named), the 16 RAM pages of the Scorpion, the format of the SamRam page numbers beyond the table, and the.sltlevel data. - Viewer: the explorer reads the files of the 48K and 128K machines (and treats the +3, Pentagon, +2, +2A as 128K, ignoring port
$1FFDpaging, and the Timex machines as 48K); every byte of RAM is decoded as Z80 code with nothing followed from the program counter; the ROM is not in a snapshot, so a call into the ROM is named but not shown; the 128K screen is the one port$7FFDselects; flashing cells are drawn in their first phase. It has not been run in a browser by its author.
Checked
- 15 real snapshots (versions 1, 2 and 3) and two from libspectrum's own tests were read by the explorer and by libspectrum: every register, the border, port
$7FFDand a hash of every 16 KiB RAM bank after decompression are equal.