         SYSTEM   SIG9P                                                         
         SYSTEM   OPTIONS                                                       
*                                                                               
*        OVERLAY MADE UP OF TERMINATION CLASS CALS AND ERROR                    
*                 HANDLING FROM ALL STD CALS                                    
*                                                                               
*        TMSETERR                                                               
*        TMDCBERR                                                               
*        TMSETPSD                                                               
*        TMSETREG                                                               
*        KJOB                                                                   
*        EXTM                                                                   
*        STATUS,MODIFY                                                          
*        RLS                                                                    
*        SEGLOAD                                                                
*                                                                               
         DEF      A:EXTM                                                        
         DEF      TMSETE,TMDCBERR                                               
         DO1      #ECB                                                          
         DEF      KJOB                                                          
         DEF      STATUS,MODIFY                                                 
         DEF      RLS                                                           
         DEF      TRMXR8,TRMXTERM,TRMXTRMJ                                      
         DEF      TRMX                                                          
         DEF      SEGLOAD                                                       
         DEF      SEGEXIT                                                       
OLAYFLAG EQU      'EXTM'                                                        
         PSYS     0                                                             
         SYSTEM   CPRMON                                                        
*                                                                               
*        OVERLAY EXITS AND REFS                                                 
*                                                                               
TRMXR8   B        *R8                                                           
TRMXTERM B        TMTERM                                                        
TRMXTRMJ B        TMTRMJ                                                        
TRMXBAD  LI,R15   TYCTRAP           SET R15=BADCAL                              
         B        TRMX                                                          
TRMXTMX1 BAL,R8   TMSETERR          SET ERROR REGS AND PSD                      
         BAL,R8   TMTYC15S          SET TYPE COMPL WORD IN FPT                  
TRMX     B        CALSTDX                                                       
         TITLE    '** EXTM - TMSETERR SUBROUTINE **'                            
******************                                                              
*    TMSETERR    *       SUBROUTINE  TO SET R8 AND R10 IN RTS IF ERROR          
******************            OCCURED ON CAL1.   ALTERS RETURN PSD              
*                *            ACCORDING TO STANDARD FPT SPECS.                  
*                                                                               
* ENTRY: R2       DCB ADDRESS (I/O ONLY)                                        
*        R3       FPT ADDRESS                                                   
*        R15      ERROR CODE (BYTE 3)                                           
*        BAL,R8   TMSETERR    IF FPT ERROR/ABNORMAL ADDRESSES TO BE USE         
* EXIT:  +1       R15=TYC                                                       
* REGISTERS USED: R0,R8,R14,R15 IF ERROR                                        
*           SAVED: R1-R7,R9-R13                                                 
* STACK WORDS: 5                                                                
* SUBROUTINES:    GETFPTN,TMSETREG,TMSETPSD                                     
* NOTE:  TRANSLATES TYC'S LESS THAN OR EQUAL TO X'18'                           
*        TMSETERR IS PERMANENTLY RESIDENT IN THE MONITOR ROOT                   
*        IF THE TYC IS NOT NORMAL, AND BALBIT IS OFF, COMES TO                  
*        TMSETE IN THE OVERLAY                                                  
TMSETE   PUSH     5,R5              ERROR TYC, SAVE REGS                        
         CI,R15   TMSETXL           IS TYC AN I/O TYC WHICH REQUIRES            
         BG       TMSETE4               TRANSLATION                             
*                                                                               
*        IO FPT ERROR HANDLING                                                  
*                                                                               
         LW,R6    R15                   YES, TRANSLATE IT                       
         LB,R9    TMSETX,R6                                                     
         CI,R9    TYCF0                 INVALID TYC=SYS ERROR?                  
         BL       %+2                   NO                                      
         LW,R6    R9                    YES-SET R6                              
         CI,R9    TYC40             IF ERR CODE IS GTR OR =                     
         BGE      TMSETE1               40, USE ERR ADDR                        
         LI,R15   FPTABAD               LT 40, USE ABN ADDR                     
         BAL,R5   GETFPTN                                                       
         B        TMSETE3               NOT GIVEN, EXIT                         
         CI,R15   0                     =0, EXIT                                
         BE       TMSETE3                                                       
         B        TMSETE2               ABN EXTI GIVEN, CONT                    
