***********************************************************************
*M*      SPROCS   TO DECODE :SPROCS CC AND BUILD M:SPROCS
***********************************************************************
*
         SYSTEM   SIG7FDP
         SYSTEM   BPM
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      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
D1       EQU      12
D2       EQU      13
D3       EQU      14
D4       EQU      15
         REF      P2ABRT,P2ERR
         REF      P2OVLOP
         REF      M:TM
         REF      PRNTP2SI
         REF      LOGIT
         REF      READSTRG,LLIST
         REF      SYNTAX,COREALLOC,MODGEN,WRITELM
         DEF      SPROCS
         REF      TREE00
         REF      SWAPUTS,SCYLPSA
         REF      BIGLOC
         REF      HAND2FLG
DYN      CNAME
         PROC
LF       EQU      %-DYNAM
         GEN,1,15,16  AF(1),AF(2),AF(3)
         PEND
FOP      CNAME
         PROC
         GEN,1,7,8    AF(1),AF(2),AF(3)
         PEND
         PAGE
*
*        CARD FORMAT AND KEYWORD
*
KWDTBLO  EQU      %
         DATA     KWDTBL-KWDTBLO
         FOP      0,0,3             0    FIND '('
         FOP      0,10,9            1    KEYWORD SEARCH
         FOP      1,0,10            2    PROCESS KEYWORD
         FOP      0,8,1             3    GO TO 8
         FOP      0,8,6             4    COMMA
         FOP      1,4,12            5    NAME TO TEXTC
         FOP      0,1,19            6    DW TBL PTR AT 1,R5
         FOP      0,4,1             7    GO TO 4
         FOP      1,0,8             8    '),('
         FOP      0,1,1             9    GO TO 1
         FOP      1,0,15            10   KWD TO TEXTC
         FOP      0,3,19            11   DW TBL PTR AT 3,R5
         FOP      0,8,6             12   COMMA
         FOP      0,15,13           13   DECIMAL NUMBER
         FOP      0,18,1            14   GO TO 18
         FOP      1,12,11           15   TEXT 'SJPDMTBGC' NOT >8
         FOP      0,3,19            16   DW TBL PTR AT 3,R5
         FOP      0,12,1            17   GO TO 12
         FOP      0,3,18            18   WD TBL PTR AT 3,R5
         FOP      0,12,1            19   GO TO 12
         FOP      0,21,1            20  NOP
         FOP      0,8,12            21  WD
         FOP      0,9,19            22  DW STORE
         FOP      0,8,6             ,
         FOP      0,27,13           24  DEC
         FOP      0,9,18            25  WD STORE
         FOP      0,23,1            26
         FOP      1,8,11            27  TEXT
         FOP      0,9,19            28  DW STORE
         FOP      0,23,1
KWDTBL   TEXT     'UTM '
         GEN,8,7,17  8,0,5          KEWORD GO TO 5
         TEXT     'MON'
         GEN,8,7,17    8,0,5        KEYWORD GO TO 5
         TEXT     'POSP'
         TEXT     'ACE '
         GEN,8,7,17  1,0,POSPLOC    1 DEC VALUE
         TEXT     'MOSP'
         TEXT     'ACE '
         GEN,8,7,17  1,0,MOSPLOC    1 DEC VALUE
         TEXT     'PSPA'
         TEXT     'CE  '
         GEN,8,7,17  1,1,PSPLOC     2 DEC VALUES
         TEXT     'REPL'
         GEN,8,7,17 8,0,20
DFLTS    DATA     #DFLT
KWDPTR   GEN,15,17  DFLTS-KWDTBL,KWDTBLO
*
*  SKELETON DYNAMIC DATA FOR SYNTAX
*
DYNAM    EQU      %
OTBLTOP  DATA     0
OTBLPTR  DATA     0
PTBLTOP  DATA     0
PTBLPTR  DATA     0
POSPLOC  DYN      1,0,-1
MOSPLOC  DYN      1,0,0
PSPLOC   DYN      1,0,-1
PSPSZLOC DYN      1,6,255
#DFLT    EQU      %-DYNAM
RTBLTOP  DATA     0
RTBLPTR  DATA     0
#DYNAM   EQU      %-DYNAM
         PAGE
