         TITLE    '****  PASSTWO  ****'                                         
        SYSTEM   SIG5                                                           
         SYSTEM   OPTIONS                                                       
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  PASS TWO                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 PASS 2  REREADS RELOCATABLE OBJECT MODULES, AND               
*                                                                               
*                 USING TABLES  FROM PASS ONE, BUILDS AN ABSOLUTE               
*                                                                               
*                 CORE IMAGE  ON THE  PROGRAM FILE.                             
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
         TITLE    '****  DEFS,REFS  ****'                                       
         DEF      PASSTWO,OVOFLOW                                               
         DEF      OLAYTWO                                                       
         REF      M:OV,M:X4,M:X3                                                
         REF      B:X                                                           
         REF      M:X2                                                          
         REF      M:X5                                                  22      
         REF      V:LIBSIZ                                                      
         REF      FPT:CC1                                                       
         REF      FPT:RDG,FPT:WTG                                               
         REF      FPT:XN1                                                       
         REF      F:DEVICE                                                      
         REF      FBA:TEMP                                                      
         REF      FBA:LIM,LBA:LIM                                               
         REF      FBA:ROO2,LBA:ROO2,BL:ROO2,BAP:ROO2                            
         REF      FBA:INTT                                                      
         REF      FBA:DCBT,LBA:DCBT                                             
         REF      FL:UDCB,FL:RTYPE,FL:TASKS                                     
         REF      FL:OFLOW,FL:TEMP                                              
         REF      FL:BACK                                                      8
         REF      FL:ERROR                                                     8
         REF      FL:PUBL                                                      8
         REF      FL:OUTOV                                                16    
         REF      LBA:COMN,LBA:PATH                                             
         REF      MOVBYTS,BOUNDRDW,READXN,RDIAG,RABORT                          
         REF      ROMBYTE,ROMBYTES,CONVROMX,SOLVEX,SKIPX                        
         REF      P:POOL                                                        
         REF      P:GRAN                                                        
         REF      T:FBA,T:LBA,T:BDP                                             
         REF      T:NBE                                                         
         REF      T:PL                                                         8
         REF      V:CCTYPE                                                      
         REF      V:TOTSIZ                                                      
         REF      LBA:ROM,BAP:ROM                                               
         REF      PT:WTGR                                                       
         REF      FBA:OVLO                                                      
         REF      LBA:OVLO                                                      
         REF      V:DECLNO                                                      
         REF      RAX,SERCHFWD                                                  
         REF      SERCHDCB                                                      
         REF      TBENTRY                                                       
         REF      XBC                                                           
         REF      4BYTES                                                        
         REF      LOADERR                                                       
         REF      WORD,WRITEXN                                                  
         REF      LOADSEG                                                       
         REF      FWA:ASSN,LWA:ASSN,WDP:ASSN                                    
         REF      FL:PAS2                                                       
         REF      V:MASK                                                        
         REF      X:3,X:7,X:F,X:FFFF,X:1FFFF,X:7FFFF                       101  
         REF      V:MSECB,V:MRECB,V:MENQ,V:NUSG,V:NPLSG                         
         REF      FBA:COMN,FBA:RTMP,LBA:ROO1                                    
         REF      FL:STM,FL:CRIT,FL:PRIM,FL:RTMP                                
         REF      S:FMSK,S:IMSK,S:MMSK,S:SMSK,S:PMSK                            
         REF      FL:SMM                                                        
         REF      BOUNDRP                                                       
         REF      X:1FF                                                         
         REF      GIOOBIT,GIODBIT,GIOFBIT,GIOABIT,GIOFA,GIOBITS                 
         REF      X:FFF                                                         
         REF      FPT:ASN,FPT:GASN,FPT:COR,FPT:REW,FPT:PACK                     
         REF      FPT:OPEN,FPT:CLS                                              
         REF      PT:OPEN,PT:CLS                                                
         REF      B:OPLBNM,B:DEVNM,B:DEVX,B:DEVCON,B:ERRCC                      
         REF      NXTROM,GIOCT                                                  
         REF      FPT:ROM1                                                      
         REF      EBL:ROO2                                                      
         REF      GRN:ROO2                                                      
         REF      LML:ROO2                                                      
         REF      FLG:ROO2                                                      
         TITLE    '****  PROCEDURES  ****'                                      
*                                                                               
*                                                                               
*        PUSH,PULL  PROCEDURE                                                   
*                                                                               
*                                                                               
PUSH     CNAME    1                                                             
PULL     CNAME    0                                                             
         PROC                                                                   
         DO       (AF(2)=0)|(AF(2)=AF(1))                                       
LF       GEN,8,4,3,17  X'88'+NAME,AF(1),0,PCBPOINT SINGLE FIELD IN AF(1)        
         ELSE                                                                   
         DO       AF(2)>AF(1)       EG PUSH 9,11                                
LF       LCFI     (AF(2)-AF(1)+1)&X'F'                                          
         ELSE                       EG PUSH 11,7  (IE 11-15,0-7)                
LF       LCFI     (16-AF(1)+AF(2)+1)&X'F'         WRAPAROUND                    
         FIN                                                                    
         GEN,8,4,3,17  X'8A'+NAME,AF(1),0,PCBPOINT                              
         FIN                                                                    
         PEND                                                                   
*                                                                               
*                                                                               
*        BUILD DCB PROC             USE  SET FUNCTION TO GIVE VALUES            
*                                   TO PARAMETERS COUCHED IN                    
*                                   RBM DCB DESCRIPTION MNEMONICS.              
*                                                                               
*                                   BUILDS M:,F: DEFAULT DCBS.                  
*                                                                               
BUILDDCB CNAME                                                                  
         PROC                                                                   
         BOUND    4                                                             
LF       GEN,8,3,4,3,2,3,1,4,4  TTL,OPEN,MOD,0,BUSY,PACK,VFC,BTD,ASN            
         GEN,8,7,2,7,8          NRT,0,DEVF,TYPE,DOR                             
         GEN,8,7,17             NRA,TYC,BUF                                     
         GEN,15,17              RSZ,ERA                                         
         GEN,15,17              ARS,ABA                                         
         DO       AF(1)=0                                                       
         DATA     0,0               DEVICE                                      
         ELSE                                                                   
         TEXT     AF(1)             OP LABEL OR FILE NAME                       
         TEXT     '    '                                                        
         FIN                                                                    
         DATA     0,0,0,0           OPTIONAL WORDS UNUSED                       
         PEND                                                                   
         TITLE    '****  SUBROUTINE CALLS  ****'                                
*                                                                               
*                                                                               
BAL      EQU      X'6A'                                                         
*                                                                               
*                                                                               
ASSNDCB  COM,8,4,3,17    BAL,12,0,ASSNDCB                                  101  
BOUNDRDW COM,8,4,3,17  BAL,15,0,BOUNDRDW                                        
         DO       #MAP~=0                                                       
BOUNDRP  COM,8,4,3,17  X'6A',15,0,BOUNDRP                                       
         FIN      #MAP~=0                                                       
CONVROMX COM,8,4,3,17  BAL,13,0,CONVROMX                                        
ENDSEG   COM,8,4,3,17 BAL,13,0,ENDSEG                                           
EXPRESSN COM,8,4,3,17 BAL,12,0,EXPRESSN                                         
GALL     COM,8,4,3,17 BAL,15,0,GALL                                     22      
GETADR   COM,8,4,3,17  BAL,13,0,GETADR                                          
LDROM    COM,8,4,3,17  BAL,15,0,LDROM                                           
LOADERR  COM,8,4,3,17  BAL,15,0,LOADERR                                         
WRITEXN  COM,8,4,3,17  BAL,15,0,WRITEXN                                         
WORD     COM,8,4,3,17  BAL,15,0,WORD                                            
LOADSEG  COM,8,4,3,17  BAL,15,0,LOADSEG                                         
MOVBYTS  COM,8,4,3,17  BAL,15,0,MOVBYTS                                         
MOVGRAN  COM,8,4,3,17  BAL,14,0,MOVGRAN                                         
RAX      COM,8,4,3,17 BAL,12,0,RAX                                              
RABORT   COM,8,4,3,17  BAL,14,0,RABORT                                    16    
READGRAN COM,8,4,3,17  BAL,14,0,READGRAN                                        
READXN   COM,8,4,3,17  BAL,15,0,READXN                                          
REAWA    COM,8,4,3,17  BAL,13,0,REAWA                                           
REORGWA  COM,8,4,3,17  BAL,13,0,REORGWA                                         
RDIAG    COM,8,4,3,17  BAL,15,0,RDIAG                                           
ROMBYTE  COM,8,4,3,17  BAL,15,0,ROMBYTE                                         
ROMBYTES COM,8,4,3,17  BAL,14,0,ROMBYTES                                        
SERCHDCB COM,8,4,3,17  BAL,14,0,SERCHDCB                                        
SERCHFWD COM,8,4,3,17  BAL,14,0,SERCHFWD                                        
SKIPX    COM,8,4,3,17  BAL,13,0,SKIPX                                           
SOLVEX   COM,8,4,3,17  BAL,13,0,SOLVEX                                          
STORBITS COM,8,4,3,17  BAL,13,0,STORBITS                                        
STORNBYT COM,8,4,3,17  BAL,12,0,STORNBYT                                        
WRITGRAN COM,8,4,3,17  BAL,14,0,WRITGRAN                                        
ZEROGRAN COM,8,4,3,17  BAL,15,0,ZEROGRAN                                        
TBENTRY  COM,8,4,3,17  BAL,15,0,TBENTRY                                         
XBC      COM,8,4,3,17 BAL,15,0,XBC                                              
4BYTES   COM,8,4,3,17  BAL,15,0,4BYTES                                          
         TITLE    '****  EQUATES  ****'                                         
SAVE%    SET      %                                                             
         ASECT                                                                  
         ORG      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                                                           
R8       EQU      %+8                                                           
R9       EQU      %+9                                                           
R10      EQU      %+10                                                          
R11      EQU      %+11                                                          
R12      EQU      %+12                                                          
R13      EQU      %+13                                                          
R14      EQU      %+14                                                          
R15      EQU      %+15                                                          
         USECT    SAVE%                                                         
K:MASTD  EQU      X'14A'            PTR TO START OF MASTER DICTIONARY           
K:RFT4   EQU      X'17A'            RAD FILE ENTRY 4                            
*                                   GRANULE SIZE                                
K:RFT5   EQU      X'17B'            PTR TO RFT5 (RSIZE)                         
RIGHT    EQU      -1                                                            
LEFT     EQU      1                 SHIFT                                       
D        EQU      X'20'                                                         
E        EQU      1**(31-14)        BIT 14                                      
R        EQU      1**(31-13)        BIT 13                                      
CF       EQU      4                 DECL/FWD INDICATOR                          
V        EQU      X'10'                                                         
C        EQU      X'08'                                                         
TY       EQU      X'C0'                                                         
SREF     EQU      X'80'             SECONDARY REF                               
PUBLIB   EQU      3                                                             
DCBSIZE  EQU      11                DCB SIZE                                    
PCBPOINT EQU      X'4E'             MONITOR POINTER TO CURRENT PCB              
NBEOVLO  EQU      44                NO BYTES IN OVLOAD TABLE ENTRY              
:ASSIGN  EQU      12                V:CCTYPE VALUE FOR ASSIGN                   
:LMHDR   EQU      14                                                            
NWE:ASSN EQU      10                10 WDS PER ENTRY IN T:ASSN                  
W        EQU      1**(31-12)                                                    
G        EQU      X'00040000'       G BIT IN T:MODULE WORD 0                    
Q        EQU      8                 LOAD RELOCATABLE Q BIT                      
IN       EQU      1                 INPUT DEVICE                                
OUT      EQU      2                 OUTPUT DEVICE                               
INOUT    EQU      3                 BOTH                                        
SEG:CCI  EQU      1                 CCI IS OVERLAY 1                            
SEG:MAP  EQU      4                 MAP OVERLAY NUMBER.                         
B:D      EQU      B:X+9             DATA FOR DEFINE FLD                         
B:M      EQU      B:X+18            MASKS FOR DEFINE FLD                        
*LOAD MODULE HEADER FLAG BITS                                                   
H:FSET   EQU      X'80'             FORE/BACK                                   
H:SSET   EQU      X'40'             SIMPLIFIED MEMORY MANAGEMENT                
H:RSET   EQU      X'20'             RESTRICT TO SECONDARY TASK MEM              
H:LSET   EQU      X'10'             PUBLIB                                      
H:PSHIFT EQU      LEFT*2            PRIMARY/SECONDARY                           
H:CSET   EQU      2                 CRITICAL TASK                               
*LMHDR FIELDS                                                                   
H:FLAGS  EQU      0                 BD OF FLAG BYTE                             
H:FWA    EQU      0                 WD OF TASK FWA                              
H:LWA    EQU      1                 WD OF TASK LWA                              
H:MSECB  EQU      4                 BD OF MAX SOLICITED ECBS                    
H:ENTRY  EQU      2                 WD OF ROOT ENTRY                            
H:MRECB  EQU      8                 BD OF MAX RESPONSIBLE ECBS                  
H:MLR1   EQU      3                 WD OF MEMORY LENGTH OF ROOT1                
H:MENQ   EQU      12                BD OF MAX ENQUEUES                          
H:MAR1   EQU      4                 WD OF ADDRESS OF ROOT1                      
H:NSEGS  EQU      16                BD OF NUMBER OF SEGMENTS                    
H:LLR1   EQU      5                 WD OF LOAD MODULE LENGTH OF ROOT1           
H:MLR2   EQU      6                 WD  OF MEM LENGTH OF ROOT2                  
H:MAR2   EQU      7                 WD OF MEM ADDRESS OF ROOT2                  
H:LLR2   EQU      8                 WD OF LM LENGTH OF ROOT2                    
H:LAR2   EQU      9                 WD OF LM ADDRESS OF ROOT2                   
H:LLSYM  EQU      10                WD OF LM LENGTH OF T:SYMBOL                 
H:RTS1   EQU      12                WD OF RBM TEMP STACK SPD WORD 1             
H:RTS2   EQU      13                WD OF RBM TEMP STACK SPD WORD 2             
H:LASYM  EQU      11                WD OF LM ADDRESS OF T:SYMBOL                
H:LLVAL  EQU      12                WD OF LM LENGHT OF T:VALUE                  
H:LAVAL  EQU      13                WD OF LM ADDRESS OF T:VALUE                 
H:PLTAB  EQU      14                START OF PUBLIB NAME TABLE                  
*T:SEG FIELDS                                                                   
S:LL     EQU      9                 WD OF LOAD MODULE LENGTH OF SEG             
S:MA     EQU      12                HWD OF SEGMENT START ADDRESS                
S:ML     EQU      13                HWD OF SEGMENT MEMORY LENGTH                
S:ENTRY  EQU      7                 WD OF ROOT ENTRY                            
S:VALBL  EQU      7                 HWD OF BL OF T:VALUE                        
S:SYMBL  EQU      9                 HWD OF BL OF T:SYMBOL                       
S:SYMGN  EQU      4                 HWD TO GRAN NR OF T:SYMBOL IN X5            
S:LA     EQU      5                 HWD OF LM ADDRESS OF SEG                    
S:FLAGS  EQU      7                 W INDEX TO FLAG FIELD                       
*        SHIFTS FROM RJ TO NATURAL POSITION IN T:SEG FLAG WORD                  
S:FSHIFT EQU      28                FIXED REAL MEMORY FLAG SHIFT                
S:ISHIFT EQU      27                INITIAL LOAD FLAG SHIFT                     
S:MSHIFT EQU      25                MEM ACCESS PROT CODE SHIFT                  
S:SSHIFT EQU      23                SHARABILITY CODE SHIFT                      
S:PSHIFT EQU      22                PRELOADED SHARABLE SEG FLAG SHIFT           
*        SHIFTS FROM RJ TO NATURAL POSITION IN OVLOAD FLAG BYTE                 
O:SSHIFT EQU      2                 SHARABILITY CODE                            
O:MSHIFT EQU      6                 MEMORY ACCESS PROTECTION CODE               
O:ISHIFT EQU      1                 INITIAL LOAD                                
O:FSHIFT EQU      0                 FIXED REAL MEMORY                           
O:PSHIFT EQU      4                 PRELOADED SHARABLE SEGMENT                  
PLESIZE  EQU      16                T:PL ENTRY SIZE                             
PLSIZE   EQU      5*PLESIZE+1       T:PL SIZE IN WORDS:                         
*                                   ENTRY SIZE TIMES MAX NR ENTRIES             
*                                   PLUS ONE WORD TO ALLOW ZERO                 
*                                   WORD AT END OF TABLE                        
*        T:PL ENTRY ITEM INDICES                                                
PLSYMBL  EQU      10                WORD INDEX TO T:SYMBOL BL                   
PLSYMGO  EQU      11                WORD INDEX TO T:SYMBOL GRAN ORIGIN          
PLVALBL  EQU      12                WORD INDEX TO T:VALUE BL                    
PLVALGO  EQU      13                WORD INDEX TO T:VALUE GRAN ORIGIN           
PLNSEGS  EQU      24                BYTE INDEX TO NR OF SEGS IN PUBLIB          
         TITLE    ' **** DYNAMIC TABLE AREA POINTERS ****'                      
