 TITLE '*** 73XX MAGNETIC TAPE I/O HANDLER E00 CP-V ***'
         DEF      MAGTAPE:          EXECUTIVE DELTA PATCHING SYMBOL.
MAGTAPE: EQU      %
MAGTAPE  EQU      %
*
         SYSTEM   UTS
*
*
:DOT     CNAME
         PROC
         DO1      NUM(LF)=1
LF       SET      %-DOT
         GEN,8,8,8,8 AF(1),AF(2),AF(3),AF(4)
         PEND
         SPACE
:CLIST   CNAME
         PROC
         DO1      NUM(LF)=1
LF       SET      BA(%)-BA(DOT)
I        DO       NUM(AF)
         DATA,1   DA(AF(I))-DA(DOT)
         FIN      I
         PEND
         SPACE
:CDW     COM,8,24,8,8,8,8  AF(1),AF(2),AF(3),X'80',AF(4),AF(5)
*
*        DEF'S FOR MAGTAPE
*
         DEF      TYC:TST           FIND MATCHING TYC FOR TDV BIT
         DEF      EXITIS1           COME W/R13 LOADED TO ERROR EXIT I/O
         DEF      MTAPCU1           ENTRY FROM NSTAP FOR NO-ERROR CLNUP
         DEF      MTAPCU            CLEANUP ENTRY FROM IOQ
         DEF      WRITERR           WRITE TAPE ERROR EXIT
         DEF      MTAP11
         DEF      MTAP16            FOR NSTAP
         DEF      EXITIS            'INCONSISTENT STATUS' EXIT POINT
         DEF      MT64              MERGE FROM NSTAP FOR RDBS CHECKS
         DEF      MT65              MERGE FROM NSTAP FOR LOST POSITION
         DEF      SPC:TST           CHECK FOR USER ORIGINATED SPACE ORDERS
         DEF      VECT1             VECTOR TABLE
         DEF      MTAP54            FOR 7TAP
         DEF      9TDOT             NINE TRACK DOT TABLE
         DEF      NEWERCK
         DEF      EXITRTY           START RETRY ROUTINE
         DEF      EXITFOL           START FOLLOW-ON ROUTINE
         DEF      EXTSTORE          STORE NEW FUNCTION IN DCT17 ROUTINE
         DEF      EXITOK            LOAD TYC=NORMAL
         DEF      EXITERR           LOAD TYC=ERROR
         DEF      EXTERASE          CONTINUE ERASING TAPE ROUTINE
         DEF      MTAP              PRE-PROCESS ENTRY POINT
         DEF      MTAP06
         DEF      CUSETUP           SETUP CLEANUP REGISTERS
         DEF      VECT4             FOR 7TAP
         DEF      VECT5             FOR 7TAP
         REF      M19               DATA OF X'0007FFFF'
         DEF      RSTRBC            FOR 7TAP
         DEF      SAVRBC            FOR 7TAP
         DEF      FCEWR6
         DEF      FCEWR8
         DEF      FCSNSL1,FCSNSL2,FCSNSL3,FCSNSL4,FCSNSL5
*,*                                 FILE OPERATION REPORTS A
*,*                                 TAPE MARK.
         DEF      FCMC
         DEF      MAGTAPE
         DEF      MTAP10
         DEF      MTAP20
         DEF      MTAP30
         DEF      MTAP50
         DEF      MT14
         DEF      MT16
         DEF      MT18
         DEF      NOISE
         DEF      NOTOPTST
         DEF      SPAC:FIL
         DEF      SPAC:REC
*
*
         REF      IOSERCK           OLD GENERAL ERROR TESTING
         REF      IOARS             ARS ROUTINE IN IOQ
         REF      DOUBLEZERO        DBL-WORD OF ALL ZEROES IN TABLES
*,*                                 ROUTINE IN 'BASHANDL' MODULE;
*,*                                 DOES PART OF GENERAL ERROR
*,*                                 CHECKING FOR 'NEWERCK'.
         REF      IOSEREC           SUBROUTINE OF 'IOSERCK'; LOGS
*,*                                 CERTAIN ERRORS FOR 'NEWERCK'.
         REF      IOSCU             GENERAL I/O CLEAN-UP ROUTINE
*,*                                 IN 'IOQ' MODULE; ALL 'MAGTAPE'
*,*                                 EXITS EVENTUALLY GO TO
*,*                                 THIS ROUTINE.
         REF      RE:ENT            ROUTINE IN 'BASHANDL' MODULE;
*,*                                 CALLED TO CHECK FOR REENTRANCE
*,*                                 BEFORE AN INTERRUPT ALTERABLE
*,*                                 TABLE IS MODIFIED.
         REF      REPCOM            RETURN TO 'COMLIST' IN THE
*,*                                 'BASHANDL' MODULE TO COMPLETE
*,*                                 A COMMAND LIST FOR A DATA
*,*                                 CHAINED REVERSE READ.
         REF      USECOM            RETURN TO 'COMLIST' IN THE
*,*                                 'BASHANDL' MODULE TO STORE A
*,*                                 COMMAND THAT HAS BEEN MODIFIED
*,*                                 BY A 'MAGTAPE' SUBROUTINE.
         REF      TB:FLGS1          MAG TAPE TABLE, CONTAINING
*,*                                 THE POTTER TAPE DRIVE (MODELS
*,*                                 7332, 7333) IDENTIFIER FLAG.
         REF      MSG2              ADDRESS OF 'ERROR' MESSAGE.
         REF      MSG9A             ADDRESS OF 'INCONSISTENT
*,*                                 STATUS' MESSAGE.
         REF      DCT1              DEVICE ADDRESS: FOR ISSUING
*,*                                 HIO INSTRUCTION.
         REF      DCT3              TO CHECK IF TIMEOUT OCCURRED
         REF      DCT4              DEVICE TYPE: INDEX INTO 'TB:FLGS1'
*,*                                 TABLE TO CHECK FOR POTTER DRIVE.
         REF      DCT7              ADDRESS OF CLIST AREA: TO ACCESS
*,*                                 SENSE DATA BUFFER, 'BYTESKIP'
*,*                                 COUNTER, 'ERASEBUF' COUNTER,
*,*                                 AND 'RBCSAVE'.
         REF      DCT8              PRE-PROCESSOR ENTRY POINT: TO
*,*                                 SEE IF '7TAP' OR 'NSTAP' IS
*,*                                 IN THE SYSTEM.
         REF      DCT13             TDV STATUS: TO SAVE AND RESTORE
*,*                                 REMAINING BYTE COUNT (RBC).
         REF      DCT17             RETRY AND FOLLOW-ON CODES:
*,*                                 CHANGED FROM ORIGINAL DOT VALUES
*,*                                 FOR CERTAIN RECOVERY SEQUENCES.
         REF      IOQ4              ORIGINAL FUNCTION CODE: USED
*,*                                 TO CHECK FOR 7-TRACK REVERSE READ.
         REF      IOQ5              CURRENT FUNCTION CODE: USED TO
*,*                                 DISTINGUISH A RECOVERY SEQUENCE
*,*                                 FROM NORMAL FUNCTION CLEAN-UP.
         REF      IOQ8              FLAGS AND BUFFER ADDRESS: USED
