Alley Cat Music Format

From ModdingWiki
Jump to navigation Jump to search
Alley Cat Music Format
Format typeMusic
Notation typeCustom
InstrumentsPC Speaker
Max channel count1
Max track countUnknown
Max pattern countUnknown
Max order countUnknown
Tags?None
Games

The IBM PC title melody in Alley Cat is an embedded byte sequence indexed into a table of PIT channel 2 divisors. It is neither sampled audio nor MIDI. The Tandy title uses a different three-voice format.

File format

All addresses are IBM DS offsets; add 0x300 for file offsets.

DS offset Data type Contents
0x5320 UINT16LE Runtime sequence index
0x5322 UINT16LE Runtime last BIOS tick
0x5324 UINT16LE[] PIT divisor lookup data
0x538C UINT8[] Title note sequence, ending with 0x66

Each note byte has this meaning:

Value Meaning
0x00 Silence for one BIOS tick
0x66 End the tune and silence the speaker; do not advance the sequence index
Other Read a UINT16LE divisor at DS:(0x5324 + value) and sound it for this tick

The byte is a byte offset into the divisor data, not a MIDI pitch or a word index. Do not multiply it by two. The routine does not validate a note value before using it; an editor should restrict new values to known divisor entries and preserve the terminator.

Playback

The player (CS:53B0) processes one event when the BIOS tick changes, approximately 18.2065 events per second. Non-zero notes program PIT channel 2 in square-wave mode and enable the PC speaker. For divisor d:

frequencyHz = 1193182 / (d == 0 ? 65536 : d)

Every sequence byte before the terminator occupies one tick, including rests. Consecutive copies of a note continue that pitch across ticks. The viewer constructs square-wave oscillators from the same sequence and divisor data; its 1024-event guard is not a file-format length field.

Notes

  • The sound-enable flag is DS:0000. With sound disabled, the translated title routine returns before advancing the melody.
  • Runtime indices and timing words are player state, not a header that must be prepended to exported music.
  • Other IBM tunes use direct divisor words and different timing rules; see Alley Cat Sound Table Format.

Source code

From re-alleycat, the open-source HTML5 port (revision b003aa63ffbb):

Credits

This file format was reverse engineered by VorticonCmdr. Please credit the original research when using this information in your own project, and include a link back to this wiki.