[Coco] binary file format (CLOADM/LOADM)
Robert Gault
robert.gault at worldnet.att.net
Wed Apr 8 21:42:17 EDT 2009
Allen Huffman wrote:
> Can someone summarize the byte sequence used by binary files -- or point
> me to the specs? Like, what is the header, and how do you specify the
> ORG address where data loads, for a BIN file?
>
The disk file structure separates each block of code with instructions
for the DOS on where to load the block and the size of the block. These
separators referred to in the "Unravelled" series as preambles and
postambles have the following structures.
byte preamble postamble
0 $00 flag $FF flag
1,2 length of block $0000
3,4 load address EXEC address
Typically the data blocks are 256 byte blocks or the ml program is a
single block the size of the program. It depends on how it was assembled
and the number of ORG statements in the source code.
Tape files have a slightly different format.
1) A leader of 128 bytes of $%%
2) Namefile block
3) 0.5 sec blank
4) 128 bytes $55
5) data blocks
6) end of file block
Block headers
1) $55
2) $3C sync byte
3) block type; name=0, data=1, EOF=$FF
4) block length byte; value 0-255
5) data; 0-255 bytes
6) checksum
7) $55
Namefile block 15 bytes of data
1) 8 bytes for name
2) file type byte; Basic=0, data=1, ML=2
3) ascii flag; binary=0, ascii=$FF
4) gap flag byte; continuous=1, gaps=$FF - this byte may not be used
5) 2 bytes; start address
6) 2 bytes; load address
EOF block
No data bytes
More information about the Coco
mailing list