*,*                                 TO TEST FOR DATA CHAINING.
         REF      IOQ9              REQUESTED BYTE COUNT OR NUMBER
*,*                                 OF IOCD'S IN A DATA CHAIN:
*,*                                 USED TO GET REQUESTED BYTE COUNT;
*,*                                 ALSO, REMAINING SPACE COUNT
*,*                                 (FOR ARS) ON A PRECORD IS
*,*                                 STORED HERE.
         REF      IOQ11             RETRIES REMAINING: SET TO ZERO
*,*                                 FOR NON-RECOVERABLE ERRORS.
         REF      IOQ12             PRECORD SPACING COUNT.
         REF      M16               MASK FOR RBC IN TDV  STATUS
*,*                                 AND FOR REQUESTED BYTE COUNT
*,*                                 IN DATA CHAINED IOCD'S.
         REF      M24               'IOQ8' ADDRESS MASK.
         REF      Y02
         REF      YC                MASK TO SET CHANNEL NOT BUSY
*,*                                 IN R4 (PRE-PROCESSOR) FOR REWINDS.
         SREF     NSTAP             USED TO TEST FOR EXISTENCE OF
*,*                                 NS TAPE IN SYSTEM CONFIGURATION.
         SREF     NSLOG             ENTRY POINT IN 'NSTAP' MODULE
*,*                                 FOR SENSE DATA ERROR LOGGING.
         SREF     7TAP              USED TO TEST FOR EXISTENCE OF
*,*                                 7-TRACK TAPE IN SYSTEM
*,*                                 CONFIGURATION.
*
*
         SREF     EXTREVCK
         REF      IOQ10
         REF      COMLIST
         REF      MSG5
         REF      MSG9
         REF      Y2
         SREF     7TAP20
*
*
*
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
*
*
*        TYC CODES
*
TYCOK    EQU      1                 SUCCESS
TYCBOT   EQU      3                 LOAD POINT
TYCEOT   EQU      5                 END OF TAPE
TYCTM    EQU      6                 TAPE MARK (END OF FILE)
TYCERR   EQU      8                 ERROR
TYCEREOT EQU      X'13'             ERROR AT END OF TAPE
*
*        FLAGS
*
FLGRETRY EQU      X'8000'
FLGFOLOW EQU      X'4000'
FLGINTER EQU      X'2000'
FLGKEYNC EQU      X'800'
FLGHOLD  EQU      X'400'
*
*        ORDER CODES
*
RDBCODE  EQU      12                READ BACKWARD
SRBCODE  EQU      75                SPACE RECORD BACKWARD
SFBCODE  EQU      91                SPACE FILE BACKWARD
SCCODE   EQU      3                 SET CORRECTION
SECODE   EQU      99                SET ERASE
RWONCODE EQU      19                REWIND ON-LINE
RWOFCODE EQU      35                REWIND OFF-LINE
*
*        SPECIAL CLIST AREA WORDS
*
SENSEBUF EQU      2                 SENSE DATA BUFFER, WDS 2-5
FUNCSAVE EQU      6                 CURRENT FUNCTION SAVE AREA
RBCSAVE  EQU      6                 7-TRACK REVERSE READ SAVE AREA
BYTESKIP EQU      7                 WT RECOVERY REV READ BYTE COUNTER
ERASEBUF EQU      7                 WT RECOVERY ERASE COUNT
*
*
64K      EQU      X'10000'
         PAGE
*
*        TAPE WRITE ERROR RECOVERY STEPS
*
*        1. WRITE REQUESTOR'S RECORD.
*        2. SET CORRECTION ORDER.
*        3. SPACE RECORD BACK (SRB) OVER ERROR RECORD.
*        4. WRITE A TAPE MARK (TM) .
*        5. SPACE RECORD BACK OVER TM.
*        6. READ BACKWARDS W/SKIP (RDBS) OVER PRECEDING 'GOOD' RECORD.
*        7. IF STEP 6 HAS ANY ERROR AT ALL REPEAT STEP 6.
*        8. ONCE STEP 6 IS PERFORMED W/O ERROR - SRF TO GET IN FRONT
*           OF THE 'GOOD' RECORD.
*        9. SET ERASE ORDER GIVEN.
*       10. ERASE TAPE BY SENDING TM ORDER.
*       11. SRB - CHECK TO SEE IF ENUFF TAPE ERASED TO COVER THE
*           ERROR RECORD - GO TO STEP 10 IF NOT.
*       12. REWRITE THE RECORD.
*       13. SPACE RECORD BACK OVER REWRITTEN RECORD.
*       14. SPACE RECORD BACK OVER PRECEDING RECORD.
*       15. READ FOREWARD WITH SKIP OVER RECORD SKIPPED IN STEP#14.
*       16. READ FOREWARD WITH SKIP THE REWRITTEN RECORD.
*       17. ANY ERRORS OCCUR ON STEP'S 12 THRU 16 CAUSE OPERATION
*           TO BE ABORTED.
*
*
         PAGE
*
*        READ BACKWARD WITH SKIP (RDBS) ERROR RECOVERY
*        (AS A PART OF WRITE TAPE ERROR RECOVERY ONLY)
*
MTAP60   EQU      %
         CI,R5    X'60'             TDE/TME TEST
MT64     EQU      %
         BAZ      MT68              NO TME/TDE ERROR HIT
MT65     EQU      %
         LB,R13   DCT3,R1           IF TIMEOUT OCCURRED WITH TAPE MOTION,
         AND,R13  =X'EF'               WE RESET DEV TIMEOUT INDICATOR
         STB,R13  DCT3,R1            & REPORT IT AS 'LOST POSITION'
         LI,R13   TLPMSG            NOT OK - TAPE HAS LOST POSITION
         B        EXITIS1           QUIT NOW
*
TLPMSG   EQU      %
         DATA,1   MSGC,64,'E','R'
         TEXT     'ROR-TAPE LOST POSITI'
         DATA,1   'O','N',64,21
MSGC     EQU      BA(%)-BA(TLPMSG)-1
         PAGE
*
*        SETUP REGISTERS FOR CLEANUP
*
*        REGISTER ASSIGNMENTS INSIDE MAGTAPE:
*
*        R0 -     NOT AVAIL (IN USE BY IOQ)
*        R1 -     DCT INDEX
*        R2 -     CIT INDEX
*        R3 -     IOQ INDEX
*        R4 -     CURRENT FUNCTION STEP (FROM IOQ5)
*        R5 -     AIO/TDV STATUS BITS (16,16)
*        R6 -     AIO STATUS
*        R8 -     TIO STATUS BITS
*        R9 -     HANDLER PRE-PROCESSOR ADDRESS (WA FORMAT)
*        R10-     TDV STATUS WORD ZERO
*        R11-     REMAINING BYTE COUNT
*        R12-     DEFAULT TYC
*        R13-     DEFAULT ERROR MSG
*        R14-     DEVICE ACTIVITY COUNTER (BELONGS TO IOQ)
*
CUSETUP  EQU      %
         LB,R4    IOQ5,R3           GET CURRENT FUNCTION STEP
         LI,R9    X'1FFFF'
         AND,R9   DCT8,R1           GET HANDLER PRE-PROCESSOR ADDRS
         LD,R10   DCT13,R1          GET TDV STATUS
         AND,R11  M16               EXTRACT RBC FOR CLEANUP
         AND,R10  M19               EXTRACT LAST CDW DA
         B        0,R7              RETURN TO CALLER
         PAGE
