         DEF      UCAL
2741CODE SET      1                 SET FOR 2741 CAPABILITY
         SYSTEM   UTS
         PCC      0
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
SR1,R8   EQU      8
SR2,R9   EQU      9
SR3,R10  EQU      10
SR4,R11  EQU      11
D1,R12   EQU      12
D2,R13   EQU      13
D3,R14   EQU      14
D4,R15   EQU      15
*
UCAL     EQU      %
         DEF      MOVER
         DEF      MVDATIME
         DEF      MVNAMACT
         DEF      MVNAMDAT
         REF      JOVVPA
         REF      MSROCTY
         DEF      T:ASSOCIATE
         DEF      T:DISASSOCIATE
         DEF      T:CHTBL
         DEF      T:SAVEGET
         DEF      T:WAIT
         DEF      UCALSIZ
         DEF      T:GDDL
*                                                                       00832000
         REF      UB:PCT
         REF      UB:ACP
         REF      SB:RBMX,SB:ROMX
CORATX   EQU      1                 CORE RAT INDEX
         REF      SL:CORE
         REF      S:PCORE
         REF      Y003E
         REF      Y08
         REF      J:EXLY,Y04
EXLYMSK  EQU      Y04
         REF      JB:PCP
         REF      JB:PCC
         REF      JB:PCDD
         REF      JEUPVP
         REF      J:PUL
         REF      J:PLL
         REF      J:DUL
         REF      J:DLL
         REF      J:DDUL
         REF      J:DDLL
         REF      J:RNST
         REF      JB:MNPA
         REF      COCLN
         REF      DATE
         REF      E:SL
         REF      J:ACCN
         REF      J:CCBUF
         REF      J:CFLGS
         REF      J:CPROCS
         REF      J:JIT
         REF      J:BASE
         REF,1    JB:PNR
         REF,1    JB:PCW
         REF,1    JB:LPP
         REF      JHKBIT,JHKBIT1
         REF      M:UC
         REF      PB:PSZ
         REF      PB:PVA
         REF      PB:UC
         REF      PB:REP
         REF      PNAMEND
         REF      S:CUN
         REF      S:GJOBTBL
         REF      RCVPSD
         REF      T:REG
         REF      T:SNAC
         REF      TIME
         REF      TRAPEXIT
         REF      U:MISC
         REF      UB:APO
         REF      UB:APR
         REF      UB:ASP
         REF      UB:DB
         REF      XFC
         REF      M2
         REF      M8
         REF      M17
         REF      Y8
         REF      Y4
         REF      YF
         REF      T:RVPI
         REF      PB:DSZ,J:EUP,NPMC,T:GNVNPI
         REF      J:BUP
         REF      JX:CMAP
         REF      J:DCBLINK
         REF      J:AJ,JBNRG,JCCL,J:CLE
         REF      T:TOTESZ
         REF      T:GBUF,T:RBUF,SBUF2VPA
         REF      JB:PCDCB,J:DCBLL
         REF      JXBUFVP,JB:FBUL,JBFBUC,JH:LDCF,JBCBUC
         REF      J:TELFLGS,Y002
         REF      DCBCHK#
         REF      STEPOVRSEG
         REF      PB:HVA
         REF      UH:FLG
         REF      FPMC,Y1
*
         REF      MSTRAP
         REF      MINT
         REF      MSTIMER
         REF      MTTIMER
         REF      T:DSMT
         REF      T:JOBENT
         REF      MSRTFILE
         REF      SEGLD
         REF      MTIME
         REF      PEOF
         REF      PFIL
         REF      PLEOFRM
         REF      PRECORD
XFBFF    EQU      NB31TO0+11
X800     EQU      BT31TO0+12
         REF      REW
         REF      WEOF
         REF      MXCON
         REF      JSPVP             PAGE # OF SP. SH. PR. AREA
         REF      PB:LNK            LNK TO NEXT ASP OLAY
         SREF     BUFCNT
         SREF     COCII
         SREF     COCOC
         SREF     COCTERM
         SREF     CPI
         SREF     CPOS
         SREF     LB:UN
         SREF     MODE
         SREF     MODENO
         SREF     MODE2
         SREF     MODE3
         SREF     MODE4
         TITLE    'UCAL'
*
*  DRIVER FOR MISOVLY
         AI,0     DRIVE
         B        *0
DRIVE    EQU      %-1
         B        MVNAMDAT
         B        T:ASSOCIATE
         B        T:DISASSOCIATE
         B        T:CHTBL
         B        T:SAVEGET
         B        T:GHOST
         B        T:WAIT
         B        MSTRAP
         B        MXCON
         B        MINT
         B        MSTIMER
         B        MTTIMER
         B        T:DSMT
         B        T:JOBENT
         B        MSRTFILE
         B        MTIME
         B        PEOF
         B        PFIL
         B        PLEOFRM
         B        PRECORD
         B        REW
         B        WEOF
         B        SEGLD
         B        T:GDDL
         B        AVR
         B        MSRKEY
         REF      AVR
         RES      40
DRSZ     EQU      %-DRIVE
         PAGE                                                           01858000
************************************************************************
*
*  M:GDDL  (GET DYNAMIC DATA LIMITS)  ROUTINE.
*
*  FORMAT OF CAL:
*             CAL1,8   FPT
*     FPT     GEN,8,24 X'1B',0
*
*  INPUT:
*     SR4         RETURN ADDRESS
*
*  OUTPUT:
*     USER'S SR1 (IN TSTACK) - WORD ADDRESS OF WORD 0 IN THE
*                 DYNAMIC DATA REGION (J:DDLL*512).
*     USER'S SR2 (IN TSTACK) - WORD ADDRESS OF THE LAST WORD IN
*                 THE DYNAMIC DATA REGION (J:DDUL*512+511).
*     USER'S SR3 (IN TSTACK) - THE MAXIMUM NUMBER OF PAGES THAT
*                 A USER COULD OBTAIN THROUGH THE M:GP, M:GCP,
*                 AND M:GVP CALS.  THIS VALUE DOES NOT INCLUDE THOSE
*                 PAGES HE ALREADY HAS, E.G., IF THE USER HAD ALREADY
*                 OBTAINED ALL BUT 1 PAGE A VALUE OF 1 WOULD BE RETURNED.
*
*  ENTRY POINTS:
*     AT T:GDDL
*
*  EXIT POINTS:
*     AT GPL75  (WITH A BRANCH *SR4)
*
*  REGISTERS DESTROYED:
*     R1, R2, R3, R4, D1, D2, D3, AND D4
*
*  NOTE:
*     THE VALUE OF SR3 IS SET SO THAT ALL OF THE FOLLOWING
*     RELATIONS ARE TRUE:  (ALL VALUES IN PAGES OR PAGE NUMBERS)
*     1  UB:PCT <= 152
*     2  UB:PCT + (POSSIBLE ADDED SIZE THRU NON-SHARED OVERLAYING)
*        - (CONTEXT SIZE) <= (JB:MNPA, SB:RBMX, OR SB:ROMX, WHICHEVER
*        IS APPROPRIATE). IF MONITOR RUNNING OR A SHARED PROCESSOR
*        WITH ALL-OF-CORE PRIVILEGE THIS TEST IS NOT MADE.
*     3  UB:PCT + (POSSIBLE ADDED SIZE THRU NON-SHARED OVERLAYING)
*        + (REGULAR SHARED PROC SIZE) + (LONGEST SHARED OVERLAY SIZE)
*        + (2 PAGES IF COOP BUFFERS NOT ALLOCATED BUT USER HAS COOP
*        PRIVILEGES) + (SIZE OF THE ASSOCIATED TEL OVERLAY, IF ONE
*        EXISTS) <= SL:CORE AND S:PCORE
*     4  (NUMBER OF ALLOCATED PAGES IN DYNAMIC DATA AREA) <=
*        (DYN DATA UPPER LIMIT) - (DYN DATA LOWER LIMIT) + 1
*
************************************************************************
T:GDDL   EQU      %
         LW,R4    S:CUN             L/USER #
         LW,14    SL:CORE           INITIALIZE # PGS AVAILABLE