TMSETE1  RES      0                                                             
         LI,R15   FPTERAD           P1=ERR ADDR PARAMETER                       
         LB,R5    *R3                                                           
         AND,R5   M7                R5= FPT CODE                                
         CLM,R5   DATA1C1D          IS IT A PFIL OR PREC                        
         BCS,9    %+2               NO, BRANCH                                  
         LI,R15   FPTABAD           YES, USE P2 FOR ERR AND ABN                 
         BAL,R5   GETFPTN                                                       
         LI,R15   0                     NOT PRESENT, CONTINUE                   
TMSETE2  LW,R5    R15               SAVE ERROR ADDR                             
         LW,R15   R6                    RESTORE R15 TO TYC                      
         LW,R6    R2                SET R6=DCB ADDRESS ON I/O ERRORS            
         BAL,R8   TMSETREG          SET REGISTERS                               
         LW,R9    R5                    SET R9=ADDRESS                          
         BAL,R6   TMSETPSD                                                      
         B        TMSETEX           EXIT                                        
TMSETE3  LW,R15   R6                RESTORE TYC                                 
         B        TMSETEX           EXIT                                        
*                                                                               
*        NON-IO (STANDARD) FPT ERROR HANDLING                                   
*                                                                               
TMSETE4  LW,R9    R15               SET R9 = TYC                                
         LW,R6    R3                    R6=FPT ADDR FOR R10                     
         LB,R0    *R3               GET FPT CODE                                
         AND,R0   X7F               MASK IT                                     
         CI,R0    X'29'             IS IT A SERVICE WITH NO P0 BIT              
         BLE      TMSETE4A          YES, DON'T CHECK P0                         
         CI,R0    X'47'             DELFPT                                      
         BE       TMSETE4A          YES                                         
         LW,R0    0,R3                  IS FPT EXTENDED?                        
         CW,R0    XFPTP0                (P0 BIT IN STD FPT)                     
         BANZ     TMSETE4A          YES, ERR PARAM PRESENT                      
         BAL,R8   TMSETREG          ERR NOT PRESENT, SET REGS                   
         B        TMSETE5           EXIT                                        
TMSETE4A RES      0                                                             
         LI,R15   FPTERAD                                                       
         BAL,R5   GETFPTN           GET ERR ADDR IN R15                         
         NOP                        R15= 0 IF NOT PRESENT                       
         LW,R5    R15               R5= ERROR ADDRESS                           
         LW,R15   R9                R15 CONTAINS TYC                            
         BAL,R8   TMSETREG          SET R8,R10 IN USERS STACK                   
         LW,R9    R5                MOVE ERROR ADDRESS TO R9                    
         BAL,R6   TMSETPSD          MODIFY RETURN ADDRESS                       
TMSETEX  PULL     5,R5              RESTORE REGS AND EXIT                       
         B        TRMXR8                                                        
TMSETE5  CI,R15   TYCTRAP           TYC ALREADY HGHR THAN TRAP                  
         BGE      TMSETEX               EXIT                                    
         LI,R15   TYCTRAP               IF NOT, SET IT TO                       
         B        TMSETEX               TRAP AND EXIT                           
*                                                                               
TMSETX   DATA,1   0,0               TABLE TO XLATE TYCS                         
         DATA,1   X'07'             02                                          
         DATA,1   X'1D'             03                                          
         DATA,1   X'30'             04                                          
         DATA,1   X'1C'             05                                          
         DATA,1   X'05'             06                                          
         DATA,1   X'06'             07                                          
         DATA,1   X'41'             08                                          
         DATA,1   X'45'             09                                          
         DATA,1   X'42'             0A                                          
         DATA,1   X'FF'             0B                                          
         DATA,1   X'FF'             0C                                          
         DATA,1   X'FF'             0D                                          
         DATA,1   X'FF'             0E                                          
         DATA,1   X'FF'             0F                                          
         DATA,1   X'4B'             10                                          
         DATA,1   X'4C'             11                                          
         DATA,1   X'4D'             12                                          
