*************************************************************************
*M*      XMONITOR DECODES :MON CC-BUILDS M:CPU,M:SYMB,CSEBRANCH,M:CONFIG
*        AND MON::ORG
***************************************************************************
*
         SYSTEM   SIG7FDP
         SYSTEM   BPM
*
*
         DEF      UBMONITOR
         REF      P2ERR
         REF      P2OVLOP
         REF      SSIZE,SDGANSG,CORE,M:TM,LLIST,READSTRG
         REF      COREALLOC,SYNTAX,WRITELM,MODGEN
         REF      AVTBLGTH,#MXSTRM,SYMBCOUNT,PRIVDEV
         REF      LORBIN,#RBTS
         REF      #GRANPER
         REF      BIGLOC
         REF      MINCOCFL
         REF      LPART#
         REF      MPOOL,CPOOL
         REF      DCT1TEMP
         REF      ABNERR2
         REF      P2ABRT
         REF      PASS2OUT
         REF      DCTSIZE
         REF      DP3275
         REF      MCDEV
         REF      LOGIT
         REF      HAND2FLG
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
DYN      CNAME
         PROC
LF       EQU      %-DYNAM
         GEN,1,15,16 AF(1),AF(2),AF(3)
         PEND
RFDFSIZ  EQU      240
CFUSIZ   EQU      19
ROMSIZ   EQU      X'1C'
SPECSTART  DATA   0
SPECLGTH DATA     0
MFSVAL   DATA     0
VALLCLX  DATA     0
         BOUND    8
SITESTRT DATA     X'40404040',X'40404040',X'40404040'
SITETOP  DATA     X'40404040'
         BOUND    8
CSE%7    DATA     X'5BFF7AF7'
         DATA     X'F2F54040'
X1FFFE   DATA     X'1FFFE'
         PAGE
*****CSEDFLAGS GETS SET AS FOLLOWS  DEPENDING ON CONFIGURATION
*
*    BIT 24 SET IF SIG7 WAS SPECIFIED ON :MON CC
*    BIT 25 SET IF SIG9 WAS SPECIFIED ON :MON CC
*    BIT 26 SET IF X560 WAS SPECIFIED ON :MON CC
CSEDFLGS DATA     0
*****CONFFLGS GETS SET AS FOLLOWS DEPENDING ON CONFIGURATION
*
*    BYTE 0 SET IF BIG SPECIFIED ON :MON CC
*    BYTE 1 SET IF BIG AND SIG9 SPECIFIED ON :MON CC
*    BYTE 3 SET IF BIG AND X560 SPECIFIED ON :MON CC
*
CONFFLGS DATA     0
*****THE FOLLOWING MASK TABLE SERVES TO CHK ILLEGAL COMBINATIONS
*****OF SIG9,SIG7,X560 AND BIG SPECIFICATIONS
*
*    IF BYTE 0 IS SET, SIG9 WAS SPECIFIED ON :MON CC
*    IF BYTE 1 IS SET, SIG7 WAS SPECIFIED ON :MON CC
*    IF BYTE 2 IS SET, X560 WAS SPECIFIED ON :MON CC
*    IF BYTE 3 IS SET, BIG  WAS SPECIFIED ON :MON CC
*
*
M1111    DATA     X'01010101'       SIG9,SIG7,X560,BIG
M0111    DATA     X'00010101'            SIG7,X560,BIG
M1011    DATA     X'01000101'       SIG9      X560,BIG
M1101    DATA     X'01010001'       SIG9,SIG7      BIG
M0101    DATA     X'00010001'            SIG7      BIG
*
MTAB     EQU      %-CONFFLGS
*        CONVERSION TABLE        SYMBOLS    SHIFT FACTOR - 1
CLUNITAB DATA     X'00000809'    - A B C     0   1   2   3
         DATA     X'0A0B0C0D'    D E F G     4   5   6   7
         DATA     X'10110012'    H I - J     8   9  10  11
         DATA     X'13141518'    K L M N    12  13  14  15
         DATA     X'191A1B1C'    O P Q R    16  17  18  19
         DATA     X'00001D20'    - - S T    20  21  22  23
         DATA     X'21222324'    U V W X    24  25  26  27
         DATA     X'2528292A'    Y Z 0 1    28  29  30  31
         DATA     X'2B2C2D30'    2 3 4 5    32  33  34  35
         DATA     X'31323334'    6 7 8 9    36  37  38  39
SPECTABS DATA     X'292A2B2C'    ACTUAL SHIFT COUNT FOR %,#,@,:
SPECSYMB TEXT     '%#@:'
         BOUND    8
PRESENTF DATA     0,0            D.W. TABLE OF PREVIOUSLY ENCOUNTERED
*                                SYMBOLS. BITS SET AS PER SHIFT
*                                FACTOR NOTATIONS FOR CLUNITAB ABOVE
TEMPSTAK DATA     %+1               TEMP STACK POINTER D. W.
         GEN,16,16 16,0
         RES      16
XC0      DATA     X'C0'
XFFFF    DATA     X'FFFF'
X7       DATA     7
X38      DATA     X'38'
X7F      DATA     X'7F'
XF0404040 DATA    '0   '
MOC      TEXTC    'M:OC'
         DATA     2,0,X'200003',X'60002'
ORGROM   DATA     X'1C00801C',X'0306D4D6','NORG',12**24,X'0A010100'
         DATA     X'20',X'02020E00'
ROMSIZE  EQU      X'1C'
THREE    DATA     3,1
STBYHA   EQU      %
         STB,9    *12,1
         STH,9    *12,1
CONFIGNM TEXTC    'M:CONFIG'
CSEBRNM  TEXTC    'CSEBRANCH'
HAND     TEXTC    'HANDLERS'
HAND2KEY  TEXTC   'HANDLERS2'
TPOVFLGS DATA X'01010000'
         BOUND 8
CSEHAND  TEXTC    'CSEHAND'
CSES7    TEXTC    'CSES7'
CSES9    TEXTC    'CSES9'
CSEX560  TEXTC    'CSEX560'
CSECOM   TEXTC    'CSECOM'
XTQROOT  TEXTC    'TQROOT'
XPWP     TEXTC    'PWP'
         TEXT     '    '
IOQ      TEXTC    'IOQ'
         TEXT     '    '
SWPSCED  TEXTC    'SWPSCED'
BUFPOOLS RES      4
DCT1     DATA     0
CSEDBUF  EQU      %
         LIST     0
         DO1      200
         DATA     0
         LIST     1
NGMSG    TEXTC    '*** COMBINATION OF SIG9/SIG7/X560/BIG - ILLEGAL',;
                  ' OR ALL OF THESE ARE MISSING'
NGSYMB   TEXTC    '*** UNRECOGNZIED DEVICE SYMBOL ON ONE OF ',;
                  'THE DEVICE CARDS. SYMBOL IS:   '
NOMCDEV  TEXTC    '***SINCE AN X560 WAS SPECIFIED AN MC DEVICE SHOUL',;
                  'D HAVE BEEN INCLUDED IN THE DEVICE CONTROL COMMANDS'
