SPRAB89A September 2011 – March 2014
The call itself is generated as a simple PC-relative branch that transfers control to the callee:
B func ; goto func
The displacement is a 21-bit signed word offset. If the destination is unreachable, the linker generates a trampoline, which is a stub function that uses absolute, PC-relative, or GOT-indirect addressing to address the destination function. For more information about trampolines see Section 5.4.
For an indirect call, the destination is a register:
B reg ; goto address in reg
For branches that implement calls, the TI toolchain uses the CALL pseudo-instruction, which encodes as a branch but annotates the debug information so that profilers, debuggers, or other analysis tools can identify the instruction as a function call (see Section 5.4). So the previous direct call would actually appear in the assembly source as:
CALL func ; encodes as B func
The C64+ ISA has a composite instruction CALLP that single-handedly implements a call. CALLP integrates these steps:
A call using CALLP is simply:
CALLP func, B3