Anonymous

ZX-State format: Difference between revisions

From Sinclair Wiki
→‎Format extensions: Add DivMMC blocks
(→‎Emulator support: Document Fuse and libspectrum support for each block type.)
(→‎Format extensions: Add DivMMC blocks)
Line 83: Line 83:
&nbsp;&nbsp; '''chData'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The compressed or uncompressed contents of the RAM page. When uncompressed, this member is exactly 8KB (8,192) bytes in size. When loading [http://www.zlib.org/ Zlib] compressed pages, the compressed size can be obtained by:
&nbsp;&nbsp; '''chData'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The compressed or uncompressed contents of the RAM page. When uncompressed, this member is exactly 8KB (8,192) bytes in size. When loading [http://www.zlib.org/ Zlib] compressed pages, the compressed size can be obtained by:
  compressedSize = blk.dwSize - ( sizeof( ZXSTDIVIDERAMPAGEBLOCK ) - sizeof( ZXSTBLOCK ) - 1 );
  compressedSize = blk.dwSize - ( sizeof( ZXSTDIVIDERAMPAGEBLOCK ) - sizeof( ZXSTBLOCK ) - 1 );
=== ZXSTDIVMMC ===
The state of the DivMMC interface.
// DivMMC flags
#define ZXSTDIVMMC_EPROM_WRITEPROTECT 1
#define ZXSTDIVMMC_PAGED 2
#define ZXSTDIVMMC_COMPRESSED 4
// DivIDE IDE settings
typedef struct _tagZXSTDIVMMCBLOCK
{
  ZXSTBLOCK blk;
  WORD wFlags;
  BYTE chMemCtrl;
  BYTE chNumRamPages;
  BYTE chData[1];
} ZXSTDIVMMCBLOCK, *LPZXSTDIVMMCBLOCK;
==== Members ====
&nbsp;&nbsp; '''blk'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The block header. The block id is ZXSTBID_DIVMMC ('D', 'M', 'M', 'C').<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 DivMMC's EPROM is write protected.
|-
|ZXSTDIVIDE_PAGED
|The DivMMC is currently paged in.
|-
|ZXSTDIVMMC_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 DivMMC's memory control register.<br />
&nbsp;&nbsp; '''chNumRamPages'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The amount of RAM installed in this DivMMC interface, in units of 8KB. Normally '''16''', '''32''' or '''64''', representing 128KB, 256KB or 512KB DivMMC interfaces.<br />
&nbsp;&nbsp; '''chData'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The compressed or uncompressed contents of the DivMMC'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( ZXSTDIVMMCBLOCK ) - sizeof( ZXSTBLOCK ) - 1 );
=== ZXSTDIVMMCRAMPAGE ===
This block is used to save and restore the contents of the DivMMC's built-in RAM.
A zx-state file will contain a number of these blocks, normally 16 for the 128KB DivMMC, 32 for the 256KB version or 64 for the 512KB version . A [[#ZXSTDIVMMC|ZXSTDIVMMC]] block will proceed the first of these blocks.
// Ram pages are compressed using Zlib
#define ZXSTDRF_COMPRESSED 1
// DivIDE RAM page
typedef struct _tagZXSTDIVMMCRAMPAGEBLOCK
{
  ZXSTBLOCK blk;
  WORD wFlags;
  BYTE chPageNo;
  BYTE chData[1];
} ZXSTDIVMMCRAMPAGEBLOCK, *LPZXSTDIVMMCRAMPAGEBLOCK;
==== Members ====
&nbsp;&nbsp; '''blk'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The block header. The block id is ZXSTBID_DIVIDERAMPAGE ('D', 'M', 'R', 'P').<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'''
|-
|ZXSTDRF_COMPRESSED
|If set, the RAM page data (beginning from '''chData''') will be compressed using the [http://www.zlib.org/ Zlib] compression library.
|}
&nbsp;&nbsp; '''chPageNo'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Page number of this 8KB RAM page. For the 128KB version of the DivIDE interface, this is 0 - 15, for the 256KB version, it is 0 - 31 and for the 512KB version it is 0 - 63.<br />
&nbsp;&nbsp; '''chData'''<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The compressed or uncompressed contents of the RAM page. When uncompressed, this member is exactly 8KB (8,192) bytes in size. When loading [http://www.zlib.org/ Zlib] compressed pages, the compressed size can be obtained by:
compressedSize = blk.dwSize - ( sizeof( ZXSTDIVMMCRAMPAGEBLOCK ) - sizeof( ZXSTBLOCK ) - 1 );


=== ZXSTLEC ===
=== ZXSTLEC ===
49

edits