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.

Coding > exec() call?

#163650 - moonlightcheese - Tue Oct 07, 2008 8:51 pm

is there a library for executing binaries from a running program? i poked around and found chishm's exec stub but nothing specific to the gba...

#163652 - Griffin - Tue Oct 07, 2008 9:01 pm

Wouldn't you just branch to the start of the code you wanted to run?

#163654 - silent_code - Tue Oct 07, 2008 9:24 pm

There is no operarting system. ;^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#163657 - Miked0801 - Tue Oct 07, 2008 9:38 pm

Sure:
Code:

    b foo

#163733 - tepples - Fri Oct 10, 2008 1:47 am

Miked0801's suggestion may require the use of a custom link script (to put code into EWRAM at foo) or possibly -fPIC (to make code that takes a speed/size hit in favor of being able to run from any location in IWRAM, EWRAM, or VRAM).

Here's what my Multiboot Menu does:
  • Make some sort of file system in ROM space (such as GBFS, PogoShell FS, FCSR, or Zip Store).
  • Using code in IWRAM or ROM, copy .mb binaries to the start of EWRAM.
  • Clear everything but IWRAM and EWRAM using RegisterRamReset(0xFC).
  • Jump to the IWRAM entry point.

Really, the solution depends on what kind of "binaries" moonlightcheese wants to run.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.