*
*        OTHER    DATA
*
FILENAME TEXTC    'M:SPROCS'
OVNAMES  TEXTC    'OVNAMES'
NOOVLY   LI,D3    NOSPREC
         BAL,SR4  LOGIT             PUT MESSAGE IN T:P2SI    FILE
         B        CONTINUE
NOSPREC  TEXTC    '***TROUBLE WITH SPEC:HAND FILE - NO MONITOR OV',;
                  'ERLAY NAMES RECORD GENERATED'
         BOUND    8
FLGMSG   TEXTC    '*** ILLEGAL FLAG X FOR XXXXXXXX - FLAG IGNORED'
NOROOM   TEXTC    '**** INSUFFICIENT SPACE -- SPROCS ABORTED'
NOMOSPC  TEXTC    '*** MOSPACE OPTION NOT VALID.',;
                        ' IT WILL BE IGNORED'
PSPMSG   TEXTC    '**** PSPACE SIZE > S:CYLSZ -- ',;
                  'S:CYLSZ USED'
BEGIN    RES      1
         BOUND    8
         DATA     0
NOREMESS TEXTC    '***XXXXXXXX NOT STANDARD PROCESSOR. CAN''T REPLACE'
ENQRTMES TEXTC    '*** ENQ AND RTNRRT IGNORED. PASS2 SUPPLIES ',;
                  'CORRECT OVERLAY NAMES'
         BOUND    8
DUPMESS  TEXTC    '***ATTEMPT TO REDEFINE XXXXXXXX. IGNORED.'
ZERO     DATA     0,0,0
XDMLM    TEXTC    'M:DUMLM'
         GEN,8,24 3,0
         BOUND    8
FLGMSGF  EQU      18
FLGMSGN  EQU      FLGMSG+6
LIMS     DATA     X'800000'         LOWER LIMIT FOR TEXTC < 8 CHARS
         DATA     X'7FFFFFF'        UPPER LIMIT FOR TEXTC > 0 CHARS
RFDFSIZ  EQU      200
P0P9     TEXTC    ':P0'
         TEXTC    ':P9'
FLGS     TEXT     'PDJSMTBGCX'
FLAG     COM,1,31 1,1**(16-AF(1))+1**(16-AF(2))
FLAGS    FLAG     2,4
         FLAG     2,3
         FLAG     1,0
         FLAG     2,0
         FLAG     5,0
         DATA     X'80000400'       T FLAG BIT 5
         DATA     X'80000200'       B FLAG BIT 6
         DATA     X'80000100'       G FLAG BIT 7
         DATA     X'80000700'       C FLAG BITS 5,6,7
         DATA     X'80000040'
#FLAGS   EQU      %-FLAGS
         DATA     0                 FLAG FOR BLANK
STDOLY   EQU      %
         TEXTC    'KEYIN'
         TEXTC    'LDLNK'
         TEXTC    'DEBUG'
         TEXTC    'LTAPE'
         TEXTC    'OPEN'
         TEXTC    'CLOSE'
         TEXTC    'MULOV'
         TEXTC    'MISOV'
         TEXTC    'OPENTP'
         TEXTC    'STEPOVR'
         TEXTC    'RMAOV'
