Metroid/Music data format

From Data Crystal
< Metroid
Revision as of 14:39, 22 March 2011 by Furrykef (talk | contribs) (Created page with 'The Metroid music format was likely decoded by Dirty McDingus, as a complete description of it appears in his disassembly of the game. == Init music index table == This table ap…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Metroid music format was likely decoded by Dirty McDingus, as a complete description of it appears in his disassembly of the game.

Init music index table

This table appears at BBFA in every ROM bank with music (every bank except the graphics and engine banks). It translates song IDs into offsets (given as one byte) into the Init Music Table. Curiously, the songs are not in the same order in the two tables.

The song order is:

  • 0: Ridley
  • 1: Tourian
  • 2: Item room
  • 3: Kraid
  • 4: Norfair
  • 5: Escape
  • 6: Mother Brain
  • 7: Brinstar
  • 8: Game start
  • 9: Received item / beat boss
  • A: Ending
  • B: Title screen

Init Music Table

This table is present in every ROM bank with music. It is located at $BD31 in each bank.

The order (as defined by the Init Music Index table) is:

  • Mother Brain
  • Escape
  • Norfair
  • Kraid
  • Item room
  • Ridley
  • Ending
  • Title screen
  • Game start
  • Received item / beat boss
  • Brinstar
  • Tourian

The format is:

  • Index into note length table (will be $00, $0B, or $17)
  • Does song loop at end? (zero = no, nonzero = yes)
  • Length counter for triangle channel
  • Instrument ID for square 1
  • Instrument ID for square 2
  • Address of square 1 music data
  • Address of square 2 music dta
  • Address of triangle music data
  • Address of noise music data

All of these are one byte except for the offsets, which are two.

If a song is not used in the current bank, its offsets are given as $0100, $0300, $0500, $0700.

Music data

  • $00 - Ends or loops the song. Affects all channels.
  • $Bx - Sets length of subsequent notes to x (as defined by the song's note lengths table)
  • %11xxxxxx - start of local loop; loop x times
  • $FF - end of local loop
  • $01 - plays an A-1 note
  • $02 - play a rest [i.e. a silent note]
  • $04-7E = plays C#2, D-2, D#2 ... F-7.