Introduction
A DMS file is a compressed copy of a Commodore Amiga floppy disk, made by the DiskMasher program (DMS) that Amiga users used to swap disks by modem and on cover disks. Unpacking one gives the disk image that an Amiga emulator loads, an ADF file, and a great deal of Amiga software survives only as .dms files.
The file is a 56-byte header followed by one record for each track. A track is a cylinder, both sides together: 22 sectors of 512 bytes, 11,264 bytes, on a double density disk, so a full disk is 80 tracks and 901,120 bytes once unpacked. Each track is packed on its own, by one of seven modes, from storing it untouched to the adaptive Huffman coder called Deep. Each track carries a CRC-16 of its packed bytes and a checksum of its unpacked bytes, so damage is found track by track.
Some files also hold text tracks: a banner (often ANSI art) that DMS showed while unpacking, and a FILE_ID.DIZ description for bulletin boards.
The explorer here unpacks every track, checks every CRC and checksum, and opens the result as an ADF, so the disk’s files can be browsed and opened.
Structure
0File headerDMS!, flags, date, track range, sizes, versions, disk type, mode, CRC56 bytes56Track record a 20-byte header (TR, number, sizes, mode, checksum, CRCs) and the packed data20 bytes + packed size…More track records banner tracks (number 65535), tracks 0 to 79, a FILE_ID.DIZ track (80)one per track
Tracks are decoded in order with one set of dictionaries, which carry over from track to track in the dictionary modes (Quick, Medium, Deep, Heavy). A track whose flag bit 0 is clear (every stored and run-length-only track in the files seen) starts the next track with fresh dictionaries, and so does a text track in the viewer. See Compression modes.
Worked example
The start of a real Heavy 2 file (a double density music disk):
00 44 4D 53 21 00 00 00 00 00 00 00 00 2B 2F AD 98 DMS!............
10 00 00 00 4F 00 0A 56 E6 00 0D C0 00 00 00 00 00 ...O..V.........
20 00 04 00 01 00 01 00 00 00 00 00 00 00 41 00 6F .............A.o
30 00 6F 00 01 00 06 19 C8
38 54 52 00 00 00 00 28 14 29 C4 2C 00 07 06 95 3E TR....(.).,....>
48 C7 05 88 0A AD 98 C6 39 ... data
Reading it: flags at 10 are 0; the date 2B2FAD98 is 724,545,944 seconds after
1 January 1970, 16 December 1992 at 22:45 UTC; tracks 0 to 79 (004F); packed size
000A56E6 = 677,606 and unpacked 000DC000 = 901,120; made with DMS
1.11 (006F = 111), needing 1.11; disk type 1; mode 6 (Heavy 2); header CRC
19C8. The first track record at 0x38: track 0, 10,260 bytes
(2814) packed, 10,692 (29C4) after the Heavy coder, 11,264
(2C00) unpacked; flags 7 (dictionary, new tables, run-length stage), mode 6,
checksum 953E, data CRC C705, header CRC 880A.
What is checked, and what is not
Checked against the real files: the header and track layouts and both CRC-16 checks; the None, Simple, Medium, Deep, Heavy 1 and Heavy 2 modes (every track of the files tried unpacks to its checksum in 972 of 975 different files; the other three are one cut-off file and two with a few tracks whose checksums do not match, cause not established); the dictionary resets; the banner and FILE_ID.DIZ tracks; the disk image coming out as a valid ADF. All of this, and the flag bits, disk types, date and encryption, was also compared line by line with the source of xDMS 1.3 (see the header, where the date turned out to be Unix time, not Amiga time, and the disk type names and the flag bit 7 and 8 names were corrected). Not tested on any real file, because none was found: the Quick mode, encrypted disks, high density disks and the info flags other than banner and no-zero-tracks. The creator details at bytes 28 to 45 are not read by xDMS and are not understood.
Not described
The reference and the viewer are both partial. DMS has no formal specification; what is here comes from real files and from the source of xDMS 1.3.
Known, not yet covered
- Reference: the disk types other than the Amiga ones (MS-DOS, AMax, Mac) are known only as far as xDMS’s comment goes: the original DMS reserved values for them and never used them. See Compression modes and File header.
- Reference: high density disks and PC (MS-DOS) disks: xDMS handles them, but no file here uses them, so track sizes and layout are unconfirmed. See Tracks.
- Viewer: Quick-mode tracks are implemented but never tested on a real file.
- Viewer: encrypted files: the tracks are listed and their CRCs checked, but nothing is unpacked, because no password can be entered.
- Viewer: a PC disk image opens as raw bytes, not as a FAT disk (FAT is publicly documented).
- Viewer: creator details are shown as raw numbers, and banners as plain text with the colour codes removed, not as ANSI art.
Unknown
- Reference and viewer: two files, CanDo_25-A and AmigaCManual_30-C, have track checksums that do not match after unpacking. The cause is not established (damaged source disk, a wrong sum, or a fault in the unpacker); the viewer marks those tracks.
- Reference and viewer: the creator details at bytes 28 to 45 and the bytes 4 to 9 (tool tags such as MaPuS): xDMS does not read them and no other source was found.
Links
Software
Developers
- xDMS – command-line DMS unpacker, the usual reference for the algorithms (C)