Simple GBA Mode Switcher
With Slot-1 DS flash carts, you sometimes want to boot a GBA cart in Slot-2. There’s probably something already out there for this, but I couldn’t find one so I made a small and simple GBA mode switcher. It uses the setting you’ve selected in your DS firmware to determine which screen to run on. This is probably the shortest DS code I’ll ever write, so source is included in this post.
ARM7:
#include <nds.h>
int main(void) {
uint8 current, backlight;
if(((PERSONAL_DATA *)0x023FFC80)->gbaScreen) {
backlight = ~PM_BACKLIGHT_TOP;
}
else {
backlight = ~PM_BACKLIGHT_BOTTOM;
}
// Reset the clock if needed
rtcReset();
//enable sound
powerON(POWER_SOUND);
SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F);
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz | SPI_CONTINUOUS;
REG_SPIDATA = 0x80;
SerialWaitBusy();
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHz ;
REG_SPIDATA = 0;
SerialWaitBusy();
current = REG_SPIDATA & 0xff;
current = current & backlight;
SerialWaitBusy();
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHZ | SPI_CONTINUOUS;
REG_SPIDATA = 0;
SerialWaitBusy();
REG_SPICNT = SPI_ENABLE | SPI_DEVICE_POWER | SPI_BAUD_1MHZ;
REG_SPIDATA = current;
SerialWaitBusy();
swiSwitchToGBAMode();
return 0;
}
ARM9:
#include <nds.h>
int main(void) {
if(((PERSONAL_DATA *)0x023FFC80)->gbaScreen) {
POWER_CR &= ~POWER_SWAP_LCDS;
}
else {
POWER_CR |= POWER_SWAP_LCDS;
}
return 0;
}
January 25th, 2007 at 3:45 pm
thats kool, hmm.. what if you make it vice versa? i mean like instead of a nds file switching to gba mode, make a gba. file that switched into nintendo ds mode for ds users.
January 28th, 2007 at 9:32 pm
One problem I had is that the DS doesn’t always keep the most recent personal settings at that one location (it uses two that I have seen in my own firmware dumps, at any rate).
Here is the code I used to get around that:
http://l33t.spod.org/~cory1492/EZDStoGBA_V2.zip
(also EZDStoGBA_V4.zip, EZDStoGBA_V3_Framed.zip, EZDStoGBA.zip at that same base url).
Not nearly as tidy as yours, mind, and with ez4 specifically in mind for a couple things (bankswitching OS NOR for the reboot).
Any rate, thanks for the goodies; I’m sure alot of people will indeed appreciate the tiny util
February 1st, 2007 at 12:54 pm
This is a very nice piece of software…. I was really looking for something like this I have an M3 Simply + EZ2 PS, so for me this is a great software.
Thanks a lot!!!
February 1st, 2007 at 8:42 pm
wangtang: I don’t know of any way to switch back to DS mode once the GBA BIOS has been loaded and the DS is in GBA mode, so I’m not sure that’s possible.
cory1492: Thanks for the tip and the code, I’ll have to have a look at it. I was going off the information in the NDSTech wiki as to where the copy of the personal settings was stored, and it seemed to work on my DS’s (then again they both have FlashMe V7 installed).
February 6th, 2007 at 4:21 am
How to replace black border of GBA games on DS with an image.
http://scdev.org/forum/viewtopic.php?t=5192&start=60
February 15th, 2007 at 8:59 pm
Have you perhaps heard of cartreset? It allows you to boot a slot-2 and is in the form of an nds rom. Works seamlessly on my DS-x w/ a G6 Lite. It was a bit hard to find, but if you search for ‘cartreset.zip’ you should be able to find it in the DS-x forums. I recall the coder also created LoveLite.
February 21st, 2007 at 3:35 pm
Hi, nice mini-app
Do you have any idea how to switch back to the NDS main menu from an NDS app ?
The (slot1) flash cart I use boots straight into its loader rather than allowing the option to go to the main NDS menu, and I’d like an app to load via the loader but make it return to the main NDS menu (with pictochat/download-play etc available).
February 27th, 2007 at 1:19 am
wangtang: If that was possible then there would be no market for pass-card devices (or the various new Slot1 carts). Any slot2 flash cart would be able to boot in GBA mode, switch to DS mode, and load NDS games from a Slot2 cart. It’s something that Nintendo protected fairly well, and as far as I know noone has been able to work around it (except for by booting from Slot1 using either a passcard device or a slot1 card, or re-flashing their DS bios)
April 3rd, 2007 at 3:44 am
could you some how have a border injecter so when we use your gba switch we can use a nice border instead of seeing the black space around the games?
April 6th, 2007 at 8:25 pm
This is great! I was looking for something like this. What release of DKA does this work on?
April 9th, 2007 at 5:39 pm
[…] Here’s the newest build of GBAMP Multiboot . It adds the ability to boot the GBAMP in to GBA mode. The GBA booting code I was using was outdated and didn’t compile with my environment so you must use a 3rd party GBA booter such as HyperHacker’s or RyanFB’sĀ and rename it gbaboot.nds and put it at the root of your card. The program is pretty self explanitory when you load it up. […]
April 10th, 2007 at 10:24 pm
This is a very useful little program… thanks! I agree with Shadow, though… being able to use ‘frames’ for GBA mode would make this utility perfect!
May 19th, 2007 at 4:36 am
Can anyone compile this in PALib? I’m using PALib for an app, and I would like to add a ‘Boot GBA’ option.
June 10th, 2007 at 10:12 am
I’ve updated this code to work with the latest devkitARM & libnds, get it here:
ARM7
http://paste.uni.cc/16216
ARM9
http://paste.uni.cc/16217
July 1st, 2007 at 4:36 pm
I’m betting I sound like a complete idiot when I say this but
can you run GBA roms like this?
(I have a slot-1 R4/M3 simply)
July 12th, 2007 at 3:14 am
Chuckstudios I can’t compile that code with the lastest Devkit.
Can you give me an advice for it ? What is the template for this code ? My attempts always failed. Thanks
September 19th, 2007 at 10:04 am
im having the same issue as Hiryu posted a few months back. ive seen other people with m3 perfects and their nds’ load into the normal nds start screen but my passcard loads straight into m3. id really like to be able to start off with the option of choosing whether to load m3 or play with the settings, pictochat etc without having to eject the passcard every time. any suggestions?
February 2nd, 2008 at 10:38 am
Thank you for this great app!
i have a problem with using this with my m3 real
I put the downloaded nds file with the code in the root
when this code/nds file is launched it loads which ever gba rom was recently played / stored in the gba expansion ram and says “loading…” on the screen
March 15th, 2008 at 11:10 am
fuzoid: i highly doubt that you would be able to use roms, but its possible