*DECK NDLOVLD
IDENT NDLOVLD
ENTRY NDLOVLD
COMMENT OVERLAY LOADER
TITLE OVERLAY LOADER
*#
*1D OVERLAY LOADER
* D NDLOVLD
*
* 1. PROC NAME AUTHOR DATE
* NDLOVLD J.E.JONES 78/07/07
* A.T.GERMOND 79/07/03
* D.K.ENDO 81/07/29
*
* 2. FUNCTIONAL DESCRIPTION
* LOADS OVERLAYS.
*
* 3. METHOD
*
* DETERMINE IF PRIMARY OR SECONDARY OVERLAY IS REQUESTED. IF
* THE OVERLAY HAS ALREADY BEEN LOADED JUST SET UP THE RJ AND
* JUMP TO IT. OTHERWISE, LOAD IT. OVERLAY LOAD ERRORS CAUSE
* PROC TO ABORT. CLEAR THE SECONDARY DATA WORDS TO ZERO
* WHEN LOADING A NEW PRIMARY. ALSO SAVE THE PRIMARY RETURN
* ADDRESS TO PRESERVE IT IF SECONDARIES ARE LATER LOADED.
* UPON RETURN FROM THE OVERLAY, FOR PRIMARIES, RESTORE THE
* RETURN ADDRESS IN CASE IT HAS BEEN CLOBBERED BY SECONDARY
* OVERLAY LOADS. FOR SECONDARIES, RESTORE THE PRIMARY NAME
* IN CUROVL. RETURN.
*
* 4. ENTRY PARAMETERS
* OVL PARAM = 42/OVL NAME,6/0,6/PRI,6/SEC
*
* 5. EXIT PARAMETERS
* CUROVL CURRENT OVERLAY SET IN EXTERNAL REF AREA
*
* 6. COMDECKS CALLED
* NONE.
*
* 7. CALLED BY
*
* 8. ROUTINES CALLED
* FOL.LOV LOADER
* MESSAGE ISSUE DAYFILE MESSAGE
*
* 9. DAYFILE AND ERROR MESSAGES
* XXXXXXX OVERLAY LOAD ERROR.
*#
NDLOVLD BSSZ 1
SA0 A1+1 SAVE PARAMETER LIST
SA1 X1 GET OVERLAY NAME
BX6 X1
SA6 CUROVL SAVE THE CURRENT OVERLAY
SB1 1
SB2 B0 INITIALIZE OVERLAY INDEX
MX0 -6
BX3 -X0*X1 REQUESTED OVERLAY LEVEL
ZR X3,IDXOK
SB2 B1 B2=0 - PRIMARY B2=1 - SECONDARY
IDXOK SA3 OVLLVL+B2 GET CURRENTLY LOADED OVL AT REQ LEVEL
BX6 X1-X3
NE B2,TESTLD JIF SECONDARY
SA2 NDLOVLD
BX7 X2
SA7 PRIRET SAVE PRIMARY RTN ADDR
TESTLD ZR X6,SETRJ OVERLAY ALREADY LOADED
NE B2,LOADIT JIF SECONDARY
SX6 B0
SA6 OVLLVL+B1 CLEAR THE SECONDARY VALUES WHEN
SA6 RJUMP+B1 LOADING A NEW PRIMARY
LOADIT BX0 X1 SAVE X1 IN CASE OF ERRORS
BX6 X1
SA6 OVLLVL+B2 SAVE OVERLAY NAME
RJ =XFOL.LOV
NG B7,LDERR
SX6 B7
SA6 RJUMP+B2 SAVE B7 FOR REENTRY
SETRJ BSS 0
SA3 RJX
MX0 6
BX3 X3*X0 CLEAR OLD ADDRESS
SA2 RJUMP+B2
LX2 30
BX6 X3+X2 PUT CALLEE ADDRESS IN RJ INSTRUCTION
SA6 A3
RJ CLEAR CLEAR INSTRUCTION STACK SO NEW RJ PICKED UP
CLEAR BSSZ 1
RJN SA1 A0
RJX RJ 0 GOTO CALLEE ** CODE MODIFIED **
SA2 CUROVL CHECK OVERLAY LEVEL
MX0 -6
BX2 -X0*X2 OVERLAY LEVEL
NZ X2,RSOVL JIF SECONDARY
SA2 PRIRET
AX2 30
SB3 X2
JP B3
RSOVL SA2 OVLLVL
BX7 X2 RESTORE CUROVL TO PRIMARY
SA7 CUROVL
EQ NDLOVLD
LDERR BSS
BX1 X0 OVERLAY NAME
MX0 42
SA3 ERRMSG
BX6 X0*X1
BX3 -X0*X3 CLEAR OLD NAME
BX6 X3+X6 OR IN OVERLAY NAME
SA6 A3
SX6 B7
SA6 LDRERR
MESSAGE ERRMSG,,RECALL
ABORT
ERRMSG DIS ,* OVERLAY LOAD ERROR.*
LDRERR DATA 0
* MAKE EXTERNAL SO CALLING PROC CAN USE IT
ENTRY CUROVL
CUROVL BSSZ 1
PRIRET BSSZ 1 PRIMARY RETURN ADDRESS
OVLLVL BSSZ 2 OVERLAY LEVEL
RJUMP BSSZ 2 TRANSFER ADDRESSES (B7)
END