gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS Flash Equipment > Adding flashcart base address relocation support to firmware

#42346 - torne - Tue May 10, 2005 12:54 pm

I have FlashMe'd my DS and it works nicely with my 256Mbit XG cart (original, not xg2/3). However, having to use single-rom mode to put an NDS binary on there is less than ideal; it means I don't have room for GBA-mode code on there. I'm intending to modify the firmware to allow me to have multiple roms on the cart, GBA or NDS. I've seen the discussion here about releasing/not releasing the code for the firmware, and am curious to see how that turns out; but even if it's not released, I'll be dropping a dump into IDA and figuring it out myself ;)

Anyway, I have code to prod the cart base address for the XG/EZ (as the former is a ripoff of the latter) and different code for several other card models (pulled from PogoShell or from disassembling the loaders provided by the cart link software), and would like to slap this into the firmware - a good start would be to assume that the NDS binary is the first rom and is thus offset by 32k (the LittleWriter menu that I use is 32k, anyway, others are various sizes) and to look there, and if found relocate the cart there to boot. A proper boot menu implemented in the firmware would be neater though - the flash relocation is 32k-aligned so it doesn't actually take too long to scan through the 1024 possible start locations to check what roms are present, and whether they are DS or GBA roms.

The latter part could be implemented in a DS loader menu on the cart, but it's just more fun to do it in firmware, space permitting (guess I'll have to see).

I'm posting basically to ask if anyone is working on something similar, perhaps for another cart, because duplication of effort is teh lose. Also, if DarkFader and co feel like chucking some info about the firmware my way, it'd be appreciated, to save me spending quite so much time messing with IDA (though IDA is fun to mess with, I guess). As DsPet pointed out, we have enough information to turn the DS into a brick already - it's NOT doing so that we want help with ;)

Thanks in advance folks,
T.

#42365 - josath - Tue May 10, 2005 5:57 pm

everything you want to do, can just as easily be done in a loader menu that's not part of the firmware, which means people can use it without flashing their firmware. Costis has a mostly working one for NDS homebrew (don't know if he's doing gba support), which he hasn't released. I'm working on one as well, but haven't made a lot of progress yet.

#42369 - torne - Tue May 10, 2005 6:29 pm

Yes, just about; fiddling with the GBA modeswitch would let you still boot GBA roms. It would have to replace the first image on the cart, though, in order to get booted by the current firmware - this stops it being GBA compatible (though I can envision suitable voodoo, maybe, depends what order things get done in) and won't work with whatever GBA boot menu your flasher software would normally use.

I use LittleWriter to flash my cart as it does automatic save banks and stuff, none of which works right if you don't put LWPACK at the beginning of the cart. It's also neccecary to modify the LW executable to replace LWPACK, as it's not a seperate file.

It's more aesthetically pleasing to drop it into the firmware, anyway; if there's space, it could be slipped into Nintendo's menu screens, which would look pretty cool. (If there isn't, maybe PictoChat can be excised *grin*). Not needing space on the cart, a client-side util to assemble multiple roms into an image, or modifying the cart writing software seems like an advantage to me.

It's fun to mess with firmware, regardless; there are other things that could be put in there, and it'd be interesting to tweak and extend N's rather tasteful menu. The converse of your statement applies; everything I want to do can just as easily be done in the firmware, given a minimal amount of info about how it works, and I can live with getting that info with IDA if it's not forthcoming from another source. Disassembly is fun too. ;)

#42389 - tepples - Tue May 10, 2005 8:41 pm

torne wrote:
Yes, just about; fiddling with the GBA modeswitch would let you still boot GBA roms. It would have to replace the first image on the cart, though, in order to get booted by the current firmware - this stops it being GBA compatible (though I can envision suitable voodoo, maybe, depends what order things get done in) and won't work with whatever GBA boot menu your flasher software would normally use.

Load your bootloader in DS mode, and when the player selects a GBA game, bankswitch the cart and then use "switch to GBA mode" in the BIOS.

Quote:
I use LittleWriter to flash my cart as it does automatic save banks and stuff, none of which works right if you don't put LWPACK at the beginning of the cart.

I use LW as well with my Visoly Flash Advance (yes, old, I know), but I use PogoShell rather than LWPACK because if I use LWPACK, my GBA freezes on the "GAME BOY / Nintendo?" screen.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#42434 - torne - Wed May 11, 2005 10:43 am

tepples wrote:
Load your bootloader in DS mode, and when the player selects a GBA game, bankswitch the cart and then use "switch to GBA mode" in the BIOS.


That lets you play GBA games on the DS - when I said GBA compatible I meant using the cart on a real GBA (obviously can't run any DS stuff off the cart). That would require code that could be executed by the ARM7 of the DS after being initialised by WhicheverMe but also by the GBA, and have it run far enough to tell which system it was running on.

tepples wrote:
I use LW as well with my Visoly Flash Advance (yes, old, I know), but I use PogoShell rather than LWPACK because if I use LWPACK, my GBA freezes on the "GAME BOY / Nintendo?" screen.


Heh, I'd kill for a flash advance, the XG1 is an unreliable POS. ;) LWPACK works fine for me but PogoShell goes horribly wrong, so mileages clearly vary.

#42500 - tepples - Thu May 12, 2005 2:36 am

torne wrote:
when I said GBA compatible I meant using the cart on a real GBA (obviously can't run any DS stuff off the cart). That would require code that could be executed by the ARM7 of the DS after being initialised by WhicheverMe but also by the GBA, and have it run far enough to tell which system it was running on.

Or at least using different headers to make different entry points.

Quote:
Heh, I'd kill for a flash advance, the XG1 is an unreliable POS. ;) LWPACK works fine for me but PogoShell goes horribly wrong, so mileages clearly vary.

PogoShell is designed for Visoly Flash Advance and Flash2Advance Classic carts. You don't need to kill; just purchase F2A, which is still sold. That is, unless you work at a slaughterhouse and killing God's creatures how you earn a living ;)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#42517 - torne - Thu May 12, 2005 10:17 am

tepples wrote:
Or at least using different headers to make different entry points.

True, but using a different header would break compatibility with existing DS stuff.

Quote:
PogoShell is designed for Visoly Flash Advance and Flash2Advance Classic carts. You don't need to kill; just purchase F2A, which is still sold. That is, unless you work at a slaughterhouse and killing God's creatures how you earn a living ;)

I can't afford to buy a new cart; too many vital living expenses (broadband!). Gotta stick it out with this knockoff piece of junk ;)

I'm earning a living killing Microsoft's mobile division, or at least that's the plan.. I don't think they count as god's creatures *grin*