+  RHDN Forum Archive
|-+  Romhacking
| |-+  General Romhacking
| | |-+  GB ROM expander
Pages: [1]
Author Topic: GB ROM expander  (Read 459 times)
Doom127
Guest
« on: December 19, 2006, 04:23:30 pm »

Just wondering if one exists? I need to put some extra space at the end of the SaGa 2 ROM.
KaioShin
Guest
« Reply #1 on: December 19, 2006, 04:35:15 pm »

It's been too long since I messed with GB stuff, so what I'm about to say is only a general direction and not to be meant as precise instruction.

You really shouldn't a tool for something like this. If the ROM is really completely used to the end (often there's a huge space left with zeroes at the end of ROMs) you have to examine which memory bank controller the Rom uses (short: mbc). It's possible that the mbc would support more space, then you'd just have to add another bank (size of a bank depends on mbc I guess) to the end (any hex editor will do). You'll have to code a small routone which switches the bank though (and back of course after you are done with whatever). So yes, this is a ASM hack.
If the mbc doesn't support additional banks you might try to change the mbc the game uses. It's just a one byte change in the header, you can refer to the tech docs of the GB (there are several) to find the address and which value indicates which mbc. Take care though, if the mbc uses a different command to switch banks you'll most likely just screw up the whole game. I can't remember if the mbcs where very similiar in this aspect, as I said it's been too long. It may be possible that they are all different and changing mbc is not possible at all without screwing the game (unless you rewrite it of course).

I hope that helps you a little bit. Don't shoot me if I messed things up, it's been a while since I was fluid in GB tech^^ Kiss
Doom127
Guest
« Reply #2 on: December 19, 2006, 04:55:45 pm »

Thanks KaioShin.
Ryusui
Guest
« Reply #3 on: December 19, 2006, 06:32:30 pm »

Expanding a GB ROM is thankfully more analogous to expanding a SNES ROM than an NES one. You still have to worry about mappers (or MBCs in this case), but adding extra banks is a simple matter of padding onto the end of the ROM; you don't have to rip apart the entire game so it looks for PRG in the right place or whatever.
KingMike
Guest
« Reply #4 on: December 20, 2006, 01:11:35 am »

Don't you have to always double the ROM size?
The docs I've seen suggest that only exponent of 2 sizes can fit in the header (32KB, 64, 128, 256, 512, 1MB, 2, 4).
(that being again, if the mapper supports it) Then you got that one weird mapper (MBC1?) where you can't use banks that are multiples of $20, because you're not allowed to map bank 0 into the $4000-7FFF (the switchable ROM bank).
From what I've looked at the mappers, they seem to all involve writing the bank number to $2000 (though I haven't looked very hard).
Tauwasser
Guest
« Reply #5 on: December 20, 2006, 02:58:24 am »

Well.

0147       Cartridge type:
           0 - ROM ONLY               5 - ROM+MBC2
           1 - ROM+MBC1               6 - ROM+MBC2+BATTERY
           2 - ROM+MBC1+RAM           8 - ROM+RAM
           3 - ROM+MBC1+RAM+BATTERY   9 - ROM+RAM+BATTERY
                                     FF - ROM+HuC1+RAM+BATTERY

0148       ROM size:
            0 - 256Kbit =  32KByte =   2 banks
            1 - 512Kbit =  64KByte =   4 banks
            2 -   1Mbit = 128KByte =   8 banks
            3 -   2Mbit = 256KByte =  16 banks
            4 -   4Mbit = 512KByte =  32 banks
            5 -   8Mbit =   1MByte =  64 banks
            6 -  16Mbit =   2MByte = 128 banks
           52 -   9Mbit = 1.1MByte =  72 banks
           53 -  10Mbit = 1.2MByte =  80 banks
           54 -  12Mbit = 1.5MByte =  96 banks

          calculate ROM size: if 0<=val<=6 then  size = 1<<(5+val) KBytes

That's how it goes. You should adhere to the sizes, however, it won't ever know unless you are addressing a rombank that's just not there Wink
Secondly, mappers can handle banks all differently.

MBC1 is tricky though, it can use two models of accessing data.

Well, for further information, just look for the most recent version of it. That's 17-Mar-99 by kOOpa or the version updated on 16-Mar-99 (some differences), afaik.

cYa,

Tauwasser
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC