Yoshi's Story uses 32-bit “bank-offsets” to point to resources in ROM. The bank table is located at 0x000A79D4 in ROM (0x800A6DD4 in RAM) as an array of bank base addresses. There are 16 available slots for bank addresses, but only bank numbers 0x00, 0x03, and 0x04 seem to be used by the game.
Bank # | ROM address |
---|---|
0x00 | 0x00001060 |
0x01 | 0x00000000 |
0x02 | 0x00000000 |
0x03 | 0x00526EC0 |
0x04 | 0x00B47A10 |
0x05 | 0x00000000 |
0x06 | 0x00000000 |
0x07 | 0x00000000 |
0x08 | 0x00000000 |
0x09 | 0x00000000 |
0x0A | 0x00000000 |
0x0B | 0x00000000 |
0x0C | 0x00000000 |
0x0D | 0x00000000 |
0x0E | 0x00000000 |
0x0F | 0x00000000 |
Bank-offsets are 32 bits, containing a 4-bit bank number and a 24-bit offset:
---- bbbb oooooooooooooooooooooooo
Bitfield | Description |
---|---|
- | unused bits |
b | 4-bit bank number |
o | 24-bit offset |
So a bank-offset to ROM address conversion formula could look something like this:
u32 boToAddress(u32 bankOffset) { u8 bankNum = (bankOffset >> 24) & 0x0F; u32 offset = bankOffset & 0x00FFFFFF; u32 romAddress = gRomBanks[bankNum] + offset; return romAddress; }