A. Header length
The header length is determined by the file length modulo 256:
headerSize = fileLength % 256;
This means that the header is variable length and the minimum size is zero bytes, and the maximum size of 255 bytes.
Here is a description of the header bytes:
|0||Setors per track||18|
|2||Sector size code||1|
|3||First sector ID||1|
|4||Sector attribute flag||0|
If the sector attribute flag is zero then the track count is determined by the formula:
(fileLength - headerSize) / (sectorsPerTrack * (128 << sectorSizeCode)) / sideCount
If the sector attribute flag is non zero then the track count is determined by the more complex formula:
(fileLength - headerSize) / (sectorsPerTrack * ((128 << sectorSizeCode) + 1) ) / sideCount
If the length of the header is to short to contain the geometry desired, then the default values are assumed. If the header length is zero the all of the geometry is assumed. When creating disk images it is desirable to make the header length as short as possible. The header should only be used to deviate from the default values.
The sector data begins immediately after the header. If the header length is zero then the sector data is at the beginning file.
C. Sectors per track
This is the number of sectors per track (ones based). A value of 18 means there are 18 sectors per track
D. Side Count
This is the number of sides in the disk image. Values of 1 or 2 are acceptable. If there are two sides then the tracks are interleaved. The first track in the image file is track zero side 1, the second track in the image file is track zero side 2.
E. Sector size
The is the same value that is stored in the wd179x ID field to determine sector size:
Other values are undefined. Every sector in the disk image must be the same size.
F. First sector ID
This determines the first sector ID for each track.
Each successive sector adds one to the previous ID. If the first sector ID is 1, then the second sector has an ID of 2, and the third has an ID of 3.
G. Sector Attribute Flag
If this byte is non zero, then each sector contains an additional byte prepended to the sector data. If the attribute flag is zero then there are no extra bytes in front of the sector data.
H. Sector attribute byte
This byte is put at the begining of every sector if the header flag is turned on. The information this byte contains is the same as the status register (of the wd179x) would contain when a ‘Read Sector’ command was issued. The bit fields are defined as:
7 6 5 4 3 2 1 0 | | | | | | | | | | | | | | | +--- Not used. Set to zero. | | | | | | +----- Not used. Set to zero. | | | | | +------- Not used. Set to zero. | | | | +--------- Set on CRC error. | | | +----------- Set if sector not found. | | +------------- Record type: 1 - Deleted Data Mark, 0 - Data Mark. | +--------------- Not Used. Set to zero. +----------------- Not Used. Set to zero.
I. Software support
Jeff Vavasour’s Color Computer 3 Emulator version 1.6 supports header lengths of up to 255 bytes. It interrupts only the first header byte.
Jeff Vavasour’s Color Computer 2 Emulator only supports a zero byte header length.
Jeff Vavasour’s Port utility only supports a zero byte header length.
MESS version 0.37b151 supports a zero header length variant.
MESS version 0.56 supports header lengths of up to 255 bytes. It interrupts only the first four header bytes.
David Keil’s emulator only supports the zero header length variant. (To be confirmed)
Color Computer Transfer Utility version 0.95 supports header lengths of up to 255 bytes. It interrupts only the first 4 header bytes.
H. Example files
35 track, 18 spt, 256 byte sectors, single sided
80 track, 18 spt, 256 byte sectors, double sided
40 track, 255 spt, 256 byte sectors, double sided
80 track, 18 spt, 1024 byte sectors, double sided (Fake large floppy)
128 track, 255 spt, 256 byte sectors, double sided (Fake large floppy)
This document was inspired by an message from Jeff Vavasour on the Color Computer Mailing list.
It was written and formatted by tim lindner (firstname.lastname@example.org)
2001/11/22: I noticed there was a bug in the code to determine the number of tracks if header byte 4 was non-zero. I added some parenthesis to force the correct order of operation.
2001/11/22: Added note about this format’s name.
1. This program contain a hack to support double sided disks. If the disk has greater than 80 tracks then it is assumed the disk is double sided. For example, if the disk contains 82 tracks, then it is assumed to be a 41 track double sided disk (the tracks are interleaved). Furure versions of this programs will do away with these hacks, and support the JVC full header.