.RESTR - load an element from an hstar or system.

Usage:

B:
   entry = .restr( unit [, name, return, loc, strip] );
C:
   #equate B_restr .restr
   int B_restr(FILE *stream [, int name, int return,
               void *loc, int strip] );

Where:

entry
is the entry point of the overlay, as recorded in the hstar.
unit
indicates where the overlay is to come from.
>=0
indicates that the file containing the hstar is attached to a normal B I/O unit with the given number.
-1
indicates that the overlay is to be loaded from the system, not from a file. In TSS, this indicates a system-edited program; in batch, this means MME GECALL is used instead of MME GERSTR.
-2
indicates that the overlay is to come from the same place as the rest of the program. It is only applicable to programs in multi-element hstars. In TSS, the overlay is taken from the file indicated by ".hstar"; in batch, it again means MME GECALL is used.
name
is the name of the element/subsystem to be loaded. This is a BCD word except in the case of a subsystem load in TSS ("unit" = -1) when it is an ASCII word. In TSS, this word may be omitted or set to zero if the only element of a single element hstar is being loaded. "name" is always required in batch.
return
0
tells .RESTR to transfer to the overlay being loaded rather than returning to the caller. (Default)
1
tells .RESTR to return to its caller.
loc
specifies the address where loading is to begin. If "loc" is zero or omitted, the information in the hstar is used to obtain this address.
strip
is a flag indicating whether or not .RESTR should strip the loader prefix from the overlay. This can only be used in TSS; .RESTR will fail to work if "strip" is used in a batch call.
0
tells .RESTR to load at "loc" plus the offset in hstar.
1
tells .RESTR to load the first word at "loc".

Description:

.RESTR is used to overlay load another program (subsystem) or element of a program. Since the underlying system calls are different, not all the TSS options of .RESTR are available in batch. In batch, if "loc" is non-zero any prefix specified in the hstar is stripped.

On return, the external "rst.in" contains the following information.

00-17
First word loaded.
17-36
Last word loaded plus 1. The same information is also returned in the A register, and could be retrieved with an immediate call to .NULL or by appropriate definition of a C struct return. Of course the values of "entry" and "rst.in" are meaningful only if "return" equals 1.

See Also:

expl b lib external .keep
for a note about putting .BSET in an overlay.

Copyright © 1996, Thinkage Ltd.