A8CAS - software for reading/writing Atari 8-bit cassettes
HEX file format - description
HEX is a text-based representation of CAS format - it stores the same information, in the same structure, but in text rather that binary. It is destined to use when debugging tape files which contain some wrong bytes.
A8CAS' HEX format is inspired by the HEX format as used by Ernest R. Schreurs' WAV2CAS, however it is not compatible.
The HEX format should be treated as a debug-only format, and tape dumps in this format should not be released in public - for that puropse the CAS format should be used, as it can store the exact same content. Specification of the HEX format can change without warning - it already happened once.
Here is an example of a file in HEX format: Bang! Bank!
Structure
Note: everywhere in this document, "newline" means Unix newline character, 0x10. Only Unix newlines are supported.
The file in HEX format starts with a line containing the file's header. Length of the line is precisely 10 bytes (with the terminating newline).
A8CAS-HEX<newline>
After the header, each line corresponds to a single CAS chunk. Each line contains 3 parts: a chunk's name, some numeric or textual data, and an optional comment preceded by a ";" character. A comment may contain some additional information, such as chunk length or calculated checksum of a block, useful for verification of correctness.
There are several types of chunks, as in the CAS format. For details on meaning of values stored in each chunk. see description of the CAS format.
FUJI <description><newline>
Represents a CAS
FUJI
chunk.<description>
is a UTF-8 string of length up to 65535 bytes (not characters).FUJI
chunks are the only chunks in a HEX file that cannot have a comment - any character, including ";" and trailing spaces, will be interpreted as part of the<description>
field. Note however that the single space character afterFUJI
is not part of the description.baud <baudrate> ;<comment><newline>
Represents a CAS
baud
chunk.<baudrate>
is an integer number number between 0 and 65535.data <irg_length> <data> ;<comment><newline>
Represents a CAS
data
chunk.<irg_length>
is an integer number between 0 and 65535.<data>
is a sequence of integer numbers written hexadecimally (each one between 00 and ff), separated by spaces. For example:4b 72 65 74 79 6e
.
fsk <irg_length> <data> ;<comment><newline>
Represents a CAS
fsk
chunk.Caution! There must be two spaces between the block's name,
fsk
, and the<irg_length>
field! This is a restriction that is likely to be removed in future releases.<irg_length>
is an integer number between 0 and 65535.<data>
is a sequence of integer numbers (each one between 0 and 65535), separated by spaces. For example:2 351 517 51 68
.
pwms <pulse_type> <bit_order> <samplerate> ;<comment><newline>
Represents a CAS
pwms
chunk.<pulse_type>
is a string. It can be one ofrising_edge_first
orfalling_edge_first
.<bit_order>
is a string. It can be one ofmsb_first
orlsb_first
.<samplerate>
is an integer number between 0 and 65535.
pwmc <silence_length> <data> ;<comment><newline>
Represents a CAS
pwmc
chunk.<silence_length>
is an integer number between 0 and 65535.<data>
is a sequence of pairs of numbers, separated by spaces. Each pair consists of:- Length of a single pulse, an integer number between 0 and 255, and
- Length of a signal, an integer number between 0 and 65535.
22 16300 105 1220 50 768
.
pwmd <pulse_0_length> <pulse_1_length> <data> ;<comment><newline>
Represents a CAS
pwmd
chunk.<pulse_0_length>
is an integer number between 0 and 255.<pulse_1_length>
is an integer number between 0 and 255.<data>
is a sequence of integer numbers written hexadecimally (each one between 00 and ff), separated by spaces. For example:4b 72 65 74 79 6e
.
pwml <silence_length> <data> ;<comment><newline>
Represents a CAS
pwml
chunk.<silence_length>
is an integer number between 0 and 65535.<data>
is a sequence of integer numbers (each one between 0 and 65535), separated by spaces. For example:2 351 517 51 68
.