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.

ASM > THUMB to ARM code

#21601 - Lord Graga - Tue Jun 01, 2004 7:14 pm

Hey all!

I know that to switch to THUMB from ARM, I must use this code:
Code:
;NOTE THAT THIS IS ARM SDT ASSEMBLER CODE
ADR     r0, start + 1        BX      r0
NOP     ; These are probably not needed, but I can't start experimenting with them until the code compiles
NOP
CODE16
But, what if I wanna switch back?

It doesn't matter if your code example is in GCC ASM, I think that I can translate it.

#21609 - poslundc - Tue Jun 01, 2004 9:03 pm

You can switch back the same way you switch in; just don't add 1 to the PC and use CODE32 instead of CODE16. I don't think you should need the nops, since the branch will flush the pipeline. Don't hold me to that, though.

Dan.