Introduction
An .MSA file is an Atari ST floppy disk saved by the Magic Shadow Archiver program: the same sectors as an .ST image, but each
track on its own, run-length compressed when that makes it shorter. Because a disk is mostly empty or repeated bytes, a 720 KB disk often shrinks to a fraction of that. Emulators such as
Hatari read it directly. Every number is big-endian. Joined together, the decoded tracks are exactly an .ST image, and the explorer opens that image from the node
Tracks.
The header
| Offset | Size | Field |
|---|---|---|
| 0 | word | $0E0F: the magic |
| 2 | word | Sectors per track |
| 4 | word | Sides minus one: 0 for one side, 1 for two |
| 6 | word | The first track in the file, normally 0 |
| 8 | word | The last track in the file; it is included, so 79 means 80 tracks |
The tracks
The tracks follow in order, and for each track its sides, side 0 then side 1: so a two-sided disk of 80 tracks has 160 records. A record is a word length and that many bytes.
- A length equal to sectors per track × 512 is the raw track, stored as it is.
- A shorter length is a compressed track. A byte other than
$E5stands for itself.$E5starts a run: the next byte is the value to repeat and the word after it is the count. So four bytesE5 00 12 00are 4,608 zero bytes. Every$E5byte of the original has to be written as a run (a run of one), since the marker cannot stand for itself. - The decoded track is sectors per track × 512 bytes. The explorer refuses a file in which a record decodes to anything else, or runs past the end of the file, or in which the number of records is not the number the header announces.
What the explorer shows
The header, a node for each track (raw or compressed, its length), the geometry, and the decoded disk as a file that opens as an ST disk image, with its boot sector, file system and files. A file that starts at a track other than 0 is reported: the decoded image then holds only the tracks in the file.
Not described
Known, not yet covered
- Reference: no original specification was read: the layout is from the CLK emulator’s MSA reader (through a fetch summary) and from the decoder in the EstyJS emulator, which agree except that EstyJS uses the sides field without adding one (the viewer follows CLK). Which tool wrote which variant (for instance whether a program writes a run for fewer than five bytes) is not described, and neither is what happens to a disk whose side count is changed after the first track.
- Viewer: checked on MSA files made by an encoder written for the test; no real .MSA file was found on this machine. Only the first-to-last track range in the header is read; a track range that does not start at 0 is not padded. It has not been run in a browser by its author.
Links
Software
- Hatari – Atari ST emulator that reads and writes .MSA (Windows, macOS, Linux)
Reference
- CLK: an MSA reader – the commit that adds a reader: the header, the track loop and the run encoding