************************************************************************
*  ADD TO THE CURRENT SIZE THE NUMBER OF ADDITIONAL PAGES THAT COULD
*  LATER BE NEEDED FOR NON-SHARED OVERLAYS.
************************************************************************
         LB,12    UB:PCT,4          USER PROC + DATA + CONTEXT + DY DATA
         LB,13    JB:PCP            PAGE COUNT OF USERS PROCEDURE
         BEZ      GPL20             SHARED PROCESSOR RUNNING-OR NO TREE TABLE
         LI,1     1                 USER RUNNING SO FIND HIS TRUE SIZE
         LB,1     JB:PCP,1          PAGE COUNT OF DATA
         AW,13    1                 CURRENT PROCD PGS + CURRENT DATA PGS
         SW,12    13                 TAKEN OUT OF TOTAL PAGE COUNT
*                                   -NOW ADD PROCEDURE AND DATA BACK
*                                     IN BASED ON JIT LIMITS TO ALLOW
*                                     FOR POSSIBLE SEGMENT LOADING
         AW,12    J:PUL
         SW,12    J:PLL
         AW,12    J:DUL
         SW,12    J:DLL
         AI,12    2                 BECAUSE LIMITS ARE INCLUSIVE
GPL20    EQU      %
************************************************************************
*  CHECK FOR MONITOR RUNNING STATUS OR A SHARED PROCESSOR WITH
*  ALL-OF-CORE PRIVILEGE.  IF SO, DON'T CHECK FOR A VIOLATION
*  OF JB:MNPA, SB:RBMX(CORATX), OR SB:ROMX(CORATX).
************************************************************************
         LW,R1    J:RNST            L/PUF IN JIT
         AND,R1   Y003E             &MASK FOR RUN FLAGS
         BEZ      GPL40             BEZ; MONITOR RUNNING
         LB,R1    UB:APR,R4         L/APR #
         BNEZ     %+2               BNEZ; APR EXISTS
         LB,R1    UB:ASP,R4         L/ASP #
         LW,R3    Y08               L/Y08 MASK
         AND,R3   P:SA,R1           C/MASK W/P:SA
         BNEZ     GPL40             BNEZ; PROC ALLOWED ALL OF CORE
         LI,R1    BA(JB:PCC)        L/BA OF CONTEXT PG CNT IN JIT
         LB,R1    0,R1              L/CONTEXT PG CNT
         SW,12    R1                CONTEXT NOT INCLUDED IN USER PG CNT
         LI,R3    BA(JB:MNPA)       L/BA OF MAX # PGS IN JIT
         LB,13    0,R3              DEFAULT MAX # OF PGS
         BNEZ     GPL30             BNEZ; USE THIS VALUE
         LI,R2    CORATX            L/CORE RAT INDEX
         LB,13    SB:RBMX,R2        L/SYSTEM LIMIT FOR BATCH CORE
         LC       J:JIT             L/FLAGS FROM WD 0 OF JIT
         BCR,8    %+2               B/NOT ONLINE
         LB,13    SB:ROMX,R2        L/SYSTEM LIMIT FOR ONLINE CORE
GPL30    BAL,R2   GPL80             BAL/CHECK FOR NEW AVAIL LIMIT
         NOP
         AW,12    R1                ADD CONTEXT BACK IN
***********************************************************************
*  HOLD BACK FOR UNALLOCATED SPARE BUFFERS
*************************************************************************
GPL40    LB,1     JB:FBUL           NO-HOLD BACK THOSE NOT YET ALLOCATED
         AI,1     -JXBUFVP+1        MAX # FPOOLS
         LI,2     JBFBUC
         LB,2     J:JIT,2           # FPOOLS ALLOCATED
         SW,1     2                 # FPOOL LEFT TO ALLOCATE
         AW,12    1                 HOLD THEM IN RESERVE
         LI,2     X'FFFF'
         AND,2    JH:LDCF           ALLOWED SYMBIONT ACCESS
         BEZ      GPL50             NO
         LI,1     JBCBUC
         LB,1     J:JIT,1           # CPOOLS USED
         CI,1     2                 DEFAULT OR MORE
         BGE      GPL50             YES-DONT HOLD BACK ANY MORE
         AI,12    2                 HOLD BACK THOSE NOT
         SW,12    1                   NOT YET ALLOCATED
***********************************************************************
*  CHECK TO SEE IF SL:CORE IS THE CONSTRAINING FACTOR
************************************************************************
GPL50    LW,13    SL:CORE
         BAL,R2   GPL80             BAL/CHECK FOR NEW AVAIL LIMIT
         BAL,2    GPL90             CHECK FOR AJIT
************************************************************************
* USER SWAP SIZE OK-NOW CHECK FOR PCORE EXCEEDED
************************************************************************
GPL240   LH,2     UH:FLG,4
         CI,2     TIC               IS COMMAND PROCESSOR ASSOCIATED
         BAZ      GPL241            NO-SEE IF THERE IS APR
         LB,1     UB:ACP,4          GET COMMAND PROCESSOR NUMBER
         LW,3     Y4
         CW,3     P:SA,1            IS CP A SPEC. SHRD. PROC.
         BANZ     GPL250            YES-GO COMPUTE SP. SHRD. PROC. SIZE
         B        %+3               NO-CP SIZE IS INCLUDED IN STD SHRD PROC SIZE
GPL241   LB,1     UB:APR,4          STD. SHRD. PROC. #
         BEZ      GPL242            NONE-SEE IF WE SHOULD HOLD BACK FOR TEL
         AW,12    J:PUL             SIZE OF APR OR ACP(NOT SPECIAL)
         SW,12    J:PLL             FROM JIT LIMITS (ALLOWS FOR SEG LOADING)
         AI,12    1                 BECAUSE LIMITS ARE INCLUSIVE
         CI,2     TIC               DID WE JUST ADD IN ACP
         BANZ     GPL255            YES-DONT CHECK FOR TEL
*                                 GET SPECIAL SHARED PROCESSOR SIZE
*                                 LARGEST OF ACP/ASP/DB
GPL242   EQU      %
         LC       J:JIT             ON-LINE USER
         BCR,8    GPL255            NO
         LW,2     Y002              DOES ON-LINE USER WANT
         CW,2     J:TELFLGS          SPACE HELD IN RESERVE FOR TEL
         BANZ     GPL255            NO
         LI,1     PNAMEND           FIND TELS NUMBER
         LD,2     TEL
         CD,2     P:NAME,1
         BE       %+2
         BDR,1    %-2
GPL250   LB,2     PB:PSZ,1          FIND TELS SIZE
         B        GPL256
GPL255   EQU      %                 FIND # PGS REQUIRED FOR SHARED
         LI,2     0                 NO SP. SHARED CP
GPL256   LB,1     UB:ASP,4          SP.SHARED PROC OR CORE LIBRARY
         LB,13    PB:PSZ,1          ASP SIZE
         LB,1     UB:DB,4           DEBUGGER
         CB,13    PB:PSZ,1          ASP : DB
         BGE      %+2
         LB,13    PB:PSZ,1
         CW,13    2                 ASP/DB : SP.SHARED ACP
         BGE      %+2
         LW,13    2
         AW,12    13                GREATEST POSSIBLE SIZE
         LW,13    S:PCORE
         BAL,R2   GPL80             BAL/CHECK FOR NEW AVAIL LIMIT
         BAL,2    GPL90             CHECK FOR AJIT PAGE
************************************************************************
*  CHECK TO SEE IF THE CONSTRAINT IS A LACK OF UNALLOCATED PAGES
*  IN THE DYNAMIC DATA REGION.
************************************************************************
GPL257   LW,13    J:DDUL
         SW,13    J:DDLL
         AI,13    1                 SIZE OF DYNAMIC DATA AREA
         LI,R1    BA(JB:PCDD)       L/BA OF DYN DATA PG CNT
         LB,12    0,R1              # PGS USED IN DYNAMIC DATA
         BAL,R2   GPL80             CHECK IF NEW AVAIL LIMIT
         BAL,2    GPL90             CHECK FOR AJIT PAGE
************************************************************************
*  GET THE DYNAMIC DATA REGION LIMITS AND STORE WITH
*  THE AVAILABLE PAGE COUNT INTO THE USER'S REGISTERS
*  IN TSTACK.  EXIT.
************************************************************************
         LD,D1    J:DDLL            L/DYN DATA LOWER AND UPPER LIMITS
         SLD,D1   9                 G/WORD ADDRESSES
         AI,D2    X'1FF'            G/WD ADR OF TOP OF UPPER PAGE
         LI,R1    SR1               L/DISP FROM *J:BASE TO SR1 IN TSTACK
         LCI      3                 L/CC'S FOR STM
         STM,D1   *J:BASE,R1        S/D1 - D3 INTO USER'S SR1 - SR3
GPL75    B        *SR4              RETURN
******************************************************************************
* UPDATE THE CURRENT AVAILABLE PAGE LIMIT IN R14 BY SETTING R14 TO
* THE MINIMUM OF (R13-R12) AND R14.
******************************************************************************
GPL80    SW,13    12                LIMIT-USED PGS (SAME TYPE)
         CW,13    14                NEW AVAILABLE PGS * OLD AVAILABLE PGS
         BG       1,2               NOT A NEW AVAILABLE LIMIT
         LW,14    13                SET NEW AVAILABLE PAGE LIMIT
         B        0,R2              RETURN
*****************************************************************
*  CHECK TO SEE IF HE WOULD NEED AN AJIT PAGE IF HE WERE TO
*  GET ALL OF THE PAGES HE COULD
*****************************************************************
GPL90    LW,1     J:AJ
         BNEZ     0,2               HE ALREADY HAS AN AJIT
         LW,5     14                # OF PAGES HE COULD GET
         LI,1     JBNRG
         LB,1     J:JIT,1           # OF GRAN. REMAINING
         LCW,1    1
         AW,1     5                 # PAGES
         AI,1     3                 ROUND UP
         DW,1     X4                # ADDITIONAL SEEKS REQUIRED
         AW,5     1
         SLS,5    1                 # DOUBLEWORDS REQUIRED
         AW,5     J:CLE             NW CLIST LENGTH
         CI,5     JCCL              WILL IT FIT
         BL       0,2               YES-AJIT NOT NEEDED
         AI,14    -1                TAKE OUT AJIT PAGE
         B        0,2
         PAGE
         PAGE
         BOUND    8
TEL      TEXTC    'TEL'
         TEXT     '    '
TRNTBLS  DATA     0,3               TTY TRANSLATION TABLE BOUNDARIES
         DO       2741CODE=1
         DATA     4,10              2741 TRANSLATION TABLE BOUNDARIES
         FIN
BUF      EQU      J:CCBUF
BLNKS    EQU      GJOBMS+1
GJOBMS   TEXT     'GJOB '
K60      DATA     X'60'
LINE#    EQU      M:UC+COCLN
ONMES    TEXT     ' ERR'
PLIST    GEN,1,31 1,0
         DATA     BUF
PROCLIMT GEN,8,24 PNAMEND,0
OLAYLIMT GEN,8,24 PPROCS,0          MAX LEGAL APO + 1
         PAGE
T:WAIT   EQU      %
         LW,1     S:CUN             GET CURRENT USER #
         AI,6     1                 ROUND UP
         AND,6    M17
*
         STW,6    U:MISC,1          SAVE WAKE UP LIMIT
*
         LI,6     E:SL              REPORT SLEEPER TO SCHEDULER
         LI,11    CC1RST            EXIT FROM REG
         B        T:REG              GIVE UP TO SCHED
         PAGE                                                           00994000
T:CHTBL  EQU      %
         MTW,0    J:JIT             ONLY ALLOW ON-LINE USERS
         BGEZ     CC1SET
         LW,1     LINE#             GET LINE NUMBER INTO REG 1
         AND,1    M8
*
         LW,0     7                 SAVE FPT+1 ADR FOR SETMOD
         LH,7     6
         CI,7     X'80'             CHECK PRESENCE BIT FOR BREAK,
*                                    SET TABLE
         BAZ      CHTBL10           BR IF NOT FUNCTION TO ARM BREAK,
*                                    SET TABLE
         AND,7    M2
         DISABLE
         LB,0     MODE2,1
         AND,0    XFC               CLEAR OLD ENTRY IF SET
         OR,0     7                 ARM BREAK SET TABLE
         STB,0    MODE2,1
ENCC1    EQU      %
         ENABLE
         B        CC1RST
