$CONTROL MAP,CODE,USLINIT                                               00010000
  <<     HIOTAPE0, MODULE 35 - TAPE DRIVER   SERIES 30/33/44/64 >>      00015000
<< HP32002C MPE SOURCE C.00.00 >>                                       00020000
<< COPYRIGHT     "(C) COPYRIGHT HEWLETT-PACKARD CO. 1980.           >>  00025000
<<     THIS PROGRAM MAY BE USED WITH ONE COMPUTER SYSTEM AT A       >>  00030000
<<     TIME AND SHALL NOT OTHERWISE BE RECORDED, TRANSMITTED OR     >>  00035000
<<     STORED IN A RETRIEVAL SYSTEM.  COPYING OR OTHER REPRODUCTION >>  00040000
<<     OF THIS PROGRAM EXCEPT FOR ARCHIVAL PURPOSES IS PROHIBITED   >>  00045000
<<     WITHOUT THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY.>>  00050000
<< **** Note - Dollar Copyright cannot be used with this module *** >>  00055000
$TITLE "HP 7970E MAG TAPE DRIVER - (HP-IB)"                             00060000
$CONTROL PRIVILEGED,UNCALLABLE                                          00065000
$TP                                                                     00070000
                                                                        00075000
<<                                                                      00080000
                                                                        00085000
         3000 Series 30/33/44/64  Magnetic Tape Driver - HIOTAPE0       00090000
            ---------------------------------------------               00095000
                                                                        00100000
                                                                        00105000
Structure of HIOTAPE0:                                                  00110000
                                                                        00115000
HIOTAPE0, together with the SIO Device Monitor (SIODM) constitute a     00120000
standard MPE Type 1 I/O Driver/Monitor.  This means that it does not    00125000
run in its own process, but executes on any stack and therefore must    00130000
run to completion.  During initialization it executes on PROGEN's       00135000
stack, during request initiation it executes on ATTACHIO's stack, and   00140000
during interrupt processing it executes on the Interrupt Control        00145000
Stack (ICS).                                                            00150000
                                                                        00155000
HIOTAPE0 consists of a global area, two procedures, and an "outer       00160000
block" which is really a linkage area for INITIAL.  The global area     00165000
contains an array called INITIAL which is comprised of three parts.     00170000
The first part specifies the size of the other two, the unit extract    00175000
instruction, and various parameters which are used by INITIAL.  This    00180000
section is deleted after INITIAL is through with it.  The other two     00185000
parts are the Device Information Table (DIT) and the Channel Program    00190000
area, which is part of the Interrupt Linkage Table (ILT).  INITIAL      00195000
will put each of these items in the area of memory where it belongs.    00200000
The linkage area specifies the procedure labels (P-labels) of the       00205000
associated monitor (SIODM), the request initiator (MTDRVR), the         00210000
request completor (MTDRVR), the initialization procedure (MTINIT,       00215000
called by PROGEN at system startup), and the interrupt handler (GIP).   00220000
                                                                        00225000
                                                                        00230000
Operation of HIOTAPE0:                                                  00235000
                                                                        00240000
The primary working code of HIOTAPE0 is a procedure MTDRVR.  MTDRVR is  00245000
called with five parameters.  Two of these parameters, BANK and         00250000
BUFFADDR, are the absolute buffer address of the data to be processed.  00255000
The other three, DITP, IOQP, and SIOP are pointers to three arrays.     00260000
DITP is a pointer to the Device Information Table which contains        00265000
information about its associated mag tape unit.  There is one DIT for   00270000
unit on the controller and they contain information which must be       00275000
saved between I/O requests to the driver.  IOQP is a pointer to the     00280000
Input/Output Queue element.  IOQ elements contain information relevent  00285000
to the current request.  SIOP is a pointer to the first element of the  00290000
Channel Program which is actually part of the Interrupt Linkage Table.  00295000
These three elements are described in more detail elsewhere in this     00300000
listing.                                                                00305000
                                                                        00310000
MTDRVR is always called by the SIO device monitor (SIODM) and it        00315000
determines the reason for the call by examining the IOQ and the DIT.    00320000
When a new request is initiated, MTDRVR examines the function code      00325000
and parameter fields contained in the IOQ element to determine the      00330000
task that is desired.  The proper command codes and program branches    00335000
are then placed in the Channel Program and its execution is begun.      00340000
                                                                        00345000
Upon completion of the request, an interrupt is generated and MTDRVR    00350000
is again called.  The code checks for current activity in progress,     00355000
and this being the case, branches to the completion section of the      00360000
driver.  Here several status words are examined for errors or special   00365000
conditions which might have occurred during the execution of the        00370000
Channel Program, during the data transfer, or during the operation of   00375000
the mag tape unit.  These conditions can cause error retries and/or     00380000
special notation back to the caller.  A list of the conditions and      00385000
the return codes is provided in this listing.                           00390000
                                                                        00395000
                                                                        00400000
                                                                        00405000
>>                                                             <<02681>>00410000
$PAGE "DEVELOPMENT AND FIX HISTORY"                            <<02681>>00415000
comment                                                        <<02681>>00420000
                                                                        00425000
                                                                        00430000
        Development and Fix History                                     00435000
        ---------------------------                                     00440000
                                                                        00445000
Development Engineer:  Rich Pearson                                     00450000
                                                                        00455000
Change History: 7/01/81 Changed channel program to perform record       00460000
                        mode transfers instead of burst mode.  This     00465000
                        was done to prevent tape-runaway problems due   00470000
                        to CPP going away for periods of time longer    00475000
                        than the tape could stand.  Housekeeping on     00480000
                        the AB'ACK bit, and additional comments were    00485000
                        added (AJK).                                    00490000
                7/07/81 Error detection and retry processing we<<02681>>00495000
                        added to detect and retry up to 15 time<<02681>>00500000
                        when writing an EOF to tape (AJK).     <<02681>>00505000
                7/10/81 Writing an EOF past EOT will now work a<<02681>>00510000
                        does the 7976 driver for FSTORE compat-<<02681>>00515000
                        ibility.  When multiple ATTACHIO's are <<02681>>00520000
                        pending and EOT is encountered, no EOF'<<02681>>00525000
                        will be written unless the appropriate <<02681>>00530000
                        is set in P2 of the IOQ.  Also, if the <<02681>>00535000
                        tape is not-ready and a device close is<<02681>>00540000
                        issued, the DCLOSE will now complete wi<<02681>>00545000
                        out a not-ready console message (AJK). <<02681>>00550000
                7/28/81 Error recovery ERRORMASK contained an  <<02710>>00555000
                        extra trailing "0" which made the mask <<02710>>00560000
                        word bits off by 3 locations.  Also,   <<02710>>00565000
                        the machine code generated by SPL was  <<02710>>00570000
                        incorrect for the ERRORMASK expression <<02710>>00575000
                        evaluation.  Parenthesis were added to <<02710>>00580000
                        force SPL to gen code as expected.     <<02710>>00585000
                9/30/82 The 7970 controller returns three      <<04937>>00590000
                        bytes of statusr.This fix will log     <<04937>>00595000
                        all three bytes of status. The fix     <<04937>>00600000
                        requires an additional word be added   <<04937>>00605000
                        to the device informational table,     <<04937>>00610000
                        and changes to the completor secton.   <<04937>>00615000
                        (JRK)                                  <<04937>>00620000
               12/01/82 The driver was changed to fix the      <<06151>>00625000
                        problem of one tape unit stopping      <<06151>>00630000
                        the another tape unit on the same      <<06151>>00635000
                        controller when an abort channel       <<06151>>00640000
                        program is started.                    <<06151>>00645000
                        (JRK)                                  <<06151>>00650000
 3/17/83 Dean Coggins.                                                  00655000
                                                                        00660000
   1.  Corrected the handling of a failure to start the                 00665000
       Idle Channel program when the IOQ pointer passed                 00670000
       was zero.                                                        00675000
                                                                        00680000
3/09/83 DAVID SM CHANG  INITIAL MPEV INCL5 PROGRAM.            <<07419>>00685000
$PAGE                                                                   00690000
                Device Information Table (DIT)                          00695000
                ------------------------------                          00700000
                                                                        00705000
                                                                        00710000
There is one DIT per physical device.  If a physical device represents  00715000
more than one logical device, the logical device number is obtained     00720000
from the IOQ element.  The following diagram shows the DIT used for     00725000
the mag tape driver.                                                    00730000
                                                                        00735000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          00740000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    00745000
  0| 0| 0|AC|RQ| 0|MU| 0|IO|IA| 0| 0| 0|   STATE   |   DFLAG            00750000
   +--+--+--+--+--+--+--+--+--+--+--+--+-----------+                    00755000
  1| SYSDB relative pointer to the DIT for the next|   DLINK            00760000
   | device requesting this resource or service    |                    00765000
   +-----------------------------------------------+                    00770000
  2| SYSDB relative pointer to the first IOQ in    |   DIOQP            00775000
   | request list for this device                  |                    00780000
   +--------+--------------+-----------------------+                    00785000
  3| Logical device number                         |   DLDEV   <<07419>>00790000
   +--------+--------------+-----------------------+                    00795000
  4| SYSDB relative pointer to Device Linkage Table|   DDLTP            00800000
   +-----------------------------------------------+                    00805000
  5| SYSDB relative pntr to Interrupt Linkage Table|   DILTP            00810000
   +-----------------------------------------------+                    00815000
  6|RW|RU|SH|CE|BO|                             |AA|   DSAVE            00820000
   +-----------------------------------------------+                    00825000
  7| Hardware error pointer. Set when the driver   |   DSERR            00830000
   | detects an error.  Whenever <>0, the driver   |                    00835000
   | monitor logs an I/O error and clears this word|                    00840000
   +--+--+--+--+--+--------------------------------+                    00845000
%10| Bit 0 is set at completion of timer           |   DTIME            00850000
   +--+--+--+--+--+--------------------------------+                    00855000
%11| Interrupt status for this unit.  Set by the   |   DSTAT            00860000
   | driver each time it processes an interrupt.   |                    00865000
   +-----------------------------------------------+                    00870000
%12|IOT  |    Physical  device unit                |   DUNIT   <<07419>>00875000
   |                                               |           <<07419>>00880000
   +-----------------------------------------------+                    00885000
%13|          Hardware logged error status         | DLOGERROR          00890000
   +-----------------------------------------------+                    00895000
%14|          Hardware logged error status+1       | DLOGERROR+1        00900000
   +-----------------------------------------------+                    00905000
%15| Holds the time out request entry index while  |   DRQST   <<07419>>00910000
   | a time is active.                             |           <<07419>>00915000
   +-----------------------------------------------+           <<07419>>00920000
                                                                        00925000
                                                                        00930000
DFLAG - Flags and request state                                         00935000
  AC  ACTIVE  - A monitor is currently servicing this device.           00940000
  RQ  REQUEST - A service request is pending while the monitor is       00945000
                active.                                                 00950000
  MU  MUNIT   - This device is on a multi-unit controller.              00955000
  IO  IOPROG  - An I/O Channel Program is running for this device.      00960000
  IA  IAK     - An interrupt or response has occurred for this device.  00965000
  NO  NOTRDY  - Go to state %10 after Idle Channel Program is started.  00970000
  ST  STWAIT  - The device monitor is starting an Idle Channel Program  00975000
                for this device.  There is no IOQ associated with this  00980000
                type of request.                                        00985000
  STATE       - State of the device monitor.  Specifies the next action 00990000
                to be taken in SIODM in servicing the request:          00995000
                  0 - start new request                                 01000000
                  1 - not used                                          01005000
                  2 - call driver initiator procedure                   01010000
                  3 - call driver completor procedure                   01015000
                  4 - not used                                          01020000
                  5 - process request completed                         01025000
                  6 - initiate device recognition sequence              01030000
                  7 - start operator intervention wait                  01035000
                %10 - wait for interrupt (operator intervention)        01040000
                      restart at state 0                                01045000
                %11 - wait for data segment freeze, then state 2        01050000
                %12 - wait for driver initiator to be frozen, then      01055000
                      allocate controller (state 2)                     01060000
                %13 - wait for I/O completion interrupt, then state 3   01065000
                %14 - wait for controller, then call driver initiator   01070000
                %15 - not used                                          01075000
                %16 - wait for initiator make present, then state 2     01080000
                %17 - wait for completor make present, then state 3     01085000
                                                                        01090000
DLDEV - I/O system type, unit and logical device number                 01095000
  IOT I/O TYPE- Type of I/O system                                      01100000
                0 - HP3000 Series II/III                                01105000
                1 - HP3000 Series 33 (HP-IB)                            01110000
                2 - unused                                              01115000
                3 - unsused                                             01120000
                                                                        01125000
