ZXSTGS
Contains the Z80 registers and other internal state information for the General Sound Interface.
Memory state is stored separately in ZXSTGSRAMPAGE blocks which will follow this block.
// General Sound
// Flags
#define ZXSTZF_EILAST 1
#define ZXSTZF_HALTED 2
#define ZXSTGSF_CUSTOMROM 64
#define ZXSTGSF_COMPRESSED 128
// GS model
#define ZXSTGSM_128 0
#define ZXSTGSM_512 1
typedef struct _tagZXSTGS
{
ZXSTBLOCK blk;
BYTE chModel;
BYTE chUpperPage;
BYTE chGsChanVol[4];
BYTE chGsChanOut[4];
BYTE chFlags;
WORD AF, BC, DE, HL;
WORD AF1, BC1, DE1, HL1;
WORD IX, IY, SP, PC;
BYTE I;
BYTE R;
BYTE IFF1, IFF2;
BYTE IM;
DWORD dwCyclesStart;
BYTE chHoldIntReqCycles;
BYTE chBitReg;
BYTE chRomData[1];
} ZXSTGS, *LPZXSTGS;
Members
- blk
The block header. The block id is ZXSTBID_GS ('G', 'S', 0, 0 ).
- chModel
The GS model being emulated. This can be one of:
Value
Meaning
ZXSTGSM_128
General Sound with 128KB of RAM.
ZXSTGSM_512
General Sound with 512KB of RAM.
- chUpperPage
The current 32KB RAM (or ROM if 0) page at $8000 - $ffff.
chGsChanVol[4]
The 6-bit volume level of each of the four sound channels. Bits 6 and 7 should be set to zero.
chGsChanOut[4]
The output level to each of the four sound channels.
- chFlags
Various flags indicating the internal state of the interface. This can be a combination of:
Flag
Meaning
ZXSTZF_EILAST
The last instruction executed was an
EIinstruction.ZXSTZF_HALTED
The last instruction executed was a
HALTinstruction. The CPU is currently executing NOPs and will continue to do so until the next interrupt occurs. This flag is mutually exclusive with ZXSTZF_EILAST.ZXSTGSF_CUSTOMROM
A custom GS ROM is installed. The ROM image begins at chRomData. The default ROM is version 1.04.
ZXSTGSF_COMPRESSED
If a custom GS ROM is embedded in this block, it has been compressed with the Zlib compression library.
- AF
The contents of the AF register pair
- BC
The contents of the BC register pair
- DE
The contents of the DE register pair
- HL
The contents of the HL register pair
- AF1
The contents of the AF' register pair
- BC1
The contents of the BC' register pair
- DE1
The contents of the DE' register pair
- HL1
The contents of the HL' register pair
- IX
The contents of the IX register pair
- IY
The contents of the IY register pair
- SP
The contents of the stack pointer, SP
- PC
The current value of the program counter, PC
- I
The contents of the R register
- R
The contents of the R register
- IFF1
The value of Interrupt Flip Flop 1 (IFF1). This is guaranteed to be either 0 or 1.
- IFF2
The value of Interrupt Flip Flop 2 (IFF2). This is guaranteed to be either 0 or 1.
- IM
The current Z80 interrupt mode. This can be 0, 1 or 2.
- dwCyclesStart
The t-states value at the time the snapshot was made. This counts up from zero to the maximum number of t-states per 50Hz frame.
- chHoldIntReqCycles
The number of t-states left on restart when an interrupt can occur. This is used to support interrupt re-triggering properly.
- chBitReg
Internal Z80 register used to generate bits 5 and 3 of the F register after executing a
BIT x,(HL)instruction.- chRomData
A Zlib compressed or uncompressed custom GS ROM (if one was installed). The uncompressed ROM size is always 32,768 bytes. When loading Zlib compressed ROMs, the compressed size can be obtained by:
compressedSize = blk.dwSize - ( sizeof( ZXSTGS ) - 1 - sizeof( ZXSTBLOCK ));
Remarks
Memory state is stored separately in ZXSTGSRAMPAGE blocks which will follow this block.
Revision history
Available since version 1.2.