View Single Post
Old October 30th, 2012 (4:16 AM).
Jambo51's Avatar
Jambo51 Jambo51 is offline
Glory To Arstotzka
Join Date: Jun 2009
Gender: Male
Nature: Quiet
Posts: 731
Nit picky point, but the M4AA engine is actually 16 bit. The GBA is a 16 bit system by design. All the memory buses are 16 bit (the channels of communication between processor and cartridge only support 16 bit data transfers). The M4AA engine is coded in 16 bit THUMB, and as such is 16 bit itself.

Hardware lesson over, the music table in GS is at 0xE906E, it has 3 byte pointers on it which point to the music headers. The format of the music headers is identical between gen 1 and gen 2.

The note structure is a little different, but it's documented in one of the documents you have read. To find a song headed from the table, take the second 2 bytes, reverse them, then subtract 0x4000 from the number.

Eg, the pointer is 3A D1 7B, reverse the 2nd and 3rd byte (7B D1), subtract 0x4000 (3B D1) and note this location down.

Now, multiply the first byte (3A) by 0x4000 to get the "ROM bank". (0xE8000)

Finally, add the 2 numbers together to get the ROM location. (0xE8000 + 0x3BD1 = 0xEBBD1)

What my tool does at the moment is export the song as a .s file, ready to insert into a gen 3 ROM. It's not perfect, but it's getting there.
Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!
Reply With Quote