NOENHAND TEXTC    '*** TROUBLE WITH SPEC:HAND -  ',;
                  'HANDLERS RECORD NOT INCLUDED'
NO560    TEXTC    '***SINCE AN MC WAS SPECIFIED IN DEVICE COMMANDS',;
                  ' AN X560 SHOULD BE INCLUDED ON :MON CC.'
COR2LG   TEXTC    '***CORE SPECIFICATION TOO LARGE FOR THIS ',;
                  'SYSTEM. 128K SUBSTITUTED.'
CPUNAME  TEXTC    'M:CPU'
ANSMSG   TEXTC    '*** NOT BOTH ANSDET AND',;
         ' ANSPROT-IGNORED'
AVGSMSG  TEXTC    '*** AVGSER OUT OF RANGE --DEFAULT',;
                  ' (1) USED'
CHKREC   LB,R1    SR3               IT IS POSSIBLE THAT HANDLERS
         CI,R1    X'43'             RECORD DOES NOT EXIST AT
         BNE      NOGO              THIS TIME. IF SO IT'S O.K.
         M:CLOSE  M:TM,(SAVE)       TO AVOID A WRITE BEFORE READ ERROR
         M:OPEN   M:TM,(FILE,'SPEC:HAND'),(KEYED),(INOUT),(SAVE),;
                  (ERR,NOGO),(ABN,NOGO),(DIRECT)
         LI,R1    0
         STW,R1   *SPECSTART         INITIALIZE SIZE TO ZERO
         LI,R1    2
         B        CHKCSED
NOGO     EQU      %
         LW,14    L(X'00200000')    CHECK FCD BIT OF DCB
         AND,14   M:TM              IS DCB OPEN?
         BAZ      %+2               NO
         M:CLOSE  M:TM,(SAVE)       YES
         LI,14    NOENHAND
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         CAL1,8   =X'09000002'      RELEASE GOTTEN PAGES
         B        EXITOUT
*
*
ERR      LCI      7
         PLM,9    *0
         EXU      NOGO
         EXU      NOGO+1
         BAZ      ABNERR2
         M:CLOSE  M:TM,(REL)
         B        ABNERR2
*
*
NG       LI,D3    NGMSG
         MTW,1    P2ERR,R3
         CAL1,2   LLIST
         MTW,1    P2ABRT,R3         ABORT PASS2
         B        PASS2OUT
*
*
ERTPMIN  LI,D3    TPMINMSG
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         B        CONTINUE
TPMINMSG TEXTC    '*** MINICOC OPTION WILL BE IGNORED SINCE TP',;
                  ' HAS ALSO BEEN SPECIFIED'
         PAGE
*
*        KEYWORDS
*
KWD      COM,32,8,24  AF(1),AF(2),AF(3)
FOP      COM,1,7,8   AF(1),AF(2),AF(3)
KWDTBLO  EQU      %
         DATA     KWDTBL-KWDTBLO
         FOP      0,0,3             0 FIND LEFT '('
         FOP      1,0,9             1 KWD
         FOP      1,0,10            2 PROCKWD
         FOP      1,0,8             3 INTEROPT
         FOP      0,1,1             4 GOTO 1
         FOP      1,3,20            5 GETSTRG
         FOP      0,1,19            6 DW TBL PTR AT 1,R5
         FOP      0,3,1             7 GO TO 3
KWDTBL   EQU      %
         TEXT     'SIG9'
         GEN,8,8,16   0,1,(SIGLOC*4)+0
         TEXT     'SIG7'
         GEN,8,8,16   0,1,(SIGLOC*4)+1
         TEXT     'SIG6'            SIG6 AND SIG7 ARE SYNONYMOUS
         GEN,8,8,16   0,1,(SIGLOC*4)+1
         TEXT     'X560'
         GEN,8,8,16   0,1,(SIGLOC*4)+2
         TEXT     'BIG'
         GEN,8,8,16   0,1,(SIGLOC*4)+3
         TEXT     'MINICOC'
         GEN,8,8,16   0,1,(MINLOC*4)+3
         TEXT     'ANS'
         GEN,8,8,16  0,1,(ANSDLOC*4)+3     ALLOW 'ANS' BUT IGNORE IT
         TEXT     'ANSDET'
         GEN,8,8,16  0,1,(ANSDLOC*4)
         TEXT     'ANSPROT'
         GEN,8,8,16  0,1,(ANSPLOC*4)+3
         TEXT     'TP'
         GEN,8,8,16   0,1,(TPLOC*4)+3
         KWD      'QUEU',1,QUELOC   DEC
         KWD      'CORE',1,CORLOC   DEC
         KWD      'ORG ',2,ORGLOC   HEX
         KWD      'MPOO',1,MPOLOC   DEC
         KWD      'CPOO',1,CPOLOC   DEC
         KWD      'CFU ',1,CFULOC   DEC
         KWD      'MPAT',1,MPXLOC   DEC
         KWD      'INFI',1,INFILOC
         KWD      'OUTF',1,OUTFILOC
         KWD      'AVGS',1,AVGSLOC
         KWD      'ENQ ',1,ENQLOC
         TEXT     'SITE'
         GEN,8,7,17  8,0,5          KEYWORD GOTO
LKWDTBL  EQU      %
         DATA     #DYNAM            #KWDS WITH DEFAULTS
KWDPTR   GEN,15,17  LKWDTBL-KWDTBL,KWDTBLO
         PAGE
*
*   LIMITS AND DEFAULTS
*
DYNAM    EQU      %
SITEPTR  DATA     SITETOP
         DATA     SITESTRT
QUELOC   DYN      1,10,0
CORLOC   DYN      1,128,0
ORGLOC   DYN      1,X'62',0
MPOLOC   DYN      1,5,0
SPSIZ    DATA     256
CPOLOC   DYN      1,3,0
CFULOC   DYN      1,40,0
MPXLOC   DYN      1,700,0
INFILOC  DYN      1,20,0
OUTFILOC DYN      1,32,0
AVGSLOC  DYN      1,1,0
ENQLOC   DYN      1,0,0
SIGLOC   DYN      0,0,0
MINLOC   DYN      0,0,0
ANSDLOC  DYN      0,0,0
ANSPLOC  DYN      0,0,0
TPLOC    DYN      0,0,0
#DYNAM   EQU      %-DYNAM
KEYAD    DATA     0
         PZE      EXITOUT           ABORT RETURN FROM COREALLOC OR MODGEN
         PAGE
UBMONITOR LI,R1   #DYNAM
         LW,4     KWDPTR
         LI,R2    DYNAM
         BAL,SR4  SYNTAX
         LCI      15
         PSM,R1   TEMPSTAK
         LW,D1    MINLOC,R5         CHK FOR PRESENCE OF MINICOC OPTION
         BEZ      CONTINUE
         CW,D1    TPLOC,R5          PRESENT. NOW CHK FOR PRESENCE OF TP
         BE       ERTPMIN           BOTH - NOT ALLOWED
         STW,D1   MINCOCFL,R3       SET FLAG FOR LATER PROCESSING BY
