GBA Flash carts

Discussion of development of software for any "obsolete" computer or video game system. See the WSdev wiki and ObscureDev wiki for more information on certain platforms.
Post Reply
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

GBA Flash carts

Post by tokumaru »

I recently bought a SuperCard MiniSD for use with my GBA systems (I got an EZ-Flash 3in1 for my DS) and was a bit disappointed with the fact that I have to patch ROMs in order for them to work on that device (IIRC, the EZ-Flash doesn't need any patching - I haven't used it in a while). Being used to high quality products like bunnyboy's PowerPaks or Krikzz's Everdrives, which keep things as authentic as possible, this bothers me a lot.

My goal is not just to "play games on the go", if it was I'd be satisfied with the GBA emulator in my Android phone, which runs perfectly fine. I want things to remain authentic, specially if I decide to run homebrew software on my Flash carts, so I was wondering if anyone here knows what kind of modifications the SuperCard or similar products make to the ROMs, and how they affect the software. Can they break the ROMs in any way? Introduce glitches not present in the original ROMs? Thanks.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: GBA Flash carts

Post by mic_ »

I own a SuperCard CF version, and haven't noticed any issues. IIRC, the patching is done at least in part to allow things like realtime saving, which I assume that it does by installing its own interrupt handler that does whatever it needs to do and then calls the original handler. Last time I used the PC tool, I think it would look up the ROMs in some kind of database to know how to patch the them. If no match was found - e.g. if I added my own techdemos - it would say something like "Patching failed" and supposedly not modify the ROM.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: GBA Flash carts

Post by tepples »

The GBA has its own counterpart to Super NES fast and slow ROM, the WAITCNT register. The system boots in slow ROM mode; most games switch to fast ROM early on. (There's also a super-fast mode that some advanced flash adapters support to diminish slowdown in some games; my memtestARM app for DS tests stability in this mode.) But the SuperCard's RAM controller isn't fast enough for fast ROM. Patching does four things: it disables fast ROM, it enables instruction prefetch (which sort of makes up for it), it mapper-hacks the save code to use SRAM instead of Bandai-style EEPROM or parallel flash, and it adds a keypress code to return to the adapter's menu (like a PowerPak long reset, except the GBA has no reset button). Most homebrew games and multiboot games will run fine without patching because they don't enable fast ROM and if they do save, it's to SRAM.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: GBA Flash carts

Post by tokumaru »

mic_ wrote:I own a SuperCard CF version, and haven't noticed any issues.
There was a game I tried (Altered Beast, I think) with different patching options, and at least once the game booted up with corrupt graphics. I can't remember if it always booted up that way though.
IIRC, the patching is done at least in part to allow things like realtime saving, which I assume that it does by installing its own interrupt handler that does whatever it needs to do and then calls the original handler.
I tried disabling everything, but the ROMs were still modified in some way, because they don't work without going through the patching tool first. What I'm trying to find out is what the minimum required patching does, and how it can affect the game.
If no match was found - e.g. if I added my own techdemos - it would say something like "Patching failed" and supposedly not modify the ROM.
Have you tried copying the ROM directly? It doesn't work, does it?
tepples wrote:But the SuperCard's RAM controller isn't fast enough for fast ROM. Patching does four things: it disables fast ROM, it enables instruction prefetch (which sort of makes up for it)
Sounds bad... I mean, even if GBA games don't make use of timed code like NES games do, messing up the timings doesn't sound exactly harmless.
it mapper-hacks the save code to use SRAM instead of Bandai-style EEPROM or parallel flash
How does it know what kind of save each game uses? Database? Does it leave games that already use SRAM alone?
and it adds a keypress code to return to the adapter's menu (like a PowerPak long reset, except the GBA has no reset button).
I have nothing against powering off and back on, I can totally live without this feature if that means screwing less with the games.
Most homebrew games and multiboot games will run fine without patching because they don't enable fast ROM and if they do save, it's to SRAM.
I see... So, if someday I decide to program my own GBA software it should run unmodified as long as I don't use fast ROM or saving methods other than SRAM.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: GBA Flash carts

Post by tepples »

tokumaru wrote:Have you tried copying the ROM directly? It doesn't work, does it?
Everything seen on my GBA homebrew page will probably work unmodified.
even if GBA games don't make use of timed code like NES games do, messing up the timings doesn't sound exactly harmless.
GBA games are written mostly in C, and they should be somewhat resilient to what amount to CPU speed changes.
How does it know what kind of save each game uses?
When I was in the GBA scene, it depended on identifier strings compiled into the official flash and EEPROM save libraries. I don't know whether it has since become more database driven. It might use the SRAM identifier to add SD writeback at various points ("real-time save").
So, if someday I decide to program my own GBA software it should run unmodified as long as I don't use fast ROM or saving methods other than SRAM.
Correct. Don't touch WAITCNT and your program will work fine on a SuperCard. For inner loops, you can always copy code to the built-in ultra-fast IWRAM. You will have to quick power cycle to save though.
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Re: GBA Flash carts

Post by MottZilla »

The SuperCard is a let down for GBA. I owned one before. As you noticed, basically all games must be patched due to the Slow RAM (or Memory Controller) in the product not being able to keep up with *normal* ROM speeds. The pre-fetch does not make up for this. Games that normally don't suffer slowdown will. Some games suffer terrible slowdowns. The SuperCard is more useful for playing NDS games. I recommend if you can find one, one of the M3 Adapters. While any GBA device requires patching the ROMs if they use something other than SRAM it's not a bit deal. SuperCard's the one that *really* requires patching not just for saving but for not crashing when the RAM can't keep up.

I'd highly recommend trying to find another product.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: GBA Flash carts

Post by tokumaru »

Crap. Wish I knew this sooner. Thanks MottZilla.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: GBA Flash carts

Post by Dwedit »

I have the Flash2Advance 256M (32MB), and it has hardware simulation of several different save types.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
mikejmoffitt
Posts: 1353
Joined: Sun May 27, 2012 8:43 pm

Re: GBA Flash carts

Post by mikejmoffitt »

Did my old 128Mbit EZ-Flash 2 do this sort of thing? It was a small NAND flash deal, I don't believe it copied the game to its own RAM in order to run like some newer devices did.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: GBA Flash carts

Post by tepples »

A NAND device would still have to copy the game to RAM to run it. It just acts as if it were a raw NAND needing a software controller, like a SmartMedia or xD-Picture card as opposed to CF or SD. Only NOR flash is word-addressed in the way that allows for the sort of execute-in-place operation needed to run programs without copying them to RAM first. Most cards that are 512 Mbit or smaller are NOR based.
User avatar
mikejmoffitt
Posts: 1353
Joined: Sun May 27, 2012 8:43 pm

Re: GBA Flash carts

Post by mikejmoffitt »

tepples wrote:A NAND device would still have to copy the game to RAM to run it. It just acts as if it were a raw NAND needing a software controller, like a SmartMedia or xD-Picture card as opposed to CF or SD. Only NOR flash is word-addressed in the way that allows for the sort of execute-in-place operation needed to run programs without copying them to RAM first. Most cards that are 512 Mbit or smaller are NOR based.
I indeed had those mixed up - I believe it was an NOR cart.
Post Reply