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 > ADRL restriction in DevKitPRO

#177856 - WriteASM - Tue Apr 09, 2013 2:03 pm

I'm using DevKitPRO for ASM GBA development, but couldn't figure out why the following code wasn't working:
Code:
adrl r0, ARMInter      @ Start the Interpreter over again.

DevKitPRO would always say, "undefined symbol ARMInter used as an immediate value", even though it was defined as GLOBAL in the appropriate code file. Then I found the following in "as.info":

Quote:
`ADRL'
adrl <register> <label>

This instruction will load the address of LABEL into the indicated
register. The instruction will evaluate to one or two PC relative
ADD or SUB instructions depending upon where the label is located.
If a second instruction is not needed a NOP instruction will be
generated in its place, so that this instruction is always 8 bytes
long.

If the label is out of range, or if it is not defined in the same
file (and section) as the ADRL instruction, then an error will be
generated
. This instruction will not make use of the literal pool.


Does anyone know exactly why the restriction is there? Or a way around it? (It's also on ADR.)
In my opinion, DevKitPRO would be much better off without that restriction. I'm writing the address to the return stack, and don't want to use "LDR R0, =ARMInter", as then the code isn't relocatable.

(I'm using multiple code files so that I don't have one 14,272-line file, which would be a little unmanageable, to say the least.)
_________________
"Finally, brethren, whatever is true, whatever is honorable, whatever is right, whatever is pure, whatever is lovely, whatever is of good repute, if there is any excellence and if anything worthy of praise, dwell on these things." (Philippians 4:8)

#177857 - Dwedit - Tue Apr 09, 2013 2:05 pm

For a while, I was using #include to work around those problems. One ASM file includes everything else.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."