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 development > Loading a Binary into ram and Executing it.

#149240 - TwentySeven - Thu Jan 17, 2008 3:12 am

What I'd like to be able to do is to build a .nds (both arm7 and arm9) that can load another special seperately compiled arm9 executable binary *into ram only* and then execute it.

My current working premise is that you'd have a "stub" .nds (about 200-300k or so) that would possibly be modified to load itself "high" into ram, lets say at the 3MB mark.

Then the stub would download (or read from the cart) and store the new "child" executable in ram at 0x0000, and hand execution over to it.

This would effectively destroy the stub, which is desirable.

My current question: (assuming this is feasible!)
Is it possible to modify the current libnds .nds compiles to build a stub that starts high in ram leaving 0x000 onwards free? Does anyone have experience with this?

#149245 - knight0fdragon - Thu Jan 17, 2008 4:35 am

it is feasable, look for chishms exec stub
_________________
http://www.myspace.com/knight0fdragonds

MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206

#149246 - DekuTree64 - Thu Jan 17, 2008 4:42 am

You'll probably need to fiddle with link scripts, but it shouldn't be too difficult. Maybe just changing the EWRAM memory region start to 0x2300000 and size to 1MB would do it.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#149247 - TwentySeven - Thu Jan 17, 2008 5:13 am

Thanks for the tips, Ill post here when I have an update.

#149254 - PypeBros - Thu Jan 17, 2008 9:58 am

the alternative is to copy your stub in VRAM and execute it there, meaning that you don't have to worry at all about the start address of your loaded binary...

Well, you might have good reasons to want it stay resident in normal RAM, of course ^_^
_________________
SEDS: Sprite Edition on DS :: modplayer