View Single Post
Old October 30th, 2012 (7:22 AM).
RichterSnipes's Avatar
RichterSnipes RichterSnipes is offline
*pew pew pew*
    Join Date: Oct 2011
    Location: USA
    Age: 24
    Gender: Male
    Nature: Modest
    Posts: 370
    Originally Posted by Jambo51 View Post
    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.
    Well drat. I could have sworn some trusted source claimed that the GBA was 32-bit. But I figured otherwise, a system with capabilities not that much greater (in certain areas) than the SNES certainly could still be running with 16-bit hardware, just in a more convoluted sense. That's like calling the Atari Jaguar a 64-bit system! :D

    It probably would have been a bit easier for me if I had spent a little time with that header information before! All the headers were documented in that second link in that thread, and doing just simple math like that would have inevitably resulted in me finding all the tracks with ease. I'd still be clueless on where the music table is, though!

    And how exactly does your tool export the songs from the GB(C) ROMs? Would the tracks still use GB Synth? Will your tool be able to create 1-to-1 versions of those songs with all velocities, modulations, panning, note rises, and distortion intact? If so, then that's awesome! Yet a little sad for me at the same time.
    Reply With Quote