TMSETXL  EQU      X'12'             MAX TYC TO XLATE                            
         TITLE    '** EXTM - TMBCERR SUBROUTINE **'                             
******************                                                              
*    TMDCBERR    *       SUBROUTINE TO SET R8 AND R10 IN RTS IF DCB             
******************            TYPE ERROR CONDITION ON CAL1, ALTERS              
*                             PSD IN RTS FOR RETURN ACCORDING TO SPECS.         
* ENTRY: R2       DCB ADDRESS                                                   
*        R3       FPT ADDRESS                                                   
*        R15      TYC (BYTE 3)                                                  
*        BAL,R8   TMDCBERR                                                      
* EXIT   +1       ALL CONDITIONS, R15=TYC (MAY BE ALTERED)                      
* REGISTERS USED: R0,R8,R15 IF ERROR                                            
*           SAVED: R1-R7,R9-R14, R15 IF NO ERROR                                
* STACK WORDS:    4                                                             
* SUBROUTINES: TMSETREG, TMSETPSD                                               
*                                                                               
TMDCBERR BIFBAL   TRMXR8            ENTRY INTERNALLY, LEAVE RTS                 
         PUSH     4,R6              SAVE REGS                                   
         LW,R9    M17                   SET R9 TO ISOLATE ADDR                  
         CI,R15   TYC40             USE ABNORMAL OR ERROR EXIT                  
         BL       TMDCBE1               IF LT X'40'-USE ABNORMAL                
         LS,R9    3,R2                  IF GTE X'40'-USE ERROR                  
         B        TMDCBE2                                                       
TMDCBE1  LS,R9    4,R2                                                          
         BEZ      TMDCBE3           IF ABNORMAL ADDRESS=0, EXIT                 
TMDCBE2  XW,R9    R15               SAVE THE EXIT ADDRESS                       
         LW,R6    R2                SET R6=DCB ADDR                             
         BAL,R8   TMSETREG          SET R8,R10                                  
         XW,R9    R15               RESTORE R9,R15                              
         BAL,R6   TMSETPSD          SET THE EXIT ADDRESS                        
TMDCBE3  PULL     4,R6                                                          
         B        TRMXR8                                                        
         TITLE    '** EXTM - EXTM CAL PROCESSOR **'                             
*                                                                               
*        EXTM     CAL PROCESSOR TO TERMINATE A TASK                             
*                                                                               
EXTM     RES      0                                                             
A:EXTM   EQU      EXTM                                                          
         LI,R15   TYCNORM           SET R15 TO NORMAL COMPLETION                
         LW,R0    0,R3                  WAS THE FPT EXTENDED?                   
         CW,R0    XFPTP0                NO                                      
         BAZ      TRMXTERM              TERMINATE CALLER                        
         BAL,R8   TMGETIDS          FIND THE JOB OF THE TASK                    
         B        TRMXTMX1              BEING TERMINATED (ERROR)                
         DO       #ROLL                                                         
         CI,R5    MMLMID            TRYING TO TERM A SYSTEM TASK?               
         ELSE     #ROLL                                                         
         CI,R5    CTLMID                                                        
         FIN      #ROLL                                                         
         BLE      EXTM2                 YES, GIVE ERR 62                        
         LB,R1    TCBPOINT          THE CALLING TASK'S LM                       
         CB,R5    STILMID,R1                                                    
         BE       TRMXTERM              YES                                     
         CI,R6    BKGJID                BACKGROUND EXTM                         
         BNE      EXTM0                 NO, CONTINUE                            
         CI,R1    CTID                  CONTROL TASK CALLING                    
         BNE      EXTM2                 NO, ERROR                               
EXTM0    LW,R0    1,R3              IS THE ABNRMAL BIT REQUESTED?               
         CI,R0    FPTF1                                                         
         BANZ     EXTM1                 YES, ABORT THE TASK                     
         BAL,R8   TMTRMT                NO, TERM THE TASK                       
         B        TRMXTMX1          EXIT                                        
EXTM1    BAL,R8   TMABRTT                                                       
         B        TRMXTMX1          EXIT                                        
