r/EmuDev • • 9d ago

GBA Can't call subroutine from a linked in object file in GBA assembly

/r/Assembly_language/comments/1y299i6/cant_call_subroutine_from_a_linked_in_object_file/
3 Upvotes

3 comments sorted by

1

u/CAPTAINCAPSLOCK111 2d ago

One thing I’d check is the ARM/Thumb state at main. With .include, assembler directives from the header affect the code that follows. Once you assemble the files separately, that state doesn’t carry over. Make the intended mode explicit in each file and mark Thumb function entries appropriately. Then step through the call in mGBA and check both the destination and CPU mode. The address being right doesn’t prove the instructions are being decoded in the right mode.

1

u/tinymoat 2d ago

Hey, thanks for the reply. I ended up figuring it out, and that was exactly the problem!

1

u/CAPTAINCAPSLOCK111 2d ago

Glad you tracked it down! Thanks for coming back to confirm the cause; that makes the thread useful for the next person who hits it.