*                                   BY COC MODULE
CONTINUE EQU      %
         LW,12    MPOLOC,5
         STW,D1   MPOOL,R3          MPOOL AND CPOOL GET TRANSFERED
         LW,D1    CPOLOC,R5         TO STACK FOR PROCESSING BY P2COC
         STW,D1   CPOOL,R3
         LW,D2    SIGLOC,R5         CHECK FOR ALL LEGAL COMBINATIONS
         BEZ      NG                OF SIG9/SIG7/X560/BIG
         LI,R4    MTAB
         CW,D2    CONFFLGS-1,R4
         BE       NG
         BDR,R4   %-2
         LW,R4    CORLOC,R5         GET CORE SIZE
         CI,D2    1                 WAS BIG SPECIFIED
         BAZ      %+3               BRANCH IF NOT
         MTW,1    BIGLOC,R3         SET BIG FLAG FOR OTHER MODULES
         B        CORWORDS
         CI,R4    128               CHECK FOR A BIG TYPE MACHINE
         BLE      CORWORDS          BRANCH IF REASONABLE
         LI,R4    128               OTHERWISE RESET TO 128K WORDS
         LI,D3    COR2LG            AND PRINT WARNING MESSAGE
         BAL,SR4  LOGIT
CORWORDS SLS,R4   10                CONVERT K VALUE TO # OF WORDS
         STW,R4   CORLOC,R5
         SLS,D2   8
         BCS,8    SIG9              IF 1 BIT HAS PASSED BIT 0, IT'S SIG9
         SLS,D2   8
         BCS,8    SIG7              IF 1 BIT (BYTE 1) HAS PASSED BIT 0
         SLS,D2   -16
         CH,D2    M1111             ARE BYTE 2/3 = 0101
         BNE      %+4               BRANCH IF ONLY X560 FLAG IS SET
*                                   IT'S AN X560 AND BIG
         LI,R6    1                 SET FLAGS FOR M:CONFIG CODE
         MTB,1    R6                SAVE CONFIGURATION FLAGS
         STW,R6   CONFFLGS          SAVE CONFIGURATION FLAGS
         LI,R6    X'20'
         OR,R6    CSEDFLGS          SET 560  FLAG
         STW,R6   CSEDFLGS
         B        CPURFDFS
SIG9     LI,R6    X'40'
         OR,R6    CSEDFLGS          SET SIG9 BIT IN FLAG WORD
         STW,R6   CSEDFLGS
         CI,D2    0
         BE       CPURFDFS          BRANCH IF ONLY SIG9 WAS SPECIFIED
         SLS,D2   8
         BCR,8    CHK560            BRANCH IF NOT A SIG7/SIG9 COMBO
         LI,R6    X'80'
         OR,R6    CSEDFLGS          SET SIG7 BIT IN FLAG WORD
         STW,R6   CSEDFLGS
         CI,D2    0
         BE       CPURFDFS          ONLY SIG9/SIG7 WERE SPECIFIED
CHK560   SLS,D2   8
         BCR,8    SIG9BIG           BRANCH IF ONLY SIG9/BIG SPECIFIED
SET560FL LI,R6    X'20'             SET X560 FLAG
         OR,R6    CSEDFLGS
         STW,R6   CSEDFLGS
         B        CPURFDFS
SIG9BIG  LH,R6    M1101
         STH,R6   CONFFLGS          SAVE CONFIGURATION FLAGS
         B        CPURFDFS
SIG7     LI,R6    X'80'             SET SIG7 BIT IN FLAG WORD
         OR,R6    CSEDFLGS
         STW,R6   CSEDFLGS
         CI,D2    0                 WAS ONLY SIG7 SPECIFIED
         BNE      SET560FL          BRANCH IF X560 ALSO SPECIFIED
CPURFDFS LI,D1    2*RFDFSIZ
         LI,D2    -1
         BAL,SR4  COREALLOC         GET SOME WORK AREA
         BAL,SR3  MODGEN
         LI,D1    4
         TEXTC    'C%MSZE0'
         LW,D1    CSEDFLGS
         STW,D1   *SR1
         TEXTC    'C%CPU1'
         B        %+1
         AI,SR1   1
         LCI      3
         PSM,R7   *R0
         CI,D1    X'80'             IS IT A SIG7 ONLY
         BE       CLEANUPAA         BRANCH IF SO
         BAL,SR3  MODGEN
         TEXTC    'C%MSTAT1'
         B         %+1
CHK9560  CI,D1    X'40'             CHECK FOR ANY COMBINATION OF SIG9
         BAZ      VARSIZ3           BRANCH IF NOT COMBINATION WITH SIG9
VARSIZ4  AI,SR1   20
         CI,D1    X'20'             CHK FOR 560 COMBO
         BANZ     ANY560
         B        CLEANUPA
VARSIZ3  AI,SR1   15                HERE FOR SIG7/560 OR JUST 560
ANY560   BAL,SR3  MODGEN
         TEXTC    'C%PSTAT1'
         AI,SR1   7
         TEXTC    'C%PCNTL1'
         B        %+1
         LW,D2    DCT1TEMP,R3       GET DCT1 ADDRESS
         STW,D2   DCT1              SAVE IT
         LCI      3
         PSM,R7   *R0
         LI,D2    CSEDBUF
         LI,D1    DP3275
         AW,D1    R3
         LW,R6    DCTSIZE,R3         TOTAL # OF DEVICES SPECIFIED
         AI,R6    -1
         LI,R4    -1
         LI,R2    0
GRANDLUP AI,R4    1
         AI,R2    2                 R2 POINTS TO CHANNEL SYMBOL 4 EACH DEVICE
         LB,R1    *D1               GET # OF 3275 PACKS SPECIFIED
         LI,D3    4                 ASSUME MIOP PROCESSOR FOR THIS CLUSTER
         LB,R5    *DCT1,R2          GET A CHANNEL SYMBOL FROM THE DCT1
*                                   TABLE
         CI,R5    'A'               CHECK FOR ALPHANUMERICS
         BL       SPECSYMBL         BRANCH IF ONE OF SPECIAL SYMBOLS
         EOR,R5   XC0               SUBTRACT OFF 'C0'
         LD,SR3   PRESENTF          CHECK IF THIS SYMBOL HAS ALREADY
         LW,SR2   R5                BEEN ENCOUNTERED
         AI,SR2   X'301'            GET SET FOR APPROPRIATE SHIFT
         S,SR3    *SR2
         CI,SR4   1                 BIT WILL BE SET IF ALREADY ENCOUNTERRED
         BANZ     SKIPNTRY
         AI,SR4   1
         EOR,SR2  X7F               GET TWO'S COMPLEMENT OF SR2
         AI,SR2   1
         S,SR3    *SR2
         STD,SR3  PRESENTF          SET BIT ON FIRST OCCURENCE OF SYMBOL
         AW,R5    XC0