*
*        CHECK FOR BOT ON READ REV W/SKIP
*
MT68     EQU      %                 GET HERE CAUSE NO TDE/TME
         CI,R5    X'400'            ARE WE AT BOT NOW....
         BAZ      MT69              NOPE
         LB,R5    IOQ4,R3           CALLING FUNCTION CODE
         STB,R5   IOQ5,R3           BACK TO ORIG. FUNCTION CODE.
         LI,R12   X'2800'           KEYIN REQUIRED
         LI,R13   STRIPMES          'STRIP TAPE' MESSAGE
         B        IOSCU             BACK TO IOQ
STRIPMES TEXTC    ' STRIP TAPE AND RE-TRY'
*
*        GET HERE CAUSE NOT TDE/TME ERROR AND NOT AT BOT EITHER
*
*
MT69     EQU      %
         CI,R5    X'1000'           WELL THEN HOW BOUT A TAPE MARK....
         BAZ      EXITIS            EXIT TO INCONSISTENT STATUS COND.
         LI,R5    FCEWR6            OTHERWISE LOAD NEW FUNCTION CODE
*
*        SPACE FILE FORWARD IF WE HIT A FILE MARK
*
         B        EXTSTORE          AND SPACE FILE FORWARD CUASE WE
*                                   FINALLY FOUND A GOOD RECORD (TM)
         PAGE
*------------------------------------*
*                                   *
*        CLEANUP ENTRY POINT        *
*                                   *
*------------------------------------*
*
MTAPCU   EQU      %
         BAL,R7   NEWERCK           TEST FOR GENERAL TYPS OF ERRORS
         B        MTAP05            GOT AN ERROR
*
*        NO ERRORS FOUND
*
MTAPCU1  EQU      %                 COMMON CLEANUP ENTRY FROM NSTAP..
         BAL,R7   CUSETUP           SETUP CLEANUP REGISTERS
         LB,R7    VECT1,R4          GET NO ERROR ROUTINE ADDRESS
         B        MAGTAPE,R7        AND GO TO IT
         PAGE
*
*        FOUND SOME TYPE OF ERRORS - DISPATCH FUNCTION DEPENDENT
*        ROUTINES
*
MTAP05   EQU      %
         LC       DCT3,R1           DID DEVICE TIMEOUT?
         BCS,1    MT65              Y, REPORT LOST POSITION
         BAL,R15  NOTOPTST          TEST FOR DEVICE OPERATIONAL
         BAL,R7   CUSETUP           IS UP - SETUP CLEANUP REGISTERS
         LB,R7    VECT3,R4          GET ERROR ROUTINE INDEX
MTAP06   EQU      %
         B        MAGTAPE,R7        GO TO ERROR ANALYSIS
         PAGE
*
*        SPACING CODES COME HERE WHEN DONE OR AT BOT/EOT/TAP MARK
*
SPC:TST  EQU      %
         CLM,R4   SPC:ORD           IS USER REQUESTED SPACING
         BCS,9    RCVRY             NO--> IS PART OF TAPE RECOVERY
         LD,R10   DCT13,R1          GET TDV STATUS
         LW,R11   IOQ12,R3          GET # OF PRERECORDS (OR FILES) LEFT
         STD,R10  DCT13,R1          REPLACE AS RBC FIELD
         SLS,R11  1                 DOUBLE IT
         STH,R11  IOQ9,R3           PUT BACK AS REQUESTED COUNT
         B        TYC:TST           SEE IF WE SHOULD CHANGE THE TYC
*
*        CONTINUE CHECKS USING NORMAL NO-ERROR VECTOR
*
RCVRY    EQU      %
         LB,R7    VECT1,R4          GET NO-ERROR ENTRY POINT
         CI,R9    7TAP              IS THIS A 7-TRACK TAPE
         BNE      MAGTAPE,R7        NO--> CONTINUE W/RECOVERY STEP
         LB,R7    VECT4,R4          YES-> 7TRACK ENTRY POINT
         B        MAGTAPE,R7        AND DISPATCH ROUTINE
*
         BOUND    8
SPC:ORD  DATA     FCTM
         DATA     FCSFF             ALL RECORD/FILE SPACE ORDERS
*
TYC:RAN  DATA     1,X'15'
*
*
         PAGE
*
*        TEST FOR UNIQUE TYC'S TO RETURN
*
TYC:TST  EQU      %
         LI,R6    3                 ASSUME READ ORDER
         CH,R5    TDVBIT,R6         FIND MATCHING TDVBIT
         BANZ     TYC:TST1          GOTCHA
         BDR,R6   %-2               KEEP GOING
         CLM,R12  TYC:RAN           DO WE HAVE A TYC NOW..
         BCR,9    EXITOK1           YUP
         B        EXITOK            NO-> LOOD NORMAL TYC AND RETURN
TYC:TST1 EQU      %
         LB,R12   TYCS,R6           GET MATCHING TYC FOR BIT
         B        EXITOK1           EXIT TO IOSCU
*
TDVBIT   EQU      %
         DATA,2   0,;
                  X'200',;          END-OF-TAPE
                  X'1000',;         TAPE MARK
                  X'400'            BEGINNING-OF-TAPE
         BOUND    4
*
TYCS     EQU      %
         DATA,1   0,;
                  TYCEOT,;
                  TYCTM,;
                  TYCBOT
*
         BOUND    4
         PAGE
*
*        EXIT TO IOQ WITH NORMAL TYC
*
EXITOK   EQU      %
         CLM,R12  TYC:RAN           ALREADY HAVE A TYC LOADED
         BCR,9    EXITOK1           YUP-> GO
         LI,R12   TYCOK
EXITOK1  EQU      %                 OR COME HERE WITH YOUR OWN TYC
         B        IOSCU             AND RETURN
*--------------------------------------------*
*
*        EXIT TO IOQ WITH RETRY INDICATED
*
*--------------------------------------------*
EXITRTY  EQU      %
         LI,R13   MSG2              LOAD DEFAULT ERROR MSG
EXITRTY1 EQU      %
         LI,R12   FLGRETRY+FLGINTER+TYCERR
         LD,R4    DCT13,R1          TDV DOUBLE WORD
         CW,R5    Y02               EOT CROSSED
         BAZ      IOSCU             NO
         LI,R12   FLGRETRY+FLGINTER+TYCEREOT  ERR AT EOT
         B        IOSCU
         PAGE
*
*        WE'RE ERASING TAPE - SEE HOW MANY MORE TO DO
*
EXTERASE EQU      %
         LH,R6    DCT7,R1           GET CLIST DA
         LD,R10   6,R6              GET OUR WORK DBL-WORD
         MTH,-1   R11               DECREMENT # OF ERASURES LEFT
         BLEZ     EXITFOL           DONE--> DO NEXT RCVRY STEP
         STD,R10  6,R6              REPLACE FOR NEXT TIME THEN