CHTBL10  EQU      %
         CI,7     X'40'
         BANZ     T:TS              TERMINAL STATUS
         CI,7     X'20'             CHECK IF SET MODE REQUEST
         BANZ     SETMOD            B IF YES
         CI,7     X'10'             CHECK IF RESET BRK COUNT REQUEST
         BANZ     RSTBRK            B IF YES
CHTBL15  EQU      %
         AND,6    M8                CLEAR HIGH ORDER BITS
         DO       2741CODE=1
         LI,7     4
         CB,7     COCTERM,1
         BG       CHTBL20           BR IF CURRENT TRANS TABLE IS A TTY
         CI,6     1
         BANZ     CC1SET            ERR IF ODD TRANS TBL SPEC'D FOR 2741
         LI,7     5
*
CHTBL20  EQU      %
         CLM,6    TRNTBLS-8,7
         ELSE
         CLM,6    TRNTBLS
         FIN
         BCS,9    CC1SET            ERROR IF INVALID TRANS TABLE SPEC'D
         STB,6    COCTERM,1
         B        CC1RST            EXIT
*
         PAGE
********************************************************************************
*
*  M:TS (OBTAIN TERMINAL STATUS) ROUTINE.
*
*  FORMAT OF CAL:
*        CAL1,8   FPT
*  FPT   GEN,8,4,20    6,4,0        OLD FORMAT
*  -- OR --
*  FPT   GEN,8,4,20    6,6,0        NEW (EXTENDED) FORMAT
*
*  INPUT:
*     R1          LINE NUMBER
*     R7          RIGHT JUSTIFIED, THE LEFT HALF OF FPT
*
*  OUTPUT (IN TSTACK):
*                 *************************************
*     USER'S R8   *COCTERM *  MODE  * MODE2  * MODE3  *
*                 *************************************
*
*                 *************************************
*     USER'S R9   *  CPOS  * COCOC  * BUFCNT * LB:UN  *
*                 *************************************
*
*     THE FOLLOWING TWO REGISTERS ARE SET ONLY IN EXTENDED FORMAT
*
*                 *************************************
*     USER'S R10  * MODE4  *  CPI   *       I*        *
*                 *************************************
*
*                 *************************************
*     USER'S R11  *        *        *PLATEN W*  LPP   *
*                 *************************************
*
*                 I = 1 IF INPUT BUFFERS EXIST
*                 W = WIDTH, LPP = LINES/PAGE
*
*  ENTRY POINTS:
*     AT T:TS
*
*  EXIT POINTS:
*     AT TS250
*
*  REGISTERS DESTROYED:
*     R3, R4, R5, R15
*
********************************************************************************
T:TS     EQU      %
         LI,R5    8                 L/8; # OF OUTPUT BYTES IF OLD FORMAT
         CI,R7    X'20'             C/LH OF FPT W/.20
         BAZ      TS050             BAZ; OLD FORMAT
         LI,R5    16                L/16; # OF OUTPUT BYTES; EXTENDED
TS050    LI,R4    R8*4              L/BTD FROM R0 TO R8
TS100    LH,R3    ADRS-(R8*2),R4    L/DISPLACEMENT TO DESIRED VALUE
*                                   .. IN MONITOR OR JIT
         BGEZ     TS150             BGEZ; DISPLACEMENT IS ADR IN ROOT
         LB,R15   J:JIT+X'200',R3   L/VALUE FROM JIT
         B        TS200             B
TS150    LB,R15   *R3,R1            L/VALUE FROM ROOT
TS200    STB,R15  *J:BASE,R4        S/VALUE IN USER'S REGISTER IN TSTACK
         AI,R4    1                 +1 TO TABLE AND OUTPUT INDEX
         BDR,R5   TS100             BDR; GET NEXT VALUE
         CI,R7    X'20'             C/LH OF FPT W/.20
         BAZ      TS250             B/OLD FORMAT
         LI,R4    R10*4+2           L/BTD TO BYTE 2 OF R10
         LH,R15   COCII,R1          L/INPUT INSERTION POINTER
         BEZ      %+2               BEZ; NO INPUT EXISTS
         LI,R5    1                 L/1; FLAG INDICATING INPUT EXISTS
         STB,R5   *J:BASE,R4        S/FLAG (0 OR 1)
TS250    B        CC1RST            B; DONE, RESET CC1, EXIT
         SPACE    1
********************************************************************************
*  EACH OF THE FOLLOWING TABLE'S ENTRIES ARE IN ONE OF THE
*  FOLLOWING FORMATS:
*  1  IF THE ENTRY POINTS TO A LINE-NUMBER INDEXED TABLE IN
*     THE ROOT, THE ENTRY IS THE WORD ADDRESS OF THAT TABLE.
*  2  IF THE ENTRY POINTS TO A BYTE IN THE JIT, THE ENTRY
*     IS BA(JIT BYTE)-BA(J:JIT+X'200').
*  3  IF A DUMMY ENTRY, A 0 IS USED.
*  THERE IS A 1-TO-1 CORRESPONDENCE BETWEEN THIS TABLE AND THE
*  OUTPUT BYTES IN THE USER'S REGISTERS IN TSTACK (STARTING
*  WITH R8).
********************************************************************************
ADRS     EQU      %
         DATA,2   COCTERM,MODE,MODE2,MODE3,CPOS,COCOC,BUFCNT,LB:UN
         DATA,2   MODE4,CPI,,,,
         DATA,2   BA(JB:PCW)-BA(J:JIT+X'200')    PLATEN WIDTH
         DATA,2   BA(JB:LPP)-BA(J:JIT+X'200')    LINES/PAGE
         PAGE
*
* THIS ROUTINE SETS COC MODE BITS AS SPECIFIED IN THE FPT. THERE ARE
* 2 MASKS, MSK AND MSK+1, WHICH DETERMINE WHICH MODE BITS MAY BE
* USER SPECIFIED FOR TTY AND 2741 RESPECTIVELY. EACH DATA WORD IN
* THE FPT CONTAINS THE NEW MODE BIT VALUES IN BYTE 1 AND WHICH MODE
* BITS ARE TO BE AFFECTED IN BYTE 3.
*
SETMOD   EQU      %
         LW,4     1                 GET LINE # OF CURRENT USER
         LI,5     0
         LB,9     MODE2,4           CHECK FOR 2741 OR TTY
         AND,9    X10
         SLS,9    -4
         AI,9     MSK               POINT TO CORRECT SET OF MASKS
         LW,7     0
         AI,7     -1                GET FPT ADR FOR JHKBIT
         BAL,1    JHKBIT1           CHECK FOR MODE
         B        STMD              GOT IT
         AI,5     1                 BUMP MODE TABLE POINTER
         BAL,1    JHKBIT            CHECK FOR MODE2
         B        STMD              GOT IT
         AI,5     1
         BAL,1    JHKBIT            CHECK FOR MODE3
         B        STMD
         LI,5     BA(JB:PCW)        L/BA OF PLATEN WIDTH IN JIT
         BAL,1    JHKBIT            CHECK P BIT FOR PCW, GET VALUE IN R2
         STB,2    0,5               SET PLATEN WIDTH
         LI,5     BA(JB:LPP)        L/BA OF LINES PER PAGE IN JIT
         BAL,1    JHKBIT            CHECK P BIT FOR LPP, GET VALUE IN R2
         STB,2    0,5               SET LINES/PAGE
         LI,R5    3                 L/3; INDEX TO MODE4 IN MODENO & MSK
         BAL,R1   JHKBIT            CHECK P BIT FOR MODE4
         B        STMD              B; SET MODE4
         BAL,R1   JHKBIT            CHECK P BIT FOR TRANS TABLE NUMBER
         B        SETTT             B; SET TRANSLATION TABLE NUMBER
         B        CC1RST            DONE EXIT TO CAL+1
