*
*M*      T:OV     MONITOR OVERLAY PROCESSOR
*P*
*P*      NAME:    T:OV
*P*
*P*      PURPOSE: (1) TO ASSOCIATE ALL MONITOR AND PROCESSOR OVERLAYS
*P*
*P*               (2) TO INITIATE A GHOST JOB
*P*
*P*               (3) TO DEFINE OVERLAY ENTRY POINTS
*P*
*P*
*P*      DESCRIPTION:
*P*           (1) MONITOR OVERLAYS AND SHARED PROCESSOR OVERLAYS RESIDE
*P*               ON THE SWAPPER AND ARE DEFINED BY THE SHARED PROCESSOR
*P*               TABLES.  THE OVERLAYS ARE ASSOCIATED BY SETTING THE
*P*               INDEX TO THE SHARED PROCESSOR TABLE IN UB:OV (IF MONITOR
*P*               OVERLAY) OR UB:APO (IF SHARED PROCESSOR OVERLAY) AND
*P*               REG'ING THE USER WITH THE ASSOCIATE PROCESSOR EVENT
*P*               SPECIFIED.
*P*
*P*           (2) A GHOST JOB IS INITIATED BY SETTING UP THE GHOST
*P*               JOB TABLES AND CALLING THE ADD1 ROUTINE IN SCHED
*P*               TO INITIATE A NEW JOB.
*P*
*P*           (3) OVERLAYS (PRIOR TO MREF) HAVE ONLY ONE ENTRY POINT.
*P*               EACH OVERLAY HAS AN INTERNAL BRANCH TABLE TO DRIVE
*P*               TO VARIOUS ROUTINES WITHIN THE OVERLAY.  WHEN ENTERED,
*P*               R0 CONTAINS THE BRANCH TABLE INDEX TO DRIVE TO THE
*P*               CORRECT ROUTINE.
*P*
*P*               THE INDEX TO THE ROUTINE IS DEFINED BY THE 'AD1'
*P*               PROC, WHICH SIMPLY GENERATES A SEQUENTIAL INDEX
*P*               VALUE, AND A DEF FOR THAT VALUE, FOR EACH ROUTINE
*P*               SPECIFIED.  THE ROUTINES MUST BE SPECIFIED IN THE
*P*               SAME ORDER AS THE INTERNAL BRANCH TABLE WITHIN
*P*               THE OVERLAY.
*P*
         PAGE
*        CREATED 12/29/71   PJH
         PCC      0
*        MREF ADDED  1/12/74 AR
         SYSTEM   SIG7FDP
UTSPROC SET    0
MONPROC SET    1
S69PROC  SET      1
         SYSTEM   UTS
PUSH     CNAME    0
PULL     CNAME    1
         PROC
LF       LCI      AF(1)&X'F'
         DO       NAME=0
         PSM,AF(2) TSTACK
         ELSE
         PLM,AF(2) TSTACK
         FIN
         PEND
*
AD1      CNAME
         PROC
LF       SET      ADD1MO+1
ADD1MO   SET      ADD1MO+1
         DISP     LF
         DEF      LF
         PEND
         PAGE
*
*        REGISTER DEFINITIONS
*
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
         PAGE
T:OV:    EQU      %
*
*
* MODULE ENTRY POINTS
*
         DEF      T:OV:             MODULE BIAS
         DEF      T:PROCOV          TO LOAD SHARED PROCESSOR OVERLAY
         DEF      T:OVER            TO LOAD A MONITOR OVERLAY
         DEF      T:OVERLAY         TO LOAD A MONITOR OVERLAY AND
*,*                                  REMEMBER THE RETURN
         DEF      T:OVERLAY1        TO LOAD A MONITOR OVERLAY AND
*,*                                  REMEMBER THE RETURN
         DEF      T:REMEMBER        TO SAVE THE CURRENT OVERLAY AND
*,*                                  RETURN ADDRESS IN OSTACK
         DEF      T:OVB             SAME AS T:OVER FOR MREF
         DEF      T:OVBAL           SAVE AS T:OVERLAY FOR MREF
         DEF      RETURN            RETURN FROM T:OVBAL FOR MREF
         DEF      T:OV              TO LOAD KEY-IN
         DEF      T:SELFDESTRUCT    EXIT POINT FOR A OVERLAY TO
*,*                                  DISASSOCIATE ITSELF AND RETURN
         DEF      T:INITJOB         TO PROCESS THE INITIATE GHOST JOB CAL
         DEF      T:GJOBSTRT        MONITOR INITIATING A GHOST JOB IN :SYS
         DEF      T:GJOB            MONITOR INITIATING A GJOB NOT IS :SYYS
         DEF      T:GJOBR           KEY-IN INITIATING A GHOST JOB AND
*,*                                  PASSING RESOURCES
*
* MODULE REFS
*
         REF      PB:LCT
         REF      S:RTCORE
         REF      UH:FLG2
         REF      E:AP
         REF      J:JIT
         REF      MAXOVLY
         REF      P:NAME
         REF      PB:UC
         REF      PB:REP
         REF      PH:FRQ
         REF      P:SA
         REF      RCVPSD
         REF      S:CUN
         REF      T:REG
         REF      UB:APO
         REF      UB:OV
         REF      NB31TO0
XFFFE    EQU      NB31TO0+1
         REF      TSTACK
         REF      PB:PVA,PB:PSZ,T:SNAC,FPMC
         REF      S:MAPCW
         REF     JX:CMAP
         REF      SPMAP,PX:HPP,UX:JIT,JXCMAP
         REF      UH:FLG
         REF,1    JB:PRIV
TIC      EQU      X'80'
         REF      CC1SET
         REF      CC2SET
         REF      CC0RST
         REF      BOOTFLG
         REF      MAP,UNMAP
         REF      MAXG
         REF      MING
         REF      SB:HQ
         REF      UB:BL
         REF      UB:FL
         REF      S:GUIS
         REF      UB:US
         REF      E:WU
         REF      T:RUE
         REF      S:GJOBTBL
         REF      SB:GJOBUN
         REF      SW
         REF      SQFI
         REF      ADD1
         REF      :BIG
         REF      SB:TQ             TAILS OF QUEUES
         REF      SL:GPRIO          DEFAULT GHOST PRIORITY
         REF      UB:PRIOB          BASE PRIORITY FOR USER
         REF      S:GJOBACN         GHOST JOB ACCOUNT
         REF      SYSACT            ':SYS    '
         PAGE
*F*
*F*      NAME:    T:PROCOV
*F*
*F*      PURPOSE: TO LOAD AN OVERLAY FOR A SHARED PROCESSOR
*F*
*F*      DESCRIPTION:  THE ACCESS CODES AND CMAP FOR THE PROCESSOR
*F*               OVERLAY AREA ARE RE-INITIALIZED.  ANY CURRENTLY
*F*               ASSOCIATED PROCESSOR OVERLAY IS DISASSOCIATED AND
*F*               THE REQUESTED OVERLAY IS ASSOCIATED.
*F*
*D*      NAME:    T:PROCOV
*D*
*D*      CALL:    BAL,1   T:PROCOV
*D*                  (ENTERED FROM ALTCP)
*D*
*D*      INPUT:   R4 = INDEX TO OVERLAY IN SHARED PROCESSOR TABLES
*D*
*D*      OUTPUT:  R15 = WA (UB:APO)
*D*
*D*      DESCRIPTION:  THE REGISTERS FOR THE OV0 ROUTINE ARE SET UP
*D*               AND OV0 IS ENTERED AT 'OV20' TO ASSOCIATE THE
*D*               PROCESSOR OVERLAY.  CONTROL WILL THEN RETURN TO
*D*               ALTCP VIA THE LINK REGISTER R1.
*D*
T:PROCOV EQU      %
         PUSH     7,14
         LI,15    UB:APO            PROCESSOR OVERLAY TABLE ADDRESS
         B        OV20
         PAGE
*F*
*F*      NAME:    T:OVER
*F*
*F*      PURPOSE: TO LOAD A MONITOR OVERLAY WHEN THE CURRENT OVERLAY
*F*               NEED NOT BE REMEMBERED.
*F*
*F*      DESCRIPTION:  ANY CURRENTLY ASSOCIATED OVERLAY IS
*F*               DISASSOCIATED AND THE REQUESTED OVERLAY IS
*F*               LOADED AND ENTERED.
*F*
*D*      NAME:    T:OVER
*D*
*D*      INPUT:   R0 = INDEX TO OVERLAY ENTRY POINT
*D*               R2 = OVERLAY #
*D*
*D*      OUTPUT:  R2-R3 = OVERLAY NAME
*D*               R1 = 0 (TRANSFER CONTROL TO ADDRESS IN P:SA)
*D*
*D*      DESCRIPTION:  THE REGISTERS FOR THE OV0 ROUTINE ARE SET
*D*               UP AND CONTROL TRANSFERS TO OV0 TO ASSOCIATE THE
*D*               REQUESTED OVERLAY.
*D*
T:OVER   EQU      %
         PUSH     7,14
         LD,2     SEGNAME,2
         LI,1     0
         B        OV0
         PAGE
*F*
*F*      NAME:    T:OVERLAY
*F*
*F*      PURPOSE: TO LOAD A MONITOR OVERLAY AND SAVE THE CURRENT
*F*               OVERLAY NUMBER AND RETURN ADDRESS IN OSTACK.
*F*               THIS ALLOWS ONE OVERLAY TO CALL ANOTHER.
*F*
*F*      DESCRIPTION:  THE CURRENTLY ASSOCIATED OVERLAY # AND THE
*F*               RETURN ADDRESS ARE SAVED IN OSTACK.  THE CURRENTLY
*F*               ASSOCIATED OVERLAY IS DISASSOCIATED AND THE REQUESTED
*F*               OVERLAY IS LOADED AND ENTERED.
*F*
*F*               AFTER RETURN FROM THE REQUESTED OVERLAY, THE INFORMATION
*F*               FOR THE ORIGINAL OVERLAY IS OBTAINED FROM OSTACK AND
*F*               THE OVERLAY IS RE-ASSOCIATED AND RE-ENTERED.
*F*
*D*      NAME:    T:OVERLAY
*D*
*D*      CALL:    BAL,11  T:OVERLAY
*D*
*D*      INPUT:   R0 = INDEX TO OVERLAY ENTRY POINT
*D*               R2 = OVERLAY #
*D*
*D*      OUTPUT:  R2-R3 = OVERLAY NAME
*D*               R1 = 0 (TRANSFER CONTROL TO ADDRESS IN P:SA)
*D*
*D*      DESCRIPTION:  THE T:REMEMBER LOGIC IS ENTERED TO SAVE THE
*D*               RETURN ADDRESS AND CURRENTLY ASSOCIATED OVERLAY
*D*               IN OSTACK.
*D*
*D*               THE EXIT FROM T:REMEMBER WILL DRIVE TO THE OV0
*D*               ROUTINE TO LOAD AND ENTER THE OVERLAY.
*D*
*D*               WHEN THE OVERLAY EXITS CONTROL RETURNS TO THE
*D*               T:RESTORE   LOGIC WHICH GETS THE RETURN INFORMATION
*D*               FROM OSTACK, RE-ASSOCIATES THE OVERLAY THAT MADE THE
*D*               T:OVERLAY CALL, AND RE-ENTERS THAT OVERLAY.
*D*
T:OVERLAY         EQU               %
         PUSH     7,14
         LD,2     SEGNAME,2
         LI,1     0
         B        T:OVERLAY1+2      REMEMBER/LOAD OVERLAY
         PAGE
*F*
*F*      NAME:    T:OVERLAY1
*F*
*F*      PURPOSE: TO LOAD A MONITOR OVERLAY AND SAVE THE RETURN
*F*               INFORMATION IN OSTACK.
*F*               THIS ALSO ALLOWS ONE OVERLAY TO CALL ANOTHER.
*F*
*F*      DESCRIPTION:  THIS ROUTINE PERFORMS THE SAME FUNCTIONS AS
*F*               THE T:OVERLAY ROUTINE.  THE ONLY DIFFERENCE IS
*F*               THAT T:OVERLAY1 IS ENTERED WITH THE SEGMENT NAME
*F*               IN R2-R3 AND THE ADDRESS OF THE ROUTINE TO BE
*F*               ENTERED IN R1.
*F*
*D*      NAME:    T:OVERLAY1
*D*
*D*      CALL:    BAL,11  T:OVERLAY1
*D*
*D*      INPUT:   R2-R3 = OVERLAY NAME
*D*               R1 = ADDRESS WITHIN THE OVERLAY OF THE ROUTINE
*D*                     TO BE ENTERED
*D*
*D*      DESCRIPTION:  SEE T:OVERLAY 'D' REPORT.
*D*
T:OVERLAY1  EQU   %
         PUSH     7,14
         LI,14    OV0               TO LOAD OVERLAY AFTER T:REMEMBER
*
*                                   FALL THROUGH TO T:REMEMBER
         PAGE
*F*
*F*      NAME:    T:REMEMBER
*F*
*F*      PURPOSE: TO SAVE THE CURRENT OVERLAY NUMBER AND THE ADDRESS
*F*               IN R11 IN OSTACK FOR FUTURE OVERLAY EXIT.
*F*
*F*      DESCRIPTION:  ONE OVERLAY MAY CALL ANOTHER AND BE RE-ENTERED
*F*               WHEN THE CALLED OVERLAY EXITS.  THIS IS ACCOMPLISHED
*F*               THROUGH THE USE OF OSTACK.
*F*
*F*               EACH ENTRY IN OSTACK IS ONE WORD.  BYTE 0 CONTAINS
*F*               THE INDEX TO THE PROCESSOR TABLES OF THE OVERLAY
*F*               ASSOCIATED WITH THE USER WHEN AN OVERLAY CALL IS
*F*               MADE.  BYTES 1-3 CONTAIN THE ADDRESS TO RETURN TO
*F*               WHEN RETURNING TO THE OVERLAY.
*F*
*F*               OSTACK IS CONTAINED AT THE TOP OF THE USER'S TSTACK
*F*               IN JIT.  WHEN AN OSTACK ENTRY IS REQUIRED, THE
*F*               ADDRESS FOR THE ENTRY IS FOUND BY ADDING THE NUMBER
*F*               OF WORDS REMAINING IN TSTACK TO THE CURRENT TOP OF
*F*               STACK.  WHEN THE ENTRY IS IN USE THE NUMBER OF WORDS
*F*               REMAINING IN TSTACK IS DECREMENTED BY ONE.
*F*
*F*               T:REMEMBER IS CALLED FROM OTHER MODULES WHEN THE
*F*               EXIT FOR THE NEXT T:OVER CALL IS TO BE ESTABLISHED.
*F*
*F*               T:REMEMBER IS CALLED INTERNALLY BY T:OVERLAY AND
*F*               T:OVERLAY1 TO SAVE THE CURRENT OVERLAY ENVIRONMENT,
*F*               ASSOCIATE AND ENTER ANOTHER OVERLAY, AND RESTORE AND
*F*               RETURN TO THE ORIGINAL OVERLAY.
*F*
*D*      NAME:    T:REMEMBER
*D*
*D*      INPUT:   R11 = ADDR. TO BE REMEMBERED IN OSTACK
*D*
*D*                     ESTABLISHED BY CALLING ROUTINE IF CALLED EXTERNALLY
*D*
*D*                     SET TO RETURN FROM ORIGINAL OVERLAY CALL IF
*D*                     ENTERED VIA T:OVERLAY OR T:OVERLAY1
*D*
*D*               R14 = T:REMEMBER EXIT
*D*
*D*                     LINK REGISTER IF CALLED EXTERNALLY
*D*                           BAL,14  T:REMEMBER
*D*
*D*                     WA(OV0) IF ENTERED VIA T:OVERLAY OR T:OVERLAY1
*D*                               (TO LOAD REQUESTED OVERLAY)
*D*
*D*      OUTPUT:  R11 = WA(T:RESTORE)   TO BE USED AS EXIT FROM
*D*                                                CALLED OVERLAY
*D*
*D*               OSTACK - SEG#, ADDR TO RETURN TO CALLING OVERLAY
*D*
*D*
*D*      REGISTERS: R4 AND R11 DESTROYED
*D*
*D*      DESCRIPTION:   IF NO OVERLAY IS CURRENTLY ASSOCIATED,
*D*               T:REMEMBER SIMPLY EXITS.  OTHERWISE, THE CURRENTLY
*D*               ASSOCIATED OVERLAY AND THE VALUE SUPPLIED IN R11
*D*               ARE STORED IN OSTACK.  IF NO ENTRY IS AVAILABLE IN
*D*               OSTACK, THE SYSTEM CRASHES WITH SOFTWARE CHECK 79-01.
*D*
*D*               THE EXIT FROM T:REMEMBER RETURNS TO THE CALLER WITH
*D*               THE ADDRESS OF T:RESTORE IN R11 IF THE ROUTINE WAS
*D*               CALLED EXTERNALLY.  THE EXIT IS TO OV0 IF CALLED
*D*               FROM T:OVERLAY OR T:OVERLAY1.  AGAIN, R11 CONTAINS
*D*               THE ADDRESS OF T:RESTORE TO BE USED AS THE EXIT
*D*               FROM THE REQUESTED OVERLAY.
*D*
T:REMEMBER  EQU   %
         LW,4     J:JIT
         BEZ      BI14A
         LW,4     S:CUN
         LB,4     UB:OV,4
         BEZ      BI14A
         STB,4    11
         LW,4     TSTACK
         AH,4     TSTACK+1
         MTH,-1   TSTACK+1
         BLZ      OSTACKOVERFLOW
         STW,11   0,4
         BAL,11   *14               EXIT IF CALLED EXTERNALLY
*                                   BAL,11  OV0   IF CALLED INTERNALLY
*                                     (SO 'RESTORE' IS RETURN ADDR. IN
         PAGE
*F*      NAME:    T:RESTORE
*F*
*F*      PURPOSE: TO RESTORE AND RE-ENTER AN OVERLAY
*F*
*F*      DESCRIPTION:  T:RESTORE IS THE COUNTERPART OF T:REMEMBER.
*F*               THE INFORMATION IN OSTACK IS USED TO SET UP THE
*F*               REGISTERS FOR THE OV0 ROUTINE.  OV0 IS THEN ENTERED
*F*               TO RESTORE AND RE-ENTER THE OVERLAY.
*F*
*D*      NAME:    T:RESTORE
*D*
*D*      INPUT:   OSTACK - SEG#, RETURN ADDR
*D*
*D*      OUTPUT:  R1 = RETURN ADDR
*D*               R2/R3 = OVERLAY NAME
*D*
*D*      DESCRIPTION:  THE INFORMATION IN OSTACK IS USED TO SET UP
*D*               THE REGISTERS FOR THE OV0 ROUTINE, THE OSTACK ENTRY
*D*               IS RELEASED, AND CONTROL TRANSFERS TO OV0 TO REASSOCIATE
*D*               AND RE-ENTER THE OVERLAY.
*D*
T:RESTORE PUSH    7,14              BECAUSE OVEXIT PULLED IT
         LW,4     TSTACK
         MTH,1    TSTACK+1
         AH,4     TSTACK+1
         LW,11    0,4
         LB,4     11
         LD,2     P:NAME,4
         LW,1     11
         B        OV0
         PAGE
*F*
*F*      NAME:    T:OV
*F*
*F*      PURPOSE: TO LOAD KEY-IN
*F*
*F*      DESCRIPTION:  AN INTERRUPT FROM THE OC DEVICE CAUSES THE
*F*               'KEYIN' OVERLAY TO BE INITIATED.
*F*
*F*               THE SWAPPER  RECOGNIZES THE SPECIAL CASE OF INITIATING
*F*               'KEYIN' AND SETS UP THE INITIAL EXIT ENVIRONMENT WITH
*F*               THE ADDRESS OF T:OV IN THE USER'S PSD.  THE ADDRESS
*F*               OF T:DELUS (DELETE USER) IS SET AS THE RETURN ADDRESS
*F*               IN R11 OF THE USER'S STACK.  REGISTERS 2 AND 3 IN
*F*               THE STACK CONTAIN TEXTC 'KEYIN'.
*F*
*F*               AFTER STEP HAS INITIALIZED THIS USER CONTROL COMES
*F*               TO T:OV, VIA THE USER PSD, TO LOAD THE 'KEYIN'
*F*               OVERLAY.
*F*
*F*               T:OV LOADS THE KEYIN OVERLAY AND GIVES CONTROL TO IT
*F*               AT THE ADDRESS SPECIFIED IN P:SA.
*F*
*D*      NAME:    T:OV
*D*
*D*      INPUT:   R1 = 0 (TRANSFER CONTROL TO ADDR IN P:SA)
*D*               R2/R3 = OVERLAY NAME (KEYIN)
*D*               R11 = WA(T:DELUS)  RETURN ADDRESS
*D*
*D*      ENVIRONMENT:  MASTER/MAPPED
*D*
*D*      DESCRIPTION:  CONTROL TRANSFERS TO OV0 TO LOAD THE OVERLAY
*D*                     KEYIN.
*D*
T:OV     EQU       %
         PUSH     7,14
*                                   FALL THROUGH TO OV0
         PAGE
*F*
*F*      NAME:    OV0
*F*
*F*      PURPOSE:  COMMON SUBROUTINE TO ASSOCIATE AN OVERLAY FOR
*F*               EITHER THE MONITOR OR A SHARED PROCESSOR.
*F*
*F*      DESCRIPTION:  IF ASSOCIATING A SHARED PROCESSOR OVERLAY,
*F*               ACCESS CODES AND CMAP FOR THE OVERLAY AREA ARE
*F*               RE-INITIALIZED.
*F*
*F*               ANY CURRENTLY OVERLAY IS DISASSOCIATED BY DECREMENTING
*F*               ITS USE COUNTS (PB:UC AND PB:REP).
*F*
*F*               THE REQUESTED OVERLAY IS ASSOCIATED BY INCREMENTING
*F*               ITS USE COUNTS.
*F*
*F*               IF THE OVERLAY IS ALREADY IN CORE, THE USER'S CMAP
*F*               IS UPDATED TO RREFLECT THE PAGES CONTAINING THE
*F*               OVERLAY AND THE MAP FOR THE OVERLAY AREA IS RELOADED.
*F*
*F*               IF THE OVERLAY IS NOT IN CORE, THE USER IS REG'ED
*F*               WITH THE ASSOCIATE PROCESSOR EVENT SPECIFIED.  THE
*F*               SWAPPER WILL READ THE OVERLAY INTO CORE AND SET UP
*F*               THE USER'S CMAP.
*F*
*D*
*D*      NAME:    OV0
*D*
*D*      CALL:    ENTERED FROM T:OVER, T:OVERLAY, AND T:OVERLAY1 TO
*D*               ASSOCIATE A MONITOR OVERLAY
*D*
*D*               ENTERED FROM T:OV TO ASSOCIATE KEY-IN
*D*
*D*               ENTERED AT 'OV20' FROM T:PROCOV TO ASSOCIATE A
*D*               SHARED PROCESSOR OVERLAY
*D*
*D*      INPUT:   ENTERED WITH R14-R15, R0-R4 PUSHED IN TSTACK, AND:
*D*
*D*                 R1 = OV0 EXIT ADDRESS:
*D*
*D*                       RETURN TO ALTCP (ENTERED FRROM T:PROCOV)
*D*
*D*                       0 IF P:SA FOR REQUESTED OVERLAY IS TO BE USED
*D*                            (ENTERED FROM T:OV, T:OVER OR T:OVERLAY)
*D*
*D*                       ADDR. OF ROUTINE WITHIN OVERLAY TO BE ENTERED
*D*                            (ENTERED FROM T:OVERLAY1)
*D*
*D*                 R2/R3 = OVERLAY NAME
*D*
*D*                 R15 = WA(UB:APO) IF ENTERED FROM T:PROCOV
*D*
OV0      EQU      %
         LI,4     MAXOVLY
OV1      EQU      %
         CD,2     P:NAME,4
         BE       T:OV2
         BDR,4    OV1
         SUA      X'1D'             SUA .1D
*S*
*S*      SCREECH CODE: 1D-00
*S*
*S*      REPORTED BY:  T:OV
*S*
*S*      MESSAGE:  REQUESTED OVERLAY IS OUT OF RANGE
*S*
*S*      TYPE:   SUA
*S*
*S*      REGISTERS:  R2-R3 = OVERLAY NAME
*S*
*S*      REMARKS:  REQUESTED MONITOR OVERLAY NOT IN SHARED PROCESSOR
*S*                 TABLES.
*S*
*
T:OV2    EQU      %
         LI,15    UB:OV
         AI,1     0                 WAS START ADDRESS SPECD
         BG       OV10              BRANCH IF YES
         LW,1     P:SA,4            GET STARTING ADR OF THIS OVERLAY
OV10     EQU      %
*                                   LEGAL START ADDRESS
*                                   BRANCH IF NO.
OV20     EQU      %
         LI,2     -2
         STW,1    *TSTACK,2
         LW,2     S:CUN             GET CURRENT USER #
         CB,4     *15,2             IS REQUESTED OVERLAY ALREADY
*                                   ASSOCIATED?
         BE       OVXIT
         LB,3     *15,2
         BEZ      NOOV
         CI,15    UB:APO            SET ACCESS IF PROCESSOR O.L.     RL3
         BNE      NOOV                                               RL3
         XW,3     15
         LCI      14
         PSM,2    TSTACK
         LW,3     15
         LB,8     PB:PSZ,3          PAGES FOR OLD                    RL3
         LB,7     PB:PVA,3          STARTING VIRTUAL PAGE            RL3
         LB,6     PB:PSZ,4          AND COUNT%FOR NEW                RL3
         LI,4     1                 PP ACCESS                        RL3
         LW,9 6
         BAL,11   T:SNAC            SET PP ACCESS FOR NEW            RL3
         SW,8     9                 IS OLD > NEW                     RL3
         BLEZ     EOV               NO                               RL3
         LW,6     8                 COUNT OF REMAINDER               RL3
         LI,4     3                 NO ACCESS (11)
         LW,9 7
         BAL,11   T:SNAC            SET NO ACCESS
       LW,7 9
         LI,4     FPMC
         STORE,4  JX:CMAP,7         RE-INITIALIZE CMAP
         AI,7     1                                                  RL3
         BDR,8    %-2                                                RL3
EOV      EQU      %                                                  RL3
         LCI      14
         PLM,2    TSTACK
         XW,15    3
NOOV     EQU      %
         LI,1     OVXIT
NOOV1    EQU      %
         PSW,1    TSTACK
         MTB,-1   PB:UC,3           DECREMENT USE COUNT
         LH,14    UH:FLG2,2         GET FLAGS
         CI,14    X'800'            LOCKED IN CORE
         BAZ      NOOVA             NO
         AI,3     0                 SKIP IF
         BEZ      NOOVA             NO O.V.
         MTB,-1   PB:LCT,3          DEC. LCT
         BG       NOOVA             STILL LOCKED
         LB,1     PB:PSZ,3          GET PSZ
         LCW,1    1                 AND TAKE IT
         AWM,1    S:RTCORE          FROM RTCORE
NOOVA    STB,4    *15,2             SEG # TO USER TABLE
         MTB,1    PB:UC,4           INCREMENT USE COUNT FOR NEW OVERLAY
         CI,15    UB:OV
         BNE      NOTINCORE
         MTB,-1   PB:REP,3          DECREMENT MONITOR OVERLAY COUNT
         MTB,1    PB:REP,4          INCREMENT MONITOR OVERLAY COUNT
         MODTST   PX:HPP,4          IS THE OVERLAY IN CORE
         BEZ      NOTINCORE         NO
         MTH,1    PH:FRQ,4          COUNT UP CALLS
         CI,14    X'800'            LOCKED IN CORE
         BAZ      NOOVB             NO
         MTB,0    PB:LCT,4          ALREADY LOCKED
         BG       %+3               YES
         LB,1     PB:PSZ,4          NO, GET PSZ
         AWM,1    S:RTCORE          AND ADD IT IN
         MTB,1    PB:LCT,4          BUMP LCT
NOOVB    PUSH     3,6               SPMAP DOES THEM IN
         LOAD,7   UX:JIT,2          JIT ADDRESS
         SLS,7    11                BYTE RESOLUTION
         AI,7     JXCMAP            DISPLACEMENT TO CMAP
         SLS,7    -:BIG             BYTES FOR 7, HALFWORDS FOR 9
         BAL,1    UNMAP
         LW,2     4                 OVERLAY # TO 2
         BAL,4    SPMAP             UPDATE CMAP TO REFLECT THIS OVERLAY
         LW,2     S:CUN
         LOAD,6   UX:JIT,2          JIT ADDRESS
         LB,4     UB:OV,2
         LB,7     PB:PVA,4          OVERLAY VIRTUAL PAGE
         SLD,6    9                 MAKE BOTH WORD ADDRESS
         OR,6     S:MAPCW           MAP CONTROL WORD R
         OR,7     MAPCW1            MAP CONTROL WORD RU1
         LDMAP,6  0
         BAL,1    MAP
         PULL     3,6
         B        NOOV2
NOTINCORE EQU     %
*
         LH,3     UH:FLG,2          RESET READY TO RUN FLAG
         AND,3    XFFFE             FOR CURRENT USER.
         STH,3    UH:FLG,2
*
         PSW,11   TSTACK
         PSW,6    TSTACK
         LI,6     E:AP              ASSOCIATE PROCESSOR EVENT CODE
*
*
         BAL,11   T:REG             (REG UNINHIBITS INTERRUPTS)
         CI,14    X'800'            LOCKED IN CORE
         BAZ      NOOVC             NO
         MTB,0    PB:LCT,4          ALREADY LOCKED
         BG       %+3               YES
         LB,1     PB:PSZ,4          NO, GET PSZ
         AWM,1    S:RTCORE          AND ADD IT IN
         MTB,1    PB:LCT,4
NOOVC    PLW,6    TSTACK
         PLW,11   TSTACK
NOOV2    EQU      %
         PLW,1    TSTACK
         B        0,1
OVXIT    EQU      %
         PULL     7,14
         B        0,2
BI14A    B        *14
OSTACKOVERFLOW EQU   %
**********************************************************
         BLOCK                      WILL PARK SLAVE USER
**********************************************************
         SUA      X'79',1
*S*
*S*      SCREECH CODE:  79-01
*S*
*S*      REPORTED BY:  T:OV
*S*
*S*      MESSAGE:  MONITOR STACK TRAP
*S*
*S*      TYPE:  SUA
*S*
*S*      REMARKS:  OSTACK OVERFLOW
*S*
         PAGE
         REF      T:OVBALPSD,T:OVBPSD,SKIPPSD,J:OVRLY,M7,M17
*F*
*F*      NAME:    T:OVB
*F*
*F*      PURPOSE: TO LOAD A MONITOR OVERLAY CALLED VIA A BRANCH
*F*               INSTRUCTION SATISFIED AS AN MREF.
*F*
*F*      DESCRIPTION:  T:OVB PERFORMS THE SAME FUNCTIONS AS T:OVER.
*F*
*F*               A BRANCH INSTRUCTION THAT IS SATISFIED AS AN MREF
*F*               IS REPLACED (BY THE LOADER) WITH AN XPSD INSTRUCTION
*F*               THAT TRANSFERS CONTROL TO T:OVB.
*F*
*F*               T:OVB OBTAINS THE OVERLAY NUMBER AND THE ADDRESS
*F*               WITHIN THE OVERLAY TO BE ENTERED.
*F*
*F*               ANY CURRENTLY ASSOCIATED OVERLAY IS DISASSOCIATED AND
*F*               THE REQUESTED OVERLAY IS ASSOCIATED AND ENTERED.
*F*
*D*      NAME:    T:OVB
*D*
*D*      CALL:    MREF TABLE ENTRIES:
*D*
*D*               XPSD,0    T:OVPSD
*D*               GEN,8,4,3,17  SEG#,0,0,ADDR. WITHIN OVERLAY
*D*
*D*      DATA:    T:OVPSD =        0
*D*                                0
*D*                         A(T:OVB)
*D*                         17000000
*D*
T:OVB    EQU      %
         PUSH     7,14
         LW,0     *T:OVBPSD         MREF B
         WD,0     X'27'             ENABLE
         STW,0    J:OVRLY
         B        CALL1
         PAGE
*F*
*F*      NAME:    T:OVBAL
*F*
*F*      PURPOSE: TO A LOAD A MONITOR OVERLAY CALLED VIA A BRANCH AND
*F*               LINK INSTRUCTION SATISFIED AS AN MREF.
*F*
*F*      DESCRIPTION:  T:OVBAL PERFORMS THE SAME FUNCTIONS AS T:OVERLAY.
*F*
*F*               A BAL INSTRUCTION THAT IS SATISFIED AS AN MREF IS
*F*               REPLACED (BY THE LOADER) WITH AN XPSD INSTRUCTION
*F*               THAT TRANSFERS CONTROL TO T:OVBAL.
*F*
*F*               T:OVBAL OBTAINS THE OVERLAY NUMBER, LINK REGISTER,
*F*               AND THE ADDRESS OF THE ROUTINE WITHIN THE OVERLAY
*F*               TO BE EXECUTED.  A BAL INSTRUCTION IS BUILT WITH
*F*               THIS INFORMATION TO BE EXECUTED BY T:OVBAL.
*F*
*F*               THE CURRENTLY ASSOCIATED OVERLAY NUMBER AND THE
*F*               ADDRESS TO RETURN TO THAT OVERLAY ARE SAVED IN OSTACK.
*F*               THE CURRENTLY ASSOCIATED OVERLAY IS DISASSOCIATED AND
*F*               THE REQUESTED OVERLAY IS ASSOCIATED VIA OV0.  THE
*F*               OVERLAY IS ENTERED BY EXECUTION OF THE T:OVBAL BUILT
*F*               BAL INSTRUCTION.
*F*
*F*               WHEN THE OVERLAY EXITS VIA THE LINK REGISTER, AN
*F*               XPSD INSTRUCTION WILL BE EXECUTED THAT TRANSFERS
*F*               CONTROL TO 'RETURN'.
*F*
*D*      NAME:    T:OVBAL
*D*
*D*      CALL:    MREF TABLE ENTRIES:
*D*
*D*               XPSD,0    T:OVBALPSD
*D*               GEN,8,4,3,17  SEG#,LINK,0,ADDR. WITHIN OVERLAY
*D*
*D*      DATA:    T:OVBALPSD =     0
*D*                                0
*D*                         A(T:OVBAL)
*D*                         17000000
*D*
T:OVBAL  EQU      %
         PUSH     7,14
         LW,0     *T:OVBALPSD       MREF BAL
         WD,0     X'27'             ENABLE
         STW,0    J:OVRLY
         LW,2     S:CUN             CURRENT USER
         LB,3     UB:OV,2           CURRENT OVERLAY
         BEZ      CALL2             NO CURRENT OVERLAY
         LW,1     Y00F
         AND,1    J:OVRLY           LINK REGISTER
         SCS,1    12                RIGHT JUSTIFY
         CI,1     4                 IS A REGISTER IN TSTACK
         BG       %+3               NO
         AW,1     TSTACK            YES-GET IT THERE
         AI,1     -4
         LW,1     0,1
         STB,3    1                 OSTACK=GEN,8,24 SEG#,RETURN ADDRESS
         LW,4     TSTACK
         AH,4     TSTACK+1
         MTH,-1   TSTACK+1          STEAL SPACE
         BLZ      OSTACKOVERFLOW    SC 79 01
         STW,1    0,4               PUSH UP
         LI,0     X'6A'             OP-CODE FOR BRANCH & LINK
         LB,4     J:OVRLY           NEW SEGMENT
         STB,0    J:OVRLY
         LI,15    UB:OV
         BAL,1    NOOV1             ASSOCIATE NEW OVERLAY
         PULL     7,14
         EXU      J:OVRLY           B OR BAL,LINK OVERLAY ADDRESS
         XPSD,0   SKIPPSD
XPSDVECT XPSD,0   SKIPPSD
         XPSD,0   SKIPPSD
         XPSD,0   SKIPPSD
         XPSD,0   SKIPPSD
         XPSD,0   SKIPPSD
*F*
*F*      NAME:    RETURN
*F*
*F*      PURPOSE: TO RESTORE AND RE-ENTER AN OVERLAY (MREF PROCESSING)
*F*
*F*      DESCRIPTION:  RETURN PERFORMS THE SAME FUNCTIONS AS T:RESTORE.
*F*
*F*               THE INFORMATION IN OSTACK IS USED TO SET UP THE
*F*               REGISTERS FOR THE OV0 ROUTINE, THE OSTACK ENTRY
*F*               IS RELEASED, AND THE OVERLAY IS RE-ASSOCIATED
*F*               VIA OV0.
*F*
*D*      NAME:    RETURN
*D*
*D*      CALL:    XPSD,0  SKIPPSD
*D*
*D*      DATA:    SKIPPSD =        0
*D*                                0
*D*                         A(RETURN)
*D*                         17000000
*D*
RETURN   EQU      %
         PUSH     7,14
         LW,1     SKIPPSD
         WD,0     X'27'             ENABLE
         AND,1    M17               ADDRESS
         AI,1     -XPSDVECT         DETERMINE WITCH XPSD WAS EXECUTED
         LW,4     TSTACK
         MTH,1    TSTACK+1
         AH,4     TSTACK+1
         AW,1     0,4               PULL UP
         STW,1    J:OVRLY           RETURN ADDRESS
CALL1    EQU      %
         LW,2     S:CUN
         LB,3     UB:OV,2
CALL2    EQU      %
         LB,4     J:OVRLY
         LI,15    UB:OV
         BAL,1    NOOV1             RE-ASSOCIATE OLD OVERLAY
         PULL     7,14
         B        *J:OVRLY          RETURN
*
*
Y00F     DATA     X'00F00000'
         PAGE
*F*
*F*      NAME:    T:INITJOB
*F*
*F*      PURPOSE: TO PROCESS THE INITIATE GHOST JOB CAL
*F*
*F*      DESCRIPTION:  IF THE USER HAS INSUFFICIENT PRIVILEGE TO
*F*               ISSUE THE CAL CONTROL RETURNS TO HIM WITH CC1 SET.
*F*
*F*               OTHERWISE, THE T:GJOBSTRT ROUTINE IS CALLED TO
*F*               INITIATE THE GHOST JOB.  ANY ERRORS DETECTED BY
*F*               T:GJOBSTRT ARE REPORTED TO THE USER VIA CC SETTINGS.
*F*
*D*      NAME:    T:INITJOB
*D*
*D*      CALL:    B  T:INITJOB
*D*                   (ENTERED FROM ALTCP)
*D*
*D*      INPUT:   R7 = WA(FPT+1)
*D*
*D*      DATA:    FORMAT OF FPT
*D*                 WORD 0  -  X'06000000'
*D*                 WORD 1-2 - TEXTC GHOST JOB NAME
*D*
         REF      BLANK
T:INITJOB EQU     %
         LI,1     JB:PRIV
         LB,0     0,1
         CI,0     X'A0'
         BGE      INITJOB1          GHOST PRIV OK
         LW,1     S:CUN             TIC IS TOO
         LH,1     UH:FLG,1
         CI,1     TIC
         BAZ      CC1SET
INITJOB1 EQU      %
         LW,0     BLANK             GET NAME FROM FPT
         LW,1     BLANK
         LB,2     *7
         AND,2    M7
         STB,2    0
         LB,5     *7,2
         STB,5    0,2
         BDR,2    %-2
*
         BAL,10   T:GJOBSTRT        START IT UP
         BCS,8    CC1SET
         BCS,4    CC2SET
         B        CC0RST
         PAGE
*F*
*F*      NAME:    T:GJOBR
*F*
*F*      PURPOSE: TO INITIATE A GHOST JOB FOR KEY-IN
*F*
*F*      DESCRIPTION:  KEY-IN MAY SPECIFY A RESOURCE TO BE PASSED TO
*F*               THE GHOST JOB IN R2.  IF IT IS SPECIFIED, IT IS
*F*               SAVED IN BYTE 0 OF R10 TO BE USED BY ADD1 (IN THE
*F*               SCHEDULER) FOR RESOURCE ALLOCATION.
*F*
*F*               IF AN ACCOUNT WAS SPECIFIED IN R12-R13 IT IS MOVED
*F*               TO R8-R9.  OTHERWISE, THE :SYS ACCOUNT WILL BE
*F*               USED.
*F*
*F*               CONTROL THEN PASSES TO T:GJOBSTRT TO INITIATE THE
*F*               GHOST JOB.
*F*
*D*      NAME:    T:GJOBR
*D*
*D*      CALL:    BAL,10  T:GJOBR
*D*                  (ENTERED FROM KEYN)
*D*
*D*      INPUT:   R0-R1 = GHOST JOB NAME (TEXTC FORMAT)
*D*
*D*               R2 = INDEX TO SH:RNM (RESOURCE NAME TABLE) OF RESOURCE
*D*                    TO BE PASSED TO THE GHOST JOB
*D*
*D*               R12-R13 = ACCOUNT (TEXT FORMAT)
*D*                 OR
*D*               R12-R13 = 0  IF :SYS ACCOUNT IS TO BE USED
*D*
T:GJOBR  EQU      %
         STB,2    10                SAVE RESOURCE NAME INDEX IN LINK
         CI,12    0                 WAS AN ACCCOUNT NUMBER PASSED
         BEZ      T:GJOBSTRT        NOPE
         LD,8     12                YES - MOVE IT
         B        T:GJOBSTRT+1      ENTER MAIN PATH
         PAGE
*F*
*F*      NAME:    T:GJOBSTRT
*F*
*F*      PURPOSE: TO INITIATE A GHOST JOB
*F*
*F*      DESCRIPTION:  IF THE GHOST JOB TO BE INITIATED IS ALREADY
*F*               IN THE GHOST JOB TABLES, AND IS NOT IN THE SLEEP OR
*F*               QUEUE FOR INTERRUPT STATE (HE IS RUNNING), CONTROL
*F*               IS RETURNED TO THE CALLING ROUTINE WITH CC1 AND CC3
*F*               SET; IF IN THE SLEEP OR QUEUE FOR INTERRUPT STATE,
*F*               A WAKE-UP EVENT IS REPORTED ON THE GHOST AND CONTROL
*F*               RETURNS WITH CC2 SET.
*F*
*F*               OTHERWISE, A SLOT IN THE GHOST JOB TABLES IS OBTAINED.
*F*               IF NONE IS AVAILABLE, CONTROL RETURNS WITH CC1 SET.
*F*
*F*               IF A SLOT IS AVAILABLE, IT IS INITIALIZED AND THE
*F*               'ADD1' ROUTINE IN SCHED IS CALLED TO ADD THE JOB
*F*               TO THE SYSTEM.  CONTROL RETURNS WITH ALL CC RESET.
*F*
*D*      NAME:    T:GJOBSTRT
*D*
*D*      CALL:    BAL,10  T:GJOBSTRT   (IF :SYS)
*D*               BAL,10  T:GJOB   (IF NOT :SYS)
*D*
*D*      INPUT:   R0/R1 = TEXTC GJOB NAME
*D*
*D*               R8/R9 = ACCOUNT (IF ENTERED AT T:GJOB)
*D*
*D*               R15 = PRIORITY  (IF ENTERED AT T:GJOB)
*D*
*D*      INTERFACE:  ADD1
*D*
T:GJOBSTRT EQU    %
         LD,8     SYSACT            DEFAULT ACCOUNT NUMBER FOR GHOSTS
         LW,15    SL:GPRIO          DEFAULT PRIORITY FOR GHOSTS
T:GJOB   EQU      %                 ENTRY WITH ACCOUNT IN R8,R9
         WD,0     X'37'             DISABLE
         LI,5     MAXG              FIND NAME
         CD,0     S:GJOBTBL,5
         BE       GJOB01
GJOB02   RES      0
         BDR,5    %-2
         LI,2     MAXG
         CD,5     S:GJOBTBL,2       FIND ENPTY SLOT
         BE       ADDGJOB
         BDR,2    %-2
         B        GJOB10
         REF      SNULL
ADDGJOB  LI,6     SNULL             GET NULL STATE
         CI,2     MING              RESERVED SLOT
         BG       ADDGJOB1          NO
         BE       ADDGJOB2          GHOST1 SLOT - START IF SYSTEM NOT UP
         LB,4     SB:HQ,6
         BNEZ     %+2
         STB,2    SB:TQ,6           SET TAIL
         STB,2    SB:HQ,6
         STB,2    UB:BL,4
         STB,4    UB:FL,2
         B        ADDGJOB2
ADDGJOB1 LW,4     BOOTFLG
         BNEZ     GJOB10            DON'T START IF SYSTEM NOT UP YET
ADDGJOB2 LB,4     SB:HQ,6           HEAD OF AVAILABLE SLOTS
         BEZ      GJOB10
         STB,4    SB:GJOBUN,2       PUT USER NO
         STB,15   UB:PRIOB,4        SET BASE PRIORITY
         STD,0    S:GJOBTBL,2       PUT NAME
         STD,8    S:GJOBACN,2       SET ACCOUNT
         MTW,1    S:GUIS
         BAL,11   ADD1
         LCI      0
         B        *10
GJOB01   EQU      %
         CD,8     S:GJOBACN,5       CHECK FOR ACCOUNT MATCH
         BNE      GJOB02            NO, KEEP GOING
         LW,2     5                 GET RIGHT INDEX REG
         LB,5     SB:GJOBUN,2       GET USER #
         BEZ      ADDGJOB           PREESTABLISHED NAME, LOG IT ON
         LB,6     UB:US,5           IS HE ASLEEP
         CI,6     SW
         BE       GJOB03            DEFINITELY WAS ASLEEP
         CI,6     SQFI
         BE       GJOB03            IF QUEUED FOR INTERRUPT
         WD,0     X'27'             ENABLE
         LW,4     5                 ALWAYS RET WITH R4=USER#
         LCI      X'A'              PASS BACK 'RUNNING' CCS
         B        *10
GJOB03   LI,6     E:WU              PASS WAKE UP EVENT FOR GHOST
         BAL,11   T:RUE             WAKE UP THE GHOST
         LCI      4
         B        *10
*
GJOB10   EQU      %
         WD,0     X'27'             ENABLE
         LW,4     5                 ALWAYS RET WITH R4=USER#
         LCI      8
         B        *10
         PAGE
*F*
*F*      NAME:    T:SELFDESTRUCT
*F*
*F*      PURPOSE: TO SERVE AS AN EXIT POINT FOR MONITOR OVERLAYS
*F*               WHICH SHOULD BE DISASSOCIATED FROM THE USER
*F*               AFTER EACH CALL.
*F*
*F*      DESCRIPTION:  THE OVERLAY ASSOCIATED WITH THE USER IS
*F*               DISASSOCIATED BY SETTING UB:OV TO ZERO. THE USE
*F*               COUNTS (PB:UC AND PB:REP) ARE DECREMENTED.  IF THE
*F*               USER IS A LOCKED IN CORE USER, AND DISASSOCIATION
*F*               OF THIS OVERLAY UNLOCKS IT, THE NUMBER OF LOCKED IN
*F*               CORE PAGES (S:RTCORE) IS DECREMENTED BY THE OVERLAY
*F*               SIZE.  EXIT IS ON R11.
*F*
T:SELFDESTRUCT EQU %                ZAP THE CURRENT MONITOR
         LW,4     S:CUN             OVERLAY AND DECREMENT
         LB,1     UB:OV,4           ITS USER COUNT.
         CI,1     MAXOVLY           CHECK FOR LEGAL VALUE
         BG       *11
         STB,1    11                SAVE 1
         LI,1     0
         STB,1    UB:OV,4
         LB,1     11                GET 1
         MTB,-1   PB:REP,1          DECREASE USERS ASSOCIATED
         MTB,-1   PB:UC,1
         LH,1     UH:FLG2,4
         CI,1     X'800'            LOCKED IN CORE
         BAZ      NOLCT             NO
         LB,1     11
         MTB,-1   PB:LCT,1          STILL LOCKED
         BG       NOLCT             YES
         LB,1     PB:PSZ,1          NO, GET PSZ
         LCW,1    1                 AND TAKE IT
         AWM,1    S:RTCORE          FROM RTCORE
NOLCT    LB,1     11
         B        *11
         PAGE
MAPCW1   GEN,7,25 :BIG+1,0
         BOUND    8
SEGNAME  EQU      %
         TEXTC   'OPEN'
         TEXTC    'CLOSE'
         TEXTC    'LTAPE'
         TEXTC    'DEBUG'
         TEXTC    'MULOV'
         TEXTC    'LDLNK'
         TEXTC    'MISOV'
         TEXTC    'OPENTP'
         TEXTC    'STEPOVR'
         TEXTC    'ENQOV'
         TEXTC    'RTOV'
         TEXTC    'RMAOV'
         TEXTC    'TQOV1'           TP Q MANAGER OVERLAY SEGMENT 1
         TEXTC    'TQOV2'           TP Q MANAGER OVERLAY SEGMENT 2
*
*        ADD NEW TEXTC SEGMENT NAMES HERE
*
         PAGE
         DEF      OPNSEG
         DEF      CLSSEG,DLTSEG
         DEF      LBLTSEG
         DEF      DEBUGSEG
         DEF      MULSEG
         DEF      LDLNKSEG
         DEF      MISOVSEG
         DEF      IODTYSEG
         DEF      STEPOVRSEG
         DEF      ENQSEG
         DEF      RTNRRTSEG
         DEF      RMAOVSEG
         DEF      TQOV1SEG
         DEF      TQOV2SEG
         DEF      OPNTPSEG
*
*        ADD NEW DEFS FOR SEGMENT # NAMES HERE
*
OPNSEG   EQU      0
CLSSEG   EQU      1
DLTSEG   EQU      1
LBLTSEG  EQU      2
DEBUGSEG EQU      3
MULSEG   EQU      4
LDLNKSEG EQU      5
MISOVSEG EQU      6
IODTYSEG EQU      7
STEPOVRSEG EQU    8
ENQSEG   EQU      9
RTNRRTSEG EQU     10
RMAOVSEG EQU      11
OPNTPSEG EQU      IODTYSEG
TQOV1SEG EQU      12                TP Q MANAGER OVERLAY SEGMENT 1
TQOV2SEG EQU      13                TP Q MANAGER OVERLAY SEGMENT 2
*
*        ADD NEW SEGMENT #'S HERE
*
         PAGE
         PAGE
*        SAME RELATIVE POSITION AS ADDITION TO VECTOR IN RDERLOG
*        RMAOVSEG
ADD1MO   SET      0
*
T:RDERLOG#        AD1
T:WTERLOG#        AD1
T:MODPRTRT#       AD1
T:BLIST#     AD1
T:DOPEN#     AD1
T:DCLOSE#         AD1
T:LOCK#           AD1
T:MAP#            AD1
T:CLOSIT#         AD1
         PAGE
*        MISOVSEG
ADD1MO   SET      0
*
MVNAMDAT# AD1
T:ASSOCIATE# AD1
T:DISASSOCIATE# AD1
T:CHTBL# AD1
T:SAVEGET# AD1
T:GHOST# AD1
T:WAIT#  AD1
MSTRAP#  AD1
MXCON#   AD1
MINT#    AD1
MSTIMER# AD1
MTTIMER# AD1
T:DSMT#  AD1
T:JOBENT# AD1
MSRTFILE# AD1
MTIME#   AD1
PEOF#    AD1
PFIL#    AD1
PLEOFRM# AD1
PRECORD# AD1
REW#     AD1
WEOF#    AD1
SEGLD#   AD1
T:GDDL#  AD1
MSRKEY#  AD1
T:JECLS# AD1
         PAGE
*  CLS
ADD1MO   SET      -1
*
CLSM#    AD1
REL#     AD1
CLSC#    AD1
DELFWD#  AD1
DELETE#  AD1
DELSET#  AD1
DELO#    AD1
DELAA#   AD1
BADA#    AD1
ERFILDA# AD1
CLSALL#  AD1
         PAGE
*  MUL
ADD1MO   SET      -1
*
MULMUL#  AD1
RELMUL#  AD1
OPV#     AD1
OPNDEV#  AD1
LDEV#    AD1
CCLOSE#  AD1
OPNLD#   AD1
         PAGE
*                   IODTYSEG/OPNTPSEG
ADD1MO   SET      0
*
OPNLA#   AD1
OPNLO#   AD1
OPNT#    AD1
AOPNL1#  AD1
OPNLBL#  AD1
OPNT1#   AD1
RDCLS#   AD1
CLSTP#   AD1
MSRCLSLBL# AD1
CLSLBL#  AD1
RELTP#   AD1
         PAGE
*        RTNRRTSEG
ADD1MO   SET      0
*
RTGJOBCON#        AD1
RTCONNECT#        AD1
RTDISCON#         AD1
RTCLOCK#          AD1
RTRNDWN#          AD1
RTSTOPIO#         AD1
RTSTARTIO#        AD1
RTRESDF#          AD1
         PAGE
*                 ENQSEG
ADD1MO   SET      0
*
CHKQO#   AD1
CHKUO#   AD1
DEQUEUE# AD1
ENQALL#  AD1
ENQOLD#  AD1
LNKQUE#  AD1
RELDWO#  AD1
RELQO#   AD1
SAJCK#   AD1
TEST#    AD1
ENQ#     AD1
*
         PAGE
*      STEPOVRSEG
ADD1MO   SET -1   NOTE 1ST ENTRY =0 (T:EXIT#)
*
T:EXIT#       AD1
T:ERROR#      AD1
T:ABORT#      AD1
XCONSETUP#    AD1
KICKOFF#      AD1
T:SCRATCH#    AD1
T:ASP#        AD1
T:ECCP#       AD1
T:TELDELCCI#  AD1
T:DELUS#      AD1
DCBCHK#       AD1
T:AMRDWT#         AD1
         PAGE
*        TQOV1SEG
ADD1MO   SET      -1
*
TQUEUE#  AD1
TQ:RTN#  AD1
TQ:NEWQ# AD1
TQ:MOVE# AD1
TQ:AOK#  AD1
         PAGE
*        TQOV2SEG
ADD1MO   SET      -1
*
TQ:ABORT#         AD1
TQ:UNLOCK#        AD1
TQ:PURGE#         AD1
TQ:LOCK#          AD1
CKECB1#           AD1
CNMPROC9#         AD1
CNMPROC0#         AD1
CNMPROC1#         AD1
CNMPROC2#         AD1
CNMPROC3#         AD1
CNMPROC4#         AD1
CKECB#            AD1
TQ:AUTH#          AD1
         PAGE
*        LDLNKSEG
ADD1MO   SET      0
LDLNK#   AD1
LEXIT#   AD1
T:SAVESWAPIMG# AD1
T:FSI#   AD1
T:ASI#   AD1
T:COUPL# AD1
T:CAL#   AD1
LDTSETUP# AD1
         END