*
*        CONTINUE TO ERASE TAPE
*
         LI,R5    FCEWR8            MORE TO DO - LOAD CODE
*
*        EXIT TO FOLLOW-ON BY STORING NEW CODES IN DCT17
*
EXTSTORE EQU      %
         STH,R5   DCT17,R1          STORE NEW CODE
EXITFOL  EQU      %                 FOLLOW-ON ENTRY POINT
         LI,R12   FLGFOLOW+FLGINTER+TYCERR
         B        EXITOK1           AND EXIT
         PAGE
*
*        USER ORIGINATED SPACE ORDERS COME HERE
*
SPAC:FIL EQU      %
         CI,R5    X'600'            IS EOT/BOT SET
         BANZ     TYC:TST           YUP-> TELL DER USER
         CI,R5    X'1000'           NOPE> DID WE SEE A TAPE MARK HERE
         BAZ      EXITRTY           NOPE> RETRY THE SPACE ORDER
         B        EXITOK            EXIT TO CALLER EVERYTHING OK HERE
*
SPAC:REC EQU      %
         CI,R5    X'1600'           SEE EOT OR BOT THIS TIME
         BANZ     SPC:TST           YES--> BETTER STOP THIS MESS THEN
         MTW,-1   IOQ12,R3          DECREMENT PRECORD COUNTER
         BGZ      EXITFOL           MORE TO DO YET
         B        SPC:TST           MERGE TO EXIT AT COUNT DONE
         PAGE
*
*        REPORT 'YYNDD ERROR' ON OPERATOR'S CONSOLE
*
EXITNOT  EQU      %
         CI,R4    FCRWOF            IS FUNCTION AN UNLOAD
         BE       EXITOK            YUP--> REPORT NORMAL TYC
EXITERR  EQU      %
         LI,R13   MSG2              'ERROR' MESSAGE
         B        EXITIS1
         PAGE
*
*        IF NSTAP GO TO NSLOG - ELSE FALL THRU AND SAY 'INCONSISTENT'
*
NSLOGG   EQU      %
         CI,R9    NSTAP             ZIS TRUE
         BE       NSLOG             YUP--> GO THERE
*
*        COME HERE TO SAY 'YYNDD INCONSISTENT STATUS' AND QUIT
*
EXITIS   EQU      %
         LI,R13   MSG9A             'INCONSISTENT STATUS' MSG
EXITIS1  EQU      %
         LI,R12   FLGRETRY+TYCERR   K L U D G E TO GET ERROR MSG OUT
         LH,R7    DCT1,R1
         HIO,R0   0,R7
         LI,R11   0
         STB,R11  IOQ11,R3          PREVENT FURTHER RETRIES
         B        IOSCU             FROM HAPPENING.
         PAGE
*
*        GENERAL ERROR TESTING
*
NEWERCK  EQU      %
         BAL,R9   IOSERCK           TEST FOR GENERAL TYPES OF ERRORS
         B        0,R7              FOUND ONE-AND LOGED  IT
         CI,R6    8                 WAS UNUSUAL END BIT SET
         BAZ      1,R7              NO-> NORMAL RETURN
         CI,R5    X'1600'           YES> WAS TM/BOT/EOT HIT
         BANZ     0,R7              YES- DONT LOG THOSE
         BAL,R9   IOSEREC           LOG UNUSUAL ERRORS
         B        0,R7              AND RETURN
         PAGE
*
*        ERROR CHECK FOR 'WRITE' AND 'WRITE TAPE MARK'
*
MTAP10   EQU      %
         CI,R5    X'60'             TDV9,10  TME,TDE
         BANZ     MTAP15            ERASE AND REWRITE
         CI,R5    X'2000'           WRITE PERMITTED
         BAZ      EXITIS            ***ERROR**
*
*        SEND 'WRITE PROTECTED' MSG TO OPERATOR
*
MTAP11   EQU      %
         LI,R12   FLGINTER+FLGKEYNC+TYCERR
         LI,R13   MSG5
         B        IOSCU
*
MTAP15   EQU      %
         LI,R12   EXITRTY           LOAD EXIT FOR MTAP16
*
*        INIT WRITE RECOVERY STUFF IN CLIST AREA
*
MTAP16   EQU      %
         MTB,0    IOQ11,R3          ANY REMAINING RETRIES.
         BEZ      *R12              NO-GO BACK TO IOQ
         SLS,R10  1                 TDV DA CDW POINTER TO WA FORMAT
         LB,R6    *R10              GET ORDER CODE
         CI,R6    X'73'             IS WRITE-TAPE-MARK ORDER
         BNE      MTAP16B           NO-COMPUTE NUMBER OF ERASURES
         CLM,R4   SPC:ORD           USER CALLED WRITE TAPE MARK
         BOL      EXITFOL           NO-IN WRTE RECOVERY IGNORE ERROR
         B        *R12              YES-DO RETRY SEQUENCE
MTAP16B  EQU      %
         BAL,R13  IOARS             GET ARS INTO R8
         LI,R6    0                 SET UP THE
         LI,R7    2800              # OF BYTES IN 3.5 TAPE INCHES
         XW,R7    R8                ARS TO R7 - 2800 TO R8
         LW,R4    R7                ARS OF WRITE
         DW,R6    R8                CALCULATE # OF ERASURES REQUIRED
         AI,R7    2                 ROUND UP ERASE COUNT+INTERRECORD GAP
         LW,R6    R4                RESTORE R6 AS IT WAS (BYTE CNT)
         LB,R4    IOQ10,R3          ORIGINAL # OF RETRIES
         LB,R8    IOQ11,R3          CURRENT # REMAINING
         SW,R4    R8                CALCULATE # WE HAVE DONE SO FAR
         AI,R4    1                 NUMBER OF TIMES HERE
         MW,R7    R4                NUMBER OF ERASURES TO DO
         SLS,R7   16                POSITION MAX ERASURES COUNTER
         LH,R5    DCT7,R1           GET CLIST DA
         STD,R6   FUNCSAVE,R5       SAVE BYTE COUNT/MAX ERASE COUNT
         LD,R6    DCT13,R1          TDV DOUBLE WORD
         CW,R7    Y02               END OF TAPE
         BAZ      *R12              NO-GO BACK TO IOQ
         LI,R7    1                 YES-SET RETRY COUNT AT ONE
         STB,R7   IOQ11,R3
         B        *R12              AND RETURN TO CALLER
*
*        WORDS 6 AND 7 IN THE CLIST AREA HAVE THE FOLLOWING
*        CONSTRUCTION;
*
*        0        8                                  31
*        <--------><--------------------------------->
*         FUNCTION     # OF BYTES IN ERROR RECORD
*           CODE          VIA BYTE COUNT - RBC
*        <--------><--------------------------------->
*         # OF ERASES            #OF BYTES SKIPPED
*            LEFT                 OVER BY READ-REV
*           TO DO NOW              WITH SKIP
*        <------------------><----------------------->
*        0                   16                      31
*
         PAGE