*
STMD     EQU      %                 JHKBIT RETURNS FPT DATA WORD IN R2
         INT,12   2                 L/NEW VALUES IN R12, MASK IN R13
         LB,11    *9,5              L/USER-CHANGABLE BITS
         AND,13   11                &USERS MASK W/USER-CHANGABLE BITS
         LH,R2    MODENO,R5         L/ADR OF MODEX TABLE
         DISABLE                    DIS-ALLOW INTERRUPTS
         LB,10    *2,4              L/CURRENT MODEX
         STS,12   10                G/NEW VALUE
         STB,10   *2,4              S/NEW VALUE IN MODEX
         ENABLE
         B        1,1               EXIT TO BAL PLUS 2
*
* PERMISSION BYTE MASKS FOR ALTERING MODE, MODE2, MODE3, MODE4.
* IF BIT IS SET THE USER IS PERMITTED TO ALTER THE
* CORRESPONDING BITS IN MODE, MODE2, MODE3, OR MODE4.
MSK      EQU      %
         DATA     X'8F6FE0FF'       USER-CHANGABLE BITS FOR TTY
         DATA     X'0F6FE0FF'       USER-CHANGABLE BITS FOR 2741
*
SETTT    LW,R6    R2                L/TRANS TABLE #
         LW,R1    LINE#             L/LINE NUMBER
         AND,R1   M8                &LINE NUMBER W/.FF
         B        CHTBL15           B; CHECK & SET TRANS TABLE #
*
RSTBRK   EQU      %                 RESET BREAK COUNT
         DISABLE
         LB,0     MODE,1            MODE  CONTAINS BRK COUNT
         AND,0    XFC               RESET BRK COUNT
         STB,0    MODE,1            STORE IT
         B        ENCC1             TO CAL+1,ENABLE & WITH CC1=1
         PAGE
         REF      Y2,Y3
         REF      PPROCS,P:SA,E:AP,P:NAME,T:PAC
         REF      J:INTENT
J:DELENT EQU      J:INTENT
T:ASSOCIATE EQU   %
         LI,1     0                 FOR CONDITION CODES
*
* R6 HAS 1ST WORD OF THE PLIST
* R7 HAS THE PLIST+1 = NAME
*
         BAL,0    GETNAME           GET NAME OF DEBUG/LIB
*
* R5 HAS PROCESSOR NUMBER
* R4 HAS USER NUMBER
* R8+R9 HAVE PROCESSOR NAME
*        R15 HAS USER FLAGS
*
         BAL,0    GETTYPE
*
* GETTYPE RETURNS WITH R2 = 1 IF A LIBRARY
*           OR R2 = 2 IF A DEBUGGER
* IF NEITHER, IT WILL RETURN TO THE USER WITH
* CC1 SET
*
         LW,7     J:EUP             INITIAL PAGE
         CI,7     JEUPVP            CANT ASSOCIATE IF HE IS
         BNE      CC4SET             USING EXTENDED CORE
         EXU      TESTIT,2          GET LIB/DB NOW ASSOCIATED
         CW,3     5                 IS IT THE SAME
         BNE      ASSOC2            NO
         CI,2     2                 YES-IS IT DELTA
         BNE      CC0RST            NO-ASSOC SAME LIBR IS NOP
         PUSH     1                 SAVE CC=0
         B        CHKDEL            RE-ASSOCIATE DELTA
ASSOC2   EQU      %
         AI,7     1
         CI,2     2
         BNE      NOPAGE            ASSOCIATING A LIBRARY
         LW,2     J:EXLY            IS THIS AN EXECUTE ONLY
         CW,2     EXLYMSK               LOAD MODULE
         BANZ     CC1SET            YES-HE SHOULDNT ASSOC A DEBUGGER
         PUSH     7,1
         LI,6     1
         BAL,11   T:GNVNPI
         PULL     7,1
         LOAD,0   JX:CMAP,7
         CI,0     FPMC
         BE       CC4SET            NO PAGE AVAILABLE
NOPAGE   EQU      %
         EXU      TESTIT,2          **LB,3 ASP/DB,4
         BEZ      %+2               NONE OF SAME TYPE CURRENTLY ASSOC.
         LI,1     -1                INDICATE ABNORMAL
*GET INFO FOR CHECKIT IN CASE WE ARE ASSOCIATING A DEBUGGER
         LB,7     UB:ASP,4          CURRENT LIBRARY
         BNEZ     %+2                IF THERE IS ONE
         LB,7     UB:DB,4           ELSE CURRENT DEBUGGER
*MAKE SURE THERE IS ENOUGH PCORE FOR NEW SPECIAL SHARED PROCESSOR
         EXU      STORIT,2          **STB,5 ASP/DB,4    NEW SP. SHRD. PROC.
         PUSH     7,1
         LI,7     0                 PHONEY PAGE #
         BAL,0    T:TOTESZ          WOULD ASSOCIATION MAKE HIM TOO BIG
         B        NOPCORE           YES
         PULL     6,2               LEAVE ABNORMAL FLAG IN STACK
         LW,3     7                 CURRENT ASP/DB TO R3
         MTB,-1   PB:UC,3
         LW,1     *TSTACK
         BEZ      %+2               SAME TYPE NOT CURRENTLY ASSOCIATED
         MTB,-1   PB:REP,3          DECR OLD PROCESSOR
         MTB,1    PB:REP,5          INCREASE USERS ASSOCIATED
         MTB,1    PB:UC,5           BUMP ITS COUNT
         BDR,2    CHKIT             BRANCH IF DEBUGGER
         B        REPORTIT          T:REG AND GOBACK
*
*
CHKIT    EQU      %                 ASSOCIATING A DEBUGGER
         MTB,0    UB:ASP,4          IF THERE IS A LIBRARY,
         BEZ      %+3               THEN
         MTB,-1   PB:UC,5           DEBUGGER NOT IN USE YET
         MTB,1    PB:UC,3           BUT LIBRARY IS
         LH,15    UH:FLG,4
         LW,7     J:EUP             INIT PAGE PAST USER AREA
         AI,7     1
         LOAD,5   JX:CMAP,7         DOES HE HAVE IT ALREADY
         CI,5     NPMC
         BNE      CHKDEL            YES
         SETR     PPSWP             FLAG FOR SWAPPER
         SETR     INIT              SET FLAG FOR SWAPPER