#STDOLY  EQU      %-STDOLY
STDPROC  TEXTC    'GHOST1'
         TEXT     'JM'
         DATA     0,0
         TEXTC    'FIX'
         TEXT     '    M   '
         DATA     0,0
         TEXTC    'ALLOCAT'
         DATA     0,0,0
         TEXTC    'TEL'
         TEXT     '    JSMT'
         TEXT     'X   '
         DATA     0
         TEXTC    'CCI'
         TEXT     '    JMB '
         DATA     0,0
         TEXTC    'LOGON'
         TEXT     'JMTBG'
         DATA     0
         TEXTC    'LINK'
         TEXT     'SM  '
         DATA     0,0
         TEXTC    'DELTA'
         TEXT     'SD  '
         DATA     0,0
         TEXTC    ':P0'
         TEXT     '    P   '
         DATA     0,0
         TEXTC    ':P1'
         TEXT     '    P   '
         DATA     0,0
         TEXTC    'DRSP'
         TEXT     'M   '
         DATA     0,0
         TEXTC    'RUNNER'
         TEXT     'JS  '
         DATA     0,0
#STDPROC EQU      %-STDPROC
         BOUND    8                 FOLLOWING ARE OPTIONAL MON. OVLAYS
OPTOVLAY TEXTC    'TQOV2'
         TEXTC    'TQOV1'
         TEXTC    'RTOV'
         TEXTC    'ENQOV'
         TEXTC    'ECBOV'
UMOV     TEXTC    'UMOV'
OPOVREC  DATA     0,0               OPTIONAL OVERLAY NAME RECORD
OPTNAMES EQU      %                 TO BE WRITTEN OUT TO SPEC:HAND
         DO1      10                (5 POSSIBLE ENTRIES)
         DATA     0
XRTNRRT  TEXTC    'RTNRRT'
XENQ     TEXTC    'ENQ'
ENQRTFL  DATA     0
BLNKRT   GEN,8,24 12,BA(ENQRTMES+2)
BLNKENQ  GEN,8,24 8,BA(ENQRTMES+1)
TPFLAGS  DATA     X'01010000'       FLAGS FOR PRESENCE OF TPOV2 & TPOV1
         PZE      WRITE             ABORT RETURN FROM COREALLOC
         PAGE
*
*  START OF SPROCS
*
SPROCS   LW,5     7                 SAVE R7
         LW,1     =X'8000001'
         CAL1,8   1
         BCS,8    NOROOMCD
         STW,9    BEGIN
         STW,9    RTBLPTR
         AI,9     512
         STW,9    RTBLTOP
         LI,12    RFDFSIZ           GET
         LI,13    -1                SOME
         BAL,11   COREALLOC         CORE.
         B        %+2
         PZE      END               ABORT RETURN FROM MODGEN OR SYNTAX
         LW,9     TREE00,7          GET SECT00 DATA FROM TREE
         SLS,9    -16               DW SIZE = 1/2 WD SIZE
         LW,12    8
         AW,12    9
         LW,13    12                START OF PROCS TABLE
         AW,12    9                 END   OF PROCS TABLE
         LW,9     13                END   OF OVERLAYS TABLE
         LW,10    8                 START OF OVERLAYS TABLE
         STW,12   PTBLTOP
         STW,9    OTBLTOP
         LI,6     -#STDOLY          MOVE STD OVERLAYS TO FIRST HALF
         AI,10    #STDOLY+2         SET POINTER TO NEXT AVAIL LOC
         LW,14    STDOLY+#STDOLY,6
         STW,14   *10,6
         BIR,6    %-2
         STW,10   OTBLPTR
         LI,6     -#STDPROC         MOVE STD PROCESSORS TO SECOND HALF
         AI,13    #STDPROC          SET POINTER TO NEXT AVAIL LOC
         LW,14    STDPROC+#STDPROC,6
         STW,14   *13,6
         BIR,6    %-2
         STW,13   PTBLPTR
         LI,1     #DYNAM
         LI,2     DYNAM
         LW,4     KWDPTR                    SYNTAX
         LW,14    7                 SAVE MODIFY PLIST PTR
         LW,7     5                 RESTORE R7
         BAL,11   SYNTAX            (1)=0 ON RETURN
         LW,2     MOSPLOC,5
         BLEZ     %+3
         M:PRINT  (MESS,NOMOSPC)
         MTW,1    P2ERR,R3
         MTW,0    SWAPUTS,3         DP SWAPPER ?
         BEZ      SWAPDUN           NO
         PSW,7    *0
         PSW,14   *0
         LW,7     SCYLPSA,3         YES
         SLS,7    -16               GET#GRAN/PHY.CYL.
         CW,7     PSPSZLOC,5        IS SIZE </= ?
         BGE      %+4               NO
         STW,7    PSPSZLOC,5        YES,ERROR
         LI,14    PSPMSG
         BAL,SR4  LOGIT
         PLW,14   *0
         PLW,7    *0
