[OpenVMS documentation]
[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
Updated: 11 December 1998

VAX MACRO and Instruction Set Reference Manual


Previous Contents Index


JMP

Jump

Format

opcode dst.ab

Condition Codes

N|| <--- N;  
Z|| <--- Z;  
V|| <--- V;  
C|| <--- C;  

Exceptions

Opcodes

17 JMP Jump

Description

The program counter (PC) is replaced by the destination operand.

JSB

Jump to Subroutine

Format

opcode dst.ab

Condition Codes

N|| <--- N;  
Z|| <--- Z;  
V|| <--- V;  
C|| <--- C;  

Exceptions

Opcodes

16 JSB Jump to Subroutine

Description

The program counter (PC) is pushed onto the stack as a longword. The PC is replaced by the destination operand.

Note

Because the operand specifier conventions cause the evaluation of the destination operand before saving the PC, you can use JSB for coroutine calls with the stack used for linkage. The form of this call is:

JSB @(SP)+ 


RSB

Return from Subroutine

Format

opcode

Condition Codes

N|| <--- N;  
Z|| <--- Z;  
V|| <--- V;  
C|| <--- C;  

Exceptions

Opcodes

05 RSB Return from Subroutine

Description

The program counter (PC) is replaced by a longword popped from the stack.

Notes

  1. Use RSB to return from subroutines called by the BSBB, BSBW, and JSB instructions.
  2. RSB is equivalent to JMP @(SP)+, but is 1 byte shorter.

SOBGEQ

Subtract One and Branch Greater Than or Equal

Format

opcode index.ml, displ.bb

Condition Codes

N|| <--- index LSS 0;  
Z|| <--- index EQL 0;  
V|| <--- {integer overflow};  
C|| <--- C;  

Exceptions

Opcodes

F4 SOBGEQ Subtract One and Branch Greater Than or Equal

Description

One is subtracted from the index operand, and the index operand is replaced by the result. If the index operand is greater than or equal to zero, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result.

Notes

  1. Integer overflow occurs if the index operand before subtraction is the largest negative integer. On overflow, the index operand is replaced by the largest positive integer; therefore, the branch is taken.
  2. The C-bit is unaffected.

SOBGTR

Subtract One and Branch Greater Than

Format

opcode index.ml, displ.bb

Condition Codes

N|| <--- index LSS 0;  
Z|| <--- index EQL 0;  
V|| <--- {integer overflow};  
C|| <--- C;  

Exceptions

Opcodes

F5 SOBGTR Subtract One and Branch Greater Than

Description

One is subtracted from the index operand, and the index operand is replaced by the result. If the index operand is greater than zero, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result.

Notes

  1. Integer overflow occurs if the index operand before subtraction is the largest negative integer. On overflow, the index operand is replaced by the largest positive integer, and thus, the branch is taken.
  2. The C-bit is unaffected.

9.2.5 Procedure Call Instructions

The following three instructions implement a standard procedure calling interface:

CALLG and CALLS call the procedure. The RETURN instruction returns from the procedure. Refer to the OpenVMS Programming Interfaces: Calling a System Routine for the procedure calling standard.

The CALLG instruction calls a procedure with the argument list in an arbitrary location.

The CALLS instruction calls a procedure with the argument list on the stack. Upon return after a CALLS instruction, this list is automatically removed from the stack. Both call instructions specify the address of the entry point of the procedure being called. The entry point is assumed to consist of a word called the entry mask followed by the procedure's instructions. The procedure terminates by executing a RET instruction.

The entry mask specifies the register use and overflow enables of the subprocedure.


At the occurrence of one of the call instructions, the stack is aligned to a longword boundary, and the trap enables in the processor status longword (PSW) are set to a known state to ensure consistent behavior of the called procedure. Integer overflow enable and decimal overflow enable are affected according to bits 14 and 15 of the entry mask, respectively. Floating underflow enable is cleared. Registers R11 to R0, specified by bits 11 to 0, respectively, are saved on the stack and are restored by the RET instruction. In addition, the program counter (PC), stack pointer (SP), frame pointer (FP), and argument pointer (AP) are always preserved by the CALL instructions and restored by the RET instruction.

All external procedure calls generated by standard Digital language processors and all intermodule calls to major VAX software subsystems comply with the procedure calling software standard (see the VAX Procedure Calling and Condition Handling Standard in the OpenVMS Programming Interfaces: Calling a System Routine). The procedure calling standard requires that all registers in the range R2 to R11 used in the procedure must appear in the mask. R0 and R1 are not preserved by any called procedure that complies with the procedure calling standard.

To preserve the state, the CALL instructions form a structure on the stack termed a call frame or stack frame. The call frame contains the saved registers, the saved PSW, the register save mask, and several control bits. The frame also includes a longword that the CALL instructions clear. The system uses this longword to implement the OpenVMS condition handling facility (see the VAX Procedure Calling and Condition Handling Standard in the OpenVMS Programming Interfaces: Calling a System Routine). At the end of execution of the CALL instruction,the frame pointer (FP) contains the address of the stack frame. The RET instruction uses the contents of FP to find the stack frame and the restore state. The condition handling facility assumes that FP always points to the stack frame.

The stack frame has the following format:


Note that the saved condition codes and the saved trace enable (PSW<T>) are cleared.

The contents of the frame PSW<3:0> at the time RET is executed will become the condition codes resulting from the execution of the procedure. Similarly, the content of the frame PSW<4> at the time the RET is executed will become the PSW<T> bit.

The following instructions are described in this section.
  Description and Opcode Number of Instructions
1. Call Procedure with General Argument List
CALLG arglist.ab, dst.ab, {-(SP).w*}
1
2. Call Procedure with Stack Argument List
CALLS numarg.rl, dst.ab, {-(SP).w*}
1
3. Return from Procedure
RET {(SP)+.r*}
1


CALLG

Call Procedure with General Argument List

Format

opcode arglist.ab, dst.ab

Condition Codes

N|| <--- 0;  
Z|| <--- 0;  
V|| <--- 0;  
C|| <--- 0;  

Exceptions

Opcodes

FA CALLG Call Procedure with General Argument List

Description

The stack pointer (SP) is saved in a temporary register. Bits 1:0 are replaced by zero, so that the stack is longword aligned. The procedure entry mask is scanned from bit 11 to bit 0, and the contents of registers whose numbers correspond to set bits in the mask are pushed on the stack as longwords. The program counter (PC), frame pointer (FP), and argument pointer (AP) are pushed on the stack as longwords. The condition codes are cleared. A longword containing the saved low 2 bits of the SP in bits 31:30, a zero in bits 29 and 28, the low 12 bits of the procedure entry mask in bits 27:16, and the processor status word (PSW) in bits 15:0 with T cleared are pushed on the stack. A longword zero is pushed on the stack. The FP is replaced by the SP. The AP is replaced by the arglist operand. 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. The T-bit is unaffected. The 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 zero, a reserved operand fault occurs.
  2. On a reserved operand fault, condition codes are UNPREDICTABLE.
  3. The procedure calling standard and the condition handling facility require the following register saving conventions:
    Refer to the VAX Procedure Calling and Condition Handling Standard in the OpenVMS Programming Interfaces: Calling a System Routine.

CALLS

Call Procedure with Stack Argument List

Format

opcode numarg.rl, dst.ab

Condition Codes

N|| <--- 0;  
Z|| <--- 0;  
V|| <--- 0;  
C|| <--- 0;  

Exceptions

Opcodes

FB CALLS Call Procedure with Stack Argument List

Description

The numarg operand is pushed on the stack as a longword (byte 0 contains the number of arguments; Digital software uses the high-order 24 bits). The stack pointer (SP) is saved in a temporary register, and then bits 1:0 of the SP are replaced by zero so that the stack is longword aligned. The procedure entry mask is scanned from bit 11 to bit 0, and the contents of registers whose numbers correspond to set bits in the mask are pushed on the stack. The program counter (PC), frame pointer (FP), and argument pointer (AP) are pushed on the stack as longwords. The condition codes are cleared. A longword containing the saved low 2 bits of the SP in bits 31:30, a 1 in bit 29, a zero in bit 28, the low 12 bits of the procedure entry mask in bits 27:16, and the processor status word (PSW) in bits 15:0 with T cleared is pushed on the stack. A longword zero is pushed on the stack. The FP is replaced by the SP. The AP is set to the value of the stack pointer after the numarg operand was pushed on 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. The T-Bit is unaffected.

The 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. The appearance of the stack after CALLS is executed is:


Notes

  1. If bits 13:12 of the entry mask are not zero, a reserved operand fault occurs.
  2. On a reserved operand fault, the condition codes are UNPREDICTABLE.
  3. 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 automatically.
  4. The procedure calling standard and the condition handling facility require the following register saving conventions:

RET

Return from Procedure

Format

opcode

Condition Codes

N|| <--- tmp1<3>;  
Z|| <--- tmp1<2>;  
V|| <--- tmp1<1>;  
C|| <--- tmp1<0>;  

Exceptions

Opcodes

04 RET Return from Procedure

Description

The stack pointer (SP) is replaced by the frame pointer (FP) plus 4. A longword containing stack alignment bits in bits 31:30, a CALLS/CALLG flag in bit 29, the low 12 bits of the procedure entry mask in bits 27:16, and a saved processor status word (PSW) in bits 15:0 is popped from the stack and saved in a temporary. The program counter (PC), frame pointer (FP), and argument pointer (AP) are replaced by longwords popped from the stack. A register restore mask is formed from bits 27:16 of the temporary. Scanning from bit 0 to bit 11 of the restore mask, the contents of registers whose numbers are indicated by set bits in the mask are replaced by longwords popped from the stack. The SP is incremented by 31:30 of the temporary. The PSW is replaced by bits 15:0 of the temporary. If bit 29 in the temporary is 1 (indicating that the procedure was called by CALLS), a longword containing the number of arguments is popped from the stack. Four times the unsigned value of the low byte of this longword is added to the SP, and the SP is replaced by the result.

Notes

  1. A reserved operand fault occurs if tmp1<15:8> NEQ 0.
  2. On a reserved operand fault, the condition codes are UNPREDICTABLE.
  3. The value of tmp1<28> is ignored.
  4. The procedure calling standard and condition handling facility assume that procedures which return a function value or a status code do so in R0, or R0 and R1. Refer to the VAX Procedure Calling and Condition Handling Standard in the OpenVMS Programming Interfaces: Calling a System Routine.

9.2.6 Miscellaneous Instructions

The following instructions are described in this section.
  Description and Opcode Number of Instructions
1. Bit Clear PSW
BICPSW mask.rw
1
2. Bit Set PSW
BISPSW mask.rw
1
3. Breakpoint Fault
BPT {-(KSP).w*}
1
4. Halt
HALT {-(KSP).w*}
1
5. Index
INDEX subscript.rl, low.rl, high.rl,
size.rl, indexin.rl, indexout.wl
1
6. Move from PSL
MOVPSL dst.wl
1
7. No Operation
NOP
1
8. Pop Registers
POPR mask.rw, {(SP)+.r*}
1
9. Push Registers
PUSHR mask.rw, {-(SP).w*}
1
10. Extended Function Call
XFC {unspecified operands}
1

BICPSW

Bit Clear PSW

Format

opcode mask.rw

Condition Codes

N|| <--- N AND {NOT mask<3>};  
Z|| <--- Z AND {NOT mask<2>};  
V|| <--- V AND {NOT mask<1>};  
C|| <--- C AND {NOT mask<0>};  

Exceptions

Opcodes

B9 BICPSW Bit Clear PSW

Description

The result of the logical AND on processor status word (PSW) and the one's complement of the mask operand replaces PSW.

Note

A reserved operand fault occurs if mask<15:8> is not zero. On a reserved operand fault, the PSW is not affected.


BISPSW

Bit Set PSW

Format

opcode mask.rw

Condition Codes

N|| <--- N OR mask<3>;  
Z|| <--- Z OR mask<2>;  
V|| <--- V OR mask<1>;  
C|| <--- C OR mask<0>;  

Exceptions

Opcodes

B8 BISPSW Bit Set PSW

Description

The result of the logical OR on processor status word (PSW) and the mask operand replaces PSW.

Note

A reserved operand fault occurs if mask<15:8> is not zero. On a reserved operand fault, the PSW is not affected.


Previous Next Contents Index

[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
[OpenVMS documentation]

Copyright © Compaq Computer Corporation 1998. All rights reserved.

Legal
4515PRO_020.HTML