LUP3275  EQU      %
         LB,D4    *D1,R1            CHECK TABLE VALUE AGAINST CURRENT SYMBOL
         CW,R5    D4                IS CURRENT ENTRY A 3275 SYMBOL
         BE       ITS3275
         BDR,R1   LUP3275           BRANCH IF NOT
STORTYPE EQU      %
         STB,D3   *SR1,R4           MIOP OR RMP TYPE GOES INTO CNTL TABLE
         EOR,R5   XC0               SUBTRACT OFF 'C0'
         LB,R5    CLUNITAB,R5       GET TRUE PROCESSOR ADDRESS
         STB,R5   *D2,R4            STORE IT   IN TEMP BUFFER
         BEZ      MINSYSTM          IF R5 = 0, CHANNEL SYMBOL WAS 'A'
GENCLUST AI,R4    1                 DO FOLLOWING FOR ALL CLUSTERS
         LI,D3    2                 MI TYPE GOES INTO CNTL TABLE
         STB,D3   *SR1,R4
         AND,R5   X38               DISCARD UNIT PART AND KEEP CLUSTER
         AI,R5    6                 PART OF 6-BIT ADDRESS (HIGH ORDER 3
         STB,R5   *D2,R4            BITS = CLUSTER PART. LOW ORDER 3 BITS
         AI,R4    1                 = UNIT PART)
         AI,R5    1                 GENERATE MI AND PI CLUSTER,UNIT
         STB,R5   *D2,R4            ADDRESSES
         LI,D3    3                 GENERATE PI TYPE
         STB,D3   *SR1,R4
ENDLOOP  BDR,R6   GRANDLUP
         B        CLEANUP
ITS3275  LI,D3    5                 GENERATE RMP TYPE
         B        STORTYPE
MINSYSTM AI,R4    1
         LW,D3    X38               GENERATE ONE SU ADDRESS
         STB,D3   *D2,R4
         LI,D3    7                 GENERATE ONE SU TYPE
         STB,D3   *SR1,R4
         AI,R4    1
         LI,D3    1                 GENERATE ONE CPU TYPE
         STB,D3   *SR1,R4
         LI,D3    5                 GENERATE ONE CPU ADDRESS
         STB,D3   *D2,R4
         B        GENCLUST
SPECSYMBL LI,R7   3
SPSYMBLP CB,R5    SPECSYMB,R7
         BNE      NEXTSYMB
         LB,SR2   SPECTABS,R7
         LD,SR3   PRESENTF          CHK IF ALREADY PROCESSED
         AI,SR2   X'300'
         S,SR3    *SR2
         CI,SR4   1
         BANZ     SKIPNTRY
         AI,SR4   1
         EOR,SR2  X7F
         AI,SR2   1
         S,SR3    *SR2
         STD,SR3  PRESENTF
         LW,R5    R7                SPECIAL SYMBOLS HAVE ADDRESSES
         AI,R5    1                 OF: 01,02,03 & 04 REPCTIVELY
         STB,D3   *SR1,R4           STORE AWAY MIOP TYPE
         STB,R5   *D2,R4
         B        GENCLUST
NEXTSYMB BDR,R7   SPSYMBLP
         CI,R7    0
         BE       SPSYMBLP          DO ONE MORE TIME
         STB,R5   NGSYMB+18
         LI,D3    NGSYMB            IF NEGATIVE, DON'T RECOGNIZE SYMBOL
         B        NG+1
SKIPNTRY AI,R4    -1
         B        ENDLOOP
CLEANUP  EQU      %
         LW,D1    R4
         LCI      3
         BAL,SR3  MODGEN
         TEXTC    'C%PSZE0'
         AI,R4    4                 CONVERT # OF CLUSTER-UNIT ADDRESSES
         SLS,R4   -2                INTO # OF WORDS USED
         AW,SR1   R4
         TEXTC    'C%PADDR1'
         B        %+1
         LW,R6    R4
         AI,R6    -1
         LW,R5    *D2,R6            MOVE DATA FROM TEMP BUFFER TO LOAD
         STW,R5   *SR1,R6           MODULE
         BDR,R6   %-2
         LW,R5    *D2
         STW,R5   *SR1
         AW,SR1   R4
CLEANUPA EQU      %
         LW,R5    *R0
         AI,R5    -1
         STW,SR1  *R5               SAVE NEW VALUE OF SR1 IN STACK
         LW,D1    CSEDFLGS
CLEANUPAA EQU     %
         MTW,0    MCDEV,R3          CHK IF MCDEV SPECIFIED
         BEZ      CHK560Z           CHK IF 560 SPECIFIED
         CI,D1    X'20'             IF MC THEN CHK FOR 560 ALSO
         BANZ     CLEANUPC          BR. IF O.K.
         LI,D3    NO560             PRINT ERR MESS.
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         B        CLEANUPC
CHK560Z  CI,D1    X'20'
         BAZ      CLEANUPC          BR IF O.K.. NO MC AND NO 560
         LI,D3    NOMCDEV
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         B        CLEANUPC
CLEANUPC LCI      15
         PLM,R1   TEMPSTAK
         LCI      3
         PLM,R7   *R0
