CALLS Instruction

Purpose:To invoke a procedure with arguments located on the stack.
Format:opcode numarg.rl, dst.ab
Operation: {Push arg count};
{align stack};
{create stack frame};
{set arithmetic trap enables};
{set new values of AP, FP, PC};
Condition
Codes:
N <- 0;
Z <- 0;
V <- 0;
C <- 0;
Exceptions:Reserved Operand
Opcodes:
FBCALLSProcedure with Stack Argument list
Description: The number of arguments operand is pushed onto the stack as a long word. SP is saved in a temporary and then bits 1:0 are replaced by 0 so that the stack is long word aligned. The procedure entry mask is scanned from bit 11 to 0 and the contents of the registers whose number corresponds to set bits in the mask are pushed on the stack as long words. PC, FP and AP are pushed on the stack as longwords. The condition codes are cleared. A longword containing the saved two low bits of SP in bits 31:30, a 1 in bit 29 and a 0 in bit 28, the low 12 bits of the procedure entry mask in bits 27:16 and the PSW in bits 15:0 with T cleared is pushed onto the Stack. A longword 0 is pushed onto the stack. FP is replaced by SP. AP is replaced by the saved SP (the value of the stack pointer after the number of arguments operand was pushed onto the stack). The trap enables in the PSW are set to a known state. Integer overflow, and decimal overflow are affected according to bits 14 and 15 of the entry mask respectively; floating underflow is cleared. T-bit is unaffected. PC is replaced by the sum of destination operand plus 2 which transfers control to the called procedure at the byte beyond the entry mask.
Notes:
1.
If bits 13:12 of the entry mask are not 0, a reserved operand fault occurs.
2.
On a reserved operand fault, the condition codes are unpredictable.
2.
The procedure calling standard and the condition handling facility require the following register saving conventions. R0 and R1 are always available for function return values and are never saved in the entry mask. All registers R2 through R11 which are modified in the called procedure must be preserved in the mask.
2.
Normal use is to push the arglist onto the stack in reverse order prior to the CALLS. On return, the arglist is removed from the stack by the RET instruction.