Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

RETRN - Load return with register

&pagelevel(3)&pagelevel

General

Application area:

Starting, interrupting and terminating; see "Starting, interrupting and terminating"

Macro type:

Type O; see "O-type macros"

Macro description

The RETRN macro serves to reload saved register contents, to return from a subroutine to the main program and to pass on a return code, if desired.
The RETRN macro is issued at the end of a subroutine if, at the beginning of that subroutine, the registers of the main program were saved by means of the SAVE macro. Except for register 13, all general register contents can be buffered and reloaded. The address of the save area supplied by the main program must be contained in register 13 (see the SAVE macro).

Macro format and description of operands

RETRN

[(r1[,r2])] [,T] [,RC=rc / (15)

r1
Specifies a register (general register) that is to be loaded from the save area. Numbers between 0 and 15 (except 13) may be specified for “r1”. The parentheses are optional.

r1,r2
Specifies a consecutive series of general registers which are to be reloaded. The range r1, r2 must not contain register 13, but it may cross the register 15/register 0 boundary.Example: All registers except register 13, i.e. registers 0 to 12, 14 and 15, are loaded from the save area by means of the entry (14,12).

T
Is designed for compatibility with TOS language processors and is used to interrupt forward chaining in nested programs. After the registers have been reloaded, a “1” is set in the lowest-order bit in word 3 of the buffer.

RC=
Specifies a return code that is passed on to the main program in the rightmost three bytes of register 15.

rc

The value “rc” must be a decimal number or an absolute expression.

(15)
Specifies that register 15 contains a return code in the rightmost three bytes. In this case register 15 is not reloaded with the original contents of the buffer.

Functional description

The RETRN macro loads the specified registers from the save area and branches to the main program. For the call of the RETRN macro it is required:

  • that the subroutine saved the register contents at the beginning by means of the SAVE macro;

  • that the address of the save area has been loaded to register 13;

  • that the main program has loaded the return address to register 14.

If specified, the RETRN macro transfers a return code in register 15. This code can be freely agreed upon by the main program and the subroutine. The description of the SAVE macro deals with this point in detail and contains an example.

Note

Register specifications can also be entered in the form “Rn”, where n = register number.