*
*        TAPE READ ERROR RECOVERY STEPS
*
*        1. READ REQUESTOR'S RECORD FROM TAPE UNIT.
*        2. PERFORM SENSE OPERATION.
*        3. SPACE RECORD BACKWARDS OVER RECORD JUST READ.
*        4. SEND 'SET CORRECTION' ORDER TO TAPE UNIT.
*        5. GO TO STEP # 1 TO RETRY THE READ OPERATION.
*
*
*        ERROR CHECK FOR 'READ' ORDERS
*
MTAP20   EQU      %
         CI,R5    X'1600'           TM OR BOT OR EOT SEEN...
         BANZ     MTAP22            YES, IGNORE TRANSMISSION ERRORS
         CI,R5    X'60'             TDV9,10 TME,TDE
         BAZ      EXITIS            INCONSISTENT STATUS IF NOT...
         CI,R5    X'800'            TDV4, NON-CORRECTABLE READ ERROR
         BANZ     MTAP20A
         LH,R12   DCT17,R1
         SLS,R12  8
         STH,R12  DCT17,R1
         LI,R12   X'A408'
         B        IOSCU
MTAP20A  EQU      %
*
*        NON-CORRECTABLE READ ERROR
*
         CI,R9    7TAP              IS IT 7-TRACK
         BNE      NOISE             NOT 7-TRACK
         B        7TAP20            DO 7T REV READ CHECKS
*
*        AT TAPE MARK OR BOT ON A READ ORDER
*
MTAP22   EQU      %
         CI,R9    7TAP              IS 7TRACK TAPE
         BE       EXTREVCK          YUP--> CHECK FOR READ REV ON 7T
         B        TYC:TST           NO---> REPORT TYC TO USER
         PAGE
*
*        TDV STATUS SAYS 'NON-CORRECTABLE READ ERROR'
*        CHECK TO SEE IF WE STUMBLED OVER A 'NOISE' RECORD ON THIS
*        READ OPERATION;
*
*        IF SO -  RETRY WITHOUT REPOSITIONING THE TAPE.
*        IF NOT-  RETRY WITH A REPOSITION.
*
*
NOISE    EQU      %
         BAL,R13  IOARS             GET ARS WE READ IN
         CI,R8    0                 DOES ARS INDICATE TAPE MOTION
         BLEZ     NOISE0            NO--> RETRY W/O POSITIONING
         CI,R11   0                 ANY RBC
         BEZ      EXITRTY           NO--> PROBABLY NOT NOISE RECORD
         CI,R8    12
         BGE      EXITRTY           NOT A NOISE RECORD
NOISE0   EQU      %
         LB,R5    IOQ5,R3           NOISE; RETRY W/O REPOSITIONING
NOISE1   EQU      %
         SLS,R5   8
         STH,R5   DCT17,R1
         B        EXITRTY
         PAGE
*
*        ERROR TESTS FOR ALL TYPES OF SPACING ORDERS
*
MTAP30   EQU      %
         CI,R5    X'1600'           TM/BOT OR EOT HIT
         BAZ      EXITIS
         B        SPC:TST           RELOAD R4/CONTINUE
         PAGE
*
*        ERROR CHECK FOR SET CORRECTION AND SET ERASE ORDERS
*
MTAP50   EQU      %
         CI,R5    X'60'             TDV9,10  TME,TDE
         BAZ      EXITIS            BAD STATUS
         LI,R12   FLGRETRY+FLGKEYNC
         LI,R13   MSG9              'REQ RETRY' MESSAGE
         B        IOSCU
*
*        ERROR CHECK FOR ALL TYPES OF REWIND ORDERS
*
MTAP54   EQU      %
         CI,R5    X'400'            TDV5,BOT
         BANZ     EXITOK            REWIND FINISHED AT LOAD PT
         B        EXITRTY           NOT AT LOAD POINT, TRY AGAIN
         PAGE
*
*        SAVE TDV STATUS FOR FAKE 7-TRK REVERSE READ OPS
*
SAVRBC   EQU      %
         LD,R8    DCT13,R1          GET TDV STATUS (WITH RBC)
         LH,R7    DCT7,R1           CLIST AREA ADR
         STD,R8   6,R7              SAVE STATUS IN CLIST AREA
         B        EXITFOL           GO DO A SPACE RECORD BACK
         PAGE
*
*        RESTORE TDV STATUS FOR 7-TRK REVERSE READ OPS
*
RSTRBC   EQU      %
         LH,R7    DCT7,R1           CLIST AREA ADR
         LD,R10   6,R7              GET TDV STATUS FROM READ
         STD,R10  DCT13,R1          RESTORE RBC FOR DATA CHAINED READ
         AND,R11  M16               RBC FOR REV READ, NO DATA CHAIN
         B        EXITOK
         PAGE
*
*        ERASE TAPE DECISION FOR 9T WRITE RECOVERY
*        FUNCTION WAS A 'SPACE RECORD BACKWARD'
*
MTAP70   EQU      %
         CI,R5    X'1400'           TDV3,5  TM,BOT
         BAZ      EXITIS            UNKNOWN CONDITION
         B        EXTERASE
         PAGE
*
*        REWRITE OF USER'S RECORD COMPLETED NORMALLY
*
MTAP80   EQU      %
         BAL,R13  IOARS             CALCULATE ARS WRITTEN OUT
         LH,R7    DCT7,R1           GET CLIST DA
         STD,R8   6,R7              REMEMBER ARS OF RE-WRITTEN RECORD
         B        EXITFOL           FOLLOW ON TO NEXT FUNCTION
         PAGE
*
*        READ FOREWARD W/SKIP OF REWRITTEN RECORD COMPLETED NORMALLY
*
MTAP90   EQU      %
         LI,R8    X'10000'          READ BYTE COUNT
         SW,R8    R11               MINUS RBC = ARS OF OPERATION
         LH,R7    DCT7,R1           GET CLIST DA
         LD,R10   6,R7              GET ARS OF RE-WRITE
         CW,R8    R10               MATCH WRITE .VS. READ ARS VALUES
         BE       TYC:TST           YES-CHECK FOR END OF TAPE
*
WRITERR  EQU      %
         LI,R13   WRCERR
         LI,R12   EXITRTY1          RETRY RETURN WITH MESSAGE
         B        MTAP16            COMPUTE NUMBER OF ERASURES
*
WRCERR   TEXTC    ' WRITE RECOVERY ERROR'
*
         PAGE
*
*        FUNCTION INDEPENDENT ERROR CHECK
*
NOTOPTST EQU      %
         CI,R8    X'6600'           TIO1,2,5,6  OPERATIONAL STATUS
         BANZ     EXITNOT           NOT OPERATIONAL
         CI,R5    X'1E'             TDV11-14  IOP ERROR
         BANZ     MT65              REPORT THE ERROR MSG/QUIT
         B        *15
         PAGE
