When the assembler program is the caller, R13 must point to the caller's register save area (18 words), and the first 2 bytes of the save area must be zero. The save area back chain must be set with a valid 31-bit address. (That is, the high-order byte must be cleared when running AMODE 24.)
LA 13, SAVEAREA
.
.
.
SAVEAREA DS 18F
as this will ensure that the high-order byte
is cleared for AMODE 24 programs.BAS 13,SKIP SAVEAREA DS 18F SKIP DS 0H
BAL 13,SKIP SAVEAREA DS 18F SKIP LA 13,0(,13)
The BAL instruction puts the instruction length code, the condition code (CC), and the program mask in the high-order byte of the register. We recommend using the BAS instruction instead of the BAL instruction, since the BAS instruction places zeros in the high-order byte, thus preventing the 24-bit addressing problem.
If the program passes parameters, a parameter list must be prepared, and the address of this list loaded into R1. R1 must be set to zero if no parameter list is passed. R14 must contain the return address in the assembler program, and R15 must contain the address of the entry point of the COBOL program.