CHKDEL   EQU      %
         LI,7     X'3FFFF'
         AND,6    7                 STORE TVECTOR FROM FPT
         SCS,7    -1
         STS,6    J:DELENT          INTO DELENT
         CI,6     X'20000'          IF FLAG SET, ENTER DEBUGGER
         BAZ      NOBRK             AT BREAK ENTRY
         DISABLE
         REF      UH:DL
         LH,6     UH:DL,4           SET BRK BIT
         OR,6     BT31TO0+13        =X1000
         STH,6    UH:DL,4
         ENABLE
NOBRK    EQU      %
         CI,15    DELA              IF ASSOC IS A NOP
         BANZ     GOBACK            DON'T REG
         SETRST   DELA              ASSOCIATE DELTA
REPORTIT EQU      %
         LRSETSST RTR               FORCE A SWAP
         LI,6     E:AP
         BAL,11   T:REG
*
* NEW LIBRARY OR DEBUGGER IS ASSOCIATED BY T:REG
*
         BAL,11   T:PAC
GOBACK   EQU      %
         PLW,1    TSTACK
         LW,1     1
         BLZ      CC3SET            SET CC3 IF LESS THAN ZERO
         B        CC0RST            RETURN
*
STORIT   EQU      %-1
         STB,5    UB:ASP,4          LIB
         STB,5    UB:DB,4           DEBUG
TESTIT   EQU      %-1
         LB,3     UB:ASP,4          LIB
         LB,3     UB:DB,4           DEBUG
*
*
*
GETNAME  EQU      %
         LW,4     S:CUN             CURRENT USER NUMBER
         LH,15    UH:FLG,4          GET USER FLAGS
         CI,15    DIC               DEBUGGER CANT ASSOC OR DISASSOC
         BANZ     CC1SET
         LW,8     *7                GET 1ST WORD OF NAME
         AI,7     1
         LW,9     *7                AND SECOND
         LI,5     PPROCS            MAX NUMBER OF PROCESSORS
         CD,8     P:NAME,5
         BE       *0
         BDR,5    %-2               FIND IT
         B        CC1SET            ERROR, NO NAME
*
* R5 CONTAINS THE PROCESSOR NUMBER
*
GETTYPE  EQU      %
         LW,2     Y3
         AND,2    P:SA,5
         SCS,2    4
         CI,2     3                 IS IT A LIB/DEBUG
         BGE      CC1SET                    NO
         BAZ      CC1SET                    NO
         B        *0                YES, RETURN
         PAGE
*
*
T:DISASSOCIATE EQU %
*
* R7 HAS PLIST+1 = NAME
*
         BAL,0    GETNAME
*
* R5 HAS PROCESSOR NUMBER
* R4 HAS USER NUMBER
* R8+R9 HAVE THE NAME
*
         BAL,0    GETTYPE
*
* R2=1 IF LIBRARY
*   =2 IF DEBUGGER
*
         EXU      TESTIT,2          IS ONE ASSOCIATED
         BEZ      CC2SET            NO
         CW,3     5                 IS IT THE ONE REQUESTED
         BNE      CC1SET            NO,SET CC1
         LI,5     0
         CI,2     2                 WAS IT DEBUGGER
         BNE      CHKDEL2           NO
         RSETSST  DELA              RESET DELA
         STW,5    J:DELENT          ZAP DELENT FOR BRK CNTL
         PUSH     4,2
         LW,7     J:EUP
         AI,7     1
         BAL,11   T:RVPI            RELEASE DELTAS DATA PAGE
         NOP
         PULL     4,2
         LB,1     UB:ASP,4          IS LIBRARY ALSO ASSOCIATED
         BEZ      CHKDEL2+1         NO-DECREMENT UC AND REP
         LI,1     0                 LIBRARY PROCEDURE IS IN CMAP
         B        CHKDEL2+2         DONT DECREMENT USE COUNT
CHKDEL2  EQU      %                 DISASSOCIATING LIBRARY
         LB,1     UB:DB,4           GET DEBUGGER-IF ANY
         MTB,-1   PB:UC,3           DECR COUNT
         MTB,-1   PB:REP,3          DECREASE USERS ASSOCIATED
         EXU      STORIT,2          ZAP THE LIB/DEB
         LW,1     1                 IS DELTA NOW ASSOCIATED
         BEZ      CUD3              NO
         LI,1     0
         PSW,1    TSTACK            SIGNAL NORMAL EXIT
         B        REPORTIT          GET DELTA BACK IN CMAP
CUD3     EQU      %
         BAL,11   T:PAC             SET ACCESS
         B        CC0RST
         PAGE
*
*
*
T:SAVEGET EQU     %
         LW,4     S:CUN             GET THIS USERS FLAGS
         LH,2     UH:FLG,4
*
         AI,8     -2                ADJUST FPT CODE
         BLZ      CC1SET
         BEZ      T:SAVE1
*
         CI,8     1
         BNE      CC1SET
*                                   ONLY TEL HAS ACCESS
         CI,2     TIC               TO THE GET CAL
         BAZ      CC1SET            BRANCH IF NOT TEL
*
*
*
T:GET    EQU      %                 GET USERS PROC# FROM JIT AND
*                                   REPLACE IN USER TABLES
         PUSH     6,6
         LB,1     J:CPROCS          L/APR #
         BEZ      GET02             BEZ; NO APR
         LB,0     PB:PVA,1          L/PB:PVA (PP PA) FOR APR
         BEZ      GETERR            BEZ; APR DOESN'T EXIST
         CW,0     J:PLL             C/PVA W/PP LOWER LIMIT IN JIT
         BNE      GETERR            BNE; NOT SAME APR
         LB,0     PB:HVA,1          L/PB:HVA (HIGH PP PA + 1) FOR APR/APO
         AI,0     -1                -1; J:PUL = PB:HVA - 1
         CW,0     J:PUL             C/HVA-1 W/PP UPPER LIMIT IN JIT
         BNE      GETERR            BNE; NOT SAME APR/APO
GET02    MTW,0    J:DCBLINK         ADDR OF DCB TAB
         BEZ      GET06             B IF NO DCBS
         PUSH     4,R2              SAVE R2 - R5
         LI,14    SBUF2VPA          GET SPECIAL BUFFER 2 TO
         BAL,2    T:GBUF            USE FOR DCB CHECK
         LW,2     J:DCBLINK         DCB TABLE ADDRESS
         LB,1     JB:PCDCB          # OF PAGES OF DCBS
         SLS,1    9                 # OF WORDS OF DCBS
         LW,R0    J:DCBLL           ADD OF 1ST PAGE OF DCBS
         SLS,R0   9                 ADD OF 1ST WORD OF DCBS
         LI,R4    SBUF2VPA          ADD OF BUFFER FOR DCB CHECKER
         LI,5     1                 SPECIAL INIT FOR TEL GET
         PUSH     0
         PUSH     2                 REGS PULLED BY STEPOVR
         OVERLAY  STEPOVRSEG,DCBCHK#
         LI,14    SBUF2VPA          RETURN BUFFER
         LI,5     0
         BAL,2    T:RBUF
         PULL     4,R2              RESTORE R2 - R5
         AI,6     0                 CHECK CC
         BNEZ     GETERR            ERR IN DCBS