DSAVE - Device processing flags                                         01130000
  RW  RWBIT  - Indicates tape has been rewound.                         01135000
  RU  RWUNLD - Indicates that a rewind/unload was performed to allow a  01140000
               write-ring mount.                                        01145000
  SH  SHORT  - A short read is in progress.  After completion of read,  01150000
               EOF is checked for and if not present, the requested     01155000
               bytes are transfered from the short-read buffer to the   01160000
               user's buffer.                                           01165000
  CE  CESTAT - Channel parity error processing is in progress.          01170000
  BO  BODEOF - Backspace record due to a data EOF processing is in      01175000
               progress.                                                01180000
  AA  AB'ACK - Abort Channel Program is executing.                      01185000
$PAGE                                                                   01190000
DSTAT - Mag tape controller status                                      01195000
                                                                        01200000
  BITS         USE                                                      01205000
                                                                        01210000
    0     END OF FILE                                                   01215000
                                                                        01220000
    1     BEGINNING OF TAPE                                             01225000
    2     END OF TAPE                                                   01230000
    3     SINGLE TRACK ERROR (NOT LOGGED FOR READS)                     01235000
                                                                        01240000
    4     COMMAND REJECT                                                01245000
    5     FILE PROTECT                                                  01250000
    6     MULTIPLE TRACK ERROR                                          01255000
                                                                        01260000
    7     UNIT ONLINE                                                   01265000
    8     (NOT USED)                                                    01270000
    9     UNIT NUMBER (MSB)                                             01275000
                                                                        01280000
   10     UNIT NUMBER (LSB)                                             01285000
   11     TIMING ERROR                                                  01290000
   12     TAPE RUNAWAY                                                  01295000
                                                                        01300000
   13     REWINDING       *                                             01305000
   14     UNIT BUSY       **  (REPORTED AS UNIT NOT READY)              01310000
   15     INTERFACE BUSY  *                                             01315000
                                                                        01320000
FOR STATUS READ (3RD BYTE STATUS) DENOTES:                              01325000
                                                                        01330000
BITS       USE                                                          01335000
----       ---                                                          01340000
                                                                        01345000
  0        0 (NOT USED)                                                 01350000
  1        0 (NOT USED)                                                 01355000
  2        POWER ON                                                     01360000
  3        COMMAND PARITY ERROR                                         01365000
  4        *UNIT 3 PLACED ON LINE                                       01370000
  5        *UNIT 2 PLACED ON LINE                                       01375000
  6        *UNIT 1 PLACED ON LINE                                       01380000
  7        *UNIT 0 PLACED ON LINE                                       01385000
                                                                        01390000
*NOTE:  BITS 4,5,6,7 NOT USED BY DRIVER.                                01395000
$PAGE                                                                   01400000
                Interrupt Linkage Table (ILT)                           01405000
                -----------------------------                           01410000
                                                                        01415000
                                                                        01420000
There is one ILT for each device controller configured on the system.   01425000
A controller may support more than one unit as is the case with the     01430000
mag tape which supports four units per controller.                      01435000
                                                                        01440000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01445000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01450000
  0|         Channel                               |   ICPVA0           01455000
  1|              Program                          |   ICPVA1           01460000
  2|                  Variable                     |   ICPVA2           01465000
  3|                       Area (ICPVA)            |   ICPVA3           01470000
   +-----------------------------------------------+                    01475000
  4|         DMA Abort                             |   ICPVA4           01480000
  5|              Address                          |   ICPVA5           01485000
   +-----------------------------------------------+                    01490000
  6|                      0                        |   ISRQL            01495000
   +--+-----------------+-----+-----------+--------+                    01500000
  7|LI|     CHANQUE     |     |   CHAN    |  DEV   |   ICNTRL           01505000
   +--+-----------------+-----+-----------+--------+                    01510000
%10| SYSDB relative pointer to Channel Program area|   ISIOP            01515000
   +-----------------------------------------------+                    01520000
%11| SYSDB relative pointer to Status Return area. |   ISTAP            01525000
   +-----------------------------------------------+                    01530000
%12| single instruction that is executed to extract|   IUNIT            01535000
   | the device unit number from the status pointed|                    01540000
   | to by ISTAP.                                  |                    01545000
   +-----------------------------------------------+                    01550000
%13| SYSDB relative DIT pointer of the device      |   ICDP             01555000
   | currently using the channel to perform a      |                    01560000
   | data operation.                               |                    01565000
   +-----------------------+-----------------------+                    01570000
%14|       SIOPSIZE        |        CQUEN          |   IQUEUE           01575000
   +--+--+--+--------------+-----------+-----------+                    01580000
%15|RW|WP|IG|                          |  HCUNIT   |   IFLAG            01585000
   +--+--+--+--------------------------+-----------+                    01590000
%16| SYSDB relative DIT pointer for unit 0         |   IDITP0           01595000
   +-----------------------------------------------+                    01600000
%17| SYSDB relative DIT pointer for unit 1         |   IDITP1           01605000
   +-----------------------------------------------+                    01610000
%20| SYSDB relative DIT pointer for unit 2         |   IDITP2           01615000
   +-----------------------------------------------+                    01620000
%21| SYSDB relative DIT pointer for unit 3         |   IDITP3           01625000
   +-----------------------------------------------+                    01630000
%22|        Idle Channel Program                   |                    01635000
%23|            Status Return Area                 |                    01640000
   +-----------------------------------------------+                    01645000
%24|             Mag Tape                          |                    01650000
   .               Channel                         .                    01655000
   |                 Program                       |                    01660000
   +-----------------------------------------------+                    01665000
                                                                        01670000
$PAGE                                                                   01675000
ICPVA0 - Channel Program Variable Area                                  01680000
                                                                        01685000
  The first word is used by the channel program processor to store      01690000
  status information after I/O channel aborts.  The next word is used   01695000
  by the driver to indicate if status should be examined for special    01700000
  conditions or errors.  The other two words are not used.              01705000
                                                                        01710000
                                                                        01715000
ICPVA4 - DMA abort address                                              01720000
                                                                        01725000
  If a DMA abort occurs, the absolute address where the abort occurred  01730000
  is stored in this area.                                               01735000
                                                                        01740000
                                                                        01745000
ICNTRL - Contains controller information                                01750000
                                                                        01755000
  LIM     - If this bit is set, the controller is sharing a software    01760000
            channel resource in order to limit bandwidth.               01765000
  CHANQUE - The software channel resource number.                       01770000
  CHAN    - Channel number (four most significant bits of DRTN).        01775000
  DEV     - Device number (three least significant bits of DRTN).       01780000
                                                                        01785000
                                                                        01790000
IQUEUE -                                                                01795000
                                                                        01800000
  SIOPSIZE - (number of words + 1)/2 in the channel program area.       01805000
  CQUEN    - For a multi-unit controller this field contains the        01810000
             software controller resource number.                       01815000
                                                                        01820000
                                                                        01825000
IFLAG - Controller and Channel Program state flags                      01830000
                                                                        01835000
  RUNWAIT  - An Idle Channel Program should be started when there       01840000
             are no active requests to process.                         01845000
  WAITPROG - An Idle Channel Program has been started for this          01850000
             controller.  This bit is reset by an interrupt.            01855000
  IGNOREHI - An HIOP instruction has been issued against this	          01860000
             controller but the channel program was not in a wait       01865000
             statement.  Therefore ignore the interrupt generated by    01870000
             the channel code when this program halts.                  01875000
  HCUNIT   - Highest configured unit number for this controller.        01880000
$PAGE                                                                   01885000
            I/O QUEUE ELEMENT (IOQ)                                     01890000
            -----------------------                                     01895000
                                                                        01900000
                                                                        01905000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01910000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01915000
  0|      Request dependent flags (see below)      |   QFLAG            01920000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01925000
  1| SYSDB relative pointer to next IOQ element.   |   QLINK            01930000
   | Points to first word of element.              |                    01935000
   +-----------------------+-----------------------+                    01940000
  2|                       | Logical device number |   QLDEV            01945000
   +--+--+--+--+-----------+-----------+-----------+                    01950000
  3| R| B| F| G|   FSCNTR  |   BSCNTR  |   RTCNTR  |   QMISC            01955000
   +--+--+--+--+-----------+-----------+-----------+                    01960000
  4| S| If QFLAG.(3:1) is clear then this is the   |   QDSTN            01965000
   |  | DST number of the target data segment.  If |                    01970000
   |  | S is set, QADDR is DB relative.            |                    01975000
   +--+--------------------------------------------+                    01980000
  5| Offset in the data segment or system buffer   |   QADDR            01985000
   | table to the target data buffer.              |                    01990000
   +-----------------------+-----------------------+                    01995000
  6|                       | Function code for     |   QFUNC            02000000
   |                       | this request.  (See   |                    02005000
   |                       | next section.)        |                    02010000
   +-----------------------+-----------------------+                    02015000
  7| On initiation, specifies the word count (>0)  |   QWBCT            02020000
   | or byte count (<0).  At completion of the     |                    02025000
   | request this location contains the actual     |                    02030000
   | transmission count in the same units (bytes   |                    02035000
   | or words) as in the request.                  |                    02040000
   +-----------------------------------------------+                    02045000
%10| Parameter 1.  Used only for reads.  Contains  |   QPAR1            02050000
   | the EOF specification in bits (13:3).         |                    02055000
   +-----------------------------------------------+                    02060000
%11| Parameter 2.  Used only for writes.  If bit   |   QPAR2            02065000
   | (13:1) is set, writing past EOT is allowed.   |                    02070000
   +-----------------------+--------------+--------+                    02075000
%12|         PCBN          |  QUALIFIER   | STATUS |   QSTAT            02080000
   +-----------------------+--------------+--------+                    02085000
                                                                        02090000
                                                                        02095000
QFLAG - Request dependent flags                                         02100000
                                                                        02105000
  Bit 0  ABORT     - Abort this request and return an error indication  02110000
                     to the caller.                                     02115000
  Bit 1  SPECIAL   - Apply special handling to this request.  (Not used)02120000
  Bit 2  DIAG      - This is a request from the diagnostic subsystem.   02125000
                     (Not used)                                         02130000
  Bit 3  SYSBUFF   - Target is an index relative to the SBUF Table of   02135000
                     the data buffer.                                   02140000
  Bit 4  IOWAKE    - Wake caller on completion of request.              02145000
  Bit 5  BLOCKED   - Blocked I/O.  The caller is waited in ATTACHIO     02150000
                     until the request is completed.  Implies IOWAKE.   02155000
  Bit 6  COMPLETED - The request has been completed and the caller      02160000
                     awakened if he had requested (with IOWAKE).        02165000
  Bit 7  DATAFRZN  - Set by the memory management routines (MAM) when a 02170000
                     MAKEPRESENT request is successfully completed and  02175000
                     indicates the data segment is frozen in memory.    02180000
  Bit 8  MAMERRORD - An error has occurred while MAM was trying to      02185000
                     make the target data segment present and freeze    02190000
                     it in memory.                                      02195000
  Bit 9  PREQ      - (Not used)                                         02200000
  Bit 10 SFAIL     - Delayed failure of SIO instruction.  If a call to  02205000
                     STARTIO resulted in the request being added to     02210000
                     the channel queue, this bit indicates that the SIO 02215000
                     instruction failed when the request was selected   02220000
                     for execution.                                     02225000
  Bit 11 PFAIL     - The request was aborted because of a system power  02230000
                     failure.                                           02235000
                                                                        02240000
                                                                        02245000
QMISC - Driver request dependent flags and counters.  Used mostly for   02250000
        error retries.                                                  02255000
                                                                        02260000
  RETRY    - Indicates an error retry is in progress.                   02265000
  BACK     - Backspace record processing for an error retry is in       02270000
             progress.                                                  02275000
  FORWARD  - Forward space record processing for an error retry is      02280000
             in progress.                                               02285000
  GAP      - Gap processing for an error retry is in progress.          02290000
  FSCNTR   - Forward space record counter.                              02295000
  BSCNTR   - Backspace record counter.                                  02300000
  RTCNTR   - Error retry counter.                                       02305000
                                                                        02310000
                                                                        02315000
QSTAT - PCB number and request completion status.                       02320000
                                                                        02325000
  PCBN    - The Process Control Block (PCB) number of the process       02330000
            which made this request.  If zero, the request is not       02335000
            associated with any process and the IOQ element is to       02340000
            be returned by the system when the request has completed.   02345000
  STATUS  - General status indicating the final state of the request.   02350000
            The following codes are used:                               02355000
              0 - Not started or awaiting completion.                   02360000
              1 - Successful completion.                                02365000
              2 - End-of-file detected.                                 02370000
              3 - Unusual, but recoverable, condition detected.         02375000
              4 - Irrecoverable error has occurred.                     02380000
  QUALIFIER - A code which further defines or qualifies the general     02385000
              status.  (See the section Driver Return Status Codes.)    02390000
                                                                        02395000
