*****************
*M*      MODIFY - GENERATES A REF/DEF STACK ENTRY WITHIN A LMN
*****************
*                 CATALOG NO. 704898 - M:SYSMOD (SYSGEN MODIFY)
         SYSTEM   SIG7FDP
         PAGE
         DEF      MODIFY            ADD,DELETE,CHANGE RFDFSTK,
*,*                                 EXPRSTK,RELDICT ENTRIES OR
*,*                                 MODIFY CORE LOCATION.
         CSECT    1
*P*
*P*      NAME:    MODIFY
*P*      PURPOSE: ADD, DELETE, OR CHANGE A LOAD MODULES RFDFSTK,
*P*               EXPRSTK, OR RELDICT OR MODIFY CORE
*P*               LOCATIONS WITHIN THE LOAD MODULE.
*P*      DESCRIPTION:  THE ADDING TO, DELETEING FROM, OR
*P*               CHANGING OF A LOAD MODULES RFDFSTK, EXPRSTK,
*P*               OR RELDICT & THE MODIFYING OF A LOAD MODULES
*P*               CORE LOCATION IS PERFORMED BY SUPPLYING
*P*               MODIFY WITH A MASTER PARAMETER LIST (PLIST)
*P*               IDENTIFYING THE LOAD MODULES BIASES &
*P*               SIZES & ALSO SPECIAL CHANGE DESCRIPTION
*P*               TABLES IDENTIFYING WHAT IS TO BE DONE WITH
*P*               THE LOAD MODULE.
*P*
         PAGE
*D*
*D*      NAME:    MODIFY
*D*      ENTRY:   RSEARCH
*D*      ENTRY:   LOC
*D*      ENTRY:   SECTION
*D*      ENTRY:   EVAL
*D*      ENTRY:   EVALR
*D*      ENTRY:   ADJUST
*D*      ENTRY:   EDEST
*D*      ENTRY:   RINDEX
*D*      ENTRY:   EFIX
*D*      ENTRY:   RADD
*D*      ENTRY:   DADD
*D*      ENTRY:   EADD
*D*      ENTRY:   CHCORE
*D*      ENTRY:   CC5
*D*      ENTRY:   EXP
*D*      ENTRY:   DEF
*D*      ENTRY:   ADDDE
*D*      ENTRY:   MOD
*D*      ENTRY:   MOD2
*D*      ENTRY:   DICT
*D*      ENTRY:   ABSREF
*D*      DESCRIPTION:  THROUGHOUT THE MODIFY MODULE, EACH OF
*D*               THE ROUTINES REQUIRES IN R7 THE ADDRESS
*D*               OF THE MASTER PLIST (PARAMETER LIST).
*D*               THEREFORE, R7 IS SACRED THROUGHOUT MODIFY...
*D*
*D*      REGISTER-NOTATION:
*D*               THROUGHOUT THE MODIFY MODULE, THE DESCRIPTIONS
*D*               REFER TO REGISTERS AS R0-R15. HOWEVER, THE CODE
*D*               ITSELF SELDOM USES THIS NOTATION, BUT, USES ITS
*D*               OWN REGISTER DEFINITIONS. THE EQUIVALENCES ARE
*D*               AS FOLLOWS:
*D*                           R0  = SN, R0
*D*                           R1  = I, R1
*D*                           R2  = K, R2
*D*                           R3  = A, R3
*D*                           R4  = LO, R4
*D*                           R5  = LO+1, J, R5
*D*                           R6  = T, R6
*D*                           R7  = P, R7
*D*                           R8  = X, SR1
*D*                           R9  = Y, SR2
*D*                           R10 = R, SR3
*D*                           R11 = SR4
*D*                           R12 = C, D1
*D*                           R13 = N, D2
*D*                           R14 = V, D3
*D*                           R15 = M, D4
*D*
         PAGE
SN       EQU      0                 LEFT BYTE OF R0
R0       EQU      0
I        EQU      1
R1       EQU      1
K        EQU      2
R2       EQU      2
A        EQU      3
R3       EQU      3
R4       EQU      4
R6       EQU      6
R7       EQU      7
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
D1       EQU      12
D2       EQU      13
D3       EQU      14
D4       EQU      15
LO       EQU      4
LO1      EQU      LO+1
J        EQU      5
R5       EQU      5
T        EQU      6
P        EQU      7
X        EQU      8
Y        EQU      9
R        EQU      10
SR4      EQU      11
C        EQU      12
N        EQU      13                N = C+1
V        EQU      14
M        EQU      15                M = V+1
         PAGE
*  TABLE PARAMETERS
*
PRLH     EQU      6
PELH     EQU      7
PRULH    EQU      14
PEULH    EQU      15
PCW      EQU      0
PSW      EQU      1
PTLW     EQU      2
P0LW     EQU      4
TRSH     EQU      12
TESH     EQU      16
T0SLW    EQU      5
T2SLW    EQU      9
RTB      EQU      1
RNCB     EQU      12
RVW      EQU      1
RRW      EQU      2
EPRW     EQU      -1
ECB1B    EQU      2
EDPW     EQU      2
         PAGE
*  CONSTANTS
*
DEFBIT   EQU      X'80'
CORDEST  EQU      X'40'
XDEFBIT  DATA     DEFBIT
M2       DATA     3
M3       DATA     7
M6       DATA     X'3F'
M7       DATA     X'7F'
M16      DATA     X'FFFF'
M17      DATA     X'1FFFF'
M32      DATA     -1
Y02      DATA     X'02000000'
Y8       DATA     X'80000000'
MASK     DATA     X'7FFFF'          B
         DATA     X'3FFFF'          H
         DATA     X'1FFFF'          W
         DATA     X'0FFFF'          D
         DATA     -1                NO RES.
         PAGE
*D*
*D*      NAME:    RSEARCH
*D*      ENTRY:   EXIT1
*D*      DESCRIPTION:  RSEARCH -- SEARCH RFDFSTK FOR A GIVEN NAME.
*D*
*D*               EXIT1 -- ADJUST RETURN TO RETURN TO CALLER +1,
*D*               & THEN RETURN.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R13 = ADDRESS OF NAME(I) IN CHANGE
*D*                     DESCRIPTION TABLE
*D*
*D*      OUTPUT:  RETURN+0...NAME NOT FOUND IN RFDFSTK
*D*                 R3  = ADDRESS OF NEXT AVAILABLE
*D*                       RFDFSTK ENTRY
*D*                 R12 = INDEX TO NEXT AVAILABLE RFDFSTK ENTRY
*D*                 R13 = ADDRESS OF NAME(I) IN CHANGE
*D*                       DESCRIPTION TABLE
*D*
*D*               RETURN+1...NAME WAS FOUND IN RFDFSTK
*D*                 R3 = ADDRESS OF NAME IN RFDFSTK
*D*                 R12 = INDEX TO NAME IN RFDFSTK
*D*                 R13 = ADDRESS OF NAME(I) IN CHANGE
*D*                       DESCRIPTION TABLE
*D*
*D*      REGISTERS:  R1-R3,R5,R8-R9,R12 USED, R11 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
*
RSEARCH  LI,K     PRLH
         LH,A     *P,K              A:= RFDF ITEM ADDRESS
         SLS,A    1
         LI,C     0                 C:= RFDF ITEM INDEX
         LI,K     TRSH
         LH,Y     *T,K              Y:= SIZE OF RFDFSTK
RS1      BLEZ     *SR4              EXIT IF NO MORE ITEMS IN RFDFSTK
         LB,I     *N                I:= CH. COUNT FOR GIVEN SYMBOL
         LI,K     RNCB
         CB,I     *A,K              COMPARE WITH COUNT FOR RFDF SYMBOL
         BNE      RS2               REJECT ITEM IF DIFFERENT
         LI,J     0
RS3      AI,J     1
         AI,K     1
         LB,X     *N,J              COMPARE NEXT CHARACTER
         CB,X     *A,K
         BNE      RS2               REJECT IF DIFFERENT
         BDR,I    RS3
EXIT1    AI,SR4   1                 TAKE 'SKIP' EXIT
         B        *SR4
RS2      EQU      %                 ITEM REJECTED
         LB,X     *A                GET ITEM SIZE
         AW,A     X
         AW,C     X
         SW,Y     X
         B        RS1               PROCEED TO NEXT ITEM
         PAGE
*D*
*D*      NAME:    LOC
*D*      ENTRY:   SECTION
*D*      ENTRY:   EXITL
*D*      ENTRY:   EXITL1
*D*      DESCRIPTION:  LOC -- PERFORM THE EVALUATION OF THE
*D*               LOCATION DEFINED BY NAME1+-VALUE1.
*D*
*D*               SECTION -- COMPUTE THE SECTION #
*D*               WITHIN A LOAD MODULE GIVEN THE LOCATION.
*D*               THE SECTION # IS: SECT 00,01, OR 10.
*D*
*D*               EXITL -- RESTORE CALLERS RETURN & THEN RETURN.
*D*
*D*               EXITL1 -- RESTORE CALLERS RETURN & THEN
*D*               RETURN TO CALLER +1.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   LOC --
*D*               R13 = ADDRESS -1 OF NAME1 IN CHANGE
*D*                     DESCRIPTION TABLE
*D*
*D*      OUTPUT:  LOC --
*D*               R0  = SECTION # OF SECT 00,01, OR 10 IN
*D*                     LOAD MODULE WHERE CORE ADDRESS IS
*D*                     LOCATED
*D*               R4  = CORE ADDRESS OF DESIGNATED LOCATION,
*D*                     I.E., NAME1+-VALUE1
*D*               R13 = ADDRESS -1 OF NAME2 IN CHANGE DESCRIPTION
*D*                     TABLE
*D*
*D*      INPUT:   SECTION --
*D*               R4  = CORE ADDRESS FOR WHICH SECTION # IS TO
*D*                     BE OBTAINED
*D*               R13 = ADDRESS OF VALUE(I) IN CHANGE DESCRIPTION
*D*                     TABLE
*D*
*D*      OUTPUT:  SECTION --
*D*               R0 = SECTION # OF SECT 00,01, OR 10 IN LOAD
*D*                    MODULE WHERE CORE ADDRESS IS LOCATED
*D*
*D*      INTERFACE:  EVAL,ERR1,ERR,EXIT1.
*D*      REGISTERS:  R4-R5,R8-R10,R12 USED, R11 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
*
LOC      PSW,SR4  *R0               SAVE SR4
         LI,R     2                 SET RES=WA
         BAL,SR4  EVAL              EVALUATE EXPRESSION
         B        ERR1              EXPRESSION MUST BE DEFINED
         B        ERR1
         PLW,SR4  *R0
         LW,LO    V
SECTION  SLD,LO   -1
         AND,LO   M16               LO:=DA(V). SAVE BIT 31 IN LO+1 (=J)
         LI,C     T2SLW
LO4      LW,X     *C,T              GET SIZE, LOC OF SECTION
         LH,Y     X                 Y:= SECTION SIZE (DOUBLEWORDS)
         AND,X    M16               X:= SECTION BASE (DA)
         CW,LO    X
         BL       LO3               REJECT IF LO<SECTION BASE
         AW,X     Y
         CW,LO    X
         BL       LO2               REJECT IF LO>=VASE+SIZE
LO3      AI,C     -2                REJECTED, TRY NEXT SECTION
         CI,C     T0SLW
         BGE      LO4
         B        ERR               NOT IN ANY SECTION, ERROR
LO2      AI,C     -T0SLW
         SLS,C    -1
         STB,C    SN                SAVE SECTION NUMBER
         SLD,LO   1                 RE-ESTABLISH AS WORD ADDRESS
         LI,LO1   X'E0000'
         LS,LO    *N                COPY UPPER 15 BITS OF VAL TO LO
         B        *SR4
EXITL    PLW,SR4  *R0
         B        *SR4
EXITL1   PLW,SR4  *R0
         B        EXIT1
         PAGE
*D*
*D*      NAME:    EVAL
*D*      ENTRY:   EVALR
*D*      DESCRIPTION:  EVAL -- PERFORM THE EVALUATION OF AN
*D*               EXPRESSION, NAME(I)+-VALUE(I), FOUND
*D*               IN THE CHANGE DESCRIPTION TABLE.
*D*
*D*               EVALR -- OBTAIN RESOLUTION CODE FROM
*D*               CHANGE DESCRIPTION TABLE & THEN ENTER EVAL.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R10 = DESIRED RESOLUTION CODE
*D*               R13 = ADDRESS -1 OF NAME(I) IN CHANGE
*D*                     DESCRIPTION TABLE
*D*
*D*      OUTPUT:  RETURN+0...NAME(I) NOT FOUND IN RFDFSTK
*D*                 R3  = ADDRESS OF NEXT AVAILABLE RFDFSTK ENTRY
*D*                 R10 = RESOLUTION CODE OF DESIRED VALUE
*D*                 R12 = INDEX TO NEXT AVAILABLE RFDFSTK ENTRY
*D*                 R13 = ADDRESS OF NAME(I) IN CHANGE
*D*                       DESCRIPTION TABLE
*D*
*D*               RETURN+1...NAME(I) WAS FOUND IN RFDFSTK AS A REF
*D*                 R3  = ADDRESS OF RFDFSTK ENTRY
*D*                 R10 = RESOLUTION CODE OF DESIRED VALUE
*D*                 R12 = INDEX TO RFDFSTK ENTRY
*D*                 R13 = ADDRESS OF NAME(I) IN CHANGE
*D*                       DESCRIPTION TABLE
*D*
*D*               RETURN+2...EXPRESSION FOR NAME(I)+-VALUE(I)
*D*                          EVALUATED
*D*                 R10 = RESOLUTION CODE OF DINAL VALUE IN R14
*D*                 R12 = INDEX TO RFDFSTK ENTRY
*D*                     = -1 WHEN NO NAME(I)
*D*                 R13 = ADDRESS -1 OF NEXT NAME(I) IN CHANGE
*D*                       DESCRIPTION TABLE
*D*                 R14 = EVALUATED EXPRESSION VALUE,
*D*                       NAME(I)+-VALUE(I)
*D*                 R15 = RESOLUTION WORD OF FINAL VALUE IN R14
*D*
*D*      INTERFACE:  RSEARCH,EXITL,EXITL1,ADJUST.
*D*      REGISTERS:  R2,R5,R8,R10,R12-R15 USED, R11 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
EVALR    LW,R     PCW,P
         LW,R     *R
         AND,R    M3
EVAL     PSW,SR4  *R0
         AI,N     1                 N:= WA(NAME)
         MTB,0    *N                SEE IF SYMBOL PRESENT
         BEZ      EV1
         BAL,SR4  RSEARCH           YES- FIND IT IN RFDFSTK
         B        EXITL             RETURN 1
         LI,K     RTB
         LB,X     *A,K              X:=TYPE
         AND,X    M6
         BEZ      EV3
         CI,X     3                 REJECT IF TYPE NOT DEF,CSECT OR
         BL       EXITL1               DSECT
EV3      LW,V     RVW,A             V:= SYMBOL VALUE
         LW,M     RRW,A             M:= SYMBOL RESOLUTION WORD
         BAL,SR4  ADJUST            ADJUST V TO RESOLUTION (R)
EV4      LB,J     *N                ADD CONSTANT
         SLS,J    -2
         AW,N     J
         AI,N     1                 N:=WA(VAL)
         AW,V     *N                ADD VAL
         PLW,SR4  *R0               RETURN 3
         AI,SR4   2
         B        *SR4
EV1      LI,V     0                 NO NAME.  V:=0
         LI,M     0                           M:=0
         LI,R     4                           R:=4
         LI,C     -1
         B        EV4
         PAGE
*D*
*D*      NAME:    ADJUST
*D*      DESCRIPTION:  ADJUST VALUE ACCORDING TO REQUIRED
*D*               RESOLUTION & FORM RESOLUTION WORD USED
*D*               IN IDENTIFYING THE VALUES RESOLUTION.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R10 = RESOLUTION DESIRED FROM THE CHANGE
*D*                     DESCRIPTION TABLE
*D*               R14 = VALUE FROM RFDFSTK ENTRY TO BE
*D*                     ADJUSTED TO DESIRED RESOLUTION
*D*               R15 = RESOLUTION WORD FROM RFDFSTK ENTRY
*D*
*D*      OUTPUT:  R10 = RESOLUTION CODE OF RESOLVED VALUE IN R14
*D*               R14 = VALUE FROM RFDFSTK ENTRY ADJUSTED TO
*D*                     DESIRED RESOLUTION
*D*               R15 = RESOLUTION WORD ADJUSTED TO INDICATE
*D*                     DESIRED RESOLUTION
*D*
*D*      REGISTERS:  R5,R10,R14 USED, R11,R15 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
ADJUST   PSW,M    *R0               SAVE RES WORD
         LI,J     4
AJ3      CI,M     X'FF'             CHECK ONE BYTE OF RES WORD
         BANZ     AJ2
         SLS,M    -8
         BDR,J    AJ3
         B        AJ5
AJ2      AI,J     -1                SEE IF BYTE IS +1 OR -1
         CI,M     1
         BE       AJ4
         CI,M     X'FF'
         BE       AJ4
AJ5      LI,R     4                 NO- MIXED RES
         PLW,M    *R0               RESTORE RES WORD
         B        *SR4
AJ4      CI,R     4                 SEE IF RES REQ'D
         BE       AJ1
         SW,J     R                 YES, ALIGN V
         SAS,V    0,J
         LCW,J    R                 SET M TO +1 OR -1 IN PROPER BYTE
         SLS,J    3
         SLS,M    24,J
         PLW,J    *R0               DUMMY PULL TO FIX STACK
         B        *SR4
AJ1      LW,R     J
         PLW,M    *R0
         B        *SR4
         PAGE
*D*
*D*      NAME:    EDEST
*D*      DESCRIPTION:  EXPRSTK DESTINATION ADDRESS SEARCH.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R4 = DESIRED DESTINATION ADDRESS FOR
*D*                    SEARCHING PURPOSES
*D*
*D*      OUTPUT:  ALL EXPRSTK ENTRIES HAVING A DESTINATION
*D*               ADDRESS EQUAL TO THE DESIRED DESTINATION
*D*               ADDRESS IN R4 ARE REMOVED FROM EXPRSTK BY
*D*               SETTING BIT-8 IN WORD-0 OF EXPRSTK ENTRY TO 1
*D*
*D*      INTERFACE:  EXITL.
*D*      REGISTERS:  R1-R5,R9 USED, R11 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
EDEST    PSW,SR4  *R0
         LI,K     PELH
         LH,A     *P,K              A:= EXPR LOC
         SLS,A    1
         LI,LO1   X'1FFFF'          (LO1 = J)
         LI,K     TESH
         LH,Y     *T,K              Y:= EXPR SIZE
ED1      BLEZ     EXITL             EXIT IF NO ITEMS LEFT
         LH,I     *A
         CI,I     DEFBIT
         BANZ     ED2               REJECT ITEM IF DEFINED
         CI,I     CORDEST
         BAZ      ED2               REJECT ITEM IF NOT TO CORE DEST.
         AND,I    M6
         AI,I     -EDPW             I:= INDEX TO DEST WORD
         CS,LO    *A,I
         BNE      ED2               REJECT IF ADDR(LO)~=ADDR(DEST)
         LH,I     *A                ITEM MATCHES. SET ITS DEFBIT TO 1
         OR,I     XDEFBIT
         STH,I    *A
ED2      LB,X     *A                MOVE ON TO NEXT ITEM
         AW,A     X
         SW,Y     X
         B        ED1
         PAGE
*D*
*D*      NAME:    RINDEX
*D*      DESCRIPTION:  COMPUTE RFDFSTK ENTRY ADDRESS GIVEN A
*D*               RFDFSTK INDEX.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R13 = RFDFSTK ENTRY INDEX
*D*
*D*      OUTPUT:  R4 = RFDFSTK ENTRY ADDRESS
*D*
*D*      REGISTERS:  R4,R13 USED, R11 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
RINDEX   LI,LO    PRLH
         LH,LO    *P,LO
         SLS,LO   1                 LO:= WA(RFDFSTK)
         AND,N    M16               REMOVE LEFT HALF OF INDEX
         AW,LO    N                 ADD INDEX TO RFDFSTK BASE
         B        *SR4
         PAGE
*D*
*D*      NAME:    EFIX
*D*      DESCRIPTION:  FIX EXPRSTK FOR UNSATISFIED REF.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INTERFACE:  EXITL,RINDEX,ADJUST,SECTION,CHCORE.
*D*      REGISTERS:  R1-R5,R8-R10,R12-R15 USED, R11 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
EFIX     PSW,SR4  *R0
         LI,K     PELH
         LH,A     *P,K              A:= EXPR ITEM LOC
         SLS,A    1
         LI,K     TESH
         LH,Y     *T,K              Y:= EXPR SIZE
EF1      BLEZ     EXITL             EXIT IF NO ITEMS LEFT
         LH,I     *A
         CI,I     DEFBIT
         BANZ     EF9               REJECT IF DEFINED
         LI,J     ECB1B             J:= CONTROL BYTE INDEX
         AND,I    M6
         AW,I     A
         AI,I     EPRW              I:= RES. WORD POINTER
         LI,K     -EPRW             K:= CONSTANT/POINTER INDEX
EF4      LB,X     *A,J              FETCH NEXT CONTROL BYTE
         BEZ      EF5               REJECT ZERO BYTE (PADDING)
         CI,X     2
         BL       EF6               TEST FOR 'ADD CONSTANT'
         BE       EF2               TEST FOR 'EXPRESSION END'
         CI,X     X'30'
         BGE      EF5               TEST FOR 'CHANGE RES.'
         LW,N     *I,K
         BAL,SR4  RINDEX            FIND RFDFSTK ITEM
         LH,X     *LO               GET ITS TYPE
         AND,X    M6
         BEZ      EF6
         CI,X     3
         BL       EF9               REJECT EXPR IF REF
EF6      AI,K     1                 BUMP CONST/PNTR INDEX
EF5      AI,J     1                 BUMP CONTROL BYTE INDEX
         B        EF4
EF9      LB,X     *A                PROCESS NEXT EXPRSTK ITEM
         AW,A     X
         SW,Y     X
         B        EF1
*  EXPR COMPLETELY DEFINED, EVALUATE IT
EF2      LI,V     0                 INITIALIZE VALUE TO 0
         LW,M     0,I               INITIALIZE RES WORD
         LI,K     -EPRW             K := PNTR/RFDF INDEX
         LI,J     ECB1B             J := CONTROL BYTE INDEX
EF10     LB,X     *A,J              GET CONTROL BYTE
         BEZ      EF11              PADDING: IGNORE
         CI,X     2
         BE       EF12              END
         BG       EF13
         AW,V     *I,K              ADD CONSTANT
EF14     AI,K     1
EF11     AI,J     1
         B        EF10
EF13     LW,R     X                 MOVE RES BITS TO R
         AND,R    M2
         CI,X     X'30'
         BGE      EF15
         LW,N     *I,K              ADD/SUB DECLARATION
         AI,K     1
         BAL,SR4  RINDEX            FIND DEF
         LD,C     V                 SAVE EXPR VALUE/RES
         LW,V     RVW,LO            GET VALUE/RES OF DEF
         LW,M     RRW,LO
EF20     PSW,J    *R0               SAVE J
         BAL,SR4  ADJUST            ADJUST VALUE/RES OF ADDEND
         CI,X     8                 CHECK ADD/SUB BIT
         BAZ      EF16
         LCW,V    V                 NEGATE ADDEND VALUE
EF16     AW,V     C                 ADD EXPR VALUE
         LI,J     -4                UPDATE RES WORD
EF17     LB,R     M+1,J             GET INDEX FROM ADDEND RES WORD
         CI,X     8                 CHECK ADD/SUB BIT
         BAZ      EF18
         LCW,R    R                 NEGATE INDEX
EF18     LB,C     N+1,J             GET INDEX FROM EXPR RES WORD
         AW,R     C                 ADD TO ADDEND INDEX
         STB,R    M+1,J             STORE IT AS NEW EXPR RES INDEX
         BIR,J    EF17
         PLW,J    *R0               RESTORE J
         B        EF11
EF15     CI,X     X'34'
         BGE      EF19
         LI,C     0                 CHANGE RESOLUTION: MOCK UP AN
         LI,N     0                    EXPR WITH VALUE=RES=0
         B        EF20              ADDEND := EXPR
EF19     LD,C     V                 ADD/SUB ABS SECTION
         LI,V     0                 MAKE ADDEND = DA(0)
         LI,M     1
         B        EF20
EF12     LH,X     *A                END OF EXPRESSION
         OR,X     XDEFBIT           SET ITS DEFBIT TO 1
         STH,X    *A
         CI,X     CORDEST           SEE IF ITS DEST IS CORE
         BAZ      EF8
         PSW,A    *R0               YES- SAVE A AND Y
         PSW,Y    *R0
         LI,R     4
         BAL,SR4  ADJUST
         LW,J     R
         LW,M     MASK,J            ESTABLISH MASK FOR STORING
         LW,N     I
         AI,N     -EDPW-EPRW        N:= WA(EXPR DEST POINTER)
         LW,LO    *N                L:= DEST POINTER
         BAL,SR4  SECTION           COMPUTE SECT. NO. OF LO
         BAL,SR4  CHCORE            STORE EXPR VALUE
         PLW,Y    *R0               RESTORE A AND Y
         PLW,A    *R0
         B        EF9               PROCEED TO NEXT EXPRSTK ITEM
EF8      LW,N     -EDPW-EPRW,I      GET RFDF INDEX
         BAL,SR4  RINDEX            FIND RFDF ITEM
         STW,V    RVW,LO            STORE VALUE
         STW,M    RRW,LO            STORE RES WORD
         LI,K     RTB               SET ITS TYPE TO 'DEF'
         LI,X     0
         STB,X    *LO,K
         B        EF9
         PAGE
*D*
*D*      NAME:    RADD
*D*      ENTRY:   DADD
*D*      DESCRIPTION:  RADD -- ADD A REF TO THE RFDFSTK.
*D*
*D*               DADD -- ADD A DEF TO THE RFDFSTK.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R3  = ADDRESS OF NEXT AVAILABLE RFDFSTK ENTRY
*D*               R13 = ADDRESS OF NAME(I) IN CHANGE DESCRIPTION
*D*                     TABLE
*D*
*D*      OUTPUT:  R3  = ADDRESS IN RFDFSTK OF CURRENT ENTRY
*D*               R13 = ADDRESS OF NAME(I) IN CHANGE DESCRIPTION
*D*                     TABLE
*D*
*D*      INTERFACE:  ERR2.
*D*      REGISTERS:  R1-R2,R5,R8-R9 USED, R10-R11 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
RADD     EQU      %
         PSW,R    *R0
         LI,R     2
RADDCOM  EQU      %
         MTW,0    PCW,P             CHECK INHIBIT GROWING STACK BIT
         BLZ      ERR2              ERROR IF SET
         LB,X     *N                COMPUTE SIZE OF ITEM IN WORDS
         SLS,X    -2
         AI,X     4                 X := 4+N/4 = SIZE OF ITEM
         LI,K     PRULH             COMPUTE NO. OF WORDS AVAILABLE
         LH,Y     *P,K
         LI,K     PRLH
         SH,Y     *P,K
         AND,Y    M16
         SLS,Y    1
         AI,Y     2                 Y := NO. WORDS AVAILABLE
         LW,J     X                 COMPUTE TOTAL SIZE OF MODIFIED STK
         LI,K     TRSH
         AH,J     *T,K              J := TOTAL SIZE
         CW,J     Y                 SEE IF THERE IS ENOUGH ROOM FOR IT
         BG       ERR2              ERROR IF NOT
         STH,J    *T,K              STORE TOTAL SIZE
         LW,K     A
         SLS,K    2                 K := BA(ITEM)
         STB,X    0,K               STORE ITEM LENGTH
         AI,K     RTB
         LW,X     R                 SET TYPE = 'REF' OR 'DEF'
         STB,X    0,K
         AI,K     RNCB-RTB
         LB,I     *N                FETCH NAME LENGTH
         STB,I    0,K               STORE IT
         LI,J     0
RA1      AI,K     1                 MOVE NAME INTO RFDSTK ITEM
         AI,J     1
         LB,X     *N,J
         STB,X    0,K
         BDR,I    RA1
         PLW,R    *R0
         B        *SR4
DADD     EQU      %
         PSW,R    *R0
         LI,R     0
         B        RADDCOM
         PAGE
*D*
*D*      NAME:    EADD
*D*      DESCRIPTION:  ADD ENTRY TO EXPRSTK.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R8  = VALUE OF NAME(I)+-VALUE(I)
*D*               R9  = 0  EXPRESSION FOR A DEF
*D*                   = 4  EXPRESSION FOR A REF, I.E.,
*D*                        CORE DESTINATION
*D*               R10 = RESOLUTION CODE FOR A REF EXPRESSION
*D*               R12 = INDEX TO NEXT AVAILABLE ENTRY IN
*D*                     RFDFSTK IF R10 <4
*D*               R13 = ADDRESS OF NAME(I) IN CHANGE DESCRIPTION
*D*                     TABLE
*D*
*D*      INTERFACE:  ERR.
*D*      REGISTERS:  R2-R3,R5,R8-R10 USED, R11 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
EADD     MTW,0    PCW,P             CHECK ' INHIBIT GROWING STACK' BIT
         BLZ      ERR               ERROR IF SET
         LI,K     PEULH             COMPUTE AVAILABLE SPACE
         LH,A     *P,K
         LI,K     PELH
         SH,A     *P,K
         AND,A    M16
         SLS,A    1
         AI,A     2                 A = NO. WORDS AVAILABLE
         LI,K     TESH              COMPUTE TOTAL SIZE OF UPDATED STK
         LH,J     *T,K
         AI,J     6                 SIZE OF NEW ITEM IS 6 WORDS
         CW,J     A                 SEE IF THERE IS ENOUGH SPACE
         BG       ERR               ERROR IF NOT
         STH,J    *T,K              STORE UPDATED SIZE
         LI,K     PELH              COMPUTE LOC OF NEW ITEM
         LH,A     *P,K
         SLS,A    1
         AI,A     -6
         AW,A     J                 A = WA(ITEM)
         SLS,Y    16                GENERATE 1ST WORD
         CI,R     4
         BL       EA1
         CI,C     0
         BLZ      EA2
         B        EA3
EA2      EQU      %
         LI,R     -X'20'
EA1      EQU      %
         AW,Y     R                     EXPRESSION STRING IS:
EA3      EQU      %
         AW,Y     L(X'06040120')        01, 20+R, 02.
         STW,Y    0,A
         LW,Y     Y02               2ND WORD
         STW,Y    1,A
         STW,X    2,A               3RD WORD = DEST
         LI,X     0
         STW,X    3,A               4TH WORD (RES) = 0
         LB,J     *N                COMPUTE LOC OF EXPR CONSTANT
         SLS,J    -2
         AI,J     1
         LW,Y     *N,J              MOVE CONSTANT TO 5TH WORD
         STW,Y    4,A
         STW,C    5,A               6TH WORD = REF INDEX
         B        *SR4
         PAGE
*D*
*D*      NAME:    CHCORE
*D*      ENTRY:   CC5
*D*      DESCRIPTION:  CHCORE -- CHANGE A CORE LOCATION OR EXPRSTK
*D*               REFS.
*D*
*D*               CC5 -- ENTRY FOR RELOCATION DICTIONARY CHANGES.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R0  = SECTION # (I.E., SECT 00,01,10) IN
*D*                     LOAD MODULE WHERE DESTINATION ADDRESS
*D*                     IS FOUND
*D*               R4  = DESTINATION INFORMATION WORD, I.E.,
*D*                     ADDRESS FIELD SIZE & TERMINAL BIT
*D*                     POSITION OF ADDRESS FIELD & DESTINATION
*D*                     ADDRESS
*D*               R10 = RESOLUTION CODE:
*D*                           0 = BYTE
*D*                           1 = HALF WORD
*D*                           2 = WORD
*D*                           3 = DOUBLE WORD
*D*                           4 = NONE
*D*                     FOR EXP OR MOD TYPE CHANGE DESCRIPTION
*D*                     TABLE REQUESTS. FOR DICT TYPE REQUESTS,
*D*                     R10 CONTAINS THE RESOLUTION TYPE CODE
*D*                     WITH BIT-0 SET =1, I.E.,
*D*                           X'80000000'+DICT CODE
*D*
*D*      INTERFACE:  EDEST,ERR1,EXITL, & SPECIAL USER SUPPLIED
*D*               MODIFICATION ROUTINE IF ONE IS DESIRED.
*D*      REGISTERS:  R1-R5,R9,R14-R15 USED, R11 SAVED
*D*
CHCORE   PSW,SR4  *R0
         BAL,SR4  EDEST             REMOVE EXPRSTK REFS TO THIS LOC
CC5      LB,J     SN                GET SECTION NO.
         AI,J     P0LW
         LW,A     *P,J
         SLS,A    1                 A := SECTION LOC
         SLS,J    1
         AI,J     T0SLW-2*P0LW
         LCW,I    *T,J              I := -DA(SECTION BIAS)
         SLS,I    1
         AW,I     LO                I := ADDRESS REL.TO SECT.BIAS
         LI,LO1   X'1FFFF'
         LS,LO    I                 ADDR(LO) := ADDR(I)
         LI,M     -1                INITIALIZE MASK
         CI,LO    X'1FFFF'          SEE IF THIS IS A 'FIELD' DEST
         BLE      CC1               NO
         LB,I     LO                YES, FETCH FIELD LENGTH
         LH,J     LO                AND TERMINAL-BIT NO.
         SLS,J    -1
         AND,J    M7
         LCW,J    J
         CI,I     32
         BG       ERR1              ERROR IF FIELD LONGER THAN WORD
         SLS,M    0,I
         EOR,M    M32               GENERATE MASK OF LENGTH I
         AW,I     J
         CI,I     1
         BG       ERR1              ERROR IF FIELD OVERLAPS WD BNDRY
         SLD,V    31,J              SHIFT VALUE AND MASK
CC1      LW,J     PSW,P
         BEZ      CC2               SEE IF STACKING REQUESTED
         LW,R1    LO
         LD,R2    V
         BAL,SR4  0,J
         B        EXITL
CC2      EQU      %
         LW,J     R                 ESTABLISH REL DICT CODE IN V
         BLZ      CC3
         STS,V    *A,LO
         LB,V     DCODE,J
CC4      LB,K     SN
         AI,K     P0LW
         LW,Y     *P,K              GET DICT/SECTION LOCS
         LW,R2    LO                SAVE RELATIVE ADR.IN R2 FOR PASS-0
         LW,R3    V                 SAVE VALUE IN R3 FOR PASS-0
         LI,LO1   0
         SLD,LO   -1
         AND,LO   M16               LO := DA(REL ADR)
         SLD,LO   -2                SEPARATE INTO WORD NO. AND
         SLS,LO1  -27                  GROUP NO.
         LCW,LO1  LO1
         LI,M     X'F'
         SLD,V    28,LO1            POSITION DICT CODE AND MASK
         LH,Y     Y
         BEZ      EXITL             NO DICT
         SLS,Y    1                 Y := WA(DICT)
         STS,V    *Y,LO             STORE DICT CODE
         B        EXITL
CC3      LW,V     R                 R<0 SO USE DICT CODE IN R
         B        CC4
DCODE    DATA,1   0,1,2,3,X'E',0,0,0
         PAGE
*D*
*D*      NAME:    ERR
*D*      ENTRY:   ERR1
*D*      ENTRY:   ERR2
*D*      DESCRIPTION:  THE MASTER PLIST IS IN ERROR OR AN ERROR
*D*               IS FOUND IN THE CHANGE DESCRIPTION TABLE.
*D*               THEREFORE, RESTORE STACK & EXIT BACK TO CALLER
*D*               WITH CC1 SET.
*D*
*D*      REGISTERS:  R1 USED, R5-R11 RESTORED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
ERR1     PLW,R1   *R0               DUMMY PULL TO ADJUST STACK
ERR      LCI      7
         PLM,R5   *R0               RESTORE R5-R7, SR1-SR4
         LCI      8                 CC1 := 1
         B        *SR4              RETURN TO USER
ERR2     EQU      %
         PLW,R    *R0
         B        ERR
         PAGE
*F*
*F*      NAME:    MODIFY
*F*      PURPOSE: ADD, DELETE, OR CHANGE A LOAD MODULES RFDFSTK,
*F*               EXPRSTK, OR RELDICT OR MODIFY CORE
*F*               LOCATIONS WITHIN THE LOAD MODULE.
*F*      DESCRIPTION:  THE ADDING TO, DELETEING FROM, OR
*F*               CHANGING OF A LOAD MODULES RFDFSTK, EXPRSTK,
*F*               OR RELDICT & THE MODIFYING OF A LOAD MODULES
*F*               CORE LOCATION IS PERFORMED BY SUPPLYING
*F*               MODIFY WITH A MASTER PARAMETER LIST (PLIST)
*F*               IDENTIFYING THE LOAD MODULES BIASES &
*F*               SIZES & ALSO SPECIAL CHANGE DESCRIPTION
*F*               TABLES IDENTIFYING WHAT IS TO BE DONE WITH
*F*               THE LOAD MODULE.
*F*
*
*D*
*D*      NAME:    MODIFY
*D*      DESCRIPTION:  THIS ROUTINE DETERMINES WHAT KIND OF
*D*               CHANGE DESCRIPTION TABLE IS BEING SUPPLIED
*D*               TO MODIFY FOR PROCESSING & THEN ENTERS THE
*D*               APPROPRIATE PROCESSOR.
*D*
*D*      CALL:    R11 = LINK
*D*
*D*      INPUT:   R7 = ADDRESS OF MASTER PARAMETER LIST (PLIST)
*D*
*D*      OUTPUT:  CC1 = 0  PROCESSING COMPLETED
*D*                   = 1  PROCESSING COULD NOT BE COMPLETED
*D*                        DUE TO AN ERROR IN CHANGE DESCRIPTION
*D*                        TABLE OR PLIST
*D*
*D*      INTERFACE:  ERR,EXP,DEF,MOD,DICT,ADDDE,ABSREF.
*D*      REGISTERS:  R13 USED, R5-R11 SAVED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
*D*               THE FOLLOWING SHOWS THE STRUCTURE OF THE
*D*               MASTER PLIST:
*D*
*D*      WORD-0   BIT-0       = 0   CHANGE DESCRIPTION TABLE MAY
*D*                                 CAUSE AN EXPANSION OF THE
*D*                                 RFDFSTK OR EXPRSTK.
*D*                           = 1   CHANGE DESCRIPTION TABLE IS
*D*                                 NOT TO EXPAND THE RFDFSTK OR
*D*                                 EXPRSTK, THUS THE EXPR TYPE
*D*                                 OF CHANGE DESCRIPTION TABLE
*D*                                 IS NOT PERMITTED, & 'NAME-2'
*D*                                 OF THE DEF TYPE CHANGE
*D*                                 DESCRIPTION TABLE MUST BE
*D*                                 DEFINED.
*D*               BITS 1-31   =     WORD ADDRESS OF A CHANGE
*D*                                 DESCRIPTION TABLE.
*D*      WORD-1   BITS 0-31   = 0   NO ACTION TAKEN.
*D*                           > 0   THE ADDRESS OF A SUBROUTINE
*D*                                 TO BE ENTERED UNDER THE
*D*                                 FOLLOWING CIRCUMSTANCES:
*D*                                   ANY CALL ON MODIFY MAY
*D*                                   RESULT IN A NUMBER OF CORE
*D*                                   LOCATIONS IN SECT 00,01,
*D*                                   OR 10 BEING MODIFIED. IF IT
*D*                                   IS SO DESIRED THAT MODIFY
*D*                                   NOT MAKE THESE CHANGES, BUT,
*D*                                   INSTEAD, INFORM THE CALLER
*D*                                   OF THE CHANGES, THEN THIS
*D*                                   SUBROUTINE WILL BE ENTERED.
*D*                                   THE SUBROUTINE IS ENTERED VIA:
*D*                                     R1 = CORE LOCATION TO
*D*                                          WHICH CHANGE APPLIED
*D*                                     R2 = VALUE TO STORE IN
*D*                                          CORE LOCATION
*D*                                     R3 = MASK FOR STORING
*D*                                          VALUE
*D*                                     R11= LINK
*D*      WORD-2   BYTE-0      = 00  RELDICT 00,01, & 10 ARE AVAILABLE.
*D*                           = 01  RELDICT 00,01, & 10 ARE
*D*                                 NOT AVAILABLE, I.E., THE LOAD
*D*                                 MODULE IS AN ABSOLUTE MODULE.
*D*               BITS 8-31   =     WORD ADDRESS OF THE LOAD MODULES
*D*                                 TREE TABLE.
*D*      WORD-3   BYTES 0-1   =     DOUBLE WORD ADDRESS OF RFDFSTK.
*D*               BYTES 2-3   =     DOUBLE WORD ADDRESS OF EXPRSTK.
*D*      WORD-4   BYTES 0-1   =     DOUBLE WORD ADDRESS OF RELDICT
*D*                                 FOR SECT 00.
*D*               BYTES 2-3   =     DOUBLE WORD ADDRESS OF THE
*D*                                 SECT 00 DATA AREA.
*D*      WORD-5   BYTES 0-1   =     DOUBLE WORD ADDRESS OF RELDICT
*D*                                 FOR SECT 01.
*D*               BYTES 2-3   =     DOUBLE WORD ADDRESS OF THE
*D*                                 SECT 01 DATA AREA.
*D*      WORD-6   BYTES 0-1   =     DOUBLE WORD ADDRESS OF RELDICT
*D*                                 FOR SECT 10.
*D*               BYTES 2-3   =     DOUBLE WORD ADDRES OF THE
*D*                                 SECT 10 DATA AREA.
*D*      WORD-7   BYTES 0-1   =     DOUBLE WORD ADDRESS OF
*D*                                 RFDFSTK UPPER LIMIT, I.E.,
*D*                                 LAST USABLE DOUBLE WORD.
*D*               BYTES 2-3   =     DOUBLE WORD ADDRESS OF
*D*                                 EXPRSTK UPPER LIMIT, I.E.,
*D*                                 LAST USABLE DOUBLE WORD.
*D*
*
MODIFY   LCI      7
         PSM,R5   *R0               SAVE R5-R7, SR1-SR4
         LW,T     PTLW,P            SET UP TREE ADDRESS IN T
         LW,N     PCW,P             N := WA(CHANGE TABLE)
         LB,J     *N                FETCH FUNCTION BYTE
         CI,J     5
         BG       ERR
         EXU      MOD1,J
MOD1     B        EXP
         B        DEF
         B        MOD
         B        DICT
         B        ADDDE
         PAGE
*D*
*D*      NAME:    EXP
*D*      DESCRIPTION:  PROCESS AN EXPR (EXPRESSION) TYPE
*D*               CHANGE DESCRIPTION TABLE REQUEST. THE
*D*               NAME1+-VALUE1 EXPRESSION IS EVALUATED & IS THE
*D*               DESTINATION ADDRESS USED WHEN THE EXPRESSION
*D*               NAME2+-VALUE2 IS SATISFIED OR EVALUATED. NO
*D*               NAME1 IMPLIES VALUE1 AS DESTINATION.
*D*               NAME2+-VALUE2 IS THEN INTERROGATED. IF
*D*               NAME2 IS NOT IN THE RFDFSTK, IT WILL BE
*D*               ADDED TO IT AS A REF TYPE & AN EXPRSTK ENTRY IS
*D*               MADE WHICH WILL EXPRESS THE EVALUATION
*D*               ALGORITHM FOR NAME2. IF NAME2 IS IN THE
*D*               RFDFSTK & IS A REF TYPE, AN EXPRSTK
*D*               ENTRY IS MADE WHICH WILL EXPRESS THE
*D*               EVALUATION ALGORITHM FOR NAME2. HOWEVER,
*D*               IF NAME2 IS IN  THE RFDFSTK & IS A DEF TYPE,
*D*               THE EXPRESSION NAME2+-VALUE2 IS EVALUATED.
*D*               THE VALUE IS THEN USED TO REPLACE THE FIELD
*D*               IN THE DESTINATION ADDRESS & IS MASKED
*D*               ACCORDING TO THE DESTINATIONS RESOLUTION.
*D*               THE RESOLUTION MAY BE BYTE,HALF WORD,WORD,OR
*D*               DOUBLE WORD. EACH ENTRY IN THE EXPRSTK IS THEN
*D*               CHECKED TO SEE IF ITS DESTINATION ADDRESS IS
*D*               THE SAME AS THE DESTINATION ADDRESS OF
*D*               NAME1+-VALUE1, & IF SO, THE EXPRSTK ENTRY IS
*D*               REMOVED BY SETTING A FLAG IN THE ENTRY
*D*               INDICATING THAT THIS EXPRESSION HAS BEEN
*D*               EVALUATED. IF THERE IS NO NAME2, I.E.,
*D*               ONLY A +-VALUE2, THEN THE RESULT IS THE
*D*               SAME AS IF THERE WAS A NAME2 DEFINED IN THE
*D*               RFDFSTK WITH VALUE 0.
*D*
*D*      INPUT:   R13 = ADDRESS OF CHANGE DESCRIPTION TABLE
*D*
*D*      INTERFACE:  LOC,EVALR,RADD,MOD2,EADD,MEXIT.
*D*      REGISTERS:  R5,R8-R9,R11,R15 USED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
*D*               THE FOLLOWING SHOWS THE STRUCTURE OF THE
*D*               CHANGE DESCRIPTION TABLE:
*D*
*D*      WORD-0   BYTE-0      = 00  CHANGE DESCRIPTION TABLE TYPE
*D*               BITS 28-31  =     RESOLUTION OF NAME2
*D*                                   CODES ARE:
*D*                                     0 = BYTE
*D*                                     1 = HALF WORD
*D*                                     2 = WORD
*D*                                     3 = DOUBLE WORD
*D*                                     4 = NONE
*D*      WORD 1-N             =     TEXTC OF NAME1
*D*      WORD N+1             =     +-VALUE1
*D*                                 VALUE1'S FORMAT IS:
*D*                                   BYTE-0    = DESTINATIONS
*D*                                               FIELD SIZE IN
*D*                                               BITS WHERE
*D*                                               ULTIMATE VALUE
*D*                                               IS TO BE SET
*D*                                 BITS 8-14   = ENDING BIT
*D*                                               POSITION OF
*D*                                               VALUE IN THE
*D*                                               DESTINATIONS
*D*                                               FIELD
*D*                                 BITS 15-31  = RELATIVE WORD
*D*                                               WORD ADDRESS IN
*D*                                               SECT 00,01,10
*D*                                               OF DESTINATION
*D*                                               I.E., RELATIVE
*D*                                               TO NAME1
*D*      WORD N+2-M           =     TEXTC OF NAME2
*D*      WORD M+1             =     +=VALUE2
*D*
EXP      BAL,SR4  LOC               EVALUATE LOC EXPR FOR DEST
         BAL,SR4  EVALR             EVALUATE MAIN EXPR
         BAL,SR4  RADD              ADD REF ITEM IF NECESSARY
         B        EX1               EXPR NOT DEFINED
         LW,J     R                 EXPR DEFINED, DO CORE MODIFICATION
         LW,M     MASK,J
         B        MOD2
EX1      LW,X     LO                EXPR NOT DEFINED, ADD IT TO EXPRSTK
         LI,Y     CORDEST
         BAL,SR4  EADD
         B        MEXIT
         PAGE
*D*
*D*      NAME:    DEF
*D*      ENTRY:   ADDDE
*D*      DESCRIPTION:   PROCESS A DEF (DEFINITION) TYPE
*D*               CHANGE DESCRIPTION TABLE REQUEST. THERE ARE
*D*               TWO TYPES OF DEF REQUESTS: WITH EXPRESSION
*D*               EVALUATION & WITH NO EXPRESSION EVALUATION.
*D*
*D*                 DEF --    TYPE ONE, NO EXPRESSION:
*D*               WHEN THIS TYPE OF REQUEST IS ENCOUNTERED, NAME1
*D*               IN ENTERED INTO THE RFDFSTK AS A REFERENCE TYPE
*D*               UNLESS IT IS ALREADY THERE. THE EXPRESSION
*D*               NAME2+-VALUE2 IS THEN INTERROGATED. IF NAME2
*D*               IS NOT IN THE RFDFSTK, IT WILL BE ADDED TO IT
*D*               AS A REF TYPE & AN EXPRSTK ENTRY IS MADE WHICH
*D*               WILL EXPRESS THE EVALUATION ALGORITHM FOR NAME2.
*D*               HOWEVER, IF NAME2 IS IN THE RFDFSTK & IS A
*D*               DEF TYPE, THE EXPRESSION, NAME2+-VALUE2 IS
*D*               EVALUATED. THE RESULT IS THEN PUT INTO THE
*D*               RFDFSTK ENTRY & THE ENTRY IS FLAGED AS A DEF.
*D*               WHEN NAME2 IS A REFERENCE, THEN THE RFDFSTK
*D*               ENTRY REMAINS AS A REF TYPE. THE EXPRSTK IS
*D*               THEN SEARCHED TO FIND ALL ENTRIES WHICH
*D*               REFERENCE THIS DEFINITION. EACH SATISFIED
*D*               REFERENCE IS THEN EVALUATED & THE VALUE IS
*D*               THEN USED TO REPLACE THE FIELD IDENTIFIED
*D*               BY THE DESTINATION & WILL BE MASKED ACCORDING
*D*               TO THE DESTINATIONS RESOLUTION, I.E., BYTE,
*D*               HALF WORD,WORD,DOUBLE WORD. IF THERE IS NO
*D*               NAME2, I.E., ONLY +-VALUE2, THEN THE RESULT IS
*D*               THE SAME AS IF THERE WAS A NAME2 WITH VALUE 0.
*D*
*D*                  ADDDE -- TYPE TWO, WITH EXPRESSION:
*D*               WHEN THIS TYPE OF REQUEST IS ENCOUNTERED, NAME1
*D*               IS ENTERED INTO THE RFDFSTK AS A DEFINITION TYPE,
*D*               UNLIKE THAT FOR TYPE ONE ABOVE, UNLESS IT IS
*D*               ALREADY IN THE RFDFSTK. THE EXPRESSION
*D*               NAME2+-VALUE2 IS THEN INTERROGATED. IF NAME2
*D*               IS NOT IN THE RFDFSTK, IT WILL BE ADDED TO IT
*D*               AS A REF TYPE & AN EXPRSTK ENTRY IS MADE
*D*               WHICH WILL EXPRESS THE EVALUATION ALGORITHM
*D*               FOR NAME2. IF NAME2 IS IN THE RFDFSTK & IS A
*D*               REF TYPE, AN EXPRSTK ENTRY IS MADE WHICH WILL
*D*               EXPRESS THE EVALUATION ALGORITHM FOR NAME2.
*D*               HOWEVER, IF NAME2 IS IN THE RFDFSTK AS A
*D*               DEF TYPE OR IF THERE IS NO NAME2, I.E., ONLY
*D*               A +-VALUE2, THE EXPRESSION NAME2+-VALUE2
*D*               IS EVALUATED. THE RESULT IS THEN PUT INTO THE
*D*               RFDFSTK ENTRY FOR NAME1.
*D*
*D*      INPUT:   R13 = ADDRESS OF CHANGE DESCRIPTION TABLE
*D*
*D*      INTERFACE:  ERR,RSEARCH,RADD,EVALR,EFIX,MEXIT,DADD,
*D*               EADD.
*D*      REGISTERS:  R2,R4,R8-R9,R11,R13 USED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
*D*               THE FOLLOWING SHOWS THE STRUCTURE OF THE
*D*               CHANGE DESCRIPTION TABLE:
*D*
*D*      WORD-0   BYTE-0      = 01  DEFINITION WITH NO EXPRESSION
*D*                           = 04  DEFINITION WITH EXPRESSION
*D*               BITS 28-31  =     THE RESOLUTION OF NAME2
*D*                                   CODES ARE:
*D*                                     0 = BYTE
*D*                                     1 = HALF WORD
*D*                                     2 = WORD
*D*                                     3 = DOUBLE WORD
*D*                                     4 = NONE
*D*      WORD 1-N             =     TEXTC FOR NAME1
*D*      WORD N+1-M           =     TEXTC FOR NAME2
*D*      WORD M+1             =     +-VALUE2
*D*
DEF      AI,N     1                 SET TO WA(DEF NAME)
         MTB,0    *N
         BEZ      ERR               ERROR IF NO DEF NAME PRESENT
         BAL,SR4  RSEARCH           SEE IF IT IS IN RFDFSTK
         BAL,SR4  RADD              IF NOT, PUT IT IN
         LW,LO    A                 SAVE LOC OF DEF ITEM
         LB,X     *N                N:=WA(EXPR)-1
         SLS,X    -2
         AW,N     X
         BAL,SR4  EVALR             EVALUATE EXPR
         BAL,SR4  RADD              ADD REF IF NECESSARY
         B        DEF1
         STW,M    RRW,LO            STORE RES WORD,
         STW,V    RVW,LO               AND VALUE IN DEF ITEM
         LI,K     RTB               SET TYPE TO 'DEF'
         LI,X     0
         STB,X    *LO,K
         BAL,SR4  EFIX
         B        MEXIT