GET06    EQU      %
         LW,0     J:CFLGS
         LH,2     UH:FLG,4
         LI,1     DIC|DELA
         STS,0    2
         STH,2    UH:FLG,4
         LW,0     J:CPROCS
         LI,1     -2
GET07    EQU      %
         CB,0     PROCLIMT          IS NUMBER > MAX PROC #
         BGE      GETERR            YES
         LW,6     0                 PROC #
         AND,6    M8                   TO R6
         LW,2     P:SA,6            GET FLAGS FOR THIS PROC
         LC       2                 CHECK FOR
         EXU      FLAGTST,1            LEGAL FLAGS
         LB,2     PB:PVA,6          GET FIRST VP #
         BEZ      GETERR            PROC DOESN'T EXIST
         CI,2     JSPVP             IS 1ST PAGE IN SP PR AREA
         BL       GETERR            NO, BIASED TOO LOW
         EXU      UTBLSET,1         STORE # IN PROPER USER TABLE
         MTB,1    PB:REP,6          INCR USERS ASSOCIATED
         SLS,0    -8                SHIFT TO ASP
         BIR,1    GET07
*
         CB,R0    OLAYLIMT          C/APO # W/MAX LEGAL + 1
         BGE      GETERR
*
* NOTE  -  R1=0 HERE
         SLD,0    -8                R0=APR,  R1(BYTE0)=APO
         LB,2     1                 R2=APO
         BEZ      GET09             NO APO, STORE ZERO
*IF APO EXISTS, CHECK FOR IT IN APR CHAIN
         AI,0     0                 APO IMPLIES APR,
         BEZ      GETERR               ELSE ERROR
         LW,6     0                 R6=APR
GET08    LB,6     PB:LNK,6          GET NEXT OLAY #
         BEZ      GETERR            END OF OLAY CHAIN & NOT FND
         CB,6     1                 IS IT THIS OLAY
         BNE      GET08             NO, CONTINUE DOWN CHAIN
GET09    STB,2    UB:APO,4          STORE IN USER TABLE
         CI,2     0                 IF THE USER HAS NO PROC,
*                                   DON'T SET ACCESS
         BE       GET10
*
         BAL,R1   GETSNAC           SET 01 ACCESS FOR OLAY
*
GET10    EQU      %
         CB,0     PROCLIMT
         BGE      GETERR
*
         STB,0    2                 PROC #
         LB,2     2                 IF THE USER HAS NO PROC,
*                                   DON'T SET ACCESS
         BE       GET20
*
         LI,R1    GET20             SIM. BAL
GETSNAC  EQU      %
         PUSH     0
         PUSH     4
         LI,4     1
         LB,6     PB:PSZ,2
         LB,7     PB:PVA,2
         BAL,11   T:SNAC            SET 01 ACCESS/OR THIS PROC
         PULL     4
         PULL     0
         B        0,1               RETURN ON R1
*
*  THIS IS AN EXU LIST
         BCR,2    GETERR            DEBUG NOT SET
         BCR,5    GETERR            PUB. LIB OR SP SHR PROC NOT SET
FLAGTST  EQU      %
         STB,0    UB:DB,4           STORE DEBUGGER #
         STB,0    UB:ASP,4          STORE ASP #
UTBLSET  EQU      %
*
GET20    EQU      %
         STB,0    UB:APR,4
         LW,6     0
         AND,6    M8                INCREASE NUMBER OF USERS ASSOCIATED
         MTB,1    PB:REP,6
         PULL     6,6
         B        CC1RST
*
GETERR   EQU      %
         PULL     6,6
         B        CC1SET
*
*
T:SAVE1  EQU      %                 SAVE USERS PROC#S IN JIT
         LI,3     1
         LB,0     UB:APR,4
         STB,0    J:CPROCS
         LB,0     UB:APO,4
         STB,0    J:CPROCS,3
         LI,3     2
         LB,0     UB:ASP,4
         STB,0    J:CPROCS,3
         LI,3     3
         LB,0     UB:DB,4
         STB,0    J:CPROCS,3
         LI,3     X'FFFF'
         STS,2    J:CFLGS
         B        CC1RST
         PAGE
*                                                                       01743000
*
T:GHOST  EQU      %
         PUSH     16,0
         LI,1     5
         LI,2     BA(GJOBMS)        MOVE 'GJOB' TO OUTPUT BUF
         LI,3     BA(J:CCBUF)+1
         BAL,0    MOVER
*
         LI,1     7                 MAX. 7 CHARS.
         LI,2     JB:PNR            GET GJOB INDEX
         LB,2     0,2
         SLS,2    3                 TO BYTES
         AI,2     BA(S:GJOBTBL)+1   SKIP COUNT
         BAL,11   MVACT10
*
         LI,2     BA(ONMES)
         LI,1     4                 MOVE 'ON' TO BUF
         BAL,0    MOVER
*
         AI,3     -BA(J:CCBUF)-1
         STB,3    J:CCBUF           STORE BYTE COUNT IN BUFFER
*
         LI,5     J:JIT
         LI,8     2                 TYPE CODE
         LI,7     PLIST             POINTER TO PLIST WORD1
*
         BAL,11   MSROCTY           'GJOB ON' TO OC
*
*
*
*
         PULL     16,0
         B        *11
         PAGE
MVNAMDAT EQU      %
         PUSH     11
         BAL,11   MVNAMACT
         LI,2     BA(BLNKS)
         LI,1     4
         BAL,0    MOVER
         BAL,11   MVDATIME
         PULL     11
         B        T:SELFDESTRUCT
         PAGE
*    MOVE 'NAME, ACCOUNT #'
*    INPUT R3 STARTING BYTE ADDRESS OF DESTINATION BUFFER
MVNAMACT EQU      %
         REF      J:UNAME
         LI,1     12
         LI,2     BA(J:UNAME)
MVACT10  BAL,0    MOVER             TO SPECIFIED BUFFER
*
         BAL,0    DELETBLNKS        DELETE TRAINING BLANKS
*
         LI,0     ','               INSERT A COMMA
         STB,0    0,3
         AI,3     1
*
         LI,1     8
         LI,2     BA(J:ACCN)        MOVE USERS ACCOUNT #
         BAL,0    MOVER             TO BUFFER
*
         BAL,0    DELETBLNKS        DELETE TRAILING BLANKS
