Skip to content

Instantly share code, notes, and snippets.

@loveemu
Last active March 24, 2019 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loveemu/1e53d09b4540b3d5ccf93128ea463080 to your computer and use it in GitHub Desktop.
Save loveemu/1e53d09b4540b3d5ccf93128ea463080 to your computer and use it in GitHub Desktop.
Hachiemon Music Format Analysis (GBA Natsume Driver)

Hachiemon Music Format Analysis

  • Max channels: 12
  • Similar to Standard MIDI Format 1
  • BGM/SFX have different data structure

Music address table at 0x807EC8C (xref from 0x8069DEE), 19 song items available.

Song #0 and #1 are special. They are used for setup.

Channels?

Channel 0-7 are for GB channels (ch 4-7 are usually not used), and 8-11 are for GBA FIFO channels. (GB channels are slightly initialized in song #0, #1)

Live pointer addresses: 0x3000174, 0x30001e8, ... (+0x74*N)

Song Header

Size Comment
2 Channel mask (max 0xFFF, MSB first)
1 Priority?
1 Alignment (0)
4*N Channel entrypoint address

Sequence

Command e0..ff

  • 00-7F xx: Note (note number, length)
  • 80 xx: Rest
  • D0-DF: ADSR? (Attack Rate?)
  • E3 xx: Instrument (GB Waveform, GBA FIFO)
  • E4, E5, E6, E7: Pulse Duty Rate (12.5%, 25%, 50%, 75%)
  • E9 xx: Single-ch Echo Delay (max xx: 48)
  • FB xx yy zz vv: General channel attributes?
  • FD: ?
  • FE xx: FE 02 for percussion channel? (GB Noise, GBA FIFO Drums), FE 00 for switching back to melodic channel
  • FF: End of Track

Pastebin

BGM entrypoint:
0x807ECD8
0x807ED0C
0x807ED28
0x807ED44
0x807ED60
0x807ED7C
0x807ED98
0x807EDB4
0x807EDD0
0x807EDEC
0x807EE08
0x807EE24
0x807EE40
0x807EE5C
0x807EE78
0x807EE94
0x807EEB0
0x807EECC
0x807EEE8
Song 2:
0x807FAC0
0x807FB6A
0x807FC14
0x807FCC4
0x807FDB1
0x807FE17

Perc 0x24 (bass drum) = unk_807FA92 // why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment