         PCC      0                                                             
         DEF      TAPE,TAPEPRE,TAPEPOST,MTAP,MTAPCU,7TAP,7TAPCU                 
         SYSTEM   SIG5P                                                         
         SYSTEM   OPTIONS                                                       
OLAYFLAG EQU      'TAPE'                                                        
         SYSTEM   CPRMON                                                        
         TITLE    '** TAPE **'                                                  
         TITLE    '** TAPE - TAPE CONTROL TABEL PROC **'                        
         DO       #MTAPE                                                        
*                                                                               
* PROC TO BUILD TAPE CONTROL TABLES                                             
*                                                                               
AFTER    CNAME                                                                  
         PROC                                                                   
         LOCAL    X1,X2,X3,X4,X5,X6,X7,X8                                       
         LOCAL    V1,V2,V3,V4,V5,V6,V7,V8                                       
         LOCAL    I,J,TERM,EXIT,VALUE                                           
*                                                                               
* SET UP DEFAULTS                                                               
*                                                                               
X1       SET      25                                                            
V1       SET      25                                                            
*                                                                               
X2       SET      25                                                            
V2       SET      25                                                            
*                                                                               
X3       SET      25                                                            
V3       SET      25                                                            
*                                                                               
X4       SET      25                                                            
V4       SET      25                                                            
*                                                                               
X5       SET      25                                                            
V5       SET      25                                                            
*                                                                               
X6       SET      25                                                            
V6       SET      25                                                            
*                                                                               
X7       SET      25                                                            
V7       SET      25                                                            
*                                                                               
X8       SET      25                                                            
V8       SET      25                                                            
*                                                                               
* EXTRACT PARAMETERS                                                            
*                                                                               
I        DO       NUM(AF)/3                                                     
J        SET      (I*3)-2                                                       
TERM     SET      AF(J)                                                         
EXIT     SET      J+1                                                           
VALUE    SET      J+2                                                           
*                                                                               
         GOTO,TERM  X1,X2,X3,X4,X5,X6,X7,X8                                     
         ELSE                                                                   
*                                                                               
X1       SET      EXIT                                                          
V1       SET      VALUE                                                         
         ELSE                                                                   
*                                                                               
X2       SET      EXIT                                                          
V2       SET      VALUE                                                         
         ELSE                                                                   
*                                                                               
X3       SET      EXIT                                                          
V3       SET      VALUE                                                         
         ELSE                                                                   
*                                                                               
X4       SET      EXIT                                                          
V4       SET      VALUE                                                         
         ELSE                                                                   
*                                                                               
X5       SET      EXIT                                                          
V5       SET      VALUE                                                         
         ELSE                                                                   
*                                                                               
X6       SET      EXIT                                                          
V6       SET      VALUE                                                         
         ELSE                                                                   
*                                                                               
X7       SET      EXIT                                                          
V7       SET      VALUE                                                         
         ELSE                                                                   
*                                                                               
X8       SET      EXIT                                                          
V8       SET      VALUE                                                         
         ELSE                                                                   
*                                                                               
         FIN                                                                    
*                                                                               
* BUILD TABLE ENTRY                                                             
*                                                                               
LF       RES      0                                                             
CF(2)    EQU      (%-TAPETBL)/3                                                 
         GEN,4,4,4,4,4,4,4,4  ;                                                 
         AF(X1),AF(X2),AF(X3),AF(X4),AF(X5),AF(X6),AF(X7),AF(X8)                
         GEN,8,8,8,8,8,8,8,8  ;                                                 
         AF(V1),AF(V2),AF(V3),AF(V4),AF(V5),AF(V6),AF(V7),AF(V8)                
         PEND                                                                   
         TITLE    '** TAPE - MODEL 33XX POST-HANDLER **'                        
         DO       #33TAPE                                                       
*                                                                               
* TAPE POST HANDLER                                                             
*                                                                               
TAPEPOST RES      0                                                             
         BAL,R0   TESTREW           TEST FOR REWIND ON-LINE CASE                
         BAL,R9   NEWIOCK           ANY ERROR OR ABNORMAL                       
         B        TAPEERR           YES                                         
         B        TERM1             NO                                          
*                                                                               
* TAPE ERROR OR ABNORMAL ANALYSIS                                               
*                                                                               
* R5     TDV STATUS RIGHT JUSTIFIED                                             
* R6     AIO STATUS RIGHT JUSTIFIED                                             
* R8     TIO STATUS RIGHT JUSTIFIED                                             
* R1-R4  UNCHANGED                                                              
* R10-R11 TDV STATUS DW                                                         
* R14-R15 UNCHANGED                                                             
*                                                                               
TAPEERR  RES      0                                                             
         LCF      DCT20,R1          TDV CC                                      
         BCS,8    EXITSENS          CC1 SET - INCONSISTANT                      
         BCS,4    EXITTM            CC2 SET - TEST MODE                         
         CI,R8    (BIT1+BIT2+BIT5+BIT6)**-16 DEVICE/CONTROLLER STATE            
         BANZ     EXITNO            NOT OPERATIONAL                             
*                                   OK                                          
         CI,R5    (BIT2+BIT7)**-16  TAPE MOTION OK                              
         BAZ      TAPE10            YES                                         
*                                   NO                                          
         CI,R5    BIT2**-16                                                     
         BANZ     TAPE05            SET                                         
*                                   RESET                                       
         CI,R5    BIT5**-16         BOT                                         
         BANZ     TERM5             YES                                         
         B        EXITSENS          POSITION LOST                               
         PAGE                                                                   
TAPE05   RES      0                                                             
         CI,R5    BIT7**-16                                                     
         BAZ      EXITSENS          POSITION LOST                               
*                                   NO MOTION                                   
         CI,R5    BIT14**-16        IOP HALT                                    
         BANZ     EXITFALT          YES, FAULT                                  
*                                   NO                                          
         CI,R5    BIT1**-16         WRITE PERMIT                                
         BANZ     TAPE07            YES                                         
*                                   NO                                          
         LB,R9    IOQ5,R3           CURRENT FUNCTION                            
         LB,R7    WRITORDR          COUNT OF WRITE FUNCTIONS                    
         CB,R9    WRITORDR,R7       IS IT A WRITE ORDER                         
         BE       EXITWP            YES, ITS A WRITE PROTECT VIOLATION          
         BDR,R7   %-2               NO, LOOP                                    
TAPE07   RES      0                 ITS NOT A WRITE PROTECT VIOLATION           
         CI,R5    BIT5**-16         IS IT A BOT                                 
         BANZ     TERM5             YES                                         
         B        EXITFALT          NO, ITS A NO MOTION FAULT                   
*********                                                                       
WRITORDR DATA,1   BA(WRITEND)-BA(%),FUN01,FUN03                                 
         DO1      #7TTAPE                                                       
         DATA,1   FUN11,FUN14,FUN17,FUN19                                       
WRITEND  DATA,1   FUN40                                                         
         BOUND    4                                                             
********                                                                        
TAPE10   RES      0                                                             
         CI,R5    (BIT10+BIT11+BIT12+BIT13)**-16  IOP HALT, TAPE MOVED          
         BANZ     TERM2             YES                                         
*                                   NO                                          
         CI,R5    BIT9**-16         TDE                                         
         BAZ      TAPE20            NO                                          
*                                   YES                                         
         CI,R5    BIT4**-16         CORRECTABLE                                 
         BAZ      TERM6             YES                                         
         B        TERM2             NO                                          
********                                                                        
TAPE20   RES      0                                                             
         CI,R5    BIT3**-16         TAPE MARK                                   
         BANZ     TERM3             YES                                         
*                                   NO                                          
         CI,R5    BIT5**-16         BOT                                         
         BANZ     TERM5             YES                                         
*                                   NO                                          
         CI,R5    BIT6**-16         EOT                                         
         BANZ     TERM4             YES                                         
