SOFTWARE - UTILITIES

ZX ROM CARTRIDGE CREATOR

The ZX ROM Cartridge Creator is a Windows based utility originally created to allow the generation of Spectrum ZX Interface 2 ROM cartridge files, but has been extended to allow the creation of multi-program ROM cartridge files for use on the ZX80 fitted with either the 4K ROM or the 8K ROM. It provides support for the ZXC2, ZXC3 and ZXC4 ROM cartridges.

The utility allows a compilation of up to 254 program (.O) files to be constructed, and will automatically generate a menu system that will allow the selection of the program to run. For the ZXC3 and ZXC4, the compilation can be sent via RS232 at 57600 baud to the ZX81 and the ZX81 will then program the compilation into the ROM using the Flash Programmer utility (as described later). For the ZXC2, a binary file can be created but must be programmed into an EPROM using an EPROM programmer.

Each program file in a compilation can be assigned a colour file, which specifies the ink and paper colours for each displayable character. When the program is selected from the ROM cartridge menu, the user is presented with the choice of running the program colourised or in black and white. If colourisation is selected then Chroma will be configured using these colour definitions before the program is copied into RAM and run.

Each program file in a compilation can also be assigned a character file, which specifies an alternate character set to display the program with. When the program is selected from the ROM cartridge menu, the user is presented with the choice of running the program using the alternate character set or the standard Sinclair character set. If the alternate set is selected then Chroma will be configured using to show these before the program is copied into RAM and run.

To convert a program, 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. Programs that load in multiple parts are not supported.

A screenshot of the Cartridge Creator showing a ZX80 4K ROM compilation can be seen below:

ZX ROM Cartridge Creator


CREATING A CARTRIDGE COMPILATION

To create a compilation, select the target as 'ZX80 4K' or 'ZX80 8K' and choose the desired ROM cartridge type.


SELECTING PROGRAM FILES

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. 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.

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, 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 reference information (such as a version number, catalogue number, or hardware requirements such as WRX support) 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.

The Cartridge Creator utility also provides functions to re-arrange the order that the programs appear within the menu. This is done by selecting the program to move and then either clicking the Move Up and Move Down buttons from the tool bar or by pressing keys Ctrl+7 and Ctrl+6. Functions also exist on the toolbar for sorting the list of programs based on one of the fields: Title, Program Type, RAM, Publisher, Reference or Year.


ASSIGNING COLOURISATION FILES

The Cartridge Creator supports the colourisation mechanism provided by the Chroma 80 interface. Every program can have a colourisation file assigned to it. A colourisation file uses XML formatting to specify the ink and paper colours that each character should be displayed in. Colourisation files can be created using a standard text editor and can be associated with more than one program if desired. Programs that have a colourisation file assigned will appear in the compilation list in red.

When a program with a colourisation file assigned to it is selected from the ROM cartridge menu, a choice is presented to run the program colourised or in black and white. If the colour facilities provided by the Chroma 80 interface are disabled via configuration switch 3 then a message is displayed to indicate this.

A detailed description of the colourisation definition file format can be found here, with a selection of colourisation files available here.

A program file and colourisation file data must all fit within a 16K block of the ROM cartridge, and so it might not be possible to assign a colourisation file if a program is very large.

Note that a colourisation file designed for use with an 8K ROM program can be assigned to a 4K ROM program, and vice versa. This allows the potential for sharing a single colourisation file between different ROM versions of the same game.


ASSIGNING CHARACTER FILES

The Cartridge Creator supports the CHR$128 UDG format provided by the Chroma 80 interface. Every program can have a character file assigned to it. A character file uses XML formatting to specify the bit patterns for each character. Character files can be created using a standard text editor and can be associated with more than one program if desired. Programs that have a character file assigned will appear in the compilation list in blue, and those that also have a colourisation file assigned will appear in magenta.

When a program with a character file assigned to it is selected from the ROM cartridge menu, a choice is presented to run the program with the defined character set or with the standard Sinclair character set.

A detailed description of the character definition file format can be found here, with a selection of files available here.