EXTM2    LI,R15   TYC62             SET ERROR CODE 62, TSK NAME                 
         B        TRMXTMX1              EXIT                                    
         TITLE    '** EXTM - KJOB CAL PROCESSOR **'                             
*                                                                               
*        KJOB     KILL JOB CAL PROCESSING                                       
*                                                                               
         DO       #ECB                                                          
KJOB     LI,R15   TYCNORM           SET TYC TO NORMAL                           
         BAL,R8   TMGETJID          GET JOB ID FOR JOB NAME                     
         B        TRMXTMX1          IGNORE ERROR RETURN                         
         CI,R6    RBMJID            IS IT THE RBM/CPR JOB                       
         BE       KJOB2             YES, ERROR                                  
         CI,R6    BKGJID            IS IT THE BKG JOB                           
         BE       KJOB2             YES, ERROR                                  
         LI,R9    LMIT+LMIA             BACKGROUND, ABORT JOB                   
KJOB1    LB,R4    TCBPOINT          IS IT THE CALLER JOB                        
         CB,R6    STIJID,R4                                                     
         BE       TRMXTRMJ              KILL CALLERS JOB                        
         BAL,R8   TMTRMJ            TERMINATE JOB                               
         B        TRMXTMX1          GO TO EXIT                                  
*                                                                               
*                                                                               
KJOB2    RES      0                                                             
         LI,R15   TYC63             ILLEGAL JOB NAME                            
         B        TRMXTMX1          EXIT                                        
         FIN      #ECB                                                          
         TITLE    '** EXTM - STATUS/MODIFY CAL PROCESSOR **'                    
*                                                                               
*        STATUS   CAL PROCESSOR                                                 
*        MODIFY   CAL PROCESSOR                                                 
*                                                                               
STATUS   EQU      %                                                             
MODIFY   EQU      %                                                             
         LW,R0    0,R3                  REJECT FPT IF IT IS NOT                 
         CW,R0    XFPTP0                EXTENDED WITH P0 BIT                    
         BAZ      TRMXBAD                                                       
         LB,R4    TCBPOINT          R4 = CALLERS TASK-ID                        
*                                                                               
         LI,R15   3                                                             
         BAL,R5   GETP              CHECK TASK NAME PAR                         
         B        TMSM0A            B IF ABSENT                                 
         CI,R15   0                                                             
         BE       TMSM0A            B IF ZERO                                   
*                                                                               
*        TASK NAME IS SPECIFIED                                                 
*                                                                               
         BAL,R8   TMGETIDS          GET TASK ID                                 
         B        TRMXTMX1          B IF BADLY SPECIFIED                        
         CI,R1    X'4E'                                                         
         BE       TMSM0B            B IF STATUS REQ.                            
         B        TMSM2             B IF MODIFY REQ.                            
*                                                                               
*        UNSPECIFIED TASK. USE CALLER                                           
*                                                                               
TMSM0A   RES      0                                                             
         CI,R1    X'4E'             IS THIS STATUS CAL                          
         BNE      TMSM1             NO, A MODIFY CAL                            
*                                                                               
*        TELL CALLER WHO HE IS                                                  
*                                                                               
         LB,R5    STILMID,R4                                                    
         LD,R8    LMINAME,R5        R8,9 = LM NAME                              
         LI,R15   3                                                             
         BAL,R5   GETP              GET TASK NAME(1)                            
         B        %+2               NOT PRESENT                                 
         STW,R8   *R14              SET TASK NAME(1)                            
         LI,R15   4                                                             
         BAL,R5   GETP              GET TASK NAME(2)                            
         B        %+2               NOT PRESENT                                 
         STW,R9   *R14              SET TASK NAME(2)                            
         LB,R6    STIJID,R4                                                     
         LD,R8    SJI2,R6           R8,9 = JOB NAME                             
         LI,R15   11                                                            
         BAL,R5   GETP              GET JOB NAME(1)                             
         B        %+2               NOT PRESENT                                 
         STW,R8   *R14              SET JOB NAME(1)                             
         LI,R15   12                                                            
         BAL,R5   GETP              GET JOB NAME(2)                             
         B        %+2               NOT PRESENT                                 
         STW,R9   *R14              SET JOB NAME(2)                             
