zx-state header

The zx-state header appears right at the start of a zx-state (.szx) file.

It is used to identify the version of the file and to specify which model of ZX Spectrum (or clone) the file refers to.

Following the zx-state header is an optional ZXSTCREATOR creator information block.

Following that are the ZXSTZ80REGS and ZXSTSPECREGS blocks followed by zero or more additional blocks representing the current state of the emulated Spectrum.

// Machine identifiers
#define ZXSTMID_16K          0
#define ZXSTMID_48K          1
#define ZXSTMID_128K         2
#define ZXSTMID_PLUS2        3
#define ZXSTMID_PLUS2A       4
#define ZXSTMID_PLUS3        5
#define ZXSTMID_PLUS3E       6
#define ZXSTMID_PENTAGON128  7
#define ZXSTMID_TC2048       8
#define ZXSTMID_TC2068       9
#define ZXSTMID_SCORPION     10
#define ZXSTMID_SE           11
#define ZXSTMID_TS2068       12
#define ZXSTMID_PENTAGON512  13
#define ZXSTMID_PENTAGON1024 14
#define ZXSTMID_NTSC48K      15
#define ZXSTMID_128KE        16

// Flags (chFlags)
#define ZXSTMF_ALTERNATETIMINGS 1

typedef struct _tagZXSTHEADER
{
  DWORD dwMagic;
  BYTE  chMajorVersion;
  BYTE  chMinorVersion;
  BYTE  chMachineId;
  BYTE  chFlags;
} ZXSTHEADER, *LPZXSTHEADER;

Members

dwMagic

Byte sequence of 'Z', 'X', 'S', 'T' to identify the file as a zx-state file.

chMajorVersion

Major version number of the file format. Currently 1.

chMinorVersion

Minor version number of the file format. Currently 4.

chMachineId

The model of ZX Spectrum (or clone) to switch to when loading the file. This is one of:

Value

Meaning

ZXSTMID_16K

16k ZX Spectrum

ZXSTMID_48K

48k ZX Spectrum or ZX Spectrum+

ZXSTMID_128K

ZX Spectrum 128

ZXSTMID_PLUS2

ZX Spectrum +2

ZXSTMID_PLUS2A

ZX Spectrum +2A/+2B

ZXSTMID_PLUS3

ZX Spectrum +3

ZXSTMID_PLUS3E

ZX Spectrum +3e

ZXSTMID_PENTAGON128

Pentagon 128

ZXSTMID_TC2048

Timex Sinclair TC2048

ZXSTMID_TC2068

Timex Sinclair TC2068

ZXSTMID_SCORPION

Scorpion ZS-256

ZXSTMID_SE

ZX Spectrum SE

ZXSTMID_TS2068

Timex Sinclair TS2068

ZXSTMID_PENTAGON512

Pentagon 512

ZXSTMID_PENTAGON1204

Pentagon 1024

ZXSTMID_NTSC48K

48k ZX Spectrum (NTSC)

ZXSTMID_128Ke

ZX Spectrum 128Ke

chFlags

Various flags. This can currently only be:

Flag

Meaning

ZXSTMF_ALTERNATETIMINGS

If set, the emulated Spectrum uses alternate timings (one cycle later than normal timings). If reset, the emulated Spectrum uses standard timings. This flag is only applicable for the ZXSTMID_16K, ZXSTMID_48K and ZXSTMID_128K models.

Revision history

Available since version 1.0

ZXSTMID_NTSC48K and ZXSTMID_128Ke were added in version 1.4

ZXSTMF_ALTERNATETIMINGS was added in version 1.4