ZX-State format

From Sinclair Wiki
Revision as of 20:08, 13 August 2017 by Pak21 (talk | contribs) (Move ULAplus SZX block definition here (as I'm going to add some more in a bit).)
Jump to navigation Jump to search

ZX-State (SZX) format

ZX-State is the preferred snapshot format for Spectaculator and Fuse. It is usually used with the extension .SZX. Fuse unofficially uses the mimetype x-spectrum-szx for the format (although this could potentially change to x-spectrum-zxstate or x-spectrum-zx-state).

See the official ZX-State documentation and also the draft of the next version.

Support for the format is implemented in libspectrum (used by Fuse), Zero, ZXDS, SpecEmu and Spin.

Early versions of libspectrum (prior to 1.0.0) contained a bug which caused the A and A' registers to be swapped with F and F', respectively, when loading or saving in the SZX format. Current versions of libspectrum detect "libspectrum: 0.5.0" and earlier versions strings and correct for this.

Format extensions

With the official specification being somewhat stalled, some emulators have added unofficial extensions to the format. These include:

ZXSTPALETTE

The state of the ULA registers found in the 64 colour replacement ULA. This block may be present for any machine.

// Palette Block flags
#define ZXSTPALETTE_DISABLED  0
#define ZXSTPALETTE_ENABLED  1

// Palette Block. Contains the palette register values
typedef struct _tagZXSTPALETTEBLOCK
{
  ZXSTBLOCK blk;
  BYTE chFlags;
  BYTE chCurrentRegister;
  BYTE chPaletteRegs[64];
} ZXSTPALETTEBLOCK, *LPZXSTPALETTEBLOCK;

Members

   blk
      The block header. The block id is ZXSTBID_PALETTE ('P', 'L', 'T', 'T').
   chFlags
      A flags that indicates if the palette is enabled or if the normal display mode is in use. This can be one of:

Flag Meaning
ZXSTPALETTE_DISABLED Normal palette mode with BRIGHT and FLASH
ZXSTPALETTE_ENABLED 64 colour palette mode


    chCurrentRegister
      The currently selected palette register (0-63).
    chPaletteRegs
      The current values of the palette registers.