SWAPDUN  EQU      %
         LW,7     14
         LW,R4    OTBLPTR-DYNAM,R5   R4 PTS TO LAST LOC + 1
*                                   OF MON OVERLAY NAMES INCLUDING
*                                   STD AND USER SUPPLIED NAMES
         SW,R4    OTBLPTR           R4 NOW = SIZE OF USER NAME AREA
         BEZ      GETOPOVS          SKIP FOLLOWING IF NO MON-USER NM
         SLS,R4   -1                # OF D.W. NAMES
         LI,R2    0
ENQRTLUP EQU      %                 THIS CODE REMOVES OLD ENQOV AND
         LD,D1    *OTBLPTR,R2       AND RTOV NAMES WHICH USERS MAY
         CW,D1    XENQ              STILL SUPPLY WITH MON OPTION
         BNE      CHK4RT            ON :SPROCS CC
         MTW,-2   1,R5              IF FOUND, BUMP TOP-0-TBL PTR
         LW,D3    1,R5              GET CURRENT LAST ENTRY
         LD,D1    *D3
         STD,D1   *OTBLPTR,R2       OBLITERATE OLD TYPE ENTRY
         AI,R4    -1                DECREMENT # LEFT TO DO
         MTW,1    ENQRTFL
CHK4RT   CD,D1    XRTNRRT
         BNE      ENDLUP-1
         MTW,-2   1,R5              IF FOUND, BUMP TOP-O-TBL PTR
         LW,D3    1,R5              GET CURRENT LAST ENTRY
         LD,D1    *D3
         STD,D1   *OTBLPTR,R2       OBLITERATE OLD TYPE ENTRY
         MTW,2    ENQRTFL
         AI,R4    -1
         BGZ      ENQRTLUP
         AI,R2    1
ENDLUP   BDR,R4   ENQRTLUP
         LW,R2    ENQRTFL
         CI,R2    2
         BG       PRINTIT
         BE       RTONLY
         LW,R1    BLNKRT
         B        %+2
RTONLY   LW,R1    BLNKENQ
         MBS,0    BA(ENQRTMES)
PRINTIT  LI,D3    ENQRTMES
         BAL,SR4  LOGIT             PUT MESSAGE IN T:P2SI    FILE
GETOPOVS EQU      %
         LW,12    OTBLPTR-DYNAM,5
         LI,R4    4                 THIS CODE INCLUDES OPTIONAL OVERLAYSS
         LI,R2    0                 -- RTOV,ENQOV,TPOV1,TPOV2
         LW,R1    P2OVLOP,R3        AND ECBOV DEPENDING ON SETTINGS IN
         LI,D2    OPTNAMES          AREA TO BUILD OPTIONAL OVERLAYS
OPOVLUP  LD,SR3   OPTOVLAY,R2
         SLS,R1   8                 CHECK FOR PRESENCE FLAGS
*                                   TPOV2 =01000000
*                                   TPOV1 =00010000
*                                   RTOV  =00000100
*                                   ENQOV =00000001
*                                   ECBOV = NONE
         BCR,8    IN2OPREC          BRANCH IF NOT PRESENT
         STD,SR3  *D1               OTHERWISE IT GOES INTO SPROCS
         AI,D1    2
         B        OVLUPND-1
IN2OPREC STD,SR3  *D2               STORE OPTIONAL NAMES IN MISSING
         AI,D2    2                 NAME RECORD TO BE WRITTEN TO SPEC:HAND
         MTW,1    OPOVREC           INCREASE # OF MISSING OVLAY NAMES
         AI,R2    1