$PAGE                                                                   02400000
           MAG TAPE REQUEST CODES                                       02405000
           ----------------------                                       02410000
                                                                        02415000
                                                                        02420000
   0 - READ                                                             02425000
         P1(13:3) - END OF FILE SPECIFICATION                           02430000
   1 - WRITE                                                            02435000
         P2(13:1) - IF SET THEN WRITE PAST END OF TAPE MARK             02440000
                    IF CLEAR THEN RETURN ERROR IF EOT HAS BEEN DETECTED 02445000
   2 - OPEN FILE (NO OPERATION)                                         02450000
   3 - CLOSE FILE (RESET EOF FLAGS IN LPDT)                             02455000
   4 - CLOSE DEVICE (RESET EOF FLAGS AND REWIND TAPE)                   02460000
   5 - REWIND                                                           02465000
   6 - WRITE FILE MARK                                                  02470000
   7 - FORWARD SPACE FILE                                               02475000
   8 - BACKSPACE FILE                                                   02480000
   9 - REWIND AND UNLOAD                                                02485000
  10 - GAP TAPE                                                         02490000
  11 - FORWARD SPACE RECORD                                             02495000
  12 - BACKSPACE RECORD                                                 02500000
  13 - READ RECORD BACKWARDS                                            02505000
  14 - SUPPLY TOTAL RECORD BYTE COUNT                                   02510000
  15 - READ STATUS                                                      02515000
                                                                        02520000
COUNT - +WORD OR -BYTE COUNT.  NOTE - IF BYTE COUNT IS SPECIFIED, THE   02525000
        TRANSMISSION LOG WILL REFLECT THE ACTUAL TRANSFER LENGTH, BUT   02530000
        IF WORD COUNT IS SPECIFIED FOR A READ OR BACK-READ OPERATION,   02535000
        ODD BYTE TRANSFERS WILL BE ROUNDED UP IN THE TRANSMISSION LOG   02540000
        RETURNED.                                                       02545000
                                                                        02550000
                                                                        02555000
$PAGE                                                                   02560000
                       DRIVER RETURN STATUS CODES                       02565000
                       --------------------------                       02570000
                                                                        02575000
                                                                        02580000
 GENERAL STATUS (13:3)       QUALIFYING STATUS (8:5)      OVERALL (8:8) 02585000
  0 - PENDING               1 - WAITING FOR COMPLETION         %10      02590000
                            2 - ERROR RECOVERY WAIT            %20      02595000
                            3 - NOT READY WAIT                 %30      02600000
                            4 - NO WRITE RING WAIT             %40      02605000
                                                                        02610000
  1 - SUCCESSFUL            0 - NO ERRORS                        1      02615000
                            2 - RETRY WAS NECESSARY            %21      02620000
                            3 - EOT AFTER WRITE                %31      02625000
                                                                        02630000
  2 - END OF FILE           1 - A TAPE MARK WAS READ                    02635000
                                OR P1 WAS NONZERO AND                   02640000
                                THE LAST RECORD READ                    02645000
                                WAS A TAPE MARK                %12      02650000
                          2-7 - A DATA DEPENDENT EOF                    02655000
                                CONDITION AS SPECIFIED                  02660000
                                BY EOFCHECK                             02665000
                                                                        02670000
 3 - UNUSUAL CONDITION      3 - REQUEST ABORTED                %33      02675000
                            6 - POWERFAIL ABORT                %63      02680000
                            7 - BOT AND BACKSPACE REQUESTED    %73      02685000
                          %10 - TAPE RUNAWAY                  %103      02690000
                          %11 - EOT AND WRITE REQUESTED       %113      02695000
                          %21 - DEVICE POWERED UP             %213      02700000
                          %22 - BOT AND BACK-READ REQUESTED   %223      02705000
                                                                        02710000
 4 - IRRECOVERABLE ERROR    0 - INVALID REQUEST                  4      02715000
                            1 - TRANSMISSION ERROR             %14      02720000
                            3 - TIMING ERROR                   %34      02725000
                            4 - SIO FAILURE                    %44      02730000
                            5 - UNIT FAILURE                   %54      02735000
                          %12 - SYSTEM ERROR                  %124      02740000
                          %14 - CHANNEL FAILURE               %144      02745000
                                                                        02750000
                                                                        02755000
;          <<* * End of comments * *>>                         <<02681>>02760000
$PAGE "VARIABLE AND EXTERNAL PROCEDURE DECLARATIONS"                    02765000
BEGIN                                                                   02770000
$INCLUDE INCLIOQ                                               <<07419>>02775000
$INCLUDE INCLLPDT                                              <<07419>>02780000
  EQUATE                                                                02785000
                                                                        02790000
            << FUNCTION CODES >>                                        02795000
                                                                        02800000
    BACKREADFC   = 13,  << BACKWARDS READ >>                            02805000
    BSRECORDFC   = 12,  << BACKSPACE RECORD >>                          02810000
    DCLOSEFC     =  4,  << DEVICE CLOSE >>                              02815000
    FSRECORDFC   = 11,  << FORWARD SPACE RECORD >>                      02820000
    READFC       =  0,  << READ RECORD >>                               02825000
    REWINDFC     =  5,  << REWIND >>                                    02830000
    REWUNLDFC    =  9,  << REWIND/UNLOAD >>                             02835000
    TAPEGAPFC    = 10,  << TAPE GAP >>                                  02840000
    TTCOUNTFC    = 14,  << TOTAL TRANSFER COUNT >>                      02845000
    WRITEFC      =  1,  << WRITE RECORD >>                              02850000
    WRTFMARKFC   =  6,  << WRITE FILE MARK >>                           02855000
                                                                        02860000
                                                                        02865000
       << MAG TAPE COMMANDS >>                                          02870000
                                                                        02875000
    BACKREADCMD  = %17,                                                 02880000
    BSFILECMD    = %14,                                                 02885000
    BSRECORDCMD  = %12,                                                 02890000
    FSFILECMD    = %13,                                                 02895000
    FSRECORDCMD  = %11,                                                 02900000
    READCMD      = %10,                                                 02905000
    REWINDCMD    = %15,                                                 02910000
    REWUNLDCMD   = %16,                                                 02915000
    TAPEGAPCMD   =   7,                                                 02920000
    WRITECMD     =   5,                                                 02925000
    WRTFMARKCMD  =   6,                                                 02930000
                                                                        02935000
                                                                        02940000
            << QSTAT STATUS RETURNS >>                                  02945000
                                                                        02950000
    ABORTED      =  %33,  << REQUEST ABORTED >>                         02955000
    BREADATBOT   = %223,  << BOT AND BACK-READ REQUESTED >>             02960000
    BSPCATBOT    =  %73,  << BOT AND BACKSPACE REQUESTED >>             02965000
    CHANFAIL     = %144,  << I/O CHANNAL ERROR >>                       02970000
    CMPLTIONWAIT =  %10,  << WAITING FOR COMPLETION >>                  02975000
    EOTWRITE     = %113,  << EOT AND WRITE REQUESTED >>                 02980000
    GOODEOT      =  %31,  << EOT AFTER SUCCESSFUL WRITE >>              02985000
    GOODIO       =    1,  << NO ERRORS >>                               02990000
    GOODRETRY    =  %21,  << RETRY WAS NECESSARY >>                     02995000
    INVALIDRQST  =    4,  << INVALID REQUEST >>                         03000000
    NOTREADYWAIT =  %30,  << NOT READY WAIT >>                          03005000
    PFABORT      =  %63,  << POWERFAIL ABORT >>                         03010000
    POWERUP      = %213,  << DEVICE POWERED UP >>                       03015000
    RETRYWAIT    =  %20,  << DOING ERROR RECOVERY >>                    03020000
    RUNAWAY      = %103,  << TAPE RUNAWAY OCCURRED >>                   03025000
    RINGWAIT     =  %40,  << NO WRITE RING WAIT >>                      03030000
    SIOFAIL      =  %44,  << SIO FAILURE >>                             03035000
    SYSERROR     = %124,  << SYSTEM ERROR >>                            03040000
    TIMINGERR    =  %34,  << TIMING ERROR >>                            03045000
    TRANSFERERR  =  %14,  << TRANSFER ERROR >>                          03050000
    UNITFAIL     =  %54,  << UNIT FAILURE >>                            03055000
                                                                        03060000
            << CHANNEL PROGRAM ARRAY POINTERS >>                        03065000
                                                                        03070000
    ABTCP        = 85,  <<ABORT CHAN PGM>>                              03075000
    ABEND        =105,  <<ABORT END CMD PTR>>                           03080000
    BADDR'RC     = 65,  << BUFFER ADDRESS FOR TRANSFER COUNT READ >>    03085000
    BADDR        = 26,  << BUFFER ADDRESS FOR DATA TRANSFER >>          03090000
    BYTECNT      = 23,  << BYTE COUNT FOR DATA TRANSFER >>              03095000
    CMDWORD      = 96,  << MOTION COMMAND WORD >>                       03100000
    CPSTAT       = 43,  << BEGINNING OF CHAN PROG STATUS ROUTINE >>     03105000
    DSJ'CMDJMP   =  9,  << MOTION COMMAND/READ XFER COUNT SWITCH >>     03110000
    DSJ'RWJMP    = 20,  << READ/WRITE DATA BYPASS SWITCH >>             03115000
    DUMMYBUFF    =104,  << DUMMY BUFFER FOR READ DELAY >>               03120000
    ENDCMD       = 98,  << END COMMAND >>                               03125000
    EOI'JMP      = 28,  << EOI JMP INSTRUCTION >>                       03130000
    IDLE         = 68,  << BEGINNING OF IDLE CHANNEL PROGRAM >>         03135000
    MEMX'RC      = 64,  << BANK ADDRESS FOR TRANSFER COUNT READ >>      03140000
    MEMX         = 25,  << BANK ADDRESS FOR DATA TRANSFER >>            03145000
    RWDATA       = 22,  << READ/WRITE DATA COMMAND >>                   03150000
    SLCTUNIT     = 95,  << UNIT NUMBER BUFFER FOR SELECT COMMAND >>     03155000
    SPFDCMD      = 97,  << STOP POLLING FOR DATA COMMAND >>             03160000
    SRBUFF       =101,  << SHORT READ BUFFER >>                         03165000
    STATUS       = 99,  << I/O STATUS BUFFER >>                         03170000
    TDBL         = 24,  << TERM DISPLACEMENT/BURST LENGTH >>            03175000
                                                                        03180000
                                                                        03185000
         << TABLE ARRAY POINTERS AND PROGRAM CONSTANTS >>               03190000
                                                                        03195000
    CONSOLE      =     0,  << OUTPUT MESSAGE TO OPERATOR >>             03200000
    DILTP        =     5,  << DIT, INTERRUPT LINKAGE TABLE PT>><<07419>>03205000
    DIOQX        =     2,  << DIT, IOQPOINTER >>               <<07419>>03210000
    DLDEV        =     3,  << DIT, LOGICAL DEVICE AND UNIT NUMBERS >>   03215000
    DLOGERROR    =    11, << DIT, HARDWARE ERROR STATUS>>               03220000
    DRQST        =   %15,  << DIT, DRIVER TIMER >>             <<07419>>03225000
    DUNIT        =   %12,  << PHYSICAL UNIT # >>               <<07419>>03230000
    DSAVE        =     6,  << DIT, DRIVER FLAGS WORD >>                 03235000
    DSERR        =     7,  << DIT, HARDWARE COUNT & INDEX >>            03240000
    DSTAT        =     9,  << DIT, LAST INTERRUPT STATUS >>             03245000
    DTIME        =     8,  <<DIT, BIT 0 INDICATES TIMER POPPED >>       03250000
    ERRORMASK    = %04037, << RETRY ERROR DECTION MASK >>      <<02710>>03255000
    IFLAG        =    13,  << ILT, FLAG WORD >>                         03260000
    INTRPTWAIT   =   %13,  << INTERRUPT WAIT DRIVER RETURN STATE >>     03265000
    ISIOP        =     8,  << CHANNEL PROGRAM AREA POINTER >>           03270000
    ISTAP        =     9,  << CHAN PROG STATUS RETURN AREA POINTER >>   03275000
    MAXBSIZE     = 16384,  << MAXIMUM BUFFER BYTE SIZE >>               03280000
    MASK'STE'MTE = %11000, << MTE or STE bits in STATUS >>     <<02710>>03285000
    NOTRDYMSG    =    11,  << NOT READY MESSAGE CATALOG INDEX >>        03290000
    NOWRING      =   220,  << NO WRITE RING MESSAGE CATALOG INDEX >>    03295000
    OPINTRVNTNWAIT =   7,  << OPERATOR INTERVENTION WAIT RETURN STATE >>03300000
    PARITYERROR  =    -1,  << PARITY ERROR LOGGING VALUE >>             03305000
    QFUNC        =     6,  << IOQ, FUNCTION CODE >>                     03310000
    QMISC        =     3,  << IOQ, REQUEST FLAGS AND COUNTERS WORD >>   03315000
    QPAR2        =     9,  << IOQ, REQUEST PARAMETER WORD >>            03320000
    QSTAT        =    10,  << IOQ, REQUEST STATUS RETURN >>             03325000
    QWBCT        =     7,  << IOQ, WORD/BYTE COUNT >>                   03330000
    REQUESTDONE  =     5,  << REQUEST DONE DRIVER RETURN STATE >>       03335000
    SYSDB        = %1000,  << SET START OF SYSDB AREA >>                03340000
    SYSLPDT      =   %10,  << LPDT POINTER INDEX >>                     03345000
    SYSSBUFF     =     6,  << SYS BUFF TABLE POINTER INDEX >>           03350000
  ENDEQ          =     0;                                               03355000
                                                                        03360000
           << DSTAT BIT DEFINITIONS >>                                  03365000
                                                                        03370000
  DEFINE                                                                03375000
    BUSY         = (13:3)#,  << INTERFACE BUSY/UNIT BUSY/REWINDING >>   03380000
    EOF          = ( 0:1)#,  << END OF FILE >>                          03385000
    EOT          = ( 2:1)#,  << END OF TAPE >>                          03390000
    FILEPROTECT  = ( 5:1)#,  << FILE PROTECT  >>                        03395000
    LOADP        = ( 1:1)#,  << LOAD POINT (BOT) >>                     03400000
    ONLINE       = ( 7:1)#,  << UNIT ONLINE >>                          03405000
    REJECT       = ( 4:1)#,  << COMMAND REJECTED >>                     03410000
    STERR        = ( 3:1)#,  << SINGLE TRACK ERROR >>                   03415000
    TAPERUN      = (12:1)#,  << TAPE RUNAWAY >>                         03420000
    TIMING       = (11:1)#,  << TIMING ERROR >>                         03425000
    TRANSFER     = ( 6:1)#,  << TRANSFER ERROR (MTE) >>                 03430000
                                                                        03435000
                                                                        03440000
           << DSAVE BIT DEFINITIONS >>                                  03445000
                                                                        03450000
    RWBIT        = ( 0:1)#,  << TAPE REWOUND FLAG >>                    03455000
    RWUNLD       = ( 1:1)#,  << REWIND/UNLOAD FOR WRITE RING MOUNTING >>03460000
    SHORT        = ( 2:1)#,  << SHORT READ IN PROGRESS >>               03465000
    CESTAT       = ( 3:1)#,  << CHANNEL PARITY ERROR PROCESSING FLAG >> 03470000
    BODEOF       = ( 4:1)#,  << BACKSPACE ON DATA EOF >>                03475000
    AB'ACK       = (15:1)#,  << ABORT CP RUNNING >>                     03480000
                                                                        03485000
                                                                        03490000
           << QMISC BIT DEFINITIONS >>                                  03495000
                                                                        03500000
    RETRY        = ( 0:1)#,  << ERROR RETRY IN PROGRESS >>              03505000
    BACK         = ( 1:1)#,  << BACKSPACE RECORD FLAG >>                03510000
    FORWRD       = ( 2:1)#,  << FORWARD SPACE RECORD FLAG >>            03515000
    GAP          = ( 3:1)#,  << TAPE GAP FLAG >>                        03520000
    FSCNTR       = ( 4:4)#,  << FORWARD SPACE COUNTER >>                03525000
    BSCNTR       = ( 8:4)#,  << BACKSPACE COUNTER >>                    03530000
    RTCNTR       = (12:4)#,  << ERROR RETRY COUNTER >>                  03535000
                                                                        03540000
                                                                        03545000
         << MISCELLANEOUS BIT DEFINITIONS >>                            03550000
                                                                        03555000
    ABS          = ABSOLUTE#,                                           03560000
    ASMB         = ASSEMBLE#,                                           03565000
    BANKAD       = ( 8:8)#,  << BANK ADDRESS FIELD >>                   03570000
    BLOCKCNT     = ( 8:4)#,  << SIOP, DATA CHAIN BLOCK COUNT FIELD >>   03575000
    EOFBIT       = ( 7:3)#,  << LPDT, EOF FIELD >>                      03580000
    EOTFLAG      = (13:1)#,  << QPAR2, READ PAST EOT MARKER FLAG >>     03585000
    ERRORCODE    = ( 0:3)#,  << CPVA, ERROR CODE FIELD >>               03590000
    IOSTAT       = ( 8:8)#,  << QSTAT, REQUEST STATUS RETURN FIELD >>   03595000
    IS'IN'BYTES  = ( 0:1)#,  << IOQ COUNT SIGN BIT >>          <<07419>>03600000
    LDEV         = ( 8:8)#,  << DLDEV, LOGICAL DEVICE FIELD >>          03605000
    PARITYERR    = ( 3:1)#,  << STATUS, PARITY ERROR OCCURRED >>        03610000
    PFAIL        = (11:1)#,  << QFLAG, ABORT DUE TO POWER FAILURE >>    03615000
    POWUP        = ( 2:1)#,  << STATUS, UNIT HAS POWERED UP >>          03620000
    FUNC         = ( 8:8)#,  << QFUNC, FUNCTION CODE >>                 03625000
    RETRY'MODE   = ( 0:1)#,  << RETRY MODE >>                  <<07419>>03630000
    SFAIL        = (10:1)#,  << QFLAG, FAILURE ON DELAYED START SIO >>  03635000
    TIMEDOUT     = (13:1)#,  << CPVA, TIMED OUT TRANSFER ABORT >>       03640000
    DISABLE      = ASSEMBLE(SED 0)#, << DISABLE INSTRUCTION >> <<06151>>03645000
  ENDDEF         = 0#;                                                  03650000
