Trying to run a headerless PSYQ .exe from ROM in PSYQ
Posted: February 24th, 2020, 5:37 pm
e.g.
ROM @$1f800000 -> $1F020690
EXE @$1f020690 -> $something
The .exe works fine normally (as in, with a header in the $8000 range) and is identical whether built with /P (binary output) or if you strip the $800 header out.
Startup on the left (essentially replicating GCC's crt0)
Linker on the right - with the data and text groups defined separately:
Note: 'org' completely ignored if you manually define every section
E.g. you can org any random value and the resultant .exe is identical

It gets decently far into my C code:
-> Boot @ 1F000000
-> Loads address of the incbin'd .exe and jr t0's there
-> Loads the .crt0 (.global in IDA)
-> makes it into main() and over a few variable initalisations
-> hangs on ResetGraph(0)
Adding the asm chunk to copy ROM sections into RAM didn't seem to help at all.
Note: i'm aware it's copying readonly chunks, but it was easier to copy one massive chunk for testing
Can this even be done in PSYQ?
E.g. we have the .bss and .sbss sections - .sbss seems to work
Adding some dummy bytes for .sdata for example fixed the
la $gp,0
issue, but that's as far as I've got.
Doing something like this
(or the other way around - leaving bss undefined and defining .text)

Throws this error

Any way to debug this? Just a bit lost right now.
Any tips would be appreciated
Cheers =)
ROM @$1f800000 -> $1F020690
EXE @$1f020690 -> $something
The .exe works fine normally (as in, with a header in the $8000 range) and is identical whether built with /P (binary output) or if you strip the $800 header out.
Startup on the left (essentially replicating GCC's crt0)
Linker on the right - with the data and text groups defined separately:
Note: 'org' completely ignored if you manually define every section
E.g. you can org any random value and the resultant .exe is identical

It gets decently far into my C code:
-> Boot @ 1F000000
-> Loads address of the incbin'd .exe and jr t0's there
-> Loads the .crt0 (.global in IDA)
-> makes it into main() and over a few variable initalisations
-> hangs on ResetGraph(0)
Adding the asm chunk to copy ROM sections into RAM didn't seem to help at all.
Note: i'm aware it's copying readonly chunks, but it was easier to copy one massive chunk for testing
Can this even be done in PSYQ?
E.g. we have the .bss and .sbss sections - .sbss seems to work
Adding some dummy bytes for .sdata for example fixed the
la $gp,0
issue, but that's as far as I've got.
Doing something like this
(or the other way around - leaving bss undefined and defining .text)

Throws this error

Any way to debug this? Just a bit lost right now.
Any tips would be appreciated
Cheers =)