OVLUPND  BDR,R4   OPOVLUP
         LD,SR3   OPTOVLAY,R2
         LW,R1    P2OVLOP,R3
         CW,R1    TPFLAGS
         BANZ     MISSECB
         STD,SR3  *D1               IT'S PRESENT. PUT IT IN SPROCS
         AI,D1    2
         B        CHKUMOV
MISSECB  STD,SR3  *D2               NOT PRESENT. PUT IT IN MISSING NAMES
         MTW,1    OPOVREC           RECORD.
         AI,D2    2
CHKUMOV  LD,SR3   UMOV
         MTW,0    HAND2FLG,R3
         BNEZ     STINPROC
         STD,SR3  *D2               WHEN NO HANDLERS2 CC, UMOV
         MTW,1    OPOVREC           GOES INTO MISSING NAMES RECORD
         B        SORTA
STINPROC STD,SR3  *D1               HANDLERS2 CC EXISTS STORE UMOV
         AI,D1    2                 IN M:SPROCS
SORTA    STW,D1   1,R5
         LW,2     8                 SORT OVERLAY NAMES INTO INVERSE ORDER
         MTW,-1   0,2               MAKE FIRST VERY BIG
SORT0    LW,1     2                 ADDR OF CURRENT SORTEE
         LW,11    1                 -2THAT IS
         SLS,11   2                 MAKE CBS POINTER
         AI,11    1                 SKIP COUNT
         MTB,7    11                COMPARE 7 BYTES
         CBS,11   8                 OF THIS AND THE NEXT
         BL       SORT1             CURRENT SORTEE IS SORTED
         BE       REMUVDUP          BRANCH IF A DUPLICATE
         LD,10    *1                NO, SWITCH THEM
         XW,10    2,1
         XW,11    3,1
         STD,10   *1
         AI,1     -2
         B        SORT0+1           AND TRY NEXT ONE
SORT1    AI,2     2                 TO NEXT UNSORTED ONE
         CW,2     12                ARE WE DOEN
         BL       SORT0             NO
         MTW,1    *8                YES, REZAP FIRST ENTRY
         LW,2     9
         B        MDMDN
REMUVDUP AI,D1    -2                REDUCE PTR TO END OF MON OVLAY NAMES
*                                   TABLE+2
         LD,SR3   *D1               GET LAST NAME IN THE TABLE
         STD,SR3  *R1               STORE IT OVER THE DUPLICATE NAME
         LI,R1    0                 ZERO OUT THE FORMER LAST NAME ENTRY
         STD,R1   *D1
         STW,R1   *SR1              RE-SET FIRST WORD OF TABLE TO ZERO
         B        SORTA             AND START AGAIN TO ORDER MONITOR
*                                   OVERLAYS IN INVERSE ALBHABETICAL
*                                   ORDER
DODUM    BEZ      *11
         LW,4     XDMLM
         STW,4    *12
         AI,12    1
         LW,4     XDMLM+1
         STW,4    *12
         AI,12    1
         AI,1     -1
         B        DODUM
MDMDN    CW,2     12
         BGE      OK
         LI,14    NOROOM
         BAL,SR4  LOGIT
         LI,8     -1
         B        END
OK       LCI      15
         PSM,1    *0
         LW,D4    R3                SAVE PTR TO P2ERR
         AI,D4    P2ERR
         LW,1     BEGIN
         CW,1     RTBLPTR-DYNAM,5
         BGE      NORE
         LW,2     *1
RE       LI,3     0
         CW,2     *9,3
         BE       FOUNDIT
         AI,3     5
RE1      CI,3     #STDPROC
         BL       %-4
         LI,3     X'40'
         STB,3    2
         LI,3     1
         LW,3     *1,3
         SCD,2    8
         STD,2    NOREMESS+1
         LI,14    NOREMESS
         MTW,1    *D4               INCREMENT ERROR COUNT
         CAL1,2   LLIST
         BAL,SR4  PRNTP2SI          PUT MESSAGE IN T:P2SI    FILE
         AI,1     1
