ACIDCAT . FILE FORMAT REFERENCE

YM Anatomy

ST-SoundYM2149 register dump
rev 2026.09
magic YM2! to YM6!
endian big
container LHA level 0, -lh5-
samples digidrums, 8-bit

A .ym holds no code and no score: it is what a player routine wrote to the Yamaha YM2149 (the Atari ST's sound chip, and the AY-3-8910's twin in the Spectrum and the CPC), one frame of registers per tick, usually fifty a second. Sixteen bytes a frame is a lot, so the registers are stored interleaved -- every frame's r0, then every frame's r1 -- which turns slow-changing registers into long runs, and the file is packed in an LHA archive. What sits on disk is the archive; the tune is inside it.

file regions
▸the LHA member header0x00 . drawn below

Level 0 only. ST-Sound reads only the oldest header layout, so a YM is archived with it. The header's own checksum is the byte sum of everything after the first two bytes. The body that follows is -lh5-: LZSS over an 8 KB window with Huffman codes rebuilt every block, bits read most significant first. A block opens with its symbol count and three code-length tables -- a small one that codes the next, the 510 literal-and-length symbols (256 bytes and match lengths 3 to 256), and 14 position classes -- and a position class p above 1 is followed by p-1 raw bits. The CRC-16 (the ARC one: polynomial 0x8005, reflected, starting at zero) is of the unpacked tune. A single zero byte ends the archive.

▸the YM6 headerunpacked, 0x00 . drawn below

YM5 and YM6 share this header. After it come the digidrums, each a 32-bit size and that many 8-bit samples, then the song name, author and comment as NUL-terminated strings, then the register data, then End!.

▸the stringsNUL-terminated . drawn below

Name, author, comment, in that order, each ending in a zero. An empty one is the zero alone. This file's comment, not drawn, names who converted it.

▸the registers16 x frames . drawn below

Sixteen registers a frame. r0-r13 are the chip's, with the bits it does not use cleared; r14 and r15 carry YM6's special effects (SID voice, digidrum, sync buzzer), whose parameters also ride in the chip registers' spare bits. Interleaved, register k of frame f is at k x frames + f. Drawn: the first twelve frames of r8, voice A's volume.

r0-r5tone periods A, B, C: 8 bits fine, 4 coarse
r6noise period, 5 bits
r7mixer: tone off A-C (bits 0-2), noise off A-C (3-5)
r8-r10volumes A-C, 4 bits; bit 4 hands the voice to the envelope
r11-r12envelope period, fine and coarse
r13envelope shape, 4 bits; 0xFF means not written this frame, since a write restarts the envelope
r14-r15YM6 effect data
▸the endEnd! . drawn below
▸the older versionsYM2 . YM3 . YM3b . YM4

YM3! is the magic and nothing else: fourteen registers a frame, interleaved, at 50 Hz on a 2 MHz chip, and the frame count is what fits in the file. YM2! is the same layout from the Mad Max player, whose drums came from samples built into the player rather than the file. YM3b adds a 32-bit loop frame as the last four bytes. YM4! is an intermediate version between YM3b and YM5 and is not drawn here. MIX1, YMT1 and YMT2 carry the same LeOnArD! but are ST-Sound's sample-remix and sample-tracker types, not register dumps.

▸identification-lh5- . YMn!

On disk, -lh5- at offset 2 of an LHA member; inside, one of YM2!, YM3!, YM3b, YM4!, YM5!, YM6! at zero, and YM4 and later follow it with LeOnArD!.