An .s98 is the VGM idea from the Japanese PC scene: every write a program made
to its sound chips, with the time between, so a player holding the same chips plays it back. Two
versions are in the wild and they put things in different places. v1 is a 32-byte header,
a plain-text title right after it, and the dump at the next 128-byte boundary running to the end
of the file. v3 adds a device table after the header and a [S98] tag of
key=value lines after the dump. The tag offset field is the same in both; where
it points tells you which layout you have.
The timer. One sync is numerator / denominator seconds; zero in either field means the default, 10 / 1000, ten milliseconds. This file says 1 / 0: one millisecond per sync.
One opcode, then operands. 0x00-0x7F is a write: the device is
the opcode halved, the port its low bit, and two bytes follow, register and value.
0xFF is one sync. 0xFE is a sync count plus two, as a
7-bit varint, low bits first, bit 7 meaning another byte follows, in every
version. 0xFD ends the dump, and in a well-formed file that is where the tag
(v3) or the file (v1) begins.
v3: five bytes of mark, then key=value lines separated by LF, in
Shift-JIS unless a utf8= line says otherwise. The keys are free; title, artist,
game, year, genre, comment, copyright, s98by and system are the ones players show. v1 has
only a title, plain text, NUL-padded, sitting between the header and the dump.
Three letters and a version digit as text. v2 was defined and never used.