*                                                                               
*                       *THE FOLLOWING TABLES AREAS ARE DYNAMICALLY             
*                        ALLOCATED (DURING PASSONE) AND ARE LOCATED             
*                        BETWEEN THE END OF THE LOGEST OVERLAY                  
*                        (K:PEND) AND THE END OF BACKGROUND (K:BACKEND).        
*                       *THE EQUATED VALUES ARE INDICES INTO T:FBA,             
*                        T:LBA,T:NBE,AND T:BZA.                                 
*                                                                               
T:PUBVAL EQU      1      PUBLIC LIBRARY DEF VALUE TABLE                         
*                            *5 BYTES PER ENTRY                                 
*                            *ENTRIES PARALLEL TO T:PUBSYM ENTRIES              
*                                                                               
*                                                                               
T:PUBSYM EQU      2      PUBLIC LIBRARY DEF EBCDIC NAME TABLE                   
*                            *VARIABLE SIZED ENTRIES                            
*                            *ENTRIES PARALLEL TO T:PUBVAL ENTRIES              
*                                                                               
*                                                                               
*                                                                               
T:VALUE  EQU      3     *PROGRAM SYMBOL TABLE VALUES (ADDR,CONSTANT,OR E        
*                        (SYMBOL TABLE HAS DEFS,DSECTS,AND FORWARD REFS)        
*                            *5 BYTES PER ENTRY                                 
*                            *ENTRIES PARALLEL TO T:SYMBOL                      
*                                                                               
*                                                                               
T:SEG    EQU      4      SEGMENT INFORMATION TABLE                              
*                            *9 WORDS PER ENTRY                                 
*                            *ONE ENTRY PER SEGMENT                             
*                                                                               
T:DCBV   EQU      5      TABLE OF VARIABLE DCB'S                                
*                            *7 WORDS PER ENTRY                                 
*                            *ONE DCB FOR EACH DISTINCT RAD FILE                
*                             SPECIFIED FOR ROM INPUT                           
*                                                                               
T:DCB    EQU      6     *TABLE OF SYSTEM (M:) AND USER (F:) DCB                 
*                        DEF'S AND  REF'S                                       
*                            *3 WORDS PER ENTRY                                 
*                                                                               
T:ROMI   EQU      7     *ROM INPUT INFORMATION TABLE;CONTAINS THE               
*                        NUMBER OF ROM'S TO INPUT AND THE INPUT SOURCE.         
*                        (TABLE ONLY EXIST DURING PASSONE)                      
*                            *1 WORD PER ENTRY                                  
*                                                                               
T:MODIFY EQU      8     *TABLE OF CORE IMAGE MODIFICATIONS FOR THE              
*                        SEGMENT                                                
*                            *VARIABLE SIZED ENTRIES                            
*                                                                               
T:MODULE EQU      9      MODULE INFORMATION TABLE                               
*                            *5 WORDS PER ENTRY                                 
*                            *ONE ENTRY PER MODULE                              
*                                                                               
B:MT     EQU      10    *MODULE TABLES BUFFER FOR T:DECL,T:CSECT,T:FWD          
*                        AND T:FWDX; BUFFER OUTPUT EITHER AT THE END            
*                        OF THE SEGMENT OR WHEN THE BUFFER IS FULL.             
*                                                                               
T:DECL   EQU      11    *MODULE DECLARATION TABLE; EACH DECLARATION             
*                        ENTRY POINTS TO AN ENTRY IN (1) T:DCB,                 
*                        (2) T:SYMBOL/T:VALUE,(3) T:CSECT, OR                   
*                        (4) T:PUBSYM/T:PUBVAL                                  
*                            *2 BYTES PER ENTRY                                 
*                                                                               
T:CSECT  EQU      12    *CONTROL SECTION TABLE; EACH ENTRY CONTAINS             
*                        SIZE AND ALLOCATED ADDRESS.                            
*                            *2 WORDS PER ENTRY                                 
*                                                                               
T:FWD    EQU      13    *FORWARD TABLE; EACH ENTRY CONTAINS A FORWARD           
*                        NUMBER AND IT'S CORRESPONDING VALUE. A VALUE           
*                        CAN BE AN ADDR, CONSTANT, OR AN EXPRESSION.            
*                            *2 WORDS PER ENTRY                                 
T:FWDX   EQU      14     FORWARD EXPRESSION TABLE                               
*                            *VARIABLE SIZED ENTRIES                            
*                                                                               
T:SYMBOL EQU      15    *PROGRAM SYMBOL TABLE EBCDIC NAMES AND DSECT            
*                        SIZES; ENTRIES PARALLEL TO T:VALUE ENTRIES             
*                            *VARIABLE SIZED ENTRIES                            
*                                                                               
T:VALX   EQU      16    *T:VALUE EXPRESSION TABLE; BACKWARD TABLE               
*                        WITH FORWARD ENTRIES,BUILT FROM K:BACKEND              
*                            *VARIABLE SIZED ENTRIES                            
FBA:PUBV EQU      T:FBA+T:PUBVAL                                                
FBA:PUBS EQU      T:FBA+T:PUBSYM                                                
FBA:VALU EQU      T:FBA+T:VALUE                                                 
FBA:SEG  EQU      T:FBA+T:SEG                                                   
FBA:DCBV EQU      T:FBA+T:DCBV                                                  
FBA:DCB  EQU      T:FBA+T:DCB                                                   
FBA:ROMI EQU      T:FBA+T:ROMI                                                  
FBA:MODF EQU      T:FBA+T:MODIFY                                                
FBA:MODL EQU      T:FBA+T:MODULE                                                
FBA:MTB  EQU      T:FBA+B:MT                                                    
FBA:DECL EQU      T:FBA+T:DECL                                                  
FBA:CSEC EQU      T:FBA+T:CSECT                                                 
FBA:FWD  EQU      T:FBA+T:FWD                                                   
FBA:FWDX EQU      T:FBA+T:FWDX                                                  
FBA:SYM  EQU      T:FBA+T:SYMBOL                                                
FBA:VALX EQU      T:FBA+T:VALX                                                  
BDP:PUBV EQU      T:BDP+T:PUBVAL                                                
BDP:PUBS EQU      T:BDP+T:PUBSYM                                                
BDP:VALU EQU      T:BDP+T:VALUE                                                 
BDP:SEG  EQU      T:BDP+T:SEG                                                   
BDP:DCBV EQU      T:BDP+T:DCBV                                                  
BDP:DCB  EQU      T:BDP+T:DCB                                                   
BDP:ROMI EQU      T:BDP+T:ROMI                                                  
BDP:MODF EQU      T:BDP+T:MODIFY                                                
BDP:MODL EQU      T:BDP+T:MODULE                                                
BDP:MTB  EQU      T:BDP+B:MT                                                    
BDP:DECL EQU      T:BDP+T:DECL                                                  
BDP:CSEC EQU      T:BDP+T:CSECT                                                 
BDP:FWD  EQU      T:BDP+T:FWD                                                   
BDP:FWDX EQU      T:BDP+T:FWDX                                                  
BDP:SYM  EQU      T:BDP+T:SYMBOL                                                
BAP:VALX EQU      T:BDP+T:VALX                                                  
LBA:PUBV EQU      T:LBA+T:PUBVAL                                                
LBA:PUBS EQU      T:LBA+T:PUBSYM                                                
LBA:VALU EQU      T:LBA+T:VALUE                                                 
LBA:SEG  EQU      T:LBA+T:SEG                                                   
LBA:DCBV EQU      T:LBA+T:DCBV                                                  
LBA:DCB  EQU      T:LBA+T:DCB                                                   
LBA:ROMI EQU      T:LBA+T:ROMI                                                  
LBA:MODF EQU      T:LBA+T:MODIFY                                                
LBA:MODL EQU      T:LBA+T:MODULE                                                
LBA:MTB  EQU      T:LBA+B:MT                                                    
LBA:DECL EQU      T:LBA+T:DECL                                                  
LBA:CSEC EQU      T:LBA+T:CSECT                                                 
LBA:FWD  EQU      T:LBA+T:FWD                                                   
LBA:FWDX EQU      T:LBA+T:FWDX                                                  
LBA:SYM  EQU      T:LBA+T:SYMBOL                                                
LBA:VALX EQU      T:LBA+T:VALX                                                  
NBE:PUBV EQU      T:NBE+T:PUBVAL                                                
NBE:PUBS EQU      T:NBE+T:PUBSYM                                                
NBE:VALU EQU      T:NBE+T:VALUE                                                 
NBE:SEG  EQU      T:NBE+T:SEG                                                   
NBE:DCBV EQU      T:NBE+T:DCBV                                                  
NBE:DCB  EQU      T:NBE+T:DCB                                                   
NBE:ROMI EQU      T:NBE+T:ROMI                                                  
NBE:MODF EQU      T:NBE+T:MODIFY                                                
NBE:MODL EQU      T:NBE+T:MODULE                                                
NBE:MTB  EQU      T:NBE+B:MT                                                    
NBE:DECL EQU      T:NBE+T:DECL                                                  
NBE:CSEC EQU      T:NBE+T:CSECT                                                 
NBE:FWD  EQU      T:NBE+T:FWD                                                   
NBE:FWDX EQU      T:NBE+T:FWDX                                                  
NBE:SYM  EQU      T:NBE+T:SYMBOL                                                
NBE:VALX EQU      T:NBE+T:VALX                                                  
         TITLE    '****  DIAGNOSTIC EQUS  ****'                                 
*                        *DIAGNOSTICS                                           
CCITEM   EQU      1           CC ERR:ITEM XX                                    
OCCITEM  EQU      2           CC ERR:ITEM XX  (OLOAD)                           
OCCFITEM EQU      4           CC ERR:FOLLOWING ITEM XX (OLOAD)                  
CCFITEM  EQU      3           CC ERR:FOLLOWING ITEM XX                          
CCORDER  EQU      5           CC ERR:ILLEGAL ORDER                              
CCIDENT  EQU      6           CC ERR:SEG IDENT NOT 1ST OPTION                   
CCDUPNAM EQU      7           CC ERR:DUP NAME IN ITEM XX                        
CCSEGORD EQU      8           CC ERR:SEG'S ORDERED INCORRECTLY                  
CCDUPSEG EQU      9           CC ERR:DUP SEG IDENT                              
CCUNDSEG EQU      10          CC ERR:SEG IDENT UNRECOGNIZED                     
CCUNDSYM EQU      11          CC ERR:UNDEFINED SYMBOL IN ITEM XX                
OCCFORE  EQU      12          CC ERR:NEED (FORE,FWA,LWA) OPT FOR PUBLIB         
OCCTEMP  EQU      13          CC ERR:ILLEGAL OPT FOR PUBLIB (TEMP,VAL)          
OCCLINKS EQU      14          CC ERR:ILLEGAL OPT FOR PUBLIB (GO,LINKS)          
OCCTASKS EQU      15          CC ERR:ILLEGAL OPT FOR PUBLIB (TASKS,VAL)         
OCCPUBL  EQU      16          CC ERR:ILLEGAL OPT FOR PUBLIB (PUBL,NAME)         
CHKSUM   EQU      17          ROM ERR:CHKSUM                                    
SEQERR   EQU      18          ROM ERR:BAD SEQ                                   
LOADITEM EQU      19          ROM ERR:ILL LOAD ITEM                             
OBJFORMT EQU      20          ROM ERR:NOT OBJ LANGUAGE                          
NOTSTBIN EQU      21          ROM ERR:NOT STANDARD BIN                          
NOMODEND EQU      22          ROM ERR:NO MODULE END                             
TEXOFLO  EQU      23          ROM ERR:EXPRESSION SIZE EXCEEDS MAX               
RFUND    EQU      24          CC ERR:UNDEFINED FILE                             
RFUND2   EQU      25          CC ERR:UNDEFINED FILE                             
EOFONCC  EQU      26          UNEXPECTED MONITOR CC ON TTYDD                    
ILLEOD   EQU      27          UNEXPECTED EOD ON DEVICE/FILE                     
ILLEOD2  EQU      28          UNEXPECTED EOD ON DEVICE/FILE                     
BOTERR   EQU      29          BOT ON DEVICE/FILE                                
EOTERR   EQU      30          EOT ON DEVICE/FILE                                
EOTERR2  EQU      31          EOT ON DEVICE/FILE                                
IRRECRD  EQU      32          UNRECOVERABLE RD ERR ON DEVICE/FILE               
IRRECWR  EQU      33          UNRECOVERABLE WR ERR ON DEVICE/FILE               
TINYBUFF EQU      34          BUF SMALLAR THAN DATA RECD                        
RONGDCB  EQU      35          DCB HAS BAD PARAMETERS                            
NORADFIL EQU      36          UNDEFINED FILE AA,XXXXXXXX (IN DCB)               
DCBNODEV EQU      37          DCB NOT ASSIGNED                                  
READOUTP EQU      38          READING AN OUTPUT DEVICE                          
WRITEINP EQU      39          WRITING ON INPUT DEVICE                           
NOOPDCBW EQU      40          DCB HAS INSUFFICIENT INFO                         
NOOPDCBR EQU      41          DCB HAS INSUFFICIENT INFO                         
PROGERR  EQU      42          PROGRAM ERROR,OLAY,ADDR XXXXX                     
DCBCLOSE EQU      43          PROGRAM ERROR,OLAY,SB=XX,ADDR XXXXX               
DCBOPEN  EQU      44          PROGRAM ERROR,OLAY,SB=XX,ADDR XXXXX               
NONREAL  EQU      45          PROGRAM ERROR,OLAY,SB=XX,ADDR XXXXX               
INVBUFF  EQU      46          PROGRAM ERROR,OLAY,SB=XX,ADDR XXXXX               
REREADCC EQU      47          PROGRAM ERROR,OLAY,SB=XX,ADDR XXXXX               
ILLDCB   EQU      48          WARNING:ILL DCB NAME                              
ILLDCB2  EQU      49          WARNING:DCB IN OVERLAY SEG                        
LCOMSIZE EQU      50          LCOM XXX OF SIZE XX GR. THAN ALLOCATED            
DCBADR   EQU      51          WARNING:ILL DCB ADDR                              
PUBLIB5  EQU      52          DSECT'S IN PUBLIB LOAD                            
PLENGTH  EQU      53          BIAS TOO LARGE                                    
BACKSIZE EQU      54          BACKGROUND TOO SMALL                              
TABOFLO  EQU      55          BACKGROUND TOO SMALL                              
MOUNTPT  EQU      56          MOUNT PAPER TAPE ROM                              
FULLRFT  EQU      57          RAD FILE TABLE FULL                               
RADWP    EQU      58          TTYDD WRT PROT                                    
UPREF    EQU      59          WARNING:UNSATISFIED REF'S                         
DUPLDEFS EQU      60          WARNING:DUPLICATE DEF'S                           
UNDEFDEF EQU      61          WARNING:UNDEFINED DEF'S                           
UNDEFORG EQU      62          UNDEFINED ORIGIN                                  
ILLORG   EQU      63          ILLEGAL ORIGIN XXXXX                              
FLDOFLO  EQU      64          WARNING:FIELD OVERFLOW AT ADDR XXXXX              
NOSTART  EQU      65          WARNING:NO START ADDR FOR ROOT                    
SEGGT8K  EQU      66          WARNING: SEGMENT GREATER THAN 8K            20    
ABORT    EQU      67          FILE DESTROYED AA,FFFFFFFF                        
ABORT2   EQU      68          FILE UNCHANGED AA,FFFFFFFF                        
EXCLIM   EQU      69          WARNING:PROGRAM EXCEEDS SPEC ADDR LIMITS          
UNDEFRLC EQU      70          PROGRAM ERROR:UNALLOCATED CONTROL SECT            
UNDEFDCB EQU      71          WARNING:UNALLOCATED DEFID DCB                     
OCCAREA  EQU      72          CC ERR:SPECIFIED AREA FOR PUBLIB NOT 'FP'         
UNDEFST  EQU      73          WARNING:UNDEFINED START ADDR                      
ILLSTRT  EQU      74          WARNING:START ADDR XXXXX OUTSIDE SEGMENT          
DEFALTST EQU      76          DEFAULT START ADDRESS XXXXX FOR ROOT      21      
INITLCOM EQU      85          INITIALIZING LABELLED COMMON OUTSIDE SEG          
DCBSMALL EQU      89                WARNING:  DCB XXXXXXXX TOO SMALL ...        
ILLOVRSZ EQU      94                OV FILE RSIZE .NE. GSIZE                    
         TITLE    '****  LABELS IN ROOT P:POOL  ****'                           
NUMDCBS  EQU      P:POOL+0                                                 15   
FBAEXEC  EQU      P:POOL+1                                                      
LBAEXEC  EQU      P:POOL+2                                                      
FWAGRAN  EQU      P:POOL+3                                                      
LWAGRAN  EQU      P:POOL+4                                                      
NWEGRAN  EQU      P:POOL+5                                                      
ENDRET   EQU      P:POOL+6                                                 101  
FWAWA    EQU      P:POOL+7                                                      
NBTRWA   EQU      P:POOL+8                                                      
ROMEXIT  EQU      P:POOL+9                                                      
CBYTE    EQU      P:POOL+10                                                     
REPRET   EQU      P:POOL+11                                                     
BAPEXEC  EQU      P:POOL+12                                                     
RETURN   EQU      P:POOL+13         SHARED BAL REGISTER STORAGE                 
LOARET   EQU      RETURN                                                        
LNBRET   EQU      RETURN                                                        
DECRET   EQU      RETURN                                                        
ORIRET   EQU      RETURN                                                        
DEFRET   EQU      RETURN                                                        
FORRET   EQU      RETURN                                                        
DECDRET  EQU      RETURN                                                        
XDEFRET  EQU      RETURN                                                        
DECLSRET EQU      RETURN                                                        
DECLNRET EQU      RETURN                                                        
STARET   EQU      RETURN                                                        
DEBUGRET EQU      RETURN                                                   15   
BLDR2RET EQU      RETURN                                                        
NBEGRAN  EQU      P:POOL+14                                                     
BYTDISSG EQU      P:POOL+15                                                     
BITSIZFD EQU      P:POOL+16                                                     
BYTSIZFD EQU      P:POOL+17                                                     
BITDISFD EQU      P:POOL+18                                                     
SVPGRAN  EQU      P:POOL+19                                                     
BITOFFST EQU      P:POOL+20                                                     
BYTDISGR EQU      P:POOL+21                                                     
MSLADD   EQU      P:POOL+22                                                     
UNUSED1  EQU      P:POOL+23         UNUSED                                      
PRLDFLAG EQU      P:POOL+24         PRELOADED SHARABLE SEG                      
VALUGRAN EQU      P:POOL+25                                                     
REPTCNT  EQU      P:POOL+26                                                     
REPTFLAG EQU      P:POOL+27                                                15   
NUMBYTS  EQU      P:POOL+28                                                15   
BAPBYT   EQU      P:POOL+29                                                15   
LIMIT    EQU      P:POOL+30                                                     
FLMODIFY EQU      P:POOL+31                                                     
B:REPEAT EQU      P:POOL+32         A SIX WORD BUFFER FOR REPEAT ITEMS     101  
NEXTCELL EQU      P:POOL+38                                                101  
         BOUND    4                                                             
OLAYTWO  RES      0                                                             
         TITLE    '****  DATA AND EBCDIC CONSTANTS ****'                        
X:3F     DATA     X'3F'                                                         
X:FC     DATA     X'FC'                                                         
X:7FFF8  DATA     X'7FFF8'                                                      
X:1FFFE  DATA     X'1FFFE'                                                      
X:FF     DATA     X'FF'                                                         
X:7FFFC  DATA     X'7FFFC'                                                      
D:8      DATA     8                                                             
Y:10     DATA     X'10000000'                                                  8
Y:11     DATA     X'11000000'                                              15   
Y:15     DATA     X'15000000'                                                   
X:7F     DATA     X'7F'                                                         
Y:C      DATA     X'C0000000'                                                   
Y:FFFE   DATA     X'FFFE0000'                                                   
PREF     DATA     X'C0'                                                         
FL:ADRER DATA     0                 1= ERROR IN GETADR SUBR/SIG7-3766/*C5733    
*                                   0= NO ERROR            /SIG7-3766/*C5733    
MSLSYM   GEN,8,32,24  5,'M:SL',0    M:SL NAME IN T:SYM FORMAT                   
         TITLE    '****  PASSTWO - MAIN PROGRAM  ****'                          
         BOUND    4                                                        15   
PASSTWO  RES      0                                                             
*                                                                               
*                 REWIND GO,X1 IS IMPLICIT IN FIRST READ,SINCE                  
*                 PASS ONE  CLOSES THEM.                                        
*                                                                               
         PAGE                                                                   
*                                                                               
*                 MOVE T:SEG,T:DCBV,T:DCB STARTING AT FBA:PUBS (DA)             
*                 AND SET  FBA,LBA POINTERS THESE  TABLES.                      
*                                                                               
         LW,R5    FL:PAS2                                                       
         BNEZ     ASSNRET                                                  101  
         LI,R5    40                                                            
         LI,R6    0                                                             
         STW,R6   P:POOL-1,R5       ZERO P:POOL AREA                            
         BDR,R5   %-1                                                           
         LW,R5    FBA:SEG                                                  101  
         LW,R6    FBA:PUBS                                                      
         LW,R8    LBA:SEG            BYTE LENGTH                                
         SW,R8    R5                                                            
         MOVBYTS                    MOVE  T:SEG                                 
         STW,R6   FBA:SEG                                                       
         AW,R6    R8                BYTE LENGTH                                 
         STW,R6   LBA:SEG                                                       
         BOUNDRDW                                                               
PTWO1    LW,R5    FBA:DCBV                                                      
         LW,R8    LBA:DCBV                                                      
         SW,R8    R5                BYTE LENGTH  T:DCBV                         
         MOVBYTS                                                                
         STW,R6   FBA:DCBV          NEW FBA                                     
         AW,R6    R8                                                            
         STW,R6   LBA:DCBV                                                      
         BOUNDRDW                                                               
PTWO21   LW,R5    FBA:DCB           MOVE  T:DCB                                 
         LW,R8    LBA:DCB                                                       
         SW,R8    R5                BYTE LENGTH                                 
         MOVBYTS                                                                
         STW,R6   FBA:DCB           NEW AREA                                    
         STW,R8   BDP:DCB                                                       
         AW,R6    R8                                                            
PTWO22   STW,R6   LBA:DCB                                                       
         STW,R6   FBA:VALU          SET FOR PUBLIBS                             
         PAGE                                                                   
*                                                                               
*                 OPEN M:OV AND                                                 
*                 GET GRANULE SIZE FROM RFT FOR M:OV.                           
*                                                                               
         LI,R9    0                                                             
         CAL1,1   FPT:CC1           OPENS M:OV                                  
         LW,R7    M:OV+1                                                        
         AND,R7   X:FF              RFT INDEX                                   
         LH,R10   *K:RFT4,R7         GRANULE SIZE IN BYTES.                     
         CH,R10   *K:RFT5,R7                                                    
         BE       PTWO225           B IF RSIZE = GSIZE                          
         LI,R9    ILLOVRSZ          ILLEGAL RSIZE                               
         RDIAG                      WARNING WITH RETURN                         
PTWO225  RES      0                                                             
         AND,R10  X:FFFF                                                        
         STW,R10  NBEGRAN                                                       
         SLS,R10  RIGHT*2           WORD SIZE OF GRANULE                        
         STW,R10  NWEGRAN                                                       
         MTW,0    FL:PUBL                                               21      
         BGZ      PTWO3                                                 21      
         PAGE                                                                   
*                                                                               
*        IF NOT A PUBLIB, ALLOCATE ROOT PART TWO                                
*                                                                               
*                 SET FBA:ROO2 (FBA OF PART2 OF THE ROOT) TO THE                
*                 PAGE OR DW EXTENSION OF THE SPECIFIED ADDRESS,OR              
*                 OF THE HIGHEST SEGMENT END, IF THERE IS NO                    
*                 SPECIFIED ADDRESS                                             
*        COMBINE ROOT2 WITH ROOT1 IF THERE ARE NO SEGS                          
*        AND ROOT2 ORIGIN HAS NOT BEEN SPECIFIED                                
*                                                                               
*                                                                               
         LW,R8    FBA:ROO2          GET ROOT2 ORIGIN                            
         BNEZ     %+2               BRANCH IF SPECIFIED                         
         LW,R8    LBA:PATH          GET HIGHEST END OF SEG                      
         BOUNDRDW                                                               
        DO       #MAP                                                           
         LW,R2    FL:PRIM                                                       
         CI,R2    1                                                             
         BAZ      %+2               B IF NOT SECONDARY                          
         BOUNDRP                    PAGE-BOUND THE ADDRESS                      
        FIN      #MAP                                                           
         LW,R2    R8                                                            
         LW,R9    V:NUSG            NUMBER OF USER SEGS                         
         CI,R9    2                                                             
         BG       PTWO235           BRANCH IF THERE ARE NON-ROOT SEGS           
         MTW,0    FBA:ROO2          TEST ROOT2 ORIGIN SPECIFICATION             
         BNEZ     PTWO235           BRANCH IF SPECIFIED                         
         LW,R2    LBA:ROO1          ROOT2 WILL BE PART OF ROOT1.                
*                                   ORIGIN AT END OF ROOT1                      
         LCW,R5   NBE:SEG           DELETE T:SEG  ENTRY                         
         AWM,R5   LBA:SEG           RESERVED FOR ROOT2                          
         MTW,-1   V:NUSG            AND IN  MEMORY                              
*                                                                               
PTWO235  RES      0                                                             
         STW,R2   FBA:ROO2          SET ROOT2 ORIGIN                            
         PAGE                                                                   
*                                                                               
*        ALLOCATE SPACE FOR OVLOAD TABLE AND ADD M:SL                           
*        DCB IF NEEDED                                                          
*                                                                               
         LW,R9    V:NUSG            GET NR OF USER SEGS                         
         STW,R2   FBA:OVLO          START OF OVLOAD TABLE                       
         DO       #MAP=0                                                        
         AI,R2    4                 ONE WORD FOR NR OF ENTRIES                  
         STW,R2   BAP:ROO2          CURRENT LOAD LOC IN ROOT 2                  
         STW,R2   LBA:OVLO          INITIAL GUESS:  NO ENTRIES                  
         ELSE     #MAP=0                                                        
         MI,R9    NBEOVLO                                                       
         AI,R9    4                 ONE WORD FOR NR OF ENTRIES                  
         AW,R2    R9                                                            
         STW,R2   LBA:OVLO          LBA+1 OF OVLOAD TABLE                       
         STW,R2   BAP:ROO2          CURRENT LOAD LOC IN ROOT 2                  
         LW,R9    V:NUSG            RELOAD NR OF SEGS                           
         FIN      #MAP=0                                                        
         CI,R9    2                                                             
         BLE      PTWO24            B IF NO NON-ROOT SEGS                       
         AI,R9    -2                                                            
         LW,R5    LBA:COMN                                                      
         CW,R5    FBA:COMN                                                      
         BLE      %+3               B IF NON-ROOT SEGS NOT COMMON SEG           
         AI,R9    -1                DISCOUNT COMMON SEG                         
         BEZ      PTWO24            B IF NO OVERLAY SEGS                        
         DO       #MAP=0                                                        
         MI,R9    NBEOVLO           NR ENTRIES TIMES BYTES PER ENTRY            
         AW,R2    R9                                                            
         STW,R2   LBA:OVLO          LBA+1 OF OVLOAD TABLE                       
         STW,R2   BAP:ROO2          CURRENT LOAD LOC IN ROOT 2                  
         FIN      #MAP=0                                                        
         LI,R5    BA(MSLSYM)        NAME FOR M:SL DCB                           
         SERCHDCB                                                               
         CI,R6    0                                                             
         BNE      PTWO24            B IF ALREADY DEFINED                        
         LW,R5    LBA:DCB                                                       
         AI,R5    -1                                                            
         LW,R9    Y:C                                                           
         WORD                                                                   
         LW,R9    MSLDCB                                                        
         WORD                                                                   
         LW,R9    MSLDCB+1                                                      
         WORD                                                                   
         AI,R5    1                 LBA + 1                                     
         STW,R5   LBA:DCB                                                       
         PAGE                                                                   
*                                                                               
*        ALLOCATE SPACE FOR LOADER-PROVIDED DCBS                                
*                                                                               
PTWO24   LW,R4    FBA:DCB                                                       
         LI,R7    0                                                             
         STW,R7   NUMDCBS                                                 20    
PTWO25   CW,R4    LBA:DCB                                                       
         BGE      PTWO265                                                       
         MTW,1    NUMDCBS                                                 20    
         LW,R10   MSLDCB                                                        
         SLS,R4   RIGHT*2           WORD ENTRY IN T:DCB                         
         LB,R12   *R4                                                           
         CW,R12   PREF                                                    16    
         BANZ     PTWO253           USER REFFED DCB                       16    
         CI,R12   D                 USER DEFINED                          16    
         BAZ      PTWO252           NOT DEFINED ALLOCATE LIKE PREF        16    
         CI,R12   V                                                       16    
         BANZ     PTWO26            DEFINED BY USER AND VALUE             16    
PTWO252  LI,R9    UNDEFDCB          ALARM FOR UNDEFINED DCB               16    
         LW,R10   R4                ADDRESS IN DCB TABLE                  16    
         SLS,R10  LEFT*2                                                        
         RDIAG                                                            16    
         B        PTWO255           ALLOCATE ANYWAY                       16    
PTWO253  CW,R10   1,R4                                                    16    
         BNE      %+2               NOT M:SL                                    
         STW,R2   MSLADD                                                        
PTWO255  STW,R2   0,R4              EXECUTION ADDRESS                     16    
         LW,R12   PREF                                                          
         AI,R12   V+D                                                     20    
         STB,R12  *R4               MERGE CONTROL BYTE                    16    
         AI,R2    DCBSIZE*4                                                     
PTWO26   SLS,R4   LEFT*2                                                        
         AW,R4    NBE:DCB                                                       
         B        PTWO25                                                        
PTWO265  LW,R1    FL:UDCB                                                       
         BEZ      PTWO29            NO UNNAMED DCBS                             
         LW,R5    LBA:DCB           P                                           
         AI,R5    -1                                                            
PTWO27   LI,R9    D+V               DEFINED WITH VALUE                          
         AW,R9    PREF                                                          
         SCS,R9   RIGHT*8                                                       
         AW,R9    R2                                                            
         WORD                                                                   
         LW,R9    UDCBNAME                                                      
         WORD                                                                   
         WORD                                                                   
         AI,R2    DCBSIZE*4                                                     
         MTW,1    NUMDCBS                                                 20    
         BDR,R1   PTWO27                                                        
         AI,R5    1                                                             
         STW,R5   LBA:DCB                                                       
*                                                                               
*        ADJUST T:VALUE FOR POSSIBLY EXTENDED T:DCB                             
*                                                                               
PTWO29   LW,R8    LBA:DCB                                                       
         BOUNDRDW                                                               
PTWO295  STW,R8   FBA:VALU                                                      
         STW,R8   LBA:VALU                                                      
         PAGE                                                                   
*                                                                               
*        ALLOCATE DCBTAB                                                        
*                                                                               
         LW,R8    R2                                                            
         BOUNDRDW                                                               
         STW,R8   R2                UPDATE EXLOC                                
         STW,R8   FBA:DCBT                                                      
         LW,R7    NUMDCBS                                                 20    
         MW,R7    NBE:DCB                                                       
         AW,R2    R7                                                            
         AI,R2    4                                                             
         STW,R2   LBA:DCBT                                                      
         PAGE                                                                   
*                                                                               
*        ALLOCATE TEMP STACKS                                                   
*                                                                               
         STW,R2   R8                                                            
         BOUNDRDW                                                               
         STW,R8   R2                                                            
         STW,R2   FBA:TEMP          USER TEMP STACK FBA                         
         LW,R8    FL:TEMP                                                       
         LW,R9    FL:RTMP                                                       
         SLD,R8   LEFT*2                                                        
         AW,R8    R2                                                            
         BOUNDRDW                                                               
         STW,R8   FBA:RTMP          RBM TEMP STACK FBA                          
         AW,R8    R9                                                            
         BOUNDRDW                                                               
         DO       #MAP~=0                                                       
         LW,R9    FL:PRIM                                                       
         CI,R9    1                                                             
         BAZ      %+2               BRANCH IF NOT SECONDARY                     
         BOUNDRP                    PAGE-BOUND SEG END IF SECONDARY             
         FIN      #MAP~=0                                                       
         LW,R9    R8                                                            
         SW,R9    FBA:RTMP                                                      
         SLS,R9   RIGHT*2                                                       
         STW,R9   FL:RTMP           INCLUDE ROUNDING-UPWARD SPACE               
*                                   IN RBM TEMP STACK                           
         STW,R8   LBA:ROO2                                                      
         CW,R8    LBA:PATH                                                      
         BLE      %+2                                                           
         STW,R8   LBA:PATH                                                      
         AI,R8    -1                                                            
         CW,R8    LBA:LIM                                                       
         BLE      %+2               BRANCH IF NOT OUT OF BOUNDS                 
         STW,R8   LIMIT             SET OUT OF BOUNDS FLAG                      
         AI,R8    1                                                             
         SW,R8    FBA:ROO2                                                      
         STW,R8   BL:ROO2                                                       
         PAGE                                                                   
*                                                                               
*                 BUILD T:SEG ENTRY FOR ROOT2, OR ACCOUNT                       
*                 FOR IT IN THE ROOT1 ENTRY                                     
*                                                                               
         LW,R7    V:NUSG                                                        
         CI,R7    1                                                             
         BE       PTWO298           BRANCH IF ROOT1/2 COMBINED                  
*        BUILD SEPARATE T:SEG ENTRY FOR ROOT2                                   
         LW,R7    FBA:SEG           SEPARATE ROOT2. BUILD T:SEG ENTRY           
         AW,R7    NBE:SEG           INDEX THE ENTRY RESERVED                    
         SLS,R7   RIGHT*2           CONVERT TO WA                               
         LI,R6    S:MA                                                          
         LW,R9    FBA:ROO2          GET MEMORY ADDRESS                          
         SLS,R9   RIGHT*3           CONVERT TO DA                               
         STH,R9   *R7,R6            INSERT IN T:SEG                             
         LI,R6    S:ML                                                          
         LW,R8    LBA:ROO2          END OF ROOT2                                
         SLS,R8   RIGHT*3           CONVERT TO DA                               
         SW,R8    R9                SUBTRACT START TO GET LENGTH                
         STH,R8   *R7,R6            INSERT IN T:SEG                             
         SLS,R8   LEFT*3            DL TO BL                                    
         STW,R8   V:TOTSIZ          INCLUDE ROOT2 IN V:TOTSIZ                   
         LW,R8    LBA:DCBT          END OF DCBTAB IS                            
*                                   ALSO END OF ROOT2 LM IMAGE                  
         SLS,R9   LEFT*3            CONVERT DW TO BYTE                          
         SW,R8    R9                SUBTRACT START OF ROOT2 TO GET LTH          
         STW,R8   S:LL,R7           INSERT IN T:SEG                             
         B        PTWO3             DONE BUILDING T:SEG ENTRY                   
*                 MODIFY ROOT1 T:SEG ENTRY TO INCLUDE ROOT2                     
PTWO298  LW,R7    FBA:SEG                                                       
         SLS,R7   RIGHT*2           WORD INDEX TO ROOT1 T:SEG ENTRY             
         LI,R6    S:MA                                                          
         LH,R8    *R7,R6            START OF ROOT2                              
         AND,R8   X:FFFF            ELEIMINATE SIGN EXTENSION                   
         LW,R9    LBA:ROO2          END OF ROOT2                                
         SLS,R9   RIGHT*3           CONVERT TO DA                               
         SW,R9    R8                DW LENGTH OF ROOT1/2                        
         LI,R6    S:ML                                                          
         STH,R9   *R7,R6            REPLACE IN T:SEG                            
         LW,R9    LBA:DCBT          END OF LM IMAGE                             
         SLS,R8   LEFT*3            CONVERT START TO BA                         
         SW,R9    R8                BL OF ROOT1/2 LM IMAGE                      
         STW,R9   S:LL,R7           PLACE IN T:SEG                              
*                                                                               
*                                                                               
*                 ALLOCATIONS FOR PART TWO OF ROOT ARE DONE                     
*                                                                               
*                 BEGIN PROCESSING  ROOT AND SEGMENTS.                          
*                                                                               
PTWO3    LI,R3    0                                                             
         STW,R3   BDP:SEG           FIRST ENTRY OF SEGMENT TABLE.               
         LI,R3    1                 LEAVE 0 FOR SECTOR HEADER                  8
         STW,R3   P:GRAN            GRANULE POINTER IN OV                      8
         PAGE                                                                   
*                                                                               
*        PROCESS NEXT SEGMENT                                                   
*                                                                               
*        SET UP LIMITS AND SYMBOL TABLE                                         
*                                                                               
PTWO32   LW,R1    FBA:SEG                                                       
         AW,R1    BDP:SEG                                                       
         SLS,R1   RIGHT*2           WA OF CURRENT T:SEG ENTRY                   
         LW,R7    S:FLAGS,R1                                                    
         CW,R7    S:PMSK                                                        
         BAZ      %+2               B IF NOT PRELOADED SHARABLE SEG             
         STW,R7   PRLDFLAG          SET LOCAL FLAG                              
         LW,R7    8,R1              LIBRARY SUZE - BYTES                        
         SLS,R7   RIGHT*2                                                       
         AWM,R7   V:LIBSIZ                                                      
         LI,R7    5                                                             
         LW,R8    P:GRAN            GRAN DISPLACEMENT                          8
         STH,R8   *R1,R7            TO SEG TABLE                               8
         LW,R7    6,R1                                                          
         SLS,R7   RIGHT*13          FDA TO BYTEADDR OF THIS SEG                 
         AND,R7   X:7FFF8                                                       
         STW,R7   FBAEXEC            SET LIMITS FOR THIS SEGMENT                
         STW,R7   BAPEXEC                                                      8
         LW,R8    6,R1                                                          
         AND,R8   X:FFFF                                                        
         SLS,R8   LEFT*3             NO OF DOUBLE WORDS TO NO BYTES             
         AWM,R8   V:TOTSIZ                                                      
         AW,R7    R8                                                            
         STW,R7   LBAEXEC                                                       
         AI,R7    -1                                                            
         CW,R7    LBA:LIM                                                       
         BLE      %+2               BRANCH IF NOT OUT OF BOUNDS                 
         STW,R7   LIMIT             SET OUT OF BOUNDS FLAG                      
         LI,R7    7                                                             
         LH,R9    *R1,R7             BYTE LENGTH                                
         AND,R9   X:FFFF                                                        
         LI,R6    6                  BDP - TVALU THIS SEG                       
         LH,R6    *R1,R6                                                        
         AND,R6   X:FFFF                                                        
         STW,R6   BDP:VALU                                                      
         AW,R6    FBA:VALU           BUFFER ADDR                                
         STW,R6   LBA:VALU                                                      
         AWM,R9   LBA:VALU                                                      
         LI,R5    M:X4                                                          
         LW,R12   1,R1               GRANULE NO IN X4                           
         SLS,R12  RIGHT*16           RIGHT JUSTIFIED                            
         STW,R12  VALUGRAN                                                      
         READXN                     GET VALUE TABLE THIS SEGMENT                
*        IF THIS IS NON-PUBLIB ROOT1, SUPPLY VALUE FOR P:END                    
         MTW,0    BDP:SEG                                                   13  
         BNEZ     PTWO35            ONLY FOR ROOT                           13  
         MTW,0    FL:PUBL                                                       
         BGZ      PTWO35                                                        
         LW,R5    FBA:VALU                                                      
         AW,R5    NBE:VALU                                                      
         LI,R8    D+V               P:END IS DEFINED,VALUE,ADDRESS              
         STB,R8   0,R5                                                          
         LW,R9    LBA:PATH                                                      
         WORD                       PUT ADDRESS IN 2 ENTRY OF VALUE TABL        
         PAGE                                                                   
*                                                                               
*                 CONSTRUCT TGRAN=((BL/NBEGRAN))+1  WORDS                       
*                                                                               
PTWO35   LW,R9    S:LL,R1           BL OF LM IMAGE OF SEG                       
         SLS,R9   RIGHT*2           CONVERT TO WL                               
         LI,R8    0                                                             
         DW,R8    NWEGRAN                                                       
         MTW,0    R8                 REMAINDER CHECK                            
         BEZ      %+2               NONE                                        
         AI,R9    1                 YES -ADD 1 FOR PARTIAL GRANULE              
         LW,R8    LBA:VALU          START GRAN TABLE                            
         BOUNDRDW                   ON DW ADDR FOLLOWING VALU.                  
         SLS,R8   RIGHT*2                                                       
         STW,R8   FWAGRAN                                                       
         STW,R8   LWAGRAN                                                       
         AWM,R9   LWAGRAN                                                       
         STW,R9   *FWAGRAN                                                      
         MTW,1    LWAGRAN                                                       
         LW,R7    R9                ZERO OUT TABLE                              
         LI,R10   0                                                             
         STW,R10  *FWAGRAN,R7                                                   
         BDR,R7   %-1                                                           
         PAGE                                                                   
*                                                                               
*                 READ  T:MODIFY,T:MODULE FROM M:X3.INTO B:MT.                  
*                 SET FBA:MTB                                                   
         LI,R3    11                                                            
         LH,R9    *R1,R3            BL MODL                                     
         LI,R3    10                                                            
         LH,R8    *R1,R3            BL MODF                                     
         STW,R8   LBA:MODF          ADD FBA:MTB LATER                           
         BOUNDRDW                                                               
         LW,R6    FBA:VALX          FBA:MTB=FBA:VALX - (DW ROUNDED              
*                                   BL OF MODF + BL MODL)                       
         SW,R6    R8                                                            
         SW,R6    R9                                                            
         AND,R6   X:7FFFC           ROUND TO LESSER DW BOUNDARY                 
         STW,R6   FBA:MTB                                                       
         STW,R6   FBA:MODF                                                      
         AWM,R6   LBA:MODF                                                      
         STW,R6   FBA:MODL                                                      
         STW,R6   LBA:MODL                                                      
         AWM,R8   FBA:MODL                                                      
         AW,R9    R8                                                            
         AWM,R9   LBA:MODL                                                      
         LI,R3    3                                                             
         LH,R12   *R1,R3            GRANULE NUMBER IN X3                        
         LI,R5    M:X3                                                          
         LW,R8    LWAGRAN                                                       
         STW,R8   FWAWA                                                         
         REORGWA                                                        22      
         READXN                                                                 
*                                    AT END OF GRANULE TABLE                    
         LI,R8    0                                                             
         STW,R8   BDP:MODL                                                      
         STW,R8   BDP:MODF                                                      
*                                                                               
*        IF NON-PUBLIB ROOT1, BUILD PCB                                         
*                                                                               
         MTW,0    BDP:SEG                                                       
         BNEZ     PTWO4             NOT ROOT (FIRST SEGMENT)                    
         MTW,0    FL:PUBL                                                       
         BNEZ     PTWO4             IS A PUBLIB                                 
*                                                                               
*                 BUILD PCB FOR ROOT                                            
*                                                                               
         LI,R3    1                                                             
         LI,R4    0                                                             
         REAWA                      PCB GOES IN GRANULE 1                       
         LI,R6    32                STORE A WORD                                
         LI,R7    0                                                             
         SPACE    3                                                             
         LW,R8    FBA:TEMP                                                      
         SLS,R8   RIGHT*2           WA OF TEMP STACK                            
         AI,R8    -1                                                            
         STORBITS                                                               
         SPACE    3                                                             
         LW,R8    FL:TEMP           LENGTH OF TEMP STACK IN BYTES              8
         SLS,R8   LEFT*16                                                       
         STORBITS                   IN LEFT HALFWORD                            
         SPACE    3                                                             
         LW,R8    FBA:OVLO          OVLOAD TABLE                                
         SLS,R8   RIGHT*2                                                       
         STORBITS                                                               
         SPACE    3                                                             
         LI,R8    8                                                             
         AWM,R8   BAPEXEC           PASS TWO WORDS                              
         SPACE    3                                                             
         LW,R8    MSLADD            M:SL DCB ADDRESS                            
         AND,R8   X:7FFFF                                                   14  
         SLS,R8   RIGHT*2                                                       
         STORBITS                                                               
         SPACE    3                                                             
         LI,R8    16                                                            
         AWM,R8   BAPEXEC           PASS FOUR  WORDS                            
         SPACE    3                                                             
         LW,R8    FBA:DCBT          DCB TABLE                                   
         SLS,R8   RIGHT*2                                                       
         STORBITS                                                               
         SPACE    3                                                             
         LI,R8    8                                                             
         AWM,R8   BAPEXEC           PASS 2 WORDS                                
         SPACE    3                                                             
         PAGE                                                                   
*                                                                               
*        PROCESS NEXT ROM                                                       
*                                                                               
*        SET UP ROM INFORMATION TABLES                                          
*                                                                               
*                                                                               
PTWO4    LW,R2    FBA:MODL                                                      
         AW,R2    BDP:MODL                                                      
         CW,R2    LBA:MODL                                                      
         BGE      PTWO6             END T:MODULE; END OF CURRENT SEGMENT        
         SLS,R2   RIGHT*2           BA TO WA                                    
         LW,R8    0,R2              FIRST WORD OF T:MODULE ENTRY                
         CI,R8    G                                                             
*                                                                               
*                 EACH MODULE HAS ASSOCIATED WITH IT  FOUR TABLES;              
*                 T:DECL,T:CSECT,T:FWD,T:FWDX                                   
*                                                                               
*                 TO CONSERVE SPACE ON THE RAD, THESE TABLES ARE                
*                 WRITTEN TO RAD ONLY WHEN THE CUMULATIVE TOTAL                 
*                 FOR ONE OR MORE MODULES WOULD EXCEED A GRANULE.               
*                                                                               
*                 THUS A GLOB MAY CONTAIN T:DECL,ETC FOR MORE                   
*                 THAN  1 MODULE .                                              
*                                                                               
*                 A G BIT =0 IN T:  MODULE INDICATES THAT T:DECL,ETC            
*                 FOR  THIS MODULE IS A SUBSET OF THE GLOB CURRENTLY            
*                 IN CORE. THE TABLE POINTERS ARE SET FROM BDP'S                
*                 AND BL'S IN THE MODULE TABLE ENTRY.                           
*                                                                               
*                 IF G=1, A NEW GLOB IS READ FROM X2 CONSISTING OF              
*                 ALL  TABLES UP TO AND INCLUDING THE LAST G=0                  
*                 THE GLOB IS READ  TO  FBA:MTB,AND ALL BDP'S                   
*                 ARE CALCULATED  FROM THIS  POINT. FBA:MTB IS                  
*                 CALCULATED  AS    FBA:MODL-(SUM OF ALL TABLES                 
*                 IN  THE GLOB).                                                
*                                                                               
         BANZ     PTWO44            G=1; READ A NEW GLOB.                       
         PAGE                                                                   
*                                                                               
*        G=0, TABLES ARE ALREADY IN MEMORY.  ADJUST POINTERS.                   
*                                                                               
         LI,R3    T:DECL            INDEX INTO  FBA,BDP,LBA TABLES.             
         LI,R4    2                 HALF-WORD ENTRIES IN T:MODL                 
PTWO42   CI,R4    10                                                            
         BGE      PTWO5             DONE THIS T:MODULE ENTRY                    
*                                                                               
*                 USES  HALFWORDS  N=BDP,N+1=BL  TO SET FBA,BDP,LBA OF          
*                 T:DECL,T:CSECT,T:FWD,T:FWDX ENTRIES; PARALLEL TABLES          
*                                                                               
         LH,R8    *R2,R4            BDP OF TABLE IN GLOB                        
         AND,R8   X:FFFF                                   /SIG7-3272/*C5733    
         AW,R8    FBA:MTB           GLOB FBA                                    
         STW,R8   T:FBA,R3                                                      
         STW,R8   T:LBA,R3                                                      
         AI,R4    1                 BL HALFWORD                                 
         LH,R8    *R2,R4                                                        
         AND,R8   X:FFFF                                   /SIG7-3272/*C5733    
         STW,R8   T:BDP,R3          BDP FOR EACH TABLE = BL                     
         AWM,R8   T:LBA,R3                                                      
         AI,R3    1                 NEXT SET OF PARALLEL FBA,BDP,LBA            
         AI,R4    1                                                             
         B        PTWO42                                                        
         PAGE                                                                   
*                                                                               
*                                                                               
*                 G=1, READ A NEW GLOB OF T:DECL,ETC TABLES.                    
*                                                                               
*                                                                               
PTWO44   LW,R3    R2                LOOK AHEAD TO GET LAST G=0 ENTRY            
         LW,R10   NBE:MODL                                                      
         SLS,R10  RIGHT*2           NO WORDS IN T:MODL ENTRY                    
         LW,R11   LBA:MODL                                                      
         SLS,R11  RIGHT*2           WA OF END OF TABLE                          
PTWO45   AW,R3    R10                                                           
         CW,R3    R11                                                           
         BGE      PTWO46            END OF TABLE                                
         LW,R4    0,R3              FIRST WORD OF T:MODULE ENTRY                
         CI,R4    G                                                             
         BAZ      PTWO45            =0  CHECK NEXT ENTRY                        
*                                                                               
*                 LAST WORD OF PRECEDING ENTRY CONTAINS BDP AND BL              
*                 OF LAST TABLE IN  GLOB                                        
*                                                                               
PTWO46   AI,R3    -1                                                            
         LH,R8    *R3               BDP OF LAST TABLE                           
         AND,R8   X:FFFF                                   /SIG7-3272/*C5733    
         LI,R4    1                                                             
         AH,R8    *R3,R4            BL  OF LAST TABLE                           
         STW,R8   R9                BYTES TO READ                               
         BOUNDRDW                                                               
         LW,R6    FBA:MODF                                                      
         SW,R6    R8                                                            
         STW,R6   FBA:MTB           BUFFER ADDR                                 
         STW,R6   FBA:DECL                                                      
         REORGWA                                                               8
         LI,R5    M:X2                                                          
         LI,R3    2                                                             
         LH,R12   *R2,R3            GRANULE DISPLACEMENT                        
         READXN                     GET GLOB                                    
         LI,R4    3                                                             
         LH,R8    *R2,R4            BL OF T:DECL.                               
         AW,R8    FBA:DECL                                                      
         STW,R8   LBA:DECL                                                      
         LI,R8    0                                                             
         STW,R8   BDP:DECL          0 FROM  FBA:MTB                             
         AI,R4    1                                                             
         LI,R3    T:CSECT           COMPLETE INIT OF FBA, ETC                   
         B        PTWO42                                                        
         PAGE                                                                   
*                                                                               
*                 TABLES IN CORE FOR LOADING                                    
*                                                                               
*                 LOAD A MODULE                                                 
*                                                                               
PTWO5    LI,R5    0                                                             
         STW,R5   FLMODIFY          SET FOR ROMS                                
         LI,R8    ILLEGBF           EOD RETURN FOR ROMBYTE ROUTINE              
         BAL,R15  NXTROM            SET UP TO READ NEXT ROM                     
         LDROM                                                                  
         LW,R9    NBE:MODL                                                      
         AWM,R9   BDP:MODL                                                      
         B        PTWO4             SET UP FOR NEXT MODULE                      
*                                                                               
*                                                                               
*                 END  OF  SEGMENT                                              
*                                                                               
*                                                                               
PTWO6    ENDSEG                                                                 
         LW,R9    BDP:SEG                                                       
         BNEZ     PTWO62            BRANCH IF NOT ROOT (1ST T:SEG)              
         MTW,0    FL:PUBL                                                       
         BNEZ     PTWO62            BRANCH IF PUBLIB                            
         AW,R9    NBE:SEG           ROOT2 WILL BE SKIPPED                       
PTWO62   AW,R9    NBE:SEG           POINT TO NEXT T:SEG ENTRY                   
         STW,R9   BDP:SEG                                                       
         AW,R9    FBA:SEG                                                       
         CW,R9    LBA:SEG                                                       
         BGE      PTWO7             LAST SEGMENT                                
*                                                                               
*                                                                               
         B        PTWO32                                                        
*                                                                               
         PAGE                                                                   
*                 LAST SEGMENT HAS BEEN PROCESSED.                              
*                                                                               
*                                                                               
PTWO7    MTW,0    FL:PUBL                                               21      
         BGZ      PTWO821                                               21      
         LI,R9    0                                                     21      
         STW,R9   BDP:DCB                                                       
         LW,R8    LBA:DCB                                                       
         BOUNDRDW                                                               
         SLS,R8   RIGHT*2                                                       
         STW,R8   FWAWA                                                         
*                                                                               
*                 PROCESS ASSIGN CARDS                                          
*                                                                               
PTWO705  RES      0                                                             
         LI,R5    0                                                             
         STW,R5   WDP:ASSN          UPDATED BY CCI                              
PTWO70   LW,R5    FWAWA                                                         
         STW,R5   FWA:ASSN          BEGINNING T:ASSN                            
         STW,R5   FWAWA                                    /SIG7-2206/*C5733    
         LW,R6    V:CCTYPE                                                      
         CI,R6    :ASSIGN                                                       
         BE       PTWO706           BRANCH IF :ASSIGN REMAINS                   
         CI,R6    :LMHDR                                                        
         BNE      ASSNRET           DONT BRANCH IF :LMHDR REMAINS               
PTWO706  RES      0                                                             
         LW,R6    LBA:VALX                                                 101  
         STW,R6   FBA:DECL                                                 101  
         SLS,R6   RIGHT*2                                                       
         AI,R6    -1                UPPSER LIMIT                                
         STW,R6   LWA:ASSN                                                      
         SW,R6    R5                                                            
         AI,R5    -1                                                            
         LI,R8    0                 ZERO OUT ASSIGN AREA                        
         STW,R8   *R5,R6                                                        
         BDR,R6   %-1                                                           
         LI,R5    1                                                             
         STW,R5   FL:PAS2                                                       
         LI,R11   SEG:CCI                                                       
         LOADSEG                                                                
ASSNRET  LW,R5    WDP:ASSN                                                      
         AWM,R5   FWAWA                                                         
         AW,R5    FWA:ASSN                                                      
         STW,R5   LWA:ASSN                                                      
         LW,R5    V:NUSG                                                        
         CI,R5    1                                                             
         BE       PTWO82A           BRANCH IF ROOT2 PART OF ROOT1               
         PAGE                                                                   
*                                                                               
*                 PROCEED TO CONSTRUCT ROOT2 AS A SEPARATE SEG                  
*                                                                               
         LW,R8    LWA:ASSN                                                      
*                 PROCEED TO SET UP TABLE AREAS FOR ROOT2 CONSTRUCTION          
         STW,R8   FWAGRAN                                                       
         LW,R5    FBA:TEMP                                                      
         SW,R5    FBA:ROO2          LM BL FOR ROOT2                             
         LI,R4    0                                                             
         DW,R4    NBEGRAN                                                       
         MTW,0    R4                                                            
         BEZ      %+2               NO PARTIAL GRAN                             
         AI,R5    1                                                             
         STW,R5   *FWAGRAN                                                      
         AW,R8    R5                POINTER FOR WORK AREA                       
         AI,R8    1                                                             
         LI,R9    0                                                             
         STW,R9   *FWAGRAN,R5                                                   
         BDR,R5   %-1               ZERO OUT GRANULE TABLE                      
         STW,R8   FWAWA             BEGINNING  OF WORK AREA                     
         LW,R8    FBA:ROO2                                                      
         STW,R8   FBAEXEC                                                       
         LW,R8    LBA:ROO2                                                      
         STW,R8   LBAEXEC                                                       
*                 NOW LIMITS ARE INITIALIZED ROOT PART 2                        
         LW,R8    P:GRAN                                                        
         MTW,0    FLG:ROO2          HAVE WE EXLOCED R2 BEHIND R1?               
         BGEZ     %+2                                                           
         LW,R8    GRN:ROO2          YES, USE SECTOR BEHIND ROOT1                
         LW,R6    FBA:SEG           T:SEG BASE                                  
         AW,R6    NBE:SEG           T:SEG ENTRY RESERVED FOR ROOT2              
         SLS,R6   RIGHT*1           CONVERT TO HW                               
         AI,R6    S:LA              POINT TO LM ADDRESS ITEM                    
         STH,R8   0,R6              SAVE ROOT2 GRAN NR                          
         BAL,R15  BUILDR2           BUILD ROOT2 AS A SEPARATE SEG               
*                                                                               
*        DO ASSIGNS FOR ROOT2 DCBS                                              
*                                                                               
         LI,R3    0                                                             
         LW,R5    WDP:ASSN                                                      
         BEZ      PTWO82            NO ASSIGNS TO DO                            
         STW,R3   WDP:ASSN                                                 101  
PTWO812  LW,R4    FWA:ASSN                                                      
         AW,R4    WDP:ASSN                                                      
         CW,R4    LWA:ASSN                                                      
         BGE      PTWO82            DONE ALL ASSIGNS                            
         LW,R5    0,R4              BYTE ADDR OF DCB                            
         CW,R5    FBA:ROO2          IS THE DCB IN PART 2 OF THE ROOT       101  
         BL       PTWO813                                                  101  
         CW,R5    LBA:ROO2                                                      
         BGE      PTWO813                                                       
         ASSNDCB                        YES,ASSIGN DCB                     101  
         B        PTWO814                                                       
PTWO813  LI,R3    -1                    NO,SET FLAG TO ASSIGN LATER        101  
PTWO814  LI,R8    NWE:ASSN                                                      
         AWM,R8   WDP:ASSN                                                      
         B        PTWO812                                                  101  
PTWO82   RES      0                 WRITE OUT REMAINING GRANULES                
*                                   IN ROOT PART 2                              
         MTW,0    FLG:ROO2          SHOULD ROOT2 GO BEHIND ROOT1                
*                                   IN LOAD MODULE FILE                         
         BGEZ     PTWO82AA          NO                                          
         LW,R5    P:GRAN            SAVE P:GRAN                                 
         STW,R5   SVPGRAN                                                       
         LW,R5    GRN:ROO2          DONT PUT AT END OF LM BUT BEHIND R1         
         STW,R5   P:GRAN                                                        
         LI,R5    0                 WRITE OUT ALL REMAINING GRANS               
         WRITGRAN                                                               
         LW,R5    SVPGRAN                                                       
         STW,R5   P:GRAN                                                        
         B        PTWO82AC                                                      
PTWO82AA RES      0                                                             
         LI,R5    0                                                             
         WRITGRAN                                                              8
         LW,R5    *FWAGRAN                                                      
         AWM,R5   P:GRAN            ADD GRANS FOR ROOT PT 2                     
PTWO82AC RES      0                                                             
         AI,R5    1                 FOR SECTOR HDR                              
         SLS,R5   LEFT*17           LEFT JUST IN BITS 0-14                      
         AWM,R5   M:OV+4            UPDATE COUNT IN DCB                         
         CI,R3    -1               *ARE THERE ANY DCBS TO BE ASSIGNED      101  
*                                   IN PART ONE OF THE ROOT                101  
         BNE      PTWO821               NO                                 101  
         PAGE                                                                   
*                                                                               
*        DO ASSIGNS FOR ROOT1 DCBS AND BUILD ROOT2 IF                           
*        ROOT2 IS PART OF ROOT1                                                 
*                                                                               
PTWO82A  RES      0                                                             
         LW,R3    P:GRAN                                                        
         STW,R3   SVPGRAN           SAVE CURRENT P:GRAN VALUE                   
         LI,R3    1                     YES,SET UP POINTERS TO LOAD        101  
         STW,R3   P:GRAN                    PART ONE OF THE ROOT           101  
         LW,R3    LWA:ASSN                                                 101  
         STW,R3   FWAGRAN                  *LOCATE T:GRAN AT THE END       101  
*                                           OF T:ASSN                      101  
         LW,R3    FBA:SEG                                                  101  
         SLS,R3   RIGHT*1                                                  101  
         LH,R7    6,R3                      GET FBA OF ROOT (PART ONE)     101  
         AND,R7   X:FFFF                                                   101  
         SLS,R7   LEFT*3                                                   101  
         STW,R7   FBAEXEC                                                  101  
         STW,R7   LBAEXEC                                                  101  
         SLS,R3   RIGHT*1                                                  101  
         LW,R7    6,R3                      GET LBA+1 OF ROOT (PART ONE)   101  
         AND,R7   X:FFFF                                                   101  
         SLS,R7   LEFT*3                                                   101  
         AWM,R7   LBAEXEC                   R7=NO. OF BYTES IN ROOT        101  
         SLS,R7   RIGHT*2                   R7=NO. OF WORDS IN ROOT        101  
         AW,R7    NWEGRAN                  *CALCULATE THE NO. OF GRANULE   101  
         AI,R7    -1                        PARTITIONS IN THE ROOT AND     101  
         DW,R7    NWEGRAN                   ALLOCATE SPACE FOR T:GRAN      101  
         STW,R7   *FWAGRAN                                                 101  
         AW,R7    FWAGRAN                                                  101  
         AI,R7    1                                                        101  
         STW,R7   LWAGRAN                                                  101  
         STW,R7   FWAWA                    *BEGIN THE WORK AREA AT THE     101  
*                                           END OF T:GRAN                  101  
         LW,R5    *FWAGRAN          GRANS IN ROOT(BOTH PARTS IF COMBINED)       
         LW,R7    LBA:ROO1          END OF ROOT PART 1                          
         SW,R7    FBAEXEC                                                       
         SLS,R7   RIGHT*2           BL TO WL                                    
         AW,R7    NWEGRAN                                                       
         AI,R7    -1                                                            
         DW,R7    NWEGRAN           GRANS IN ROOT 1 ONLY                        
         LI,R3    0                 'GRANULE NOT CREATED YET'                   
         CW,R5    R7                                                            
         BNE      %+2               BRANCH IF NOT LAST ROOT 1 GRAN              
         LI,R3    W                 'GRANULE EXISTS ON LM FILE'                 
         STW,R3   *FWAGRAN,R5                                                   
         BDR,R5   %-4                                                           
         LI,R3    0                                                        101  
         STW,R3   WDP:ASSN                                                 101  
         LW,R3    V:NUSG                                                        
         CI,R3    1                                                             
         BNE      PTWO82B           BRANCH IF SEPARATE ROOT 2                   
         BAL,R15  BUILDR2           BUILD ROOT 2 IN ROOT 1                      
PTWO82B  LW,R4    FWA:ASSN          GER THE NEXT ENTRY IN T:ASSN                
         AW,R4    WDP:ASSN                                                 101  
         CW,R4    LWA:ASSN                                                 101  
         BGE      PTWO82E           END OF T:ASSN                               
         LW,R5    0,R4                     *IS THE DCB IN PART ONE OF      101  
         LW,R3    V:NUSG                                                        
         CI,R3    1                                                             
         BE       PTWO82C           BRANCH IF COMBINED ROOT1/2                  
         CW,R5    FBA:ROO2                  THE ROOT                       101  
         BL       PTWO82C           BRANCH IF DCB BELOW ROOT2                   
         CW,R5    LBA:ROO2                                                      
         BL       PTWO82D                                                       
PTWO82C  ASSNDCB                    IN ROOT1                                    
PTWO82D  RES      0                                                             
         LI,R8    NWE:ASSN                                                 101  
         AWM,R8   WDP:ASSN          POINT TO NEXT T:ASSN ENTRY             101  
         B        PTWO82B                                                       
PTWO82E  LI,R5    0                 *FINISHED THE ASSIGNMENTS,                  
         WRITGRAN                           WRITE GRANULES IN CORE BACK    101  
         LW,R5    SVPGRAN                                                       
         STW,R5   P:GRAN            RESTORE P:GRAN TO CURRENT EOF               
         PAGE                                                                   
*                                                                               
*        BUILD LOAD MODULE HEADER                                               
*                                                                              8
PTWO821  MTW,0    LIMIT                                                         
         BEZ      PTWO822                                                       
         LI,R9    EXCLIM                                                        
         RDIAG                                                                  
         LW,R4    FL:PUBL                                                       
         BEZ      %+2                                                           
         STW,R4   FL:ERROR                                                      
PTWO822  LI,R4    0                                                             
         LW,R8    LBA:VALU                                              21      
         BOUNDRDW                                                               
         SLS,R8   RIGHT*2                                               21      
         STW,R8   FWAWA             SAVE VALUE TABLE FOR PUBLIB         21      
         LW,R3    R8                                                            
         LW,R9    FBA:LIM           TASK FBA                                    
         SLS,R9   RIGHT*2           CONVERT TO WA                               
         STW,R9   H:FWA,R3          INSERT FWA IN HEADER                        
         LI,R9    0                                                             
         MTW,0    FL:BACK                                                      8
         BGZ      %+2                                                          8
         LI,R9    H:FSET            FOREGROUND                                  
         MTW,0    FL:SMM            BCKG WORK SPACE NEEDED                      
         BEZ      %+2               BRANCH IF NOT                               
         AI,R9    H:SSET                                                        
         MTW,0    FL:STM            RESTRICT TO SECONDARY MEMORY                
         BEZ      %+2               BRANCH IF NOT                               
         AI,R9    H:RSET            RESTRICT                                    
         MTW,0    FL:PUBL                                                       
         BEZ      %+2               BRANCH IF NOT PUBLIB                        
         AI,R9    H:LSET            PUBLIB                                      
         LW,R8    FL:PRIM           GET PRIMARY/SECONDARY FLAGS                 
         SLS,R8   H:PSHIFT          POSITION THEM                               
         AW,R9    R8                AND INSERT                                  
         MTW,0    FL:CRIT           CRITICAL TASK                               
         BEZ      %+2               BRANCH IF NOT                               
         AI,R9    H:CSET            CRITICAL                                    
         LI,R4    H:FLAGS                                                       
         STB,R9   *R3,R4            INSERT FLAGS IN HEADER                      
         LW,R9    LBA:PATH          GENERATE DEFAULT LWA                        
         AI,R9    -1                LBA:PATH IS ACTUALLY LBA+1                  
         SLS,R9   RIGHT*2           CONVERT TO WA                               
         STW,R9   H:LWA,R3          INSERT LWA   IN HEADER                      
         LW,R9    V:MSECB           MAX SOLICITED ECBS                          
         LI,R4    H:MSECB                                                       
         STB,R9   *R3,R4            INSERT IN HEADER                            
         LW,R5    FBA:SEG           START OF T:SEG TABLE                        
         SLS,R5   RIGHT*2           CONVERT TO WA                               
         LW,R9    S:ENTRY,R5        GET ROOT ENTRY (0 FOR PUBLIB)               
         MTW,0    FL:PUBL                                                       
         BEZ      %+2               BRANCH IF NOT PUBLIB                        
         LI,R9    0                 FORCE ENTRY ADDR TO 0                       
         AND,R9   X:1FFFF                                                       
         STW,R9   H:ENTRY,R3        INSERT INITIAL ENTRY IN HEADER              
         LW,R9    V:MRECB           MAX RESPONSIBLE ECBS                        
         LI,R4    H:MRECB                                                       
         STB,R9   *R3,R4            INSERT MRECB IN HEADER                      
         LI,R6    S:ML                                                          
         LH,R9    *R5,R6            DW LENGTH OF ROOT1 OR                       
         AND,R9   X:FFFF              PUBLIB ROOT SEGMENT                       
         SLS,R9   LEFT*3            CONVERT TO BL                               
         MTW,0    FL:SMM                                                        
         BEZ      PTWO822B          BRANCH IF NOT SIMPLIFIED MEM MGT            
         LW,R9    FBA:ROO2          ROOT1 WILL END AT ROOT 2 START              
         LW,R4    V:NUSG                                                        
         CI,R4    1                                                             
         BG       %+2               BRANCH IF ROOT1 AND 2 SEPARATE              
         LW,R9    LBA:PATH          ROOT1 WILL CONTAIN LONGEST PATH             
         SW,R9    FBA:LIM           SUBTRACT START BA FOR BL                    
PTWO822B STW,R9   H:MLR1,R3         INSERT MEM LTH ROOT1 IN HEADER              
         LW,R9    V:MENQ            MAX ENQUEUES                                
         LI,R4    H:MENQ                                                        
         STB,R9   *R3,R4            INSERT MENQ IN HEADER                       
         LI,R6    S:MA                                                          
         LH,R9    *R5,R6            DW ADDRESS OF ROOT1 OR                      
         AND,R9   X:FFFF            PUBLIB ROOT SEGMENT                         
         SLS,R9   LEFT*1            CONVERT TO WA                               
         STW,R9   H:MAR1,R3         INSERT MEM ADDR ROOT1 IN HEADER             
         LW,R9    V:NUSG                                                        
         MTW,0    FL:SMM                                                        
         BEZ      PTWO822F          BRANCH IF NOT SIMPLIFIED MEM MGT            
         CI,R9    1                                                             
         BE       %+2               BRANCH IF ROOT1 ALONE                       
         LI,R9    2                 FORCE TO ROOT1 + ROOT2                      
*                                   SINCE USER SEGS WILL BEE IN                 
*                                   ROOT1 MEMORY SEGMENT                        
         AI,R9    1                 ADD ONE FOR REST OF BKG MEM                 
         B        PTWO822X                                                      
PTWO822F RES      0                                                             
         LI,R4    0                                                             
         STW,R4   BDP:SEG           INITIALIZE FOR T:SEG SEARCH                 
PTWO822L RES      0                                                             
         LW,R4    FBA:SEG                                                       
         AW,R4    BDP:SEG           NEXT TSEG ENTRY BA                          
         CW,R4    LBA:SEG                                                       
         BGE      PTWO822X          B IF PAST END                               
         SLS,R4   -2                CONVERT TO WA                               
         LW,R4    S:FLAGS,R4        GET FLAGS WORD FROM T:SEG ENTRY             
         AND,R4   S:SMSK            EXTRACT SHARABILITY                         
         CW,R4    S:SMSK                                                        
         BNE      %+2               B IF NOT SMM                                
         AI,R9    -1                DISCOUNT AN SMM SEG                         
         LW,R4    NBE:SEG                                                       
         AWM,R4   BDP:SEG           POINT TO NEXT T:SEG ENTRY                   
         B        PTWO822L                                                      
*                                                                               
PTWO822X RES      0                                                             
         AW,R9    V:NPLSG           ADD PUBLIB SEGS FOR TOTAL                   
*                                   SEGS HANDLED BY MEM MANAGER                 
         LI,R4    H:NSEGS                                                       
         STB,R9   *R3,R4            INSERT NR SEGS IN HEADER                    
         LW,R9    S:LL,R5           LOAD MODULE LENGTH OF ROOT1                 
         STW,R9   H:LLR1,R3         OR PUBLIB ROOT SEGMENT                      
         LW,R9    V:NUSG                                                        
         CI,R9    1                 ROOT2 OR PUBLIB CONTEXT                     
         BE       PTWO823           BRANCH IF NOT                               
         LW,R10   NBE:SEG                                                       
         SLS,R10  RIGHT*2                                                       
         AW,R5    R10               POINT TO SECOND T:SEG ENTRY                 
         LI,R6    S:ML                                                          
         LH,R9    *R5,R6            DW LENGTH OF ROOT2 OR                       
         AND,R9   X:FFFF            PUBLIB CONTEXT SEGMENT                      
         SLS,R9   LEFT*3            CONVERT TO BL                               
         STW,R9   H:MLR2,R3         INSERT IN HEADER                            
         LI,R6    S:MA                                                          
         LH,R9    *R5,R6            DW EXLOC OF ROOT2 OR                        
         AND,R9   X:FFFF            PUBLIB CONTEXT SEGMENT                      
         SLS,R9   LEFT*1            CONVERT TO WA                               
         STW,R9   H:MAR2,R3         INSERT IN HEADER                            
         LW,R9    S:LL,R5           OR PUBLIB CONTEXT SEGMENT                   
         STW,R9   H:LLR2,R3         INSERT IN HEADER                            
         LI,R6    S:LA                                                          
         LH,R9    *R5,R6            LOAD MODULE ADDRESS OF START OF             
         AND,R9   X:FFFF            ROOT2 OR PUBLIB CONTEXT IMAGE               
         STW,R9   H:LAR2,R3         INSERT IN HEADER                            
         SW,R5    R10               POINT TO FIRST T:SEG ENTRY                  
         LW,R9    FLG:ROO2          R2 EXLOCED BEHIND R1?                       
         BGEZ     PTWO824           NO                                          
*        LW,R9    H:LLR2,R3         CHECK USERS INPUT FOR R2 SIZE               
*        CW,R9    LML:ROO2          WITH ACTUAL VALUE                           
*        BGE      PTWO823A          B IF OK                                     
         LW,R9    LML:ROO2          CHECK USERS INPUT RE LENGTH                 
         SLS,R9   2                                                             
         CW,R9    H:LLR2,R3         WITH ACTUAL SIZE                            
         BLE      PTWO823A          B IF OK                                     
         LI,R9    97                                                            
         RDIAG                                                                  
PTWO823A RES      0                                                             
*                                   EXTEND R1 TO INCLUDE R2 IN HEADER           
         LW,R9    H:LLR1,R3         PAGE BOUND                                  
         AI,R9    X'3FC'                                                        
         AND,R9   =X'FFFFF800'                                                  
         AW,R9    H:LLR2,R3                                                     
         STW,R9   H:LLR1,R3                                                     
         B        PTWO823                                                       
*        THERE IS NO ROOT2/PUBLIB CONTEXT                                       
PTWO823  LI,R9    0                 ZERO THE ROOT2/PUBLIB CONTEXT               
         STW,R9   H:MLR2,R3         POINTERS IN THE HEADER                      
         STW,R9   H:MAR2,R3                                                     
         STW,R9   H:LLR2,R3                                                     
         STW,R9   H:LAR2,R3                                                     
*                                                                               
PTWO824  MTW,0    FL:PUBL                                                       
         BNEZ     PTWO87            BRANCH IF PUBLIB                            
*                                                                               
*        FINISH LOAD MODULE HEADER FOR TASK LOAD MODULE                         
*                                                                               
         LW,R9    FBA:RTMP          START OF RBM TEMP STACKS                    
         SLS,R9   RIGHT*2           CONVERT TO WA                               
         AI,R9    -1                                                            
         STW,R9   H:RTS1,R3         INSERT SPD WORD 1 FOR RBM TS                
         LW,R9    FL:RTMP           RBM TS LENGTH IN WORDS                      
         SLS,R9   LEFT*16           ALIGN IN LEFT HW                            
         STW,R9   H:RTS2,R3         INSERT  SPD WORD 2 FOR RBM TS               
         LI,R4    H:PLTAB-1         NEXT WORD TO LOAD MINUS 1                   
PTWO84   LI,R6    0                                                            8
PTWO85   LI,R5    2                                                             
PTWO855  AI,R4    1                                                             
         LW,R8    T:PL,R6           INSERT PUBLIC LIB NAMES                    8
         BEZ      PTWO86            DONE                                       8
         STW,R8   *FWAWA,R4                                                    8
         AI,R6    1                                                            8
         BDR,R5   PTWO855                                                       
         AI,R6    PLESIZE-2                                                     
         B        PTWO85                                                       8
PTWO86   STW,R8   *FWAWA,R4         END WITH ZERO ENTRY                         
         B        PTWO89                                                       8
*                                                                               
*        FINISH LOAD MODULE HEADER FOR PUBLIB LOAD MODULE                       
*                                                                               
PTWO87   LW,R5    FBA:SEG                                               21      
         SLS,R5   RIGHT*2                                               21      
         LW,R9    P:GRAN            GRAN DISP OF T:SYMBOL               21      
         STW,R9   H:LASYM,R3        INSERT LM ADDR OF T:SYMBOL IN HDR           
         LI,R6    S:SYMBL                                                       
         LH,R9    *R5,R6            LOAD ROOT T:SYMBOL BYTE LENGTH              
         LI,R7    S:VALBL                                                       
         LH,R11   *R5,R7            LOAD ROOT T:VALUE BYTE LENGTH               
         LW,R10   V:NUSG                                                        
         CI,R10   1                                                             
         BE       PTWO87A           BRANCH IF NO CONTEXT SEGMENT                
         LW,R10   NBE:SEG           T:SEG ENTRY BL                              
         SLS,R10  RIGHT*2           BL TO WL                                    
         AW,R5    R10               POINT TO CONTEXT SEG BL                     
         AH,R9    *R5,R6            ADD CONTEXT T:SYMBOL BL                     
         AH,R11   *R5,R7            ADD CONTEXT T:VALUE BL                      
PTWO87A  STW,R9   H:LLSYM,R3        INSERT T:SYMBOL LM LENGTH IN HDR            
         STW,R11  H:LLVAL,R3        INSERT T:VALUE LM LENGTH IN HDR             
         AW,R9    NBEGRAN                                                       
         AI,R9    -1                                                            
         DW,R9    NBEGRAN           (R9)=NR OF GRANULES FOR T:SYMBOL            
         AW,R9    P:GRAN                                                        
         STW,R9   H:LAVAL,R3        INSERT LM ADDR OF T:VALUE IN HDR            
         AW,R11   NBEGRAN                                                       
         AI,R11   -1                                                            
         DW,R11   NBEGRAN           (R11)=NR OF GRANULES FOR T:VALUE            
         AW,R11   R9                                                            
         STW,R11  P:GRAN            UPDATE POINTER TO NEXT GRANULE              
         LI,R4    H:LAVAL           DISP IN HDR OF LAST WORD USED               
*                                                                              8
*        WRITE THE HEADER INTO THE LOAD MODULE                                  
*                                                                              8
PTWO89   LW,R6    P:GRAN                                                        
         LW,R7    Y:FFFE                                                        
         SCS,R6   RIGHT*15                                                      
         STS,R6   M:OV+4            SAVE NR GRANS USED IN OV FILE               
         LW,R8    V:TOTSIZ                                                      
         AI,R8    3                                                             
         SLS,R8   RIGHT*2           CHANGE TOTAL SIZE TO WORDS                  
         STW,R8   V:TOTSIZ                                                      
         MTW,0    FL:OFLOW                                                      
         BNEZ     PTWO9             B IF FILES HAVE OVERFLOWED                  
         AI,R4    1                                                             
         SLS,R4   LEFT*2            BYTES TO WRITE                              
         STW,R4   FPT:WTG+5         NO BYTES TO WRITE                           
         LW,R8    FWAWA                                                        8
         STW,R8   FPT:WTG+4         BUFFER                                     8
         LI,R7    0                                                            8
         STW,R7   FPT:WTG+6         BYTE OFFSET (TEMP)                         8
         STW,R7   FPT:WTG+7         GRANULE DISPLACEMENT                       8
         LI,R9    PT:WTGR           PARAM LIST                                 8
         CAL1,1   FPT:WTG                                                      8
         MTW,0    FL:PUBL                                               21      
         BEZ      PTWO9             NOT A PUBLIC LIBRARY                21      
         PAGE                                                                   
*                                                                       21      
*                 WRITE OUT  T:SYMBOL,T:VALUE TO PUBLIC LIBRARY         21      
*                                                                       21      
*                 FILE.                                                 21      
*                                                                       21      
PTWO895  LW,R5    FBA:VALU                                                      
PTWO896  CW,R5    LBA:VALU                                                      
         BGE      PTWO897                                                       
         LB,R8    0,R5              CHANGE VALUE ENTRIES TO PUBLIB TYPE         
         AND,R8   X:FC                                                          
         AI,R8    PUBLIB                                                        
         STB,R8   0,R5                                                          
         AW,R5    NBE:VALU                                                      
         B        PTWO896                                                       
PTWO897  LW,R7    FWAWA                                                         
         LW,R8    H:LAVAL,R7        GRAN DISP T:VALUE                           
         STW,R8   FPT:WTG+7                                             21      
         LW,R8    H:LLVAL,R7        BL T:VALUE                                  
         STW,R8   FPT:WTG+5                                             21      
         LW,R8    FBA:VALU                                              21      
         SLS,R8   RIGHT*2           WORD ADDR                           21      
         STW,R8   FPT:WTG+4                                             21      
         LI,R8    0                 BYTE OFFSET                         21      
         STW,R8   FPT:WTG+6                                             21      
         LI,R9    PT:WTGR                                               21      
         CAL1,1   FPT:WTG           WRITE OUT T:VALU                    21      
*                                                                       21      
*                 READ T:SYMBOL  AND WRITE TO OV                        21      
*                                                                       21      
         LW,R9    H:LLSYM,R7        BL T:SYMBOL                                 
         STW,R9   FPT:WTG+5                                             21      
         LW,R6    R7                                                    21      
         STW,R6   FPT:WTG+4                                                     
         LW,R8    H:LASYM,R7        LM ADDR OF T:SYMBOL                         
         STW,R8   FPT:WTG+7                                                     
         SLS,R6   LEFT*2            BUFFER WA TO BA                             
         LI,R5    M:X5              WA OF DCB FOR X5 FILE                       
         LW,R4    FBA:SEG           BA OF T:SEG ENTRY FOR ROOT                  
         SLS,R4   RIGHT*2           BA TO WA                                    
         LI,R3    S:SYMGN                                                       
         LH,R12   *R4,R3            GRAN NR IN X5 OF ROOT T:SYMBOL              
         LI,R3    S:SYMBL                                                       
         LH,R9    *R4,R3            BL OF ROOT T:SYMBOL                         
         READXN                     READ ROOT T:SYMBOL INTO BUFFER              
         LW,R10   V:NUSG                                                        
         CI,R10   1                                                             
         BE       PTWO898           BRANCH IF NO CONTEXT SEGMENT                
         LI,R5    M:X5              WA OF DCB FOR X5 FILE                       
         LW,R6    FWAWA             WA OF T:SYMBOL BUFFER                       
         SLS,R6   LEFT*2            WA TO BA                                    
         LI,R3    S:SYMBL                                                       
         LW,R4    FBA:SEG           BA OF ROOT T:SEG ENTRY                      
         SLS,R4   RIGHT*2           BA TO WA                                    
         AH,R6    *R4,R3            (R6)=BA OF CONTEXT T:SYMBOL BUFFER          
         LW,R10   NBE:SEG                                                       
         SLS,R10  RIGHT*2           BL TO WL                                    
         AW,R4    R10               (R4)=CONTEXT T:SEG ENTRY WA                 
         LH,R9    *R4,R3            BL OF CONTEXT T:SYMBOL                      
         LI,R3    S:SYMGN                                                       
         LH,R12   *R4,R3            GRAN NR IN X5 OF CONTEXT T:SYMBOL           
         READXN                     READ CONTEXT T:SYMBOL INTO BUFFER           
PTWO898  LI,R9    PT:WTGR                                                       
         CAL1,1   FPT:WTG                                               22      
*                                                                              8
*                                   EXIT                                       8
*                                                                              8
PTWO9    LI,R11   SEG:MAP                                                       
         LOADSEG                                                               8
         TITLE    ' ** BUILDR2 ** '                                             
*                                                                               
*                 THE FOLLOWING CODE (BUILDR2 THROUGH PTWO8)                    
*                 HAS BEEN CHANGED TO A SUBROUTINE TO CONSTRUCT                 
*                 ROOT2 EITHER AS A SEPARATE SEGMENT OR AS PART                 
*                 OF ROOT1                                                      
*                                                                               
*                 ON ENTRY, T:GRAN HAS BEEN SET UP FOR THE SEGMENT              
*                 TO BE USED, AND (FWAWA) IS THE ADDRESS OF THE                 
*                 START OF THE WORK AREA AVAILABLE.                             
*                                                                               
BUILDR2  RES      0                                                             
         STW,R15  BLDR2RET          SAVE RETURN ADDRESS                         
         LW,R8    FBA:OVLO                                                     8
         STW,R8   BAPEXEC                                                      8
         LW,R9    LBA:OVLO                                                      
         SW,R9    R8                                                            
         AI,R9    -4                (R9)=BL OF OVLOAD TABLE W/O COUNT CELL      
         LI,R8    NBEOVLO                                                       
         DW,R9    R8                                                            
         LW,R8    R9                                                           8
         LI,R6    32                                                           8
         LI,R7    0                                                            8
*                 NOTE:R6,R7 SET ONCE. MUST REMAIN UNCHANGED                    
*                 TO PTWO82                                                     
*                                                                               
         STORBITS                   STORE OVLOAD TABLE LENGTH                  8
         LI,R4    0                                                            8
         STW,R4   BDP:SEG                                                      8
*                                   BUILD OVLOAD TABLE                         8
PTWO71   LW,R4    FBA:SEG                                                      8
         AW,R4    BDP:SEG                                                      8
         CW,R4    LBA:SEG                                                      8
         BGE      PTWO72            DONE ALL SEGS                              8
         SLS,R4   RIGHT*2                                                      8
         LH,R8    *R4                                                           
         DO       #MAP=0                                                        
         CI,R8    X'8000'                                                       
         BANZ     PTWO719           B IF NOT OLAY SEG: NO OVLOAD ENTRY          
         FIN      #MAP=0                                                        
         LI,R5    S:ML                                                          
         LH,R9    *R4,R5            LOAD DWL OF SEGMENT IN MEMORY               
         AND,R9   X:FFFF                                                        
         AI,R9    X'FF'                                                         
         SLS,R9   RIGHT*8           CONVERT TO PAGE LENGTH                      
         STH,R9   R8                MERGE                                       
         LI,R10   0                                                             
         LW,R11   S:FLAGS,R4        GENERATE OVLOAD FLAG BYTE                   
         LW,R9    R11                                                           
         AND,R9   S:FMSK                                                        
         SLS,R9   O:FSHIFT-S:FSHIFT                                             
         OR,R10   R9                                                            
         LW,R9    R11                                                           
         AND,R9   S:IMSK                                                        
         SLS,R9   O:ISHIFT-S:ISHIFT                                             
         OR,R10   R9                                                            
         LW,R9    R11                                                           
         AND,R9   S:MMSK                                                        
         SLS,R9   O:MSHIFT-S:MSHIFT                                             
         OR,R10   R9                                                            
         LW,R9    R11                                                           
         AND,R9   S:SMSK                                                        
         SLS,R9   O:SSHIFT-S:SSHIFT                                             
         OR,R10   R9                                                            
         LW,R9    R11                                                           
         AND,R9   S:PMSK                                                        
         SLS,R9   O:PSHIFT-S:PSHIFT                                             
         OR,R10   R9                                                            
         STB,R10  R8                MERGE INTO CURRENT OVLOAD WORD              
         STORBITS                   IDENT                                      8
         LW,R8    Y:10                                                      13  
         LW,R9    MSLADD            BYTE ADDR                                   
         SLS,R9   RIGHT*2                                                       
         AW,R8    R9                                                        13  
         STORBITS                   ADDRESS OF M:SL                            8
         LI,R8    12                                                           8
         AWM,R8   BAPEXEC           SKIP THREE WORDS                           8
         LI,R5    12                                                            
         LH,R8    *R4,R5                                                        
         AND,R8   X:FFFF            DA OF ROOT/SEG                              
         SLS,R8   LEFT*1            WA                                          
         STORBITS                                                              8
         LW,R8    S:LL,R4           BL OF LM IMAGE OF SEG                       
         STORBITS                                                              8
         LI,R3    5                                                            8
         LH,R8    *R4,R3            GRANULE DISPLACEMENT                       8
         STORBITS                                                              8
         LI,R8    8                                                            8
         AWM,R8   BAPEXEC           SKIP TWO WORDS                             8
         LI,R3    7                                                            8
         LW,R8    *R4,R3            ENTRY ADDRESS                              8
         AND,R8   X:1FFFF           WORD ADDRESS                               8
         STORBITS                                                              8
PTWO719  LW,R3    NBE:SEG                                                       
         AWM,R3   BDP:SEG                                                       
         B        PTWO71            GET NEXT ENTRY                             8
*                 SET UP DCBTAB                                                8
PTWO72   LI,R4    0                                                            8
         STW,R4   BDP:DCB                                                       
         LW,R4    FBA:DCBT                                                     8
         STW,R4   BAPEXEC                                                      8
         LW,R8    NUMDCBS                                                  15   
         STORBITS                                                           13  
PTWO73   LW,R4    FBA:DCB                                                      8
         AW,R4    BDP:DCB                                                      8
         CW,R4    LBA:DCB                                                      8
         BGE      PTWO75            DONE MOVING DCB TABLE                      8
         AI,R3    1                                                         13  
         SLS,R4   RIGHT*2           CHANGE TO WA                               8
         LW,R8    1,R4                                                         8
         STORBITS                                                              8
         LW,R8    2,R4              SECOND EBCDIC WORD                         8
         STORBITS                                                              8
         LW,R8    0,R4                                                         8
         SLS,R8   RIGHT*2           WORD ADDRESS NOW                           8
         AND,R8   X:1FFFF                                                      8
PTWO74   STORBITS                                                              8
         LW,R3    NBE:DCB                                                      8
         AWM,R3   BDP:DCB                                                      8
         B        PTWO73                                                       8
*                 INSERT DCBS                                                  8
PTWO75   LW,R4    FBA:DCB                                                      8
         LI,R3    0                                                            8
         STW,R3   BDP:DCB                                                      8
PTWO76   LW,R4    FBA:DCB                                                       
         AW,R4    BDP:DCB                                                       
         CW,R4    LBA:DCB                                                       
         BGE      PTWO8                                                        8
         SLS,R4   RIGHT*2           WORD ADDR OF CURRENT DCB TABLE             8
*                                   ENTRY                                      8
         LB,R8    *R4                                                           
         CW,R8    PREF                                                          
         BANZ     PTWO763           PREF                                  16    
         CI,R8    V                 DEF  CHECK VALUE                      16    
         BANZ     PTWO774           YES  DONT ALLOCATE                    16    
PTWO763  LW,R8    1,R4              MATCH ON DEFAULTS                     16    
         LW,R9    2,R4                                                         8
         LW,R5    0,R4              ADDRESS OF DCB AT EXEC TIME                 
         AND,R5   X:7FFFF           BYTE ADDRESS                                
         STW,R5   BAPEXEC                                                       
         LW,R5    TDCBNAME                                                     8
         SLS,R5   RIGHT*1                                                17     
PTWO765  CD,R8    TDCBNAME,R5       TABLE OF EBCDIC DEFAULT NAMES        17     
         BNE      PTWO768           NO DEFAULT DCB                        16    
         LI,R7    V                                                       16    
         SCS,R7   RIGHT*8           PREF + V MEANS DEFAULT                16    
         STS,R7   0,R4              INTO DCB TABLE ENTRY                  16    
         B        PTWO77                                                  16    
PTWO768  BDR,R5   PTWO765                                                17     
         LI,R5    1                                                      17     
         LB,R8    *R4               CONTROL BYTE                                
         LI,R9    0                 RESET D BIT FOR UNALLOCATED DCBS            
         EOR,R8   R9                                                            
         STB,R8   *R4                                                           
PTWO77   LW,R5    TCBADR,R5         ADDRESS OF DCB                       17     
*                                   WORD ENTRY IN PARALLEL TABLE               8
         LI,R4    DCBSIZE                                                      8
PTWO773  LW,R8    0,R5                                                         8
         AI,R5    1                 MOVE DCB INTO USER ROOT PT 2               8
         LI,R7    0                                                             
         LI,R6    32                                                            
         STORBITS                                                              8
         BDR,R4   PTWO773                                                      8
PTWO774  LW,R4    NBE:DCB                                                       
         AWM,R4   BDP:DCB                                                       
         B        PTWO76                                                        
PTWO8    RES      0                                                             
         B        *BLDR2RET         RETURN                                      
         TITLE    '****  ENDSEG  ****'                                          
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  ENDSEG                  *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 APPLIES ANY MODIFICATIONS FROM T:MODIFY.                      
*                                                                               
*                 WRITES REMAINING GRANULES IN TGRAN TO PROGRAM FILE            
*                 AND UPDATES PGRAN TO LAST GRANULE WRITTEN.                    
*                                                                               
*                                                                               
*        ENTRY    R13 IS BAL REG                                                
*                 BDP:SEG IS OFFSET OF CURRENT SEGMENT TABLE ENTRY              
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
ENDSEG   RES      0                                                             
         STW,R13  ENDRET                                                        
         LI,R7    F:DEVICE                                                      
         LI,R9    PT:CLS                                                        
         CAL1,1   FPT:CLS           CLOSE VARIABLE-MEDIUM DCB IF NEEDED         
END3     LW,R5    LBA:MODF                                                      
         CW,R5    FBA:MODF                                                      
         BE       END7              NO  MODIFIES TO DO                          
         STW,R5   LBA:ROM           MODIFIES IN PSEUDO-ROM FORMAT               
         LW,R5    FBA:MODF                                                      
         AI,R5    -1                                                            
         STW,R5   BAP:ROM                                                       
         LI,R5    0                                                             
         STW,R5   FL:RTYPE                                                      
         LI,R5    1                                                             
         STW,R5   FLMODIFY          SET FOR MODIFIES                            
         LDROM                                                                  
*                                                                               
END7     RES      0                                                             
*                 WRITE VALUE TABLE WITH EXPRESSIONS RESOLVED TO M:X4           
         LW,R6    FBA:VALU                                                      
         LW,R5    FBA:SEG                                                       
         AW,R5    BDP:SEG                                                       
         SLS,R5   RIGHT*2                                                       
         LI,R7    6                 FBD VALU                                    
         AH,R6    *R5,R7                                                        
         LI,R7    3                                                        15   
         STS,R6   FPT:XN1+6                                                15   
         SLS,R6   RIGHT*2           BYTE OFFSET AND WORD LOC OF BUFFER     15   
         STW,R6   FPT:XN1+4                                                     
         LI,R7    7                 BL VALU                                     
         LH,R9    *R5,R7                                                        
         BEZ      END725            ZERO WD CNT                                 
         STW,R9   FPT:XN1+5                                                     
         LW,R12   VALUGRAN                                                      
         STW,R12  FPT:XN1+7                                                     
         LI,R5    M:X4                                                          
         AW,R5    Y:11              WRITE ORDER                            15   
         STW,R5   FPT:XN1                                                       
         LI,R9    0                                                             
         CAL1,1   FPT:XN1                                                       
*                 CHECK START ADDRESSES                                  20     
END725   MTW,0    FL:PUBL                                                       
         BGZ      END9                                                          
          LW,R5   FBA:SEG                                                20     
         AW,R5    BDP:SEG                                                20     
         SLS,R5   RIGHT*2           WA OF CURRENT SEG TABLE ENTRY        20     
          LW,R6   7,R5              START ADDRESS                        20     
         CI,R6     R                                                     20     
          BANZ    END8              START INPUT ON CC                    20     
         LI,R7    X'1FFFF'          WA MASK                              20     
         CI,R6    E                                                      20     
         BANZ     END73             START ADDR STILL UNRESOLVED          20     
*                                   EXPRESSION                           20     
         CI,R6    X'1FFFF'                                               20     
         BANZ     END9              NON ZERO START ADDR                  20     
         MTW,0    BDP:SEG                                                20     
         BNEZ     END9              ZERO START - NOT ROOT                20     
END73     LI,R6   0                 START IS UNRESOLVED EXP USE 0        20     
         STS,R6   7,R5                                                   20     
         MTW,0    BDP:SEG                                                20     
         BNEZ     END9              NOT ROOT - NO WARNING                20     
          LI,R9   NOSTART           ROOT - NO START - NO DEFAULT         20     
         RDIAG                                                           20     
         B        END9                                                   20     
END8     RES      0                                                     21      
*                 START ADDR INPUT ON CC, UNRESOLVED EXPRESSION           20    
         LW,R3    R6                                                            
         AND,R3   X:1FFFF           ENTRY NO IN T:VALU                    20    
        AI,R3    -1                                                             
         MW,R3    NBE:VALU          BYTE POSIT.                           20    
         AW,R3    FBA:VALU          ABSOLUTE BYTE ADDR                    20    
         LB,R4    0,R3              VALU CONTROL BYTE                     20    
         CI,R4    D                                                             
         BANZ     LDR15             BRANCH IF SATISFIED/DEFINED                 
LDR11    LI,R9    UNDEFST           UNDEF START ON CC                           
         RDIAG                                                                  
LDR12    LI,R7    X'1FFFF'                                                      
         B        END73                                                         
LDR15    CI,R4    V                                                             
         BAZ      LDR11             NO VALUE                              20    
         XW,R5    R3                                                            
         4BYTES                     GET VALUE                             20    
         CI,R4    C                                                       20    
         BANZ     %+2               CONSTANT                              20    
         SLS,R8   RIGHT*2           STORED AS BA                                
         LW,R11   FBAEXEC           CHECK LIMITS                          20    
         SLS,R11  RIGHT*2                                                 20    
         CW,R8    R11                                                           
         BL       LDR17                                                   20    
         LW,R11   LBAEXEC                                                 20    
         SLS,R11  RIGHT*2                                                 20    
         CW,R8    R11                                                           
         BGE      LDR17                                                   20    
         B        LDR19             WITHIN LIMITS OF SEGMENT              20    
LDR17    LI,R9    ILLSTRT           ILLEGAL START OUTSIDE SEG                   
         RDIAG                                                            20    
*                                                                        20     
LDR19    LI,R9    X'1FFFF'+E        WA MASK + E BIT                             
         STS,R8   7,R3              STORE ADDR FROM CC                          
END9     MTW,0    BDP:SEG                                                       
         BNEZ     END91             BRANCH IF NOT ROOT (1ST T:SEG)              
         MTW,0    FL:PUBL                                                       
         BNEZ     END91             BRANCH IF PUBLIB                            
         LW,R6    FBAEXEC                                                       
         AI,R6    24                                                            
         STW,R6   BAPEXEC                                                       
         LI,R6    32                                                            
         LI,R7    0                                                             
         LW,R5    FBA:SEG           T:SEG FIRST ENTRY                           
         SLS,R5   RIGHT*2           CONVERT TO WA                               
         LW,R8    S:ENTRY,R5        GET ENTRY ADDRESS FOR ROOT                  
         AND,R8   X:1FFFF                                                       
         STORBITS                   TASK ENTRY                                  
END91    LI,R5    0                                                             
         STW,R5   FPT:XN1+6                                                     
         WRITGRAN                   WRITE OUT ALL REMAINING                     
*                                   GRANULES OF SEGMENT                         
         LI,R5    0                                                             
         XW,R5    PRLDFLAG          GET AND RESET PRELOAD FLAG                  
         BNEZ     END92             IF PRELOADED, DONT COUNT GRANS              
         MTW,0    FLG:ROO2          WAS R2 EXLOCED BEHIND R1                    
         BGEZ     END91A            NO                                          
         MTW,0    BDP:SEG           B IF NOT ROOT                               
         BNEZ     END91A                                                        
         MTW,0    FL:PUBL           B IF PUBLIB                                 
         BNEZ     END91A                                                        
         LW,R5    P:GRAN            SAVE GRAN # OF FIRST GRAN                   
         AW,R5    *FWAGRAN          BEHIND ROOT1                                
         STW,R5   GRN:ROO2                                                      
*        MTW,1    *FWAGRAN          SPACE FOR 1 EXTR SEC FOR R2                 
         LW,R5    LML:ROO2          CAL # SECTORS FOR ROOT2                     
         AI,R5    255               ROUND UP TO SECTOR BOUNDARY                 
         SLS,R5   RIGHT*8                                                       
         AWM,R5   *FWAGRAN          SPACE FOR R2 SECTORS                        
END91A   RES      0                                                             
         LW,R5    *FWAGRAN          NR OF GRANS IN SEG                          
         AWM,R5   P:GRAN            ADD TO NEXT GRAN POINTER                    
         SLS,R5   LEFT*17           ADJUST POSITION                             
         AWM,R5   M:OV+4            ADD TO NR GRANS IN OV FILE                  
END92    B        *ENDRET                                                       
         TITLE    '**** MOVGRAN ****'                                           
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  MOVGRAN                 *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 MOVE A GRANULE IN CORE.                                       
*                 ZERO THE OLD GRANULE SPACE.                                   
*                                                                               
*        ENTRY    R14 IS BAL REGISTER                                           
*                 R5 CONTAINS GRANULE NUMBER                                    
*                 R6 CONTAINS WA(DESTINATION)                                   
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*        USES     ZEROGRAN                                                      
MOVGRAN  RES      0                                                             
         PUSH     4,9                                                           
         LW,R7    *FWAGRAN,R5                                                   
         AND,R7   X:1FFFF           ADDRESS PORTION                             
         BNEZ     MGR2              NON-ZERO                                    
         LI,R9    PROGERR           NOT IN CORE, LOGIC ERROR                    
         RDIAG                                                                  
MGR2     AI,R6    -1                                                            
         AI,R7    -1                                                            
         LW,R4    NWEGRAN           NO OF WORDS IN A GRANULE                    
MGR3     LW,R9    *R7,R4                                                        
         STW,R9   *R6,R4            MOVE DATA                                   
         BDR,R4   MGR3                                                          
         ZEROGRAN                   ZERO OUT OLD GRANULE                        
         LW,R7    X:1FFFF           REPLACE ADDRESS PORTION               16    
         AI,R6    1                                                       16    
         STS,R6   *FWAGRAN,R5                                                   
         PULL     4,9                                                           
         B        *R14                                                          
         TITLE    '**** OVOFLOW  ****'                                          
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  OVOFLOW                 *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 ERROR RESPONSE FOR EOT ON  WRITGRAN                           
*                                                                               
*                 PROGRAM FILE (M:OV) HAS OVERFLOWED IN PASS 2                  
*                                                                               
*                                                                               
*        ENTRY    FROM ENTRY IN PARAMETER TABLE  PT:WTG                         
*                                                                               
*        EXIT     R8                                                            
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
OVOFLOW  RES      0                                                             
         LI,R9    2                                                             
         STW,R9   FL:OFLOW          OVERFLOW IN PASS 2 FLAG                     
         STB,R9   M:OV+2            BYTE  0  OF WORD 2 OF M:OV DC = 2           
         B        *R8                                                           
         TITLE    '****  READGRAN  ****'                                        
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  READGRAN                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 IF THE WRITE BIT  IN THE TGRAN ENTRY IS SET,                  
*                                                                               
*                 READ THE GRANULE INTO CORE; RESET WRITE BIT                   
*                                                                               
*                 THE ADDRESS IS SET INTO THE TABLE ENTRY BY                    
*                 THE CALLING PROGRAM.                                          
*                                                                               
*                 IF THE WRIT BIT IS RESET, ZERO THE GRANULE IN CORE.           
*                                                                               
*        ENTRY    R5  CONTAINS GRANULE  NUMBER                                  
*                 R14 IS BAL  REG                                               
*        USES     ZEROGRAN                                                      
*                                                                               
READGRAN RES      0                                                             
         MTW,0    FL:OFLOW                                                      
         BNEZ     RDG9              OVERFLOW ON M:OV, BYPASS READ               
         PUSH     5,10                                                          
         LW,R9    *FWAGRAN,R5                                                   
         CI,R9    W                 WRITE BIT                                   
         BANZ     RDG2              HAS BEEN  WRITTEN,READ IN                   
RDG1     RES      0                                                             
         ZEROGRAN                   NOT WRITTEN, JUST ZERO OUT                  
         B        RDG8                                                          
RDG2     AND,R9   X:1FFFF                                                       
         BNEZ     RDG3              NON-ZERO                                    
         LI,R9    PROGERR           LIGIC ERROR -SHOULD HAVE BEEN SETUP         
         RDIAG                                                                  
         RABORT                                                                 
RDG3     STW,R9   FPT:RDG+4         BUFFER  LOC                                 
         STW,R9   *FWAGRAN,R5                                                   
         LW,R9    NBEGRAN                                                       
         STW,R9   FPT:RDG+5                                                     
         LI,R9    PT:RDG            ERROR HANDLER TABLE                         
         AW,R5    P:GRAN            R5 IS OFFSET; GET REAL DISPLACEMENT         
         AI,R5    -1                                                            
         STW,R5   FPT:RDG+7         GRANULE DISPLACEMENT                        
         CAL1,1   FPT:RDG                                                       
RDG8     PULL     5,10                                                          
RDG9     B        *R14                                                          
*                                                                               
PT:RDG   DATA     1                 ERROR HANDLERS                              
         DATA,1   5                 EOD                                         
         DATA,3   RDG1              ZERO GRANULE INSTEAD OF READING             
         TITLE    ' ****  REAWA  ****'                                          
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  REAWA                   *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 REALLOCATE WORK AREA                                          
*                                                                               
*                 SET THE GRANULES WHOSE NUMBERS ARE IN R3 AND R4               
*                 INTO CONTIGUOUS,MOST APPROPRIATE POSITION IN THE              
*                 CORE  WORK AREA.                                              
*                 SET CORRESPONDING VALUES IN TGRAN.                            
*                                                                               
*        ENTRY    R13 IS BAL REGISTER                                           
*                 R3  NUMBER OF FIRST GRANULE.                                  
*                 R4  IF R4=0, ONLY  R3 IS REQUIRED                             
*                     IF R4>0,  R4= R3+1 AND TWO CONTIGUOUS GRANULES            
*                 ARE  ALLOCATED IN CORE.                                       
*                                                                               
*                 HEREAFTER, R3,R4 REFER TO REGISTERS  3 AND 4.                 
*                 E3,E4  CORRESPOND  TO  THE ENTRIES  IN TGRAN POINTED          
*                 TO IN R3,R4.                                                  
*                 G3,G4 REFER TO  THE ACTUAL GRANULES REFERENCED                
*                 IN R3,R4.                                                     
*                 GRANULE  ALLOCATION IS MAINTAINED IN TGRAN, A                 
*                 WORD TABLE DEFINED  BY  FWAGRAN, LWAGRAN=FWAWA                
*                 GRANULES  ARE ALLOCATED IN WA (WORK AREA)                     
*                 WHOSE DYNAMIC LIMITS ARE IN FWAWA,FBA:DECL            22      
*                                                                               
*                 THE TABLE FORMAT  IS:                                         
*                                                                               
*                 WORD 0 = NUMBER OF ENTRIES IN TABLE (NO. OF GRANULES          
*                          FOR  THIS SEGMENT).                                  
*                 WORD N BITS 0-11 UNUSED                                       
*                        BIT 12 =1  GRANULE WRITTEN ON RAD                      
*                               =0  NOT WRITTEN AND/OR IN CORE                  
*                        BIT 15-31  WA OF GRANULE IN CORE.                      
*                                   IF=0, THE GRANULE HAS BEEN WRITTEN          
*                                   OR HAS NOT BEEN  ALLOCATED                  
*                                                                       22      
*                 USES  REGS 5,6,7,9,10,11,12                           22      
*                                                                       22      
REAWA    RES      0                                                             
*                                                                               
*                 PRELIMINARY CHECKS                                            
*                                                                               
*                 R3>0                                                          
         LI,R7    X'1FFFF'                                                      
         CI,R3    0                                                             
         BG       REA12                                                         
REA1     LI,R9    PROGERR           LOGIC ERR  NO 0 GRANULE                     
         RDIAG                                                                  
*                                                                               
*                 FOLLOWING CODE  GENERATES GRANULES IN LINE                    
*                                   IN CORE FOR PRELIMIN CHECKOUT               
*                                                                               
*                                                                       22      
*                 SINCE THIS ROUTINE IS ENTERED EACH TIME  A GRANULE    22      
*                 ALLOCATION MUST BE CHECKED, DO A FAST CHECK TO        22      
*                 DETERMINE WHETHER ALLOCATION IS ALREADY DONE,         22      
*                 OR WHETHER ALLOCATION/READING/WRITING IS NECESSARY.   22      
*                                                                       22      
REA12    CW,R3    *FWAGRAN                                              22      
         BG       REA1                                                  22      
         CW,R4    *FWAGRAN                                              22      
         BG       REA1              >  NO OF GRANULES ALLOCATED.        22      
         LW,R6    *FWAGRAN,R3                                           22      
         AND,R6   X:1FFFF           ADDRESS PORTION.                    22      
         BEZ      REA8              G3  NOT IN  CORE                    22      
*                                                                       22      
*                 G3 IS IN CORE                                         22      
*                                                                       22      
         CI,R4    0                                                     22      
         BE       REA9              G4 NOT ASKED FOR - DONE             22      
REA13    AW,R6    NWEGRAN                                               22      
         CW,R6    *FWAGRAN,R4       DOES G4 FOLLOW G3 IN CORE           22      
         BE       REA9              YES, G3,G4 LIE IN CONTIGUOUS CORE   22      
*                                                                       22      
*                                   END  FAST CHECK                     22      
*                                                                       22      
*                                                                       22      
*                 G3 IS IN CORE,G4 IS NOT CONTIGUOUS                    22      
*                                                                       22      
*                 WE MUST GET G3,G4 CONTIGUOUS IN CORE                  22      
*                                                                       22      
*                 R6 CONTAINS THE NECESSARY ADDRESS FOR G4 TO           22      
*                 FOLLOW G3.                                            22      
*                 IF THAT LOCATION IS VACANT AND AVAILABLE,             22      
*                 ALLOCATE/READ/MOVE G4 THERE                           22      
*                                                                       22      
*                 IF NOT VACANT, EITHER FIND TWO ADJACENT               22      
*                 EMPTY GRANULES WITHIN LIMITS,                         22      
*                 OR WRITE OUT THE FIRST TWO GRANULES IN                22      
*                 THE WORK AREA, AND PUT G3,G4 THERE.                   22      
*                                                                       22      
*                                                                       22      
*                                                                       22      
REA3     LW,R5    *FWAGRAN          NO OF GRANULES IN SEG               22      
         GALL                       CHECK UPPER LIMIT FOR PAIR                  
         BCS,1    REA7              OUTSIDE LIMITS                              
REA33    CW,R6    *FWAGRAN,R5       DOES ANY GRAN OCCUPY G4'S LOC               
         BE       REA4              YES                                 22      
         BDR,R5   REA33                                                 22      
         LW,R5    *FWAGRAN,R4       CHECK G4                            22      
         BEZ      REA35             NEVER ALLOCATED                     22      
         CI,R5    W                                                     22      
         BANZ     REA35             G4 WAS WRITTEN                      22      
         LW,R5    R4                MOVE G4 FROM OLD LOC TO             22      
         MOVGRAN                    NEW LOC IN R6                       22      
         B        REA9              EXIT                                        
REA35    STS,R6   *FWAGRAN,R4       ALLOCATE G4                         22      
         LW,R5    R4                                                    22      
         READGRAN                   READ OR ZERO G4 ACCORDING TO W.     22      
         B        REA9              EXIT                                22      
REA4     WRITGRAN                   GET RID OF OCCUPYING GRANULE        22      
         B        REA3              INSERT G4                                   
*                                                                       22      
*                 FIND ONE/(TWO) CONSECUTIVE GRANULES WITHIN            22      
*                 WORK AREA LIMITS THAT ARE EMPTY FOR G3/(G4)           22      
*                                                                       22      
*                 (REA8 HAS ALREADY TRIED OPTIMIZING POSITION OF G3,    22      
*                 IF G3 WAS NOT IN CORE).                               22      
*                                                                       22      
*        METHOD:  START WITH FIRST TWO CONSECUTIVE GRANULES             22      
*                 IN THE WORK AREA.                                     22      
*                                                                       22      
*                 TEST CONSECUTIVE PAIRS N,N+1 OF GRANULE               22      
*                 ADDRESSES FOR AN EMPTY PAIR. (IF R4=0, TEST           22      
*                 ONLY FOR A SINGLE GRANULE.)                           22      
*                                                                       22      
*                 IF NO CONSECUTIVE PAIR OF EMPTY GRANULES              22      
*                 EXISTS, WRITE THE FIRST GRANULE(S) OF                 22      
*                 WA TO DISC, AND ALLOCATE/MOVE/RED G3/(G4)             22      
*                 THERE.                                                22      
*                                                                       22      
REA7     LW,R10   FWAWA             WA(GRAN N) IN R10                   22      
         LW,R6    FWAWA             WA(GRAN N+1) IN R6                  22      
         CI,R4    0                                                     22      
         BE       %+2               ONLY ONE GRANULE,N=N+1              22      
         AW,R6    NWEGRAN                                               22      
         LCW,R12  *FWAGRAN          DONT GO PAST NO OF ENTRIES.         22      
REA72    LW,R5    *FWAGRAN                                              22      
         GALL                       IS WA(GRAN N+1) OUTSIDE LIMITS      22      
         BCS,1    REA75             YES - WRITE GRANS 1-2 OF WA         22      
REA73    CW,R6    *FWAGRAN,R5                                                   
         BE       REA74             CRAPPED OUT ON THIS PAIR            22      
         CW,R10   *FWAGRAN,R5                                                   
         BE       REA74             DITTO                               22      
         BDR,R5   REA73                                                 22      
*                                                                       22      
*                 NO GRANULE HAS WA IN EITHER R6 OR R10                         
*                                                                       22      
*                 USE WA IN R6 FOR G4, WA IN R10 FOR G3.                22      
REA732   LI,R11   2                                                             
REA733   XW,R6    R10                                                   22      
         LW,R5    *FWAGRAN,R3                                           22      
         CI,R5    X'1FFFF'                                              22      
         BAZ      REA734            NOT IN CORE OR NOT ALLOCATED        22      
         LW,R5    R3                                                    22      
         MOVGRAN                    MOVE TO NEW LOCATION                22      
         B        REA7342                                                       
REA734   STS,R6   *FWAGRAN,R3       SET UP ALLOC                        22      
         LW,R5    R3                                                            
         READGRAN                   READ OR ZERO                        22      
REA7342  BDR,R11  REA735            BRANCHES FIRST TIME ONLY                    
         XW,R3    R4                RESTORE FOR RETURN                  22      
         B        REA9                                                  22      
REA735   CI,R4    0                                                     22      
         BE       REA9              ONLY ONE TO SET UP                  22      
         XW,R3    R4                                                    22      
         B        REA733                                                22      
REA74    AW,R6    NWEGRAN           HIT ON R6 OR R10                    22      
         AW,R10   NWEGRAN                                               22      
         BIR,R12  REA72                                                    101  
REA75    LI,R11   2                 TABLE EXHAUSTED AND NO EMPTIES              
         LW,R10   NBTRWA            NEXT BLOCK TO RELEASE FROM WA               
REA7510  CI,R4    0                                                             
         BE       %+2               B IF ONLY ONE BLOCK NEEDED                  
         AI,R10   1                 NEXT BLOCK +1                               
         AI,R10   1                 NEW NEXT AVAILABLE BLOCK                    
         LW,R9    NBTRWA            FIRST BLOCK TO RELEASE THIS TIME            
         STW,R10  NBTRWA            UPDATE NEXT BLOCK TO RELEASE                
         MW,R9    NWEGRAN           BLOCK NR TIMES WDS/BLOCK                    
         AW,R9    FWAWA             WORD DISPL PLUS WORK AREA BASE              
*                                   BLOCK ADDRESS IN R9                         
         LW,R6    R9                                                            
         AI,R6    -1                                                            
         AW,R6    NWEGRAN                                                       
         CI,R4    0                                                             
         BE       %+2               B IF ONLY ONE BLOCK NEEDED                  
         AW,R6    NWEGRAN                                                       
         GALL                       CHECK IF END OF BLOCK(S) IS IN              
         BCR,1    %+3               WORK AREA. B IF IT IS.                      
         LI,R10   0                 POINT AT FIRST BLOCK                        
         B        REA7510           B TO FREE IT                                
         LW,R10   R9                (R10)= WA OF START OF BLOCK(S)              
REA752   LW,R5    *FWAGRAN                                                      
REA753   CW,R10   *FWAGRAN,R5                                                   
         BNE      %+2                                                   22      
         WRITGRAN                   5 IS GRAN NO OF GRAN AT FWAWA       22      
         BDR,R5   REA753                                                22      
         CI,R4    0                                                     22      
         BE       REA78             ONLY  ONE                           22      
         AW,R10   NWEGRAN                                               22      
         BDR,R11  REA752                                                        
REA78    LW,R6    R10                                                           
         CI,R4    0                                                             
         BE       %+2               B IF ONLY ONE BLOCK                         
         SW,R6    NWEGRAN           WA OF PRIOR BLOCK                           
         B        REA732                                                22      
*                                                                       22      
*                 G3 IS NOT IN CORE                                     22      
*                                                                       22      
REA8     LW,R5    R3                                                    22      
         MW,R5    NWEGRAN                                               22      
         SW,R5    NWEGRAN           GET LOGICALLY BEST POSSIBLE         22      
         AW,R5    FWAWA             POSITION FOR G3.                    22      
         STW,R5   R6                                                    22      
REA81    GALL                       IN LIMITS                           22      
         BCS,1    REA7              NO - GET TWO EMPTY ONES                     
         LW,R5    *FWAGRAN                                              22      
REA82    CW,R6    *FWAGRAN,R5                                                   
         BE       REA7              LOGICAL POSITION OCCUPIED                   
         BDR,R5   REA82                                                 22      
         STS,R6   *FWAGRAN,R3       LOGICAL POSIT AVAIL                 22      
         LW,R5    R3                GRANULE NUMBER                              
         READGRAN                                                       22      
         CI,R4    0                                                     22      
         BE       REA9              NO G4                               22      
         B        REA12                                                         
*                                                                       22      
*                                                                       22      
*        GALL     IF THE WA IN R6 LIES WITHIN THE LIMITS                22      
*                 FWAWA AND FBA:DECL,RETURN CC=0,                       22      
*                 IF NOT RETURN CC=1                                    22      
*                 (USED ONLY BY REAWA)                                  22      
GALL     PUSH     6                                                     22      
         CW,R6    FWAWA                                                 22      
         BL       GALLNG            < LOWER LIMIT                       22      
         SLS,R6   LEFT*2            BA                                  22      
         AW,R6    NBEGRAN           UPPER LIMIT                         22      
         CW,R6    FBA:DECL                                              22      
         BG       GALLNG            > UPPER LIM                         22      
         PULL     6                 OK                                  22      
         LCFI     0                                                     22      
         B        *R15                                                  22      
GALLNG   PULL     6                                                     22      
         LCFI     1                                                     22      
         B        *R15                                                  22      
REA9     B        *R13                                                  21      
         TITLE    '****  ASSNDCB  ****'                                    101  
*                                                                          101  
*        PURPOSE: TO ASSIGN A DCB FROM INFORMATION IN IT'S                 101  
*                 CORRESPONDING T:ASSN ENTRY                               101  
*                                                                          101  
*        INPUT:   R4=FWA OF T:ASSN ENTRY                                   101  
*                 R5=FBA OF DCB'S EXECUTION LOCATION                       101  
*                                                                          101  
*        CALL:    BAL,12  ASSNDCB                                          101  
*                                                                          101  
ASSNDCB  RES      0                                                             
         PUSH     R12                                                           
         PUSH     R4,R5                                                         
         STW,R5   BAPEXEC           SAVE EXECUTION LOC OF DCB                   
         SW,R5    FBAEXEC           BYTE ADDRESS WITHIN SEG                     
         SLS,R5   -2                WORD ADDR WITHIN SEG                        
         LI,R2    0                                                             
         LW,R3    R5                                                            
         DW,R2    NWEGRAN           R2=WORD IN GRAN, R3=GRAN IN SEG             
         AI,R3    1                 R3=T:GRAN INDEX                             
         LI,R4    0                 ASSUME SECOND GRAN UNNEEDED                 
         REAWA                      GET FIRST GRAN IN MEMORY                    
         LW,R1    *FWAGRAN,R3                                                   
         AND,R1   X:1FFFF           FIRST GRAN MEMORY ADDR                      
         AW,R1    R2                DCB MEMORY ADDRESS                          
         LB,R0    *R1               GET DCB SIZE                                
         SLS,R0   2                 IN BYTES                                    
         LW,R5    BAPEXEC           RECOVER EXECUTION LOC OF DCB                
         AW,R5    R0                END+1 BYTE ADDR                             
         AI,R5    -1                END BYTE ADDR                               
         CW,R5    LBAEXEC                                                       
         BG       ASSNERR1          B IF DCB PASSES SEG END                     
         SW,R5    FBAEXEC           CONVERT TO BYTE ADDR WITHIN SEG             
         SLS,R5   -2                WORD ADDRESS WITHIN SEG                     
         LI,R4    0                                                             
         DW,R4    NWEGRAN           R5=END GRAN NR                              
         AI,R5    1                 R5=END T:GRAN INDEX                         
         CW,R5    R3                                                            
         BE       %+3               B IF SAME AS START GRAN NR                  
         LW,R4    R5                                                            
         REAWA                      GET FIRST AND SECOND GRAN ADJACENT          
         LW,R7    R1                GET DCB WORD ADDRESS IN MEMORY              
         PULL     R4,R5                                                         
*                                                                               
         LCI      6                                                             
         LM,R8    2,R4              GET IO MEDIUM NAME FROM T:ASSN              
         STM,R8   GIOCT             SAVE IO ID IN USUAL BUFFER                  
         LW,R9    GIOBITS                                                       
         STS,R8   FPT:ASN+1         SET ASSIGN CAL IO ID P-BITS                 
         LW,R9    GIOOBIT                                                       
         SLD,R8   1                                                             
         STS,R8   FPT:ASN+3         SET INDIRECT BIT FOR OPLABEL NAME           
         LI,R9    PT:ASSN           SPECIAL ERROR HANDLING                      
         CAL1,1   FPT:ASN           ASSIGN THE IO ID                            
*                                                                               
         LW,R8    R4                GET T:ASSN ENTRY ADDR IN R8                 
         LW,R10   R7                GET DCB ADDRESS IN R10                      
*                                                                               
         LI,R9    0                 CURRENTLY DONT HAVE A FLAG WORD             
         LW,R3    ASNCTL            GET CONTROL TABLE SIZE                      
ASSN50   RES      0                                                             
         LW,R1    ASNCTL,R3         GET NEXT FIELD CONTROL WORD                 
         LI,R2    3                 UNPACK IT                                   
         LB,R0    R1,R2                                                         
         STW,R0   R4,R2                                                         
         BDR,R2   %-2                                                           
         LB,R4    R1                                                            
*        R4 IS LEFT-SHIFT TO ALIGN WITH DCB                                     
*        R5 IS FIELD LENGTH IN BITS                                             
*        R6 IS DCB WORD TO AFFECT                                               
*        R7 IS T:ASSN  WORD BEING ANALYZED                                      
         CW,R7    R9                                                            
         BE       %+3               ALREADY HAVE T:ASSN  WORD                   
         LW,R15   *R8,R7            GET NEW T:ASSN  WORD                        
         LW,R9    R7                SAVE INDEX OF CURRENT WORD                  
         LI,R14   0                                                             
         SLD,R14  0,R5              SHIFT NEXT FIELD INTO R14                   
         SLS,R15  1                 SHIFT OFF FLAG BIT                          
         BEV      ASSN60            B IF FIELD IS NOT ASSIGNED                  
         LW,R0    R14               GET FIELD VALUE                             
         LI,R1    1                                                             
         SLS,R1   0,R5                                                          
         AI,R1    -1                MASK TO STORE VALUE                         
         SLD,R0   0,R4              SHIFT TO NATURAL DCB ALIGNMENT              
         STS,R0   *R10,R6           STORE INTO DCB                              
ASSN60   RES      0                                                             
         BDR,R3   ASSN50            B TO ASSIGN NEXT FIELD                      
         PULL     R12                                                           
         B        *R12              RETURN                                      
*                                                                               
ASSNERR1 RES      0                 DCB RUNS OFF SEG END                        
         PULL     R4,R5                                                         
ASSNERR2 RES      0                                                             
         PULL     R12                                                           
         LW,R10   R4                SAVE T:ASSN POINTER FOR DIAG                
         LI,R9    DCBSMALL                                                      
         RDIAG                      GIVE WARNING                                
         B        *R12              RETURN                                      
*                                                                               
PT:ASSN  DATA     1                 1 SPECIAL ERROR CODE HANDLER                
         GEN,8,7,17  X'7D',0,ASSNERR2   FOR DCB TOO SMALL FOR ASSIGN CAL        
*                                                                               
         PAGE                                                                   
*                                                                               
*                                                                               
*        THE FOLLOWING TABLE CONTROLS THE REPRESENTATION                        
*        IN T:ASSN OF FIELDS TO BE ALTERED OTHER                                
*        THAN THOSE IDENTIFYING THE I/O MEDIUM.                                 
*                                                                               
*        WORD ZERO CONTAINS THE NUMBER OF ENTRIES.                              
*        EACH FOLLOWING WORD IS AN ENTRY WHICH DESCRIBES                        
*        THE LOCATION OF A DCB FIELD AND THE PACKING OF                         
*        ITS ASSIGNED VALUE IN T:ASSN.                                          
*                                                                               
*        BYTE 0 OF AN ENTRY CONTAINS THE LEFT-SHIFT COUNT                       
*        TO SHIFT A VALUE FROM RIGHT-ALIGNED (NORMAL)                           
*        TO DCB-ALIGNED (NATURAL) POSITION IN A WORD.                           
*        BYTE 1 IS THE BIT LENGTH OF THE FIELD CONCERNED.                       
*        BYTE 2 IS THE DCB WORD IN WHICH THE FIELD RESIDES.                     
*        BYTE 3 IS THE T:ASSN WORD IN WHICH THE VALUE IS PACKED.                
*                                                                               
*        THE ENTRIES FOR FIELD VALUES PACKED IN A SINGLE T:ASSN                 
*        WORD ARE GROUPED IN THE CONTROL TABLE ORDERED                          
*        INVERSE TO THE ORDER IN WHICH THE VALUES WILL BE LEFT-SHIFTED          
*        OUT OF THE T:ASSN WORD.                                                
*                                                                               
*        THIS TABLE MUST BE THE DUPLICATE OF THE ONE IN OCCI                    
*        WHICH IS USED TO PACK T:ASSN                                           
*                                                                               
ASNCTL   CNAME                                                                  
         PROC                                                                   
LF       EQU      %-ASNCTL                                                      
         DATA,1   AF(1),AF(2),AF(3),AF(4)                                       
         PEND                                                                   
*                                                                               
ASNCTL   DATA     ASNCTLE-ASNCTL-1                                              
*        ENTRIES FOR T:ASSN WORD 8                                              
ASNNRT   ASNCTL   24,8,1,8          NRT                                         
ASNBTD   ASNCTL   4,2,0,8           BTD                                         
ASNVFC   ASNCTL   8,1,0,8           VFC                                         
ASNDP    ASNCTL   9,1,0,8           D/P                                         
ASNDRC   ASNCTL   10,1,0,8          DRC                                         
ASNASC   ASNCTL   11,1,0,8          ASC                                         
ASNMOD   ASNCTL   17,1,0,8          MOD                                         
*        ENTRIES FOR T:ASSN WORD 9                                              
ASNRSZ   ASNCTL   17,15,3,9         RSZ                                         
ASNCTLE  RES      0                                                             
         TITLE    'LDROM'                                                       
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  LDROM                   *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 LOAD A SINGLE RELOCATABLE OBJECT MODULE                       
*                                                                               
*        ENTRY    R15 IS BAL REGISTER                                           
*                 T:DECL,T:MODL,T:FWD,T:FWDX POINTERS SET                       
*                 BAPEXEC POINTS TO LAST BYTE LOADED OR BA(FD OF                
*                 SEGMENT).                                                     
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
LDROM    RES      0                                                             
         STW,R15  ROMEXIT                                                       
         LI,R8    0                 FIRST RECORD OF MODULE                      
         STW,R8   BAPEXEC           WILL BE SET EXPLICITLY BY ORG               
         STW,R8   V:DECLNO                                                      
         RAX                        RESOLVE EXPRESSIONS                         
*                                                                               
LDROM2   RES      0                                                             
         ROMBYTE                                                                
         STW,R8   CBYTE                                                         
         LI,R9    0                                                             
         STW,R9   REPTCNT                                                       
         STW,R9   REPTFLAG                                                 15   
         STW,R8   R7                                                            
         CI,R7    X'13'                                                         
         BG       LDROM3                                                        
         LW,R8    T:CLBYT,R7        GET JUMP ADDRESS                            
LDROM22 BAL,R15   *R8               APPROPRIATE SERVICE ROUTINE                 
*                                   BAL, SO SERCICE ROUTINES CAN BE             
*                                   CALLED BY REPEAT ALSO.                      
         B        LDROM2            ALWAYS RETURN HERE EXCEPT 'END'             
*                                                                               
*                 CONTROL BYTES OVER  X'13' MUST BE SPECIALLY PROCESSED         
LDROM3   CI,R7    X'1E'             PSECT                                       
         BNE      LDROM31           B IF NOT                                    
         LI,R8    DECLNCON          TREAT AS NONSTD CSECT DECL                  
         B        LDROM22                                                       
LDROM31  RES      0                                                             
         CI,R7    X'40'             NOT PSECT                                   
         BL       ILLEGBF           ILLEGAL                                     
         SLS,R7   RIGHT*4                                                       
         CI,R7    4                                                             
         BNE      LDROM32                                                       
         LI,R8    LOADNBYT          CODE X'40'                                  
         B        LDROM22                                                       
LDROM32  CI,R7    5                                                             
         BNE      LDROM33                                                       
         LI,R8    LOADRLNG          CODE X'50' +                                
         B        LDROM22                                                       
LDROM33  CI,R7    6                 SPECIAL MODIFY BIN TYPE                     
         BNE      LDROM34                                                       
         LI,R8    MODEXP                                                        
         B        LDROM22                                                       
LDROM34  CI,R7    8                                                             
         BL       ILLEGBF                                                       
         LI,R8    LOADRSHT          CODE X'80' +                                
         B        LDROM22                                                       
*                                                                               
*                 CONTROL BYTE VECTOR TABLE    T:CLBYT                          
*                                                                               
*                 CONTROL BYTES 0-X'10'. TABLE ORDERED BY CODE NUMBER           
*                                                                               
T:CLBYT  DATA     PADDING           0                                           
         DATA     ILLEGBF           1  PASS 1 ONLY OR  CONVROMX-SOLVEX          
         DATA     ILLEGBF           2  AS 1                                     
         DATA     DECLX             3  DECLARE EXTERNAL- DEF                    
         DATA     ORIGIN            4                                           
         DATA     DECLX             5  DECLARE EXTERNAL-PREF                    
         DATA     DECLX             6  DECLARE EXTERNAL- SREF                   
         DATA     DEFNFLD           7  DEFINE FIELD                             
         DATA     FORWARD           ,  FORWARD REFERENCE DEFINITION             
         DATA     DECLDUMY          9  DECLARE DUMMY CONTROL SECTION            
         DATA     XDEFVALU          A  AS 1                                     
         DATA     DECLSCON          B  DECLARE STANDARD CONTROL SECTION         
         DATA     DECLNCON          C  DECLARE NON-STAND CONTROL SECTION        
         DATA     START             D  START ITEM                               
         DATA     END               E  END OF MODULE                            
         DATA     REPEAT            F  REPEAT FOLLOWING ITEM                    
         DATA     FORWARDH          10 FORWARD DEFINITION AND HOLD              
         DATA     DEBUGTYP          11 (UTS DEBUG)                              
         DATA     DEBUGINT          12 (UTS DEBUG)                              
         DATA     DEBUGSYM          13 (UTS DEBUG)                              
         PAGE                                                                   
*                                                                               
*                 THE FOLLOWING SUBROUTINES  SERVICE                            
*                                                                               
*                 OBJECT MODULE ITEMS                                           
*                                                                               
         TITLE    'ILLEGAL BINARY ITEM'                                         
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  ILLEGBF                 *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 ABORTS ON A BINARY LOAD ITEM WHICH SHOULD                     
*                                                                               
*                 HAVE BEEN PROCESSED IN PASS 1 OR BY CONVROMX- SOLVEX.         
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
ILLEGBF  RES      0                                                             
         LI,R9    PROGERR                                                       
         RDIAG                                                                  
         RABORT                                                                 
         TITLE    'PADDING - CODE 0'                                            
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  PADDING                 *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      0                                           
*                                                                               
*                 CONTROL BYTE      00000000                                    
*                                                                               
*                 DESCRIPTION       BYPASS THIS BYTE                            
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
PADDING  B        *R15              RETURN FOR NEXT BYTE                        
         TITLE    'DECLARE EXTERNAL -DEF,PREF,SREF- CODE 3'                     
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  DECLX                   *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      3                                           
*                                                                               
*                 CONTROL BYTE      00000011                                    
*                                                                               
*                 DESCRIPTION       DECLARE EXTERNAL DEFINITION,                
*                                   PRIMARY REFERENCE, OR SECONDARY             
*                                   REFERENCE.                                  
*                                                                               
*                                   INCREMENT DECLARATION  COUNTER              
*                                                                               
*                                   OTHER PROCESSING IN PASS1.                  
*                                                                               
*                 USES              ROMBYTES                                    
DECLX    RES      0                                                             
         STW,R15  DECRET            RETURN                                      
         MTW,1    V:DECLNO                                                      
         ROMBYTE                    SYMBOL LENGTH IN BYTES.                     
         LW,R9    R8                                                            
         BEZ      DEC3                                                          
         ROMBYTES                   SKIP OVER EBCDIC                            
DEC3     B        *DECRET                                                       
         TITLE    'ORIGIN - CODE 4'                                             
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  ORIGIN                  *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      4                                           
*                                                                               
*                 CONTROL BYTE      00000100                                    
*                                                                               
*                 DESCRIPTION       SET EXECUTION ORIGIN                        
*                                                                               
*                                                                               
*                                   SETS  BAPEXEC,THE CURRENT EXECUTION         
*                                   LOCATION.                                   
*                                                                               
*                                                                               
*                                                                               
*                                                                               
ORIGIN   RES      0                                                             
         STW,R15  ORIRET                                                        
         EXPRESSN                   RETURNS VALUE FROM MODIFY,ROM EXP.          
         STW,R9   BAPEXEC           SET NEW LOAD-LOCATION ORIGIN                
         CI,R8    D                 D=1,                                        
         BAZ      ORI7              UNDEFINED                                   
         CI,R8    V                                                             
         BAZ      ORI7              NOT A VALUE                                 
         CI,R8    C                                                             
         BANZ     ORI85                                                         
*                                                                               
*                 ORIGIN IN R9 IS A BITE ADDRESS                                
*                                                                               
         CW,R9    FBAEXEC                                                       
         BL       ORI8              < LOWER LIMIT THIS SEGMENT                  
         CW,R9    LBAEXEC                                                       
         BGE      ORI8              >= UPPER LIMIT THIS SEGMENT                 
         B        *ORIRET                                                       
ORI7     LI,R9    UNDEFORG          ORIGIN IS AN UNDEFINED VALUE                
         RDIAG                      ABORTS AFTER DIAGNOSTIC                     
ORI8     SLS,R9   RIGHT*2                                                       
ORI85    LW,R8    R9                                                            
         LI,R9    ILLORG                                                        
         RDIAG                      CONTINUE AFTER MESSAGE                      
         B        *ORIRET           RETURN                                      
         TITLE    ' DEFINE FIELD - CODE 7'                                      
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  DEFNFLD                 *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      7                                           
*                                                                               
*                 CONTROL BYTE      00000111                                    
*                                                                               
*                 DESCRIPTION       DEFINES A BIT FIEDLD,AND  ADDS A            
*                                   BIT STRING DEFINED BY A FOLLOWING           
*                                   EXPRESSION INTO THAT FIELD.                 
*                                                                               
*                                   CHECKS FOR OVERFLOW AND TRUNCATES.          
*                                                                               
*                                                                               
*                                                                               
*                                                                               
DEFNFLD  RES      0                                                             
         STW,R15  DEFRET                                                        
         ROMBYTE                                                                
         LW,R2    R8                FIELD LOCATION CONSTANT                     
         AI,R2    -256              TO DISPLACEMENT                             
         ROMBYTE                                                                
         LW,R3    R8                FIELD LENGTH IN BITS                        
         EXPRESSN                                                               
         CI,R9    0                                                             
         BE       DEF5              USELESS TO ADD IN 0 VALUE                   
         CI,R6    0                 WAS EXPRESSION RESOLVED                     
         BE       DEF3              YES                                         
         B        DEF5              RETURN                                      
DEF3     CI,R8    C                                                             
         BANZ     DEF4              CONSTANT, DONT ALTER                        
         LCW,R5   R10                                                           
         SAS,R9   0,R5                                                          
DEF4     LW,R8    R9                                                            
         BEZ      DEF5                                                          
         LW,R6    R3                                                            
         LW,R7    R2                                                            
         STORBITS                   R8 CONTAINS 32-BIT VALUE TO BE ADDED        
*                                   TO FIELD DEFINED BY R2,R3                   
DEF5     B        *DEFRET                                                       
         TITLE    ' DEFINE FORWARD,FORWARD AND HOLD - CODES 8,10'               
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  FORWARD,FORWARDH        *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      8,10                                        
*                                                                               
*                 CONTROL BYTE      0000100,00010000                            
*                                                                               
*                 DESCRIPTION       DEFINE FORWARD REFERENCE(AND HOLD)          
*                                                                               
*                                   PROCESSED IN PASS 1                         
*                                                                               
*                                   PASS OVER ITEM.                             
*                                                                               
*                                                                               
*                                                                               
*                                                                               
FORWARDH RES      0                                                             
FORWARD  RES      0                                                             
         STW,R15  FORRET            RETURN                                      
         LI,R9    2                 2 BYTES OF FORWARD NO.                      
         ROMBYTES                                                               
         SKIPX                      SKIP OVER VALUE EXPRESSION                  
         B        *FORRET                                                       
         TITLE    'DECLARE DUMMY SECTION - CODE 9'                              
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  DECLDUMY                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      9                                           
*                                                                               
*                 CONTROL BYTE      00001001                                    
*                                                                               
*                 DESCRIPTION       DECLARE A DUMMY SECTION (DSECT)             
*                                                                               
*                                   AND GIVE ITS SIZE                           
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
DECLDUMY RES      0                                                             
         STW,R15  DECDRET           RETURN                                      
         LW,R2    V:DECLNO                                                      
         LI,R9    4                                                             
         CI,R2    256                                                           
         BL       %+2                                                           
         LI,R9    5                                                             
         ROMBYTES                                                               
         MTW,1    V:DECLNO          COUNT CURRENT DECLARATION                   
         B        *DECDRET                                                      
         TITLE    'DEFINE VALUE OF EXTERNAL DEFINITION - CODE A'                
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  XDEFVALU                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      A                                           
*                                                                               
*                 CONTROL BYTE      00001010                                    
*                                                                               
*                 DESCRIPTION       DEFINE THE VALUE OF AN EXT%RNAL             
*                                   DEFINITION.                                 
*                                                                               
*                                   1-2 BYTE NAME NUMBER IS                     
*                                   FOLLOWED BY EXPRESSION TO                   
*                                   DEFINE VALUE.                               
*                                                                               
*                                                                               
*                                                                               
XDEFVALU RES      0                                                             
         STW,R15  XDEFRET           RETURN                                      
         LW,R2    V:DECLNO                                                      
         CI,R2    256                                                           
         BL       %+2                                                           
         ROMBYTE                    >255;2-BYTE NAME NUMBER                     
         ROMBYTE                    <256;1-BYTE NAME NUMBER                     
         SKIPX                      FOLLOWING  EXPRESSION                       
         B        *XDEFRET                                                      
         TITLE    'DECLARE STANDARD CONTROL SECTION - CODE B'                   
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  DECLSCON                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      B                                           
*                                                                               
*                 CONTROL BYTE      00001011                                    
*                                                                               
*                 DESCRIPTION       DECLARE A STANDARD CONTROL SECTION          
*                                                                               
*                                   (SECTION 0) AND GIVE ITS SIZE.              
*                                                                               
*                                   PROCESSED IN PASS 1.                        
*                                                                               
*                                   PASS 3 BYTES                                
*                                                                               
*                                                                               
DECLSCON RES      0                                                             
         STW,R15  DECLSRET          RETURN                                      
         LI,R9    3                                                             
         ROMBYTES                                                               
         B        *DECLSRET                                                     
         TITLE    'DECLARE NON-STANDARD CONTROL SECTION - TYPE C'               
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  DECLNCON                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      C                                           
*                                                                               
*                 CONTROL BYTE      00001100                                    
*                                                                               
*                 DESCRIPTION       DECLARE A CONTROL SECTION WHOSE             
*                                                                               
*                                   NAME NUMBER IS >0.                          
*                                                                               
*                                   ALLOCATED IN PASS 1                         
*                                                                               
*                                   INCREMENT V:DECLNO                          
*                                                                               
*                                   SET BAPEXLOC=FDA OF SECTION                 
DECLNCON RES      0                                                             
         STW,R15  DECLNRET          RETURN                                      
         MTW,1    V:DECLNO          UP YOUR CURRENT DECLARATION NUMBER          
         LI,R9    3                                                             
         ROMBYTES                   PASS OVER 3-BYTE SIZE                       
         LI,R2    0                 C=0,RR=00(BYTE)                             
         LW,R3    V:DECLNO          DECLARATION                                 
         GETADR                     RETURNS VALUE IN  R10                       
         STW,R10  BAPEXEC           IMPLICIT ORG 0                              
         B        *DECLNRET                                                     
         TITLE    ' DEFINE START ITEM - CODE D'                                 
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  START                   *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      D                                           
*                                                                               
*                 CONTROL BYTE      00001101                                    
*                                                                               
*                 DESCRIPTION       DEFINE A START ADDRESS (TRANSFER            
*                                                                               
*                                   ADDRESS) FOR THIS SEGMENT.                  
*                                                                               
*                                   IF VALUE IS NON-ZERO, OVERRIDE              
*                                                                               
*                                   ANY PREVIOUS START ADDRESS EXCEPT           
*                                                                               
*                                   THAT SET BY START KEYWORD ON CC.            
START    RES      0                                                             
         STW,R15  STARET            RETURN                                      
         LW,R2    FBA:SEG                                                       
         AW,R2    BDP:SEG           BA(CURRENT T:SEG ENTRY)                     
         SLS,R2   RIGHT*2           WA(  DITTO)                                 
         LW,R8    7,R2              START ADDRESS ENTRY                         
         CI,R8    R                                                       20    
         BANZ     STA7              START ADDR  INPUT ON CONTROL CARD           
*                                                                               
*                 WE ARE GOING TO GET THE START ADDRESS FROM                    
*                 THE BINARY CARD                                               
*                                                                               
         CONVROMX                   EXPRESSION IN START ITEM                    
         SOLVEX                     VALUE IN R9, KEY IN R8                      
         CI,R8    V                 VALUE/EXPRESSION                            
         BANZ     STA3              VALUE - OK                                  
         B        STA74             UNDEFINED EXPRESSION                        
STA3     CI,R9    0                                                             
         BE       STA9              FORGET 0 VALUE                              
         CW,R9    FBAEXEC                                                       
         BL       STA8              OUTSIDE LOWER LIMIT                         
         CW,R9    LBAEXEC                                                       
         BGE      STA8              OUTSIDE UPPER LIMIT                         
*                                   CHECK FOR CONSTANT?                         
         SLS,R9   RIGHT*2           BA TO WA                                    
         LW,R8    R9                                                            
STA4     AND,R8   X:1FFFF                                                       
         LI,R9    X'1FFFF'+E        RESET E BIT                                 
         STS,R8   7,R2              OVERRIDE PREVIOUS.START IF NOT              
*                                   FROM CC.                                    
STA9     B        *STARET                                                       
*                                                                               
*                 START ADDRESS INPUT ON CC AS EXPRESSION.                      
*                 RESOLVE,INSERT  AND RESET  E-BIT                              
*                                                                               
STA7     SKIPX                      SKIP EXPRESSION-DEFINED ON CC         20    
         B        STA9                                                    20    
STA74    LI,R9    UNDEFST           UNDEF SYMBOL IN START                       
         RDIAG                                                                  
STA745   LI,R9    0                 USE ZERO VALUE                              
         B        STA3                                                          
STA8     LW,R8    R9                                                            
         SLS,R8   RIGHT*2           WA                                          
         LI,R9    ILLSTRT           ILLEGAL START ITEM - OUT RANGE              
         RDIAG                                                                  
         B        STA4                                                          
         TITLE    ' MODULE END - CODE E'                                        
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  END                     *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      E                                           
*                                                                               
*                 CONTROL BYTE      00001110                                    
*                                                                               
*                 DESCRIPTION       END OF MODULE                               
*                                                                               
*                                   SEVERITY LEVEL SET IN PASS 1                
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
END      RES      0                                                             
         ROMBYTE                    OVER SEVERITY LEVEL                         
         B        *ROMEXIT          SPECIAL EXIT FOR END OF ROM                 
         TITLE    '  REPEAT - CODE F'                                           
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  REPEAT                  *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      F                                           
*                                                                               
*                 CONTROL BYTE      00001111                                    
*                                                                               
*                 DESCRIPTION       SPECIFIES THE NUMBER OF TIMES               
*                                                                               
*                                   THE ITEM FOLLOWING IS TO BE                 
*                                                                               
*                                   REPEATED.                                   
*                                                                               
*                                   THE ITEM IS MOVED TO A NEW BUFFER           
*                                                                               
*                                   FOR THE REPEAT.                             
REPEAT   RES      0                                                             
         STW,R15  REPRET                                                        
         ROMBYTE                                                                
         SLS,R8   LEFT*8                                                  20    
         STW,R8   REPTCNT           HIGH BYTE                             20    
         ROMBYTE                                                           15   
         AWM,R8   REPTCNT                                                 20    
         LW,R9    REPTCNT                                                 20    
         BLEZ     RPT8              BAD REPEAT COUNT                       15   
         CI,R9    1                 COUNT OF 1 IS SPECIAL                  15   
         BE       RPT9              JUST PROCESS FOLLOWING ITEM            15   
*                 PROCESS PROPER ITEM TO FOLLOW                            15   
         ROMBYTE                    CONTROL BYTE                           15   
         STW,R8   CBYTE                                                     15  
         STW,R8   R7                                                       15   
         B        LDROM3            PROCESS LOAD ITEM                      15   
RPT8     LI,R9    PROGERR                                                       
         RDIAG                                                                  
RPT9     B        *REPRET                                                       
         TITLE    '****  DEBUGTYP  ****'                                        
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  DEBUGTYP                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      11                                          
*                                                                               
*                 CONTROL BYTE      00010001                                    
*                                                                               
*                 DESCRIPTION       TYPE INFO FOR EXTERNAL SYMBOL               
*                                                                               
*                                   (UTS DEBUG)                                 
*                                                                               
*                                                                               
*                                   LOADER DOES NOT PROCESS ITEM                
*                                                                               
*                                                                               
*                                                                               
DEBUGTYP RES      0                                                             
         STW,R15  RETURN                                                        
         LI,R9    2                 CONTROL BYTE+ 1 BYTE TYPE AND RES           
         LW,R10   V:DECLNO                                                      
         CI,R10   256               + 1-2 BYTE DECL NO.                         
         BL       %+2                                                           
         AI,R9    1                 2 BYTE                                      
         ROMBYTES                   PASS  OVER ITEM                             
         B        *RETURN                                                       
         TITLE    '****  DEBUGINT ****'                                         
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  DEBUGINT                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      12                                          
*                                                                               
*                                                                               
*                 CONTROL BYTE      00010010                                    
*                                                                               
*                                                                               
*                 DESCRIPTION       TYPE  AND EBCDIC INFORMATION                
*                                   FOR INTERNAL SYMBOL                         
*                                   (UTS DEBUG)                                 
*                                                                               
*                                                                               
*                                                                               
DEBUGINT RES      0                                                             
         STW,R15  RETURN                                                        
         ROMBYTE                    TYPE AND RES                                
         ROMBYTE                    NO OF CHAR OF EBCDIC                        
         STW,R8   R9                                                            
         ROMBYTES                   PASS  EBCDIC                                
         SKIPX                      SKIP EXPRESSION FOLLOWING.                  
         B        *RETURN                                                       
         TITLE    '****  DEBUGSYM  ****'                                   15   
*                                                                          15   
*                                                                          15   
*        ***************************                                       15   
*        *                          *                                      15   
*        *                          *                                      15   
*        *  DEBUGSYM                *                                      15   
*        *                          *                                      15   
*        *                          *                                      15   
*        ***************************                                       15   
*                                                                          15   
*                                                                          15   
*                 CONTROL TYPE      13                                   17     
*                                                                          15   
*                 CONTROL BYTE      00010011                             17     
*                                                                          15   
*                 DESCRIPTION       DEBUG SYMBOL DECLARATION               15   
*                                                                          15   
*                                   PASSED OVER AT PRESENT BY              15   
*                                   RBM LOADER                             15   
*                                                                          15   
*                                                                          15   
DEBUGSYM STW,R15  DEBUGRET                                                 15   
         ROMBYTE                    SYMBOL LENGTH                          15   
         AI,R8    2                 PLUS DECL/FWD NUMBER                   15   
         STW,R8   R9                                                       15   
         ROMBYTES                                                          15   
         B        *DEBUGRET                                                15   
         TITLE    ' SPECIAL MODIFY EXPRESSION  '                                
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  MODEXP                  *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      60                                          
*                                                                               
*                 CONTROL BYTE      01100000                                    
*                                                                               
*                 DESCRIPTION       SPECIAL BINARY FORMAT FOR                   
*                                   MODIFY INVOLVING EXTERNAL SYMBOLS           
*                                                                               
*                                   LOOKS LIKE  STANDARD EXPRESSION             
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
MODEXP   STW,R15  RETURN                                                        
         EXPRESSN                                                               
         CI,R6    0                                                             
         BNE      MOD2              UNRESOLVED EXPRESSION,USE ZERO              
         LCW,R6   R10               TRUE RESOLUTION IN R10                      
         CI,R8    C                                                             
         BANZ     %+2               NO RESOLUTION FOR CONSTANT                  
         SAS,R9   0,R6                                                          
MOD2     LI,R6    32                WORD                                        
         LI,R7    0                                                             
         LW,R8    R9                DATA TO BE STORED IN R8.                    
         STORBITS                   BAPEXEC POINTS TO LOC TO BE MODIFIED        
         B        *RETURN                                                       
         TITLE    ' LOAD ABSOLUTE N BYTES - CODE 40'                            
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  LOADNBYT                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      40+                                         
*                                                                               
*                 CONTROL BYTE      0100NNNN                                    
*                                                                               
*                 DESCRIPTION       LOAD NNNN BYTES OF DATA AT THE              
*                                                                               
*                                   CURRENT  LOCATION COUNTER VALUE             
*                                                                               
*                                   THE NNNN BYTES OF DATA FOLLOW.              
*                                                                               
*                 USES              STORNBYT                                    
*                                                                               
*                                                                               
LOADNBYT RES      0                                                             
         STW,R15  LNBRET                                                        
         LW,R5    CBYTE             CONTROL BYTE                                
         AND,R5   X:F               NUMBER OF BYTES                             
         BNEZ     %+2                                                           
         LI,R5    16                ZERO=16                                     
         STORNBYT                                                               
         B        *LNBRET                                                       
         TITLE    ' LOAD RELOCATABLE - LONG FORM - CODE 50'                     
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  LOADRLNG                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      50+                                         
*                                                                               
*                 CONTROL BYTE      0101QCRR                                    
*                                                                               
*                 DESCRIPTION       A 4-BYTE DATA ITEM IS LOADED ON A           
*                                   WORD BOUNDARY WITH RELOCATION ON THE        
*                                   NAME NUMBER FOLLOWING.                      
*                                   C=0 NAME NUMBER IS DECLARATION              
*                                   C=1 NAME NUMBER IS FORWARD                  
*                                   Q=0,2-BYTE,Q=1,1-BYTE NAME NUMBER           
*                                   RR IS DESIRED RESOLUTION                    
*                                                                               
*                                                                               
LOADRLNG RES      0                                                             
         STW,R15  LOARET                                                        
         LW,R2    CBYTE                                                         
         LI,R3    0                 WILL BE FWD OR DECL NO                      
         ROMBYTE                                                                
         CI,R2    Q                 1-2 BYTE NAME NO                            
         BANZ     LLNG3             1 BYTE                                      
         SLS,R8   LEFT*8            2 BYTE                                      
         STW,R8   R3                UPPER ORDER BYTE                            
         ROMBYTE                                                                
LLNG3    AW,R3    R8                LOW ORDER BYTE                              
         B        LOADADR                                                       
         TITLE    ' LOAD RELOCATABLE SHORT FORM - CODE 80'                      
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  LOADRSHT                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      80+                                         
*                                                                               
*                 CONTROL BYTE      1CDDDDDD                                    
*                                                                               
*                 DESCRIPTION       LOAD 4 BYTES OF DATA ON A WORD              
*                                   BOUNDARY AND RELOCATE BY DECL/FWD           
*                                   DESIGNATED BY DDDDDD.                       
*                                   C DENOTES  DECL/FWD                         
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
LOADRSHT RES      0                                                             
         STW,R15  LOARET                                                        
         LW,R3    CBYTE             GET DECL/FWD NUMBER.                        
         AND,R3   X:3F              6 BITS                                      
         LW,R2    CBYTE                                                         
         SLS,R2   RIGHT*6           STRIP DECL NO                               
         SLS,R2   LEFT*2                                                        
         AI,R2    2                 WORD RESOLUTION                             
         B        LOADADR                                                       
         TITLE    ' LOAD  ON WORD BOUNDARY AND RELOCATE'                        
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  LOADADR                 *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CONTROL TYPE      NONE                                        
*                                                                               
*                 CONTROL BYTE      NONE                                        
*                                                                               
*                 DESCRIPTION       CALLED BY LOADRLNG, LOADRSHT                
*                                   TO LOAD 4 BYTES ON A WORD                   
*                                   BOUNDARY AND RELOCATE ON A                  
*                                   DECLARATION OR FORWARD.                     
*                                   R2 CONTAINS  CRR RIGHT JUSTIFIED            
*                                   R3 CONTAISNS  DECL/FWD NUMBER               
*                                   BAP:ROM POINTS TO FBA-1 OF DATA             
*                                                                               
*                                   EXIT  *LOARET                               
LOADADR  RES      0                                                             
         LW,R4    BAPEXEC                                                       
         AND,R4   X:3                                                           
         BEZ      LADR2             ALREADY  ROUNDED TO WA                      
*                                                                               
*                 STORE ZEROS UP TO  NEXT  WORD BOUNDARY                        
*                 R4 CONTAINS CURRENT BYTE OFFSET                               
         LI,R7    0                 BIT DISPLACEMENT                            
         LI,R8    0                 VALUE                                       
         LI,R6    4                                                             
         SW,R6    R4                BYTE RESIDUAL                               
         SLS,R6   LEFT*2            BIT RESIDUAL                                
         STORBITS                   WILL INSERT ZERO BYTES                      
*                                   AND ADJUST BAPEXEC TO                       
*                                   NEXT WORD BOUNDARY.                         
LADR2    GETADR                     INTO R10 WITH RESOLUTION                    
*                                   OF RR IN R2(30,31)                          
         MTW,0    FL:ADRER          IS ERROR FLAG SET      /SIG7-3766/*C5733    
         BEZ      LADR25              NO                   /SIG7-3766/*C5733    
         LOADERR                    SET SEVERITY LEVEL                          
         LI,R10   0                                                             
LADR25   LI,R3    4                 4 BYTES OF DATA                         13  
         LI,R4    0                                                         13  
LADR3    SLS,R4   LEFT*8            ACCUMULATE IN 4                         13  
         ROMBYTE                                                            13  
         AW,R4    R8                                                        13  
         BDR,R3   LADR3                                                     13  
         LW,R8    R4                                                        13  
         LW,R9    X:7FFFF           19 BIT MASK                                8
         AND,R2   X:3               R2 HAS RR FOR ADDR PORTION                 8
         LCW,R2   R2                RIGHT SHIFT                                8
         SLS,R9   0,R2              SET MASK TO PROPER RESOLUTION              8
         STW,R9   R11               AND SAVE IN R 11 ALSO                      8
         LI,R12   0                                                             
         STS,R8   R12               OFFSET                                     8
         AW,R10   R12               RELOCATION                                 8
         STS,R10  R8                REPLACE IN WORD FIELD                   14  
LADR35   LI,R6    32                                                        14  
         LI,R7    0                                                             
         STORBITS                                                              8
         MTW,-1   REPTCNT                                                  15   
         BGZ      LADR35                                                   15   
         B        *LOARET                                                      8
         TITLE    ' EVALUATE EXPRESSION FROM ROM OR MODIFY '                    
EXPRESSN MTW,0    FLMODIFY                                                      
         BEZ      EXPR2             ROM                                         
         LW,R5    BAP:ROM           MOD- EXP NOT IN B X FOR SOLVEY              
         AI,R5    1                 FBA OF EXP                                  
         XBC                        LENGTH OF EXP INTO 6                        
         AWM,R6   BAP:ROM           SOLVEX DOESNT BUMP BAP:ROM                  
         B        %+2                                                           
EXPR2    CONVROMX                                                               
         SOLVEX                                                                 
         B        *R12                                                          
         TITLE    ' GETADR'                                                     
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  GETADR                  *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 GET THE ADDRESS OR CONSTANT VALUE GIVEN                       
*                 A DECLARATION OR FORWARD NUMBER.                              
*                                                                               
*        ENTRY    R2  C-BIT (29)    =0  DECLARATION                             
*                                   =1  FORWARD                                 
*                     RR-BITS(30,31)ADDRESS RESOLUTION OF VALUE                 
*                                   IGNORED IF CONSTANT                         
*                 R3 FORWARD OR DECL  NUMBER                                    
*                 R13 IS BAL REGISTER                                           
*                                                                               
*        EXIT     R10 CONTAINS CONSTANT OR ADDRESS IN CORRECT RESOLUTION        
*                                                                               
*                                                                               
         BOUND    4                                                             
GETADR   RES      0                                                             
         PUSH     15,9                                                          
         LI,R4    0                                        /SIG7-3766/*C5733    
         STW,R4   FL:ADRER          INITIALIZE ERROR FLAG  /SIG7-3766/*C5733    
         LW,R4    R2                                                            
         AND,R4   X:3               RR BITS                                     
         LCW,R4   R4                                                            
         CI,R2    CF                DECL OR FORWD BIT                           
         BAZ      GETA5             DECLARATION                                 
*                                                                               
         LW,R8    R3                                                            
         SLS,R8   RIGHT*8           FROWARD NO IN 8,9                           
         LW,R9    R3                                                            
         AND,R9   X:FF                                                          
         SERCHFWD                   GET ENTRY ADDRESS                           
         CI,R5    0                                                             
         BE       GETA25                                                        
*                                   NOTE: DOES NOT DETECT UNDEFINED,            
*                                   NON-EXTERNAL SYMBOL EXPRESSED               
*                                   AS A FORWARD                                
         AI,R5    3                 STEP TO VALUE                               
         LB,R9    0,R5                                                          
         CI,R9    V                 VALUE BIT                                   
         BANZ     GETA3             VALUE                                       
         B        GETA27            DON'T OUTPUT MESSAGE NOW                    
GETA2    LI,R9    UNDEFRLC          ERROR:UNDEFINED RELOCATION BIAS             
         RDIAG                                                                  
         MTW,1    FL:ADRER                                                      
         B        GETA27                                                        
GETA25   RES      0                                                             
         LI,R8    TY                                                            
         AND,R8   R9                MASK DECL TYPE                              
         CI,R8    SREF                                                          
         BE       GETA27            B IF SREF                                   
         MTW,1    FL:ADRER          SET ERROR FLAG                              
GETA27   RES      0                                                             
         LI,R10   0                                                             
         B        GETA9             USE ZERO VALUE                              
*                                                                               
*                                                                               
GETA3    4BYTES                     GET VALUE                                   
         STW,R8   R10                                                           
         CI,R9    C                 CONTROL BYTE IN 9                           
         BANZ     GETA9             CONSTANT                                    
         SLS,R10  0,R4              RR BITS ARE IN 4 - COMPLEMENTED             
GETA9    PULL     15,9                                                          
         B        *R13                                                          
*                                                                               
GETA5    MW,R3    NBE:DECL          DECLARATION  ENTRY                          
         AW,R3    FBA:DECL          ACTUAL BYTE ADDRESS                         
         STW,R3   R5                                                            
         TBENTRY                    ENTRY BA                                    
         LB,R9    0,R5              CONTROL BYTE                                
         CI,R1    T:VALUE                                                  15   
         BE       GETA7                                                    15   
         CI,R1    T:PUBVAL                                                 15   
         BE       GETA7             BOTH TABLES IN SAME FORMAT             15   
         CI,R1    T:DCB                                                    15   
         BE       GETA52                                                   15   
         CI,R1    T:CSECT                                                  15   
         BNE      GETA2             NOT RECOGNIZABLE TYPE                  15   
GETA52   CI,R9    V                 VALUE BIT                              15   
         BANZ     GETA55            VALUE                                       
         CI,R1    T:CSECT           NOT VALUE - CHECK IF                        
         BE       GETA2             YES - RELOCATION NOT FEASIBLE               
         B        GETA25            NO -USE ZERO                                
GETA55   AI,R5    -1                                                       15   
         4BYTES   GET VALUE OR CONSTANT                                    15   
         AND,R8   X:7FFFF           RETURNED AS BYTE DISP                  15   
         STW,R8   R10                                                           
         CI,R9    C                                                             
         BANZ     GETA9             CONSTANT VALUE                              
         SLS,R10  0,R4              RR COMPLEMENTED IN R4                       
GETA6    B GETA9                                                                
GETA7    CI,R9    V                                                        15   
         BAZ      GETA25            NO VALUE                               15   
         AI,R5    1                 IN SYNC WITH OTHER FORMAT              15   
         B        GETA55                                                   15   
         TITLE    '****  REORGWA  ****'                                         
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  REORGWA                 *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 CHECKS BYTE ADDRESS IN R6 OF TABLES                   22      
*                 BEFORE THEY ARE READ IN TO DETERMINE OVERLAP                  
*                 INTO WORK AREA.                                               
*                                                                               
*                 IF THE TABLES WOULD LEAVE A WORK AREA < 2 GRANULES,           
*                 A TABLE OVERFLOW ABORT IS TAKEN.                              
*                                                                               
*                 IF RESIDENT GRANULES WOULD LIE WITHIN THE PROPOSED            
*                 TABLE AREAS, OFFENDING GRANULES ARE WRITTEN TO                
*                 THE RAD.                                                      
*                                                                               
*        ENTRY    R13 IS BAL REGISTER                                           
*                                                                               
REORGWA  RES      0                                                             
         PUSH     5,7                                                           
         SLS,R6   RIGHT*2           WA - UPPER LIMIT WORK AREA                  
         SW,R6    NWEGRAN           WA - UPPER GRANULE ADDR IN WA               
         LW,R5    *FWAGRAN          COUNT OF GRANULES                           
         LW,R7    FWAWA                                                         
         AW,R7    NWEGRAN                                                       
         CW,R7    R6                                                            
         BGE      REO7              NOT 2 GRANULES AVAIL - ABORT                
         LI,R7    X'1FFFF'                                                      
REO33    CS,R6    *FWAGRAN,R5                                                   
         BG       REO4              GRANULE LIES  < FBA:DECL                    
         WRITGRAN                                                               
REO4     BDR,R5   REO33                                                         
         B        REO9                                                          
*                                                                               
*                 CODE TO FILL HOLES INSTEAD OF JUST WRITING OUT                
*                 WOULD BE GOOD                                                 
*                                                                               
*                 ALSO CODE TO REORDER GRANULES IN NA WOULD BE GOOD             
REO7     LI,R9    BACKSIZE                                                  14  
         RDIAG                                                                  
         RABORT                                                                 
REO9     PULL     5,7                                                           
         B        *13                                                           
         TITLE    ' STORBITS'                                                   
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  STORBITS                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 ADD THE GIVEN BIT STRING INTO MEMORY                          
*                                                                               
*        ENTRY    R6 CONTAINS THE FIELD SIZE IN BITS (<256)                     
*                 R7 CONTAINS THE DISPLACEMENT OF BIT 1 OF FIELD                
*                    (R7 <=0, >-256)                                            
*                 R8 CONTAINS THE BIT STRING TO BE ADDED - RIGHT JUST           
*                 BIT 0 OF(BAPEXLOC) IS CURRENT BIT POSITION                    
*                                                                               
*                                                                               
*        EXIT     IF R7=0 ON ENTRY, INTEGRAL NO OF BYTES COVERED BY             
*                 FIELD SIZE IS ADDED TO BAPEXLOC.                              
*                                                                               
*                                                                               
         BOUND    4                                                             
STORBITS RES      0                                                             
         PUSH     2,15                                                          
         LW,R5    BAPEXEC                                                 16    
         CW,R5    FBA:LIM                                                       
         BL       STORERR                                                       
         CW,R5    FBAEXEC                                                 16    
         BL       STORERR           OUTSIDE LIMIT                         16    
         CW,R5    LBAEXEC                                                 16    
         BLE      STOR00                                                        
STORERR  B        STOR9             CONTINUE PROCESSING..THE                    
*                                    APPROPRIATE WARNING WAS OUTPUT.            
STOR00   STW,R6   BITSIZFD          BIT SIZE OF FIELD                     16    
         STW,R7   BITDISFD          BIT DISPLZCEMENT OF FIELD                   
         MTW,0    R7                                                            
         BGZ      STOR1                                                         
         BEZ      STOR7                                                   20    
         LCW,R7   R7                POS BIT DISP                               8
         AI,R7    -1                                                            
         AND,R7   X:7                                                           
         STW,R7   BITOFFST                                                     8
         LCW,R7   BITDISFD                                                     8
         AW,R7    BITSIZFD                                                     8
         AI,R7    -1                                                           8
         LCW,R7   R7                                                           8
         STW,R7   BITDISFD                                                     8
         B        STOR2                                                        8
STOR1    LI,R9    PROGERR           POSITIVE DISP IN ERROR                     8
         RDIAG                                                                  
STOR2    LW,R6    R7                                                            
         SAD,R6   RIGHT*32                                                      
         CI,R7    0                                                             
         BE       STOR32            0 DISPLACEMENT                              
         DW,R6    D:8               GET NO OF BYTES                             
         CI,R6    0                                                             
         BE       STOR32            EVEN NO OF BYTES                            
STOR3    AI,R7    -1                NEGATIVE                                    
STOR32   AW,R7    BAPEXEC           ACTUAL BYTE EXEC LOCATION                  8
*                                   OF BEGINNING OF FIELD                       
         SW,R7    FBAEXEC                                                       
         STW,R7   BYTDISSG          BYTE DISPLACEMENT IN SEGNENT                
         LI,R6    0                                                             
         DW,R6    NBEGRAN           GET GRANULE DISP IN SEG                     
         AI,R7    1                 IN NEXT GRAN                                
         STW,R6   BYTDISGR          BYTE DISPL IN GRANULE                       
STOR34   STW,R7   R3                FIRST GRANULE TO GET                        
         LW,R7    BITSIZFD                                                      
         AW,R7    BITOFFST                                                      
         AI,R7    7                                                             
         DW,R7    D:8                                                           
         STW,R7   BYTSIZFD                                                      
         AW,R7    BYTDISSG                                                      
         LI,R6    0                                                             
         DW,R6    NBEGRAN                                                       
         CI,R6    0                                                             
         BE       %+2                                                           
         AI,R7    1                                                             
         STW,R7   R4                GRANULE CONTAINING END OF FIELD             
         CW,R7    R3                RO=R4?                                      
         BNE      %+2                                                           
         LI,R4    0                 SAME GRANULE                                
*                                                                               
*                                   GRANULES NECESSARY TO LOAD THIS             
*                                   DATA IN R3 AND R4.                          
*                                                                               
         REAWA                      SET IT UP                                   
         LW,R7    *FWAGRAN,R3                                                   
         AND,R7   X:1FFFF           LOCATION OF GRANULE IN R3                   
         SLS,R7   LEFT*2                                                        
         AW,R7    BYTDISGR          ACTUAL BYTE ADDR FOR STORE                  
         LW,R6    BITDISFD                                                      
         BLZ      STOR5             INSERT ; DEFINE FIELD ITEM                  
         BEZ      STOR38                                                        
         LI,R9    PROGERR                                                       
         RDIAG                                                                  
STOR38   LW,R6    BYTSIZFD          FIELD SIZE IN BYTES                         
         AW,R7    R6                                                            
STOR4    AI,R7    -1                                                            
         MTW,0    FL:OFLOW                                                 15   
         BNEZ     STOR42            DONT ACTUALLY STORE ON OVERFLOW        15   
         STB,R8   0,R7                                                          
         SLS,R8   RIGHT*8           NEXT BYTE                                   
         BDR,R6   STOR4                                                         
STOR42   LW,R6    BYTSIZFD                                                16    
         AWM,R6   BAPEXEC           FORWARD STORE UPDATES BAPEXEC               
STOR9    PULL     2,15                                                         8
         B        *R13              EXIT                                        
STOR5    MTW,0    FL:OFLOW                                                 15   
         BNEZ     STOR9             BY PASS INSERTION                      15   
         LW,R5    *FWAGRAN,R3       WA OF GRANULE IN CORE                  15   
         SLS,R5   LEFT*2                                                        
         AW,R5    BYTDISGR                                                      
         LI,R4    27                                                            
         LI,R6    0                                                             
         STW,R6   B:X-1,R4                                                      
         BDR,R4   %-1               ZERO  B:X,B:M,B:D                           
*                                                                               
*                                                                               
*                 B:X   IS USED  FOR  3  9WD BUFFERS FOR DEFINE                 
*                 FIELD UP TO 256 BITS.                                         
*                 B:X IS WHERE DATA IS BROUGHT FROM USERS PROG                  
*                 B:D IS WHERE DATA TO BE INSERTED IS PLACED                    
*                 B:M IS WHERE MASKS FOR INSERTION ARE CREATED.                 
*                                                                               
*                 B:D =B:X+9  B:M = B:X + 18                                    
*                                   R5  HAS FBA OF FIELD                        
         LI,R4    B:X+9                                                         
         SLS,R4   LEFT*2            MAKE BA                                     
         LW,R6    BYTSIZFD                                                      
         SW,R4    R6                FBA OF INSERTION BUFFER                     
STOR52   LB,R7    0,R5                                                          
         STB,R7   0,R4              MOVE TO B:X BUFFER                          
         AI,R5    1                                                             
         AI,R4    1                                                             
         BDR,R6   STOR52            R5 NOW IS LBA+1OF USERS FIELD               
         LW,R6    BITOFFST                                                      
         SAD,R8   RIGHT*32,R6                                                   
         STW,R8   B:D+7                                                         
         STW,R9   B:D+8             LAST TWO WDS OF DATA SECT                   
         SAS,R8   RIGHT*7           EXTEND SIGN THRU REMAINDER OF R8            
         LI,R4    7                                                             
         STW,R8   B:D-1,R4          EXTEND  SIGN THROUGH WHOLE DATA SECT        
         BDR,R4   %-1                                                           
*                                                                               
*                 SET  UP POSITIONED  MASK FOR WHOLE FIELD                      
*                                                                               
         LI,R3    B:M+8             START AT LAST LOC                           
         LW,R4    BITSIZFD                                                      
         AW,R4    BITOFFST          REMOVE THESE LATER                          
         CI,R4    32                                                            
         BGE      STOR54                                                        
         SW,R4    BITOFFST                                                      
STOR54   LI,R9    -1                                                            
         CI,R4    32                                                            
         BLE      STOR55            LAST OR ONLY PARTIAL/COMPLETE WD            
         STW,R9   0,R3                                                          
         AI,R3    -1                                                            
         AI,R4    -32                                                           
         B        STOR54                                                        
STOR55   LI,R8    0                                                             
         SLD,R8   0,R4                                                          
         STW,R8   0,R3              HIGH ORDER RESIDUAL                         
         LW,R3    BITOFFST                                                      
         LW,R8    B:M+8                                                         
         SLS,R8   0,R3                                                          
         STW,R8   B:M+8                                                         
*                                                                               
*                 WE NOW HAVE A BYTE STRING IN B:X, A DATA STRING               
*                 WITH SIGN EXTENDED  IN  B:D, AND AN INSERTION                 
*                 MASK IN B:M, ALL LINED UP.                                    
*                                                                               
         LI,R4    9                 ADD ALL 9 WDS  OF B:D INTO B:X              
*                                   THROUGH MASK  B:M.                          
STOR57   LW,R9    B:M-1,R4                                                      
         LS,R8    B:D-1,R4                                                      
         AW,R8    B:X-1,R4                                                      
         STS,R8   B:X-1,R4                                                      
         BDR,R4   STOR57                                                        
*                                                                               
*                 R5  STILL  PTS TO LBA+1 OF FIELD                              
*                                                                               
         LI,R3    B:X+9                                                         
         SLS,R3   LEFT*2            MAKE BA                                     
         LW,R4    BYTSIZFD                                                      
STOR58   AI,R5    -1                                                            
         AI,R3    -1                                                            
         LB,R8    0,R3                                                          
         STB,R8   0,R5                                                          
         BDR,R4   STOR58                                                        
*                                                                               
*                                   DATA  REPLACED,RETURN                       
*                                                                               
         B        STOR9                                                         
STOR7    STW,R7   BITOFFST          STORE ZERO IN BIT OFFSET                    
         CI,R6    32                                                            
         BNE      STOR32            NOT STORING WORD                      16    
         LW,R3    BAPEXEC                                                       
         CI,R3    3                                                             
         BANZ     STOR32            NO                                    16    
         SW,R3    FBAEXEC                                                       
         SLS,R3   RIGHT*2                                                       
         LI,R2    0                                                             
         DW,R2    NWEGRAN                                                       
         AI,R3    1                                                             
*                                   3 HAS GRAN                                  
*                                   2 HAS OFFSET                                
         LI,R4    0                                                             
         REAWA                                                                  
         LW,R3    *FWAGRAN,R3                                                   
         LW,R9    V:MASK                                                        
         STS,R8   *R3,R2                                                        
         MTW,4    BAPEXEC           UPDATE LOAD LOCATION COUNTER                
         LI,R8    -1                                                            
         STW,R8   V:MASK            RESET MASK TO STORE WHOLE WORD              
         B        STOR9                                                   16    
         TITLE    ' ****  STORNBYT  ****'                                       
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  STORNBYT                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 ADD N BYTES INTO MEMORY.                                      
*                                                                               
*                                                                               
*        ENTRY    R12 IS BAL REGISTER                                           
*                 R5  CONTAINS THE NUMBER OF BYTES                              
*                 BAP:ROM CONTAINS (FBA-1) OF BYTE STRING                       
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*        EXIT     R5 UNCHANGED                                                  
*                                                                               
*                                                                               
STORNBYT RES      0                                                             
         PUSH     3,12                                                         8
         STW,R5   NUMBYTS           NUMBER OF BYTES TO STORE               15   
STB1     LI,R8    B:REPEAT                                                      
         SLS,R8   LEFT*2            MAKE BA                                     
         STW,R8   BAPBYT                                                   15   
STB2     CI,R5    0                                                             
         BLE      STB8                                                          
STB3     LW,R4    R5                BYTES ARE STORED IN GROUPS OF 4 OR          
         AI,R5    -4                LESS.                                       
         BLEZ     %+2               RESIDUAL <4                                 
         LI,R4    4                 >4.-USE 4                                   
         STW,R4   R2                                                            
         LI,R3    0                 COLLECT REGISTER - UP TO 4 BYTES            
STB4     STW,R5   R1                SAVE                                        
         MTW,0    REPTCNT                                                  15   
         BEZ      STB5              NO REPEAT                              15   
         MTW,0    REPTFLAG                                                 15   
         BGZ      %+2               NOT FIRST TIME                         15   
STB5     ROMBYTE                    FIRST TIME  PICK UP BYTE               15   
         MTW,0    REPTCNT                                                  15   
         BEZ      STB7              ONLY TIME - DONT SAVE                  15   
         LW,R7    BAPBYT            POINTS TO EQUIV POSITION IN            15   
*                                   SAVE BUFFER                            15   
         MTW,0    REPTFLAG                                                 15   
         BEZ      STB6              FIRST TIME                             15   
         LB,R8    0,R7              N>1TH TIME - GET FROM BUFFER           15   
         B        STB65                                                    15   
STB6     STB,R8   0,R7              FIRST TIME ON REPEAT - SAVE            15   
STB65    MTW,1    BAPBYT                                                   15   
STB7     LW,R5    R1                                                       15   
         SLS,R3   LEFT*8                                                        
         AW,R3    R8                                                            
         BDR,R4   STB4                                                          
         LW,R8    R3                ACCUMULATED BYTES                           
         LI,R7    0                 NO NEG FLD DISPLACEMENT                     
         LW,R6    R2                SIZE OF FIELD                               
         SLS,R6   LEFT*3            BYTES TO BITS                               
         STORBITS                                                               
         B        STB2                                                          
STB8     MTW,1    REPTFLAG                                                 15   
         MTW,-1   REPTCNT           POSITIVE REPEAT COUNT >1 TO BEGIN      15   
         BLEZ     STB9              DONE                                   15   
         LW,R5    NUMBYTS           REPEAT                                 15   
         B        STB1                                                     15   
STB9     PULL     3,12                                                     15   
         B        *R12                                                          
         TITLE    '****  WRITGRAN  ****'                                        
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  WRITGRAN                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 EITHER WRITE A GRANULE TO RAD,AND ZERO CORE SPACE             
*                 OR WRITE ALL REMAINING GRANULES TO RAD;UPDATE PGRAN.          
*                                                                               
*        ENTRY    R14 IS BAL REGISTER                                           
*                 R5 CONTAINS THE NUMBER OF THE GRANULE.                        
*                    IF R5=0,WRITE ALL REMAINING GRANULES,AND ZERO ENT.         
*                                                                               
*                 IF ENTRY IN TGRAN IS EMPTY, INHIBIT WRITE.                    
*                                                                               
*                 IF FL:OFLOW IS SET, INHIBIT WRITE                             
*                                                                               
*                                                                               
*                                                                               
WRITGRAN RES      0                                                             
         MTW,0    PRLDFLAG                                                      
         BNEZ     *R14              DO NOT WRITE, PRELOADED SEG                 
         MTW,0    FL:OFLOW                                                     8
         BNEZ     *R14              DO NOT WRITE - OVERFLOW                    8
         PUSH     5,10                                                  3929.010
         CI,R5    0                                                             
         BE       WRT5              WRITE ALL REMAINING GRANULES                
         LW,R7    *FWAGRAN,R5       WRITE ONE GRANULE                           
         AND,R7   X:1FFFF                                                       
         BEZ      WRT9              NOT IN CORE - EXIT                          
         STW,R7   FPT:WTG+4         BUFFER ADDR                                 
         LW,R7    NBEGRAN           NO OF BYTES PER GRANULE                    8
         STW,R7   FPT:WTG+5                                                     
         LI,R7    W                 WRITE BIT AND ZERO ADDRESS                 8
         STW,R7   *FWAGRAN,R5                                                   
         AW,R5    P:GRAN                                                        
         AI,R5    -1                                                            
         STW,R5   FPT:WTG+7         GRANULE DISPLACEMENT                       8
         LI,R9    0                                                            8
         STW,R9   FPT:WTG+6         TEMP                                       8
         LI,R9    PT:WTGR           PARAMETER LIST                              
         CAL1,1   FPT:WTG           WRITE GRANULE                               
         B        WRT9              EXIT                                        
*                                                                               
*                 WRITE OUT NON-ZERO ENTRIES IN TGRAN.                          
*                                                                               
WRT5     LI,R5    0                                                             
         STW,R5   FPT:WTG+6                                                     
         LI,R4    1                                                             
WRT52    CW,R4    *FWAGRAN                                                      
         BG       WRT9                                                          
         MTW,0    FL:OFLOW                                                  13  
         BNEZ     WRT9                                                      13  
         LW,R8    *FWAGRAN,R4                                                   
         AND,R8   X:1FFFF                                                       
         BEZ      WRT60                                                         
         LW,R5    P:GRAN                                                        
         AW,R5    R4                                                            
         AI,R5    -1                                                            
         STW,R5   FPT:WTG+7                                                     
         LW,R5    NBEGRAN                                                       
         STW,R5   FPT:WTG+5                                                     
         STW,R8   FPT:WTG+4                                                     
         LI,R9    PT:WTGR                                                       
         CAL1,1   FPT:WTG                                                       
WRT60    LI,R5    0                                                             
         STW,R5   *FWAGRAN,R4                                                   
         AI,R4    1                                                             
         B        WRT52                                                         
*                                                                               
WRT9     LI,R5    1                                                      17     
         STW,R5   FL:OUTOV          OV WRITTEN                            16    
         PULL     5,10                                                  3977.010
         B        *R14                                                          
         TITLE    '****  ZEROGRAN  ****'                                        
*                                                                               
*                                                                               
*        ****************************                                           
*        *                          *                                           
*        *                          *                                           
*        *  ZEROGRAN                *                                           
*        *                          *                                           
*        *                          *                                           
*        ****************************                                           
*                                                                               
*                                                                               
*                 ZERO THE GRANULE AREA IN CORE                                 
*                                                                               
*                                                                               
*        ENTRY    R5 CONTAINS GRANULE NUMBER                                    
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
ZEROGRAN RES      0                                                             
         MTW,0    FL:OFLOW                                                 15   
         BNEZ     *R15              BY PASS ON OVERFLOW                    15   
         PUSH     5,7                                                           
         LW,R7    *FWAGRAN,R5                                                   
         AND,R7   X:1FFFF                                                       
         BEZ      ZER5              NOT IN CORE                                 
         LI,R6    0                                                             
         LW,R5    NWEGRAN                                                       
         AI,R7    -1                                                            
         STW,R6   *R7,R5                                                        
         BDR,R5   %-1                                                           
ZER5     PULL     5,7                                                           
         B        *R15                                                          
         TITLE    '****  DEFAULT DCBS  ****'                                    
*                                                                               
*                                                                               
*        THE FOLLOWING  DEFAULT DCBS ARE PROVIDED BY THE LOADER.                
*                                                                               
*        M:       C                 ASSIGNED TO STANDARD OPERATIONAL            
*                 OC                LABELS                                      
*                 LO                                                            
*                 LL                                                            
*                 DO                                                            
*                 CO                                                            
*                 BO                                                            
*                 CI                                                            
*                 SI                                                            
*                 BI                                                            
*                 SO                                                            
*                 PL                                                            
*                                                                               
************************************************************************        
*                                                                               
*                                                                               
*        M:       X1                BACKGROUND TEMP FILES ON RAD                
*                 X2                                                            
*                 X3                                                            
*                 X4                                                            
*                 X5                                                            
*                 X6                                                            
*                 X7                                                            
*                                                                               
*                                                                               
*        M:       GO                GO FILE IN  BACKROUND TEMP                  
*                                                                               
*        M:       OV                DEFAULT OUTPUT  FILE  FOR LOADER            
*                                                                               
*        M:       SL                INPUT DCB FOR SEGMENT LOADER                
*                                                                               
*                                                                               
************************************************************************        
*                                                                               
*                                                                               
*        F:       105               SAME AS  M:SI                               
*                 106               SAME AS  M:BO                               
*                 108               SAME AS  M:LO                               
*                                                                               
************************************************************************        
*                                                                               
*                                                                               
*        A SKELETON DCB, WHOSE NAME CONSISTS  OF 8 BLANKS, AND                  
*        CONTAINING CERTAIN DEFAULT PARAMETERS, IS PROVIDED FOR                 
*        EACH UNNAMED DCB SPECIFIED ON THE OLOAD CARD.                          
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*        DEFAULT DCBS  CONSIST OF  3 TABLES  TDCBNAME,TDCBADDR,TDFLTDCB         
*                                                                               
*                 TDCBADR IS A SINGLE-WORD TABLE CONTAINING ADDRESSES           
*                 OF DCB COPIES IN TDFLTDCB.                                    
*                                                                               
*                 TDCBNAME IS A DOUBLE-WORD TABLE CONTAINING  EBCDIC            
*                 DCB NAMES (E.G. M:LO,ETC).  IT IS A PARALLEL                  
*                 TABLE  TO  TDCBADR.                                           
*                                                                               
         BOUND    8                                                             
TDCBNAME DATA,4   TCBADR-TDCBNAME                                               
         BOUND    8                                                            8
UDCBNAME TEXT     '        '                                                    
         TEXT     'M:C     '                                                    
         TEXT     'M:OC    '                                                    
         TEXT     'M:LO    '                                                    
         TEXT     'M:LL    '                                                    
         TEXT     'M:DO    '                                                    
         TEXT     'M:CO    '                                                    
         TEXT     'M:BO    '                                                    
         TEXT     'M:BI    '                                             17     
         TEXT     'M:CI    '                                                    
         TEXT     'M:SI    '                                                    
         TEXT     'M:BI    '                                                    
         TEXT     'M:SO    '                                                    
         TEXT     'M:PL    '                                                    
         TEXT     'M:X1    '                                                    
         TEXT     'M:X2    '                                                    
         TEXT     'M:X3    '                                                    
         TEXT     'M:X4    '                                                    
         TEXT     'M:X5    '                                                    
         TEXT     'M:X6    '                                                    
         TEXT     'M:X7    '                                                    
         TEXT     'M:GO    '                                                    
         TEXT     'M:OV    '                                                    
MSLDCB   TEXT     'M:SL    '                                                    
         TEXT     'F:101   '                                                    
         TEXT     'F:102   '                                                    
         TEXT     'F:103   '                                                    
         TEXT     'F:104   '                                                    
         TEXT     'F:105   '                                                    
         TEXT     'F:106   '                                                    
         TEXT     'F:108   '                                                    
TCBADR   DATA,4   TDFLTDCB-TCBADR                                               
         DATA,4   DFLT:BL                                                       
         DATA,4   DFLT:C                                                        
         DATA,4   DFLT:OC                                                       
         DATA,4   DFLT:LO                                                       
         DATA,4   DFLT:LL                                                       
         DATA,4   DFLT:DO                                                       
         DATA,4   DFLT:CO                                                       
         DATA,4   DFLT:BO                                                       
         DATA,4   DFLT:BI                                                       
         DATA,4   DFLT:CI                                                       
         DATA,4   DFLT:SI                                                       
         DATA,4   DFLT:BI                                                       
         DATA,4   DFLT:SO                                                       
         DATA,4   DFLT:PL                                                       
         DATA,4   DFLT:X1                                                       
         DATA,4   DFLT:X2                                                       
         DATA,4   DFLT:X3                                                       
         DATA,4   DFLT:X4                                                       
         DATA,4   DFLT:X5                                                       
         DATA,4   DFLT:X6                                                       
         DATA,4   DFLT:X7                                                       
         DATA,4   DFLT:GO                                                       
         DATA,4   DFLT:OV                                                       
         DATA,4   DFLT:SL                                                       
         DATA,4   DFLT:101                                                      
         DATA,4   DFLT:102                                                      
         DATA,4   DFLT:103                                                      
         DATA,4   DFLT:104                                                      
         DATA,4   DFLT:105                                                      
         DATA,4   DFLT:106                                                      
         DATA,4   DFLT:108                                                      
TDFLTDCB RES      0                                                             
*                                                                               
*                 DCB PARAMETER DEFAULT - COMMON  PARAMETERS  FOR ALL           
*                 DCBS                                                          
TTL      SET      11                ALL DCBS ARE MAXIMUM SIZE                   
OPEN     SET      0                                                             
FBCD     SET      0                 NO FORTRAN BCD CONVERSION                   
BUSY     SET      0                 SET BY RBM                                  
PACK     SET      0                 UNPACKED                                    
BTD      SET      0                 NO BYTE DISPLACEMENT IN BUFFER              
NRA      SET      0                 SET BY RBM                                  
TYC      SET      0                 SET BY RBM                                  
BUF      SET      0                 BUFFER ADDR SET BY USER                     
ERA      SET      0                 ERROR ROUTINE ADDR                          
ARS      SET      0                 SET BY RBM                                  
ABA      SET      0                 ABNORMAL ROUTINE ADDR                       
FUN      SET      0                 UNUSED NOW.                         22      
*                                                                               
*        THE PRECEDING SETS ARE UNCHANGED FOR ALL DCBS.                         
*                                                                               
*                                                                               
*        SETS FOR MOD,VFC,ASN,NRT,FUN,DEVF,TYPE,DOR,RSZ                         
*        PRECEDE EACH  DCB, OR GROUP OF  DCBS.                                  
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*        DEFAULT  OP LABEL,NON-RAD,NO RETRIES                                   
DEVF     SET      0                                                             
ASN      SET      3                                                             
TYPE     SET      0                                                             
NRT      SET      3                 MAG TAPE DEFAULT                            
*                                                                               
*                                   UNNAMED DCB                                 
*                                                                               
MOD      SET      0                                                             
VFC      SET      0                                                             
DOR      SET      0                                                             
RSZ      SET      0                                                             
DFLT:BL  BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:C                                         
*                                                                               
MOD      SET      0                 EBCDIC                                      
VFC      SET      1                                                             
DOR      SET      1                                                             
RSZ      SET      80                                                            
DFLT:C   BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:OC                                        
*                                                                               
MOD      SET      0                                                             
VFC      SET      1                                                             
DOR      SET      2                                                             
RSZ      SET      85                                                            
*                                                                               
DFLT:OC  BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:LO                                        
*                                                                               
MOD      SET      0                                                             
VFC      SET      1                                                        101  
DOR      SET      3                                                             
RSZ      SET      133                                                           
*                                                                               
DFLT:LO  BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:LL                                        
*                                                                               
MOD      SET      0                                                             
VFC      SET      0                                                             
DOR      SET      4                                                             
RSZ      SET      133                                                           
*                                                                               
DFLT:LL  BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:DO                                        
*                                                                               
MOD      SET      0                                                             
VFC      SET      0                                                             
DOR      SET      5                                                             
RSZ      SET      133                                                           
*                                                                               
DFLT:DO  BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:CO                                21      
*                                                                               
MOD      SET      1                 BIN                                         
VFC      SET      0                                                             
DOR      SET      6                                                             
RSZ      SET      120                                                           
*                                                                               
DFLT:CO  BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:BO                                        
*                                                                               
MOD      SET      1                                                             
VFC      SET      0                                                             
DOR      SET      7                                                             
RSZ      SET      120                                                           
*                                                                               
DFLT:BO  BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:LI                                        
*                                                                               
MOD      SET      1                                                             
VFC      SET      0                                                             
DOR      SET      8                                                             
RSZ      SET      120                                                           
*                                                                               
DFLT:CI  BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:SI                                        
*                                                                               
MOD      SET      0                                                             
VFC      SET      1                                                             
DOR      SET      9                                                             
RSZ      SET      80                                                            
*                                                                               
DFLT:SI  BUILDDCB 0                                                     21      
         SPACE    2                                                             
*                                                                               
*                                   M:BI                                        
*                                                                               
MOD      SET      1                                                             
VFC      SET      0                                                             
DOR      SET      10                                                            
RSZ      SET      120                                                           
*                                                                               
DFLT:BI  BUILDDCB 0                                                     21      
         SPACE    3                                                             
MOD      SET      0                                                             
VFC      SET      0                                                             
DOR      SET      11                                                            
RSZ      SET      80                                                            
DFLT:SO  BUILDDCB 0                                                     21      
*                                                                               
*                                   PL                                          
*                                                                               
MOD      SET      1                                                             
VFC      SET      0                                                             
DOR      SET      12                                                            
RSZ      SET      120                                                           
DFLT:PL  BUILDDCB 0                                                             
         SPACE    3                                                             
*                                                                               
*                                                                               
*                 FORTRAN DEFAULTS                                              
*                                                                               
*                                                                               
DFLT:101 EQU      DFLT:OC                                                       
DFLT:102 EQU      DFLT:OC                                                       
DFLT:103 EQU      DFLT:BI                                                       
DFLT:104 EQU      DFLT:BO                                                       
DFLT:105 EQU      DFLT:SI                                                       
DFLT:106 EQU      DFLT:BO                                                       
DFLT:108 EQU      DFLT:LO                                                       
         SPACE    5                                                             
*                                                                               
*                 FILES  X1-X7 IN BT AREA OF THE RAD                            
*                 HAVE THE FOLLOWING  SETS.                                     
*                                                                               
*                                                                               
ASN      SET      1                 RAD FILE                                    
DEVF     SET      0                 NO MEANING HERE                             
TYPE     SET      3                 BT AREA                                     
NRT      SET      3                 3  RETRIES                                  
MOD      SET      1                 ALWAYS BIN                                  
VFC      SET      0                                                             
DOR      SET      0                                                             
RSZ      SET      -2                =XFFFE                                      
         SPACE    3                                                             
DFLT:X1  BUILDDCB 'X1  '                                                        
DFLT:X2  BUILDDCB 'X2  '                                                        
DFLT:X3  BUILDDCB 'X3  '                                                        
DFLT:X4  BUILDDCB 'X4  '                                                        
DFLT:X5  BUILDDCB 'X5  '                                                        
DFLT:X6  BUILDDCB 'X6  '                                                        
DFLT:X7  BUILDDCB 'X7  '                                                        
         SPACE    5                                                             
*                                                                               
*                 OV FILE ON  BT                                                
*                                                                               
DFLT:OV  BUILDDCB 'OV  '                                                        
         SPACE    5                                                             
*                                                                               
*                 GO  FILE  ON  BT                                              
*                                                                               
RSZ      SET      120                                                           
DFLT:GO  BUILDDCB 'GO  '                                                        
         SPACE    2                                                             
DFLT:SL  EQU      DFLT:BL                                                       
         END                                                                    
