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.

C/C++ > multiboot help

#11826 - Mega386 - Mon Oct 20, 2003 11:08 pm

im making a multiboot utility but dont know how to tell where the beginning of other gba roms are located in the cart. help!

#11828 - niltsair - Mon Oct 20, 2003 11:22 pm

2 Ways :

1. At a fixed position, at the end of your rom, append pointers to the roms and each rom data. Exemple :
-Say your MB program is 50,000 Bytes long
-Store pointer to Roms at address 50,000 - 51,024 (256pointers, 4Bytes per pointer)
-Append each rom, one by one. When appending 1 rom, update it's pointer value (current size of file + 0x8000000)
-In your program, create a pointer to 0x8000000 + 50,000.
-To access 3rd rom, byte 0 : pointer[2][0].

2. At the begining of every Roms, include a sequence of bytes that will always be the same. You then look for them.
_________________
-Inside every large program is a small program struggling to get out. (Hoare's Law of Large Programs)
-The man who can smile when things go wrong has thought of someone he can blame it on. (Nixon's Theorem)

#11832 - tepples - Tue Oct 21, 2003 3:23 am

The term "multiboot" is applied both to running RAM-based (.mb) programs over a serial cable (technical term) and to running multiple ROM-based (.gba) programs on a cart with bankswitching (colloquial term).

You use niltsair's method 1 if you're trying to put .mb programs on a cart. My GBFS tools automate a lot of the pointer handling. GBFS tools.

You can use either method if you're trying to put multiple .gba programs on a cart. PogoShell uses method 1, but the Visoly "BSOD shell" uses method 2: Scan at 32 KB increments, looking for headers with a valid complement check and no bit 7 set in the name. However, the F2A does require that .gba programs be placed at even multiples of 32 KB, which speeds your search.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#11880 - Mega386 - Wed Oct 22, 2003 11:58 pm

i like the sound of method 2, how would i go about doing that?

#11882 - tepples - Thu Oct 23, 2003 1:02 am

1. Read your flash cart's technical reference to determine how it bankswitches. The flash cart manufacturers don't publish much, but you can learn a lot by reading the visoly.s source code that comes with PogoShell.
2. Read gbatek to learn what the GBA recognizes as a valid header.
3. Loop through the whole cart, looking for valid headers. Store their addresses.
4. Draw the names of the valid headers to the screen.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.