This utility works with the following models of Spectrum:
The ZX ROM Cartridge Creator is a Windows based utility that allows the generation of Sinclair Spectrum ZX Interface 2 ROM cartridge files for use on 16K, 48K, 128K and +2 models. The files are intended for use with the ZXC1, ZXC2, ZXC3 and ZXC4 ROM cartridge PCBs, and are suitable for direct programming into PROMs. This page details those facilities applicable to the ZXC3.
For a ZXC3 fitted with a 128K FLASH ROM, the generated cartridge file can be sent to the Spectrum via RS232 and the Spectrum can program it into the FLASH ROM without the need for an EPROM programmer.
The utility supports four file types:
- PC-based emulator snapshot files (.Z80, .SNA, .SZX)
- ROM image files (.ROM and .BIN)
- ZX80 program files (.O, .P80, and .80) for emulation on the Spectrum 128
- ZX81 program files (.P, .P81, and .81) for emulation on the Spectrum 128
A multi-program compilation may support any combination of these file types subject to the available space within the destination PROM. When targetting an EPROM, the utility will automatically determine which is the smallest capacity required for the chosen selection of programs. Snapshot, ZX80 and ZX81 programs are stored in a compressed format, thereby maximising the use of the available space.
PC-based emulator snapshot files (.Z80, .SNA and .SZX) allow the majority of 16K, 48K and 128K cassette based software titles to be converted into ROM cartridges. For most efficient results, the snapshot of a 16K game should be taken on emulated 16K machine and the snapshot of a 48K game taken on an emulated 48K machine. On a Spectrum 128, snapshots of programs taken while in 128 BASIC mode may fail to run properly on a Spectrum +2, and vice versa. This is due to routine relocations within the Editor ROM of the Spectrum +2.
To convert a snapshot, a few bytes of RAM are required and the safest place to attempt to obtain these from is the stack. Although this will work fine for the majority of programs, some might become corrupted if there is not enough stack space spare. If such an error is encountered then it might be possible to overcome it by taking a snapshot at a different stage within the program, preferably when there is little activity occurring, e.g. when showing a menu instead of during the game play.
ROM image files (.ROM and .BIN) can be incorporated into a multi-program cartridge, thereby allowing programs such as back-ups of the original retail cartridges or any of my new cartridge programs to be included. If the target is a Flash ROM on the ZXC3, then only ROM image files where the last 64 locations contain the value $FF can be added to the list.
|ZX80 Program Files|
ZX80 program files (.O, .P80, and .80) can be selected and will run using my ZX80 emulator ROM cartridge program (which will be included automatically). There are a couple of variants of the ZX80 emulator and each ZX80 program can be assigned to use one or other of them. Note that ZX80 programs are only supported on 128K Spectrums.
|ZX81 Program Files|
ZX81 program files (.P, .P81, and .81) can also be selected and will run using my ZX81 emulator ROM cartridge program (which will be included automatically). A number of variants of the ZX81 emulator also exist and each ZX81 program can be assigned to use a particular version. As with ZX80 programs, ZX81 programs are only supported on 128K Spectrums.
|Creating a Program Compilation|
To create a compilation for the ZXC3, select the target type as 'Spectrum' and 'ZXC3'. The Memory Type field is populated with the choice of applicable ROM types for the chosen cartridge, which are 'PROM' and 'FLASH' for a ZXC3. If the memory type is selected as 'FLASH' then the option Include Programmer is enabled, which allows selection of whether to embed the ZXC3 Flash Programmer utility in the ROM image being created. The Flash Programmer utility is the means by which the Spectrum can program the FLASH ROM and including it means that it can be invoked at any time to allow the ROM to be re-programmed. The Flash Programmer utility is described later on.
Once the target type has been chosen, programs can be selected via the Add button located on the toolbar (or from the Edit menu). It is also possible to drag-and-drop files from Windows Explorer into the compilation list area. A range of sub-options allow direct selection of a particular program type, e.g. snapshots only. Programs can also be adding by pressing the Insert key. Programs can be removed via the Remove button in the toolbar, from the Edit menu, or by pressing the Delete key. When Add is clicked, a dialog window is displayed which allows selection of the programs to insert and allows only files of the chosen type to be shown. The utility remembers the file type selected and will default to this next time the dialog is invoked. Once one or more programs have been selected, they are added to the compilation list within the middle area of the utility's window. This area shows a summary of details for each program. Fields show the file name of the program, the size the program occupies within the ROM image, the RAM required to run it, its type (e.g. a Z80 snapshot), and the text to use for the program within the automatically generated menu system (the default text is based on the program's file name). The remaining fields allow the name of the publisher, the year of release and a reference code (such as a version number or catalogue number) to be set. These details will be displayed by the menu system produced for the cartridge compilation. The menu entry text and the other fields shown for the program can be set via the options presented in the Program Details area, as described later.
When more than one program is inserted into a compilation then a start up menu will automatically be created and embedded within the cartridge image. This menu will be displayed when the cartridge is powered on and provides a method for selecting which program to run.
The menu displays the title of the cartridge, followed by a list all programs within the cartridge. The title text can be set via the entry in the Cartridge Details area (as described later). The cursor up and down keys (or just keys 7 and 6) are used to navigate the menu items and ENTER (or 0) is used to run the highlighted program. If there are more programs than can fit on the screen then indicators will be displayed to show that the menu can be scrolled. Scrolling past the end or beginning of the compilation list will cause a wrap around. To aid navigation, the cursor up and down keys will auto-repeat if held down. When navigating the menu, details about the currently selected program are displayed at the bottom of the screen. This consists of the text specified for the Publisher, Year and Reference fields for the program.
The menu system always contains a Disable ROM Cartridge entry, which allows the internal Spectrum ROM to be run. The cartridge will be completely disabled and avoids the need to physically remove the cartridge in order to use the Spectrum without it.
The Cartridge Creator utility also provides functions to re-arrange the order that the programs appear within the menu. This does not affect how the programs are actually stored within the PROM. All variable length programs are packed into the PROM space first, i.e. snapshots, ZX80 and ZX81 programs, and then after this appear all ROM image programs. This is because ROM image programs always need to begin in their own bank and are deemed to be multiples of 16K, and hence can be placed in adjacent banks without leaving any voids. The utility also provides functions for sorting the list of programs based on one of the fields: Title, Program Type, RAM, Publisher, Reference or Year.
The menu system also provides support for a couple of short-cut keys. Holding down the CAPS SHIFT key as the Spectrum is powered on causes the cartridge to be disabled and passes control to the Spectrum's internal ROM. Holiding down the SYMBOL SHIFT key as powering on the Spectrum is powered on causes the RAM Tester utlitity (if present in the compilation) to be run directly without the menu appearing. The menu system uses RAM but if the RAM is faulty then it might not be possible to select the RAM Tester from the list. The direct run facility therefore overcomes this problem.
|Create Data File|
Once a list of programs has been defined, the compilation can be written to a file by selecting the Create button. Four output file formats are supported, with the format to produce selected by choosing the appropriate file type from the save dialog.
Selecting .BIN format produces a binary ROM image suitable for direct programming into a PROM of the minimum size stated (or larger) using an EPROM programmer. It also creates an archive of the compilation output, which can subsequently be added to a blank compilation (with the Flash Programmer omitted) and downloaded to the ZXC3 for programming into a FLASH ROM. This avoids the need to regenerate the compilation from the input files.
Selecting .PRG format produces a file that contains the data formatted for transfer over RS232, which can subsequently be sent from a terminal program. This can be useful if running the Cartridge Creator within a virtual machine since some virtualisation software packages do not appear to respond rapidly to the serial handshaking lines.
The other formats available are .TAP and .TZX tape files. If these files are transferred to cassette, then the Flash Programmer utility can load them in and can use the data to program the PROM. Note that the Cartridge Creator utility does not provide a mechanism for transferring the tape files to cassette.
|Send Data via RS232|
The Send button is available when the PROM type is set to FLASH and can be used to transmit the compilation to the Spectrum via an RS232 link. The serial port to use can be selected via the drop down list next to the Send button, which will show all serial ports detected on the PC. The Flash Programmer utility supports RS232 communications through the following connections:
- Interface 1 RS232 socket
- Spectrum 128 RS232 socket
- Spectrum 128 keypad socket
- Interface 2 joystick 1 socket
- Interface 2 joystick 2 socket
As of Flash Programmer version 1.10, communications to the ZXC3 occurs at 57600 baud with 8 data bits, no parity and 1 stop bit (previously it was 19200 baud). Hardware handshaking is enabled when using the Interface 1 RS232 socket or a Spectrum 128 socket, but is disabled when using an Interface 2 joystick socket. This is because the joystick sockets only provide input lines and so cannot be used to signal to a PC when to send data. So instead the Cartridge Creator program must disable handshaking and introduce delays between the bytes it transmits. It has no way to automatically detect that an Interface 2 joystick socket is being used and so must be informed via the Target ZX Interface 2 Port option within the Cartridge menu. The delays that are inserted between bytes can be adjusted via the ZX Interface 2 Communication Settings option within the Cartridge menu. The Interface 2 joystick sockets operate at 5V logic levels and not RS232 voltage levels. Therefore a voltage level conversion circuit is required. When using an Interface 2 joystick socket to receive data, the option in the Flash Programmer utility to receive data must be selected before Send is clicked in the the Cartridge Creator program. Note that communicating via a joystick socket is significantly slower than using the other RS232 methods, and so should be avoided where possible. Cable wiring details are presented later.
The Cartridge Creator utility also provides functions for saving the current program compilation, loading a previously saved compilation, and for creating a new blank compilation. A compilation can also be loaded by dragging it in to the file list area of the Cartridge Creator, or by double clicking a .zxc compilation file.
The Cartridge Creator utility is aware of the range of ROM cartridge programs available from this website (excluding 3rd party titles) and will automatically insert details for all known programs. The programs are identified by their file name and so these should not be changed.
|Cartridge Details Area|
The Cartridge Details area contains a number of fields relating to the current compilation:
|Title||This field allows the text to use as the program title within the cartridge menu to be specified.|
|Memory Type||This field allows the ROM type to be selected for the target ROM cartridge. For the ZXC3, both PROMs and FLASH are supported.|
|Include Chars||This field selects whether to embed bitmaps for the character set or access those within the Spectrum's ROM. If the target ROM cartridge does not have paging circuitry fitted (it is optional on the ZXC3, but is generally fitted), then it is necessary to embed a copy of the bitmaps.|
|Include Programmer||This field applies if the ZXC3 is fitted with a FLASH ROM. It allow selection of whether to embed a copy of the Flash Programmer utility within the ROM image. The advantage of embedding it is that it can be invoked at any time in the future to allow the cartridge to be re-programmed. However, it may be desirable to omit it if additional space if required for a larger program compilation. In such a case, it would be necessary to load the Flash Programmer utility from a back-up, e.g. cassette or Interface 1 RS232, in order to re-program the cartridge.|
|Start-up Type||By default a menu is only included within a cartridge compilation if there is more than one program included. For a compilation consisting of a single program, a smaller block of start-up code is used instead of the menu. This start-up code performs any initialisation required and then proceeds to run the program. Both the menu code and the start-up code check the CAPS SHIFT key to disable the cartridge, and before running a program they will check to ensure that the Spectrum has the minimum amount of RAM required by the program. However, it may be desired that the menu system is included even when there is only a single program in the compilation. If so then this can be achieved by changing the Start-up Type field from 'Auto' to 'Menu'.|
|Programs||This read-only field displays the number of programs included within the compilation.|
|Required Memory||This read-only field shows the smallest capacity ROM required to contain the compilation.|
|Program Data||This read-only field displays how much space is being occupied by all of the inserted programs.|
|Menu Code||This read-only field shows how much menu or start-up code is required.|
|Programmer Code||This read-only field displays much space is occupied by the Flash Programmer utilty.|
|Free Space||This read-only field shows how much space is available for further programs.|
|Program Details Area|
The Program Details area contains a number of fields related to the program currently highlighted within the compilation list. These will appear at bottom of the screen when a program is highlighted in the menu.
|Name||This mandatory field allows the text that is used in the menu system for the program to be specified. There are no formatting requirements for this field.|
|Publisher||This optional field allows the name of the producer of the program to be set. There are no formatting requirements for this field.|
|Year||This field allows the year the program was released to be specified. The field only allows entry of values between 1980 and the current year, either selected via from the drop down list or by direct typing.|
|Ref||This optional field allows additonal reference information about the program to be set, e.g. a version number or a catalogue number, etc. There are no formatting requirements for this field.|
|RAM||This field is mandatory and is used to specify the minimum amount of RAM required by the program. For snapshot files, the amount of RAM needed is determined automatically. For ROM images, the RAM size will default to 16K but may be increased to 48K or 128K as required. ZX80 and ZX81 programs will only run on a 128K Spectrum and so the RAM field is used instead to specify the amount of emulated RAM, e.g. a 16K RAM pack.|
|Type||This read-only field indicates the nature of the program, e.g. a snapshot, ROM image, ZX80 program or ZX81 program.|
|File||This read-only field displays the full path and file name of the program.|
|Data||This read-only field shows how much space the program occupies within the PROM, taking into account any compression that has occurred.|
|Menu||This read-only field displays the amount of space taken to add the program into the menu, and so this figure will vary with the lengths of text entered into the Title, Publisher, Ref and Year fields.|
|Paging||This read-only field indicates how much space within the span of the program's storage area is unavailable due to the ZXC memory mapped paging mechanism. The paging mechanism utilises the last 64 bytes of each 16K bank of the PROM and so is unavailable for programs (with the exception of ROM images that fit within a single bank and do not require use of the paging facilities).|
|Padding||This read-only field shows the amount of other space contained within the program's span in the PROM that could not be used for storing the program. For example, a snapshot is stored as a compressed data block followed by a routine to uncompress this data into RAM. This structure repeats in each subsequent 16K bank used to hold the snapshot. After the last block, a restart routine is included which initialises all CPU registers before activating the program that now resides in RAM. The restart routine cannot be split across banks and so if there is not enough room in the last used bank then it will be shifted into the start of the next bank. This therefore introduces a void area within the span of ROM space used to hold the program. Another cause of a void area is to ensure that a connected ZX Interface 1 is not inadvertently invoked, i.e. by executing code from addresses $0008 and $1708. It is necessary to ensure that the uncompress and restart routines do not span these addresses, and so voids can occur around these locations. Void areas may also be introduced by inserting ROM images that are not exactly multiples of 16K. For example, the System Test Cartridge is only 8K is size and so padding will be inserted until the next 16K bank is reached.|
This field can be used to force a program to wait for a key press after loading. It is useful for programs that display a loading screen but clear it immediately upon running.
Creating a suitable snapshot is easy to do if the program loads using the standard Spectrum cassette routine:
|Emulator||This field is only used with ZX80 and ZX81 programs and selects which version of the ZX80 emulator or ZX81 emulator to run the selected program with. For example, there are variants of the ZX81 emulator that mimic the two editions of the ZX81 ROM and others that mimic add-on hardware such as the dk'tronics Graphics ROM module. As a ZX80 or ZX81 program is added into the compilation list, an emulator to run it is automatically inserted. By default this will be the standard ROM version for the ZX80 emulator and the edition 2 ROM version for the ZX81 emulator. The emulator will appear in the compilation list but will be displayed greyed out to indicate that it is only there in a supporting role, and hence it will not appear as a separate entry within the menu. As additional ZX80 or ZX81 programs are added, they will all share the same default instance of the ZX80 or ZX81 emulator. The type of emulator used by each program can subsequently be changed via the Emulator field. The newly chosen emulator is inserted into the list, and the old one removed unless other programs are still using it. Each emulator typically occupies one 16K bank but some require two banks, and as a result there may not always be enough space available to change the type of emulator used by a program. Selecting an emulator within the compilation list will highlight all programs that are using it by colouring them in red.|
|In Menu||This field applies to ZX80 and ZX81 programs and is used to allow an automatically inserted emulator to appear in the menu as an independent entry. The emulator can therefore be selected directly from the menu, without pre-loading a ZX80 or ZX81 program. Since additional space is required for storing the text that will be displayed within the menu, it may not be possible to make an emulator 'visible' within a very full PROM. If an emulator is inserted directly via the Add button but already exists greyed out in the list then the existing entry is upgraded to be visible within the menu.|
|Auto-Run Line||This field is only used with ZX80 and ZX81 programs and displays the line number that the program will start running from when loaded. The ZX80 did not support an auto-run facility and some ZX81 programs may not be configured to auto-run, and so the Auto-Run Line field will display 'None' for such programs. The field consists of a drop down list containing all the BASIC line numbers detected within the program and can be used to specify the line that the program should start running from when loaded. For ZX81 programs, they can be made to auto-run by simply setting the address of the line into one of the system variables. For the ZX80, it is necessary for the restart code to contain additional instructions to force the ZX80 to run the selected line. Note that the field will be disabled for ZX81 programs that already have an auto-run line number set.|
|Paging Locked||This field indicates whether the Spectrum 128 paging mechanism will be locked and/or the ZX Cartridge paging mechanism will be locked. There are four combinations denoted by the text 'None', '128 Only', 'ZXC Only' and '128 + ZXC'. For snapshots, the utility automatically determines whether the program is intended for a Spectrum 128, and hence whether the Spectrum 128 paging mechanism should remain unlocked. A snapshot conversion operates by transferring the program into RAM, then re-enabling the Spectrum ROM and disabling the ROM cartridge. The ZXC ROM cartridge paging mechanism will therefore always be disabled for a snapshot. A ZX80 or ZX81 program runs via the automatically included emulator, and this emulator will always require the Spectrum 128 paging mechanism to be unlocked. The ZXC ROM cartridge paging mechanism will be locked for all 16K versions of the emulators but unlocked for all 32K versions, e.g. ZX81 emulator with dk'tronics Graphics ROM support. The Paging Locked field is mainly used by ROM image programs, since it is not possible to automatically ascertain which mode is required. ROM images, such as back-ups of some of the original retail cartridges, require access to the full 16K ROM space and so the ZXC ROM cartridge paging mechanism must be locked. The default option for for ROM images is for the Paging Locked field is for both the Spectrum 128 and the ROM cartridge paging mechanisms to be unlocked. This setting avoids the need for additional software to be inserted to configure the paging mechanism(s) and hence allows ROM images up to the full PROM size to be selected. However, the Paging Locked field remains enabled since some ROM image programs may require different settings. For example, the original retail cartridges pre-date the Spectrum 128 and hence are unaware of its paging mechanism, and as a result the Jet Pac and Tranz Am cartridges inadvertently switch to the Spectrum 128's second display screen. To allow these ROM images to be used on a Spectrum 128, both the Spectrum 128 paging mechanism and the ZXC ROM cartridge paging mechanism must be set to be locked. This adds a start up routine that performs the locking before running the ROM image. Since the ROM image must reside at the start of a bank, the start up routine must be placed in a preceding bank and therefore means that 32K is required for these games.|
|Flash Programmer Utility|
The Flash Programmer utility is used to program a ZXC3 fitted with a 128K FLASH ROM directly from the Spectrum without the need for an EPROM programmer. It runs from the Spectrum's RAM and provides functions for accepting data via RS232 from the Cartridge Creator utility and then writing this data into the FLASH ROM. The Flash Programmer utility will usually be stored in the FLASH ROM alongside any programs written to it. This allows the utility to be invoked at any time to allow the ROM to be re-programmed. Initially, only the Flash Programmer utility is present in the ROM and so it will automatically run when the Spectrum is powered on. Specific versions of the Flash Programmer exist for the ZXC3 and the ZXC4.
Six menu options are presented by the Flash Programmer utility to allow different means for receiving data for programming into the FLASH ROM. Data can be loaded via the ZX Interface 1 RS232 port, via the Spectrum 128 RS232 port, via the Spectrum 128 KEYPAD port, via the Interface 2 joystick 1 socket, via the Interface 2 joystick 2 socket or from cassette. The Keypad option is provided since the RS232 port on a Spectrum +2 is obscured when a ZX Interface 2 is connected. The joystick socket options of the Interface 2 are provided to allow data to be transferred to a standard 16K or 48K Spectrum without a ZX Interface 1 connected. However, since delays are used instead of handshaking, this transfer method is far slower than the other serial communication links and more prone to transmission errors.
The FLASH ROM can be viewed as 8 banks of 16K. Only one bank can be programmed at a time and so data for each bank is transferred separately. The data for a bank may be sent as multiple blocks, thereby avoiding sending regions of 'blank' data ($FFs). However, typically there will only be one block per bank. When loading data, the utility displays information on how many blocks there are to be transferred and which block is currently being received. For the current block, the utility shows the bank number, the address within it and the length of the data.
After a block has been loaded it is programmed into the FLASH ROM, and then the utility proceeds to load the next block. Once all blocks have been loaded and programmed, the utility provides the option to run the installed ROM image. Pressing the BREAK key (CAPS SHIFT and SPACE) will return to the Flash Programmer menu, or pressing any other key will run the installed ROM image. If the menu is returned to then the ROM image can be run by selecting the Run Installed Application option. Alternatively, it can be run by restarting the computer using the reset button of the Spectrum+/128/+2, or by powering the Spectrum off and back on.
If the option to embed the Flash Programmer utility was selected when generating the cartridge image, then a small bootloader routine will be present in the FLASH ROM and is run first when the Spectrum starts up. This routine performs the following:
- Checks for the CAPS SHIFT key - Disables the cartridge and runs the Spectrum's ROM.
- Checks for SYMBOL SHIFT key - Runs the RAM Tester utility if present in the compilation.
- Checks for EDIT key (CAPS SHIFT and 1) - Runs the Flash Programmer menu, thereby allowing the FLASH ROM to be re-programmed.
- Checks if a user application exists within the cartridge and runs it if so.
- Otherwise runs the Flash Programmer menu.
The ZXC3 paging mechanism prevents the last 64 bytes of each bank from being programmed, hence only 16320 bytes out of each 16384 byte bank can be written to. This results in the Flash Programmer utility only being able to write to 130,560 bytes out of the available 131,072 bytes of the ZXC3's 128K FLASH ROM. The Flash Programmer utility can be omitted when producing the ROM image thereby freeing up additional space for more programs.
To re-program a FLASH ROM that does not contain a copy of the Flash Programmer utility, the following procedure can be used:
- With the Spectrum powered off, disable the ZXC3 ROM cartridge by moving its enable jumper J2 to the left hand position.
- Power on the Spectrum.
- Load the Flash Programmer utility from cassette using LOAD "", or from the ZX Interface 1 RS232 socket using LOAD *"b" and by selecting Help > Restore Programmer > ZXC3 from the ZX ROM Cartridge Creator utility's menu.
- Once loaded, re-enable the ROM cartridge by carefully moving the enable jumper to the right hand position.
- It is now possible to re-program the FLASH ROM by receiving a new ROM image via RS232 or cassette. It is also possible to erase the current ROM and re-instate just the Flash Programmer utility by selecting the Restore Programmer from Memory option, or by sending a blank compilation from the ZX Cartridge Creator.
To create a backup on cassette, select the 'Backup Programmer to Cassette' option. This will save a BASIC loader program followed by the machine code for the Flash Programmer utility itself.
|Transfer Cable Wiring|
Data may be transferred via a cable to the RS232 socket of the ZX Interface 1, the RS232 socket of the Spectrum 128, the KEYPAD socket of the Spectrum 128, or a joystick socket of the ZX Interface 2.
|ZX Interface 1 / Spectrum 128 RS232 Socket|
To receive RS232 data via the ZX Interface 1 or Spectrum 128 sockets, a transfer cable can be wired as shown for the Spectrum RS232 ROM cartridge. The cable should be shielded otherwise occasional RS232 reception errors may occur. Many PCs these days do not come equipped with in-built RS232 ports and so it is likely that a USB to RS232 adapter will be used. If communication errors are experienced and yet the transfer cable is properly shielded, then the cause may be due to poor shielding within the USB to RS232 adapter, i.e. the shielding wire enters the D-type connector housing but is not physically attached to the body of the D-type connector.
|ZX Interface 2 Joystick Socket|
To receive data via a joystick socket of a ZX Interface 2, a special transfer cable is required. The joystick socket operates at 5V logic levels but RS232 signals use -25V to -3V for logic 1 and 3V to 25V for logic 0 (a PC will typically use +/-12V for the two levels). It is therefore necessary to incorporate a voltage level conversion circuit within the cable wiring. Further, the cable should use an optocoupler to prevent damage occurring to the ZX Interface 2. The down input line of the joystick should be used for the data signal since this is present on pin 2 of both joystick sockets, allowing the cable to be used with both sockets.
The ZX Cartridge Creator program only runs on Windows PCs but to allow a similar program to be created for another PC platform, the data format required by the Flash Programmer utility is now described. This format is identical when loading data via RS232 or from cassette. Different data formats exist for the ZXC3 and ZXC4 Flash Programmers.
The data format used by ZXC3 Flash Programmer is as follows:
|$00||1||Start Of Frame (SOF)||Denotes start of a packet. Value of $AD (%10101101).|
|$01||2||Length||Number of bytes that follow after the 'Length' field (LSB first), up to and including the 'EOF' field ($07 minimum, else invalid).|
|$03||1||Block Number||The index of the current block, starts at 0 and increments up to the value of the 'Number of Blocks'-1.|
|$04||1||Number of Blocks||Total number of blocks in the communications session ($00=Invalid, reserved).|
|$05||1||Flags/Bank Number||Bits 4-7: Not used (always set to 0).
Bit 3: 1=Do not erase the sector containing the bank prior to writing the block.
Bits 0-2: Bank number ($00-$07).
|$06||2||Bank Address||The start address (LSB first) within the specified bank to write the block to ($0000-$3FBF).|
|$08||n||Data||The data to write.|
|$08+n||1||Checksum||XOR checksum of fields 'SOF' to 'Data' inclusive, using initial value $00.|
|$09+n||1||End of Frame (EOF)||Denotes end of a packet. Value of $62 (%01100010).|
A bank may be erased by sending an 'empty' packet, i.e. one containing no data bytes. Note that the FLASH ROM is partitioned into sectors of 16K, which represents the smallest data size that may be erased. Therefore a bank is the same size as a sector.
Cassette files can be created directly on the Spectrum and should be saved as binary data using SAVE "nnn" CODE xxx,yyy, with one file per block. The start address of the data file is not important since the Flash Programmer utility will always load the data to a fixed memory location. The file name is not checked and so can be anything for each data block file.
A snapshot file contains a complete dump of the Spectrum's RAM and also the state of the CPU's registers. As a result, snapshots becomes specific to the model of Spectrum on which they are taken. So for example, a snapshot of a 16K program taken using an emulated 48K Spectrum will not run on a real 16K Spectrum when converted to a ROM cartridge. Therefore a snapshot should be taken on the lowest model of Spectrum supported by the program.
Snapshots of 128K programs may also be specific to the model of emulated 128K Spectrum used to create them. This is due to relocation of routines within the Editor ROM of the Spectrum +2 compared to the Spectrum 128. Programs that use 128K BASIC will have different addresses stored on the stack and so snapshots of these programs will be specific to model of Spectrum that they were taken on. A similar issue applies to the Spanish Spectrum 128, which has a dramatically different Editor ROM than the UK Spectrum 128 and the UK, Spanish and French versions of the Spectrum +2. However, any 128K program that uses pure machine code and does not access any of the Editor ROM routines will work correctly on all 128K models when converted to a ROM cartridge.
Snapshots of programs that utilise the facilities of the ZX Interface 1 may also become specific to the edition of the Interface 1 ROM being emulated. Such a program might only perform a check for the Interface 1 ROM edition when it first runs. If a snapshot is taken after this point then the snapshot becomes specific to a particular ROM edition of the Interface 1. It is therefore important to take snapshots of such programs before any attempt is made by the program to run machine code. Snapshots taken when the CPU is running the ROM code within the Interface 1 should be avoided since the Cartridge Creator utility does not attempt to page in the Interface 1 ROM before it runs the loaded program. Therefore always take snapshots at a point in the program when Interface 1 facilities are not being actively used.
The Flash Programmer utility requires a 48K or 128K Spectrum. When attempting to run it on a 16K Spectrum, the utility detects that there is insufficient RAM and halts with a black screen and red border. This limitation results from the ZX Cartridge Creator sending blocks of data up to 16K in size. It could be overcome by sending the data in smaller block sizes. If there is interest in getting the utility to run on a 16K Spectrum then I will look into adding this functionality.
|Click here to download the ZX ROM Cartridge Creator utility.|
|Click here to download the ZXC3 Flash Programmer utility in TZX cassette file format.|