TOOLONG  AI,1     1
         CW,1     RTBLPTR-DYNAM,5
         BGE      NORE
         LW,2     *1
         CLM,2    LIMS
         BCR,9    RE
         B        %-6
FOUNDIT  AI,1     1
         CW,1     RTBLPTR-DYNAM,5
         BGE      NORE
         AI,3     1
         LW,2     *1
         CW,2     *9,3              SECOND WORD MATCH?
         BE       %+4
         AI,1     -1                NO
         AI,3     4                 TRY IT AGAIN
         B        RE1
         AI,3     1                 ZERO OUT OLD FLAGS
         LCI      3
         LM,6     ZERO
         STM,6    *9,3
         LI,4     3                 MAXIMUM FOUR VALUES
         AI,1     1
         CW,1     RTBLPTR-DYNAM,5   OVER?
         BGE      NORE              YES
         LW,2     *1                PICK UP WORD
         CLM,2    LIMS              IS IT TESTC
         BCR,9    RE                YES
         STW,2    *9,3              NO STORE IT
         AI,3     1                 NEXT ENTRY
         BDR,4    %-8
         B        TOOLONG           TOO MANY ENTRIES
NORE     LW,1     9
         AI,1     #STDPROC          START OF NON STANDARD
         LW,2     *1                CHECH FOR DUPLICATES
CHECK    LI,3     0
         CW,2     *9,3              DOES IT MATCH?
         BE       DUP               YES
         AI,3     5                 NEXT STANDARD
NODUP    CI,3     #STDPROC
         BL       %-4
         AI,1     2                 NEXT ENTRY
         CW,1     3,5
         BGE      DUPDONE
         LW,2     *1
         CLM,2    LIMS              TEXTC?
         BCR,9    CHECK             YES
         AI,1     1
         B        %-6
DUP      AI,1     1
         AI,3     1
         LW,4     *1
         CW,4     *9,3              CHECK SECOND WORD
         BE       %+4
         AI,1     -1
         AI,3     4
         B        NODUP
         LW,3     4
         LI,4     X'40'             SETUP FOR ERROR MESSAGE
         STB,4    2
         SCD,2    8
         STD,2    DUPMESS+6
         LI,14    DUPMESS
         CAL1,2   LLIST
         BAL,SR4  PRNTP2SI          PUT MESSAGE IN T:P2SI    FILE
         MTW,1    *D4
         AI,1     -1
         LI,3     0
         STW,3    *1                ERASE ERROR
         AI,1     1
         STW,3    *1
         AI,1     1
         AI,1     1
         CW,1     3,5
         BGE      DUPDONE
         LW,2     *1
         CLM,2    LIMS
         BCR,9    CHECK
         STW,3    *1
         B        %-7
DUPDONE  EQU      %
         LCI      15
         PLM,1    *0
         BAL,11   SQUEEZE           MOVE TOGETHER (13)=0 ON RETURN
         CW,2     3,5
         BL       SQUEEZE-1         NO
         LW,1     PSPLOC,5
         BAL,11   DODUM
         LW,13    POSPLOC,5
         STW,1    0,5
         STW,1    1,5
         LW,2     8
         LW,1     9
         LW,8     2
         AI,2     2
NAME     EQU      %
         AWM,13   1,5               ADD N TO OVLY CNT
         LW,15    12
         AI,1     2                 SQUEEZE
         MTW,0    *1                OUT
         BEZ      %+2               ZERO,
         AI,1     1                 (NO)
         CW,1     2                 N, EXTRA FLAGS
         BGE      NAMEA             IF NECESSARY
         LW,12    1
         LW,4     2
         BAL,11   SQUEEZE
         CW,4     12
         BG       SQUEEZE-3
         LW,2     1
NAMEA    CI,15    0
         BE       ENDNAME           END
         MTW,1    0,R5              BUMP # OF NAMES
         LW,1     2
         LI,15    0                 SET FLAGS=0
         LI,13    0                 SET N=0
         AI,2     1
