#41232 - josath - Tue Apr 26, 2005 6:23 pm
Ok, if you have a flash cart that does bank switching, and you know how, you can easily boot from ds into gba mode.
for example, on the flash cart, put a small loader at the front that boots in DS mode, than switches the bank so 0x08000000 points at the beginning of the GBA rom, then call the trick to reset to gba mode
Code: |
mov r2, #0x40
ldr r12, =0x11B8 @ call some routine in the bios
bx r12 |
And you will seen the gba boot logo, then the bin starts, because it's mapped to the right place.
The thing is, the other screen stays on. I'm thinking the ARM9 might continue to run while the arm7 runs in gba mode.
If this is true, it opens up possibilities. Imagine a gameshark that runs on the touchscreen, and you control with the stylus, that runs at the same time as the gba game runs on the top screen.
I'm sure others can come up with ideas for this.
So the questions are:
1. Does the ARM9 continue to run independantly when the ARM7 is switched to gba mode? Or does it shut down?
2. What part of ram is used by the ARM7 in gba mode? I need to know, that way the ARM9 code in ram doesn't get overwritten by the gba bin running on the ARM7. I'd think it would either be the beginning or the end of ram. GBA has 256kbytes of ram right?
#41281 - darkfader - Wed Apr 27, 2005 2:34 am
Heard that idea before. The display backlight is controlled by the power management chip. And there's little that you can do with that :P
Just turn off one display and swap accordingly to the setting.
0x27FFCE4, bit 3, GBA mode screen selection. 0=upper, 1=lower
#41360 - josath - Wed Apr 27, 2005 10:17 pm
after some testing, it looks like one of two things is happening when switching to gba mode:
1. ARM9 being shut off
2. All of main ram being cleared, so ARM9 has nothing to execute
either way, both of the displays are cleared, EXCEPT for about 10 pixels on the left & right of the gba screen, inside the black border.
http://rorexrobots.com/ds/test.png some test patterns in ds mode, turns into this after switching to gba mode:
http://www.pocket-dev.org/bug.PNG ( a mockup, but accurate )
So fancy tricks like i was thinking about above, doesn't look to be possible.
However, making a menu/loader that can load both .nds and .gba files, is a definite possibility, if you know the bankswitching code for your flashcart.
#41462 - dagamer34 - Thu Apr 28, 2005 7:41 pm
So does this work properly?
_________________
Little kids and Playstation 2's don't mix. :(
#41470 - josath - Thu Apr 28, 2005 9:59 pm
It's possible to switch from DS mode into GBA mode and have it run a gba rom, but only if you know how to bankswitch on your flashcart.
I couldn't find any way of keeping the ARM9 running once you switch into gba mode.
#45438 - TheChuckster - Fri Jun 10, 2005 6:13 pm
You think Darkain could have this in his loader?
#45443 - josath - Fri Jun 10, 2005 6:38 pm
I already said it twice, want me to say it again:
It's possible to switch from DS mode into GBA mode and have it run a gba rom, but only if you know how to bankswitch on your flashcart.
Maybe you want me to clarify:
Bankswitching code is known for some of the flashcarts, but not all. So you'd have to add support for flashcarts one at a time, and would never be able to support them all.
#45450 - dovoto - Fri Jun 10, 2005 7:30 pm
perhaps a flash cart library should be started and maintained and a standard for accessing carts could be created.
FlashCartInit("xgFlash");
FlashCartSwitchBank(blah..);
Would not support all the cards but at least the info for the cards we do know could be localized.
_________________
www.drunkencoders.com
#45451 - josath - Fri Jun 10, 2005 7:34 pm
dovoto wrote: |
perhaps a flash cart library should be started and maintained and a standard for accessing carts could be created.
FlashCartInit("xgFlash");
FlashCartSwitchBank(blah..);
Would not support all the cards but at least the info for the cards we do know could be localized. |
That's kinda how pogoshell for gba works actually. if you want pogoshell to support a new flash cart, you just have to write the functions for switching the banks and jumping to an address i think, and then drop it in.
#45489 - tepples - Sat Jun 11, 2005 5:22 am
Problem is that a lot of the flash equipment manufacturers are more into wanton copyright infringement of commercial games than into homebrew, and they publicly choose not to release hardware specs to homebrewers, not even enough to bankswitch the card's ROM and SRAM. I'm looking at you, Borden of EZFA.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#45512 - cory1492 - Sat Jun 11, 2005 12:06 pm
tepples wrote: |
they publicly choose not to release hardware specs to homebrewers, not even enough to bankswitch the card's ROM and SRAM. I'm looking at you, Borden of EZFA. |
Too true, they don't want to release the info and have POGO work on all carts properly, now do they... I think they like the extra hits to their sites while users are waiting for new bootloaders...
from:
http://forum.gbadev.org/viewtopic.php?t=6003
tepples wrote: |
And by that time, you're trying to do exactly what they're talking about in this topic. Please take discussion there. |
Actually I was attempting to do something similar to what is done with a GBA .mb file, wrather than ask a question about keeping the ARM9 going after the reset. Had I known that the RAM (apparently) gets cleared by calling Code: |
mov r2, #0x40
ldr r12, =0x11B8 @ call some routine in the bios
bx r12 |
and that some extra code is actually required to shut off one of the screens beyond that snippet, I may have not even bothered to ask. So thanks for the aim at this info.
Does anyone know what that assembly is doing and can explain a little better than "call some routine in the bios", is it calling any old routine in the gba bios? do registers survive the soft reset to GBA mode? is that just the assembly for what is done when you press GBA on the DS user menu screen/app? is there some little piece of info that I missed somewhere else that would enlighten me so I can intuit these answers on my own?
I'd wrather do it the easy way with bankswitching, but I dont have the F2A Ultra's bankswitching beyond what is in POGO (up to 512MBit f2au IIRC, somewhere. I have a 1024MBit one so...) if I did have the bankswitching code and understood how to setup the bankswitching from already running DS code, and also had darkains source to his bootloader I just may attempt that, but thats alot of ifs, which lead me to start looking into other ways of doing the same thing.
I have no way of making the bootloaders position static on the cart other than putting it at the beginning of the cart, or within a DS app/load stub of fixed length so the location would have to be patched when the cart is burned if it was to be that way... which as I also said in the other thread will destroy ingame resets that are meant to go back to the bootloader.
josath wrote: |
Ideally, what you'd do is use your carts bank/offset switching registers to make the beginning of gba rom (0x080..) point to a gba rom. this probably WONT work with gba menus/bootloaders, as they most likely expect themselves to be at the beginning of the rom and might get confused if they are not. |
actually, as I stated in the other thread, the F2A Ultra loader does not need to be or care if its the first rom on the cart, it uses a content descriptor in the "virtual" SRAM (IIRC) to describe the locations of data on the cart.
#45523 - NEiM0D - Sat Jun 11, 2005 3:46 pm
The bios only does this:
Code: |
#define REG_HALT *(vu8*)0x04000301
void ToGBAMode(void)
{
REG_HALT = 0x40;
(nop)
(nop)
return;
}
|
REG_HALT is a CPU controlling register.
You can't set REG_HALT yourself either, it must be set using the BIOS.
#45584 - cory1492 - Sun Jun 12, 2005 8:40 am
it occurs to me now that the code in pogoshell for bankswitching should be sufficient, since the DStoGBAf2au+origional loader couldbe contained inside of the gbfs of darkains loader, all that would really be needed is a little bit of DS code that sets the bankswitching like pogo does, and takes the beginning of the loader appended to the chunk of code using cat or copy /b (which the loader will "know" its own size and set the bankswitch to the first place after the beginning of itself by using the offset of the location in gbfs+the DS code size), and all without a modded darkain loader... gonna give it a shot now.
Thanks for that bit of c code NEiM0D, nice to see a straigt forward explanation of it, now all I gotta do is figure out how to include that and Darkfaders bit to turn off the screen...