CALCMFS  LW,D2    #RBTS,R3
         MI,13    2                 VALUE FOR MFS LATER
         AI,13    2                 =2+(2*#RBTS)
         STW,13   MFSVAL
         AW,13    OUTFILOC,5
         STW,13   OUTFILOC,5        STORE CONVERTED VALUE
*                                   (OUTFILE+MFS)
         LW,12    ANSDLOC,5
         MTB,0    12                WAS ANSDET SPECIFIED
         BNE      TESTBOTH          YES THEN BRANCH
         MTW,0    ANSPLOC,5         WAS ANSPROT SPECIFIED
         BNE      ANSOK             YES, THEN LEAVE ANSPLOC = 1
STONEG   LI,12    -1                NO, THEN SET ANSPLOC = -1
         STW,12   ANSPLOC,5
         B        ANSOK
TESTBOTH MTW,0    ANSPLOC,5
         BEZ      ANSOK
         LI,14    ANSMSG            NO,ERROR
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
         B        STONEG            IGNORE BOTH ANSDET AND ANSPLOC SPECS
ANSOK    EQU      %
         LI,12    1020/16
         CW,12    AVGSLOC,5         UPPER LIMIT OKAY
         BGE      GETCOR
         LI,D1    1
         STW,12   AVGSLOC,5
         LI,14    AVGSMSG
         BAL,SR4  LOGIT             PUT ERROR IN T:P2SI    & LP
GETCOR   EQU      %
STUTS    EQU      %
         LW,D1    QUELOC,R5
         BAL,SR3  MODGEN
         TEXTC    'MAXBQ0'          SET MAXBQ TO VAL. DEF = QUELOC
         LW,12    #GRANPER,3
         TEXTC    'SDGA0'
NOSYM    TEXTC    'IOQ11'           DEF IOQ1
         LW,14    QUELOC,5          CALCULATE TABLE SIZES
         AI,14    1
         LW,12    14                WD TBL
         AI,14    1
         SLS,14   -1
         LW,13    14                HWD TBL
         AI,14    1
         SLS,14   -1                BYTE TBL
         AW,8     14
         TEXTC    'IOQ21'
         TEXTC    'QFREE1'
         LW,9     8
         AW,8     14
         TEXTC    'IOQ31'           INSURE ADEQUATE SPACE
         LW,1     QUELOC,5          GEN IOQ2
         AI,1     -1
         STB,1    *9,1
         MTB,1    *9,1
         BDR,1    %-2
         MTB,1    *9
         BAL,10   MODGEN
         AW,8     14
         TEXTC    'IOQ41'
         AW,8     14
         TEXTC    'IOQ51'
         AW,8     14
         TEXTC    'IOQ61'
         AW,8     12
         TEXTC    'IOQ71'
         AW,8     14
         TEXTC    'IOQ81'
         AW,8     12
         TEXTC    'IOQ91'
         AW,8     13
         TEXTC    'IOQ101'
         AW,8     14
         TEXTC    'IOQ111'
         AW,8     14
         TEXTC    'IOQ121'
         AW,8     12
         AI,8     1                 BOUND 8
         AND,8    X1FFFE
         TEXTC    'IOQ131'
         AW,8     12
         AW,8     12
         TEXTC    'IOQ141'
         AW,8     14
         TEXTC    'IOQ151'
         AW,8     14
         TEXTC    'IOQ161'
         AW,8     12
         LW,12    CORLOC,5
         TEXTC    'CORE0'           DEF CORE SIZE
CFU      TEXTC    'ACNCFU1'
         AI,8     CFUSIZ
         TEXTC    'FILCFU1'
         AI,8     CFUSIZ
         TEXTC    'BGRCFU1'
         LI,13    CFUSIZ
         MW,13    CFULOC,5
         AI,13    -CFUSIZ
         AW,8     13
         TEXTC    'LASTCFU1'
         AI,8     CFUSIZ
         AI,8     1
         SLS,8    -1                BOUND 8 FOR MPATCH
         SLS,8    1
         TEXTC    'MPATCH1'
         LW,R4    SR1
         AI,R4    1                 1ST WORD OF MPATCH CONTAINS
         AWM,R4   *SR1              ADDRESS OF MPATCH + 1
         TEXTC    '22'
         AW,8     MPXLOC,5
NOPATCH  B        %+1
         LW,4     CORLOC,5          GET CORE SIZE
         SLS,4    -9                IN PAGES
         LCW,R2   BIGLOC,R3         GET 'BIG' FLAG
         BEZ      SMALMACH
BIGMACH  AI,SR1   -8                ADJUST START OF NEXT TABLE
SMALMACH AI,SR1   -8
         BAL,10   MODGEN
         TEXTC    'MX:PPUT1'
         LW,12    8                 SAVE REG 8
         SLS,8    2,2               ADJ.ADD BY/HW
         LCW,2    2                 CNVT FLG TO POSITIVE
         AW,8     4                 INCRE.BY CORE IN PAGES
         AW,8     THREE,2           ADD FOR BOUNDING
         SLS,8    -2,2              ADJ ADD BACK TO WRD
         TEXTC    'M:FPPH1'
         LI,1     X'20'             GENERATE
         LI,9     X'21'             LINKED
         EXU      STBYHA,R2         ENTRIES IN MX:PPUT
         AI,9     1
         AI,1     1
         CW,9     4
         BL       %-4
         B        %+1
         BAL,10   MODGEN
         LI,12    X'20'
         STW,12   *8
         AI,8     1
         TEXTC    'M:FPPT1'
         AI,9     -1
         STW,9    *8
         AI,8     1
         TEXTC    'M:FPPC1'
         AI,9     -X'1F'
         STW,9    *8
         AI,8     2                 BOUND 8 FOR NEXT TABLE
         SLS,8    -1
         SLS,8    1
         TEXTC    'AVRFNMT1'
         LW,9     AVTBLGTH,3        GET # TAPES
         STW,9    12                SAVE # TAPES
         MI,9     6                 6 WORDS/ENTRY
         AW,8     9
         TEXTC    'AVRSID1'
         AW,8     12                # OF TAPES
         TEXTC    'ANSFLGS1'
         LW,9     12                CALC BYTE TBL LENGTH
         AI,9     3
         SLS,9    -2
         AW,8     9
         TEXTC    'ANSPRT1'
         LW,9     ANSPLOC,5
         STW,9    *8
         AI,8     1
         TEXTC    'LAVRFMT0'        12= TOTAL TAPES
         LW,D4    SPSIZ
         AW,15    SSIZE,3
         AI,15    -1
         LW,12    SSIZE,3
         TEXTC    'SSSIZE0'
         BEZ      %+3
         DW,15    SSIZE,3
         AI,10    1
         BAL,10   MODGEN
         LW,12    15
         TEXTC    'SBSECTS0'
         LW,12    SDGANSG,3
         SLD,12   -16
         SLS,13   -16
         DW,13    15
         MW,13    15
         LW,12    13
         TEXTC    'SGSIZE0'
         AI,8     1                 BOUND 8 FOR NXT TABLE
         SLS,8    -1
         SLS,8    1
         TEXTC    'SITEID1'
         LW,13    SITESTRT
         STW,13   *8
         AI,8     1
         LW,13    SITESTRT+1
         STW,13   *8
         AI,8     1
         TEXTC    'BW:CHG1'         8=TABLE ADDRESS
         AI,8     1
         TEXTC    'BL:IFS1'         MUST BE BEFORE NEXT TABLE
         LW,13    INFILOC,5         IMMEDIATELY
         AI,13    -1
         STW,13   *8
         AI,8     1
         TEXTC    'BL:OFS1'         MUST FOLLOW BL:IFS
         LW,13    OUTFILOC,5        GET CONVERTED OUTFILE VALUE
         SW,13    MFSVAL            GET USER SPEC VALUE
         AI,13    -1
         STW,13   *8
         AI,8     1
         TEXTC    'LSERIAL1'
         LW,13    AVGSLOC,5         COMPUTE LENGTH
         MI,13    16                ((16*AVGSER)+3/4)+1
         AI,13    3
         SLS,13   -2
         AI,13    1+16              16 ADDED TO INSURE MIN LENGTH
         CI,13    255               MUST BE LESS THAN 255
         BLE      %+2               YES
         LI,13    255               NO
         STW,13   12                SAVE # ENTRIES
         AI,13    3
         SLS,13   -2
         STW,8    9                 SAVE START ADDRESS
         AW,8     13
         LI,4     0
         LI,6     1
         STB,6    *9,4
         AI,6     1
         AI,4     1
         CW,4     12                # OF ENTRIES
         BL       %-4
         LW,D1    MINCOCFL,R3
         BEZ      CONTINU1
         BAL,SR3  MODGEN
         TEXTC    'MINICOC0'
         AI,SR3   1
CONTINU1 EQU      %
         BAL,10   MODGEN
         TEXTC    'TSERIAL1'
         STW,R4   *SR1              HIGHEST ENTRY #
         AW,SR1   R4
         AI,SR1   1
         TEXTC    'RSERIAL1'
         AW,8     13
         LW,12    #RBTS,3           ANY RBTS
         BNEZ     RBTBLS            YES
         TEXTC    'LCLX0'           NO,LCLX=0
         TEXTC    'RBLIMSZ0'        #RBTS = 0
         TEXTC    'RBB:ID1'         RBB:ID = 1 WORD OF 0
         AI,8     1
         B        SIG9TEST
RBTBLS   EQU      %
         BAL,10   MODGEN
         TEXTC    'RBLIMSZ0'        #RBTS IN 12
         TEXTC    'RB:XFLG1'
         AI,8     1
         LW,13    LORBIN,3          GET LOW RBT DCT INDEX
         SLS,13   -2
         SW,8     13                BUMP PTR BACK
         TEXTC    'RBB:ID1'
         LW,12    LORBIN,3
         TEXTC    'RBLIMSIX0'       DEF LOW RBT DCT INDEX
         AW,12    #RBTS,3
         STW,12   VALLCLX
         TEXTC    'LCLX0'           LCLX=LORB+#RBTS OR HIRB+1
         AI,12    1+3               TO COMPUTE END OF TABLE
         SLS,12   -2
         AW,8     12
         SW,8     13                BUMP PTR BACK
         TEXTC    'RBB:HFE1'
         LW,12    LORBIN,3
         AW,12    #RBTS,3           TABLE LENGTH = #RBTS
         AI,12    3                 NO ENTRY AT LCLX
         SLS,12   -2
         AW,8     12
         SW,8     13                BUMP PTR
         TEXTC    'RBB:HOU1'
         AW,8     12
         SW,8     13
         TEXTC    'RBB:HIN1'
         AW,8     12
         SW,8     13
         TEXTC    'RBB:BCB1'
         AW,8     12
         LW,13    LORBIN,3
         SW,8     13                WORD TABLE
         TEXTC    'RB:BUF1'
         AW,13    #RBTS,3
         AW,8     13
SIG9TEST EQU      %
         MTW,0    TPLOC,R5          WAS TP SPECIFIED
         BEZ      ENQ
         B        %+1
         LW,SR4   TPOVFLGS
         AWM,SR4  P2OVLOP,R3        SET FLAGS RO TPOV2 & TPOV1 OVERLAYS
         AI,SR1   1
         AND,SR1  X1FFFE            BOUND8
         BAL,SR3  MODGEN
         TEXTC    'TTP1'
         AI,SR1   25
         TEXTC    'E2'              INSURE ADDEQUATE SPACE
ENQ      EQU      %
         MTW,0    ENQLOC,5          ENQ OPTION
         BLEZ     WRITECPU          NO,SKIP
         B        %+1
         AI,SR1   1
         AND,SR1  X1FFFE            BOUND 8
         MTW,1    P2OVLOP,R3        SET FLAG FOR ENQOV
         LW,11    8                 SAVE ADDRESS
         BAL,10   MODGEN
         LW,D1    ENQLOC,R5
         TEXTC    'QTSZ0'
         TEXTC    'QT1'
         AW,8     ENQLOC,5
         AW,8     ENQLOC,5
         TEXTC    'E2'              INSURE SPACE
         B        %+1
         XW,8     11                RECOVER STARTING POINT
         LW,12    ENQLOC,5          GET NUMBER OF ENTRIES
         AI,12    -1                NOT THE LAST ONE
         BLEZ     %+6
         LI,2     0
         LI,1     X'10000'
         STW,1    *8,2
         AI,2     2
         AI,1     X'10000'
         BDR,12   %-3
         LW,8     11                GET ENDING ADDRESS
WRITECPU EQU      %
         LW,4     CORLOC,5          GIVE CORE SIZE
         STW,4    CORE,3            TO P2CCI
         LW,4     ORGLOC,5          SAVE INFO FOR MON::ORG
         LW,D3    CSEDFLGS
         CI,D3    X'60'             CHK FOR SIG9 AND/OR 560
         BAZ      GETCPUNM          BRANCH IF NEITHER ONE
         AI,R4    -X'43'            = (MONORG-X'52'+X'F')
         SLS,R4   -4
         CI,R4    1                 THIS CODE DESIGNED TO SKIP
         BE       %+2               INTERRUPT GROUP 1 WHICH DOESN'T
         AI,R4    1                 EXIST FOR THESE MACHINES
         AI,R4    1                 ROUND FOR H.W. TABLES
         SLS,R4   -1
         BAL,SR3  MODGEN
         TEXTC    'PFSRARM1'
         AW,SR1   R4
         TEXTC    'PFSRTRIG1'
         AW,SR1   R4
         TEXTC    'PFSRENAB1'
         AW,SR1   R4
         LW,R4    ORGLOC,R5         RESTORE R4
         AI,SR1   -1
GETCPUNM B        %+1
         LI,14    CPUNAME
         BAL,11   WRITELM           WRITE M:CPU
         CI,8     -1
         BE       EXITOUT           ABORT RETURN
         M:OPEN   M:TM,(FILE,'MON::ORG'),(OUT),(SAVE),(CONSEC)
         AI,4     1
         AND,4    X1FFFE            BOUND8
         AI,R4    2                 LEAVE SLOT OF 2 WORDS BETWEEN
*                                   MONORG AND NEXT LOAD ITEM
         SLS,4    2
         AWM,4    ORGROM+3
         AI,R4    -8                STEP BACK FOR MONORG DEF
         SLS,4    8
         AWM,4    ORGROM+5
         LI,6     2
         LB,12    ORGROM,6
         LI,13    3
         SLS,4    -8                COMPUTE
         AW,12    4                 NEW
         AW,12    4                 CHECK
         BDR,13   %-3               SUM.
         AI,D1    8
         STB,12   ORGROM,6
         M:WRITE  M:TM,(BUF,ORGROM),(SIZE,ROMSIZE),(WAIT)
         M:CLOSE  M:TM,(SAVE)
         B        %+2
         PZE      WRSYMB            ERROR RETURN FOR M:SYMB
         LI,12    2*RFDFSIZ
         LI,13    -1
         BAL,11   COREALLOC
         LI,12    1
         LW,1     LPART#,3
         SLS,12   0,1
         AI,12    -1
         BAL,10   MODGEN
         TEXTC    'MBSMSK0'
         LW,12    INFILOC,5
         AI,12    1
         SLS,12   1                 FIRST TABLE ON DW
         TEXTC    'BD:ACCT1'        BOUNDARY
         AW,8     12
         SLS,12   -1
         TEXTC    'B4W:RES1'
         LW,13    12
         SLS,13   2                 X4 WORDS/ENTRY
         AW,8     13
         AI,12    1
         SLS,12   -1
         TEXTC    'BH:TIME1'
         AW,8     12
         TEXTC    'BH:SLNK1'
         AW,8     12
         TEXTC    'BH:XLNK1'
         AW,8     12
         LW,12    MFSVAL
         TEXTC    'MFS0'
         LW,12    OUTFILOC,5
         TEXTC    'OUTFIL0'
         LW,12    INFILOC,5
         TEXTC    'INFIL0'
         AW,12    OUTFILOC,5
         TEXTC    'BW:SDA1'
         AI,12    1
         LW,13    12                SAVE INFILE+OUTFILE+1
         AW,8     12
         SW,8     INFILOC,5         BUMP PTR BACK
         TEXTC    'BW:FORM1'        EFFECTIVE AREA - INFIL TO
         AW,8     13                INFIL+OUTFIL+1
         STW,14   9
         LW,14    INFILOC,5
         SLS,14   -1
         SW,8     14                BUMP PTR BACK IN HALF WORDS
         TEXTC    'BH:GRAN1'
         LW,14    13
         AI,14    1
         SLS,14   -1
         AW,8     14
         LW,14    INFILOC,5
         SLS,14   -2
         SW,8     14                BUMP PTR BACK IN BYTES
         TEXTC    'BB:COPY1'
         LW,14    13
         AI,14    3
         SLS,14   -2
         AW,8     14
         LW,14    9
         TEXTC    'BH:SID1'
         AI,12    1
         SLS,12   -1                #OF HALFWORDS
         AW,8     12
         TEXTC    'BH:COMID1'
         TEXTC    'BH:PART1'
         AW,8     12
         TEXTC    'BH:LINK1'
         STW,8    9                 SAVE 8
         AW,8     12
         TEXTC    'E2'              INSURE ADEQUATE SPACE
         B        %+1
         AI,13    -2
         LI,4     1                 SET UP LINKS
         LI,6     2
         STH,6    *9,4
         AI,6     1
         AI,4     1
         CW,4     INFILOC,5
         BL       %-4
         AI,4     1
         AI,6     1
         STH,6    *9,4
         CW,4     13                13=INFILE+OUTFILE-1
         BL       %-4
         BAL,10   MODGEN
         TEXTC    'BB:PI1'
         TEXTC    'BB:DEV1'
         AI,12    1
         SLS,12   -1
         AW,8     12
         TEXTC    'BB:RID1'
         AW,8     12
         TEXTC    'S#W:SER1'
         LW,13    AVGSLOC,5         COMPUTE # OF ENTRIES
         MW,13    INFILOC,5         (((INFIL*AVGSER)+3)/4)+1
         AI,13    3
         SLS,13   -2
         AI,13    1
         STW,13   12                SAVE #OF ENTRIES
         AW,8     13
         TEXTC    'S#H:LNK1'
         STW,8    9
         AI,13    1
         SLS,13   -1                CONVERT HW TO #WORDS
         AW,8     13
         TEXTC    'E2'              INSURE ADEQUATE SPACE
         B        %+1
         AI,12    -1
         LI,4     0
         LI,6     1
         STH,6    *9,4
         AI,4     1
         AI,6     1
         CW,4     12
         BL       %-4
         BAL,10   MODGEN
         AI,13    1
         SLS,13   -1                CONVERT TO # BYTES
         TEXTC    'S#B:TYP1'
         AW,8     13
         LW,13    #MXSTRM,3         GET MXSTRM VALUE
         AW,13    SYMBCOUNT,3       + # OF SYMBDEVICES
         AI,13    2                 + 2
         TEXTC    'STW:FORM1'
         AW,8     13
         SLS,13   -1
         TEXTC    'STH:NM1'
         AW,8     13
         TEXTC    'STH:CMDV1'
         AW,8     13
         AI,13    1
         SLS,13   -1
         TEXTC    'STB:DPD1'
         AW,8     13
         MTW,0    #RBTS,3           ANY RBTS
         BNEZ     RBSYMTABS         YES
         TEXTC    'RB:SPMF1'
         AI,8     1
         TEXTC    'RB:MFAD1'
         AI,8     1
         TEXTC    'RBH:MFX1'
         TEXTC    'SYMND1'
         B        WRSYMB
RBSYMTABS  EQU    %
         BAL,10   MODGEN
         SW,8     LORBIN,3
         TEXTC    'RB:SPMF1'
         AW,8     VALLCLX
         AI,8     1
         SW,8     LORBIN,3
         TEXTC    'RB:MFAD1'
         AW,8     VALLCLX
         AI,8     1
         LW,12    LORBIN,3
         SLS,12   -2
         SW,8     12                BUMP PTR BACK
         TEXTC    'RBB:SMD1'
         LW,13    LORBIN,3          COMPUTE #WRDS FOR ENTRIES
         AW,13    #RBTS,3           (LORBIN+#RBTS+3)/4
         AI,13    3
         SLS,13   -2
         AW,8     13
         SLS,12   1                 CONVERT TO HALFWORD
         SW,8     12
         TEXTC    'RBH:MFX1'
         SLS,13   1                 CONVERT TO HALFWORD
         AW,8     13
         SW,SR1   D1                BUMP PTR BACK
         AI,SR1   1
         TEXTC    'RBH:OFL1'
         AW,SR1   D2
         SW,SR1   D1                BUMP PTR BACK
         TEXTC    'RBH:IFL1'
         AW,SR1   D2
         SW,SR1   D1                BUMP PTR BACK
         TEXTC    'RBH:JB1'
         AW,SR1   D2
         SW,SR1   D1                BUMP PTR BACK
         TEXTC    'RBH:ACT1'
         AW,SR1   D2
         SW,SR1   D1                BUMP PTR BACK
         TEXTC    'RB:CTM1'
         SLS,D2   1                 CONVERT TO WORD RESOL
         SLS,D1   1
         AW,SR1   D2
         SW,SR1   D1                BUMP PTR BACK
         SLS,D1   -2                CONVERT TO BYTES
         SLS,D2   -2
         TEXTC    'RBB:DSM1'
         AW,8     13
         SW,8     12
         TEXTC    'RBB:MXP1'
         AW,8     13
         AI,8     -1
         TEXTC    'SYMND1'
WRSYMB   EQU      %
         B        %+1
         LI,14    SYMBNM
         BAL,11   WRITELM
         CI,8     -1
         BE       EXITOUT           ABORT RETURN
         CAL1,8   =X'08000002'
         BCS,8    EXITOUT
         STW,9    SPECSTART
         SLS,8    11
         STW,8    SPECLGTH
         LI,R6    HAND              ASSUME A WRITE TO THE HANDLERS RECORD
         MTW,0    TPLOC,R5          IF TP SPECIFIED, ASSUMPTION IS GOOD
         BNEZ     OPENTM
         MTW,0    HAND2FLG,R3       OTHERWISE CHECK FOR :HANDLERS2 SPEC.
         BEZ      OPENTM            IF NOT PRESENT, ASSUMPTION IS GOOD
         LI,R6    HAND2KEY          OTHERWISE WRITE TO HANDLER2 RECORD
OPENTM   EQU      %
         M:OPEN   M:TM,(FILE,'SPEC:HAND'),(KEYED),;
                  (INOUT),(SAVE),(ERR,CHKREC),(ABN,NOGO)
READTM   M:READ   M:TM,(BUF,*SPECSTART),(KEY,*R6),;
                  (ERR,NOGO),(ABN,NOGO),(SIZE,*SPECLGTH)
         LW,1     13+M:TM
         SLS,1    -2
CHKCSED  EQU      %
         SLS,R1   -1
         MTW,0    TPLOC,R5
         BEZ      CHKCSEDA
         LD,SR3   XTQROOT           IF TP SPECIFIED THAN TQROOT
         BAL,D4   HANDLUP           AND PWP MUST BE ADDED TO HANDLERS REC.
         LD,SR3   XPWP
         BAL,D4   HANDLUP
CHKCSEDA MTW,0    HAND2FLG,R3       WAS :HANDLERS2 SPECIFIED
         BEZ      CHKCSEDB
         CI,R6    HAND2KEY          IS HANLERS2 RECORD ABOUT TO BE
         BNE      WRSPECA           WRITTEN?  BRANCH IF NOT
CHKCSEDB LD,SR3   SWPSCED           IF HANDLERS, I0Q & SWPSCED  GET
         BAL,D4   HANDLUP           WRITTEN TO HANDLERS2. OTHERWISE
         LD,SR3   IOQ               THEY GO INTO HANDLERS RECORD
         BAL,D4   HANDLUP           INCLUDED IN HANDLERS2 RECORD
         LD,SR3   CSEHAND           CSEHAND ALWAYS INCLUDED
         BAL,D4   HANDLUP
         LW,D1    CSEDFLGS          CHK FOR SIG7, SIG9 & X560
         CI,D1    X'60'             IF EITHER OR BOTH SIG9 & 560,
         BAZ      CHKSIG7           THEN CSECOM HANDLER IS NEEDED
         LD,SR3   CSECOM
         BAL,D4   HANDLUP
         CI,D1    X'20'             IS THERE A 560
         BAZ      CHKSIG9
         LD,SR3   CSEX560           YES INCLUDE CSEX560 HANDLER
         BAL,D4   HANDLUP
CHKSIG9  CI,D1    X'40'             IS THERE A SIG9
         BAZ      CHKSIG7
         LD,SR3   CSES9             YES. INCLUDE CSES9 HANDLER
         BAL,D4   HANDLUP
CHKSIG7  CI,D1    X'80'             IS THERE A SIG7
         BAZ      WRSPECA
         LD,SR3   CSES7             YES. INCLUDE CSES7 HANDLER
         LI,D4    WRSPECA
HANDLUP  STD,SR3  *SPECSTART,R1
         MTW,1    *SPECSTART
         AI,1     1
         B        *D4
WRSPECA  SLS,R1   3                 CHANGE R1 TO BYTES
         M:WRITE  M:TM,(BUF,*SPECSTART),(SIZE,*R1),(KEY,*R6),;
                  (ERR,NOGO),(ABN,NOGO),(ONEWKEY),(WAIT)
         MTW,0    HAND2FLG,R3       CHK FOR :HANDLERS2 SPECIFICATION
         BEZ      CLSM:TM
         CI,R6    HAND2KEY          HAS HANDLERS2 RECORD BEEN WRITTEN
         BE       CLSM:TM           BRANCH IF SO
         LI,R6    HAND2KEY
         LI,R2    -4
         EXU      OPENTM+5,R2
         BIR,R2   %-1
         B        CHKCSEDA
CLSM:TM  M:CLOSE  M:TM,(SAVE)
         CAL1,8   =X'09000002'
         LI,R2    1
         LI,R1    X'F1'
         LI,D1    256
         LI,D2    256
         BAL,SR4  COREALLOC
         LW,R6    CSEDFLGS          CHK IF 1 MACHINE OR MORE
         CI,R6    X'60'             IS IT SIG9 AND X560
         BE       2MACHS
         BL       SIG9R560
         CI,R6    X'80'             IS IT JUST SIG7
         BE       1SIG7             BRANCH IF SO
2MACHS   LI,R4    0
         BAL,SR3  MODGEN
         TEXTC    'CSEBRANCH1'
         B        %+2
CSENMLUP0 EQU     %
         STB,R1   CSE%560+1,R2
CSENMLUP STB,R1   CSE%NM+1,R2       ALTER TEXTC DEF NAME
         AI,R1    1
         CI,R1    X'FA'
         BNE      %+2
         LI,R1    X'C1'             NAMES GO FROM CSE%1 TO CSE%F
         CI,R1    X'C8'
         BE       FINI
         BAL,SR3  MODGEN
CSE%NM   DATA     X'06C3E2C5'
         DATA     X'5BFFF140'       2ND BYTE GETS ALTERED EACH TIME THRU
         AW,SR3   R4
         AI,SR1   1
         B        CSENMLUP
CSE%560  DATA     X'0BC3E2C5'
         DATA     X'5BFF7AF5'
         DATA     X'F6F0F2F5'
         B        CSENMLUP0
1SIG9    MTW,2    CSE%7             CHANGE 'CSE%N:7 TO CSE%N:9
1SIG7    MTB,-2   CSE%560           CHANGE BYTE SIZE OF CANNED REF NM
         LD,SR3   CSE%7
         STW,SR3  CSE%560+1
         STW,SR4  CSE%560+2
1MACH    LI,D1    X'300'            CONVERT TO AN ADEF EQU TO REF
         AWM,D1   CSE%NM+1          CONVERT TO A VALUE DEF
         LI,R4    2
         B        CSENMLUP0
SIG9R560 CI,R6    X'20'             IS IT JUST A X560
         BNE      1SIG9             BR. IF NOT.  MUST BE SIG9
         B        1MACH
FINI     LI,D3    CSEBRNM           NOW WRITE OUT CSEBRANCH MODULE
         BAL,SR4  WRITELM
WRT:CONF EQU      %
         LI,D1    40
         LI,D2    0
         BAL,SR4  COREALLOC
         LW,R6    CONFFLGS          GET BIG/SIG9/X560 FLAGS
         BAL,SR3  MODGEN
         LB,D1    R6                =1 IF BIG SPECIFIED
         TEXTC    ':BIG0'
         SLS,D1   9                 MULTIPLY VALUE BY 512
         TEXTC    ':BIGX5120'
         SLS,R6   8                 =1 IF BOTH BIG AND SIG9 SPECIFIED
         LB,D1    R6
         TEXTC    ':B90'
         SLS,R6   16
         LB,D1    R6                =1 IF BOTH BIG AND X560 SPECIFIED
         TEXTC    ':B5600'
         LI,D3    CONFIGNM          NOW WRITE OUT M:CONFIG MODULE
         BAL,SR4  WRITELM
         MTB,0    CONFFLGS          CHECK FOR BIG SPECIFICATION
         BEZ      EXITOUT
         LW,D1    CONFFLGS
         STW,D1   BIGLOC,R3
EXITOUT  EQU      %
         LI,12    -#DYNAM
         MSP,12   *0
         PLW,12   *0
         CW,12    0
         BE       %+2
         PSW,12   *0
         B        READSTRG
SYMBNM   TEXTC    'M:SYMB'
PATCH    EQU      %
         LIST     0
         DO1      50
         DATA     0
         LIST     1
         END