$PAGE                                                                   03655000
                                                                        03660000
                                                                        03665000
<<       ***********************************                            03670000
         *                                 *                            03675000
         *    DRIVER DB AREA DEFINITION    *                            03680000
         *                                 *                            03685000
         ***********************************        >>                  03690000
                                                                        03695000
                                                                        03700000
ARRAY INITIAL (0:124) = DB :=                                  <<07419>>03705000
    [8/14,8/21],<<DIT SIZE,NOT CORE RES/RUN IDLE CP/DVR TYPE>> <<07419>>03710000
              0,   << NOT USED >>                                       03715000
         %26622,   << UNIT EXTRACT INSTRUCTION - EXF, J=9, K=2 >>       03720000
     [8/53,8/2],   <<CHAN PGM SIZE/2, STATUS RETURN AREA SIZE >>        03725000
                                                                        03730000
     << MT DIT >>                                                       03735000
              0,   << DFLAG >>                                          03740000
              0,   << DLINK >>                                          03745000
              0,   << DIOQP >>                                          03750000
              0,   << DLDEV >>                                 <<07419>>03755000
              0,   << DLTDP >>                                          03760000
              0,   << DILTP >>                                          03765000
              0,   << DSAVE >>                                          03770000
              0,   << DSERR >>                                          03775000
              0,   << DTIME >>                                          03780000
              0,   << DSTAT >>                                          03785000
         %40000,   << DUNIT >>       << HPIB DEV & UNIT NO. >> <<07419>>03790000
              0,   << DLOGERROR >>                                      03795000
              0,   << DLOGERROR+1 >>                           <<04937>>03800000
              0,   << DRQST >>                                 <<07419>>03805000
                                                                        03810000
                                                                        03815000
                                                                        03820000
     << CHANNEL PROGRAM >>                                              03825000
                                                                        03830000
<< 0>> << WRITE COMMAND >>   %2001,  << SELECT UNIT COMMAND >>          03835000
<< 1>>                           1,                                     03840000
<< 2>>                           0,                                     03845000
<< 3>>                      %42000,                                     03850000
<< 4>>                           0,                                     03855000
                                                                        03860000
<< 5>> << WAIT >>            %1000,  << WAIT FOR COMMAND COMPLETION >>  03865000
<< 6>>                           0,                                     03870000
                                                                        03875000
<< 7>> << DSJ >>             %2401,  << CHECK MAG TAPE'S CONDITION >>   03880000
<< 8>>                           0,                                     03885000
<< 9>>   <<DSJ'CMDJMP>>          0,  <<JMP*+0/50, MTN CMD/RD XFER CNT>> 03890000
<<10>>                          43,  << JMP*+43, READ STATUS >>         03895000
                                                                        03900000
<<11>> << WRITE COMMAND >>   %2001,  << ISSUE MOTION COMMAND >>         03905000
<<12>>                           1,                                     03910000
<<13>>                           0,                                     03915000
<<14>>                      %42000,                                     03920000
<<15>>                           0,                                     03925000
                                                                        03930000
<<16>> << WAIT >>            %1000,  << WAIT FOR COMMAND COMPLETION >>  03935000
<<17>>                           0,                                     03940000
                                                                        03945000
<<18>> << DSJ >>             %2401,  << CHECK MAG TAPE'S CONDITION >>   03950000
<<19>>                           0,                                     03955000
<<20>>   <<DSJ'RWJMP>>           0,  <<JMP*+0/25, RD/WRT DATA BYPASS >> 03960000
<<21>>                          32,  << JMP*+32, READ STATUS >>         03965000
                                                                        03970000
<<22>> <<R/W DATA (RWDATA)>>   %20,  << READ/WRITE RECORD COMMAND >>    03975000
<<23>>   <<BYTECNT>>             0,                                     03980000
<<24>>   <<TDBL>>            %2000,  << TERMINATION DISP. *+4 >>        03985000
<<25>>   <<MEMX>>          %000000,  <<Record mode>>                    03990000
<<26>>   <<BADDR>>               0,                                     03995000
                                                                        04000000
<<27>> << JUMP >>                0,  << EOI RECEIVED - XFER COMPLETED >>04005000
<<28>>   <<EOI'JMP>>             2,  <<JMP*+2/12, READ/WRITE CMPLETION>>04010000
                                                                        04015000
<<29>> << JUMP >>                0,  << BURST TRANSFER COMPLETED >>     04020000
<<30>>                         -15,     << JMP *-15 TO WAIT INSTRUCTN >>04025000
                                                                        04030000
<<31>> << WRITE END >>       %2007,  << ISSUE STOP POLLING FOR DATA >>  04035000
<<32>>                           1,                                     04040000
<<33>>                           0,                                     04045000
<<34>>                      %42000,                                     04050000
<<35>>                           0,                                     04055000
                                                                        04060000
<<36>> << READ COUNT >>      %1402,  << READ TRANSFER COUNT TO >>       04065000
<<37>>                           2,  << PROVIDE DELAY NEEDED   >>       04070000
<<38>>                           0,  << FOR READS - KLUDGE     >>       04075000
<<39>>                       %2000,                                     04080000
<<40>>                           0,                                     04085000
                                                                        04090000
<<41>> << WAIT >>            %1000,  << WAIT FOR OPERATION COMPLETION >>04095000
<<42>>                           0,                                     04100000
                                                                        04105000
<<43>> << DSJ >>             %2401,  << CHECK MAGE TAPE'S CONDITION >>  04110000
<<44>>                           0,                                     04115000
<<45>>                           0,  << JMP *+0, UNIT OK >>             04120000
<<46>>                           7,  << JMP *+7, READ STATUS >>         04125000
                                                                        04130000
<<47>> << READ STATUS >>     %1401,  << READ STATUS BYTES >>            04135000
<<48>>                           3,                                     04140000
<<49>>                           0,                                     04145000
<<50>>                       %2000,                                     04150000
<<51>>                           0,                                     04155000
                                                                        04160000
<<52>> << INT/HLT >>          %601,  << INTERRUPT/HALT, HALT CODE = 0 >>04165000
<<53>>                           0,  << STATUS CHECK NOT REQUIRED >>    04170000
                                                                        04175000
<<54>> << READ STATUS >>     %1401,  << READ STATUS BYTES >>            04180000
<<55>>                           3,                                     04185000
<<56>>                           0,                                     04190000
<<57>>                       %2000,                                     04195000
<<58>>                           0,                                     04200000
                                                                        04205000
<<59>> << INT/HLT >>          %601,  << INTERRUPT/HALT, HALT CODE = 1 >>04210000
<<60>>                           1,  << STATUS CHECK REQUIRED >>        04215000
$PAGE                                                                   04220000
           << TRANSFER COUNT READ CHAN PROG >>                          04225000
                                                                        04230000
<<61>> << READ COUNT >>      %1402,  << READ TRANSFER COUNT >>          04235000
<<62>>                           2,                                     04240000
<<63>>                           0,                                     04245000
<<64>>   <<MEMX'RC>>         %2000,                                     04250000
<<65>>                           0,                                     04255000
                                                                        04260000
<<66>> << JUMP >>                0,  << JMP BACK TO DSJ INSTRUCTION >>  04265000
<<67>>                         -25,                                     04270000
                                                                        04275000
                                                                        04280000
                                                                        04285000
           << IDLE CHANNEL PROGRAM >>                                   04290000
                                                                        04295000
<<68>> << WRITE END >>       %2007,  << ISSUE END COMMAND >>            04300000
<<69>>                           1,  << IDLE CHANNEL PROG >>            04305000
<<70>>                           0,                                     04310000
<<71>>                      %42000,                                     04315000
<<72>>                           0,                                     04320000
                                                                        04325000
