Friday, January 11, 2013

ExHiRom

Converting to ExHiRom (which will effectively triple the potential size of the ROM, to 6 MB) seems to be.. doable, but it's going to require some code patches.

The addressing for SNES addresses C0xxxx-FFxxxx (HiRom ROM range, and typically how HiRom code accesses ROM) is the same, but it varies for the range (00xxxx-3F0000), which under HiRom points to ROM, but in ExHiRom points to the upper portion of the ROM (see http://slack.net/~ant/old/info/snes_super_flash_cart_64m.txt).

SOM, of course, is littered with code that jumps to 01xxxx, 02xxxx, etc - so either I patch this code (replacing 01xxxx with C1xxxx, etc), or copy a bunch of it to the 4xxxxx range (which is a waste of space that I'd rather avoid).

FuSoYa's expansion tool looks like it copies the ROM from 008xxx to the 408xxx range (to avoid such problems for 16-bit addressing?) but why does it not surprise me that SOM is actually calling out these types of addresses as 24-bit in some of the code... and using HiRom-style Cxxxxx, Dxxxxx etc in other parts of the code.  Meh.

Edit: So far, 64 24-bit address references changed in SomExHi.smc, and I've managed to get the game to play up until you fall down the waterfall, at which point it crashes.  Getting this to work for all code paths is going to be a long process.

3 comments:

RetroHelix said...

Do you plan to take on the task of converting it to ExHiRom or were you just testing?

Alexandre Olivier said...

Good luck !

Mop said...

I've got it mostly working at this point, and I've documented all the changes, so I guess I may as well. It's hard to know I've covered everything, so the first versions will probably be crashy. It'll only do the conversion if you go over 4MB, though, which should be somewhat rare.