Recently several modifications have been made to the original CHAIN and EXECUTE provided with DOS. Some months ago these programs were replaced by DECUS-supplied versions which load overlays much more quickly. Recently WDS has rewritten the DECUS CHAIN to make it more comfortable to use.
The DECUS CHAIN and EXECUTE are described in detail in DECUS program library write-up 15-40 (PDPI5 bookcase). Briefly, the original CHAIN outputs all resident and link modules in a single XCU file. At execution time, individual links were searched for and loaded into core as needed using the relatively slow .READ macro. The DECUS CHAIN, by contrast, outputs a separate file for each link with extension Lnn, where nn is the link number. At run time, EXECUTE first locates and saves the starting block number of each link file. When a link is required in core, its file address is already known and it is input using a speedy block transfer macro. The DECUS EXECUTE is actually slightly smaller than the originally distributed version.
Although overlaid programs now retrieve links about 5 times faster than before, CHAIN itself is still slow to use. The principal reason is that command requests and load maps go exclusively to the system teletype. Since a source listing of the DCCUS CHAIN V7A was available, it was modified to do its command input and listing output to assignable DAT slots.
A second problem with both the original and DECUS CHAIN is their limited library scan facility. Only one user library (.LIBR5 BIN) and one system library (.LIBR BIN) are allowed. In implementing large systems programs, it would be convenient to have a third library. Such a facility has been added to the DECUS CHAIN.
The modified DECUS CHAIN is now installed as a system program under DOS. The DOS command XCHAIN will load the ATLAS version of CHAIN directly. The command CHAIN will load the DECUS CHAIN program until XCHAIN is fully trusted. There is no need to re-CHAIN any programs without links. Similarly, execute programs with links which have been overlaid using the DECUS CHAIN need not be redone.
XCHAIN operates exactly like the original CHAIN with the following exceptions:
Command input comes from the device assigned to DAT slot -14. If -14 is assigned to DKA, as it normally is, XCHAIN reads its commands from a file named CHAINX SRC.
Prompting messages, most error messages, and the load map output by XCHAIN go to the device assigned to DAT slot -15. If -15 is assigned to DKA, as it normally is, XCHAIN outputs to an ASCII file named CHAINX LST.
An auxiliary library option has been added. Following the prompt:
LIST OPTIONS & PARAMETERS
either the XSc or XUc option may be specified. Including either 'X' option will cause XCHAIN to search an auxiliary library named .LIBRc for unresolved global references. Scanning will occur after the user library is searched and before the system library is examined. The auxiliary library should be located on the system device if the XSc version of the options included, on the user device (slot-5) if the XUc version is used. Using the XUc option without a user library (DAT SLOT-5 assigned to NON) will cause an IOPS error. Only one of the two 'X' options may be used at a time.
Assigning DAT slots -14 and -15 to TTA will cause XCHAIN to prompt and receive commands like CHAIN, Assigning command input to TTA and output to DKA is not allowed as no prompting messages will be issued.
The list file, CHAINX LST, may be examined using either PIP or the editor. However, an I/O peculiarity of CHAIN causes logical records to be 1 character long with an <altmode> line terminator. BSILIST interprets <altmode> as <line feed> <cr> and therefore does not print the file out properly. To allow the CHAINX LST file to be properly l1sted, a new command has been added to LISTIT to cause <altmode> to be completely ignored. The commands:
←NALT <cr> /no altmode ←ALT <r> /altmode
turn ignore <altmode> state on and off respectively. To get a lineprinter listing of the XCHAIN commands and load map, load LISTIT as usual and type:
←NALT <cr> CHAINX LST <cr> <cntrl D>
The PAR and PAL parameters to XCHAIN cause a PAUSE nnn to be issued after relocating the resident code and links only if the list device is TTA. If the list device is file-oriented, no PAUSE occurs. Instead, XCHAIN merely types out the link number on the system teletype and continues. The PAL option is very useful for making occasional checks on a lengthy loading procedure.
When using the EDITOR to create a CHAINX SRC file to control XCHAIN, a blank line terminated by <altmode> must be inserted to cause XCHAIN to begin relocation. Typing <altmode> alone will merely cause the EDITOR to exit INPUT mode and return to EDIT mode. Instead, type <space><altmode> which is perfectly acceptable to both the EDITOR and XCHAIN.
The operation of EXECUTE in bank mode or from DECtape is suspect.
Almost all messages previously output by CHAIN to the teletype now go to the device associated with DAT slot -15. Two new error messages of this sort have been added to XCHAIN:
(1) ↑ONLY ONE 'X' OPTION ALLOWED (2) ↑↑↑EOF--ABORTED
The first diagnostic occurs if the 'X' option has been included twice in reply to the XCHAIN prompt:
'LIST OPTIONS & PARAMETERS'
The second error message occurs if XCHAIN attempts to read an end-of-file marker from its command input device. This situation will occur if the CHAINX SRC file is not terminated by a line containing <space><altmode>.
If DAT slot -15 is assigned to TTA, teletype output by XCHAIN is almost identical to that of CHAIN. If, however, -15 is assigned to DKA, XCHAIN prints out only the name of the execute file and a message indicating the success or failure of the relocation process. A successful example (operator-typed lines emphasised):
$ DOS V2A $ XCHAIN<cr> CHAIN xctnam O.K. $ DOS V2A $
An example which failed:
$ DOS V2A $ XCHAIN<cr> CHAIN namxct FAILED $ DOS V2A $
If VT is OFF the teletype bell will ring when XCHAIN exits - useful for long loading sequences.
A single error message is sent by XCHAIN exclusively to the system teletype:
'COMMAND DEVICE NOT DIRECTORIED'
This message is typed out if DAT slot -14 is TTA while slot -15 is file oriented. Relocation is aborted immediately.
Suppose one wishes to CHAIN a program with one resident program FOEEY which calls two external link subroutines BLETCH and GOBBLE which overlay each other. In turn, BLETCH calls Subroutine UP which is located in the user library; GOBBLE calls subroutine TURKEY to be found in the system library, and subroutine SOME, to be found in an auxiliary user library named .LIBR7 BIN. The first teletype interaction below would cause XCHAIN to generate the desired execute program as four files:
FOEEY XCT /Link table FOEEY XCU /Resident code FOEEY LO1 /Link 1 FOEEY L02 /Link 2(1) Using XCHAIN interactively:
$ DOS V2A $ A DK -5 <cr> / Search user Library $ ATTA -14,-15<cr> /Teletype commands and listing $ XCHAIN CHAIN ACL /ACL version of CHAIN NAME XCT FILE >FOEEY <altmode> LIST OPTIONS & PARAMETERS >NM, PAL, PAR, XU7 <laltmode> /aux lib.LIBR7, no map DEFINE RESIDENT CODE >FOEEY <altmode> /Resident program FOEEY DESCRIBE LINKS & STRUCTURE >LINK1 =GOBBLE <altmode> /Define link 1 >LINK2=BLETCH <altmode> /Define link 2 >LINK1:LINK2 <altmode> /Overlay each other ><altmode> /Begin relocation, no map PAUSE#000 /Resident code relocated <cntrl P> PAUSE#001 /Link 1 relocated <cntrl P> PAUSE#002 /Link 2 relocated <cntrl P> PAUSE#777 /XCT file output <cntrl P> O.K. /Successful relocation CORE REQ'D 75000-77636 /Program size $ DOS V2A $
The teletype interaction below accomplishes the same overlay building process by reading commands from disc file CHAINX SRC. The information in the previous example plus a load map would appear in the 5/7 ASCII file CHAINX LST.
(2) 'Programming' XCHAIN:
$ DOS V2A $ EDIT <cr> /Create CHAINX SRC file $ EDIT Vnn > OPEN CHAINX <cr> FILE NOT FOUND INPUT > FOEEY <altmode> /As if responding to XCHAIN > SZ,PAL,PAR,XU7 <altmode> /Options, parameters > FOEEY <altmode> /Resident code > LINK1=COBBLE <altmode> /Describe links > LINK2=BLETCH <altmode> > LINKl:LINK2 <altmode> /Describe structure > <space> <altmode> /Begin relocation > <cr> /Back to EDIT mode EDIT > CLOSE <cr> /Close file EDIT nn > EXIT <cr> $ DOS V2A $ A DK -5 <cr> /Search user library $ XCHAIN CHAIN FOEEY /Begin XCHAIN #000 /No pause #001 #002 #777 O.K. /Successful relocation $ DOS V2A /back to DOS $