.MCALL .MODULE .MODULE CHAIN,VERSION=06,COMMENT=,IDENT=No,LIB=Yes ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. ;++ ; ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 WLD 28-SEP-90 Use standard introductory ; comments. Use SOB if EIS. ;-- ;+ ;COND ; EIS$I (0) use SOB macro ; 1 use SOB instruction ; ; SLIB$M (0) Generate standard SYSLIB routine ; SLIB$M 1 Generate U mode part of Supervisor library ; SLIB$M 2 Generate S mode part of Supervisor library ; ; SLIB$M values are referenced using symbols of the form *PART ; in conditional statements. ; ; If SLIB$M <> 0, EIS$I is forced to 1 ;- .IIF NDF EIS$I EIS$I=0 .IIF NDF SLIB$M SLIB$M=0 .IIF NE SLIB$M EIS$I=1 OPART = SLIB$M ;0 = generate if building old library UPART = SLIB$M-1 ;0 = generate if building User part SPART = SLIB$M-2 ;0 = generate if building Supy part OSPART = OPART*SPART ;0 = generate ... old or Supy OUPART = OPART*UPART ;0 = generate ... old or User ;+ ; RT-11 SYSTEM LIBRARY (SYSLIB) SUBROUTINE ; ; CALLABLE ENTRIES: CHAIN ; ; FUNCTIONAL DESCRIPTION: ; The CHAIN routine allows a background program to chain directly to ; another background program (by specifying its name). The calling ; program may optionally pass parameters through the chain parameter ; area. ; ; This routine can be used by any background job running in a ; single-job or multi-job environment. It uses TRAP to provide ; error processing. ; ; CALLING SEQUENCE: ; ; CALL CHAIN(DBLK,VAR,WCNT) ; ; PASSED ARGUMENTS: ; ; DBLK - REAL*8 four word RAD50 descriptor of the program ; to be CHAINed to ; VAR - INTEGER*2 the first variable (must be word-aligned) ; to be passed to the program. Other variables to be ; passed follow in ascending, contiguous memory ; WCNT - INTEGER*2 the number of words to be passed. Maximum ; is 60 (decimal). If no variables are to be passed, ; WCNT must be specified as 0. ; ; RETURNED ARGUMENT VALUES: ; ; ; ; FUNCTION RETURN VALUE: ; ; ; ; ; EXTERNAL REFERENCES: ; ; $NXADR, $NXVAL ; ; ; MACRO REFERENCES: ; ; .CHAIN, SOB .SBTTL CHAIN - FORTRAN-callable system subroutine .GLOBL $SYSLB, $NXADR, $NXVAL .WEAK $MSARG CH.PGM = 500 ; Start of chain parameter area. .MCALL .CHAIN .IIF EQ EIS$I .MCALL SOB .PSECT SYS$I,I CHAIN:: MOV (R5)+,R4 ; R4(low byte) <- argument count. MOV #CH.PGM,R3 ; R3 <- start of chain parameter area. CALL $NXADR ; Get -> 'dblk' argument BCS ERR ; If CS, error - 'dblk' argument wasn't MOV (R0)+,(R3)+ ; Insert full file-specification of program MOV (R0)+,(R3)+ ; to run in 1st four words of the chain MOV (R0)+,(R3)+ ; parameter area. MOV (R0)+,(R3)+ ; CALL $NXADR ; Get -> 'var' argument BCS ERR ; If CS, error - 'var' argument wasn't MOV R0,R2 ; R2 <- address of parameters to pass. CALL $NXVAL ; Get 'wcnt' argument BCS ERR ; If CS, error - 'wcnt' argument wasn't BEQ 20$ ; If EQ, no parameters to pass; just do chain. 10$: MOV (R2)+,(R3)+ ; Otherwise, move parameters to pass to new SOB R0,10$ ; program in chain area one word at a time. ; Repeat until all words have been moved. 20$: .CHAIN ; Go chain to caller-specified program. ; Control never returns here after chain! ERR: TRAP $MSARG ; Handle any missing arguments in call RETURN .END