Original cas format

There are several possible chunk types, each identified by a 4-letter string. Those are:

FUJI - tape description

Offset Size (bytes) Name Contains
0 4 chunk_type FUJI
4 2 chunk_length chunk's length
6 2   ignored
8 chunk_length description tape's description (UTF-8)

 

A CAS file must begin with a FUJI chunk. This chunk holds the tape's description (as an UTF-8 string) in data. The chunk_length field holds the description's length. The description may be empty - then the chunk_length is 0.

A CAS file may contain more FUJI chunks - they can be used to label different parts of a tape, such as separate files recorded one after another. However the current version of liba8cas ignores all but the first FUJI chunk.

baud - baudrate for subsequent SIO records

Offset Size (bytes) Name Contains
0 4 chunk_type baud
4 2 chunk_length 0x00 00 (0 bytes)
6 2 baudrate baudrate of subsequent data chunks

 

A baud chunk holds the baudrate of the following data chunks (until a next baud chunk). The chunk's length is always 0 (+8 bytes of the header), and the baudrate is stored in the baudrate field. If no baud chunk is encountered before a data chunk, its baudrate is set to the default value of 600.

data - standard SIO record

Offset Size (bytes) Name Contains
0 4 chunk_type data
4 2 chunk_length chunk's length
6 2 irg_length length of IRG before this record, in ms
8 chunk_length data block's data

 

A data chunk contains a standard tape record as read or written by Atari's SIO. Those records normally have a length of 132 bytes, start with two 0x55 bytes, and end with a checksum byte - however those are not necessary. The record's baudrate is the baudrate stored in the previous baud chunk (if no baud chunk has been encountered yet, a standard baudrate of 600 is assumed).