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 packed by None or Simple starts the dictionaries afresh, and so does a text track. 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 1978, 16 December 2000; 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. Not checked, because no file here uses it: the Quick mode, encrypted disks and high density disks. The names of the info flag bits other than banner and no-zero-tracks, the disk type names and the creator details at bytes 28 to 45 are from memory of the xDMS source and could not be confirmed.
Not described
The reference and the viewer are partial, for these reasons.
- Reference: the Quick mode and encryption are written from memory of xDMS, with no file to check them on. The info flag bits other than banner and no-zero-tracks, the disk type names, the creator details at bytes 28 to 45, high density disks and PC (MS-DOS) disks are not confirmed. Two files whose track checksums do not match are unexplained.
- Viewer: Quick-mode tracks cannot be tested, and an encrypted file is listed and its CRCs checked but not unpacked (no password can be entered). A PC disk image opens as bytes, not as a FAT disk. Creator details are shown as raw numbers.
Links
Software
Developers
- xDMS – command-line DMS unpacker, the usual reference for the algorithms (C)