Tuesday, April 3, 2012

Commodore Disk Image headers, again

One minor nitpick about Commodore disk images is that they have no signature line.  The only way you can tell what they are is to look at the extension, the file size, and perhaps try to jump to the header sector and "see" if it looks right.  While this is not a major problem, I think there is a simple solution; namely, to add a signature to each disk image.

A signature is a small, initial data set which you can use to determine the nature of the disk unconditionally.  My suggestion is to look for an optional 32 byte signature on all Commodore images; if it proves useful, then over time all such images will have this signature.

Examples.

D64 images will start with "1541 DISK IMAGE ".
D71 images will start with "1571 DISK IMAGE ".
D81 images will start with "1581 DISK IMAGE ".
D82 images will start with "8250 DISK IMAGE ".

...and so on.

The remaining 16 bytes should be used to specify the image configuration as clearly as possible.  For example, the D64 should have a byte for how many tracks are present (i.e. 35, 40, or some other number), and a byte indicating whether or not error bytes are appended to the end of the image.  I would also suggest another byte used to indicate an auxiliary directory track, but that starts to make things complicated.

As I said, this data can be inferred from the image itself, but it is much better to be explicit, and the simplest way to do that is to lead with a short signature block.

Having a "number of tracks" byte could be space-efficient as well, because many images have content  much smaller than the disk's capacity; in these cases it would be possible to publish a smaller D64. Since the 18th track is required, the smallest D64 would be 18 tracks long, or about 95k -- almost half the size of the standard D64.

No comments:

Post a Comment