*                                                                               
*        RETURN ACCOUNT/USER NAMES IF REQUESTED (STATUS CALL)                   
*                                                                               
TMSM0B   RES      0                                                             
         LI,R15   14                                                            
         BAL,R5   GETPII                                                        
         B        TMSM1             B IF ACCOUNT USER NAME NOT NEEDED           
         LB,R6    STIJID,R4                                                     
         LW,R6    SJI1,R6           R6 = JCB POINTER                            
         LCI      5                                                             
         LM,R8    JCBACCNT,R6       GET ACCOUNT/USER NAMES                      
         STM,R8   *R14              SET ACCOUNT/USER NAMES                      
*                                                                               
TMSM1    RES      0                                                             
         LB,R5    STILMID,R4        GET LM ID                                   
*                                                                               
TMSM2    RES      0                                                             
         LI,R15   FPTPRIO           FETCH THE FLAGS, PRIORITY                   
         BAL,R5   GETFPTN               WORD AND ITS ADDRESS                    
         B        TMSM9                 NOT PROVIDED                            
         LB,R0    *R3               IS THE CAL STATUS?                          
         CI,R0    X'4E'                                                         
         BE       TMSTAT                YES                                     
         LB,R0    STISTAT,R4        IF THE IDENTIFIED TASK                      
         CI,R0    STIPRIM               WAS CURRENT R4 WILL NOT                 
         BANZ     TMSME1               BE ZERO BUT CALL IS INVALID              
         LB,R5    STILMID,R4            RESTORE THE LMID                        
TMMODFY  STH,R15  R14               MODIFY CAL, CHANGE THE                      
         LW,R15   XSTIPR                PRIORITY TO THAT IN                     
         DISABLE                        THE CALLERS FPT                         
         STS,R14  STIPRIO,R4                                                    
         DO1      #MULTDSP                                                      
         XPSD,0   TMDQ                  REQUEUE                                 
         ENABLE                                                                 
         BAL,R8   TMTPRIO               TRIGGER IT IF IT IS HIGHER              
         B        TMSM9                 PRIORITY                                
TMSTAT   RES      0                                                             
         LB,R5    STILMID,R4        RESTORE LMID                                
         LW,R12   STIPRIO,R4        FETCH THE TASK PRIORITY                     
         LH,R12   R12                   IN THE RIGHT HALF OF                    
         AND,R12  M16                   REMOVE SIGN EXTENSION                   
         LH,R0    LMISTAT,R5        GET PRESENT TASKNAME STATUS                 
         AND,R0   M16               ELIMINATE SIGN EXTENSION                    
         SLS,R0   16                POSITION                                    
         AW,R12   R0                COLLECT ALL STATUS                          
         STW,R12  *R14              STORE INTO CALLER FPT                       
TMSM9    LI,R15   TYCNORM                                                       
         B        TRMXTMX1          EXIT                                        
TMSME1   LI,R15   TYC62             TASK NAME ERROR                             
         B        TRMXTMX1                                                      
         TITLE    '** EXTM - RLS CAL PROCESSOR **'                              
*                                                                               
*                                   RELEASES FGD PROG. FROM FP TABLE            
*                                   NO ERROR RETURNS                            
*                                   IF PROG. NOT IN FP OR IF A PUB LIB          
*                                     JUST RETURNS                              
*                                                                               
*                                                                               
*                                                                               
RLS      STW,R0   R7                R7=FPT ADD.                                 
         BIFBKG   TRMXBAD           BRANCH IF BACKGROUND                        
         LI,R15   TYCNORM               R15=NORMAL EXIT (COMPL)                 
         LW,R2    1,R7                                                          
         LW,R3    2,R7              R2,R3=NAME OF PROG. TO RLS                  
RLS2     ENABLE                                                                 
         LW,R14   RUN99             R14=REENTRANCE COUNT                        
         LB,R1    LMI#              NO. OF ENTRIES                              
         BEZ      TRMX              NO LMI                                      
         LI,R6    RBMJID            SET JOB ID TO RBM                           
