Pointer-defined linkage is a convention whereby
programs can transfer control back and forth without having to know
each other's AMODEs. Pointer-defined linkage is simple and efficient.
You should use it in new or modified modules where there might be
mode switching between modules.
Pointer-defined linkage uses a
pointer-defined
value, which is a 4-byte area that contains both an AMODE indicator
and an address. The high-order bit contains the AMODE; the remainder
of the word contains the address. To use pointer-defined linkage,
you must:
- Use a pointer-defined value to indicate the entry point address
and the entry point's AMODE. (The LOAD macro provides a pointer-defined
value.)
- Use the BASSM instruction specifying a register that contains
the pointer-defined value. BASSM saves the caller's AMODE and next
the address of the next sequential instruction, sets the AMODE of
the target routine, and branches to the specified location.
- Have the target routine save the full contents of the return register
and use it in the BSM instruction to return to the caller.