NAME1    AI,2     1
         LW,12    *2                CHECK NEXT WORD
         BEZ      NAME              END
         BLZ      NAME2             FLAG
         CLM,12   LIMS              NAME,N, OR FLAGS
         BCR,9    NAME              NAME
         BCS,8    NAME2             FLAGS
         AW,13    12                N, SAVE IT UNTIL NEXT NAME
         B        NAME1
NAME2    LB,14    12
         BEZ      NAME1
         LI,4     #FLAGS
         CB,14    FLGS,4            WHICH FLAG (S,D,J OR BLANK)
         BE       NAME3             PUT IN FLAG
         BDR,4    %-2
         CB,14    FLGS              IS IT P
         BNE      NAME4             BAD FLAG - IGNORE IT
         LW,14    *1                GET NAME
         CLM,14   P0P9              CHECK VALIDITY
         BCS,9    NAME4P            INVALID, IGNORE FLAG
         MTB,1    *1
         AI,1     1
         STB,14   *1
         AI,1     -1
NAME3    OR,15    FLAGS,4           GET FLAG
         STW,15  2,1               PUT AFYER NAME
         SLS,12   8                 MOVE TO NEXT TEXT FLAG
         B        NAME2
NAME4P   LI,14    'P'
NAME4    LI,4     FLGMSGF           PUT FLAG IN MESSAGE
         STB,14   FLGMSG,4
         LCI      2
         LM,10    *1                GET NAME
         SLD,10   8                 REMOVE LENGTH
         STD,10   FLGMSGN           PUT IN MESSAGE
         LI,14    FLGMSG
         PSW,SR4  *R0
         BAL,SR4  LOGIT             PUT MESSAGE IN T:P2SI    FILE
         PLW,SR4  *R0
         B        NAME3+1
         STW,13   *12               START OF SQUEEZE LOOP
         AI,12    1                 MOVES WORDS FROM
         AI,2     1                 *2 TO *12
SQUEEZE  LI,13    0                 ZEROS OUT *2-
         XW,13    *2                UNTIL TWO CONSECUTIVE ZERO WORDS
         BNEZ     %-5               ARE ENCOUNTERED
         LW,13    1,2               MAYBE END
         BEZ      *11               YES
         B        SQUEEZE-1         NO
ENDNAME LW,12     0,5               GET TOTAL
         AW,12    1,5               SPACE FOR P:NAME (IN DWDS)
         LW,1     8                 SAVE P:NAME ADDR
         BAL,10   MODGEN
         TEXTC    'PPROCS0'
         AI,D1    1
         TEXTC    'P:NAME1'
         AW,SR1   D1
         AW,SR1   D1
         AI,12    1
         SLS,12   -1
         STW,12   6                 SAVE HW INCREMENT
         TEXTC    'PH:PDA1'
         AW,8     12
         TEXTC    'PH:FRQ1'
         AW,8     12
         AI,12    1
         SLS,12   -1
         TEXTC    'PB:LNK1'
         AW,8     12
         TEXTC    'PB:LCT1'
         AW,8     12
         AI,8     1
         SLS,8    -1                DW BOUND
         SLS,8    1
         TEXTC    'PX:HPP1'
         LW,D2    BIGLOC,R3
         LB,D2    D2
         AW,SR3   D2                SKIP NEXT INSTR. IF 'BIG' ON :MON CC
         STW,D1   R6                FOR BIG USE HW TABLE OTHERWISE
*                                   USE BYTE TABLE
         AW,8     6
         TEXTC    'PX:TPP1'
         AW,8     6
         TEXTC    'PB:PSZ1'
         AW,8     12
         TEXTC    'PB:UC1'
         AW,8     12
         TEXTC    'PB:REP1'
         AW,8     12
         TEXTC    'PB:PVA1'
         AW,8     12
         MTW,0    SWAPUTS,3         DP SWAPPER
         BEZ      NOTSWAP
         TEXTC    'PB:C#1'
         AW,8     12
         TEXTC    'PB:DC#1'
         AW,8     12