ADDDE    AI,N     1
         MTB,0    *N
         BEZ      ERR
         BAL,SR4  RSEARCH
         BAL,SR4  DADD
         LW,LO    A
         LB,X     *N
         SLS,X    -2
         AW,N     X
         BAL,SR4  EVALR
         BAL,SR4  RADD
         B        DEF1
         STW,M    RRW,LO
         STW,V    RVW,LO
         LI,K     RTB
         LI,X     0
         STB,X    *LO,K
         LW,N     PCW,P
         AI,N     1
         LB,X     *N
         SLS,X    -2
         AW,N     X
         AI,N     1
DEF1     LW,X     LO
         LI,LO    PRLH
         LH,LO    *P,LO
         SLS,LO   1
         SW,X     LO                X:= INDEX OF DEF ITEM
         LI,Y     0
         BAL,SR4  EADD
         B        MEXIT
         PAGE
*D*
*D*      NAME:    MOD
*D*      ENTRY:   MOD2
*D*      ENTRY:   MEXIT
*D*      DESCRIPTION:  MOD -- PROCESS A MOD (MODIFICATION) TYPE
*D*               CHANGE DESCRIPTION TABLE REQUEST. WHEN A CORE
*D*               MODIFICATION REQUEST IS ENCOUNTERED,
*D*               NAME1+-VALUE1 IS EVALUATED & IS THE
*D*               DESTINATION ADRESS WORD WHEN THE EXPRESSION
*D*               NAME2+-VALUE2 IS EVALUATED. IF THERE IS NO
*D*               NAME1, VALUE1 THEN BECOMES THE DESTINATION.
*D*               THE EXPRESSION NAME2+-VALUE2 IS THEN
*D*               INTERROGATED. IF THERE IS A NAME2, IT MUST
*D*               HAVE BEEN PREVIOUSLY DEFINED WITH COMPLETE
*D*               EVALUATION. IF THERE IS NO NAME2, I.E., ONLY
*D*               +-VALUE2, THEN THE RESULT OF THE EXPRESSION
*D*               EVALUATION WILL BE THE SAME AS IF THERE WAS
*D*               A NAME2 WHOSE VALUE IS 0. AFTER
*D*               EVALUATING NAME2+-VALUE2, THE ENTIRE 32 BIT
*D*               VALUE WILL REPLACE THE CONTENTS OF THE
*D*               DESTINATION ADDRESS. THE EXPRSTK IS THEN
*D*               CHECKED TO SEE IF ANY OF ITS ENTRIES CONTAIN
*D*               A DESTINATION ADDRESS EQUAL TO THE
*D*               DESTINATION ADDRESS NAME1+-VALUE1, AND IF SO,
*D*               EACH SUCH EXPRSTK ENTRY IS REMOVED BY SETTING
*D*               A FLAG IN THAT ENTRY INDICATING THAT THIS
*D*               EXPRESSION HAS BEEN EVALUATED.
*D*
*D*                 MOD2 -- PERFORM MODIFICATION OF CORE
*D*                         DESTINATION WITH NAME2+-VALUE2
*D*                         EVALUATION.
*D*
*D*                 MEXIT -- NORMAL EXIT ROUTINE FROM MODIFY.
*D*
*D*      INPUT:   R13 = ADDRESS OF CHANGE DESCRIPTION TABLE
*D*
*D*      INTERFACE:  LOC,EVALR,ERR,CHCORE.
*D*      REGISTERS:  R1,R11,R14-R15 USED, R5-R11 RESTORED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
*D*               THE FOLLOWING SHOWS THE STRUCTURE OF THE
*D*               CHANGE DESCRIPTION TABLE:
*D*
*D*      WORD-0   BYTE-0      = 02  MODIFICATION
*D*               BITS 28-31  =     RESOLUTION OF NAME2
*D*                                   CODES ARE:
*D*                                     0 = BYTE
*D*                                     1 = HALF WORD
*D*                                     2 = WORD
*D*                                     3 = DOUBLE WORD
*D*                                     4 = NONE
*D*      WORD 1-N             =     TEXTC FOR NAME1
*D*      WORD N+1             =     +-VALUE1
*D*      WORD N+2-M           =     TEXTC FOR NAME2
*D*      WORD M+1             =     +-VALUE2
*D*
MOD      BAL,SR4  LOC               EVALUATE LOC EXPR
         BAL,SR4  EVALR             EVALUATE CHANGE EXPR
         B        ERR               ERROR IF EXPRESSION NOT DEFINED
         B        ERR
         LW,I     R
         LW,M     MASK,I
         EOR,M    M32               MASK FOR NON-RELOCATED PART OF VAL
         LS,V     *N                FIX VALUE
         LI,M     -1                SET MASK TO STORE ENTIRE VALUE
MOD2     BAL,SR4  CHCORE
MEXIT    LCI      7                 MAIN EXIT FROM MODIFY
         PLM,R5   *R0               RESTORE R5-R7, SR1-SR4
         LCI      0                 CC1 := 0
         B        *SR4              RETURN TO USER
         PAGE
*D*
*D*      NAME:    DICT
*D*      DESCRIPTION:  PROCESS A DICT (RELOCATION
*D*               DICTIONARY) TYPE CHANGE DESCRIPTION
*D*               TABLE REQUEST. WHEN A DICT REQUEST IS
*D*               ENCOUNTERED, NAME1+-VALUE1 IS EVALUATED
*D*               & REPRESENTS THE DESTINATION ADDRESS FOR
*D*               WHICH A RELOCATION DICTIONARY MODIFICATION
*D*               IS DESIRED. THIS TYPE OF REQUEST WILL NORMALLY
*D*               ACCOMPANY A MOD REQUEST. THAT IS, IF A CORE
*D*               MODIFICATION IS MADE, ITS CORRESPONDING
*D*               RELOCATION DICTIONARY ENTRY MAY ALSO REQUIRE
*D*               A RESOLUTION CODE CHANGE. THE ADDRESS
*D*               NAME1+-VALUE1 RELATIVE TO THE SECTIONS BASE
*D*               BECOMES THE RELATIVE DIGIT POSITION
*D*               (4 BITS PER DIGIT IN DICTIONARY) IN THE
*D*               SECTIONS RELOCATION DICTIONARY. THE REQUEST IS
*D*               IGNORED IF CALLER OF MODIFY HAS SPECIFIED
*D*               HIS OWN SUBROUTINE FOR PURPOSES OF DOING
*D*               ANY MODIFICATIONS THRU MOD REQUESTS.
*D*
*D*      INPUT:   R7 = ADDRESS OF MASTER PLIST
*D*               R13= ADDRESS OF CHANGE DESCRIPTION TABLE
*D*
*D*      INTERFACE:  MEXIT,LOC,CC5.
*D*      REGISTERS:  R4,R8,R10-R11,R15 USED
*D*      ENVIRONMENT:  MAPPED, SLAVE
*D*
*D*               THE FOLLOWING SHOWS THE STRUCTURE OF THE
*D*               CHANGE DESCRIPTION TABLE:
*D*
*D*      WORD-0   BYTE-0      = 03  DICT CHANGE DESCRIPTION TABLE
*D*               BITS 28-31  =     RELOCATION CODE TO BE USED TO
*D*                                 MODIFY THE RELOCATION
*D*                                 DICTIONARY
*D*      WORD 1-N             =     TEXTC FOR NAME1
*D*      WORD N+1             =     +-VALUE1
*D*
DICT     MTW,0    PSW,P             DO NOT CHANGE DICT IF
         BNEZ     MEXIT             USER-STACKING EQUESTED
         BAL,SR4  LOC               EVALUATE LOC EXPR
         AND,LO   M17               REMOVE FIELD INFO, IF ANY
         LW,R     PCW,P
         LW,R     *R                GET DICT CODE
         OR,R     Y8                SET R<0
         LI,M     0                 SET MASK=0 TO PREVENT CORE CHANGE
         LI,X     MEXIT             PUSH 'MEXIT' ONTO STACK
         PSW,X    *R0
         B        CC5               GO INTO 'CHCORE'
         END