A program file, colour file data and character file data must all fit within a 16K block of the ROM cartridge, and so it might not be possible to assign a colour and / or character file to a program if it is very large.


GENERATED MENU

When more than one program is included in a compilation then a menu will automatically be created and embedded within the cartridge image. The menu provides a method for selecting which program to run. If only a single program is included in a compilation then it is optional whether to create and embed a menu. Once a compilation with an embedded menu has been programmed into a PROM, the menu can be invoked from the ZX80 by the typing the following:

For the 4K ROM: RANDOMISE USR(32640)

For the 8K ROM: RAND USR 32640

If the Chroma 80 colour facilites are enabled via configuration switch 3 then the border will be set to black.

Example ROM Cartridge Menu
Example Generated Menu

The menu displays the title of the cartridge, followed by a list all of programs within the cartridge. The title text can be set via the entry in the Cartridge Details area of the Cartridge Creator (as described later). Keys 7 and 6 are used to navigate the menu items and NEWLINE (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 up and down keys will auto-repeat if held down. The menu system also supports page up and page down controls, accessed using 5 and 8 respectively. 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 within the Cartridge Creator. The menu may also be navigated using a joystick plugged into Chroma 80 (configuration switch 3 must be set to on to enable the joystick socket).

The menu system always contains a Disable ROM Cartridge entry, which will can be used to completely disable the cartridge so that other software to be executed at the ROM cartridge invocation addresses without physically needing to remove the cartridge.


CREATING AN OUTPUT BINARY FILE

Once a list of programs has been defined, the compilation can be written to a binary file by selecting the Create button. Two 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 or ZXC4 for programming into a FLASH ROM. This avoids the need to regenerate the compilation from the input files.

Selecting .PRG format produces a binary 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.


SENDING THE COMPILATION VIA RS232

The Send button can be used to transmit the compilation to the ZX80 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. Communications to the ZXC3 and ZXC4 occurs at 57600 baud with 8 data bits, no parity, 1 stop bit, and hardware handshaking.


COMPILATION FUNCTIONS

The Cartridge Creator utility 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.


CARTRIDGE DETAILS AREA

The Cartridge Details area contains a number of fields relating to the current compilation:

Field Description
Title This field allows the text to use as the cartridge title within the menu to be specified.
Memory Type This field allows the ROM type to be selected for the target ROM cartridge. For a ZXC2 it is fixed at PROM, and for a ZXC4 it is fixed at FLASH.
Include Programmer This field allows 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, in order to re-program the cartridge. This option applies to the ZXC3 and ZXC4 only.
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 in order to run the program. However, it may be desired that the menu system is included even when there is only a single program in the compilation so that the Disable ROM Cartridge option is available. 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. For the ZXC4 this field is fixed at 29F032B.
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. This information will appear at bottom of the screen when a program is highlighted in the menu.

Field Description
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 publisher 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 from the drop down list or by direct typing.
Ref This optional field allows additional reference information about the program to be set, e.g. version number, catalogue number, requires WRX graphics, etc. There are no formatting requirements for this field.
RAM This field is mandatory and is used to specify the amount of RAM to run the program with. It will default to 1K for the 8K ROM if the program is small enough, else it will be set to 4K if appropriate, else 16K. For the 4K ROM it will default to 16K since this provides greater compatibility due to the additional RAM used by the Cartridge Creator for deploying a program into memory. However, it can be lowered if there is a need to do this. Its effect is to simply set the location of the stack and if targetting the 8K ROM then it also sets the system variable RAMTOP. A larger RAM size can always be selected if desired.
Type This read-only field indicates the nature of the program, which for the ZX80 will always be 'ZX80 program'.
File This read-only field displays the full path and file name of the program.
Chars This read-only field displays the full path and file name of the associated characters file. A characters file can be disassociated by clicking the 'X' button that appears next to the field.
Colour This read-only field displays the full path and file name of the associated colour file. A colour file can be disassociated by clicking the 'X' button that appears next to the field.
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.
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. Each program is stored within its own 16K bank, along with any associate colour and character files. This will typically leave unused space at the end of the bank.
Auto-Run Line This field displays the line number that the program will start running from when loaded, 'None' if the program is not configured to automatically run, or 'Auto' if it is a 4K ROM program that already auto-runs via the mechanism devised by Martin Korth in 2009. 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. The 4K ROM did not provide a mechanism to allow programs to automatically run, and so setting this field will cause a GO TO to be executed after the program has been loaded into RAM. The 8K ROM did provide a mechanism for programs to automatically run and so setting this field adjusts the NXTLIN system variable. The field will be disabled for 8K ROM programs that already have an auto-run line number set.
Paging Locked This field indicates whether the ZX Cartridge paging mechanism will be locked. It will always be set to locked for a ZX80 program file.


DISABLING THE ROM CARTRIDGE

With a compilation programmed into a ROM cartridge, the ROM cartridge can also be completely disabled by executing the following:

For the 4K ROM: RANDOMISE USR(32644)

For the 8K ROM: RAND USR 32644

This facility allows other software to be executed at the ROM cartridge invocation addresses without physically needing to remove the cartridge.


FLASH PROGRAMMER UTILITY

The Flash Programmer utility is used to program a ZXC3 or ZXC4 directly from the ZX80 without the need for an EPROM programmer. It runs from the ZX80'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 (although can be omitted) 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. Specific versions of the Flash Programmer exist for the ZXC3 and the ZXC4.

Four menu options are presented by the Flash Programmer utility:

ZXC4 Flash Programmer Utility Screenshot
Flash Programmer Utility

The FLASH ROM can be considered to consist of multiple 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 two blocks per bank since the maximum block size is 8K. Prior to loading data each block, the utility displays information on how many blocks there are to be transferred and which block is due to be received. For the block being received, the utility shows the bank number, the address within it and the length of the data. The ZXC3 is not capable of programming the last 64 bytes of each 16K bank, whereas the ZXC4 can program all bytes.

After a block has been loaded it is programmed into the FLASH ROM, and then the utility proceeds to load the next block. The screen display cannot be maintained while data is received via RS232 and so will show a pattern similar to that which appears when loading from cassette. While the FLASH ROM is being programmed, the screen will most be black with occasional white streaks.

Once all blocks have been loaded and programmed, the utility provides the option to run the installed ROM compilation image. Pressing the BREAK key (SHIFT and SPACE) will return to the Flash Programmer menu, or pressing any other key will run the installed ROM compilation image. If the menu is returned to then the ROM compilation image can be run by selecting the RUN INSTALLED APPLICATION option. Alternatively, it can be run by restarting the computer using the reset button provide by the Chroma 80 interface.

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 can be run as follows:

For the 4K ROM: RANDOMISE USR(32642)

For the 8K ROM: RAND USR 32642

This routine performs the following actions:


RE-INSTATING THE UTILITY

The Flash Programmer utility can be omitted when producing the ROM compilation image thereby freeing up additional space for more programs. However, to reprogram the cartridge requires loading the Flash Programmer from a cassette (or alternate) backup.

To re-program a FLASH ROM that does not contain a copy of the Flash Programmer utility, the following procedure can be used:

It is strongly recommended to keep a backup of the Flash Programmer on cassette just in case the FLASH ROM become corrupted and the Flash Programmer will no load from it. To create a backup of the Flash Programmer, select the 'BACKUP PROGRAMMER TO CASSETTE' option. Start the cassette recording when prompted and then press any key.


COMMUNICATIONS FORMAT

The ZX80 uses the same ZXC3 RS232 communications protocol and ZXC4 RS232 communications protocol as used by the ZX81 and Spectrum. This means that a ROM cartridge containing the Flash Programmer utility for the ZX81 or Spectrum can receive a ZX80 compilation and hence can program the FLASH ROM for subsequent use on the ZX80. Likewise, the Flash Programmer utility for the ZX80 can receive a ZX81 or Spectrum compilation and program the FLASH ROM for subsequent use on the ZX81 or Spectrum. The communication protocols used for the ZXC3 and ZXC4 are different to ensure that a compilation can only be programmed into the appropriate FLASH ROM.


DOWNLOADS

Click here to download the ZX ROM Cartridge Creator [V3.8.0] utility.