NOTSWAP  EQU      %
         AI,10    1
         BAL,10   MODGEN
         TEXTC    'P:SA1'
         AW,8     0,5
         AI,SR1   1
         TEXTC    'E2'              INSURE ADEQUATE SPACE
         AI,SR1   -1
         SW,8     0,5
*  ROUTINE TO SET UP P:SA AND SQUEEZE N,FLAGS FROM P:NAME
         LI,4     0                 SET INDEX REG
         LW,6     STDPROC           TEXTC FORM OF 'TEL'NAME
         AI,1     2
SA1      LW,2     1
         CW,6     *1                CHECK FOR TEL
         BAZ      ENDSA             END
         BNE      %+2               NO
         STW,R4   2,R5              YES, SAVE PREV INDEX
         AI,R4    1
         AI,1     2
         AI,2     3
         LW,13    *1                CHECK NEXT WORD
         BLZ      SA2               FLAG
         CLM,13   LIMS
         BCR,9    SA1               NAME
         BCR,8    SA3               N- SQUEEZE IT OUT
SA2      SLS,13   16
         STW,13   *8,4              FLAG- STORE IT IN P:SA AND SQUEEZE O
SA3      LW,13    *2
         STW,13   *1
         LW,12    1
         BAL,11   SQUEEZE
         B        SA1
ENDSA    LW,12    2,5               SET TEL INDEX
         LW,D2    OPOVREC           GET # OF MISSING OPTIONAL OVERLAY
         AI,D2    1                 NAMES
         SLS,D2   3                 CONVERT TO BYTES
         M:OPEN   M:TM,(FILE,'SPEC:HAND'),(KEYED),(INOUT),(SAVE),;
                       (ERR,NOOVLY),(ABN,NOOVLY),(DIRECT)
         M:WRITE  M:TM,(BUF,OPOVREC),(SIZE,*D2),(KEY,OVNAMES),;
                       (ERR,NOOVLY),(ABN,NOOVLY),(ONEWKEY)
         M:CLOSE  M:TM,(SAVE)
CONTINUE EQU      %
         BAL,10   MODGEN
         TEXTC    'MAXOVLY0'
         LW,12    0,5
         TEXTC    'PNAMEND0'
         AI,D1    1                 NEED ZEROTH TOO
         AW,8     12
         AI,8     1
         SLS,8    -1
         SLS,8    1                 DW BOUND
         TEXTC    'P:AC1'
         LI,13    -1
         STD,13   *8
         SLS,13   -1
         STW,13   *8
         AW,8     12
         AW,8     12
         TEXTC    'P:TCB1'
         AW,8     12
         TEXTC    'PH:DDA1'
         AI,12    1
         SLS,12   -1
         AW,8     12
         TEXTC    'PB:DSZ1'
         AI,12    1
         SLS,12   -1
         AW,8     12
         TEXTC    'PB:DCBSZ1'
         AW,8     12
         TEXTC    'PB:HVA1'
         AW,8     12
         TEXTC    'PBT:LOCK1'
         AI,12    7
         SLS,12   -3
         AW,8     12
         AI,8     -1
         TEXTC    'E2'              INSURE ADEQUATE SPACE
         LW,12    PSPSZLOC,5
         TEXTC    'SPSIZE0'
END      LI,12    -#DYNAM
         B        %+1
         MSP,12   *0
         PLW,12   *0                TEMP
         CW,12    0
         BE       %+2               STACK.
         PSW,12   *0
WRITE    LI,14    FILENAME
         BAL,11   WRITELM
         LW,1     =X'9000001'
         CAL1,8   1
         B        READSTRG
NOROOMCD LI,D3    NOROOM
         BAL,SR4  LOGIT             PUT MESSAGE IN T:P2SI    FILE
         B        READSTRG
PATCH    EQU      %
         LIST     0
         DO1      50
         DATA     0
         LIST     1
         END