<<73>> << WAIT >>            %1000,  << WAIT FOR MT TO POLL >>          04330000
<<74>>                           0,                                     04335000
                                                                        04340000
<<75>> << DSJ >>             %2400,  << CLEAR ANY PENDING DSJ'S >>      04345000
<<76>>                           0,                                     04350000
<<77>>                           0,                                     04355000
                                                                        04360000
<<78>> << READ STATUS >>     %1401,  << READ STATUS TO ILT >>           04365000
<<79>>                           3,                                     04370000
<<80>>                           0,                                     04375000
<<81>>                       %2000,                                     04380000
<<82>>                           0,                                     04385000
                                                                        04390000
<<83>> << INT/HLT >>          %601,  << INTERRUPT/HALT, HALT CODE = 0 >>04395000
<<84>>                           0,                                     04400000
                                                                        04405000
                                                                        04410000
           << ABORT I/O CHAN PROG >>                                    04415000
                                                                        04420000
<<85>> << WRITE END >>       %2007,  << ISSUE END COMMAND >>            04425000
<<86>>                           1,                                     04430000
<<87>>                           0,                                     04435000
<<88>>                      %42000,                                     04440000
<<89>>                           0,                                     04445000
                                                                        04450000
<<90>> << DSJ >>             %2400,  << CLEAR ANY PENDING DSJ'S >>      04455000
<<91>>                           0,                                     04460000
<<92>>                           0,                                     04465000
                                                                        04470000
<<93>> << INT/HLT >>          %601,                                     04475000
<<94>>                           0,                                     04480000
$PAGE                                                                   04485000
         << BUFFERS AND PARAMETERS >>                                   04490000
                                                                        04495000
<<95>> << STORAGE (SLCTUNIT)>>   0,  << SELECT COMMAND UNIT NUMBER >>   04500000
<<96>>   <<CMDWORD>>             0,  << MOTION COMMAND WORD >>          04505000
<<97>>                         %23,  << STOP POLLING FOR DATA COMMAND >>04510000
<<98>>                         %25,  << END COMMAND >>                  04515000
<<99>>                           0,  << STATUS BUFFER AREA >>           04520000
<<100>>                          0,                                     04525000
<<101>>                          0,  << 6 BYTE SHORT READ BUFFER >>     04530000
<<102>>                          0,                                     04535000
<<103>>                          0,                                     04540000
<<104>>                          0,  <<DUMMY BUFF>>                     04545000
<<105>>                        %63;  << ABORT END COMMAND >>            04550000
$PAGE                                                                   04555000
<<    ***************************************                           04560000
      *                                     *                           04565000
      *   EXTERNAL PROCEDURE DECLARATIONS   *                           04570000
      *                                     *                           04575000
      ***************************************              >>           04580000
                                                                        04585000
                                                                        04590000
                                                                        04595000
PROCEDURE ABORTTIMEREQ(TRLX);                                           04600000
  VALUE TRLX;   INTEGER TRLX;                                           04605000
  OPTION EXTERNAL;                                                      04610000
                                                                        04615000
PROCEDURE CHECKINDEX(INDEX,TABLE);                                      04620000
  VALUE INDEX,TABLE;                                                    04625000
  INTEGER INDEX;                                                        04630000
  INTEGER POINTER TABLE;                                                04635000
  OPTION EXTERNAL;                                                      04640000
                                                                        04645000
PROCEDURE EOFCHECK(IOQ'ENTRY'INDEX,BUF,CNT,HCHK);              <<07419>>04650000
  VALUE IOQ'ENTRY'INDEX,BUF,CNT,HCHK;                          <<07419>>04655000
  INTEGER IOQ'ENTRY'INDEX;                                     <<07419>>04660000
  DOUBLE BUF;                                                           04665000
  INTEGER CNT,HCHK;                                                     04670000
  OPTION EXTERNAL;                                                      04675000
                                                                        04680000
PROCEDURE GIP'HPIB;                                                     04685000
  OPTION EXTERNAL;                                                      04690000
                                                                        04695000
PROCEDURE HELP;                                                         04700000
  OPTION EXTERNAL;                                                      04705000
                                                                        04710000
LOGICAL PROCEDURE IOMESSAGE(SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,       04715000
                            REPLY,OFFSET,DITP,IOTYPE);                  04720000
  VALUE  SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,DITP,IOTYPE; 04725000
  INTEGER  SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,IOTYPE;    04730000
  INTEGER POINTER  DITP;                                                04735000
  OPTION VARIABLE,EXTERNAL;                                             04740000
                                                                        04745000
PROCEDURE MASTERCLEARHPIB(DITP);                                        04750000
  ARRAY DITP;                                                           04755000
  OPTION EXTERNAL;                                                      04760000
                                                                        04765000
PROCEDURE SIODM(DITP,FLAGS);                                            04770000
  VALUE DITP,FLAGS;   LOGICAL FLAGS;                                    04775000
  POINTER DITP;   OPTION EXTERNAL;                                      04780000
                                                                        04785000
PROCEDURE START'HPIB(DITP,SIOP,QFLAG);                                  04790000
  VALUE DITP,SIOP,QFLAG;   LOGICAL QFLAG;                               04795000
  POINTER DITP,SIOP;   OPTION EXTERNAL;                                 04800000
                                                                        04805000
INTEGER PROCEDURE TIMEREQ(CODE,REQ,TIME);                               04810000
  VALUE CODE,REQ,TIME;                                                  04815000
  INTEGER CODE,REQ;   DOUBLE TIME;                                      04820000
  OPTION EXTERNAL;                                                      04825000
$PAGE "7970 DRIVER INITIALIZATION PROCEDURE"                            04830000
<<     ******************************************                       04835000
       *                                        *                       04840000
       *   MT DRIVER INITIALIZATION PROCEDURE   *                       04845000
       *                                        *                       04850000
       ******************************************       >>              04855000
                                                                        04860000
                                                                        04865000
   PROCEDURE MTINIT(DITP);                                              04870000
     INTEGER ARRAY  DITP;                                               04875000
                                                                        04880000
<<                                                                      04885000
       THIS PROCEDURE INITIALIZES THE BUFFER ADDRESSES FOR              04890000
       MOST READ, WRITE, AND END COMMANDS IN THE CHANNEL                04895000
       PROGRAM.                                                         04900000
>>                                                                      04905000
                                                                        04910000
     BEGIN                                                              04915000
       INTEGER POINTER   ILTP = Q+1;                                    04920000
       INTEGER POINTER   SIOP = Q+2;                                    04925000
       INTEGER        SIOBASE = Q+3;                                    04930000
       INTEGER POINTER   STAP = Q+4;                                    04935000
       INTEGER        STABASE = Q+5;                                    04940000
       INTEGER POINTER IDLECP = Q+6;                                    04945000
                                                                        04950000
                                                                        04955000
       TOS := DITP(DILTP);       << ILTP    >>                          04960000
       TOS := ILTP(ISIOP);       << SIOP    >>                          04965000
       TOS := @SIOP + SYSDB;     << SIOBASE >>                          04970000
       TOS := ILTP(ISTAP);       << STAP    >>                          04975000
       TOS := @STAP + SYSDB;     << STABASE >>                          04980000
       TOS := @SIOP + IDLE;      << IDLECP >>                           04985000
                                                                        04990000
                                                                        04995000
       IF ILTP(IFLAG).(1:1) <> 0 THEN RETURN; <<IDLECP ALREADY STARTED>>05000000
                                                                        05005000
                                                                        05010000
       SIOP( 4) := SIOBASE + SLCTUNIT;                                  05015000
       SIOP(15) := SIOBASE + CMDWORD;                                   05020000
       SIOP(35) := SIOBASE + SPFDCMD;                                   05025000
       SIOP(40) := SIOBASE + DUMMYBUFF;                                 05030000
       SIOP(51) := SIOBASE + STATUS;                                    05035000
       SIOP(58) := SIOBASE + STATUS;                                    05040000
       SIOP(72) := SIOBASE + ENDCMD;                                    05045000
       SIOP(82) := STABASE;                                             05050000
       SIOP(89) := SIOBASE + ABEND;                                     05055000
                                                                        05060000
       START'HPIB(DITP,IDLECP,FALSE);                                   05065000
     END;                                                               05070000
$PAGE "7970 DRIVER PROCEDURE"                                           05075000
<<    ********************************************                      05080000
      *                                          *                      05085000
      *   MAG TAPE DRIVER PROCEDURE  -  MTDRVR   *                      05090000
      *                                          *                      05095000
      ********************************************         >>           05100000
                                                                        05105000
                                                                        05110000
                                                                        05115000
    INTEGER PROCEDURE MTDRVR                                   <<07419>>05120000
        (IOQ'ENTRY'INDEX,DITP,BANK,BUFFADDR,SIOP,DRTN);        <<07419>>05125000
                                                                        05130000
<<    THIS PROCEDURE INITIATES AND COMPLETES I/O REQUESTS               05135000
      FOR THE HP 7970E MAGNETIC TAPE CONNECTED TO THE HP-IB             05140000
      AND CONTROLLED BY THE GIC.                                        05145000
                                                                        05150000
      STATE RETURNS FOR MTDRVR -                                        05155000
          5 - REQUEST COMPLETED                                         05160000
          7 - OPERATOR INTERVENTION REQUIRED                            05165000
        %13 - WAIT FOR OPERATION COMPLETION                             05170000
>>                                                                      05175000
                                                                        05180000
  VALUE IOQ'ENTRY'INDEX,DITP,BANK,BUFFADDR,SIOP,DRTN;          <<07419>>05185000
  INTEGER  BANK,BUFFADDR,DRTN;                                          05190000
  INTEGER POINTER DITP,SIOP;                                   <<07419>>05195000
  INTEGER IOQ'ENTRY'INDEX;                                     <<07419>>05200000
  OPTION  PRIVILEGED,UNCALLABLE;                                        05205000
                                                                        05210000
                                                                        05215000
  BEGIN                                                                 05220000
    LOGICAL ARRAY                                                       05225000
      DITPL(*) = DITP, SIOPL(*)=SIOP;                          <<07419>>05230000
                                                                        05235000
    LOGICAL                                                             05240000
      LS0 = S-0;                                                        05245000
                                                                        05250000
    DOUBLE                                                              05255000
      BUFFADDRD = Q-7;    << BANK AND BUFFER ADDRESS >>                 05260000
                                                                        05265000
    INTEGER POINTER                                                     05270000
      CPVAP,              << HOLDS CHANNEL I/O STATUS >>       <<07419>>05275000
      IDLESIO,         << POINTS TO START OF IDLE CHAN PROG >> <<07419>>05280000
      ABCPGM,             << POINTS TO ABORT CHAN PROG >>      <<07419>>05285000
      STATSIO;        << POINTS TO START OF STATUS CHAN PROG >><<07419>>05290000
                                                                        05295000
    INTEGER                                                             05300000
      XFERCNT,            << BUFFER BYTE COUNT >>              <<07419>>05305000
      FCODE,              << FUNCTION CODE >>                  <<07419>>05310000
      MTSTATE   = MTDRVR, << MAG TAPE STATE >>                          05315000
      S0        = S-0,                                                  05320000
      S3        = S-3,                                                  05325000
      X         = X;                                                    05330000
                                                                        05335000
INTEGER LPDT'INDEX;                                            <<07419>>05340000
                                                               <<07419>>05345000
<<This subroutine returns a TRUE condition if the conditions>> <<02681>>05350000
<<are such that a write after encountering EOT is NOT allowed>><<02681>>05355000
logical subroutine CHECK'WRITE'AFTER'EOT;                      <<02681>>05360000
begin                                                          <<02681>>05365000
                                                               <<02681>>05370000
if DITPL(DSTAT).EOT             <<EOT has been passed on tape>><<02681>>05375000
   and not IOQ'PARM2.EOTFLAG <<wrt after EOT flag not set >>   <<07419>>05380000
   AND IOQ'QMISC.RETRY'MODE = 0 THEN   <<NOT IN RETRY MODE>>   <<07419>>05385000
  CHECK'WRITE'AFTER'EOT := true;                               <<02681>>05390000
                                                               <<02681>>05395000
