|
A ZX Spectrum emulator snapshot.
Information on the ZX Spectrum file formats can be found in the ZX Spectrum FAQ which can be found at WOS.
A .Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80z80 file may contain a snapshot for most ZX Spectrum models and, on some emulators, e.g. zxsp for OSX, for a bunch of clones, ZX80 and ZX81 variants and the Jupiter Ace as well.
The .Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80z80 file starts with a header section which is followed by multiple ram chunks. This is reproduced as one header segment and an appropriate number of appropriately sized segments with ram contents.
The basic layout is like this:
#target z80
Assembler directives: #code Including C Source Files: #code#code _HEADER,0,size ; size depends on version
...
Assembler directives: #code Including C Source Files: #code#code _RAM,0x4000,0xC000,<id>
...
See the zxsp .Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80z80 template file: template_z80.asm
The header size is 30 bytes and the ram chunk must be a single segment of 0xC000 bytes. Use of version 1.45 is discouraged.
Note: unlike the other versions the version 1.45 ram segment has no ID flag.
#target z80
Assembler directives: #code Including C Source Files: #code#code _HEADER,0,30
...
Assembler directives: #code Including C Source Files: #code#code _RAM,0x4000,0xC000
...
The header section contains additional information and the ram is saved in pages of 0x4000 bytes each. This has to be reproduced in the source file. Depending on the model declared in the header section, (see template_z80.asm) an appropriate number of correctly sized code segments must follow which must have an additional flag argument which defines the ID which is assigned to their ram chunk.
This would be appropriate for a ZX Spectrum 48k:
#target z80
Assembler directives: #code Including C Source Files: #code#code _HEADER,0,55
...
Assembler directives: #code Including C Source Files: #code#code _RAM1,0x4000,0x4000,8
...
Assembler directives: #code Including C Source Files: #code#code _RAM2,0x8000,0x4000,4
...
Assembler directives: #code Including C Source Files: #code#code _RAM3,0xC000,0x4000,5
...
evtl. i will implement the 'varying blocksize' feature from the b&w models for zxsp and allow zasm to produce such files. this would allow one continuous segment to be used.
This would be appropriate for a ZX Spectrum 128k:
#target z80
Assembler directives: #code Including C Source Files: #code#code _HEADER,0,86
...
Assembler directives: #code Including C Source Files: #code#code _RAM0,0xC000,0x4000,3 // ram mapped at 0xC000 after reset
...
Assembler directives: #code Including C Source Files: #code#code _RAM1,0xC000,0x4000,4
...
Assembler directives: #code Including C Source Files: #code#code _RAM2,0x8000,0x4000,5 // ram at 0x8000
...
Assembler directives: #code Including C Source Files: #code#code _RAM3,0xC000,0x4000,6
...
Assembler directives: #code Including C Source Files: #code#code _RAM4,0xC000,0x4000,7
...
Assembler directives: #code Including C Source Files: #code#code _RAM5,0x4000,0x4000,8 // ram at 0x4000
...
Assembler directives: #code Including C Source Files: #code#code _RAM6,0xC000,0x4000,9
...
Assembler directives: #code Including C Source Files: #code#code _RAM7,0xC000,0x4000,10
...
The b&w models have varying ram sizes from 1k to 64k or more. To allow storing of any arbitrary ram size the memory is chunked into blocks of 1k, 2k, 4k, 8k, 16, 32k and 64k. Currently each block must occur at most once. So 1k, 2k or 16k ram would be saved as 1 block while 48k would be saved as 2. The block IDs can be picked from template_z80.asm.
Assembler directives: #code Including C Source Files: #code#code _HEADER 0,55
...
Assembler directives: #code Including C Source Files: #code#code _RAM,0x4000,0x0800,4 ; looks like a TS1000 ;-)
...
| |