As per Philippe's email:
"However, it is possible to simulate a 32 bit relative
branch. Some compiler implement it with the following
sequence of instructions :
pea 12(pc) ; push return address (the instruction
that follows the rts below)
pea (pc) ; push the current program counter
addi.l #-52466,(a7) ; add or substract a relative 32
bit value
rts ; jump to the computed address on the stack
But this require 14 bytes instructions instead of 4 and
OnboardC does not implement it."
IMHO this would be a great thing to implement, and
would mean people could write larger programs more
easily and without having to use multiple segments.
Not 100% sure how to implement though, since the jump
sequence is generated by OnBC, and the distance of the
jump is not known until OnBA does the linking. It would
be a Bad Thing (IMHO) to always use the long jump, so
a smarter solution would be needed. Perhaps OnBA could
spot that the jump is > 32k, then generate the extra
code.
Not sure how simple that would be to implement though,
and it's a bit of a hack, since OnBA should not change
the code that's been generated....
Logged In: YES
user_id=583634
Possibly some kind of #pragma syntax could be used to allow
the programmer to specify that a long function call should be
used?
for example:
myval = some_func(arg1,arg2) #pragma longcall;
This way OnBC knows to generate a long call sequence.
Logged In: YES
user_id=583634
This can be done even more easily now: (since OnBA gained
absolute addressing mode for lea...)
lea func_name_00, a1
jsr (a1)
done. No need to push return address, and only one extra
instruction (6 bytes?)