Table of Contents

MO Tape encoding

A variant of MFM is used.

What the reading code does is wait for a polarity change, wait for 548 microseconds, and read the data line again. If the two reads lead the same value, the bit is a 0, else it's a 1.

Tape files format

Files are stored on tape as 256 byte blocks. The blocks are separated by a variable amount of blank space, while this runs under the tape head, the previous block is processed. The blank space duration is adjusted so the loading code has enough time to finish processing of one block before the next comes.

Common block format

Each block starts with a leader tone allowing synchronization:

The block data follows, and has a different format depending on the block type (indicated by the first byte). The common structure is:

The checksum is the sum of all data bytes (ignoring the type and length bytes), modulo 256.

Leader block

OffsetContents
0 Block type: 0
1 Block length: 10
2-C File name and extension (without the separator dot, space padded)
D File type
E-F File mode
10 Checksum

The file type has the following standard values (other applications can use different ones):

The file mode is application specific. BASIC files (type 0) are known to use the following values:

Data blocks

OffsetContents
0 Block type: 1
1 Block length: 0 or 2 to 255
2-L File data (up to 254 bytes per block)
L+1 Checksum

Usually, all data blocks except the last one are 254 bytes long, and have their length field set to 0.

Trailer block

OffsetContents
0 Block type: FF
1 Block length: 2
2 Checksum: 0

Note that after loading a file to memory, extra decoding will take place. Binary files have an internal structure that is also made of chunks with a size and loading address. The last chunk of a binary file is similar to the trailer block, but both must be present for the loading to succeed.