[ Spectaculator, ZX Spectrum Emulator ] Home | Downloads | Support [ ZX Spectrum Image ]

Table of contents

The zx-state file format
Block types


zx-state files will contain a number of 16KB RAM page blocks, depending on the specific Spectrum model.

// Ram pages are compressed using Zlib
#define ZXSTRF_COMPRESSED       1

// Standard 16kb Spectrum RAM page
typedef struct _tagZXSTRAMPAGE
  WORD wFlags;
  BYTE chPageNo;
  BYTE chData[1];


The block header. The block id is ZXSTBID_RAMPAGE ('R', 'A', 'M', 'P').
If ZXSTRF_COMPRESSED is set, the RAM page data (beginning from chData) will be compressed using the Zlib compression library.
Memory page number (usually 0-7, but see below as the Pentagon 512/1024 and ZS Scorpion machines have additional memory).

For 16k Spectrums, only page 5 (0x4000 - 0x7fff) is saved.

For 48k Spectrums and Timex TS/TC models, pages 5, 2 (0x8000 - 0xbfff) and 0 (0xc000 - 0xffff) are saved.

For 128k Spectrums and the Pentagon 128, all pages (0-7) are saved.

For the Pentagon 512, all 32 pages (0-31) are saved.

For the Pentagon 1024, all 64 pages (0-63) are saved.

For the ZS Scorpion 256, all 16 pages (0-15) are saved.

The actual compressed or uncompressed memory page data.

When loading Zlib compressed pages, the compressed size can be obtained by:

compressedSize = blk.dwSize - ( sizeof( ZXSTRAMPAGE ) - sizeof( ZXSTBLOCK ) - 1 );


The RAM page blocks are not guaranteed to be in any specific order.

Revision history

Available since version 1.0

  Copyright © 2001 - 2011 Jonathan Needle Top