File format for T2Peg400 files

Apply EOR 90 to file. The first five bytes are described below and are followed by the first block. The numbers given are the byte offsets from the start of the file.

The header of the file is (in bytes):
0   : 0x80
1   : 0x00
2,3 : size of file (high|low)	[noticed by Thomas Harte]
4   : unknown (suspect that it is the run type of the first file in the
      image and the address in memory used by the T2 set of ROMs to store
      the image loading code)
This is followed by:
5   : first block in file

Each block in the file are in the following format where the numbers are now the byte offsets from the start of the current block:

0		: *
1		:  terminated with 0
x		: load address [lowest|lower|low|high] (little endian)
x+4		: exec. address (little endian)
x+8 - x+9	: block number (low|high)
x+10 - x+11	: block data length (low|high)
x+12		: block flag
		  bit 0 : protection bit (*RUN only)
		  bit 6 : block contains no data
		  bit 7 : last block of file
x+13 - x+14	: address of next file
x+15 - x+16	: header CRC (for all previous bytes except &2A)
x+19		: data				<- was erroneously x+20
...
x+19+data	: data CRC

After all the blocks of data, the file is terminated by a byte:

final byte	: &2B (end of ROM marker)

Relevant notes

(from the Electron Advanced User Guide)

In a ROM filing system, the headers for all but first and last blocks may be replaced by &23 in order to reduce memory overheads.

Convention: the first file on a ROM should be a title file of zero length to identify the ROM. The name should consist of a name and version number and surrounded by single asterisks.
e.g. *Game01*

This page was last updated on 21st September 2000 by:

David Boddie
davidb@mcs.st-and.ac.uk