MO Tape encoding

A variant of MFM is used.

  • 0 bits start with a polarity change, then a constant level for 830 microseconds.
  • 1 bits also start with a polarity change, a constant level for 411 microseconds, another polarity change, and the opposite constant level for 422 microseconds.

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:

  • 16 bytes with value 01
  • Two bytes with values 3C,5A

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

  • A block type
  • A block length, including everything except the checksum
  • Some data
  • A checksum

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

  • A block of length 0 will have 256 bytes of data
  • A block of length 1 is invalid (there would be space only for the block type
  • A block of length 2 has no data (only a type, length, and checksum)
  • A block of length 3 has one payload byte
  • etc.

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):

  • 0: BASIC file (saved by SAVE)
  • 1: DATA (saved by BASIC file access commands)
  • 2: binary file (saved by CSAVEM)

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

  • 0: tokenized BASIC
  • 1: ASCII listing of BASIC program

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.

documentations/monitor/tape.format.txt ยท Last modified: 2015/02/28 18:08 by 127.0.0.1
CC0 1.0 Universal
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0