*                                                                               
         CI,R5    BIT8**-16         INCORRECT LENGTH                            
         BANZ     TERM1             YES                                         
         BAL,R7   EXITSENS          INCONSISTANT STATUS                         
         FIN      33 TAPE                                                       
         TITLE    '** TAPE - 9 TRACK TAPE PRE-HANDLER  **'                      
         DO       (#9TTAPE+#33TAPE)>0                                           
*                                                                               
* 9 TRACK TAPE PRE-HANDLER                                                      
*                                                                               
         DO1      #33TAPE                                                       
TAPEPRE  RES      0                                                             
MTAP     RES      0                                                             
         LI,R10   DOT:9T                                                        
         LB,R7    IOQ5,R3           GET CURRENT FUNCTION                        
         CI,R7    LASTFUN           IS IT TOO BIG                               
         BGE      EXITINC           YES                                         
*                                   NO                                          
         CI,R7    9TF08             IS IT A REWIND START                        
         BE       COMLIST           YES, DONT SET HOLD                          
*                                   NO                                          
         OR,R4    Y2                SET HOLD FOR SENSE                          
         B        COMLIST                                                       
*                                                                               
*                                                                               
*****************************************************************               
* CLIST USAGE                                                                   
*                                                                               
* WORD 0/1/2/3    CDW BUILDING                                                  
*                                   NO                                          
* WORD 4/5        SENSE DATA                                                    
*****************************************************************               
         FIN      (#9TTAPE+#33TAPE)>0                                           
         TITLE    '** TAPE - 7 AND 9 TRACK TAPE POST HADLER **'                 
         DO       (#9TTAPE+#7TTAPE)>0                                           
*                                                                               
* 7 AND 9 TRACK POST HANDLER                                                    
*                                                                               
         DO1      #7TTAPE                                                       
7TAPCU   RES      0                                                             
         DO1      #9TTAPE                                                       
MTAPCU   RES      0                                                             
         BAL,R0   TESTREW           TEST FOR REWIND ON-LINE CASE                
         BAL,R9   NEWIOCK           ANY ERROR OR ABNORMAL                       
         B        9TERROR           YES                                         
*                                   NO                                          
         CI,R5    BIT6**-16         IS IT EOT                                   
         BANZ     TERM4             YES                                         
*                                   NO                                          
         CI,R5    BIT5**-16         IS IT BOT                                   
         BANZ     TERM5             YES                                         
         B        TERM1             NO                                          
         TITLE    '** TAPE - 7 AND 9 TRACK ERROR/ABNORMAL ANALYSIS **'          
*                                                                               
*  9 TRACK ERROR OR ABNORMAL ANALYSIS                                           
*                                                                               
* R5     TDV STATUS RIGHT JUSTIFIED                                             
* R6     AIO STATUS RIGHT JUSTIFIED                                             
* R8     TIO STATUS RIGHT JUSTIFIED                                             
* R10/11 TDV STATUS DW                                                          
* R1-R4  PRESERVED                                                              
* R14-15 PRESERVED                                                              
*                                                                               
NCORBIT  DATA     X'800'                                                        
WANG#    DATA     X'00F7F3F2'                                                   
9TERROR  RES      0                                                             
         LW,R0    DCTMOD,R1         GET MODEL #                                 
         SLS,R0   -8                                                            
         CW,R0    WANG#             IS IT A WANG (7322/2)                       
         BE       9T05              YES                                         
*                                   NO                                          
         OR,R5    NCORBIT           FORCE NOT-CORRECTABLE BIT                   
9T05     RES      0                                                             
         CI,R8    (BIT1+BIT2+BIT5+BIT6)**-16 READY                              
         BANZ     EXITNO            NO, NOT OPERATIONAL                         
*                                   YES                                         
         CI,R5    (BIT11+BIT12+BIT13+BIT14)**-16  IOP HALT                      
         BANZ     EXITSENS          YES, POSITION UNKNOWN                       
*                                   NO                                          
         CI,R5    BIT10**-16        TME                                         
         BANZ     TERM2             YES, RETRY WITH POSITIONING                 
*                                   NO                                          
         CI,R5    BIT9**-16         TDE                                         
         BAZ      9T10              NO                                          
*                                   YES                                         
         CI,R5    BIT4**-16         CORRECTABLE                                 
         BAZ      TERM6             YES                                         
         B        TERM2             NO                                          
********                                                                        
9T10     RES      0                                                             
         CI,R8    BIT4**-16         UNUSUAL END                                 
         BAZ      9T20              NO                                          
*                                   YES                                         
         CI,R5    BIT2**-16         WRITE PROTECT VIOLATION                     
         BANZ     EXITWP            YES                                         
*                                   NO                                          
         CI,R5    BIT5**-16         BOT -                                       
         BANZ     TERM5             YES                                         
*                                   NO                                          
         CI,R5    BIT3**-16         TAPE MARK                                   
         BANZ     TERM3             YES                                         
         B        EXITSENS          NO, TAPE POSITION LOST                      
********                                                                        
9T20     RES      0                                                             
         CI,R5    BIT6**-16         EOT                                         
         BANZ     TERM4             YES                                         
*                                   NO                                          
         CI,R5    BIT8**-16         INCORRECT LENGTH                            
         BANZ     TERM1             YES                                         
*                                   NO                                          
         LC       DCT20,R1          GET TDV CC                                  
         BCS,8    EXITSENS          INCONSISTANT STATUS                         
         BCR,4    EXITSENS          INCONSISTANT STATUS                         
         B        TERM1             DOING A REWIND OFF-LINE                     
*******                                                                         
         FIN      7 AND 9 TRACK                                                 
         TITLE    '** TAPE - 7 TRACK PRE-HANDLER **'                            
         DO       #7TTAPE                                                       
*                                                                               
* 7 TRACK PRE-HANDLER                                                           
*        MODELS 7362/72                                                         
*                                                                               
7TAP     RES      0                                                             
         BAL,R0   RE:ENT            CHECK RE-ENTRANCE AND INHIBIT               
         LB,R10   IOQ5,R3           GET CURRENT FUNCTION STEP                   
         CI,R10   LASTFUN           IS FUNCTION TOO BIG                         
         BGE      EXITINC           YES                                         
         CI,R10   9TF03             IS IT 3 OR LESS                             
         BG       7TAP10            NO                                          
         AI,R10    7TF16            YES, CHANGE TO 16 THRU 19                   
         STB,R10  IOQ5,R3           AND STORE IT                                
         STB,R10  IOQ4,R3           IN BOTH CURRENT AND INITIAL                 
7TAP10   RES      0                                                             
         ENABLE                                                                 
         LI,R10   DOT:7T            GET DOT TABLE PTR                           
         B        COMLIST           AND BUILD CDW                               
*****************************************************************               
* CLIST USAGE                                                                   
*                                                                               
* WORD 0/1        RESERVED FOR CDW BUILDING                                     
* WORD 2/3        RESERVED FOR TDV STATUS AND REMAINING BYTE COUNT SAVE         
*                                                                               
*****************************************************************               
         FIN                                                                    
         TITLE    '** TAPE - SPECIAL REWIND SUBROUTINE **'                      
*                                                                               
* ROUTINE TO PROCESS THE REWIND ON-LINE AS A SPECIAL CASE                       
*                                                                               
* R0     LINK                                                                   
*                                                                               
* THIS ROUTINE IS NECESSARY BECAUSE THE STATUS RETURNED FOLLOWING               
* A REWIND ON-LINE MAY NOT APPLY THE THE TAPE UNIT INVOLVED.  IT                
* MAY REFER TO ONLY TO THE LAST UNIT DOING A DATA TRANSFER                      
*                                                                               
TESTREW  RES      0                                                             
         LB,R10   IOQ5,R3           CURRENT FUNCTION STEP                       
         CI,R10   FUN56             IS IT A REWIND ON-LINE FUNCTION             
         BNE      *R0               NO, RETURN                                  
*                                   YES                                         
         LD,R10   DCT13,R1          GET TDV STATUS                              
         CW,R11   XBIT5             IS IT BOT                                   
         BANZ     TERM1             YES, IT WORKS OK                            
         B        EXITFALT          NO, RETRY IT TIL IT IS                      
         TITLE    '** TAPE - :DOT TABLES **'                                    
*                                                                               
* :DOT TABLE                                                                    
*                                                                               
         BOUND    8                                                             
DOT      SET      %                                                             
DOT:9T   EQU      %                                                             
DOT:7T   EQU      %                                                             
9TF00    :DOT     CL01,01,LASTFUN,LASTFUN   0  READ                             
9TF01    :DOT     CL02,01,LASTFUN,LASTFUN   1  WRITE                            
9TF02    :DOT     CL03,01,LASTFUN,LASTFUN   2  READ REVERSE                     
9TF03    :DOT     CL04,01,LASTFUN,LASTFUN   3  WRITE TAPE MARK                  
9TF04    :DOT     CL05,01,LASTFUN,LASTFUN   4  BACK SPACE RECORD                
9TF05    :DOT     CL06,01,LASTFUN,LASTFUN   5  FORE SPACE RECORD                
9TF06    :DOT     CL07,90,LASTFUN,LASTFUN   6  BACK SPACE FILE (W/SKIP)         
9TF07    :DOT     CL08,90,LASTFUN,LASTFUN   7  FORE SPACE FILE (W/SKIP)         
9TF08    :DOT     CL05,95,LASTFUN,LASTFUN   8  REWIND (BACKSPACE RECORD)        
9TF09    :DOT     CL05,95,LASTFUN,LASTFUN   9  UNLOAD (BACKSPACE RECORD)        
         DO       #7TTAPE                                                       
7TF10    :DOT     CL16,01,LASTFUN,LASTFUN   10 READ BINARY                      
7TF11    :DOT     CL17,01,LASTFUN,LASTFUN   11 WRITE BINARY                     
7TF12    :DOT     CL05,01,LASTFUN,LASTFUN   12 BKSP REC (READ REV BIN)          
7TF13    :DOT     CL18,01,LASTFUN,LASTFUN   13 READ DECIMAL                     
7TF14    :DOT     CL19,01,LASTFUN,LASTFUN   14 WRITE DECIMAL                    
7TF15    :DOT     CL05,01,LASTFUN,LASTFUN   15 BKSP REC (READ REV DEC)          
7TF16    :DOT     CL01,01,LASTFUN,LASTFUN   16 READ PACKED                      
7TF17    :DOT     CL02,01,LASTFUN,LASTFUN   17 WRITE PACKED                     
7TF18    :DOT     CL05,01,LASTFUN,LASTFUN   18 BKSP REC (READ REV PK)           
7TF19    :DOT     CL04,01,LASTFUN,LASTFUN   19 WRITE TAPE MARK                  
         ELSE                                                                   
         RES      10                                                            
         FIN      #7TTAPE                                                       
9TF20    :DOT     CL08,90,LASTFUN,LASTFUN   20 FORE SPACE FILE (NO SKIP)        
9TF21    :DOT     CL07,90,LASTFUN,LASTFUN   21 BACK SPACE FILE (NO SKIP)        
9TF22    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
9TF23    :DOT     CL06,01,LASTFUN,LASTFUN      FORE SPACE RECORD                
9TF24    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
9TF25    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
9TF26    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
9TF27    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
9TF28    :DOT     CL06,01,LASTFUN,LASTFUN      FORE SPACE RECORD                
9TF29    :DOT     CL06,01,LASTFUN,LASTFUN      FORE SPACE RECORD                
9TF30    :DOT     CL06,01,LASTFUN,LASTFUN      FORE SPACE RECORD                
9TF31    :DOT     CL06,01,LASTFUN,LASTFUN      FORE SPACE RECORD                
9TF36    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
9TF37    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
9TF38    :DOT     CL13,01,LASTFUN,LASTFUN      READ W/SKIP                      
9TF39    :DOT     CL14,01,LASTFUN,LASTFUN      SET ERASE                        
9TF40    :DOT     CL20X,01,LASTFUN,LASTFUN        WRITE WTM                     
9TF41    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
9TF42    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
9TF43    :DOT     CL13,01,LASTFUN,LASTFUN      READ W/SKIP                      
9TF44    :DOT     CL13,01,LASTFUN,LASTFUN      READ W/SKIP                      
9TF56    :DOT     CL09,30,LASTFUN,LASTFUN      REWIND                           
9TF57    :DOT     CL10,30,LASTFUN,LASTFUN      UNLOAD                           
9TF62    :DOT     CL05,01,LASTFUN,LASTFUN      BACK SPACE RECORD                
         DO       (#9TTAPE+#33TAPE)>0                                           
9TF63    :DOT     CL11,01,LASTFUN,LASTFUN      SENSE                            
9TF64    :DOT     CL06,01,LASTFUN,LASTFUN      FORE SPACE RECORD                
         FIN                                                                    
         DO       #7TTAPE                                                       
7TF66    :DOT     CL16,01,LASTFUN,LASTFUN      READ BINARY                      
7TF67    :DOT     CL05,01,LASTFUN,LASTFUN      BKSP RECORD                      
7TF68    :DOT     CL18,01,LASTFUN,LASTFUN      READ DECIMAL                     
7TF69    :DOT     CL01,01,LASTFUN,LASTFUN      READ PACKED                      
         FIN                                                                    
9TF72    :DOT     CL11,01,LASTFUN,LASTFUN      SENSE                            
LASTFUN  EQU      %-DOT                                                         
         PAGE                                                                   
*                                                                               
* COMMAND LIST POINTERS                                                         
*                                                                               
CL01     :CLIST   TCDW20,TCDW1      READ                                        
CL02     :CLIST   TCDW20,TCDW2      WRITE                                       
CL03     :CLIST   TCDW20,TCDW3      READ REVERSE                                
CL04     :CLIST   TCDW20,TCDW4      WRITE TAPE MARK                             
CL05     :CLIST   TCDW5             BACK SPACE RECORD                           
CL06     :CLIST   TCDW6             FORE SPACE RECORD                           
CL07     :CLIST   TCDW7             BACK SPACE FILE                             
CL08     :CLIST   TCDW8             FORE SPACE FILE                             
CL09     :CLIST   TCDW9             REWIND                                      
CL10     :CLIST   TCDW10            UNLOAD                                      
CL11     :CLIST   TCDW11            SENSE                                       
CL12     :CLIST   TCDW12            SET CORRECTION                              
CL13     :CLIST   TCDW13            READ W/SKIP                                 
CL14     :CLIST   TCDW14            SET ERASE                                   
CL15     :CLIST   TCDW15            INCONSISTENT                                
         DO       #7TTAPE                                                       
CL16     :CLIST   TCDW16            READ BINARY                                 
CL17     :CLIST   TCDW17            WRITE BINARY                                
CL18     :CLIST   TCDW18            READ DECIMAL                                
CL19     :CLIST   TCDW19            WRITE DECIMAL                               
         FIN                                                                    
CL20X    :CLIST    TCDW21                     SPECIAL COMMAND                   
*                                                                               
         TITLE    '** TAPE - CDW SKELETONS **'                                  
*                                                                               
* COMMAND DOUBLEWORD SKELETONS                                                  
*                                                                               
NCX      EQU      X'16'                                                         
CCX      EQU      X'26'                                                         
*SKIP    EQU      X'01'             DEFINED IN CPRMON NOW                       
*                                                                               
TCDW1    :CDW     2,0,NCX,2         READ                                        
TCDW2    :CDW     1,0,NCX,2         WRITE                                       
         DO1      (#9TTAPE+#33TAPE)>0                                           
TCDW3    :CDW     X'C',RREV,NCX,4   READ REVERSE                                
TCDW4    :CDW     X'73',0,NCX       WRITE TAPE MARK                             
TCDW5    :CDW     X'4B',0,NCX       BACK SPACE RECORD                           
TCDW6    :CDW     X'43',0,NCX       FORE SPACE RECORD                           
TCDW7    :CDW     X'5B',0,NCX       BACK SPACE FILE                             
TCDW8    :CDW     X'53',0,NCX       FORE SPACE FILE                             
TCDW9    :CDW     X'13',RWD,4,4     REWIND                                      
TCDW10   :CDW     X'23',0,NCX       UNLOAD                                      
         DO       (#9TTAPE+#33TAPE)>0                                           
TCDW11   :CDW     4,SENSE,NCX,4,16  SENSE                                       
TCDW12   :CDW     3,SENSE,NCX,4,1   SET CORRECTION                              
         FIN                                                                    
TCDW13   :CDW     2,0,NCX+SKIP,0,1  READ WITH SKIP                              
TCDW14   :CDW     X'63',0,NCX       SET ERASE                                   
TCDW15   :CDW     0,EXITSENS,0,4    INCONSISTENT                                
         DO       (#9TTAPE+#33TAPE)=0                                           
TCDW3    EQU      TCDW15                                                        
TCDW11   EQU      TCDW15                                                        
TCDW12   EQU      TCDW15                                                        
         FIN                                                                    
         DO       #7TTAPE                                                       
TCDW16   :CDW     6,0,NCX,2         READ BINARY                                 
TCDW17   :CDW     5,0,NCX,2         WRITE BINARY                                
TCDW18   :CDW     X'E',0,NCX,2      READ DECIMAL                                
TCDW19   :CDW     X'D',0,NCX,2      WRITE DECIMAL                               
         ELSE                                                                   
TCDW16   EQU      TCDW15                                                        
TCDW17   EQU      TCDW15                                                        
TCDW18   EQU      TCDW15                                                        
TCDW19   EQU      TCDW15                                                        
         FIN      #7TTAPE                                                       
TCDW20   :CDW     X'B',SETMODE,CCX,4,1 SET MODE                                 
TCDW21   :CDW     1,WWTM,NCX,4      EITHER WRITE OR WRITE TM                    
         TITLE    '** TAPE - COMMON CDW BUILDING ROUTINES **'                   
         DO       (#9TTAPE+#33TAPE)>0                                           
*                                                                               
* SENSE AND SET CORRECTION CDW BUILDER                                          
*                                                                               
SENSE    RES      0                                                             
         LW,R0    DCTMOD,R1         GET MODEL #                                 
         LW,R5    NOSENS                                                        
         CW,R0    NOSENS,R5         IS IT A NONSENSICAL TAPE                    
         BE       %+3               YES, CANT SENSE                             
         BDR,R5   %-2               LOOP THRU LIST                              
         B        SENSE10           NO, IT IS A SENSICAL TAPE                   
         LI,R0    X'63'             YES,                                        
         STB,R0   R8                CHANGE ORDER TO SET ERASE (DUMMY)           
*                                                                               
SENSE10  RES      0                                                             
         LH,R0    DCT7,R1           GET CLIST DW ADDR                           
         AI,R0    2                 POINT IT TO 3ED DW                          
         SLS,R0   3                 MAKE IT A BYTE ADDR                         
         OR,R8    R0                OR IT INTO CDW                              
         B        USECOM            AND RETURN                                  
*                                                                               
NOSENS   DATA     NONSENS-%                                                     
         DATA     '7332'                                                        
         DATA     '7333'                                                        
         DATA     '7362'                                                        
NONSENS  DATA     '7372'                                                        
*                                                                               
* READ REVERSE CDW ROUTINE                                                      
*                                                                               
RREV     RES      0                                                             
         LW,R11   IOQ8,R3           GET BUFFER ADDR                             
         CW,R11   Y8                IS THERE DATA CHAINING                      
         BANZ     RREV10            YES, DONT TRY TO FIX                        
*                                   NO                                          
         AND,R11  M24               MASK OFF BUFFER ADDR                        
         OR,R8    R11               OR IT INTO CDW                              
         LH,R11   IOQ9,R3           GET BYTE COUNT                              
         AND,R11  M16               MASK IT                                     
         OR,R9    R11               OR IT IN TO CDW                             
*                                                                               
         AI,R11   -1                DECREMENT BYTE COUNT                        
         AW,R8    R11               AND ADD IT TO BUFFER ADDR                   
         B        USECOM            AND RETURN                                  
********                                                                        
RREV10   RES      0                                                             
         AI,R9    X'200'            SET CDW TYPE TO DATA TRANSFER               
         B        REPCOM            AND RE-PROCESS                              
         FIN      9 TRACK TAPES                                                 
         PAGE                                                                   
*                                                                               
* FORCE INITIAL CDW ROUTINE                                                     
*                                                                               
WWTM     RES      0                                                             
         LB,R5    IOQ4,R3           FUNCTION CODE (INITIAL)                     
         LW,R6    *R10,R5           GET :DOT ENTRY                              
         LB,R6    R6                :CLIST INDEX                                
         LB,R5    *R10,R6           :CDW INDEX                                  
         LD,R8    *R10,R5           GET CWD PROTOTYPE                           
         B        REPCOM            AND PROCESS IT                              
*                                                                               
* REWIND CDW BUILDER                                                            
*                                                                               
RWD      RES      0                                                             
         LI,R0    X'C0'                                                         
         STB,R0   R4                SET R4 FLAGS FOR NO HOLD OR BUSY            
         B        USECOM            AND RETURN                                  
*                                                                               
* CDW SPECIAL ROUTINE FOR SET MODE CDW                                          
*                                                                               
SETMODE  RES      0                                                             
         LB,R5    DCT4,R1           DEVICE TYPE                                 
         CI,R5    16                IS IT A 33 TAPE                             
         BNE      DELCOM            NO, DONT MODE SET                           
*                                   YES                                         
         AI,R9    X'100'            CHANGE IT TO AN IOQ12 TYPE                  
         B        REPCOM            AND RE-PROCESS                              
         TITLE    '** TAPE - TERMINATION PROCESSOR **'                          
*                                                                               
* THIS SELECTS THE PROPER EXIT ROUTINE AND VALUE GIVEN THE                      
* TERMINATION TYPE AND FUNCTION CODE                                            
*        IN                         OUT                                         
* R0     -                          -                                           
* R1     DCT INDEX                  UNCHANGED                                   
* R2     CIT INDEX                  UNCHANGED                                   
* R3     IOQ INDEX                  UNCHANGED                                   
* R4     -                          UNCHANGED                                   
* R5     TDV STATUS RIGHT JUST.     UNCHANGED                                   
* R6     -                          -                                           
* R7     -                          EXIT POINTER                                
* R8     -                          -                                           
* R9     -                          -                                           
* R10    TDV STATUS                 UNCHANGED                                   
* R11    TDV STATUS                 UNCHANGED                                   
* R12    -                          EXIT VALUE                                  
* R13    -                          0                                           
* R14    RE:ENT VALUE               UNCHANGED                                   
* R15    SERDEV LINK                UNCHANGED                                   
*                                                                               
* TERMINATION EXIT GROUP                                                        
*                                                                               
TERM8    BAL,R6   TAPE              SPECIAL                                     
TERM7    BAL,R6   TAPE              SPECIAL                                     
TERM6    BAL,R6   TAPE              CORRECTABLE TRANMISSION DATA ERROR          
TERM5    BAL,R6   TAPE              BEGINNING OF TAPE                           
TERM4    BAL,R6   TAPE              END OF TAPE                                 
TERM3    BAL,R6   TAPE              TAPE MARK                                   
TERM2    BAL,R6   TAPE              TRANSMISSION DATA ERROR                     
TERM1    BAL,R6   TAPE              NO ERROR OR ABNORMAL                        
         PAGE                                                                   
TAPE     LCW,R6   R6                                                            
         AI,R6    TERM1+1           COMPUTE TERMINATION NUMBER                  
*                                                                               
* PROCESS PROPER TERMINATION                                                    
*                                                                               
         BAL,R0   RE:ENT                                                        
         LB,R7    IOQ5,R3           CURRENT FUNCTION STEP                       
RETAPE   RES      0                                                             
         CI,R7    FUN72             IS FUNCTION TOO BIG                         
         BG       EXITINC           YES                                         
*                                   NO                                          
         MI,R7    3                 TIMES 3                                     
         LCI      3                                                             
         LM,R7    TAPETBL,R7        GET 8 EXIT VALUES                           
*                                                                               
         LB,R12   R8,R6             GET EXIT VALUE                              
*                                                                               
         SLS,R6   2                 TERMINATION TIMES 4                         
         SLS,R7   -28,R6            SELECT EXIT PTR                             
         AND,R7   M4                AND MASK                                    
         SLS,R6   -2                RESTORE TERMINATION                         
*                                                                               
         LI,R13   0                 CLEAR R13                                   
         LB,R7    EXITJUMP,R7       GET JUMP PTR                                
         B        EXITJUMP,R7       AND SPLIT 16 WAYS                           
*                                                                               
* EXIT JUMP TABLE                                                               
*                                                                               
EJ       COM,8    AF(1)-EXITJUMP                                                
EXITJUMP RES      0                                                             
         EJ       EXITSENS          0   INCONSISTANT STATUS                     
         EJ       EXITCUP           1   SET COMPLETITION                        
         EJ       EXITRTY           2   RETRY                                   
         EJ       EXITFOL           3   FOLLOW ON                               
         EJ       EXITCLN           4   CLEANER TEST                            
         EJ       EXITTMT           5   TAPE MARK TEST                          
         EJ       EXITDEC           6   RECORD COUNTER                          
         EJ       EXITLSF           7   LOG SENSE DATA                          
         EJ       EXIT1ST           8   FOLLOW ON TO INITIAL FUNCTION           
         EJ       EXITFALT          9   FAULT, NO TAPE MOTION                   
         EJ       EXITLT4           10  LESS THAN 4TH RETRY TEST                
         EJ       EXITLOST          11  LOST DATA TEST                          
         EJ       EXITGET           12  GET RBC AND CUP                         
         EJ       EXITSAVE          13  SAVE RBC IN CLIST                       
         EJ       EXITCUPX          14  SPACE RECORD POSTING                    
         EJ       EXITXXXX          15   USE TERM FOR INITAL FUNCTION           
         BOUND    4                                                             
         TITLE    '** TAPE - EXIT ROUTINES **'                                  
*                                                                               
* USES TERMINATION FOR INITIAL RATHER THAN CURRENT FUNCTION                     
*                                                                               
EXITXXXX RES      0                                                             
         LB,R7    IOQ4,R3           INITIAL FUNCTION                            
         B        RETAPE            AND RE-PROCESS                              
*                                                                               
* RECORD COUNT LOGIC                                                            
*                                                                               
* DECREMENT IOQ12, IF ZERO, DO TERM7 ELSE DO TERM8                              
*                                                                               
EXITDEC  RES      0                                                             
         BAL,R0   RE:ENT                                                        
         MTW,-1   IOQ12,R3                                                      
         BEZ      TERM7                                                         
         BGEZ     TERM8                                                         
         BAL,R7   EXITSENS                                                      
*                                                                               
* TAPE MARK TEST                                                                
*                                                                               
* IF TAPE MARK DO TERM7 ELSE DO TERM8                                           
*                                                                               
EXITTMT  RES      0                                                             
         CI,R5    BIT3**-16         TAPE MARK                                   
         BANZ     TERM7             YES, DO TERM7                               
         B        TERM8             NO DO TERM8                                 
*                                                                               
* EXIT FOLLOW ON TO ORIGINAL FUNCTION                                           
*                                                                               
EXIT1ST  RES      0                                                             
         LB,R12   IOQ4,R3                                                       
         B        EXITFOL                                                       
         PAGE                                                                   
*                                                                               
* EXIT FOR NOT-OPERATIONAL MESSAGE                                              
*                                                                               
EXITNO   RES      0                                                             
         LI,R12   TYCOK             PRESET TYC                                  
         LB,R8    IOQ4,R3           INITIAL FUNCTION                            
         CI,R8    FUN09             IS IT AN UNLOAD                             
         BE       EXITCUP           YES, EXIT OK ANYWAY                         
*                                   NO, REALLY NOT-OP                           
         LI,R12   TYCINCST+FLGMSG   POSITION LOST IF NOT-OP DURING IO           
         LI,R13   MSG4A             NOT-OP MESSAGE                              
         DO       #ERRORLOG                                                     
         BAL,R0   RE:ENT                                                        
         BAL,R0   IOERROR           RECORD PROBLEM                              
         FIN      #ERRORLOG                                                     
         B        EXITHIO                                                       
*                                                                               
* EXIT FOT WRITE PROTECT VIOLATION MESSAGE                                      
*                                                                               
EXITWP   RES      0                                                             
         LI,R12   FLGKEYNC+FLGMSG                                               
         LI,R13   MSG5              WRITE PROTECT MESSAGE                       
         B        EXITCUP                                                       
*                                                                               
*                                                                               
* TEST MODE EXIT                                                                
*                                                                               
         DO       (#9TTAPE+#33TAPE)>0                                           
EXITTM   RES      0                                                             
         LI,R12   TYCINCST+FLGMSG   POSITION LOST IF TM WHILE BUSY              
         LI,R13   MSG9              TEST MODE MESSAGE                           
         DO       #ERRORLOG                                                     
         BAL,R0   RE:ENT                                                        
         BAL,R0   IOERROR           RECORD PROBLEM                              
         FIN      #ERRORLOG                                                     
         B        EXITHIO                                                       
         PAGE                                                                   
*                                                                               
* EXIT LOG SENSE DATA AND FOLLOW ON                                             
*                                                                               
EXITLSF  RES      0                                                             
         DO       #ERRORLOG                                                     
         MTW,0    LOGFLAG           IS ERROR LOGGING SYSGENED IN                
         BEZ      EXITLSF5          NO                                          
*                                   YES                                         
         BAL,R0   RE:ENT            INHIBIT AND CHECK RE-ENTRANCE               
         LW,R7    IOQERROR,R3       IS THERE AN ERROR LOG BUFFER                
         BEZ      EXITLSF5          NO                                          
*                                   YES                                         
         LI,R6    LOGSENSE          SENSE DATA OFFSET                           
         LH,R5    DCT7,R1           CLIST DW ADDR                               
         SLS,R5   1                 MAKE WORD ADDR                              
*                                                                               
         LCI      4                 COUNT FOR 16 BYTES                          
         LM,R8    4,R5              PICK UP SENSE DATA                          
         STM,R8   *R7,R6            SAVE IT                                     
         LM,R8    ZEROS                                                         
         STM,R8   4,R5              CLEAR OLD SENSE DATA                        
         FIN      #ERRORLOG                                                     
EXITLSF5 LB,R5    IOQ5,R3           GET CURRENT FUNCTION                        
         CI,R5    FUN72             IS IT INC STATUS SENSE                      
         BE       EXITINC           YES                                         
         B        EXITFOL           NO                                          
         FIN      ANY 9 TRACK                                                   
         PAGE                                                                   
*                                                                               
* LESS THAN 4TH RETRY TEST - IF LESS THAN 4TH RETRY, DO TERMINATION 7           
*                                               ELSE DO TERMINATION 8           
*                                                                               
EXITLT4  RES      0                                                             
         LB,R8    IOQ10,R3          MAXIMUM RETRY COUNT                         
         LB,R9    IOQ11,R3          CURRENT RETRY COUNT                         
         SW,R8    R9                RETRY NUMBER                                
         CI,R8    3                 IS IT 3 OR LESS                             
         BLE      TERM7             YES, DO TERMINATION 7                       
         B        TERM8             NO, DO TERMINATION 8                        
*                                                                               
* CLEANER TEST - IF 4TH RETRY, DO TERMINATION 8                                 
*                              ELSE DO TERMINATION 7                            
*                                                                               
EXITCLN  RES                                                                    
         LB,R8    IOQ10,R3          MAX RETRY COUNT                             
         LB,R7    IOQ11,R3          CURRENT RETRY COUNT                         
         SW,R8    R7                RETRY NUMBER                                
         CI,R8    3                 4TH RETRY                                   
         BANZ     TERM7             NO                                          
         B        TERM8             DO TERMINATION 8                            
*                                                                               
         PAGE                                                                   
*                                                                               
* EXIT TO FOLLOW ON                                                             
*                                                                               
EXITFOL  RES      0                                                             
         BAL,R0   RE:ENT                                                        
         STH,R12  DCT17,R1                                                      
*                                                                               
         LI,R12   FLGFOLOW+FLGINTER                                             
         B        EXITCUP                                                       
*                                                                               
* EXITLOST - LOST DATA TEST                                                     
*                                                                               
EXITLOST RES      0                                                             
         CI,R5    BIT8**-16         INCORRECT LENGTH SET                        
         BAZ      EXITCUP           NO, ITS OK                                  
*                                                                               
         CI,R11   X'FFFF'           ANY REMAINING BYTE COUNT                    
         BANZ     EXITCUP           YES, ITS OK                                 
*                                                                               
         LW,R5    R10               GET CDW DW ADDR                             
         LD,R8    0,R5              GET CDW                                     
         LC       R9                GET FLAGS                                   
         BCS,8    EXITCUP           DATA CHAINING                               
LOSTDATA RES      0                 DATA CHAINING OR RBC                        
         LI,R12   TYCLOST           SET LOST DATA TYC                           
         B        EXITCUP                                                       
         PAGE                                                                   
*                                                                               
* REMAINING BYTE COUNT SAVE FOR 7T SYSTEMS                                      
*                                                                               
         DO       #7TTAPE                                                       
EXITSAVE RES      0                                                             
         LH,R6    DCT7,R1           GET CLIST ADDR                              
         BAL,R0   RE:ENT            INHIBIT AND CHECK RE-ENTRANCE               
         STD,R10  2,R6              PUT TDV STATUS DW IN SAVE                   
         SLS,R6   2                 MAKE CLIST A HW PTR                         
         AI,R6    3                 POINT TO RBC FIELD                          
         LI,R7    X'FFFF'           MASK                                        
         AND,R7   R10               OFF CDW DW ADDR                             
SAVELOOP RES      0                                                             
         LD,R8    0,R7              GET CDW                                     
         CW,R8    XBIT0             IS THERE A DATA CHAIN                       
         BAZ      EXITFOL           NO                                          
         AND,R9   M16               MASK OFF ITS BYTE COUNT                     
         AH,R9    0,R6              ADD IT TO CURRENT RBC                       
         STH,R9   0,R6              AND STORE IT BACK                           
         AI,R7    1                 BUMP CDW PTR                                
         B        SAVELOOP                                                      
         PAGE                                                                   
*                                                                               
* REMAINING BYTE COUNT GET FOR 7T SYSTEMS                                       
*                                                                               
EXITGET  RES      0                                                             
         LH,R6    DCT7,R1           GET CLIST DW ADDR                           
         LD,R10   2,R6              GET RBC                                     
         LW,R10   R6                FAKE CDW ADDR                               
         B        EXITCUP                                                       
         FIN      #7TTAPE                                                       
*                                                                               
* SPACE RECORD POSTING                                                          
*                                                                               
EXITCUPX RES      0                                                             
         LW,R0    IOQ12,R3          GET REMAINING REC COUNT                     
         LI,R5    1                                                             
         STH,R0   R11,R5            PUT IN R11 RIGHT HALF                       
         B        EXITCUP                                                       
         PAGE                                                                   
*                                                                               
* SENSE FOR STATUS FOLLOWING AN INCONSISTENT STATUS RESULT                      
*                                                                               
EXITSENS RES      0                                                             
         LI,R12   FUN72             INC STATUS SENSE FUNCTION                   
         CB,R12   IOQ5,R3           RE-ENTERED                                  
         BE       EXITLSF           YES, LOG ANYWAY                             
*                                   NO, RETRY FUNCTION 72                       
         BAL,R0   RE:ENT                                                        
         MTB,1    IOQ11,R3          BUMP RETRY COUNT FOR LAST SENSE             
         B        EXITRTY           AND RETRY                                   
*                                                                               
* FAULT EXIT - RETRY CURRENT FUNCTION                                           
*                                                                               
EXITFALT RES      0                                                             
         LB,R12   IOQ5,R3           GET CURRENT FUNCTION                        
*                                                                               
* EXIT RETRY                                                                    
*                                                                               
EXITRTY  RES      0                                                             
         SLS,R12  8                                                             
         BAL,R0   RE:ENT                                                        
         STH,R12  DCT17,R1                                                      
*                                                                               
         LI,R12   FLGRETRY+FLGHOLD                                              
         LI,R13   MSG2                                                          
*                                                                               
* EXIT WITH HIO                                                                 
*                                                                               
EXITHIO  RES      0                                                             
         BAL,R0   RE:ENT                                                        
         LH,R5    DCT1,R1                                                       
         HIO,R0   0,R5                                                          
EXITCUP  B        IOSCU                                                         
         PAGE                                                                   
*                                                                               
* EXIT INCONSISTANT                                                             
*                                                                               
         DO       #9TTAPE+#33TAPE=0 NO 9 TRACK                                  
EXITLSF  RES      0                                                             
EXITTM   RES      0                                                             
RREV     RES      0                                                             
SENSE    RES      0                                                             
         FIN      NO 9 TRACK                                                    
         DO       #7TTAPE=0                                                     
7TAP     RES      0                                                             
7TAPCU   RES      0                                                             
EXITGET  RES      0                                                             
EXITSAVE RES      0                                                             
         FIN      NO 7 TRACKS                                                   
         DO       #9TTAPE=0                                                     
MTAP     RES      0                                                             
MTAPCU   RES      0                                                             
         FIN      NO 9 TRACK                                                    
         DO       #33TAPE=0                                                     
TAPEPRE  RES      0                                                             
TAPEPOST RES      0                                                             
         FIN      NO 33 TAPE                                                    
EXITINC  RES      0                                                             
         LI,R12   TYCINCST+FLGMSG                                               
         LI,R13   MSGINC                                                        
         B        EXITHIO                                                       
         SPACE    3                                                             
MSGINC   TEXTC    ' ERROR, TAPE POSITION LOST'                                  
         TITLE    '** TAPE - TAPE CONTROL TABLE EQUEATES **'                    
* TERMINATIONS                                                                  
IF:OK    SET      1                                                             
IF:TDE   SET      2                                                             
IF:TM    SET      3                                                             
IF:EOT   SET      4                                                             
IF:BOT   SET      5                                                             
IF:CTDE  SET      6                                                             
IF:CNT:Z EQU      7                                                             
IF:CNT:P EQU      8                                                             
IF:TM:OK EQU      7                                                             
IF:NO:TM EQU      8                                                             
IF:NORM  EQU      7                                                             
IF:CLENR EQU      8                                                             
IF:LOW   EQU      7                                                             
IF:HIGH  EQU      8                                                             
* EXIT CODES                                                                    
REPORT   EQU      1                 CLEAN UP WITH TYC                           
RETRY    EQU      2                 RETRY                                       
GO:TO    EQU      3                                                             
CK:CLENR EQU      4                 CLEANER TEST                                
CHK:TM   EQU      5                 TAPE MARK TEST                              
DEC:CNT  EQU      6                 DECREMENT SKIP COUNT IN R12                 
LOG:N:DO EQU      7                 LOG SENSE DATA AND FOLLOW ON                
DO:AGAIN EQU      8                 FOLLOW ON TO INITIAL FUNCTION               
FAULT    EQU      9                 FAULT - NO TAPE MOTION                      
CK:RETRY EQU      10                LESS THAN 4TH RETRY TEST                    
CHK:LOST EQU      11                LOST DATA TEST                              
GET:RBC  EQU      12                GET RBC AND POST                            
SAVE:RBC EQU      13                SAVE RBC AND FOLLOW ON                      
REPORTX  EQU      14                SPACE RECORD POSTING                        
SPECIAL  EQU      15                                                            
XX       EQU      0                 DUMMY                                       
         TITLE    '** TAPE - CONTROL TABLE **'                                  
*                                                                               
* TAPE CONTROL TABLE (NO WANG SET CORRECTION CONTROL)                           
*                                                                               
TAPETBL  AFTER,FUN00 IF:OK,CHK:LOST,TYCOK,;      READ                           
                     IF:TDE,RETRY,FUN24,;                                       
                     IF:TM,REPORT,TYCTM,;                                       
                     IF:EOT,CHK:LOST,TYCOK,;                                    
                     IF:CTDE,RETRY,FUN24                                        
         AFTER,FUN01 IF:OK,REPORT,TYCOK,;        WRITE                          
                     IF:TDE,RETRY,FUN36,;                                       
                     IF:CTDE,RETRY,FUN36,;                                      
                     IF:EOT,REPORT,TYCEOT                                       
         AFTER,FUN02 IF:OK,CHK:LOST,TYCOK,;      READ REVERSE                   
                     IF:TDE,RETRY,FUN31,;                                       
                     IF:TM,REPORT,TYCTM,;                                       
                     IF:EOT,CHK:LOST,TYCOK,;                                    
                     IF:BOT,REPORT,TYCBOT,;                                     
                     IF:CTDE,RETRY,FUN31                                        
         AFTER,FUN03 IF:OK,REPORT,TYCOK,;        WRITE TAPE MARK                
                     IF:TM,REPORT,TYCOK,;                                       
                     IF:CTDE,RETRY,FUN36,;                                      
                     IF:TDE,RETRY,FUN36,;                                       
                     IF:EOT,REPORT,TYCEOT                                       
         AFTER,FUN04 IF:OK,DEC:CNT,XX,;          BACK SPACE RECORD              
                     IF:TM,REPORTX,TYCTM,;                                      
                     IF:BOT,REPORTX,TYCBOT,;                                    
                     IF:EOT,DEC:CNT,XX,;                                        
                     IF:CNT:Z,REPORTX,TYCOK,;                                   
                     IF:CNT:P,DO:AGAIN,XX                                       
         AFTER,FUN05 IF:OK,DEC:CNT,XX,;          FORE SPACE RECORD              
                     IF:TM,REPORTX,TYCTM,;                                      
                     IF:EOT,DEC:CNT,XX,;                                        
                     IF:CNT:Z,REPORTX,TYCOK,;                                   
                     IF:CNT:P,DO:AGAIN,XX                                       
         AFTER,FUN06 IF:OK,CHK:TM,XX,;           BACK SPACE FILE                
                     IF:BOT,REPORT,TYCBOT,;                                     
                     IF:EOT,CHK:TM,XX,;                                         
                     IF:TM:OK,REPORT,TYCOK,;                                    
                     IF:NO:TM,FAULT,XX                                          
         AFTER,FUN07 IF:OK,CHK:TM,XX,;           FORE SPACE FILE                
                     IF:EOT,CHK:TM,XX,;                                         
                     IF:TM:OK,REPORT,TYCOK,;                                    
                     IF:NO:TM,FAULT,XX                                          
         AFTER,FUN08 IF:OK,GO:TO,FUN56,;         BACK SPACE REC (REWIND)        
                     IF:TM,GO:TO,FUN56,;                                        
                     IF:EOT,GO:TO,FUN56,;                                       
                     IF:BOT,REPORT,TYCOK                                        
         AFTER,FUN09 IF:OK,GO:TO,FUN57,;         BACK SPACE REC (UNLOAD)        
                     IF:TM,GO:TO,FUN57,;                                        
                     IF:EOT,GO:TO,FUN57,;                                       
                     IF:BOT,GO:TO,FUN57                                         
         AFTER,FUN10 IF:OK,REPORT,TYCOK,;        READ BINARY                    
                     IF:CTDE,RETRY,FUN24,;                                      
                     IF:TDE,RETRY,FUN24,;                                       
                     IF:EOT,REPORT,TYCOK,;,;                                    
                     IF:TM,REPORT,TYCTM                                         
         AFTER,FUN11 IF:OK,REPORT,TYCOK,;        WRITE BINARY                   
                     IF:CTDE,RETRY,FUN36,;                                      
                     IF:TDE,RETRY,FUN36,;                                       
                     IF:EOT,REPORT,TYCEOT                                       
         AFTER,FUN12 IF:OK,GO:TO,FUN66,;         BKSP RECORD                    
                     IF:TM,REPORT,TYCTM,;                                       
                     IF:EOT,GO:TO,FUN66,;                                       
                     IF:BOT,REPORT,TYCBOT                                       
         AFTER,FUN13 IF:OK,REPORT,TYCOK,;        READ DECIMAL                   
                     IF:EOT,REPORT,TYCOK,;                                      
                     IF:CTDE,RETRY,FUN24,;                                      
                     IF:TDE,RETRY,FUN24,;                                       
                     IF:TM,REPORT,TYCTM                                         
         AFTER,FUN14 IF:OK,REPORT,TYCOK,;        WRITE DECIMAL                  
                     IF:CTDE,RETRY,FUN36,;                                      
                     IF:TDE,RETRY,FUN36,;                                       
                     IF:EOT,REPORT,TYCEOT                                       
         AFTER,FUN15 IF:OK,GO:TO,FUN68,;         BKSP RECORD                    
                     IF:EOT,GO:TO,FUN68,;                                       
                     IF:TM,REPORT,TYCTM,;                                       
                     IF:BOT,REPORT,TYCBOT                                       
         AFTER,FUN16 IF:OK,REPORT,TYCOK,;        READ PACKED                    
                     IF:EOT,REPORT,TYCOK,;                                      
                     IF:CTDE,RETRY,FUN24,;                                      
                     IF:TDE,RETRY,FUN24,;                                       
                     IF:TM,REPORT,TYCTM                                         
         AFTER,FUN17 IF:OK,REPORT,TYCOK,;        WRITE PACKED                   
                     IF:CTDE,RETRY,FUN36,;                                      
                     IF:TDE,RETRY,FUN36,;                                       
                     IF:EOT,REPORT,TYCEOT                                       
         AFTER,FUN18 IF:OK,GO:TO,FUN69,;         BKSP RECORD                    
                     IF:TM,REPORT,TYCTM,;                                       
                     IF:EOT,GO:TO,FUN69,;                                       
                     IF:BOT,REPORT,TYCBOT                                       
         AFTER,FUN19 IF:OK,REPORT,TYCOK,;        WRITE TAPE MARK (7T)           
                     IF:CTDE,RETRY,FUN36,;                                      
                     IF:TDE,RETRY,FUN36,;                                       
                     IF:EOT,REPORT,TYCEOT                                       
         AFTER,FUN20 IF:OK,CHK:TM,XX,;           FORE SPACE FILE (W/BACK REC)   
                     IF:EOT,CHK:TM,XX,;                                         
                     IF:TM:OK,GO:TO,FUN22,;                                     
                     IF:NO:TM,FAULT,XX                                          
         AFTER,FUN21 IF:OK,CHK:TM,XX,;           BACK SPACE FILE (W/FORE REC)   
                     IF:BOT,REPORT,TYCOK,;                                      
                     IF:EOT,CHK:TM,XX,;                                         
                     IF:TM:OK,GO:TO,FUN23,;                                     
                     IF:NO:TM,FAULT,XX                                          
*                                                                               
* FUNCTION 20 FOLLOW ON                                                         
*                                                                               
         AFTER,FUN22 IF:TM,REPORT,TYCOK,;        BACK SPACE RECORD              
                     IF:EOT,REPORT,TYCOK                                        
*                                                                               
* FUNCTION 21 FOLLOW ON                                                         
*                                                                               
         AFTER,FUN23 IF:TM,REPORT,TYCOK,;        FORE SPACE RECORD              
                     IF:EOT,REPORT,TYCOK                                        
*                                                                               
* READ RECOVERY                                                                 
*                                                                               
         AFTER,FUN24 IF:OK,CK:CLENR,XX,;         BACK SPACE RECORD              
                     IF:TM,CK:CLENR,XX,;                                        
                     IF:EOT,CK:CLENR,XX,;                                       
                     IF:NORM,DO:AGAIN,XX,;                                      
                     IF:CLENR,GO:TO,FUN25                                       
*                                                                               
* CLEANER READ RECOVERY                                                         
*                                                                               
         AFTER,FUN25 IF:OK,GO:TO,FUN26,;         BACK SPACE RECORD              
                     IF:TM,GO:TO,FUN26,;                                        
                     IF:EOT,GO:TO,FUN26,;                                       
                     IF:BOT,DO:AGAIN,XX                                         
         AFTER,FUN26 IF:OK,GO:TO,FUN27,;         BACK SPACE RECORD              
                     IF:TM,GO:TO,FUN27,;                                        
                     IF:EOT,GO:TO,FUN27,;                                       
                     IF:BOT,GO:TO,FUN30                                         
         AFTER,FUN27 IF:OK,GO:TO,FUN28,;         BACK SPACE RECORD              
                     IF:TM,GO:TO,FUN28,;                                        
                     IF:EOT,GO:TO,FUN28,;                                       
                     IF:BOT,GO:TO,FUN29                                         
         AFTER,FUN28 IF:OK,GO:TO,FUN29,;         FORE SPACE RECORD              
                     IF:TM,GO:TO,FUN29,;                                        
                     IF:EOT,GO:TO,FUN29                                         
         AFTER,FUN29 IF:OK,GO:TO,FUN30,;         FORE SPACE RECORD              
                     IF:TM,GO:TO,FUN30,;                                        
                     IF:EOT,GO:TO,FUN30                                         
         AFTER,FUN30 IF:OK,DO:AGAIN,XX,;         FORE SPACE RECORD              
                     IF:TM,DO:AGAIN,XX,;                                        
                     IF:EOT,DO:AGAIN,XX                                         
*                                                                               
* READ REVERSE RECOVERY                                                         
*                                                                               
         AFTER,FUN31 IF:OK,DO:AGAIN,XX,;         FORE SPACE RECORD              
                     IF:TM,DO:AGAIN,XX,;                                        
                     IF:EOT,DO:AGAIN,XX                                         
*                                                                               
* 9 AND 7 TRACK WRITE RECOVERY                                                  
*                                                                               
*                                                                               
         AFTER,FUN36 IF:OK,CK:RETRY,XX,;         BACK SPACE RECORD              
                     IF:TM,CK:RETRY,XX,;                                        
                     IF:EOT,CK:RETRY,XX,;                                       
                     IF:LOW,GO:TO,FUN37,;                                       
                     IF:HIGH,GO:TO,FUN39                                        
         AFTER,FUN37 IF:OK,GO:TO,FUN38,;         BACK SPACE RECORD              
                     IF:TM,GO:TO,FUN38,;                                        
                     IF:EOT,GO:TO,FUN38,;                                       
                     IF:BOT,GO:TO,FUN39                                         
         AFTER,FUN38 IF:OK,GO:TO,FUN39,;         READ WITH SKIP                 
                     IF:EOT,GO:TO,FUN39,;                                       
                     IF:TM,GO:TO,FUN39                                          
         AFTER,FUN39 IF:OK,GO:TO,FUN40,;         SET ERASE OR ERASE(STC)        
                     IF:EOT,GO:TO,FUN40                                         
         AFTER,FUN40 IF:OK,GO:TO,FUN41,;         ER+WRITE OR WRITE(STC)         
                     IF:CTDE,SPECIAL,XX,;                                       
                     IF:TDE,SPECIAL,XX,;                                        
                     IF:EOT,GO:TO,FUN41                                         
         AFTER,FUN41 IF:OK,GO:TO,FUN42,;         BACK SPACE RECORD              
                     IF:TM,GO:TO,FUN42,;                                        
                     IF:EOT,GO:TO,FUN42                                         
         AFTER,FUN42 IF:OK,GO:TO,FUN43,;         BACK SPACE RECORD              
                     IF:TM,GO:TO,FUN43,;                                        
                     IF:EOT,GO:TO,FUN43,;                                       
                     IF:BOT,GO:TO,FUN44                                         
         AFTER,FUN43 IF:OK,GO:TO,FUN44,;         READ WITH SKIP                 
                     IF:TM,GO:TO,FUN44,;                                        
                     IF:EOT,GO:TO,FUN44                                         
         AFTER,FUN44 IF:OK,REPORT,TYCOK,;        READ WITH SKIP                 
                     IF:TM,REPORT,TYCOK,;                                       
                     IF:EOT,REPORT,TYCEOT,;                                     
*                                                                               
* REWIND AND UNLOAD FOLLOW ON'S                                                 
*                                                                               
                     IF:CTDE,RETRY,FUN36                                        
         AFTER,FUN56 IF:OK,REPORT,TYCOK,;        REWIND                         
                     IF:EOT,REPORT,TYCOK,;                                      
                     IF:BOT,REPORT,TYCOK                                        
         AFTER,FUN57 IF:OK,REPORT,TYCOK,;        UNLOAD                         
                     IF:EOT,REPORT,TYCOK,;                                      
                     IF:BOT,REPORT,TYCOK                                        
         DO       #7TTAPE                                                       
*                                                                               
* 7 TRACK READ REVERSE SIMULATION                                               
*                                                                               
         AFTER,FUN66 IF:OK,SAVE:RBC,FUN67,;      READ BINARY                    
                     IF:CTDE,CK:CLENR,XX,;                                      
                     IF:TDE,CK:CLENR,XX,;                                       
                     IF:EOT,SAVE:RBC,FUN67,;                                    
                     IF:NORM,DO:AGAIN,XX,;                                      
                     IF:CLENR,RETRY,FUN25                                       
         AFTER,FUN67 IF:OK,GET:RBC,TYCOK,;       BACK SP REC                    
                     IF:EOT,GET:RBC,TYCOK                                       
         AFTER,FUN68 IF:OK,SAVE:RBC,FUN67,;      READ DECIMAL                   
                     IF:CTDE,CK:CLENR,XX,;                                      
                     IF:TDE,CK:CLENR,XX,;                                       
                     IF:EOT,SAVE:RBC,FUN67,;                                    
                     IF:NORM,DO:AGAIN,XX,;                                      
                     IF:CLENR,RETRY,FUN25                                       
         AFTER,FUN69 IF:OK,SAVE:RBC,FUN67,;      READ PACKED                    
                     IF:CTDE,CK:CLENR,XX,;                                      
                     IF:TDE,CK:CLENR,XX,;                                       
                     IF:EOT,SAVE:RBC,FUN67,;                                    
                     IF:NORM,DO:AGAIN,XX,;                                      
                     IF:CLENR,RETRY,FUN25                                       
         FIN      #7TTAPE                                                       
         AFTER,FUN72 IF:OK,LOG:N:DO,LASTFUN,;    INCONSISTENT                   
                     IF:TDE,LOG:N:DO,LASTFUN,;                                  
                     IF:TM,LOG:N:DO,LASTFUN,;                                   
                     IF:EOT,LOG:N:DO,LASTFUN,;                                  
                     IF:BOT,LOG:N:DO,LASTFUN,;                                  
                     IF:CTDE,LOG:N:DO,LASTFUN                                   
*****************************************************************               
         PAGE                                                                   
         DO       #7TTAPE=0                                                     
FUN66    EQU      FUN72                                                         
FUN67    EQU      FUN72                                                         
FUN68    EQU      FUN72                                                         
FUN69    EQU      FUN72                                                         
         FIN      NO 7 TRACK TAPES                                              
*                                                                               
         ELSE     NO TAPES AT ALL                                               
TAPEPRE  RES      0                                                             
TAPEPOST RES      0                                                             
MTAP     RES      0                                                             
MTAPCU   RES      0                                                             
7TAP     RES      0                                                             
7TAPCU   RES      0                                                             
TAPE     RES      0                                                             
         FIN      NO TAPES                                                      
         CRASH    'TAPE'                                                        
         TITLE    '** TAPE - FLOPLOT SOURCE **'                                 
*;         VERSION  A00                                                         
*;         TITLE    TAPE                                                        
*;         HEADING  3325,3335,3345,3346,3347 TAPE HANDLER                       
*;         ENTRY    TAPEPRE                                                     
*;         P        PICK UP :DOT TABLE PTR;SET CHANNEL HOLD FOR SENSE           
*;         EXIT     ;COMLIST                                                    
*;         COLUMN   2                                                           
*;         ENTRY    TAPEPOST                                                    
*;         L,NEWIOCK IS THERE AN ERROR OR ABNORMAL CONDITION                    
*;         IF,YES   TAPEERR                                                     
*;         IF,NO                                                                
*;         EXIT     ;TERM1                                                      
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;TAPEERR EXIT    ;TAPEERR                                                      
*;         PAGE                                                                 
*;         ENTRY    ;TAPEERR                                                    
*;         D        IS;TDV CC1 SET                                              
*;         IF,YES   &X1                                                         
*;         IF,NO                                                                
*;         D        IS;TDV CC2 SET                                              
*;         IF,YES   &X2                                                         
*;         IF,NO                                                                
*;         D        IS;DEVICE OPERATIONAL                                       
*;         IF,NO    &X3                                                         
*;         IF,YES                                                               
*;         D        IS;TAPE MOTION OK                                           
*;         IF,YES   &X5                                                         
*;         IF,NO                                                                
*;         D        IS;POSITION LOST                                            
*;         IF,YES   &X6                                                         
*;         IF,NO                                                                
*;         EXIT     ;TAPE05                                                     
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X1      EXIT     ;EXITSENS                                                   
*;&X2      EXIT     ;EXITTM                                                     
*;&X3      EXIT     ;EXITNO                                                     
*;&X5      EXIT     ;TAPE10                                                     
*;&X6      EXIT     ;EXITSENS                                                   
*;         COLUMN   1                                                           
*;         ENTRY    ;TAPE05                                                     
*;         D        IOP;HALT                                                    
*;         IF,YES   &X12                                                        
*;         IF,NO                                                                
*;         D        ;BOT                                                        
*;         IF,YES   &X13                                                        
*;         IF,NO                                                                
*;         D        WRITE PERMITED                                              
*;         IF,NO    &X14                                                        
*;         IF,YES                                                               
*;         EXIT     ;EXITFALT                                                   
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X12     EXIT     ;EXITFALT                                                   
*;&X13     EXIT     ;TERM4                                                      
*;&X14     EXIT     ;EXITWP                                                     
*;         PAGE                                                                 
*;         ENTRY    ;TAPE10                                                     
*;         D        IOP;HALT (W/MOTION)                                         
*;         IF,YES   &X22                                                        
*;         IF,NO                                                                
*;         D        ;TRANSMISSION DATA ERROR                                    
*;         IF,NO    &X23                                                        
*;         IF,YES                                                               
*;         D        IS;IT CORRECTABLE                                           
*;         IF,YES   &X24                                                        
*;         IF,NO                                                                
*;         EXIT     ;TERM2                                                      
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X22     EXIT     ;TERM2                                                      
*;&X23     EXIT     ;TAPE20                                                     
*;&X24     EXIT     ;TERM6                                                      
*;         COLUMN      1                                                        
*;         ENTRY    ;TAPE20                                                     
*;         D        IS;IT A TAPE MARK                                           
*;         IF,YES   &X32                                                        
*;         IF,NO                                                                
*;         D        IS;IT BOT                                                   
*;         IF,YES   &X33                                                        
*;         IF,NO                                                                
*;         D        IS;IT EOT                                                   
*;         IF,YES   &X34                                                        
*;         IF,NO                                                                
*;         D        IS;IT INCORRECT LENGTH                                      
*;         IF,YES   &X35                                                        
*;         IF,NO                                                                
*;         EXIT     ;EXITSENS                                                   
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X32     EXIT     ;TERM3                                                      
*;&X33     EXIT     ;TERM5                                                      
*;&X34     EXIT     ;TERM4                                                      
*;&X35     EXIT     ;TERM1                                                      
*;         PAGE                                                                 
*;         HEADING  7322/23, 7332/33 MAGNETIC TAPE HANDLER (9 TRACK)            
*;         ENTRY    ;MTAP                                                       
*;         D        IS;THE FUNCTION STEP TOO BIG                                
*;         IF,YES   &XINC                                                       
*;         IF,NO                                                                
*;         P        PICK UP :DOT PTR;SET HOLD FOR SENSE                         
*;         EXIT     ;COMLIST                                                    
*;         COLUMN   1                                                           
*;         SPACE    1                                                           
*;&XINC    EXIT     ;EXITSENS                                                   
*;         COLUMN   1                                                           
*;         ENTRY    ;MTAPCU                                                     
*;         L,NEWIOCK IS THERE AN ERROR OR ABNORMAL CONDITION                    
*;         IF,YES   &XER                                                        
*;         IF,NO                                                                
*;         D        IS;IT;EOT                                                   
*;         IF,YES   &XX10                                                       
*;         IF,NO                                                                
*;         D        IS;IT;BOT                                                   
*;         IF,YES   &XX20                                                       
*;         IF,NO                                                                
*;         EXIT     ;TERM1                                                      
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&XX10    EXIT     ;TERM4                                                      
*;&XX20    EXIT     ;TERM5                                                      
*;&XERR    EXIT     ;9TERROR                                                    
*;         PAGE                                                                 
*;9TERROR  ENTRY    ;9TERROR                                                    
*;         D        ARE;DEVICE AND CONTROLER READY                              
*;         IF,NO    &X12                                                        
*;         IF,YES                                                               
*;         D        ;IOP HALT                                                   
*;         IF,YES   &X13                                                        
*;         IF,NO                                                                
*;         D        ;TRANSMISSION MEMORY ERROR                                  
*;         IF,YES   &X13A                                                       
*;         IF,NO                                                                
*;         D        ;TRANSMISSION DATA ERROR                                    
*;         IF,NO    &X14                                                        
*;         IF,YES                                                               
*;         D        IS;IT CORRECTABLE                                           
*;         IF,NO    &X15                                                        
*;         IF,YES                                                               
*;         EXIT     ;TERM2                                                      
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X12     EXIT     ;EXITNO                                                     
*;&X13     EXIT     ;EXITSENS                                                   
*;&X13A    EXIT     ;TERM2                                                      
*;&X14     EXIT     ;9T10                                                       
*;&X15     EXIT     ;TERM6                                                      
*;         COLUMN   1                                                           
*;         ENTRY    ;9T10                                                       
*;         D        IS;IT UNUSUAL END                                           
*;         IF,NO    &X22                                                        
*;         IF,YES                                                               
*;         D        IS;IT;BOT                                                   
*;         IF,YES   &X24                                                        
*;         IF,NO                                                                
*;         D        IS;IT A TAPE MARK                                           
*;         IF,YES   &X23                                                        
*;         IF,NO                                                                
*;         D        IS;IT A WRITE PROTECT VIOLATION                             
*;         IF,YES   &X25                                                        
*;         IF,NO                                                                
*;         EXIT     ;EXITSENS                                                   
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X22     EXIT     ;9T20                                                       
*;&X24     EXIT     ;TERM5                                                      
*;&X23     EXIT     ;TERM3                                                      
*;&X25     EXIT     ;EXITWP                                                     
*;         COLUMN   1                                                           
*;         ENTRY    ;9T20                                                       
*;         D        IS;IT;EOT                                                   
*;         IF,YES   &X32                                                        
*;         IF,NO                                                                
*;         D        IS;IT;INCORRECT LENGTH                                      
*;         IF,YES   &X33                                                        
*;         IF,NO                                                                
*;         D        IS;TDV;CC1;SET                                              
*;         IF,YES   &X34                                                        
*;         IF,NO                                                                
*;         D        IS;TDV;CC4;RESET                                            
*;         IF,YES   &X35                                                        
*;         IF,NO                                                                
*;         EXIT     ;TERM1                                                      
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X32     EXIT     ;TERM4                                                      
*;&X33     EXIT     ;TERM1                                                      
*;&X34     EXIT     ;EXITSENS                                                   
*;&X35     EXIT     ;EXITSENS                                                   
*;         PAGE                                                                 
*;         HEADING  7362/7372 MAGNETIC TAPE HANDLER (7 TRACK)                   
*;         ENTRY    ;7TAP                                                       
*;         L,RE:ENT INHIBIT AND CHECK RE:ENTRANCE                               
*;         D        IS FUNCTION STEP TOO BIG                                    
*;         IF,YES   &X3                                                         
*;         IF,NO                                                                
*;         D        IS;THE FUNCTION STEP < 4                                    
*;         IF,NO    7TAP10                                                      
*;         IF,YES                                                               
*;         P        CHANGE FUNCTION TO 16 TO 19                                 
*;7TAP10   P        ;ENABLE                                                     
*;         EXIT     ;COMLIST                                                    
*;         COLUMN   1                                                           
*;         SPACE    2                                                           
*;&X3      EXIT     ;EXITSENS                                                   
*;         COLUMN   1                                                           
*;         ENTRY    ;7TAPCU                                                     
*;         L,NEWIOCK IS THERE AN ERROR OR ABNORMAL CONDITION                    
*;         IF,YES   7TERROR                                                     
*;         IF,NO                                                                
*;         EXIT     ;TERM1                                                      
*;         COLUMN   1                                                           
*;         SPACE    1                                                           
*;         EXIT     ;7TERROR                                                    
*;         PAGE                                                                 
*;7TERROR  ENTRY    ;7TERROR                                                    
*;         D        ARE;DEVICE AND CONTROLER READY                              
*;         IF,NO    &X12                                                        
*;         IF,YES                                                               
*;         D        ;IOP HALT                                                   
*;         IF,YES   &X13                                                        
*;         IF,NO                                                                
*;         D        ;TRANSMISSION DATA ERROR                                    
*;         IF,NO    &X14                                                        
*;         IF,YES                                                               
*;         D        IS;IT CORRECTABLE                                           
*;         IF,NO    &X15                                                        
*;         IF,YES                                                               
*;         EXIT     ;TERM2                                                      
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X12     EXIT     ;EXITNO                                                     
*;&X13     EXIT     ;EXITSENS                                                   
*;&X14     EXIT     ;7T10                                                       
*;&X15     EXIT     ;TERM6                                                      
*;         COLUMN   1                                                           
*;         ENTRY    ;7T10                                                       
*;         D        IS;IT UNUSUAL END                                           
*;         IF,NO    &X22                                                        
*;         IF,YES                                                               
*;         D        IS;IT A TAPE MARK                                           
*;         IF,YES   &X23                                                        
*;         IF,NO                                                                
*;         D        IS;IT;BOT                                                   
*;         IF,YES   &X24                                                        
*;         IF,NO                                                                
*;         D        IS;IT A WRITE PROTECT VIOLATION                             
*;         IF,YES   &X25                                                        
*;         IF,NO                                                                
*;         EXIT     ;EXITSENS                                                   
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X22     EXIT     ;7T20                                                       
*;&X23     EXIT     ;TERM3                                                      
*;&X24     EXIT     ;TERM5                                                      
*;&X25     EXIT     ;EXITWP                                                     
*;         COLUMN   1                                                           
*;         ENTRY    ;7T20                                                       
*;         D        IS;IT;EOT                                                   
*;         IF,YES   &X32                                                        
*;         IF,NO                                                                
*;         D        IS;IT;INCORRECT LENGTH                                      
*;         IF,YES   &X33                                                        
*;         IF,NO                                                                
*;         D        IS;TDV;CC1;SET                                              
*;         IF,YES   &X34                                                        
*;         IF,NO                                                                
*;         D        IS;TDV;CC4;RESET                                            
*;         IF,YES   &X35                                                        
*;         IF,NO                                                                
*;         EXIT     ;TERM1                                                      
*;         COLUMN   1                                                           
*;         SPACE                                                                
*;&X32     EXIT     ;TERM4                                                      
*;&X33     EXIT     ;TERM1                                                      
*;&X34     EXIT     ;EXITSENS                                                   
*;&X35     EXIT     ;EXITSENS                                                   
*;         PAGE                                                                 
*;         HEADING  COMMON TAPE CODE                                            
*;*                                                                             
*;TERM1    ENTRY    TERM1;OK                                                    
*;TERM2    ENTRY    TERM2;TDE                                                   
*;         B        TAPE                                                        
*;         COLUMN   1                                                           
*;TERM3    ENTRY    TERM3;TAPE MARK                                             
*;TERM4    ENTRY    TERM4;END OF TAPE                                           
*;TERM5    ENTRY    TERM5;BEGINNING OF TAPE                                     
*;         B        TAPE                                                        
*;       SPACE                                                                  
*;         COLUMN   1                                                           
*;TERM6    ENTRY    TERM6;CTDE                                                  
*;TERM7    ENTRY    TERM7;SPECIAL                                               
*;TERM8    ENTRY    TERM8;SPECIAL                                               
*;TAPE     P        COMBINE TERMINATION AND OPERATION AND GET A EXIT;.          
*;                  PTR AND VALUE                                               
*;         IF,EXITSENS  EXITINC                                                 
*;         IF,EXITCUP   EXITCUP                                                 
*;         IF,EXITRTY   EXITRTY                                                 
*;         IF,EXITFOL   EXITFOL                                                 
*;         IF,EXITCLN   EXITCLN                                                 
*;         IF,EXITTMT   EXITTMT                                                 
*;         IF,EXITDEC   EXITDEC                                                 
*;         IF,EXITLSF   EXITLSF                                                 
*;         IF,EXIT1ST   EXIT1ST                                                 
*;         IF,EXITFALT  EXITFALT                                                
*;         IF,EXITLT4   EXITLT4                                                 
*;         IF,EXITLOST  EXITLOST                                                
*;         PAGE                                                                 
*;         ENTRY    EXITINC;INCONSISTANT                                        
*;EXITINC  P        SET TYC = X11;SET MSG = INCONSISTANT                        
*;EXITHIO  L,RE:ENT TEST REENTRANCE                                             
*;         P        HIO DEVICE                                                  
*;         EXIT     ;IOSCU                                                      
*;         COLUMN                                                               
*;         ENTRY    EXITRTY;RETRY                                               
*;EXITRTY  P        SET RETRY, INTER-OP, HOLD FLAGS; ;.                         
*;                  SET RETRY TO EXIT VALUE                                     
*;         B        EXITHIO                                                     
*;         COLUMN                                                               
*;         ENTRY    EXITCUP;DONE                                                
*;EXITCUP  P        SET TYC TO EXIT VALUE                                       
*;         EXIT     ;IOSCU                                                      
*;         SPACE    1                                                           
*;         ENTRY    EXITCLN;CLEANER TEST                                        
*;EXITCLN  D        IS;THIS A 4TH RETRY                                         
*;         IF,YES   &TERM8                                                      
*;         IF,NO                                                                
*;&TERM7   EXIT     ;TERM7                                                      
*;         COLUMN                                                               
*;         ENTRY    EXITFOL;FOLLOW ON                                           
*;EXITFOL  P        SET FOLLOW-ON, INTER-OP FLAGS; ;.                           
*;                  SET FOLLOW-ON TO EXIT VALUE                                 
*;         EXIT     ;IOSCU                                                      
*;         SPACE                                                                
*;         ENTRY    EXITTMT;TAPE MARK TEST                                      
*;EXITTMT  D        IS;TAPE MARK INDICATOR SET                                  
*;         IF,YES   &TERM7                                                      
*;         IF,NO                                                                
*;&TERM8   EXIT     ;TERM8                                                      
*;         COLUMN   1                                                           
*;         ENTRY    EXITDEC;SKIP REC. COUNTER                                   
*;EXITDEC  L,RE:ENT CHECK FOR RE-ENTRANCE                                       
*;         P        DECREMENT COUNTER IN IOQ12                                  
*;         D        IS;COUNT ZERO NOW                                           
*;         IF,YES   &TERM7A                                                     
*;         IF,NO                                                                
*;         EXIT     ;TERM8                                                      
*;       COLUMN   1                                                             
*;       SPACE    3                                                             
*;&TERM7A   EXIT    ;TERM7                                                      
*;         COLUMN                                                               
*;         ENTRY    EXITLSF;LOG SENSE DATA                                      
*;EXITLSF  L,RE:ENT CHECK FOR RE-ENTRANCE                                       
*;         P        LOG SENSE DATA                                              
*;         EXIT     ;EXITFOL                                                    
*;         COLUMN                                                               
*;         ENTRY    EXIT1ST;FOLLOW ON TO IOQ4                                   
*;EXIT1ST  P        SET EXIT VALUE TO INITIAL FUNCTION CODE                     
*;         EXIT     ;EXITFOL                                                    
*;         SPACE                                                                
*;         ENTRY    EXITFALT;FAULT, NO TAPE MOTION                              
*;EXITFALT P        PICK UP CURRENT FUNCTION STEP                               
*;         EXIT     ;EXITRTY                                                    
*;         COLUMN                                                               
*;         ENTRY    EXITLOST;LOST DATA CHECK                                    
*;EXITLOST D        IS;INCORRECT LENGTH SET                                     
*;         IF,NO    &EXITCUP                                                    
*;         IF,YES                                                               
*;         D        ARE THERE ANY BYTES LEFT                                    
*;         IF,YES   &EXITCUP                                                    
*;         IF,NO                                                                
*;         P        SET TYC = X2;                                               
*;&EXITCUP EXIT     ;EXITCUP                                                    
*;         COLUMN                                                               
*;         ENTRY    EXITNO;NOT OPERATIONAL                                      
*;EXITNO   P        SET TYC INCONSISTENT;SET UP MESSAGE FOR NOT-OP              
*;         EXIT     ;EXITCUP                                                    
*;         SPACE                                                                
*;         ENTRY    EXITWP;WRITE PROTECT                                        
*;EXITWP   P        SET KEY-IN FLAG; SET UP WRITE PROTECT MESSAGE               
*;         EXIT     ;EXITCUP                                                    
*;         COLUMN                                                               
*;         ENTRY    EXITTM;TEST MODE                                            
*;EXITTM   P        SET TYC INCONSISTENT;SET UP TEST MODE MESSAGE               
*;         EXIT     ;EXITCUP                                                    
*;       SPACE                                                                  
*;       ENTRY    EXITLT4;RETRY # < 4 TEST                                      
*;EXITLT4 D       IS;RETRY COUNT < 4                                            
*;       IF,YES   &XT7                                                          
*;       IF,NO                                                                  
*;       EXIT     ;TERM8                                                        
*;       COLUMN   1                                                             
*;       SPACE    5                                                             
*;&XT7   EXIT     ;TERM7                                                        
*;         END                                                                  
         TITLE    '** TAPE - SYMBOLS AND CROSSREFERENCE **'                     
         END                                                                    
