Kirby 64 uses a couple different addressing systems to point to resources in ROM.
A “bank-index” is a 32-bit value containing a bank number and an index to refer to a block of data. The upper 16 bits contain the bank number and the lower 16 bits contain the index. The bank number selects the bank base address from an array, and the index number selects an offset from another array, and adds it to the base address. Confusingly, there are (at least?) two distinct sets of banks that use this type of addressing.
This bank set contains miscellaneous data including level settings and particle textures.
Bank # | Base address | Offset array |
---|---|---|
0x0000 | 0x004F3290 | 0x0006CA0C |
0x0001 | 0x007BACA0 | 0x0006FA64 |
0x0002 | 0x00964660 | 0x000712D0 |
0x0003 | 0x00BD6DB0 | 0x000730C4 |
0x0007 | 0x01D28720 | 0x00077F30 |
This bank set contains contains mesh textures.
Bank # | Base address | Offset array |
---|---|---|
0x0000 | ? | ? |
0x0001 | 0x005B5360 | 0x0006D1E4 |
0x0002 | 0x00858740 | ? |
0x0003 | 0x009D8CB0 | 0x000D9268 |
0x0005 | 0x011291B0 | 0x00074A0C |
0x0007 | 0x01BD5C80 | 0x00076B28 |
The functions at 0x800A9AA8 and 0x800A8BAC are used to load data from Bank Set 1 and Bank Set 2, respectively. These functions return a pointer to the data after it's loaded into memory. The engine keeps track of what has been loaded; if the block of data corresponding to the provided bank-index is already in memory, these function will simply return a pointer to that block without loading more data.
void *func_800A9AA8(u32 bankIndex); // bank set 1 loader/address resolver void *func_800A8BAC(u32 bankIndex); // bank set 2 loader/address resolver
A “list-index” is a 32-bit value containing a bank number and an index to refer to a block of data. The upper 16 bits contain the list number and the lower 16 bits contain the index. The list number selects a list from an array, and the index number selects a ROM start and end address pair from the list. It seems this form of addressing is specifically used to refer to Geometry Blocks.
List # | Address array | Description |
---|---|---|
0x0000 | 0x0006C8F0 | ? |
0x0001 | 0x0006CA44 | ? |
0x0002 | 0x0006FA94 | ? |
0x0003 | 0x00071300 | ? |
0x0004 | ? | ? |
0x0005 | ? | ? |
0x0006 | ? | ? |
0x0007 | 0x00076490 | Level geometry |
The function at 0x800A9864 is used to load data and return a pointer to it, given a list-index.
void func_800A9864(u32 listIndex, u32 arg1, u32 arg2);