         SYSTEM   SIG9P                                                         
         SYSTEM   OPTIONS                                                       
*                                                                               
*                                                                               
*                                                                               
        DO       #MAP                                                           
         DEF      A:IPLMM                                                       
         DEF      IPLMMEX                                                       
OLAYFLAG EQU      'IPLM'                                                        
         PSYS     0                                                             
         SYSTEM   CPRMON                                                        
*                                                                               
*                                                                               
*********** NOTE: MUST GET THIS STRAIGHT.....                                   
*                                                                               
*        WHRE ARE THE ACCESS CODES ...WHICH NAME..ALSO CONTROL DW               
*                                                                               
*        REF      INITAC            (NEEDS DW AT BEG OF STACCI                  
*                                                                               
*****************                                                               
         TITLE    '** IPLMM - MEMORY MANAGEMENT INITIALIZATION **'              
         PAGE                                                                   
*                                                                               
*        ENTRY POINT                                                            
*                                                                               
IPLMM    EQU      %                                                             
A:IPLMM  EQU      IPLMM                                                         
*                                                                               
*                                                                               
*        CHAIN UP ALL PAGES NOT IN ANOTHER PARTITION INTO STM                   
*                 'PARTITION'                                                   
*                                                                               
         LB,R6    K:RMPT                                                        
IPLMM04  LW,R4    PPT,R6            R4=PCT TYPE/PCT ADR                         
         LB,R1    R4                                                            
         AND,R1   XPPTTYPE                                                      
         CI,R1    5                 STM?                                        
         BE       IPLMM30           YES                                         
         BDR,R6   IPLMM04                                                       
         B        IPLMMCR           CRASH IF NO STM                             
IPLMM30  EQU      %                                                             
         LI,R14   0                                                             
         STW,R14  MMTPAGES          TOTAL FREE PAGE COUNT                       
         STW,R14  MMTPREQ                                                       
         STW,R14  MMTBKGP                                                       
         LW,R4    PPT,R6                R4=PCT ADDRESS                          
         STW,R14  PCTFPAGE,R4       ZERO PCT FREE PAGE COUNT                    
         LW,R5    R4                    R5=CHAIN HEAD ADDRESS                   
         DO1      #SIGMA9               GO INTO REAL EXTENDED                   
         WD,0     X'47'                                                         
         DO       #SIGMA9M                                                      
         LPSD,0   PSDRE1                                                        
         BOUND    8                                                             
PSDRE1   DATA     %+2                                                           
         DATA     X'00800000'                                                   
         FIN      #SIGMA9M                                                      
IPLMM38  BAL,R8   MMFMP             FIND MEM PARTITION                          
         B        IPLMMCR               CRASH                                   
         CW,R6    R7                IN STM PARTITION                            
         BNE      IPLMM40               NO                                      
         STW,R14  0,R5                  YES, STORE ADDR                         
         LW,R5    R14                   INTO CHAIN AND SAVE FOR                 
         MTW,1    PCTFPAGE,R4           NEXT CHAIN, INCR FREE PAGES             
         MTW,1    MMTPAGES              AND TOTAL FREE PAGES                    
IPLMM40  EQU      %                                                             
         AI,R14   512               MOVE TO NEXT PAGE                           
         CW,R14   K:UNAVBG          PAST END OF MEMORY YET                      
         BL       IPLMM38           B IF NO                                     
*                                                                               
         DO1      #SIGMA9                                                       
         WD,0     X'46'             TURN OFF MODE ALTERED                       
         DO       #SIGMA9M                                                      
         LPSD,0   PSDRE2                                                        
         BOUND    8                                                             
PSDRE2   DATA     %+2                                                           
         DATA     X'00000000'                                                   
         FIN      #SIGMA9M                                                      
         LW,R1    MMTPAGES          SETUP TO GIVE OMAN SOME PAGES               
         AI,R1    -64               BASED ON THE SIZE OF THE SYSTEM             
         BLEZ     IPLMM42           NONE IF LESS THAN 65 FREE PAGES             
         AI,R1    63                ROUND UP FOR CALCULATION                    
         SLS,R1   -6                DIVIDE BY 64 - YEILDS NUMBER OF             
         AWM,R1   OMAN#PGS          PAGES TO GIVE OMAN                          
IPLMM42  EQU      %                                                             
*                                                                               
         PAGE                                                                   
*                                                                               
*        WRITE LOCKS BUILT BY SYSGEN AS FOLLOWS:                                
*                                                                               
*                 PRIVATE                                                       
*                 MAILBOXES                                                     
*                 BLOCKING BUFFERS                                              
*                 PREFERED                                                      
*                 REMAINEDER                                                    
*                                                                               
*        PRIMARY TASKS WILL RUN WITH KEY= PRIVATE                               
*        SEC TASKS RUN WITH SKELETON KEY (ACCESS CODES FOR PROTECTION)          
*                                                                               
*        NOW LOAD THE WRITE LOCK REGISTERS                                      
*                                                                               
         LW,R1    K:UNAVBG          MAX REAL MEMORY                             
         SLS,R1   -13               #PAGES / 16                                 
         STW,R1   R2                SAVE FOR 550 CALCULATIONS                   
         CI,R1    16                OVER 128K                                   
         BLE      IPLMM50A          B IF NO                                     
         LI,R1    16                LOAD FIRST 128K                             
IPLMM50A EQU      %                                                             
         SCS,R1   -8                IN BYTE 0                                   
         LI,R0    WLOCK+1                                                       
         MMC,R0   1                 LOAD WRITE LOCKS                            
         DO       #550                                                          
         CI,R2    16                MORE THAN 128K                              
         BLE      IPLMM50B          B IF NO                                     
         AI,R2    -16               R2 EQUALS LOOP COUNT                        
         LI,R1    X'20000'          CONTROL START (128 K)                       
         WD,0     X'47'             TURN MODE-ALTERED ON                        
*        LI,R0    STMCODE           XEROXS METHOD                               
         LI,R0    0                 WL = 0 (UNPROTECTED)                        
*                                   560 LIKE SIGMA 9                            
         MTB,1    R1                NR OF WORDS TO LOAD                         
         MMC,R0   1                 LOAD 2-BIT WRITE LOCKS ABOVE 128 K          
         BDR,R2   %-3               LOOP THRU MEM ABOVE 128K                    
         WD,0     X'46'             TURN MODE-ALTERED OFF                       
         FIN      #550                                                          
IPLMM50B EQU      %                                                             
         PAGE                                                                   
*                                                                               
*        CHANGE RMPT FOR DEFAULT PRIVATE PARTITION TO                           
*                 DYNAMIC VALUE NOW-KEEPS FOREGROUND                            
*                 LOADERS FROM LOADING OVER MAILBOX AND BLK                     
*                 BUFFERS                                                       
*                                                                               
         LB,R2    K:RMPT                                                        
         LI,R1    2                                                             
IPLMM46  LW,R3    PPT,R1                                                        
         LB,R6    R3                                                            
         AND,R6   XPPTTYPE                                                      
         CI,R6    1                 PRIVATE                                     
         BE       IPLMM48                                                       
         AI,R1    1                                                             
         CI,R1    R2                                                            
         BLE      IPLMM46                                                       
         B        IPLMM49A                                                      
IPLMM48  EQU      %                 PRIVATE PARTITION FOUND                     
         LD,R12   RMPT,R1                                                       
*        LW,R7    K:FMBOX           R13 = FWA OF MAILBOX                        
*        BNEZ     IPLMM49                                                       
*        LW,R7    K:FPOOL                                                       
*        BEZ      IPLMM49A                                                      
*        LW,R7    1,R7              R13 = FWA OF 1ST BB                         
         LW,R7    K:FMBOX           R7 = FWA OF MAILBOX                         
         CLM,R7   R12                                                           
         BCR,9    IPLMM49           B IF INSIDE RSDF LIMITS                     
         LW,R7    K:FPOOL           R7 =                                        
         BEZ      IPLMM49A                                                      
         LW,R7    1,R7              R7 = FWA OF 1ST BB IN POOL                  
         CLM,R7   R12                                                           
         BCS,9    IPLMM49A          B IF OUTSIDE RSDF LIMITS                    
IPLMM49  EQU      %                                                             
         LW,R13   R7                                                            
         STD,R12  RMPT,R1                                                       
IPLMM49A EQU      %                                                             
*                                                                               
*                                                                               
*        OVERRIDE LOWER PART OF MAP 1-1                                         
*                                                                               
K:STVM   EQU      K:BACKBG          *** SHOUDL BE CALLED SUCH                   
         LW,R2    K:STVM                                                        
         SLS,R2   -9                WORDS TO PAGES 1-1                          
         LI,R1    0                                                             
         STB,R1   INITMAP+2,R1                                                  
         AI,R1    1                                                             
         BDR,R2   %-2                                                           
*                                                                               
*        NOW LOAD THE MAP REGISTERS                                             
*                                                                               
         LD,R0    INITMAP                                                       
         MMC,R0   4                                                             
*                                                                               
*        NOW LOAD THE MAP ACCESS CODES                                          
*                                                                               
         LD,R0    INITAC            SYSTEM = READ AND EX                        
         MMC,R0   2                 REST   = NO ACCESS                          
*                                                                               
         B        ELOGINIT                                                      
*                                                                               
**                                                                              
*        MAP REGISTERS                                                          
*                                                                               
*                                                                               
*                                                                               
*                                                                               
         LIST,1   1                                                             
         BOUND    8                                                             
INITMAP  EQU      %                                                             
         DATA     %+2                                                           
         GEN,8,24 64,0                                                          
         DO1      256                                                           
         DATA,1   X'FF'             MAPPED TO LAST PAGE FOR                     
*                                   LACK OF A BETTER                            
         LIST,0   1                                                             
*                                                                               
         B        ELOGINIT                                                      
*                                   FIND STM PARTITION                          
*                                                                               
*                                                                               
STOREWL  RES      0                                                             
         LW,R1    R9                1ST 2 BIT INDEX                             
*                                                                               
STOREWL1 LW,R4    R1                                                            
         LI,R5    0                 CLEAR                                       
         SCD,R4   -4                WORD INDEX TO R4                            
         SCS,R5   5                 SHIFT COUNT                                 
         AI,R5    2                 FUDGE FOR RIGHT SHIFT                       
         LCW,R5   R5                COMPLEMENT FOR RIGHT SHIFT                  
*                                                                               
         LW,R3    R0                WL CODE                                     
         LI,R2    3                 MASK                                        
         SCD,R2   0,R5              POSITION BOTH                               
         STS,R2   WLOCK+1,R4        AND STORE                                   
*                                                                               
         AI,R1    1                 BUMP INDEX                                  
         CW,R1    R10               DONE YET                                    
         BLE      STOREWL1          NO,LOOP                                     
*                                                                               
         B       *R8                RETURN                                      
*                                                                               
         PAGE                                                                   
*                                                                               
* SET UP ERROR LOGGING FILE ASSIGNMENT                                          
*                                                                               
*                                                                               
ELOGINIT EQU      %                                                             
         DO       #ERRORLOG                                                     
         LI,R0    'ER'+X'F0000'     SIGN-EXTEND NAME FOR CH                     
         LH,R1    OPLBS1            NR OF OPLABELS                              
         CH,R0    OPLBS1,R1         FIND ER OPLBL                               
         BE       %+3               B IF FOUND                                  
         BDR,R1   %-2               CHECK NEXT ENTRY                            
         B        ERERROR           B IF NOT FOUND                              
*                                                                               
         MTB,R0   OPLBS2,R1         TEST SYSGEN ASSIGNMENT                      
         BNEZ     ERERROR           B IF NONZERO SYSGEN ASSIGNMENT              
*                                                                               
         LCI      9                                                             
         LM,R0    ALLERFL           GET ERRFILE ALLOT FPT                       
         CAL1,7   R0                ALLOT ERRFILE.SP                            
         LCI      7                                                             
         LM,R0    ERFPT             GET FPT IN REGS                             
         CAL1,7   R0                STDLB (ER,ERRFILE.SP)                       
ERERROR  EQU      %                 CONTROL RETURN IF NO FILE                   
         FIN      #ERRORLOG                                                     
*                                                                               
* SET UP CRASH         FILE ASSIGNMENT                                          
*                                                                               
*                                                                               
         DO       #CRASH                                                        
         LI,R0    'SE'+X'F0000'     SIGN-EXTEND NAME FOR CH                     
         LH,R1    OPLBS1            NR OF OPLABELS                              
         CH,R0    OPLBS1,R1         FIND SE OPLBL                               
         BE       %+3               B IF FOUND                                  
         BDR,R1   %-2               CHECK NEXT ENTRY                            
         B        SEERROR           B IF NOT FOUND                              
*                                                                               
         MTB,R0   OPLBS2,R1         TEST SYSGEN ASSIGNMENT                      
         BNEZ     SEERROR           B IF NONZERO SYSGEN ASSIGNMENT              
*                                                                               
*                                                                               
         LCI      8                                                             
         LM,R0    ALLCRSH           GET CRASH ALLOT FPT                         
         CAL1,7   R0                ALLOT CRASH.SP                              
         LCI      7                                                             
         LM,R0    SEFPT             GET FPT IN REGS                             
         CAL1,7   R0                STDLB (SE,CRASH.SP)                         
SEERROR  EQU      %                 CONTROL RETURN IF NO FILE                   
         FIN      #CRASH                                                        
*                                                                               
*        SET UP ACCOUNTING LOG FILE                                             
*                                                                               
*                                                                               
         DO       #JOBACCT                                                      
         LCI      8                                                             
         LM,R0    ALLAL             GET AL ALLOT FPT                            
         CAL1,7   R0                ALLOT AL.D1                                 
         FIN                        #JOBACCT                                    
*                                                                               
*                                                                               
*        SET UP RADEDIT AND OLOAD FILES IF NECESSARY                            
*                                                                               
         LI,R1    S:SPAI            SYSTEM PROCESSORS AREA INDEX                
         LH,R15   MDNAME,R1         GET AREA NAME                               
         AND,R15  XFFFF             TRIM IT                                     
         LCI      ALLRADE-ALLRAD                                                
         LM,R0    ALLRAD            LOAD FPT INTO REGS                          
         AW,R0    R15               INSERT AREA NAME                            
         CAL1,7   R0                ALLOT RADEDIT FILE                          
         LCI      ALLOLDE-ALLOLD                                                
         LM,R0    ALLOLD            LOAD FPT INTO REGS                          
         AW,R0    R15               INSERT AREA NAME                            
         CAL1,7   R0                ALLOT OLOAD FILE                            
*                                                                               
         PAGE                                                                   
*                                                                               
*        INITIALIZE JBC'S BACKGROUND MAX MEM FROM K:BMEM                        
*                                                                               
         LH,R0    K:BMEM            MOVE SYSGEN BMEM VALUE                      
         LI,R2    BKGJID            TO BACKGROUND'S                             
         LW,R1    SJI1,R2           JCB                                         
         AI,R1    1                 --WORD 1                                    
         STH,R0   *R1               --UPPER HALF                                
         PAGE                                                                   
*                                                                               
*                                                                               
        DO1      #SYMB                                                          
         BAL,R14  IPLSYM            CLEAN UP PARTIAL SYMBIONT FILES             
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*                                                                               
         DO1      #LN                                                           
         BAL,R11  COCINITN          INITIALIZE COC                              
*                                                                               
*                                                                               
*                                                                               
*                                                                               
*        ENTER THE CONTROL TASK                                                 
*                                                                               
IPLMMEX  EQU      %                 OVERLAY EXIT                                
         B        CT1               INITIALIZATION IS NOW DONE                  
*                                                                               
*        IPLMM CRASH                                                            
*                                                                               
IPLMMCR  CRASH    'CP-R MEMORY INITIALIZATION ERROR'                            
INITAC   DATA     %+2                                                           
         GEN,8,24 16,0              16 WORDS, VIRTUAL 0                         
         DATA     X'55555555'                  READ AND EXECUTE                 
         DATA     X'55555555'                                                   
         DATA     X'55555555'                                                   
         DO1      (128-24)*2/16     # WORDS 2 PGS PER K, 16 PER WD              
         DATA     -1                NO ACCESS                                   
STMCODE  DATA     X'55555555'       WRITE LOCK CODE FOR STM                     
         PAGE                                                                   
*                                                                               
*        FPTS, ETC FOR CALS TO SET UP OPLABELS AND PROCESSOR FILES              
*                                                                               
*                                                                               
         DO       #ERRORLOG                                                     
*                                                                               
ALLERFL  GEN,8,1,23  X'5A',1,'SP'   FPT TO ALLOT ERRFILE.SP                     
         DATA     P1+P2+P3+P4+P5+P6+P7+F3+F5                                    
         DATA     ALLERROR          ERROR EXIT                                  
         DATA     1                 BLOCKED FORMAT                              
         TEXT     'ERRFILE '        FILE NAME                                   
         DATA     80                FILE SIZE (TO START)                        
         DATA     16                RSIZE                                       
         DATA     32                EXTENT SIZE (ADDED AS NEEDED)               
*                                                                               
ERFPT    GEN,8,1,23  X'62',1,'ER'   FPT TO STDLB ER TO SP/ERRORFIL              
         DATA     P1+P4+F2+F3+F7                                                
         DATA     ERERROR                                                       
         DATA     ERFILE-ERFPT+R0   FPT AND DATA IS LOADED INTO R0              
ERFILE   TEXT     '  SP'                                                        
         TEXT     'ERRFILE '                                                    
         FIN      #ERRORLOG                                                     
*                                                                               
*                                                                               
*                                                                               
         DO       #CRASH                                                        
*                                                                               
ALLCRSH  GEN,8,1,23  X'5A',1,'SP'   FPT TO ALLOT CRASH.SP                       
         DATA     P1+P3+P4+P5+P6+P7+F3+F5                                       
         DATA     ALLERROR          ERROR EXIT                                  
         TEXT     'CRASH   '        FILE NAME                                   
         DATA     10                FSIZE (INNOCUOUS)                           
         DATA     256               RSIZE                                       
         DATA     128               ESIZE (ENUF TO BE USEFUL)                   
*                                                                               
SEFPT    GEN,8,1,23  X'62',1,'SE'   FPT TO STDLB SE TO SP/CRASH                 
         DATA     P1+P4+F2+F3+F7                                                
         DATA     SEERROR                                                       
         DATA     SEFILE-SEFPT+R0   FPT AND DATA IS LOADED INTO R0              
SEFILE   TEXT     '  SP'                                                        
         TEXT     'CRASH   '                                                    
         FIN      #CRASH                                                        
*                                                                               
*                                                                               
*                                                                               
         DO       #JOBACCT                                                      
*                                                                               
ALLAL    GEN,8,1,23  X'5A',1,#ALAREA FPT TO ALLOT AL.D1                         
         DATA     P1+P2+P3+P5+P6+P7+F3+F5                                       
         DATA     ALLERROR          ERROR EXIT                                  
         DATA     1                 BLOCKED FORMAT                              
         TEXT     'AL  '            FILE NAME                                   
         DATA     160               FSIZE                                       
         DATA     8                 RSIZE                                       
         DATA     160               ESIZE                                       
*                                                                               
         FIN                        #JOBACCT                                    
*                                                                               
*                                                                               
*                                                                               
ALLRAD   RES      0                 ALLOT RADEDIT FILE                          
         GEN,8,1,23  X'5A',1,0                                                  
         DATA     P1+P3+P4+P5+P6+F3                                             
         DATA     ALLERROR          ERROR ADDRESS                               
         TEXT     'RADEDIT '        FILE NAME                                   
         DATA     55                FSIZE                                       
         DATA     256               RSIZE                                       
ALLRADE  RES      0                 END OF FPT                                  
*                                                                               
*                                                                               
ALLOLD   RES      0                 ALLOT OLOAD   FILE                          
         GEN,8,1,23  X'5A',1,0                                                  
         DATA     P1+P3+P4+P5+P6+F3                                             
         DATA     ALLERROR          ERROR ADDRESS                               
         TEXT     'OLOAD   '        FILE NAME                                   
         DATA     70                FSIZE                                       
         DATA     256               RSIZE                                       
ALLOLDE  RES      0                 END OF FPT                                  
*                                                                               
ALLERROR RES      0                 ALLOT ERROR                                 
         B        *R8               RETURN FOR NOW                              
*                                                                               
         DO       #LN                                                           
         PAGE                                                                   
********************************************************************************
*                                                                               
*  COC INITIALIZATION                                                           
*                                                                               
*  RETURN IF THIS IS A NON-COC SYSTEM.                                          
*                                                                               
*  SET UP THE COC INPUT AND OUTPUT INTERRUPT XPSD INSTRUCTIONS.                 
*                                                                               
*  IF IT IS DESIREABLE , A NOOP INSERT WILL CAUSE THE FOLLOWING                 
*  TO OCCUR ( THE INSTRUCTION IS NOTED BOLDLY IN THE CODE) ;                    
*  WE EXECUTE A 'TURN RECEIVER L DATASET OFF - TURN BACK-TO-BACK                
*  TEST OFF' WRITE DIRECT TO EACH RECEIVER.  THIS IS IN CASE THE CE'S           
*  HAVE TURNED THE BACK-TO-BACK TEST FEATURE ON WITH THEIR DIAGNOSTICS.         
*  WE THEN DELAY FOR AT LEAST 80 MILLI-SECONDS BEFORE TURNING THE               
*  RECEIVERS ON (IN COCINIT).  NOTE THAT THIS WILL HANG UP THE                  
*  PHONE LINE IF DIAL-UP.                                                       
*                                                                               
*  CALL COCINIT (IN THE COC MODULE IN THE ROOT) TO COMPLETE                     
*  INITIALIZATION.                                                              
*                                                                               
********************************************************************************
COCINITN     EQU  %                                                             
         LH,R0    DCT7              EXTENDED DCTS                               
         SH,R0    DCT1              SAME SIZE                                   
         BEZ      *R11              B/NON-COC; RETURN                           
         DO       #CMC                                                          
         LW,R8    CO:IN0                   GET CMC INTERRUPT ADDRESS            
         ELSE     #CMC                                                          
         LH,R8    COH:II                   ADDR OF INT                          
         FIN      #CMC                                                          
         LCI      4                 MOVE 4                                      
         LM,R0    ICO:IN0           FOR HIGHEST INPUT PSD                       
         LCI      4                                                             
         STM,R0   CO:IN0                                                        
         LW,R0    ICO:XIN0          GET INPUT PSD 0                             
         STW,R0   *R8               STORE XPSD                                  
*                                                                               
         DO       #CMC=0                                                        
         LCI      4                                                             
         LM,R0    ICO:CMND          MOVE IOCDS                                  
         LI,R7    CO:CMND           BASE                                        
         LI,R6    0                 COC COUNT                                   
         B        CINITSL           DO FIRST ONE                                
*                                                                               
CINITSS  AI,R3    4                 INCREMENT TIC                               
         AI,R7    4                 INCREMENT STORAGE                           
         AI,R6    1                                                             
         CI,R6    LCOC              DONE                                        
         BG       CINITSD           YES                                         
*                                                                               
CINITSL  AND,R0   YFF               CLEAR OLD ADDRESS                           
         AND,R1   YFF               CLEAR OLD BYTE COUNT                        
         LW,R9    CO:RINGE,R6       END OF BUFFER                               
         SLS,R9   2                 BYTE ADDRESS                                
         SH,R9    COH:RBS           SUBTRACT BUF SIZE                           
         AW,R0    R9                PUT IN BASE OF BUFFER                       
         AH,R1    COH:RBS           PUT IN BYTE COUNT                           
         LCI      4                                                             
         STM,R0   0,R7              STORE THIS IOCD                             
         B        CINITSS           NEXT                                        
*                                                                               
CINITSD  EQU      %                                                             
*                                                                               
         LI,R1    LCOC              MORE THAN ONE COC                           
         BEZ      CINITB            NO                                          
*                                                                               
         LW,R0    ICO:XINN          GET INPUT PSD N                             
         LH,R8    COH:II,R1         INT ADR                                     
         STW,R0   *R8               STORE XPSD                                  
         BDR,R1   %-2                                                           
*                                                                               
         LCI      7                 MOVE 7                                      
         LM,R0    ICO:INN           FOR REMAINING INPUT INTS                    
         LCI      7                                                             
         STM,R0   CO:INN                                                        
*                                                                               
CINITB   EQU      %                                                             
         LCI      6                 MOVE 6                                      
         LM,R0    ICO:OUT0          FOR EACH COC OUTPUT INT                     
         LI,R7    CO:OUT0           BASE                                        
         AW,R7    ICO:XOUT          OUTPUT INT XPSD                             
         LI,R8    0                 LOOP COUNTER                                
         B        CINITL                                                        
*                                                                               
CINITS   AI,R2    6                 FOR GOING TO LI INSTR                       
         AI,R4    1                 THE LI INSTR                                
         AI,R7    6                 FOR STORAGE                                 
         AI,R8    1                 FOR LOOP                                    
         CI,R8    LCOC              DONE                                        
         BG       CINITDN           YES                                         
*                                                                               
CINITL   LCI      6                                                             
         STM,R0   0,R7                                                          
         LH,R9    COH:IO,R4         OUTPUT INT ADDRESS                          
         STW,R7   *R9               STORE OUTPUT XPSD                           
         STW,R7   CO:OUT,R4         SAVE INTERRUPT ADDRESS                      
         B        CINITS            NEXT ONE                                    
*                                                                               
CINITDN  EQU      %                                                             
*                                                                               
         FIN      #CMC=0                                                        
*                                                                               
         LI,R1    4                                                             
         STW,R1   COCHPB            BASE OFFSET FOR COC BUFFERS                 
CINITBF  LW,R2    R1                RETAIN LINK                                 
         AI,R1    4                 EACH BUFFER 4 WORDS                         
         STW,R1   COCBUF,R2         STORE FORWARD                               
         CI,R1    HRBA              DONE                                        
         BL       CINITBF           NO                                          
*                                                                               
         DO       #CMC=0                                                        
******************************************************************************* 
*  NOP THE FOLLOWING INSTRUCTION TO TURN ON THE BACK-TO-BACK MODE CHECK.        
******************************************************************************* 
         B        COCINIT           B/COCINIT; NO BACK-TO-BACK MODE TESTS       
         LI,R3    0                 L/0; COC NUMBER                             
NXTCOC   EQU      %                                                             
         LH,R0    COH:DN,R3         L/COC DEVICE ADR                            
         TIO,R0   *R0               TIO; SEE IF COC IS THERE                    
         BCS,12   GTNXTCOC          B/COC NOT THERE; SKIP TO NEXT               
         LI,R7    0                 L/0; LINE NUMBER                            
NXTLINE  EQU      %                                                             
         EXU      CO:RCVDO,R3       TURN RECEIVER L DATASET OFF -               
*                                   TURN BACK-TO-BACK TEST OFF                  
         AI,R7    1                 +1 TO LINE NUMBER                           
         LD,R4    COD:LPC,R3        L/LIMITS OF LOGICAL LINES FOR COC           
         SW,R5    R4                LAST PHYSICAL LINE # = LAST LOGICAL -       
*                                   FIRST LOGICAL LINE #                        
         CW,R7    R5                C/CURRENT LINE # W/LAST LINE #              
         BLE      NXTLINE           BLE; CHECK NEXT LINE                        
GTNXTCOC EQU      %                                                             
         AI,R3    1                 +1 TO COC NUMBER                            
         CI,R3    LCOC              C/CURRENT COC # W/LAST COC #                
         BLE      NXTCOC            BLE; CHECK NEXT COC                         
         LI,R8    X'17000'          DELAY FOR AT LEAST 80 MILLI-SECONDS         
         BDR,R8   %                    BEFORE INITIALIZING COC                  
         FIN      #CMC=0                                                        
         B        COCINIT           B/COCINIT; R11 IS RETURN REG                
*                                                                               
*                                                                               
ICO:IN0  DATA     0,0,COCIP,X'10'                                               
*                                                                               
         DO       #CMC=0                                                        
ICO:INN  DATA     0,0,CO:INN+4,X'07000010'                                      
         LW,R5    CO:IIL            TRIGGER HIGHEST INPUT INT                   
         WD,5     X'1700'+COA:IIG                                               
         LPSD,11  CO:INN            EXIT TO THAT LEVEL                          
*                                                                               
*                                                                               
ICO:OUT0 DATA     0,0,CO:OUT0+4,X'07000010'                                     
         LI,R3    0                 COC NUMBER                                  
         B        COCOP             GO HANDLE THIS ONE ONLY                     
*                                                                               
         FIN      #CMC=0                                                        
*                                                                               
ICO:XIN0 XPSD,8   CO:IN0            INPUT XPSD 0                                
         DO       #CMC=0                                                        
ICO:XINN XPSD,8   CO:INN            INPUT XPSD N                                
ICO:XOUT XPSD,8   0                 OUTPUT XPSDS                                
*                                                                               
*                                                                               
ICO:CMND GEN,8,24 2,0               READ                                        
         GEN,8,24 X'80',0           DATA CHAIN                                  
         GEN,8,24 8,DA(CO:CMND)     TIC BACK TO FIRST                           
     DATA     0                                                                 
*                                                                               
         FIN      #CMC=0                                                        
*                                                                               
         FIN      #LN                                                           
*                                                                               
         OLAYEND                                                                
*                                                                               
        FIN      #MAP                                                           
         END                                                                    