*
*        WANG, POTTER 9-TRACK TAPE
*        ERROR BRANCH TABLE
*
VECTOR   COM,8    AF(1)-MAGTAPE
*
VECT3    EQU      %
         VECTOR   MTAP20             0 RDF
         VECTOR   MTAP10             1 WT
         VECTOR   MTAP20             2 RDB
         VECTOR   MTAP10             3 TM
         VECTOR   MTAP30             4 SRB
         VECTOR   MTAP30            5 SPACE RECORD FORWARD
         VECTOR   MTAP30            6 SPACE FILE BACKWARDS
         VECTOR   MTAP30             7 SFF
         VECTOR   EXITFOL            8 SRB-REW-ON
         VECTOR   EXITFOL            9 SRB-REW-OFF
         VECTOR   MTAP54            10 REWIND ONLINE
         VECTOR   MTAP54            11 REWIND OFF-LINE
         VECTOR   EXITERR           12 NS MODE CONTROL
         VECTOR   EXITFOL           13 SENSE,NRZI RDF CORR RCV
         VECTOR   MTAP30            14 SRB, NRZI RDF CORR RCV
         VECTOR   MTAP50            15 SC
         VECTOR   EXITFOL           16 SENSE,NRZI RDB CORR RCV
         VECTOR   MTAP30            17 SPACE RECORD FORWARD-RDB RCVRY
         VECTOR   MTAP50            18 SC
         VECTOR   MTAP30            19 SRB,RDF NON-CORR RECOV
         VECTOR   MTAP30            20 SRF - RDB NON-CORR RCVRY
         VECTOR   MTAP30            21 SRB, TM RECOVERY
         VECTOR   MTAP50            22 SE, NS PE WT TM RCV
         VECTOR   EXITFOL           23 SC,NS-NRZI WT RECOV
         VECTOR   MTAP30            24 SRB OVER BAD WRITE
         VECTOR   MTAP10            25 TM
         VECTOR   MTAP30            26 SRB OVER TM
         VECTOR   MTAP60            27 RDB WITH SKIP
         VECTOR   MTAP30            28 SFF
         VECTOR   MTAP30            29 SPACE RECORD FWD OVER GOOD RECORD
         VECTOR   MTAP50            30 SET ERASE FOR NS PE
         VECTOR   MTAP10            31 TM
         VECTOR   MTAP70            32 SRB OVER TM
         VECTOR   EXITOK            33
         VECTOR   EXITOK            34
         VECTOR   EXITOK            35
         VECTOR   EXITOK            36
         VECTOR   EXITOK            37
         VECTOR   WRITERR           38
         VECTOR   MTAP30            39
         VECTOR   MTAP30            40
         VECTOR   MTAP30            41 RFS ERROR
         VECTOR   WRITERR           42
*
         PAGE
************************************
*   MAG TAPE TABLES                *
************************************
*
*
*        ALL 9-TRACK TAPE
*        NO-ERROR BRANCH TABLE
         BOUND    4
*
VECT1    EQU      %
         VECTOR   EXITOK            0 READ FORWARD
         VECTOR   TYC:TST           1 WRITE OPERATION
         VECTOR   EXITOK            2 READ BACKWARD
         VECTOR   EXITOK            3 WRITE TAPE MARK
         VECTOR   SPAC:REC          4 SPC RECORD BACK
         VECTOR   SPAC:REC          5 SPC RECORD FRWD
         VECTOR   SPAC:FIL          6 SPACE FILE BACK
         VECTOR   SPAC:FIL          7 SPACE FILE FRWD
         VECTOR   EXITFOL            8 SRB, REWIND ON-LINE
         VECTOR   EXITFOL            9 SRB, REWIND OFF-LINE
         VECTOR   EXITOK            10 REWIND ON-LINE
         VECTOR   EXITOK            11 REWIND OFF-LINE
         VECTOR   EXITOK            12 MODE CONTROL
         VECTOR   EXITFOL           13 SENSE, NRZI CORRECTABLE RD
         VECTOR   EXITFOL           14 SRB, NRZI CORRECTABLE RD
         VECTOR   EXITFOL           15 SET CORRECTION,NRZI CORR RD
         VECTOR   EXITFOL           16 SENSE, NRZI CORR RD BACK
         VECTOR   EXITFOL           17 SRF, NRZI CORR RD BACK
         VECTOR   EXITFOL           18 SET CORR, NRZI CORR RD BACK
         VECTOR   EXITFOL           19 SRB, RDF NON-CORR RECOV
         VECTOR   EXITFOL           20 SRF, RDB NON-CORR RECOV
         VECTOR   EXITFOL           21 SRB, WRITE TM RECOVERY
         VECTOR   EXITFOL           22 SE, NS PE WT TM RCV
         VECTOR   EXITFOL           23 SET CORR, NS-NRZI WT RECOV
         VECTOR   EXITFOL           24 SRB OVER BAD WRITE
         VECTOR   EXITFOL           25 WT TM TO ESTABLISH POSITION
         VECTOR   EXITFOL           26 SRB OVER TM
         VECTOR   EXITFOL           27 RDB W/SKIP, PHONEY GAP TEST
         VECTOR   EXITFOL           28 SFF, LAST GOOD WT WAS A TM
         VECTOR   EXITFOL           29 SRF OVER LAST GOOD RECORD
         VECTOR   EXITFOL           30 SET ERASE FOR NS PE
         VECTOR   EXITFOL           31 ERASE TAPE WITH WRITE TM
         VECTOR   EXTERASE          32 SRB OVER TM, ERASE DONE TEST
         VECTOR   NSLOGG            33 SENSE FOR ERROR LOG
         VECTOR   NSLOGG            34 SENSE FOR ERROR LOG
         VECTOR   NSLOGG            35 SENSE FOR ERROR LOG
         VECTOR   NSLOGG            36 SENSE FOR ERROR LOG
         VECTOR   NSLOGG            37 SENSE FOR ERROR LOG
         VECTOR   MTAP80            38 REWRITE USER'S RECORD
         VECTOR   EXITFOL           39 SRB OVER RE-WRITE
         VECTOR   EXITFOL           40 SRB OVER PREVIOUS RECORD
         VECTOR   EXITFOL           41 READ FOREWARD WITH SKIP
         VECTOR   MTAP90            42 CHECK READ OF REWRITE
*
         PAGE
         BOUND    8
*
*        TABS     10,16,43,46
*
MTAP     EQU      %
         OR,R4    Y2                HOLD CHANNEL FOR POSSIBLE SENSE OP
         BAL,R10  COMLIST           POST DOT TABLE ADDRESS INTO R10
*
*        ALL 9-TRACK TAPE
*        DEVICE OPERATION TABLE
*
DOT      SET      %
9TDOT    EQU      %
FCRDF    :DOT     CLRDF,5,FCFNON1,FCSENS0    0  READ FOREWARD
FCWT     :DOT  CLWT,1,FCEWR1,FCWT         1  WRITE
FCRDB    :DOT     CLRDB,5,FCBNON1,FCSENS1    2  READ BACKWARD
FCTM     :DOT  CLTM,1,FCTMRCV1            3  WRITE TAPE MARK
FCSRB    :DOT  CLSRB,5,FCSRB,FCSRB        4  SPACE RECORD BACKWARD
FCSRF    :DOT  CLSRF,5,FCSRF,FCSRF        5  SPACE RECORD FOREWARD
FCSFB    :DOT     CLSFB,120,FCSFB,FCSFB      6  SPACE FILE BACKWARD
FCSFF    :DOT     CLSFF,120,FCSFF,FCSFF      7  SPACE FILE FORWARD
FCRWONS  :DOT  CLSRB,5,FCRWONS,FCRWON     8  SRB BEFORE REWIND ON-LINE
FCRWOFS  :DOT  CLSRB,5,FCRWOFS,FCRWOF     9  SRB BEFORE REWIND OFF-LINE
FCRWON   :DOT  CLRWON,60,FCRWON           10 REWIND ON-LINE
FCRWOF   :DOT  CLRWOF,60,FCRWOF           11 REWIND OFF-LINE
FCMC     :DOT  CLMC,1,FCMC                12 MODE CONTROL
*
*        READ FOREWARD RECOVERY STEPS
*
FCSENS0  :DOT  CLSENSE,1,FCFNON1,FCFCOR1  13 SENSE,NRZI RDF CORR RECOV
FCFCOR1  :DOT  CLSRB,5,FCFCOR1,FCFCOR2    14 SRB FOR NRZI CORR RDF RECOV
FCFCOR2  :DOT  CLSC,1,FCFCOR2,FCRDF       15 SET CORR, NRZI CORR RDF RCV
*
*        READ BACKWARDS RECOVERY STEPS
*
FCSENS1  :DOT  CLSENSE,1,FCBNON1,FCBCOR1  16 SENSE,NRZI RDB CORR RECOV
FCBCOR1  :DOT  CLSRF,5,FCBCOR1,FCBCOR2    17 SRF FOR NRZI CORR RDB RECOV
FCBCOR2  :DOT  CLSC,1,FCBCOR2,FCRDB       18 SET CORR, NRZI CORR RDB RCV
*
*        NON-CORRECTABLE READ RECOVERY STEP.
*
FCFNON1  :DOT  CLSRB,5,FCFNON1,FCRDF      19 SRB FOR RDF NON-CORR RECOV
*
*        NON-CORRECTABLE BACKWARDS READ RECOVERY STEP
*
FCBNON1  :DOT  CLSRF,5,FCBNON1,FCRDB      20 SRF FOR RDB NON-CORR RECOV
*
*        WRITE TAPE MARK RECOVERY STEPS
*
FCTMRCV1 :DOT  CLSRB,5,FCTMRCV1,FCTMRCV2  21 SRB FOR WT TM RECOVERY
FCTMRCV2 :DOT  CLSE,1,FCTMRCV2,FCTM       22 SET ERASE, NS PE WT TM RCV
*
*        WRITE RECOVERY STEPS
*
FCEWR1   :DOT  CLSC,1,FCEWR1,FCEWR2       23 SET CORR, NS-NRZI WT RECOV
FCEWR2   :DOT     CLSRB,5,FCEWR2,FCEWR5      24 SRB OVER BAD WRITE
FCEWR3   :DOT  CLTM,1,FCEWR3,FCEWR4       25 WT TM TO ESTABLISH POSITION
FCEWR4   :DOT  CLSRB,5,FCEWR4,FCEWR5      26 SRB OVER TM
FCEWR5   :DOT     CLRDBS,5,FCEWR5,FCEWR7     27 RDBS OVER LAST GOOD RECORD
FCEWR6   :DOT  CLSFF,10,FCEWR6,FCEWR8     28 SFF, LAST GOOD REC IS A TM
FCEWR7   :DOT  CLSRF,5,FCEWR7,FCEWR8      29 SRF OVER LAST GOOD RECORD
FCEWR8   :DOT  CLSE,1,FCEWR8,FCEWR9       30 SET ERASE FOR NS PE
FCEWR9   :DOT  CLTM,1,FCEWR9,FCEWR10      31 ERASE TAPE WITH WRITE TM
FCEWR10  :DOT  CLSRB,5,FCEWR10,WRC0       32 SRB OVER TM
*
FCSNSL1  :DOT  CLSENSE,1,FCSNSL1          33 SENSE,LOG,RETRY W/DOT RETRY
FCSNSL2  :DOT  CLSENSE,1,FCSNSL2          34 SENSE,LOG,RETRY W/DOT FOLOW
FCSNSL3  :DOT  CLSENSE,1,FCSNSL3          35 HIO,SENSE,LOG,I.S. ABORT
FCSNSL4  :DOT  CLSENSE,1,FCSNSL4          36 SENSE,LOG,RETRY SAME FUNC
FCSNSL5  :DOT  CLSENSE,1,FCSNSL5          37 HIO,SENSE,LOG,ERROR ABORT
*
WRC0     :DOT     CLWT,1,FCEWR1,WRC1      38 REWRITE USER'S RECORD
WRC1     :DOT     CLSRB,1,WRC1,WRC2       39 SRB OVER REWRITE
WRC2     :DOT     CLSRB,5,WRC2,WRC3          40 SRB OVER LAST GOOD RECORD
WRC3     :DOT     CLRDFS,1,WRC3,WRC4      41 READ W/SKIP OF STEP 40
WRC4     :DOT     CLRDFS,5,FCEWR1,FCEWR1   42 RDFS OF THE REWRITE
*
         PAGE
*
*        9T TAPE
*        COMMAND LIST TABLE
*
*
         BOUND    4
*
CLRDF    :CLIST   RDF               READ FOREWARD
CLWT     :CLIST   WT                WRITE
CLRDB    :CLIST   RDB               READ BACKWARD
CLTM     :CLIST   TM                WRITE TAPE MARK
CLSRB    :CLIST   SRB               SPACE RECORD BACKWARD
CLSRF    :CLIST   SRF               SPACE RECORD FOREWARD
CLSFB    :CLIST   SFB               SPACE FILE BACKWARD
CLSFF    :CLIST   SFF               SPACE FILE FOREWARD
CLRWON   :CLIST   RWON              REWIND ON-LINE
CLRWOF   :CLIST   RWOF              REWIND OFF-LINE
CLMC     :CLIST   MC                MODE CONTROL
CLSENSE  :CLIST   SENSE             SENSE
CLSC     :CLIST   SC                SET CORRECTION
CLRDBS   :CLIST   RDBS              READ BACKWARD WITH SKIP
CLSE     :CLIST   SE                SET ERASE
CLRDFS   :CLIST   RDFS              READ FOREWARD WITH SKIP
         PAGE
*
*        ALL TAPE
*        COMMAND DOUBLE WORDS
*
         BOUND    8
*
FNC      EQU      X'16'             FLAGS, NO COMMAND CHAIN
*
RDF      :CDW     2,0,FNC,2         READ FOREWARD OR READ PACKED
WT       :CDW     1,0,FNC,2         WRITE OR WRITE PACKED
RDB      :CDW     12,MT14,FNC,4     READ BACKWARD
TM       :CDW     115,0,FNC,0,1            WRITE TAPE MARK
SRB      :CDW     75,0,FNC,0,1             SPACE RECORD BACKWARDS
SRF      :CDW     67,0,FNC,0,1             SPACE RECORD FOREWARDS
SFB      :CDW     91,0,FNC,0,1             SPACE FILE BACKWARDS
SFF      :CDW     83,0,FNC,0,1             SPACE FILE FOREWARDS
RWON     :CDW     19,MT16,4,4,1           REWIND ON-LINE
RWOF     :CDW     35,MT16,FNC,4,1         REWIND OFF LINE
MC       :CDW     11,0,FNC,1,1            CHANGE MODE FOR NS DRIVES
SENSE    :CDW     4,MT18,FNC,4,15   SENSE
SC       :CDW     3,MT18,FNC,4,1    SET CORRECTION
RDBS     :CDW     12,0,FNC+1,0,0    READ BACKWARD WITH SKIP
RDFS     :CDW     2,0,FNC+1,0,0     READ FOREWARD WITH SKIP
SE       :CDW     99,0,FNC,0,1      SET ERASE
         PAGE