RLS2A    DISABLE                                                                
         CD,R2    LMINAME,R1         SEARCH FOR LOAD MODULE NAME                
         BNE      RLS2B                     NOT IT                              
         LW,R0    LMIJID,R1                 JOB EQUAL TO RBM                    
         CB,R6    R0                                                            
         BE       RLS3                      YES, LOAD MOD FOULD                 
RLS2B    ENABLE                     CONTINUE THROUGH ALL LMI                    
         BDR,R1   RLS2A                                                         
         CW,R14   RUN99             WAS RUN ENTERED WHILE WE RAN                
         BNE      RLS2              YES, START OVER                             
         B        TRMX              PROG NOT IN LMI, EXIT                       
RLS3     LH,R0    LMISTAT,R1        GET STATUS FLAGS                            
         CI,R0    LMISEC                SECONDARY?                              
         BANZ     TRMX                  YES, IGNORE CAL                         
         CI,R0    X'60'             IS IT A PUB LIB                             
         BAZ      RLS5                  NO                                      
RLS4     ENABLE                                                                 
         B        TRMX              EXIT                                        
RLS5     LW,R5    R1                PUT LMI INDEX IN R5                         
         LI,R9    LMIT                  AND CALL SUBR TO                        
         BAL,R8   TMLM                  SCHED PRIMARY FOR                       
         B        TRMX                  TERMINATION                             
         TITLE    '** EXTM - SEGLOAD CAL PROCESSOR **'                          
*                                                                               
*                                   LOADS OVERLAY SEGMENTS INTO CORE            
*                                     USING M:SL DCB AND OVLOAD TABLE           
*                 REG 3 MUST HAVE MU BIT IF ADDR WITHIN MONITOR                 
*                                                                               
SEGLOAD  STW,R3   R7                R'=ADDRESS OF FPT                           
         LI,R13   0                 R13=ERROR ADD.                              
         LI,R1    1                                                             
         LB,R12   *R7,R1            GET P,T FLAGS IN R12                        
         CI,R12   X'40'             IS ERROR ADDRESS PRESENT                    
         BAZ      SEGLD1            NO                                          
         CI,R12   X'80'             IS END ACTION PARAM. PRESENT                
         BANZ     %+3               YES,GET ERROR ADD. FROM +2                  
         LW,R13   1,R7              NO, GET ERROR ADDRESS                       
         B        %+2                                                           
         LW,R13   2,R7              YES, GET ERROR ADDRESS                      
         LW,R9    R13               ERROR ADDRESS                               
         BAL,R8   TMVADR            CHECK VALIDITY                              
         B        TRMXBAD                                                       
SEGLD1   CI,R12   1                 IS T FLAG (TRANSFER TO SEG) SET             
         BANZ     SEGLD2            YES, DISREGARD END ACTION                   
         CI,R12   X'80'             NO, IS THERE END ACTION                     
         BAZ      SEGLD2            NO                                          
         LW,R15   1,R7              YES, R15=END ACT. INT.                      
         LW,R2    R15               SAVE END ACTION WORD IN R2                  
         CW,R15   YC                                                            
         BAZ      SEGLD2            IGNORE IF NOT INTERR LABEL OR NO.           
         BAL,R4   CKENACT2          CHECK LEGALITY OF END ACTION                
         B        TRMXBAD           END ACTION ILLEGAL                          
SEGLD2   LW,R6    PCBPOINT          R6=PCB ADD.                                 
         LW,R5    5,R6              R5=M:SL DCB ADDRESS                         
         LW,R4    2,R6              R4=OVLOAD ADDRESS                           
         LW,R9    R5                M:SL ADDRESS                                
         BAL,R8   TMVADR            CHECK VALIDITY                              
         B        TRMXBAD                                                       
         LW,R9    R4                OVLOAD ADDRESS                              
         BAL,R8   TMVADR            CHECK VALIDITY                              
         B        TRMXBAD                                                       
         LW,R1    0,R4              GET NO. ENTRIES IN OVLOAD IN R1             
         BEZ      TRAPX             ERROR, OVLOAD EMPTY                         
         CI,R1    256                                                           
         BG       TRAPX             ERROR IF MORE THAN 256 OVLOAD ENTRYS        
         LW,R15   0,R7                                                          
         BAL,R0   GETEFADR                                                      
         AND,R15  M16               R15=SEGMENT ID FROM FPT                     
         BEZ      TRAPX             ERROR IF SEG=0                              