*
OVRTN    EQU      %
         CI,11    JOVVPA
         BG       *11               IF IN THIS OVERLAY, RETURN
         B        T:SELFDESTRUCT
*
*
DELETBLNKS EQU    %                 DELETE-TRAILING-BLANKS ROUTINE
         AI,3     -1
         LI,4     ' '
DBK10    EQU      %
         CB,4     0,3               LOOK FOR NON-BLANK CHAR
         BNE      DBK20             BRANCH IF FOUND
*
         BDR,3    DBK10             LOOP
         SCREECH  X'1C'             RECOVER
*
DBK20    EQU      %
         AI,3     1
         B        *0
*
*
MVDATIME EQU      %
         LI,1     2
         LI,2     BA(DATE)          MOVE DAY TO BUFFER
         BAL,0    MOVER
*
         LI,4     '/'
         STB,4    0,3
         AI,3     1
*
         LI,1     2
         BAL,0    MOVER             TO BUFFER
*
         LI,4     '/'
         STB,4    0,3
         AI,3     1
         LI,1     2
         LI,2     BA(DATE)+6
         BAL,0    MOVER
*
         LI,1     4
         LI,2     BA(BLNKS)         FOUR BLANKS
         BAL,0    MOVER
*
         LI,1     2
         LI,2     BA(TIME)          HOURS
         BAL,0    MOVER
*
         LI,4     ':'
         STB,4    0,3               AND
         AI,3     1
*
         BAL,0    MOVER             MINUTES TO BUFFER
*
         B        OVRTN
*
*
*        R0       LINK
*        R1       BYTE COUNT FOR MOVE
*        R2       BYTE ADR OF SOURCE BUFFER
*        R3       BYTE ADR OF DESTINATION BUFFER
MOVER    EQU      %
         STB,1    3                 COUNT TO R3
         MBS,2    0                 MOVE IT
         B        *0
         PAGE
*        THIS ROUTINE SETS THE CONDITION CODES IN THE USERS PSD
*        IN HIS TEMP STACK AND RETURNS TO CAL+1 EVENTUALLY
*
CC0RST   LI,0     0
         B        SETCC
CC1SET   LW,0     Y8
         B        SETCC
CC2SET   LW,0     Y4
         B        SETCC
CC3SET   LW,0     Y2
SETCC    EQU      %
         LW,1     YF
*
         LI,4     -17               COMPUTE DOUBLEWORD ADR OF PSD
         AW,4     TSTACK            IN USERS TEMP STACK
         LD,2     *4
         STS,0    2                 STORE CONDITION CODES
         STD,2    *4
         DESTRUCT TRAPEXIT
*
NOPCORE  PULL     7,1
         LW,5     3                 RESET CURRENT ASP/DB BECAUSE NEW ONE
         EXU      STORIT,2           WASNT ASSOCIATED
CC4SET   LW,0     Y1
         B        SETCC
CC1RST   EQU      CC0RST
         TITLE    'MSRKEYIN'
*                                   TYPES A MESSAGE ON OC DEVICE AND
*                                   READS A RESPONSE FROM THE OPERATOR
*                                   BAL,SR4 MSRKEYIN
*                                   R7 =ADR OF PLIST
MSRKEY   EQU      %
MSRKEYIN EQU      %
         LI,6     6
         BAL,1    PUSHALL
         LI,9     MSROCTY+X'80000'  OC ADDR+NEGATIVE REG
         LW,6     0,7               M:OC REQUESTED
         CI,6     X'10'             OCONLY FLAG
         BANZ     %+2
         LI,9     MSRTYPR           NOT OC ONLY
         BAL,11   *9                GO TO APPROPRIATE ROUTINE
         LI,R6    M:UC              L/ADR OF M:UC; ASSUME ON-LINE
         LH,D4    J:JIT             L/LH OF WD 0 OF JIT
         BGEZ     %+2               NOT ONLINE, USE M:OC
         BDR,9    MSRKY0
         LCI      8                 L/CC'S OF 8 FOR LM/PSM
         LM,SR4   M:OC              L/SKELETON M:OC DCB
         PSM,SR4  TSTACK            PUSH INTO TSTACK
         LW,R6    TSTACK            L/TOP OF STACK POINTER
         AI,R6    -7                -7; G/ADR OF DCB
MSRKY0   RES      0
         LI,R0    K40               SET BTD TO A ONE
         BAL,D4   SETBTDQ1
*
         BAL,R2   CHKBIT1
         B        %+1
         BAL,R2   CHKBIT
         LI,D2    K1FFFF
         STS,D1   QBUF,R6
         BAL,R2   CHKBIT
         B        %+2               REPLY SIZE
         LI,D1    60                USE DEFAULT FOR LIMIT
         LW,D4    D1
         BAL,R0   SAVBLK
         BAL,R2   CHKBIT
         LW,R7    D1                ECB ADDRESS
         STW,D4   SR3               SAVE D4
         LI,D4    0                 NEED ONLY CHECK 1 PAGE
         BAL,R0   CKLIMIT
         BCS,3    ABORT             ACCESS IN CC
         LW,D4    SR3                 RESTORE D4
         LW,SR3   D1
         LI,R7    X'1FFFF'
         AND,R7   QBUF,R6
         BAL,R0   CKLIMIT
         BCS,3    ABORT
*
*
*
         LI,R1    BAFCN             INCREMENT FUNCTION COUNT
         LI,R2    1                 SET IT TO 1
         STB,R2   *R6,R1
         LW,R3    Y008
         STS,R2   0,R6
         REF      Y008
*                                   SET UP REGISTERS FOR QUEUE
*                                   OPCODE
         LW,SR1   R6
         BAL,SR4  QUEUE             DO IO
         BAL,SR4  IOSPIN
         LW,R0    ARS,R6            L/ARS (ACT REC SIZE) FROM DCB
         SLS,R0   -17               RJ/ARS
         LW,R6    QBUF,R6           L/USER'S BUFFER ADR
         STB,R0   *R6               S/ARS IN BYTE 0 OF USER'S BUFFER
         LW,R1    Y8                L/BIT 0 MASK
         STS,R0   *SR3              RESET BIT 0 IN USER'S ECB
*                                   EXIT
         DESTRUCT MSRWRTX
*
ABORT    LI,14    X'4A'
         B        T:ABORTM
ARS      EQU      4
BAFCN    EQU      X'1C'
K1FFFF   EQU      X'1FFFF'
K40      EQU      X'40'
QBUF     EQU      7
         SPACE    5
         REF      CHKBIT
         REF      CHKBIT1
         REF      CKLIMIT
         REF      IOSPIN
         REF      M:OC
         REF      MSRTYPR
         REF      MSRWRTX
         REF      PUSHALL
         REF      QUEUE
         REF      SAVBLK
         REF      SETBTDQ1
         REF      T:ABORTM
UCALSIZ  EQU      %-UCAL
         END      UCAL