end;                                                           <<02681>>05400000
$PAGE "7970 DRIVER PROCEDURE - ENTRY POINT"                             05405000
   << INITIALIZE LOCAL POINTERS AND VARIABLES >>                        05410000
                                                                        05415000
    @CPVAP := DITP(DILTP);       << CPVAP >>                   <<07419>>05420000
    @IDLESIO := @SIOP +IDLE;     << IDLESIO >>                 <<07419>>05425000
    @STATSIO := @SIOP + CPSTAT;  << STATSIO >>                 <<07419>>05430000
    XFERCNT := IOQ'COUNT;        << XFERCNT >>                 <<07419>>05435000
    IF INTEGER(IOQ'COUNT) < 0 THEN << BYTE COUNT >>            <<07419>>05440000
      XFERCNT := -XFERCNT          << MAKE POSITIVE >>         <<07419>>05445000
    ELSE                            << WORD COUNT >>                    05450000
      XFERCNT :=XFERCNT&ASL(1);     << MAKE BYTE COUNT >>      <<07419>>05455000
    FCODE := IOQ'FUNC;            << FCODE >>                  <<07419>>05460000
    @ABCPGM := @SIOP + ABTCP;    << ABCPGM >>                  <<07419>>05465000
LPDT'INDEX := DITP(DLDEV) * INTEGER(LPDT'ENTRY'SIZE);          <<07419>>05470000
                                                                        05475000
                                                                        05480000
         << CHECK FOR IDLE CHAN PROG REQUEST >>                         05485000
                                                                        05490000
  IF IOQ'ENTRY'INDEX = 0 THEN << START IDLE CHANNEL PROGRAM >> <<07419>>05495000
    BEGIN                                                               05500000
      START'HPIB(DITP,IDLESIO,FALSE);                                   05505000
      IF < THEN   << SIO FAILURE >>                                     05510000
        BEGIN                                                           05515000
          MASTERCLEARHPIB (DITP);                              <<06371>>05520000
          DITP (DSAVE) := 0;                                   <<06371>>05525000
          MTSTATE := REQUESTDONE;                              <<06371>>05530000
          RETURN;                                              <<06371>>05535000
        END;                                                            05540000
      CPVAP := 0;                                                       05545000
      MTSTATE := REQUESTDONE;                                           05550000
      RETURN;                                                           05555000
    END;                                                                05560000
                                                                        05565000
                                                                        05570000
         << CHECK FOR ABORT REQUEST >>                                  05575000
                                                                        05580000
  IF IOQ'ABORT=1 THEN      << ABORT PROCESS >>                 <<07419>>05585000
    BEGIN                                                               05590000
      TOS := IF IOQ'PFAIL THEN PFABORT ELSE ABORTED;           <<07419>>05595000
      DISABLE;                  << DISABLE FOR INTERRUPTS >>   <<06151>>05600000
      DITP(DSAVE).AB'ACK := 0;  << RESET ABORT ACKNOWLEDGE BIT >>       05605000
      IF <> THEN GOTO UNUSUALEND;  << IF RESET, EXIT >>                 05610000
      START'HPIB(DITP,ABCPGM,TRUE ); <<ABORT>>                 <<06151>>05615000
      MTSTATE := INTRPTWAIT;                                            05620000
      IOQ'STAT := CMPLTIONWAIT;                                <<07419>>05625000
      DITP(DSAVE).AB'ACK := 1;   << SET ABORT ACKNOWLEDGE BIT >>        05630000
      RETURN;                                                           05635000
    END;                                                                05640000
                                                                        05645000
    <<reset abort-flush bit in DIT>>                                    05650000
    DITP(DSAVE).AB'ACK := 0;                                            05655000
                                                                        05660000
                                                                        05665000
         << CHECK FOR POWER UP CONDITION >>                             05670000
                                                                        05675000
  SIOP(-1).POWUP := 0;   << RESET PON BIT IN ILT STATUS >>              05680000
  IF <> AND NOT SIOPL(-2).ONLINE THEN   << RETURN PON CONDITION >>      05685000
    BEGIN                                                               05690000
      TOS := POWERUP;                                                   05695000
      GOTO BADIO;                                                       05700000
    END;                                                                05705000
                                                                        05710000
                                                                        05715000
         << CHECK TIMER >>                                              05720000
                                                                        05725000
  IF DITP(DTIME).(0:1)=1 THEN   << TIMER HAS POPPED >>                  05730000
    BEGIN                                                               05735000
      ABORTTIMEREQ(DITP(DRQST));                                        05740000
      DITP(DTIME) := 0;                                                 05745000
      DITP(DSAVE).RWUNLD := 1;                                          05750000
      TOS := REWUNLDCMD;                                                05755000
      GOTO CONTROLCONT;                                                 05760000
    END;                                                                05765000
                                                                        05770000
                                                                        05775000
$PAGE "7970 DRIVER PROCEDURE - INITIATOR SECTION"                       05780000
                                                                        05785000
                                                                        05790000
         <<  **  INITIATOR SECTION  **  >>                              05795000
                                                                        05800000
                                                                        05805000
  IF MTSTATE=2 THEN                                                     05810000
    BEGIN    << INITIATOR SECTION >>                                    05815000
      IF FCODE > 15 OR XFERCNT > MAXBSIZE THEN  << INVALID REQUEST >>   05820000
        BEGIN                                                           05825000
          TOS := INVALIDRQST;                                           05830000
          GOTO BADIO;                                                   05835000
        END;                                                            05840000
                                                                        05845000
      X := FCODE;  << SWITCH ON REQUEST CODE >>                         05850000
      ASMB( LOAD STABLE,X; ADAX; BR STABLE,X;                           05855000
        STABLE:                                                         05860000
          CON READ;     CON WRITE;    CON FOPEN;    CON FCLOSE;         05865000
          CON DCLOSE;   CON REWIND;   CON WRTFMARK; CON FSFILE;         05870000
          CON BSFILE;   CON REWUNLD;  CON TAPEGAP;  CON FSRECORD;       05875000
          CON BSRECORD; CON BACKREAD; CON TTCOUNT;  CON STATREAD);      05880000
                                                                        05885000
                                                                        05890000
READ:                                                                   05895000
      EOFCHECK(IOQ'ENTRY'INDEX,0D,0,0); << PREREAD EOF CHECK>> <<07419>>05900000
      IF <> THEN   << EOF FOUND >>                                      05905000
        BEGIN                                                           05910000
          MTSTATE := REQUESTDONE;                                       05915000
          RETURN;                                                       05920000
        END;                                                            05925000
                                                                        05930000
      IF XFERCNT = 0 THEN GOTO FSRPEOF;  << READ OF 0 SO FSRECORD >>    05935000
                                                                        05940000
      IF XFERCNT < 6 THEN                                               05945000
        BEGIN  << SHORT READ FOR THE EOF CHECK >>                       05950000
          SIOP(SRBUFF) := SIOP(SRBUFF+1) := SIOP(SRBUFF+2) := 0;        05955000
          BANK := 0;   << READ 6 BYTES INTO CHAN PROG AREA >>           05960000
          BUFFADDR := @SIOP(SRBUFF) + SYSDB;                            05965000
          XFERCNT := 6;                                                 05970000
          DITP(DSAVE).SHORT := 1;                                       05975000
        END;                                                            05980000
                                                                        05985000
                                                                        05990000
      SIOP(RWDATA) := %1400;  << SETUP READ/WRITE DATA COMMAND >>       05995000
      SIOP(EOI'JMP) := 2;     << SET EOI JUMP TO SPFD >>                06000000
      SIOP(MEMX) := BANK <<+ %100000>>;  <<add %100000 for burst mode>> 06005000
      SIOP(CMDWORD) := READCMD;   << SETUP FOR READ COMMAND >>          06010000
                                                                        06015000
WRITECONT:                                                              06020000
      SIOP(BADDR) := BUFFADDR;                                          06025000
      SIOP(BYTECNT) := XFERCNT;    << SETUP BYTE COUNT >>               06030000
      SIOP(TDBL) := 0; <<[8/4,8/64] TERM DISP/BYTE COUNT for burst>>;   06035000
      SIOP(DSJ'RWJMP) := 0;  << SET SWITCH TO READ/WRITE BRANCH >>      06040000
                                                                        06045000
INITIO:                                                                 06050000
      SIOP(DSJ'CMDJMP) := 0;  << SET SWITCH TO MOTION COMMAND BRANCH >> 06055000
                                                                        06060000
TTCOUNTCONT:                                                            06065000
      TOS := DITPL(DUNIT)&LSL(8); << PUT UNIT IN SELECT CMND>> <<07419>>06070000
      SIOP(SLCTUNIT) := (TOS + %400)&ASR(8);                            06075000
                                                                        06080000
IOCONT:                                                                 06085000
      START'HPIB(DITP,SIOP,TRUE);  << START CHANNEL PROGRAM >>          06090000
      IF < THEN  << SIO FAILURE >>                                      06095000
        BEGIN                                                           06100000
          TOS := SIOFAIL;                                               06105000
          GOTO BADIO;                                                   06110000
        END;                                                            06115000
      CPVAP := 0;                                                       06120000
      DITP(DSAVE).RWBIT := 0;  << RESET REWIND BIT >>                   06125000
      MTSTATE := INTRPTWAIT;                                            06130000
      IF DITPL(DSAVE).BODEOF THEN RETURN;                               06135000
      TOS:=                                                    <<07419>>06140000
           IF IOQ'QMISC.RETRY THEN RETRYWAIT ELSE CMPLTIONWAIT;<<07419>>06145000
      IOQ'STAT := TOS;                                         <<07419>>06150000
      RETURN;                                                           06155000
                                                                        06160000
                                                                        06165000
WRITE:                                                                  06170000
      IF XFERCNT = 0 THEN GOTO TESTWRITE;  << TO CHECK FOR WRTRING >>   06175000
      <<see if write after EOT is allowed>>                    <<02681>>06180000
      if CHECK'WRITE'AFTER'EOT then                            <<02681>>06185000
        BEGIN   << ATTEMPTED WRITE AFTER EOT DETECTED >>                06190000
          TOS := EOTWRITE;                                              06195000
          GOTO BADIO;                                                   06200000
        END;                                                            06205000
      SIOP(RWDATA) := %2000;   << SETUP READ/WRITE DATA COMMAND >>      06210000
      SIOP(EOI'JMP) := 12;  << SET EOI JUMP TO SKIP SPFD CMD >>         06215000
      SIOP(MEMX) := BANK + %20000; <<add %120000 for burst mode>>       06220000
      SIOP(CMDWORD) := WRITECMD;  << SETUP FOR WRITE COMMAND >>         06225000
      GOTO WRITECONT;                                                   06230000
                                                                        06235000
                                                                        06240000
REWIND:                                                                 06245000
      IF DITPL(DSAVE).RWBIT AND DITPL(DSTAT).LOADP THEN                 06250000
        GOTO GOODEND;                                                   06255000
      TOS := REWINDCMD;                                                 06260000
                                                                        06265000
CONTROLCONT:                                                            06270000
      SIOP(CMDWORD) := TOS;                                             06275000
      SIOP(DSJ'RWJMP) := 25;  << BRANCH AROUND READ/WRITE DATA LOGIC >> 06280000
      GOTO INITIO;                                                      06285000
                                                                        06290000
                                                                        06295000
WRTFMARK:                                                               06300000
                                                               <<02681>>06305000
      <<see if write after EOT is allowed>>                    <<02681>>06310000
      if CHECK'WRITE'AFTER'EOT then                            <<02681>>06315000
        begin                                                  <<02681>>06320000
        tos := EOTWRITE;                                       <<02681>>06325000
        go to BADIO;                                           <<02681>>06330000
        end;                                                   <<02681>>06335000
                                                               <<02681>>06340000
      TOS := WRTFMARKCMD;                                               06345000
      GOTO CONTROLCONT;                                                 06350000
                                                                        06355000
                                                                        06360000
FSFILE:                                                                 06365000
      TOS := FSFILECMD;                                                 06370000
      GOTO CONTROLCONT;                                                 06375000
                                                                        06380000
                                                                        06385000
BSFILE:                                                                 06390000
      TOS := BSFILECMD;                                                 06395000
CHECKLOADP:                                                             06400000
      IF DITPL(DSTAT).LOADP THEN  << TRIED TO BACKSPACE AT BOT >>       06405000
        BEGIN                                                           06410000
          TOS := BSPCATBOT;                                             06415000
          GOTO BADIO;                                                   06420000
        END;                                                            06425000
      GOTO CONTROLCONT;                                                 06430000
                                                                        06435000
                                                                        06440000
TAPEGAP:                                                                06445000
      TOS := TAPEGAPCMD;                                                06450000
      GOTO CONTROLCONT;                                                 06455000
                                                                        06460000
                                                                        06465000
DCLOSE:                                                                 06470000
                                                               <<07419>>06475000
LPDT'EOF'TYPE := 0;                                            <<07419>>06480000
                    << RESET EOF FIELD IN LPDT >>              <<07419>>06485000
                                                                        06490000
REWUNLD:                                                                06495000
      TOS := REWUNLDCMD;                                                06500000
      IF DITPL(DSAVE).RWBIT AND NOT DITPL(DSTAT).ONLINE THEN            06505000
        GOTO GOODEND;                                                   06510000
      GOTO CONTROLCONT;                                                 06515000
                                                                        06520000
FSRECORD:                                                               06525000
      EOFCHECK(IOQ'ENTRY'INDEX,0D,0,0);                        <<07419>>06530000
      IF <> THEN GOTO EOFOUT;                                           06535000
FSRPEOF:                                                                06540000
      TOS := FSRECORDCMD;                                               06545000
      GOTO CONTROLCONT;                                                 06550000
                                                                        06555000
                                                                        06560000
BSRECORD:                                                               06565000
      EOFCHECK(IOQ'ENTRY'INDEX,0D,0,0);                        <<07419>>06570000
      IF <> THEN GOTO EOFOUT;                                           06575000
BSRPEOF:                                                                06580000
      TOS := BSRECORDCMD;                                               06585000
      GOTO CHECKLOADP;                                                  06590000
                                                                        06595000
                                                                        06600000
BACKREAD:                                                               06605000
      EOFCHECK(IOQ'ENTRY'INDEX,0D,0,0);                        <<07419>>06610000
      IF <> THEN GOTO EOFOUT;                                           06615000
      IF XFERCNT=0 THEN GOTO BSRPEOF;                                   06620000
      IF DITPL(DSTAT).LOADP THEN  << TRIED TO BACKREAD AT BOT >>        06625000
        BEGIN                                                           06630000
          TOS := BREADATBOT;                                            06635000
          GOTO BADIO;                                                   06640000
        END;                                                            06645000
      SIOP(RWDATA) := %1400;   << SETUP READ/WRITE DATA COMMAND >>      06650000
      SIOP(EOI'JMP) := 2;     << SET EOI JUMP TO SPFD COMMAND >>        06655000
      SIOP(MEMX) := BANK; << + %100000 for burst mode>>                 06660000
      SIOP(CMDWORD) := BACKREADCMD;  << SETUP FOR BACKREAD CMD >>       06665000
      GOTO WRITECONT;                                                   06670000
                                                                        06675000
                                                                        06680000
TTCOUNT:                                                                06685000
      SIOP(MEMX'RC).(8:8) := BANK;                                      06690000
      SIOP(BADDR'RC) := BUFFADDR;                                       06695000
      SIOP(DSJ'CMDJMP) := 50;   << SET SWITCH TO TTCOUNT READ BRANCH >> 06700000
      GOTO TTCOUNTCONT;                                                 06705000
                                                                        06710000
                                                                        06715000
STATREAD:                                                               06720000
      IF XFERCNT=0 THEN  << INVALID REQUEST >>                          06725000
        BEGIN                                                           06730000
          TOS := INVALIDRQST;                                           06735000
          GOTO BADIO;                                                   06740000
          HELP;  << LINK >>                                             06745000
        END;                                                            06750000
      IF XFERCNT > 3 THEN  << EXCEED MAX STATUS >>                      06755000
        XFERCNT := 3;  << SET MAX STATUS AVAIL >>                       06760000
                                                                        06765000
      TOS := BANK;  << SET BANK >>                                      06770000
      TOS := BUFFADDR;  << SET ADDRESS >>                               06775000
                                                                        06780000
      IF XFERCNT < 3 THEN  << SINGLE STATUS REQ. >>                     06785000
        BEGIN                                                           06790000
          TOS := XFERCNT;  << TRANSFER COUNT >>                         06795000
          IF TOS THEN  << 1 BYTE STATUS REQ. >>                         06800000
            TOS := DITPL(DSTAT) LAND %177400                            06805000
          ELSE  << 1 WORD STATUS REQ. >>                                06810000
            TOS := DITP(DSTAT);                                         06815000
          ASMB(SSEA);  << STORE SINGLE WORD >>                          06820000
        END                                                             06825000
      ELSE                                                              06830000
        BEGIN  << DOUBLE STATUS REQ. >>                                 06835000
          TOS := DITP(DSTAT);  << 1ST WRD STATUS >>                     06840000
          TOS := SIOP(STATUS+1);  << 2ND WRD STATUS >>                  06845000
          ASMB(SDEA);  << STORE DOUBLE WORD >>                          06850000
        END;                                                            06855000
                                                                        06860000
      GO TO GOODEND;                                                    06865000
                                                                        06870000
    END   << INITIATOR SECTION >>                                       06875000
$PAGE "7970 DRIVER PROCEDURE - COMPLETOR SECTION"                       06880000
          << *** CONTINUATOR SECTION *** >>                             06885000
                                                                        06890000
                                                                        06895000
  ELSE                                                                  06900000
    BEGIN                                                               06905000
      IF IOQ'SFAIL THEN  << FAILURE ON DELAYED START I/O >>    <<07419>>06910000
        BEGIN                                                           06915000
          TOS := SIOFAIL;                                               06920000
          GOTO BADIO;                                                   06925000
        END;                                                            06930000
                                                                        06935000
                                                                        06940000
            << CHECK FOR CHANNEL ERRORS >>                              06945000
                                                                        06950000
      IF CPVAP.ERRORCODE=6 THEN   << CHANNEL DMA ABORT >>               06955000
        GOTO CHANERROR;                                                 06960000
      IF CPVAP.ERRORCODE=7 THEN   << CHANNEL ERROR >>                   06965000
        BEGIN                                                           06970000
          IF CPVAP.TIMEDOUT=0 THEN  << CHANNEL FAILURE >>               06975000
            GOTO CHANERROR;                                             06980000
          START'HPIB(DITP,STATSIO,TRUE);                                06985000
          IF < THEN  << SIO FAILURE >>                                  06990000
            BEGIN                                                       06995000
              TOS := SIOFAIL;                                           07000000
              GOTO BADIO;                                               07005000
            END;                                                        07010000
          CPVAP := 0;                                                   07015000
          DITP(DSAVE).CESTAT := 1;                                      07020000
          MTSTATE := INTRPTWAIT;                                        07025000
          RETURN;                                                       07030000
        END;                                                            07035000
                                                                        07040000
      IF SIOPL(STATUS+1).POWUP AND NOT SIOPL(STATUS).ONLINE THEN        07045000
        BEGIN      << POWER RESTART OCCURRED >>                         07050000
          TOS := POWERUP;                                               07055000
          GOTO BADIO;                                                   07060000
        END;                                                            07065000
                                                                        07070000
      DITP(DSAVE).CESTAT := 0;                                          07075000
      IF <> THEN  << COMPLETE CHANNEL TIMEOUT PROCESSING >>             07080000
        BEGIN                                                           07085000
          IF NOT SIOPL(STATUS+1).PARITYERR THEN GOTO CHANERROR;         07090000
          DITP(DSERR) := [8/1,8/DLOGERROR];                             07095000
          DITP(DLOGERROR):= PARITYERROR;  <<LOG ERROR>>                 07100000
          GOTO IOCONT;  << RESTART I/O >>                               07105000
        END;                                                            07110000
                                                                        07115000
                                                                        07120000
                                                                        07125000
               << ERROR RETRY PROCESSING >>                             07130000
                                                                        07135000
      DITP(DSTAT) := SIOP(STATUS);  << UPDATE DIT STATUS >>             07140000
      TOS := IOQ'QMISC;   << CHECK FOR RETRY CONDITION >>      <<07419>>07145000
      IF < THEN  << ERROR RECOVERY IN PROGRESS >>                       07150000
        BEGIN                                                           07155000
          IF (DITPL(DSTAT) LAND ERRORMASK) <> 0 THEN           <<02710>>07160000
            BEGIN                                                       07165000
UNIT'FAIL:                                                     <<02710>>07170000
              TOS := UNITFAIL;                                          07175000
              GOTO FAIL;                                                07180000
            END;                                                        07185000
          IF LS0.BACK THEN  << BACKSPACE COMPLETED >>                   07190000
            BEGIN                                                       07195000
             if FCODE=WRITEFC or FCODE=WRTFMARKFC then <<gap>> <<02671>>07200000
                BEGIN                                                   07205000
                  TOS.BACK := 0;                                        07210000
                  TOS.GAP := 1;                                         07215000
                  IOQ'QMISC := TOS;                            <<07419>>07220000
                  GOTO TAPEGAP;                                         07225000
                END;                                                    07230000
              IF DITPL(DSTAT).LOADP THEN GOTO ENDBACK;                  07235000
              TOS := TOS + %20;  << BUMP BSCNTR >>                      07240000
              IF S0.BSCNTR <> S0.RTCNTR THEN                            07245000
                BEGIN   << BACKSPACE ANOTHER RECORD >>                  07250000
                  IOQ'QMISC := TOS;                            <<07419>>07255000
                  GOTO BSRPEOF;                                         07260000
                END;                                                    07265000
ENDBACK:                                                                07270000
              TOS.BACK := 0;  << FINISHED BACKSPACING >>                07275000
              TOS.FORWRD := 1;  << NOW FORWARD SPACE >>                 07280000
            END;                                                        07285000
                                                                        07290000
          IF LS0.FORWRD THEN  << PROCESS FORWARD SPACING >>             07295000
            BEGIN                                                       07300000
              TOS := TOS + %400;  << BUMP FSCNTR >>                     07305000
              IF S0.FSCNTR < S0.BSCNTR THEN                             07310000
                BEGIN                                                   07315000
                  IOQ'QMISC := TOS;                            <<07419>>07320000
                  GOTO FSRPEOF;                                         07325000
                END;                                                    07330000
              TOS.FORWRD := 0;  << FINISHED FORWARD SPACING >>          07335000
              IOQ'QMISC := TOS;                                <<07419>>07340000
              IF FCODE = READFC THEN GOTO READ ELSE GOTO BACKREAD;      07345000
            END;                                                        07350000
                                                                        07355000
          TOS.GAP := 0;                                                 07360000
          IF <> THEN  << GAP COMPLETED, RETRY WRITING >>                07365000
            BEGIN                                                       07370000
              <<if MTE or STE occurred during GAP, then >>     <<02710>>07375000
              <<tape was mis-positioned or drive problem>>     <<02710>>07380000
              if (DITPL(DSTAT) land MASK'STE'MTE) <> 0 then    <<02710>>07385000
                go to UNIT'FAIL;                               <<02710>>07390000
              IOQ'QMISC := TOS;                                <<07419>>07395000
              if FCODE=WRITEFC then                            <<02671>>07400000
                go to WRITE    <<we gapped to re-write>>       <<02671>>07405000
              else                                             <<02671>>07410000
                go to WRTFMARK;<<we gapped to re-write FM>>    <<02671>>07415000
            END;                                                        07420000
        END;                                                            07425000
                                                                        07430000
      IF DITP(DSAVE).BODEOF=1 THEN                                      07435000
        GOTO EOFOUT;   << BACKSPACE DUE TO DATA EOF >>                  07440000
$PAGE                                                                   07445000
                                                                        07450000
          << CHECK FOR I/O ERRORS >>                                    07455000
                                                                        07460000
      IF CPVAP(1).(14:2) <> 0 THEN  << CHECK UNIT'S STATUS >>           07465000
        BEGIN                                                           07470000
          IF NOT DITPL(DSTAT).ONLINE THEN  << UNIT NOT READY >>         07475000
            BEGIN                                                       07480000
                                                               <<02681>>07485000
              <<if this is a device close, we do NOT want>>    <<02681>>07490000
              <<to hang with a NOT READY message at the  >>    <<02681>>07495000
              <<console if the tape is powered off.      >>    <<02681>>07500000
              if FCODE = DCLOSEFC then                         <<02681>>07505000
                go to GOODEND;                                 <<02681>>07510000
                                                               <<02681>>07515000
              IF IOMESSAGE(1,NOTRDYMSG,%10000,DITP(DLDEV),     <<07419>>07520000
                           ,,,,CONSOLE) THEN                            07525000
                BEGIN                                                   07530000
                  TOS := NOTREADYWAIT;                                  07535000
                  MTSTATE := OPINTRVNTNWAIT;                            07540000
                  GOTO EXIT;                                            07545000
                END;                                                    07550000
              TOS := SYSERROR;                                          07555000
              GOTO BADIO;                                               07560000
            END;                                                        07565000
                                                                        07570000
TESTWRITE:                                                              07575000
          IF FCODE=WRITEFC OR FCODE=WRTFMARKFC OR FCODE=TAPEGAPFC THEN  07580000
            BEGIN                                                       07585000
              IF DITP(DSTAT).FILEPROTECT <> 0 THEN                      07590000
                BEGIN                                                   07595000
                  IF IOMESSAGE(1,NOWRING,%10000,DITP(DLDEV),   <<07419>>07600000
                               ,,,,CONSOLE) THEN                        07605000
                    BEGIN                                               07610000
                      DITP(DTIME) := 0;                                 07615000
                      DITP(DRQST) := TIMEREQ(%20,@DITP,1000D);          07620000
                      MTSTATE := INTRPTWAIT;                            07625000
                      RETURN;                                           07630000
                    END;                                                07635000
                  TOS := SYSERROR;                                      07640000
                  GOTO BADIO;                                           07645000
                END;                                                    07650000
              IF MTSTATE=2 THEN GOTO GOODEND;                           07655000
            END;                                                        07660000
                                                                        07665000
          IF DITP(DSTAT).REJECT <> 0 THEN                               07670000
            BEGIN                                                       07675000
              TOS := UNITFAIL;                                          07680000
              GOTO FAIL;                                                07685000
            END;                                                        07690000
                                                                        07695000
          IF DITP(DSTAT).BUSY <> 0 THEN  << CHECK FOR REWIND COMMAND >> 07700000
            BEGIN                                                       07705000
              IF FCODE = REWINDFC OR FCODE = REWUNLDFC THEN             07710000
                GOTO NOERROR;                                           07715000
              TOS := UNITFAIL;                                          07720000
              GOTO FAIL;                                                07725000
            END;                                                        07730000
                                                                        07735000
          IF DITP(DSTAT).TAPERUN <> 0 THEN                              07740000
            BEGIN                                                       07745000
              TOS := RUNAWAY;                                           07750000
              GOTO FAIL;                                                07755000
            END;                                                        07760000
                                                                        07765000
          IF DITP(DSTAT).TIMING <> 0 THEN                               07770000
            BEGIN                                                       07775000
              TOS := TIMINGERR;                                         07780000
              GOTO RETRYPROCESS;                                        07785000
            END;                                                        07790000
                                                                        07795000
          IF DITP(DSTAT).STERR<>0 AND FCODE=WRITEFC THEN                07800000
            BEGIN                                                       07805000
              TOS := TRANSFERERR;                                       07810000
              GOTO RETRYPROCESS;                                        07815000
            END;                                                        07820000
                                                                        07825000
          IF DITP(DSTAT).TRANSFER <> 0 THEN                             07830000
            BEGIN                                                       07835000
              TOS := TRANSFERERR;                                       07840000
RETRYPROCESS:                                                           07845000
              DITP(DSERR) := [8/2,8/DLOGERROR];                <<04937>>07850000
              DITP(DLOGERROR):= DITP(DSTAT); <<LOG ERROR>>              07855000
              DITP(DLOGERROR+1):= SIOP(STATUS+1);<<LOG ERROR>> <<04937>>07860000
              IF IOQ'QMISC.RTCNTR=15 THEN GOTO BADIO;          <<07419>>07865000
              TOS := IOQ'QMISC + 1;  << BUMP RETRY COUNTER >>  <<07419>>07870000
              TOS.RETRY := 1;                                           07875000
              TOS := TOS LAND %170017;  << ZERO SPACING COUNTERS >>     07880000
              IF FCODE = BACKREADFC THEN                                07885000
                BEGIN                                                   07890000
                  TOS.FORWRD := 1;  << FORWARD SPACE FIRST >>           07895000
                  IOQ'QMISC := TOS;                            <<07419>>07900000
                  GOTO FSRPEOF;                                         07905000
                END;                                                    07910000
              TOS.BACK := 1;                                            07915000
              IOQ'QMISC := TOS;                                <<07419>>07920000
              if FCODE > WRITEFC and FCODE <> WRTFMARKFC then  <<02671>>07925000
                go to BADIO                                    <<02671>>07930000
              else                                             <<02671>>07935000
                go to BSRPEOF;                                 <<02671>>07940000
            END;                                                        07945000
                                                                        07950000
                                                               <<02671>>07955000
          <<if this is a write of a file mark, Boise's drive>> <<02671>>07960000
          <<will respond with a DSJ 1 but not indicate a    >> <<02671>>07965000
          <<single or multiple track error on status.  The  >> <<02671>>07970000
          <<FM bit will NOT be set if the file mark was not >> <<02671>>07975000
          <<successfully written.                           >> <<02671>>07980000
          if FCODE = WRTFMARKFC then                           <<02671>>07985000
            if DITP(DSTAT).EOF <> 1 then                       <<02671>>07990000
              begin  <<we failed to write the file mark>>      <<02671>>07995000
              tos := TRANSFERERR;                              <<02671>>08000000
              go to RETRYPROCESS;                              <<02671>>08005000
              end;                                             <<02671>>08010000
                                                               <<02671>>08015000
        END;                                                            08020000
                                                                        08025000
                                                                        08030000
         << NO I/O ERRORS - COMPLETE PROCESSING >>                      08035000
                                                                        08040000
                                                                        08045000
                                                                        08050000
NOERROR:                                                                08055000
      DITP(DSAVE).RWUNLD := 0;  << RESET UNLOAD FLAG >>                 08060000
      IF <> THEN                                                        08065000
        BEGIN                                                           08070000
          TOS := RINGWAIT;  << WAIT FOR RING MOUNT >>                   08075000
          MTSTATE := OPINTRVNTNWAIT;                                    08080000
          GOTO EXIT;                                                    08085000
        END;                                                            08090000
                                                                        08095000
      IF DITP(DSTAT).EOF=1 THEN  << SET EOF IN LPDT >>                  08100000
LPDT'EOF'TYPE := 1;                                            <<07419>>08105000
                                                               <<07419>>08110000
                                                               <<07419>>08115000
                                                               <<07419>>08120000
                                                               <<07419>>08125000
                                                                        08130000
      IF FCODE=FSRECORDFC OR FCODE=BSRECORDFC OR FCODE=BACKREADFC THEN  08135000
        BEGIN                                                           08140000
          EOFCHECK(IOQ'ENTRY'INDEX,BUFFADDRD,0,0);             <<07419>>08145000
          IF <> THEN GOTO EOFOUT;                                       08150000
        END                                                             08155000
      ELSE IF FCODE=REWINDFC OR FCODE=REWUNLDFC OR FCODE=DCLOSEFC THEN  08160000
        BEGIN                                                           08165000
          IOQ'COUNT := 0;    << SET XLOG TO 0 >>               <<07419>>08170000
          DITP(DSAVE).RWBIT := 1;                                       08175000
          IF FCODE <> REWINDFC OR DITP(DSTAT).LOADP=1 THEN              08180000
            GOTO GOODEND;                                               08185000
          DITP(DSTAT).LOADP := 1;                                       08190000
          MTSTATE := OPINTRVNTNWAIT;                                    08195000
          RETURN;                                                       08200000
        END;                                                            08205000
                                                                        08210000
                                                                        08215000
      IF FCODE=READFC AND XFERCNT <> 0 THEN                             08220000
        BEGIN                                                           08225000
          DITP(DSAVE).SHORT := 0;    << CHECK FOR SHORT READ >>         08230000
          IF <> THEN                                                    08235000
            BEGIN                                                       08240000
              TOS := 6 - SIOP(BYTECNT);                                 08245000
              TOS := IOQ'ENTRY'INDEX;                          <<07419>>08250000
              TOS := 0;                                                 08255000
              TOS := @SIOP(SRBUFF) + SYSDB;                             08260000
              TOS := S3;                                                08265000
              EOFCHECK(*,*,*,0);                                        08270000
              IF > THEN GOTO EOFOUT;                                    08275000
              IF < THEN                                                 08280000
                BEGIN                                                   08285000
                  DITP(DSAVE).BODEOF := 1;                              08290000
                  GOTO BSRPEOF;                                         08295000
                END;                                                    08300000
              IF S0 < XFERCNT THEN XFERCNT := TOS;                      08305000
              TOS := BUFFADDRD;            << DESTINATION ADDRESS >>    08310000
              TOS := 0;                    << SOURCE ADDRESS >>         08315000
              TOS := @SIOP(SRBUFF) + SYSDB;                             08320000
              TOS := (XFERCNT+1)&ASR(1);   << WORD COUNT >>             08325000
              ASMB( MABS );     << MOVE DATA INTO USER'S BUFFER >>      08330000
            END                                                         08335000
          ELSE                                                          08340000
            BEGIN  << NORMAL READ PROCESSING >>                         08345000
              XFERCNT := XFERCNT - SIOP(BYTECNT);                       08350000
              EOFCHECK(IOQ'ENTRY'INDEX,BUFFADDRD,XFERCNT,0);   <<07419>>08355000
              IF <> THEN  << EOF FOUND >>                               08360000
                BEGIN                                                   08365000
                  IF < THEN IOQ'QMISC.BODEOF :=1;              <<07419>>08370000
                  X := IF XFERCNT<127 THEN (XFERCNT+3)&ASR(1) ELSE 128; 08375000
                  TOS := BUFFADDRD;                                     08380000
                  WHILE (X:=X-1)<>0 DO                                  08385000
                    BEGIN  << BLANK OUT USER'S BUFFER >>                08390000
                      TOS := 0;                                         08395000
                      ASMB( SSEA );                                     08400000
                      TOS := TOS + 1;                                   08405000
                    END;                                                08410000
                  IF DITPL(DSAVE).BODEOF THEN GOTO BSRPEOF              08415000
                    ELSE GOTO EOFOUT;                                   08420000
                END;                                                    08425000
            END;                                                        08430000
          IF IOQ'COUNT.IS'IN'BYTES THEN                        <<07419>>08435000
            IOQ'COUNT  := -XFERCNT                             <<07419>>08440000
          ELSE                                                          08445000
            IOQ'COUNT := (XFERCNT+1)&ASR(1);                   <<07419>>08450000
        END                                                             08455000
                                                                        08460000
      ELSE  IF FCODE=WRITEFC OR FCODE=WRTFMARKFC THEN                   08465000
        BEGIN                                                           08470000
          IF DITPL(DSTAT).EOT THEN                                      08475000
            BEGIN                                                       08480000
              TOS := GOODEOT;                                           08485000
              GOTO UNUSUALEND;                                          08490000
            END;                                                        08495000
        END                                                             08500000
                                                                        08505000
      ELSE  IF FCODE = BACKREADFC THEN                                  08510000
        BEGIN                                                           08515000
          XFERCNT := XFERCNT - SIOP(BYTECNT);                           08520000
          IF IOQ'COUNT.IS'IN'BYTES THEN                        <<07419>>08525000
            IOQ'COUNT := -XFERCNT                              <<07419>>08530000
          ELSE                                                          08535000
            IOQ'COUNT := (XFERCNT+1)&ASR(1);                   <<07419>>08540000
          IF DITPL(DSTAT).LOADP THEN                                    08545000
            BEGIN                                                       08550000
              TOS := BREADATBOT;                                        08555000
              GOTO BADIO;                                               08560000
            END;                                                        08565000
        END                                                             08570000
                                                                        08575000
      ELSE                                                              08580000
        IF FCODE = TTCOUNTFC THEN                                       08585000
          IOQ'COUNT := -2                                      <<07419>>08590000
        ELSE                                                            08595000
          IOQ'COUNT := 0;                                      <<07419>>08600000
$PAGE                                                                   08605000
GOODEND:                                                                08610000
FOPEN:                                                                  08615000
FCLOSE:                                                                 08620000
      IF FCODE=DCLOSEFC THEN DITP(DSAVE) := 0;  << CLEAR FLAGS >>       08625000
      TOS := IOQ'QMISC;                                        <<07419>>08630000
      IF < THEN                                                         08635000
        TOS := GOODRETRY                                                08640000
      ELSE                                                              08645000
        TOS := GOODIO;                                                  08650000
                                                                        08655000
UNUSUALEND:                                                             08660000
      MTSTATE := REQUESTDONE;                                           08665000
                                                                        08670000
EXIT:                                                                   08675000
      IOQ'STAT := TOS;                                         <<07419>>08680000
      RETURN;                                                           08685000
                                                                        08690000
                                                                        08695000
                                                                        08700000
  <<  ERROR HANDLING SECTION  >>                                        08705000
                                                                        08710000
CHANERROR:                                                              08715000
      TOS := CHANFAIL;                                                  08720000
      DITP(DSERR):= [8/1,8/DLOGERROR];                                  08725000
      DITP(DLOGERROR):= CPVAP;  <<LOG CHANNEL STATUS>>                  08730000
                                                                        08735000
BADIO:                                                                  08740000
      MASTERCLEARHPIB(DITP);                                            08745000
      DITP(DSAVE) := 0;    << RESET DRIVER BIT FLAGS >>                 08750000
      GOTO UNUSUALEND;                                                  08755000
                                                                        08760000
FAIL:                                                                   08765000
      DITP(DSERR):= [8/2,8/DLOGERROR];                         <<04937>>08770000
      DITP(DLOGERROR):= DITP(DSTAT); <<LOG UNIT'S STATUS>>              08775000
      DITP(DLOGERROR+1):= SIOP(STATUS+1);<<LOG UNIT'S STATUS>> <<04937>>08780000
      GOTO BADIO;                                                       08785000
                                                                        08790000
EOFOUT:                                                                 08795000
      MTSTATE := REQUESTDONE;                                           08800000
      RETURN;                                                           08805000
    END;                                                                08810000
  END;                                                                  08815000
$PAGE "7970 DRIVER OUTER BLOCK FOR INITIAL"                             08820000
  ASMB(                                                                 08825000
    PCAL SIODM;      << MONITOR >>                                      08830000
    PCAL MTDRVR;     << INITIATOR >>                                    08835000
    PCAL MTDRVR;     << COMPLETOR >>                                    08840000
    CON  0;          << NO IO PROCESS >>                                08845000
    PCAL MTINIT;     << INITIALIZATION >>                               08850000
    CON  1;          << ONE INTERRUPT HANDLER >>                        08855000
    PCAL GIP'HPIB);  << INTERRUPT HANDLER >>                            08860000
  END.                                                                  08865000