SEGLD7   LW,R0    1,R4              SEARCH OVLOAD FOR RIGHT ENTRY               
         AND,R0   M16               MASK                                        
         CW,R0    R15               THIS ENTRY                                  
         BE       SEGLD8            FOUND IT                                    
         AI,R4    11                STEP TO NEXT ENTRY                          
         BDR,R1   SEGLD7                                                        
         B        TRAPX             ERROR, CAN'T FIND ENTRY                     
SEGLD8   LW,R9    R4                OVLOAD TABLE ENTRY ADDRESS                  
         BAL,R8   TMVADR            CHECK VALIDITY                              
         B        TRMXBAD                                                       
         LI,R0    K10                                                           
         STB,R0   R5                STORE READ ORDER IN M:SL ADD.               
         CW,R5    2,R4              IS WORD 2 OF OVLOAD STILL INTACT            
         BNE      TRAPX             NO,ERROR                                    
         CI,R12   1                 ARE WE SUPPOSED TO ENTER SEG LOADED         
         BAZ      SEGLD10           NO                                          
         LW,R9    11,R4             YES, IS ENTRY ADDRESS OK                    
         BAL,R8   TMVADR            CHECK VALIDITY                              
         B        TRMXBAD                                                       
SEGLD10  STW,R13  4,R4                                                          
         STW,R13  5,R4              STORE ERROR ADD. IN FPT                     
         STW,R13  3,R5              STORE ERROR ADD. IN DCB                     
         STW,R13  4,R5                                                          
         CI,R12   1                 SHOULD WE ENTER NEW SEG                     
         BANZ     SEGLD15           YES, MUST BE WAIT THEN                      
         CI,R12   K80               NO, IS THERE END ACTION                     
         BAZ      SEGLD13           NO, DO READ WITH WAIT                       
         CW,R2    YC                IS I=0                                      
         BAZ      SEGLD13           YES, NO E.A. AND FORCE WAIT                 
         LW,R0    SEGLD91           YES, READ WITH NO WAIT                      
         B        %+2                                                           
SEGLD13  LW,R0    SEGLD92           READ WITH WAIT                              
         STW,R0   3,R4              STORE WORD 2 OF FPT                         
         LW,R0    0,R7              GET SEGLOAD FPT WORD 0                      
         CW,R0    Y008              IS END-ACTION REQUESTED                     
         BAZ      SEGLD14           NO, BRANCH                                  
         LW,R0    1,R7                                                          
         STW,R0   9,R4              STORE END ACTION IN FPT                     
SEGLD14  RES      0                                                             
         LW,R0    R4                STEP R0 TO POINT TO WORD 0 OF FPT           
         AI,R0    2                                                             
         LW,R3    R0                GET FPT ADDRESS                             
         LB,R0    R7                MOVE 'MU' BIT                               
         STB,R0   R3                                                            
SEGEXIT  EQU      %                                                             
         B        READWRIT                                                      
SEGLD15  LB,R6    TCBPOINT          GET STI INDEX                               
         LD,R1    STIRTSB,R6        GET POINTER TO TOP OF STACK                 
         LW,R6    16-CAL1PUSH,R1    GET FIRST WORD OF PSD                       
         LW,R8    11,R4             GET OVLOAD SEGMENT ENTRY ADDRESS            
         AI,R8    -1                MAKE IT LOOK LIKE CAL ENTRY                 
         LI,R9    X'1FFFF'          MASK                                        
         STS,R8   R6                MODIFY ADDRESS                              
         STW,R6   16-CAL1PUSH,R1    REPLACE IN STACK                            
         B        SEGLD13                                                       
SEGLD90  GEN,8,3,21  7,0,1          VALIDITY COMPARISON FOR DCB WD 1            
SEGLD90M GEN,8,3,21  X'FF',6,X'1FEFFF'  MASK FOR DCB WD 1 CHECK                 
SEGLD91  DATA     X'F1C00100'                                                   
SEGLD92  DATA     X'F1400010'                                                   
         OLAYEND                                                                
         END                                                                    
