D64 and T64 files

The Commodore 64, just like any other proprietary machine that runs its own set of proprietary code (software, operating system) would usually have its own unique way of storing or formatting data.

For the Commodore 64, the D64 is the system’s proprietary file format. It is actually a sector for sector copy of a 1540/1541 disk used in a Commodore 64 machine. There are several version of the D64 file format. The standard format is a 174848 byte file that is composed of 256 byte sectors arranged within 35 tracks. Each track have a different number of sectors that toal 683 sectors. The track counting for this begins at 1 and not 0, and continues on to 35. Sector counting, on the other hand, begins at 0 and not at 1, thus a track with 21 sectors will count from 0 to 20.

The original media used on the actual machine, which is a 5.25” disk, has the  tracks arranged in concentric circles, with track number 1 located at the very edge of the disk, while the last track, which is 35, is located on the inside of the disk closest to the hub. Commodore, in its quest to optimize the available storage space for date, decided that the best way to achieve this is to vary the number of sectors per track as wasll as the data densitists across the disk. Because the outside diameter of the circle is the largest, the tracks that are located here contain the largest amount of storage.

Since the Ds64 is an exact copy of a 1541 floppy, it makes it a great format for any kind of emulator for the Commodore 64. But even if it is a very useful format for the emulator scene it still has certain limitations and there are people who long for a more efficient storage format.

This is where the T64 format comes in.

The T64 format was designed by Miha Peternel and is used with his C64s emulator. The format is a very structured directory that where in each individual entry occupies 32 bytes.

The T64 format possesses a large header at the beginning of the file that is used for file signature, tape name, number of directory entries, used entries as well as the remaining space for actual tape directory entries. Immediately after the end of the directory is the data for each file. Each directory entry also includes the information of where the data being in the file including the starting and ending C64 load addresses, which helps determine how long the file is.

The T64 format has some distinct advantages over the D64 format in that it wastes so little space aside from the empty directory entries. It is logically laid out so it makes support quite easy. The signature is also a big plus as well as the fact that a directory size can be as large as needed.

It also has a few drawbacks though like not being able to support multi file programs under C64s. Also, some faulty T64 files were made prior to the introduction of the MAKETAPE utility.

Ultimately, it will be up to the emulator user to decide which file format he is most comfortable with and meets his needs.