*
*        7-TRACK TAPE
*        NO-ERROR BRANCH TABLE
*
         BOUND    4
*
VECT4    EQU      %
         VECTOR   EXITOK             0 RDPF
         VECTOR   EXITOK             1 WTP
         VECTOR   EXITFOL            2 RDPB
         VECTOR   EXITOK             3 TM7
         VECTOR   SPAC:REC           4 SRB7
         VECTOR   SPAC:REC           5 SRF7
         VECTOR   SPAC:FIL           6 SFB7
         VECTOR   SPAC:FIL           7 SFF7
         VECTOR   EXITOK             8 REW-ON
         VECTOR   EXITOK             9 REW-OFF
         VECTOR   EXITOK            10 RDBF
         VECTOR   EXITOK            11 WTB
         VECTOR   EXITFOL           12 RDBB
         VECTOR   EXITOK            13 RDDF
         VECTOR   EXITOK            14 WTD
         VECTOR   EXITFOL           15 RDDB
         VECTOR   EXITFOL           16 RDPF RECOVERY
         VECTOR   EXITFOL           17 WTP RECOVERY
         VECTOR   EXITFOL           18 WTP RECOVERY
         VECTOR   EXITFOL           19 TM7 RECOVERY
         VECTOR   EXITFOL           20 TM7 RECOVERY
         VECTOR   EXITFOL           21 RDBF RECOVERY
         VECTOR   EXITFOL           22 WTB RECOVERY
         VECTOR   EXITFOL           23 WTB RECOVERY
         VECTOR   EXITFOL           24 RDDF RECOVERY
         VECTOR   EXITFOL           25 WTD RECOVERY
         VECTOR   EXITFOL           26 WTD RECOVERY
         VECTOR   SAVRBC            27 RDPB FOLLOW-ON
         VECTOR   RSTRBC            28 RDPB FOLLOW-ON
         VECTOR   SAVRBC            29 RDBB FOLLOW-ON
         VECTOR   RSTRBC            30 RDBB FOLLOW-ON
         VECTOR   SAVRBC            31 RDDB FOLLOW-ON
         VECTOR   RSTRBC            32 RDDB FOLLOW-ON
         VECTOR   EXITERR           33 SRB, FAILED REV READS
*
         PAGE
*
*        7-TRACK TAPE
*        ERROR BRANCH TABLE
*
         BOUND    4
*
VECT5    EQU      %
         VECTOR   MTAP20             0 RDPF
         VECTOR   MTAP10             1 WTP
         VECTOR   MTAP30             2 RDPB
         VECTOR   MTAP10             3 TM7
         VECTOR   MTAP30             4 SRB7
         VECTOR   MTAP30            5 SPACE RECORD FORWARD (7T)
         VECTOR   MTAP30            6 SPACE FILE BACKWARDS
         VECTOR   MTAP30             7 SFF7
         VECTOR   MTAP54            10 REWIND ONLINE
         VECTOR   MTAP54            11 REWIND OFF-LINE
         VECTOR   MTAP20            10 RDBF
         VECTOR   MTAP10            11 WTB
         VECTOR   MTAP30            12 RDBB
         VECTOR   MTAP20            13 RDDF
         VECTOR   MTAP10            14 WTD
         VECTOR   MTAP30            15 RDDB
         VECTOR   MTAP30            16 RDPF RECOVERY
         VECTOR   MTAP30            17 WTP RECOVERY
         VECTOR   MTAP50            18 WTP RECOVERY
         VECTOR   MTAP30            19 TM7 RECOVERY
         VECTOR   MTAP50            20 TM7 RECOVERY
         VECTOR   MTAP30            21 RDBF RECOVERY
         VECTOR   MTAP30            22 WTB RECOVERY
         VECTOR   MTAP50            23 WTB RECOVERY
         VECTOR   MTAP30            24 RDDF RECOVERY
         VECTOR   MTAP30            25 WTD RECOVERY
         VECTOR   MTAP50            26 WTD RECOVERY
         VECTOR   MTAP20            27 RDPB FOLLOW-ON
         VECTOR   MTAP30            28 RDPB FOLLOW-ON
         VECTOR   MTAP20            29 RDBB FOLLOW-ON
         VECTOR   MTAP30            30 RDBB FOLLOW-ON
         VECTOR   MTAP20            31 RDDB FOLLOW-ON
         VECTOR   MTAP30            32 RDDB FOLLOW-ON
         VECTOR   MTAP30            33 FINAL SRB, FAILED REV RDS
*
         PAGE
************************************
*   MAG TAPE COMMAND EXITS         *
************************************
*
         BOUND    4
*
MT14     EQU      %
         LW,R11   IOQ8,R3           BUFF ADR
         BGEZ     MT14A             WE ARE  ***NOT*** DATA CHAINING
*
*        IF DATA  CHAINING RETURN TO COMLIST TO BUILD EM
*
         AI,R9    X'200'            DATA TRANSFER FUNCTION INDEX
         B        REPCOM            GO BACK TO BEGINNING OF COMLIST
MT14A    EQU      %
         AND,R11  M24               MASK ADR
         OR,R8    R11               PUT IT IN COMMAND
         LH,R11   IOQ9,R3           GET BYTE COUNT
         AND,R11  M16               MASK BYTE COUNT
         OR,R9    R11               PUT IT IN COMMAND
         AI,R11   -1
         AW,R8    R11               SET ADR TO END OF BUF FOR REV RD
         B        USECOM
         PAGE
*
*        SET NON-DATA TRANSFER BIT FOR IOQ TO RELEASE THE
*        USER FROM I/O WAIT STATE
*
MT16     EQU      %
         OR,R4    YC                SET CHAN NOT BUSY
         B        USECOM
*
*        SENSE AND SET CORRECTION
*
MT18     EQU      %
         LB,R5    DCT4,R1           GET DEV TYPE
         LC       TB:FLGS1,R5       TEST FOR POTTER TAPE DRIVE
         BCR,2    MT18A             BRANCH; NOT POTTER DRIVE.
         LI,R5    SECODE            YES, USE SET ERASE AS DUMMY ORDER
         STB,R5   R8
MT18A    EQU      %
         LI,R5    SENSEBUF**-1      PUT BYTE ADR OF
         AH,R5    DCT7,R1            SENSE DATA
         LB,R11   R8                GET ORDER
         CI,R11   SCCODE            IS IT SET CORRECTION
         BE       MT18B             YES, DON'T CLEAR BUFFER
         LD,R12   DOUBLEZERO        GET SOME ZEROES
         BAL,R0   RE:ENT            SEE IF HANDLER WAS RE-ENTERED
         STD,R12  0,R5              NO; CLEAR BUFFERS
         STD,R12  2,R5              CLEAR ALL OF THEM....
MT18B    EQU      %
         SLS,R5   3                   BUFFER
         OR,R8    R5                   IN COMMAND
         B        USECOM
         END

