Difference between revisions of "ZX-State format"

From SinclairFAQ
Jump to: navigation, search
(Format extensions: Begin documenting DivIDE blocks.)
(ZXSTDIVIDE: Finish documenting block.)
Line 28: Line 28:
 
   BYTE chData[1];
 
   BYTE chData[1];
 
  } ZXSTDIVIDEBLOCK, *LPZXSTDIVIDEBLOCK;
 
  } ZXSTDIVIDEBLOCK, *LPZXSTDIVIDEBLOCK;
 +
 +
==== Members ====
 +
&nbsp;&nbsp; '''blk'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The block header. The block id is ZXSTBID_DIVIDE ('D', 'I', 'D', 'E').<br />
 +
&nbsp;&nbsp; '''wFlags'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Various flags. This can be any combination of:
 +
 +
{|cellspacing="1" cellpadding="1" border="1" width="100%"
 +
|'''Flag'''
 +
|'''Meaning'''
 +
|-
 +
|ZXSTDIVIDE_EPROM_WRITEPROTECT
 +
|The DivIDE's EPROM is write protected.
 +
|-
 +
|ZXSTDIVIDE_PAGED
 +
|The DivIDE is currently paged in.
 +
|-
 +
|ZXSTDIVIDE_COMPRESSED
 +
|If set, the EPROM data (beginning from '''chData''') will be compressed using the [http://www.zlib.org/ Zlib] compression library.
 +
|}
 +
 +
&nbsp;&nbsp; '''chMemCtrl'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The current value of the DivIDE's memory control register.<br />
 +
&nbsp;&nbsp; '''chNumRamPages'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The amount of RAM installed in this DivIDE interface, in units of 8KB. Normally '''4''', representing a 32KB DivIDE interface.<br />
 +
&nbsp;&nbsp; '''chData'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The compressed or uncompressed contents of the DivIDE's EPROM. When uncompressed, this member is exactly 16KB (16,384) bytes in size. When loading [http://www.zlib.org/ Zlib] compressed pages, the compressed size can be obtained by:
 +
compressedSize = blk.dwSize - ( sizeof( ZXSTDIVIDEBLOCK ) - sizeof( ZXSTBLOCK ) - 1 );
  
 
=== ZXSTLEC ===
 
=== ZXSTLEC ===

Revision as of 20:48, 13 August 2017

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:

ZXSTDIVIDE

The state of the DivIDE IDE hard disk and CompactFlash card interface.

// DivIDE flags
#define ZXSTDIVIDE_EPROM_WRITEPROTECT 1
#define ZXSTDIVIDE_PAGED 2
#define ZXSTDIVIDE_COMPRESSED 4

// DivIDE IDE settings
typedef struct _tagZXSTDIVIDEBLOCK
{
  ZXSTBLOCK blk;
  WORD wFlags;
  BYTE chMemCtrl;
  BYTE chNumRamPages;
  BYTE chData[1];
} ZXSTDIVIDEBLOCK, *LPZXSTDIVIDEBLOCK;

Members

   blk
      The block header. The block id is ZXSTBID_DIVIDE ('D', 'I', 'D', 'E').
   wFlags
      Various flags. This can be any combination of:

Flag Meaning
ZXSTDIVIDE_EPROM_WRITEPROTECT The DivIDE's EPROM is write protected.
ZXSTDIVIDE_PAGED The DivIDE is currently paged in.
ZXSTDIVIDE_COMPRESSED If set, the EPROM data (beginning from chData) will be compressed using the Zlib compression library.

   chMemCtrl
      The current value of the DivIDE's memory control register.
   chNumRamPages
      The amount of RAM installed in this DivIDE interface, in units of 8KB. Normally 4, representing a 32KB DivIDE interface.
   chData
      The compressed or uncompressed contents of the DivIDE's EPROM. When uncompressed, this member is exactly 16KB (16,384) bytes in size. When loading Zlib compressed pages, the compressed size can be obtained by:

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

ZXSTLEC

This is documented in the draft of the next version of the SZX format.

ZXSTLECRAMPAGE

This is documented in the draft of the next version of the SZX format.

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.