General Tape File Format
Previus Credits Index Next

A digital cassette tape can store a pieces of signal low and signal high, so we must decide that a bit 0 is, for example, 4 millisecond of signal low store in the tape, and a bit 1 is another 4 millisecond of signal hi.
So a 1001 binary nibble will become:

Where ^ is 1 millisecond of signal hi and ° is 1 millisecond of signal low.

This is not a good methods for storing information, because if we have a long sequence of 00000 or 11111, we have a very long sequence of signal low or high in the tape, so we can lose synchronization of bits.

So to retrieve the correct information we must use another system: a bit 0 become a sequence of signal high, signal low that is inferior that a sequence high, low used for bit 1:

Note: 

  1. we choose        0=^^^°°°    1=^^^^°°°°
  2. instead of  0=°°°^^^    1=°°°°^^^^
At this level of the bit representation it's indifferent to choose the 1 or 2 format, but the second is to prefer because the Commodore tape architecture is able to understand the transaction of level from high to low, so recognize bit is more easy with this format.

[when I tried to read the tape by hand, I found that the sequence 1 give me a good representation of what I was reading from the tape, so I implement the Reader program with that features. The programs read correctly the data, but is due to the bit duration rate that was fortunately good however. So when I wrote this document I use the representation 1 and calculate all the timing with that method. This is wrong from what I see from the listing of Turbo and 1/2 format consideration. For all the next pages consider that the symbol ^ and ° are to be inverted, and timing may be wrong. Actually I have no time to fix it, sorry.]

When one people have decide this low level details as absolute for reading a digital tape cassette, he now must decide how to represent a piece of information: the byte.

The Commodore Group have decide to use a particular method to improve readability: coding one byte use a Manchester code and using a parity bit.

A Manchester code is often used to make the bits 1 and 0 with the same frequencies in the files, in fact a bit 0 become a 01 encoded bits and bit 1 become 10 encoded bits. This fact has important theoretic consequences, but on the other hand we must coding 1 bit with 2 bits.
Other this, a parity bit (coding with Manchester too) are add to the byte to be sure to have received correctly this byte. So a byte (8 bits) is coding with 16+2 bits, but other 2 bits are used as i describe later.
In fact to be sure that we are reading the byte, a special block bits is add to the start of the byte, with a bit 1 after that to advise that the byte starting here. If the bit was 0 then the file is finished.
The special block bit is not 0 or 1 but another bit that i call *.
The fact that we use 3 different bits using a digital cassette that can store only 2 level seems to be impossible, but if we remember that a bit is coding with a different duration of the level low-hi, there's no problem:

So a typical commodore's byte become: that is 10010001 with odd parity 0, but the effective byte is 10001001 because the first bit is the low bit of the byte.

At this point we must describe how a file (a group of bytes) is made.
At the begin of the file there's a synchronization region that i describe later, after there's the header of the file.
The header contains this information:

Type of Header is a byte that can be 01, 03 (04/05 are not describe)
The Start and End address describe how the file that we read must be placed in the memory of C64.
The File Name is the name of the file that is show when we load a program in the C64.

The Commodore group have decide to store 2 copies of header that have 01/03 type of Header to be sure that there's no error reading the file.
After the header there's a new synchronization region and then there's the two copies of the file data (as for the header).

At the end of this description, there's only to say of the checksum.
In fact the header and the file data contain a supplementary byte that is calculated from the bytes that compose the header and the file data, so when a file is read this information is calculated again and compared with the checksum inside byte to be sure to have read it correctly.

Finally you are able to understand why for reading a program saved with the Commodore inside procedure you must attend a lot of time, therefore if you read the same program saved with some special turbo utility program the time is more inferior.

This table reassume these differences:

Commodore Inside Turbo
2 copies of program 1 copy of program
20 bits for one byte 8/9 bit for one byte
~ 1000 microsecond for bit ~ 550 microsecond for bit

The most significant difference is that Turbo store only one copy of the file, then it used only 8 bits (9 if it used parity bit) to represent one byte, and finally that one bit use average half time.
So if we have 40Kbyte for one program (this is the dimension on one game) we obtain this time: On the other hand there's that one file saved with Commodore Inside is more easy to read correctly even if the cassette is damage, while a Turbo file is more easy to read not correctly only because you have the heads of tape less dirty.

The last difference is the quantity of tape used by the two methods (remember that one turn of the tape is make in about 3.6 seconds)

Now we must describe an ulterior thing that it's important in the representation of the information in the tape: the synchronization region.
In fact, until now, we don't have describe how is possible to pick-up the start of the file, because it can be placed onto previous register byte, so we will be able to position the head of tape in a fine mode. The synchronization region, instead, is a region before the start of file that contain this information: So, the equals byte (or bits) are used for find synchronization, even if we don't are positioned correctly at the start. When a synchronization is found, we attend to read a countdown sequence that here assure that the body of file is to come.

 

Top
C= Logo
commodore 64 PC-C64 logo Tognon Stefano Programs