Originally posted by messiaen
Originally posted by MarIO0
Originally posted by VL-Tone
Now if we were to relocate this table where we have more space, we could probably have up to 256 different kind of items available for "!" boxes.
The memory address of the table is loaded by the 2 instructions at 0x0x0007C8E0 (ROM).
I've tried to change it's location, but the emulator hangs after I break the box, and when I look at the memory in Nemu64, it looks like it didn't load the part of the ROM where I put the table.
With this hack, you can easily set a region of the ROM to be loaded in extended memory hack. Just changing the pointer loaded in register A0 will work. When copying the table, remember that the last empty entry, indexed 0x63, is also part of it. If you remove it, any invalid value (not part of the table) for the box content will make the game stuck on an infinite loop.
The table can be expanded as much as you want, however you'll have to keep 0x63 as the last entry. This doesn't mean you can't use higher values than 0x63, this is what I mean:
[..]
62 00 04 7A 13 00 07 F8 -- Star 4
64 00 05 7A 13 00 07 F8 -- Star 5
65 00 05 7A 13 00 07 F8 -- Star 5
63 00 00 00 00 00 00 00 -- Last entry, empty box
That's because instead of multiplying the table index by the size of an entry lenght, the function uses an while loop to match the number to its content, so they don't have to be sequential.
Also, something important to keep in mind is that:
LUI A0, 0x8033
ADDIU A0, A0, 0x8BA0
is different from
LUI A0, 0x8033
ORI A0, A0, 0x8BA0
because of the signed addition. In the first case, A0 will be 0x80328BA0 while in the second case it will be 0x80338BA0. Not that this happens in this specific table case since the number being added is less than 0x8000, but it's always to good to be alert when pointers are loaded using LUI + ADDIU instead of LUI + ORI.
I did manage to load the table in an unused but loaded part of the ROM shortly after my post.
About the ADDIU instruction, I had this problem (I'm very new to MIPS assembly, but fortunately it isn't very hard to learn since I'm already decent with x86 assembly). Also fortunately, ADDIU and ORI take the same parameters, so just changing the opcode works.
About the "Extended Memory support", it looks very interesting. I'll have to look at it 
Also, what debugger/disassembler do you use? I use Nemu64 and IDA Pro, but Nemu64 can't load "extended" ROMs.
|