After the file header come the track records, one after another to the end of the file. Each is a 20-byte header and then the packed data. All numbers are big-endian.
Track header
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
0x00 | 2 | text | Signature | TR. |
0x02 | 2 | uint16 | Track number | 0 to 79 for the disk; 65535 for a banner; 80 (with a short size) for FILE_ID.DIZ. See track numbers. |
0x04 | 2 | – | Reserved | Zero in every file seen. |
0x06 | 2 | uint16 | Packed size | How many bytes of packed data follow this header. |
0x08 | 2 | uint16 | Middle size | The size after the dictionary coder and before the run-length stage; for stored and RLE-only tracks it equals the packed size. |
0x0A | 2 | uint16 | Unpacked size | The track as it ends up: 11,264 on a double density disk. A banner track states its text size; one banner seen states 0 and stores its text in the packed size. |
0x0C | 1 | bits | Flags | Bit 0: keep the dictionaries for the next track. When the bit is clear, xDMS resets every coder (the text buffer, the Deep tree and the Heavy and Medium positions) after unpacking the track; when set, the next track carries on from where this one ended (xDMS Unpack_Track: if (!(flags & 1)) Init_Decrunchers()). Heavy tracks: bit 1, new Huffman tables follow in the data; bit 2, a run-length stage follows. |
0x0D | 1 | uint8 | Mode | 0 to 6; see Compression modes. |
0x0E | 2 | uint16 | Checksum | The unpacked bytes added up modulo 65,536. |
0x10 | 2 | uint16 | Data CRC | CRC-16 of the packed data (before any decryption). |
0x12 | 2 | uint16 | Header CRC | CRC-16 of the first 18 bytes of this header. |
Track numbers
- 0 to 79: a cylinder of the disk (both heads). A double density track is 11,264 bytes; track n is at byte n × 11,264 of the image.
- 65535: a banner, text (often with ANSI colour codes) stored, not compressed in the files seen. There can be several, at the start or the end of the file.
- 80 with a size under a full track: the FILE_ID.DIZ description. 65534 also occurs in a few files, as text.
Tracks are not always complete: a file whose range is 0 to 39 or 40 to 79 holds half a disk, and a file with the no-zero-tracks flag may leave out tracks.
Making the disk image
Unpack each disk track and put it at its track number times the track size. The result of a full disk is the 901,120-byte ADF: block 0 is the first 512 bytes. The explorer does exactly this, and then reads the image with the ADF family. Of 975 different files, 962 give a 901,120-byte image, and 865 of the images have a valid AmigaDOS root block (type 2, secondary type 1, checksum correct). The others are disks with their own loader and no AmigaDOS volume, and partial disks.
Checks
- The header CRC over its first 18 bytes.
- The data CRC over the packed bytes, as stored.
- After unpacking, the sum of the bytes modulo 65,536 against the checksum field.
Of 975 different files, 972 pass every check on every track. Two fail the last check on a few tracks although the packed data’s CRC is right, and one is cut short. The cause of the two checksum failures is not established: a damaged source disk or a wrong sum written by DMS are possible, and so is a fault in the unpacker.
Fake boot block and skipped tracks
xDMS calls a track numbered 0 whose unpacked size is 1024 bytes a “FakeBB”, a fake boot
block with more advertising. When it unpacks a disk, xDMS writes out only the tracks
numbered below 80 whose unpacked size is more than 2048 bytes, so a fake boot block, a
banner (65535) and the DIZ (80) are never part of the image; the viewer does the same
for a track below 80 of 2048 bytes or less. xDMS also refuses a track if its packed,
middle or unpacked size is more than 32,000 bytes, and treats the first bytes that are
not TR as the end of the data, because it has seen files with text or zeros
after the last track.
Not described
The track records are checked against real files, apart from these points.
Known, not yet covered
- Reference: gaps from the no-zero-tracks flag and high density tracks (22,528 bytes) are handled by xDMS but were not seen in any file here.
- Viewer: text tracks are shown as plain text with colour codes removed, not as ANSI art. A disk with missing tracks is filled with zeros.
Unknown
- Reference: the meaning of track 65534 and the rule that tells a FILE_ID.DIZ track 80 from a real 81st cylinder are inferred from a few files, not from a source.
- Reference and viewer: the cause of two files’ track checksum failures is not established; the viewer marks those tracks and leaves them as zeros in the image.