$CONTROL USLINIT, CODE                                                  00010000
<< HIOTAPE1, MODULE 41 - TAPE DRIVER SERIES 30/33/44/64  >>             00015000
                                                                        00020000
<< This is an MPE-V driver.>>                                           00025000
                                                                        00030000
<<COPYRIGHT    "(C) COPYRIGHT HEWLETT-PACKARD CO. 1980. ",              00035000
     "THIS PROGRAM MAY BE USED WITH ONE COMPUTER SYSTEM AT A ",         00040000
     "TIME AND SHALL NOT OTHERWISE BE RECORDED, TRANSMITTED OR ",       00045000
     "STORED IN A RETRIEVAL SYSTEM.  COPYING OR OTHER REPRODUCTION ",   00050000
     "OF THIS PROGRAM EXCEPT FOR ARCHIVAL PURPOSES IS PROHIBITED ",     00055000
     "WITHOUT THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY.">>  00060000
$CONTROL PRIVILEGED,UNCALLABLE                                          00065000
$TITLE "HP 7976A MAG TAPE MPE-V DRIVER"                                 00070000
$TP                                                                     00075000
                                                                        00080000
2. Corrected problem with write protocol violation when error           00085000
<<                                                                      00090000
                                                                        00095000
            3000 Series 30/33/44/64 Mangnetic Tape Driver - HIOTAPE1    00100000
            --------------------------------------------------------    00105000
                                                                        00110000
                                                                        00115000
Structure of HIOTAPE1:                                                  00120000
                                                                        00125000
HIOTAPE1, together with the SIO Device Monitor (SIODM) constitute a     00130000
standard MPE Type 1 I/O Driver/Monitor.  This means that it does not    00135000
run in its own process, but executes on any stack and therefore must    00140000
run to completion.  During initialization it executes on PROGEN's       00145000
stack, during request initiation it executes on ATTACHIO's stack, and   00150000
during interrupt processing it executes on the Interrupt Control        00155000
Stack (ICS).                                                            00160000
                                                                        00165000
HIOTAPE1 consists of a global area, two procedures, and an "outer       00170000
block" which is really a linkage area for INITIAL.  The global area     00175000
contains an array called INITIAL which is comprised of three parts.     00180000
The first part specifies the size of the other two, the unit extract    00185000
instruction, and various parameters which are used by INITIAL.  This    00190000
section is deleted after INITIAL is through with it.  The other two     00195000
parts are the Device Information Table (DIT) and the Channel Program    00200000
area, which is part of the Interrupt Linkage Table (ILT).  INITIAL      00205000
will put each of these items in the area of memory where it belongs.    00210000
The linkage area specifies the procedure labels (P-labels) of the       00215000
associated monitor (SIODM), the request initiator (MTDRVR), the         00220000
request completor (MTDRVR), the initialization procedure (MTINIT,       00225000
called by PROGEN at system startup), and the interrupt handler (GIP).   00230000
                                                                        00235000
                                                                        00240000
Operation of HIOTAPE1:                                                  00245000
                                                                        00250000
The primary working code of HIOTAPE1 is a procedure MTDRVR.  MTDRVR is  00255000
called with five parameters.  Two of these parameters, BANK and         00260000
BUFFADDR, are the absolute buffer address of the data to be processed.  00265000
The other three, DITP, IOQP, and SIOP are pointers to three arrays.     00270000
DITP is a pointer to the Device Information Table which contains        00275000
information about its associated mag tape unit.  There is one DIT for   00280000
unit on the controller and they contain information which must be       00285000
saved between I/O requests to the driver.  IOQP is a pointer to the     00290000
Input/Output Queue element.  IOQ elements contain information relevent  00295000
to the current request.  SIOP is a pointer to the first element of the  00300000
Channel Program which is actually part of the Interrupt Linkage Table.  00305000
These three elements are described in more detail elsewhere in this     00310000
listing.                                                                00315000
                                                                        00320000
MTDRVR is always called by the SIO device monitor (SIODM) and it        00325000
determines the reason for the call by examining the IOQ and the DIT.    00330000
When a new request is initiated, MTDRVR examines the function code      00335000
and parameter fields contained in the IOQ element to determine the      00340000
task that is desired.  The proper command codes and program branches    00345000
are then placed in the Channel Program and its execution is begun.      00350000
                                                                        00355000
Upon completion of the request, an interrupt is generated and MTDRVR    00360000
is again called.  The code checks for current activity in progress,     00365000
and this being the case, branches to the completion section of the      00370000
driver.  Here several status words are exaimed for errors or special    00375000
conditions which might have occurred during the execution of the        00380000
Channel Program, during the data transfer, or during the operation of   00385000
the mag tape unit.  These conditions can cause error retries and/or     00390000
special notation back to the caller.  All error retries are done by     00395000
the 26076A controller. A list of the conditions and the return codes    00400000
is provided in this listings.                                           00405000
                                                                        00410000
                                                                        00415000
          Development and Fix History                                   00420000
          ---------------------------                                   00425000
                                                                        00430000
Development Engineer:  Dean Coggins.                                    00435000
                                                                        00440000
Modification History                                                    00445000
                                                                        00450000
James R. Kochanowicz 9/30/83                                            00455000
                                                                        00460000
1. Correct a problem with "not ready" message being printed             00465000
   over. This problem occurs on reel switchs during restore.            00470000
                                                                        00475000
2. Fix protocol violation by driver when it recovers from               00480000
   errors when doing queued commands.                                   00485000
                                                                        00490000
3. Changes made to handle user pressing "reset"  and then               00495000
   "online" when doing queued commands.                                 00500000
                                                                        00505000
4. Return EOF encountered on back record.                               00510000
                                                                        00515000
5. Do not log prior error abort on read.                                00520000
                                                                        00525000
James R. Kochanowicz 12/07/83                                           00530000
                                                                        00535000
1. Corrected problem with powerfail recovery.                           00540000
                                                                        00545000
2. Corrected problem with read protocol violations at BOT.              00550000
                                                                        00555000
James R. Kochanowicz 04/04/84                                           00560000
                                                                        00565000
1. Corrected problem with user's bank address being                     00570000
   computed incorrectly.                                                00575000
                                                                        00580000
2. Corrected problem with write protocol violation when fatal error     00585000
   occurs during a nonqueued write.                                     00590000
                                                                        00595000
Jesse Chin     6/15/84                                                  00600000
                                                                        00605000
1. New function code ENABLE'EOV'CHECK for fixing unspool                00610000
   problem after detecting 2 consecutive EOFs. Caller                   00615000
   resets this function by DEVICE CLOSE call. REWIND,                   00620000
   REWIND/UNLOAD or another ENABLE'EOV'CHECK will reenable              00625000
   the flag. Once the condition is true, the following                  00630000
   commands will be aborted with status PASS'EOV'ABORT:                 00635000
   READ, FORWARD SPACE FILE, GAP TAPE, FORWARD SPACE RECORD.            00640000
                                                                        00645000
2. Use DIT word DSAVE bits 9,10 for the counter.                        00650000
                                                                        00655000
Jesse Chin  7/11/84                                                     00660000
                                                                        00665000
Correct problem with short read buffer address calculation.             00670000
                                                                        00675000
                                                                        00680000
                                                                        00685000
                 Command Queuing                                        00690000
                                                                        00695000
                                                                        00700000
In the case of unblocked write, backread or read,                       00705000
the driver will attempt to keep the tape moving at speed                00710000
by looking ahead at IOQs to see if another operation of the             00715000
same type can be started up before the current operation has            00720000
completed. This is possible because of the two 16k byte buffers         00725000
in the 26076A controller.  This technique is referred to as             00730000
command queuing.  Command queuing is only done on similar               00735000
operations. i.e. Write followed by a write by another write,            00740000
read followed by read, or read backward followed by read backward.      00745000
Examples of illegal operations are a read followed by a write           00750000
or a write followed by a read.                                          00755000
                                                                        00760000
Command queuing is controlled by the following driver substate          00765000
flags.                                                                  00770000
                                                                        00775000
            ( DRIVER SUBSTATES  )                                       00780000
                                                                        00785000
    NEWREQ   = 0, (Brand new request )                                  00790000
                                                                        00795000
    FIRSTBRK = 1, (Request started, first channel program and           00800000
                   wait for first break in channel program)             00805000
                                                                        00810000
    SECNDREQ = 2, (First program done in channel program and wait       00815000
                   for completion of first channel program for          00820000
                   next request)                                        00825000
                                                                        00830000
    FINLCOMP = 3, (Started second program in channel program            00835000
                   and wait for final completion of second)             00840000
                                                                        00845000
                                                                        00850000
    FINISH   = 4, (Second half of channel program for                   00855000
                   write request is done)                               00860000
                                                                        00865000
    ERRSTD   = 7, (Error occurred on first half of a write              00870000
                   command and this request has already been            00875000
                   completed with an error status)                      00880000
                                                                        00885000
                                                                        00890000
$PAGE                                                                   00895000
                                                                        00900000
                                                                        00905000
            SUBSTATE CHANGES FOR QUEUING                                00910000
                                                                        00915000
READ                                                                    00920000
                                                                        00925000
(1) Send motion command for R1                                          00930000
(2) Send 2nd motion command for R2.                                     00935000
(3) Set up channel program for data transfer for R1.                    00940000
(4) Process completion status for R1.                                   00945000
    Now R's get bumped by 1                                             00950000
                                                                        00955000
                                                                        00960000
                                                                        00965000
    READ        |     R1         |     R2        |     R3               00970000
-----------------------------------------------------------------       00975000
  CALL SIODM    | (1) NEWREQ     | -----         | -----                00980000
    EXIT        | FIRSTBRK       | -----         | -----                00985000
-----------------------------------------------------------------       00990000
  INTERRUPT (R1)| (2) FIRSTBRK   | NEWREQ        | -----                00995000
    EXIT        | SECNDREQ       | FIRSTBRK      | -----                01000000
-----------------------------------------------------------------       01005000
  INTERRUPT (R2)| (3) SECDNREQ   | FIRSTBRK      | -----                01010000
    EXIT        | FINLCOMP       | FIRSTBRK      | -----                01015000
-----------------------------------------------------------------       01020000
  INTERRUPT (R1)| (4) FINLCOMP   | FIRSTBRK      | -----                01025000
    EXIT        | EXIT           | FIRSTBRK      | -----                01030000
-----------------------------------------------------------------       01035000
  CALL SIODM    | -----          | (2) FIRSTBRK  | NEWREQ               01040000
    EXIT        | -----          | SECNDREQ      | FIRSTBRK             01045000
-----------------------------------------------------------------       01050000
  INTERRUPT (R3)| -----          | (3) SECDNREQ  | FIRSTBRK             01055000
    EXIT        | -----          | FINLCOMP      | FIRSTBRK             01060000
-----------------------------------------------------------------       01065000
  INTERRUPT (R2)| -----          | (4) FINLCOMP  | FIRSTBRK             01070000
    EXIT        | -----          | EXIT          | FIRSTBRK             01075000
-----------------------------------------------------------------       01080000
                                                                        01085000
                                                                        01090000
$PAGE                                                                   01095000
WRITE                                                                   01100000
                                                                        01105000
(1) Send motion and data command for W1                                 01110000
(2) Send motion and data command for W2                                 01115000
(3) Set up channel program to check write status for W1.                01120000
(4) Process completion status for W1.                                   01125000
    Now W's get bumped by 1                                             01130000
                                                                        01135000
                                                                        01140000
                                                                        01145000
    WRITE       |     W1         |     W2        |     W3               01150000
-----------------------------------------------------------------       01155000
  CALL SIODM    | (1) NEWREQ     | -----         | -----                01160000
    EXIT        | FIRSTBRK       | -----         | -----                01165000
-----------------------------------------------------------------       01170000
  INTERRUPT (R1)| (2) FIRSTBRK   | NEWREQ        | -----                01175000
    EXIT        | SECNDREQ       | FIRSTBRK      | -----                01180000
-----------------------------------------------------------------       01185000
  INTERRUPT (R2)| (3) SECDNREQ   | FIRSTBRK      | -----                01190000
    EXIT        | FINLCOMP       | FIRSTBRK      | -----                01195000
-----------------------------------------------------------------       01200000
  INTERRUPT (R1)| (4) FINLCOMP   | FIRSTBRK      | -----                01205000
    EXIT        | EXIT           | FIRSTBRK      | -----                01210000
-----------------------------------------------------------------       01215000
  CALL SIODM    | -----          | (2) FIRSTBRK  | NEWREQ               01220000
    EXIT        | -----          | SECNDREQ      | FIRSTBRK             01225000
-----------------------------------------------------------------       01230000
  INTERRUPT (R3)| -----          | (3) SECDNREQ  | FIRSTBRK             01235000
    EXIT        | -----          | FINLCOMP      | FIRSTBRK             01240000
-----------------------------------------------------------------       01245000
  INTERRUPT (R2)| -----          | (4) FINLCOMP  | FIRSTBRK             01250000
    EXIT        | -----          | EXIT          | FIRSTBRK             01255000
-----------------------------------------------------------------       01260000
                                                                        01265000
                                                                        01270000
$PAGE                                                                   01275000
                                                                        01280000
                     Device Reference Table (DRT)                       01285000
                     ----------------------------                       01290000
                                                                        01295000
                                                                        01300000
There is one DRT for each device controller configured on the system.   01305000
                                                                        01310000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01315000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01320000
  0|      Channel Program Pointer  (SIOP)          |   DRT0             01325000
   +-----------------------------------------------+                    01330000
  1|  Channel Program Variable Area pointer (CPVA) |   DRT1             01335000
   +-----------------------------------------------+                    01340000
  2|      Interrupt Handler Program Label          |   DRT2             01345000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01350000
  3|ST|SH|PF|      ( status )          |WS|GF|DT|WT|   DRT3             01355000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01360000
                                                                        01365000
 Channel Program Status:                                                01370000
                                                                        01375000
   Bit 0  - ST, Channel Program Status; 0 - halted, 1 - running         01380000
       1  - SH, SIOP or HIOP instruction pending                        01385000
       2  - PF, Power Fail recovery in progress                         01390000
      12  - WS, Waiting for device status request                       01395000
      13  - GF, GIC FIFO buffer not empty                               01400000
      14  - DT, DMA transfer active                                     01405000
      15  - WT, Channel Program in Wait state                           01410000
                                                                        01415000
$PAGE                                                                   01420000
                Device Information Table (DIT)                          01425000
                ------------------------------                          01430000
                                                                        01435000
                                                                        01440000
There is one DIT per physical device.  If a physical device represents  01445000
more than one logical device, the logical device number is obtained     01450000
from the IOQ element.  The following diagram shows the DIT used for     01455000
the mag tape driver.                                                    01460000
                                                                        01465000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01470000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01475000
  0| 0| 0|AC|RQ| 0|MU| 0|IO|IA|NO|ST| 0|   STATE   |   DFLAG            01480000
   +--+--+--+--+--+--+--+--+--+--+--+--+-----------+                    01485000
  1| SYSDB relative pointer to the DIT for the next|   DLINK            01490000
   | device requesting this resource or service    |                    01495000
   +-----------------------------------------------+                    01500000
  2| SYSDB relative pointer to the first IOQ in    |   DIOQP            01505000
   | request list for this device                  |                    01510000
   +--------+--------------+-----------------------+                    01515000
  3|            Logical device number              |   DLDEV            01520000
   +--------+--------------+-----------------------+                    01525000
  4| SYSDB relative pointer to Device Linkage Table|   DDLTP            01530000
   +-----------------------------------------------+                    01535000
  5| SYSDB relative pntr to Interrupt Linkage Table|   DILTP            01540000
   +--+--+--+--+--+--+--------------------------+--+                    01545000
  6|RW|RU|SH|     |PF|          |EOV|           |PA|   DSAVE            01550000
   +--+--+--+--+--+--+--------------------------+--+                    01555000
  7| Hardware error status.  Set when the driver   |   DSERR            01560000
   | detects an error.  Whenever <>0, the driver   |                    01565000
   | monitor logs an I/O error and clears this word|                    01570000
   +-----------------------------------------------+                    01575000
%10| Bit 0 is set at completion of timer           |   DTIME            01580000
   +-----------------------------------------------+                    01585000
%11| Interrupt status for this unit.  Set by the   |   DSTAT            01590000
   | driver each time it processes an interrupt.   |                    01595000
   +-----------------------------------------------+                    01600000
%12| IOT    |///////////|  Physical unit number    |   DUNIT            01605000
   +-----------------------------------------------+                    01610000
%13| Holds the time out request entry index while  |   DRQST            01615000
   | a timer is active.                            |                    01620000
   +-----------------------------------------------+                    01625000
%14| Error log. Contains 5 valid bytes of status   |   DLOGERROR        01630000
   +-----------------------------------------------+                    01635000
                                                                        01640000
                                                                        01645000
DFLAG - Flags and request state                                         01650000
  AC  ACTIVE  - A monitor is currently servicing this device.           01655000
  RQ  REQUEST - A service request is pending while the monitor is       01660000
                active.                                                 01665000
  MU  MUNIT   - This device is on a multi-unit controller.              01670000
  IO  IOPROG  - An I/O Channel Program is running for this device.      01675000
  IA  IAK     - An interrupt or response has occurred for this device.  01680000
  NO  NOTRDY  - Go to state %10 after Idle Channel Program is started.  01685000
  ST  STWAIT  - The device monitor is starting an Idle Channel Program  01690000
                for this device.  There is no IOQ associated with this  01695000
                type of request.                                        01700000
  STATE       - State of the device monitor.  Specifies the next action 01705000
                to be taken in SIODM in servicing the request:          01710000
                  0 - start new request                                 01715000
                  1 - not used                                          01720000
                  2 - call driver initiator procedure                   01725000
                  3 - call driver completor procedure                   01730000
                  4 - not used                                          01735000
                  5 - process request completed                         01740000
                  6 - initiate device recognition sequence              01745000
                  7 - start operator intervention wait                  01750000
                %10 - wait for interrupt (operator intervention)        01755000
                      restart at state 0                                01760000
                %11 - wait for data segment freeze, then state 2        01765000
                %12 - wait for driver initiator to be frozen, then      01770000
                      allocate controller (state 2)                     01775000
                %13 - wait for I/O completion interrupt, then state 3   01780000
                %14 - wait for controller, then call driver initiator   01785000
                %15 - not used                                          01790000
                %16 - wait for initiator make present, then state 2     01795000
                %17 - wait for completor make present, then state 3     01800000
                                                                        01805000
DSAVE - Device processing flags                                         01810000
                                                                        01815000
  RW  RWBIT  - Indicates tape has been rewound.                         01820000
  RU  RWUNLD - Indicates that a rewind/unload was performed to allow a  01825000
               write-ring mount.                                        01830000
  SH  SHORT  - A short read is in progress.  After completion of read,  01835000
               EOF is checked for and if not present, the requested     01840000
               bytes are transfered from the short-read buffer to the   01845000
               user's buffer.                                           01850000
  PF  POWER  - Device power up indication.                              01855000
  PA  PENDING ABORT - An abort is pending for a command queued IOQ.     01860000
  FO  FIRST OPERATION - The first read or write after a rewind          01865000
              rcommand is not done in queuing mode.                     01870000
  EOV End'Of'Volume - enable check on 2 consecutive EOFs.               01875000
                                                                        01880000
DSTAT - Mag tape controller status                                      01885000
                                                                        01890000
  BITS         USE                                                      01895000
                                                                        01900000
    0     END OF FILE (EOF)                                             01905000
                                                                        01910000
    1     BEGINNING OF TAPE (BOT) / LOAD POINT (LP)                     01915000
    2     END OF TAPE (EOT)                                             01920000
    3     SINGLE TRACK ERROR (NOT LOGGED FOR READS)                     01925000
                                                                        01930000
    4     COMMAND REJECT (REJECT)                                       01935000
    5     FILE PROTECT (NOT WRITE ENABLED; NO WRITE RING)               01940000
    6     MULTIPLE TRACK ERROR (MTE)                                    01945000
                                                                        01950000
    7     UNIT ONLINE                                                   01955000
    8     GCR (6250 BPI DENSITY)                                        01960000
    9     UNIT NUMBER (MSB)                                             01965000
                                                                        01970000
   10     UNIT NUMBER (LSB)                                             01975000
   11     TIMING ERROR                                                  01980000
   12     TAPE RUNAWAY                                                  01985000
                                                                        01990000
   13     REWINDING       *                                             01995000
   14     UNIT BUSY       **  (REPORTED AS UNIT NOT READY)              02000000
   15     INTERFACE BUSY  *                                             02005000
$PAGE                                                                   02010000
                Interrupt Linkage Table (ILT)                           02015000
                -----------------------------                           02020000
                                                                        02025000
                                                                        02030000
There is one ILT for each device controller configured on the system.   02035000
                                                                        02040000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          02045000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    02050000
  0|         Channel                               |   ICPVA0           02055000
  1|              Program                          |   ICPVA1           02060000
  2|                  Variable                     |   ICPVA2           02065000
  3|                       Area (ICPVA)            |   ICPVA3           02070000
   +-----------------------------------------------+                    02075000
  4|         DMA Abort                             |   ICPVA4           02080000
  5|              Address                          |   ICPVA5           02085000
   +-----------------------------------------------+                    02090000
  6|                      0                        |   ISRQL            02095000
   +--+-----------------+-----+-----------+--------+                    02100000
  7|LI|     CHANQUE     |     |   CHAN    |  DEV   |   ICNTRL           02105000
   +--+-----------------+-----+-----------+--------+                    02110000
%10| SYSDB relative pointer to Channel Program area|   ISIOP            02115000
   +-----------------------------------------------+                    02120000
%11| SYSDB relative pointer to Status Return area. |   ISTAP            02125000
   +-----------------------------------------------+                    02130000
%12| Single instruction that is executed to extract|   IUNIT            02135000
   | the device unit number from the status pointed|                    02140000
   | to by ISTAP.                                  |                    02145000
   +-----------------------------------------------+                    02150000
%13| SYSDB relative DIT pointer of the device      |   ICDP             02155000
   | currently using the channel to perform a      |                    02160000
   | data operation.                               |                    02165000
   +-----------------------+-----------------------+                    02170000
%14|       SIOPSIZE        |        CQUEN          |   IQUEUE           02175000
   +--+--+--+--------------+-----------+-----------+                    02180000
%15|RW|WP|IG|                          |  HCUNIT   |   IFLAG            02185000
   +--+--+--+--------------------------+-----------+                    02190000
%16| SYSDB relative DIT pointer for unit 0     *   |   IDITP0           02195000
   +-----------------------------------------------+                    02200000
%17|        Idle Channel Program                   |                    02205000
%20|            Status Return Area                 |                    02210000
%21|                                               |                    02215000
   +-----------------------------------------------+                    02220000
%22|             Mag Tape                          |                    02225000
   .               Channel                         .                    02230000
   |                 Program                       |                    02235000
   +-----------------------------------------------+                    02240000
                                                                        02245000
* This driver does not support more than one unit.                      02250000
                                                                        02255000
                                                                        02260000
ICPVA0 - Channel Program Variable Area                                  02265000
                                                                        02270000
  The first word is used by the channel program processor to store      02275000
  status information after I/O channel aborts.  The next word is used   02280000
  by the driver to indicate if status should be examined for special    02285000
  conditions or errors.  The other two words are not used.              02290000
                                                                        02295000
                                                                        02300000
ICPVA4 - DMA abort address                                              02305000
                                                                        02310000
  If a DMA abort occurs, the absolute address where the abort occurred  02315000
  is stored in this area.                                               02320000
                                                                        02325000
                                                                        02330000
ICNTRL - Contains controller information                                02335000
                                                                        02340000
  LIM     - If this bit is set, the controller is sharing a software    02345000
            channel resource in order to limit bandwidth.               02350000
  CHANQUE - The software channel resource number.                       02355000
  CHAN    - Channel number (four most significant bits of DRTN).        02360000
  DEV     - Device number (three least significant bits of DRTN).       02365000
                                                                        02370000
                                                                        02375000
IQUEUE -                                                                02380000
                                                                        02385000
  SIOPSIZE - (number of words + 1)/2 in the channel program area.       02390000
  CQUEN    - For a multi-unit controller this field contains the        02395000
             software controller resource number.                       02400000
                                                                        02405000
                                                                        02410000
IFLAG - Controller and Channel Program state flags                      02415000
                                                                        02420000
  RUNWAIT  - An Idle Channel Program should be started when there       02425000
             are no active requests to process.                         02430000
  WAITPROG - An Idle Channel Program has been started for this          02435000
             controller.  This bit is reset by an interrupt.            02440000
  IGNOREHI - An HIOP instruction has been issued against this	          02445000
             controller but the channel program was not in a wait       02450000
             statement.  Therefore ignore the interrupt generated by    02455000
             the channel code when this program halts.                  02460000
  HCUNIT   - Highest configured unit number for this controller.        02465000
                                                                        02470000
                                                                        02475000
IDLE CHANNEL PROGRAM STATUS WORDS                                       02480000
                                                                        02485000
The idle channel program status consists of five bytes                  02490000
                                                                        02495000
                                                                        02500000
                                                                        02505000
  The first two bytes are the same as the                               02510000
  DSTAT in the DIT.                                                     02515000
                                                                        02520000
  BITS         USE                                                      02525000
                                                                        02530000
    0     End of file (eof)                                             02535000
                                                                        02540000
    1     Beginning of tape (BOT) / load point (LP)                     02545000
    2     End of tape (EOT)                                             02550000
    3     Single track error (not logged for reads)                     02555000
                                                                        02560000
    4     Command reject (reject)                                       02565000
    5     File protect (not write enabled; no write ring)               02570000
    6     Multiple track error (MTE)                                    02575000
                                                                        02580000
    7     Unit online                                                   02585000
    8     GCR (6250 BPI DENSITY)                                        02590000
    9     Unit number (MSB)                                             02595000
                                                                        02600000
   10     Unit number (LSB)                                             02605000
   11     Timing error                                                  02610000
   12     Tape runaway                                                  02615000
                                                                        02620000
   13     Rewinding       *                                             02625000
   14     Unit busy       **  (reported as unit not ready)              02630000
   15     Interface busy  *                                             02635000
                                                                        02640000
  The next two bytes of the status are:                                 02645000
                                                                        02650000
  Bit:    Meaning                                                       02655000
  0       Reserved.                                                     02660000
  1       MTU/FCU Down  Unit waiting for power.                         02665000
  2       Power restored                                                02670000
  3       Parity Error                                                  02675000
  4       Position Unrecovered                                          02680000
  5       Formatter/Controller and Tape Unit                            02685000
  6       Interface Controller(IFC) (FCU s.m.)                          02690000
  7       Interface Controller(IFC) (incl. PHI s.m.)                    02695000
  10-8    Error Details (binary)                                        02700000
          000=Null Code                                                 02705000
          001=Data Parity Error                                         02710000
          010=FCU/MTU Reject                                            02715000
          011=Protocol Reject                                           02720000
          100=Timeout Reject                                            02725000
          101=Prior Error Reject                                        02730000
          110=Rom Parity Error                                          02735000
          111=Self Test Failure Error                                   02740000
                                                                        02745000
 11-15    Retry Count                                                   02750000
                                                                        02755000
The contents of the last word depends on the bits                       02760000
from the first status word.                                             02765000
                                                                        02770000
  If Format Failure is asserted the register will be                    02775000
  encoded with the return code from the FCU.                            02780000
                                                                        02785000
  If MTE is asserted the register will be encoded with                  02790000
  the error mux. lines.                                                 02795000
                                                                        02800000
  If internal failure is asserted this register will be                 02805000
  encoded with the actual error condition flagged.                      02810000
  If self test failure is asserted this register will be                02815000
  encoded with the type of self test failure condition.                 02820000
$PAGE                                                                   02825000
            I/O QUEUE ELEMENT (IOQ)                                     02830000
            -----------------------                                     02835000
                                                                        02840000
                                                                        02845000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          02850000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    02855000
  0|      Request dependent flags (see below)      |   QFLAG            02860000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    02865000
  1| SYSDB relative pointer to next IOQ element.   |   QLINK            02870000
   | Points to first word of element.              |                    02875000
   +-----------------------+-----------------------+                    02880000
  2|                       | Logical device number |   QLDEV            02885000
   +--+--------+--+-----+--------+-----+-----------+                    02890000
  3|CO|        |BO|     |SUBS    |     | RTCNTR    |   QMISC            02895000
   +--+--------+--+-----+--------+-----+-----------+                    02900000
  4| S| If QFLAG.(3:1) is clear then this is the   |   QDSTN            02905000
   |  | DST number of the target data segment.  If |                    02910000
   |  | S is set, QADDR is DB relative.            |                    02915000
   +--+--------------------------------------------+                    02920000
  5| Offset in the data segment or system buffer   |   QADDR            02925000
   | table to the target data buffer.              |                    02930000
   +-----------------------+-----------------------+                    02935000
  6| Unit number           | Function code for     |   QFUNC            02940000
   |                       | this request.  (See   |                    02945000
   |                       | next section.)        |                    02950000
   +-----------------------+-----------------------+                    02955000
  7| On initiation, specifies the word count (>0)  |   QWBCT            02960000
   | or byte count (<0).  At completion of the     |                    02965000
   | request this location contains the actual     |                    02970000
   | transmission count in the same units (bytes   |                    02975000
   | or words) as in the request.                  |                    02980000
   +-----------------------------------------------+                    02985000
%10| Parameter 1.  Used only for reads.  Contains  |   QPAR1            02990000
   | the EOF specification in bits (13:3).         |                    02995000
   +-----------------------------------------------+                    03000000
%11| Parameter 2.  Used only for writes.  If bit   |   QPAR2            03005000
   | (13:1) is set, writing past EOT is allowed.   |                    03010000
   +-----------------------+--------------+--------+                    03015000
%12|///////////////////////|  QUALIFIER   | STATUS |   QSTAT            03020000
   +-----------------------+--------------+--------+                    03025000
%13|                     PCBN                      |   QPCBN            03030000
   +-----------------------------------------------+                    03035000
                                                                        03040000
                                                                        03045000
QFLAG - Request dependent flags                                         03050000
                                                                        03055000
  Bit 0  ABORT     - Abort this request and return an error indication  03060000
                     to the caller.                                     03065000
  Bit 1  SPECIAL   - Apply special handling to this request.  (Not used)03070000
  Bit 2  DIAG      - This is a request from the diagnostic subsystem.   03075000
                     (Not used)                                         03080000
  Bit 3  SYSBUFF   - Target is an index relative to the SBUF Table of   03085000
                     the data buffer.                                   03090000
  Bit 4  IOWAKE    - Wake caller on completion of request.              03095000
  Bit 5  BLOCKED   - Blocked I/O.  The caller is waited in ATTACHIO     03100000
                     until the request is completed.  Implies IOWAKE.   03105000
  Bit 6  COMPLETED - The request has been completed and the caller      03110000
                     awakened if he had requested (with IOWAKE).        03115000
  Bit 7  DATAFRZN  - Set by the memory management routines (MAM) when a 03120000
                     MAKEPRESENT request is successfully completed and  03125000
                     indicates the data segment is frozen in memory.    03130000
  Bit 8  MAMERRORD - An error has occurred while MAM was trying to      03135000
                     make the target data segment present and freeze    03140000
                     it in memory.                                      03145000
  Bit 9  PREQ      - (Not used)                                         03150000
  Bit 10 SFAIL     - Delayed failure of SIO instruction.  If a call to  03155000
                     START'HPIB resulted in the request being added to  03160000
                     the channel queue, this bit indicates that the SIO 03165000
                     instruction failed when the request was selected   03170000
                     for execution.                                     03175000
  Bit 11 PFAIL     - The request was aborted because of a system power  03180000
                     failure.                                           03185000
                                                                        03190000
                                                                        03195000
QMISC - Driver request dependent flags.                                 03200000
                                                                        03205000
  RTCNTR   - Retry count for a read or a write.                         03210000
  C        - Driver is in command queueing mode.                        03215000
  SUBS     - Driver substate for command queueing                       03220000
  BODEOF   - Backspace record due to a data EOF processing              03225000
             in progress.                                               03230000
                                                                        03235000
                                                                        03240000
QSTAT - PCB number and request completion status.                       03245000
                                                                        03250000
  PCBN    - The Process Control Block (PCB) number of the process       03255000
            which made this request.  If zero, the request is not       03260000
            associated with any process and the IOQ element is to       03265000
            be returned by the system when the request has completed.   03270000
  STATUS  - General status indicating the final state of the request.   03275000
            The following codes are used:                               03280000
              0 - Not started or awaiting completion.                   03285000
              1 - Successful completion.                                03290000
              2 - End-of-file detected.                                 03295000
              3 - Unusual, but recoverable, condition detected.         03300000
              4 - Irrecoverable error has occurred.                     03305000
  QUALIFIER - A code which further defines or qualifies the general     03310000
              status.  (See the section Driver Return Status Codes.)    03315000
                                                                        03320000
$PAGE                                                                   03325000
                                                                        03330000
THE FOLLOWING INFORMATION IS PERTINENT TO CONFIGURING THE               03335000
DEVICE INTO AN HP3000 COMPUTER SYSTEM.                                  03340000
                                                                        03345000
DEVICE TYPE    =24                                                      03350000
DEVICE SUBTYPE =1                                                       03355000
RECORD WIDTH   =128 WORDS                                               03360000
                                                                        03365000
                                                                        03370000
                                                                        03375000
                                                                        03380000
           MAG TAPE REQUEST CODES                                       03385000
           ----------------------                                       03390000
                                                                        03395000
                                                                        03400000
   0 - READ                                                             03405000
         P1(13:3) - END OF FILE SPECIFICATION                           03410000
   1 - WRITE                                                            03415000
         P2(13:1) - IF SET THEN WRITE PAST END OF TAPE MARK             03420000
                    IF CLEAR THEN RETURN ERROR IF EOT HAS BEEN DETECTED 03425000
   2 - OPEN FILE (NO OPERATION)                                         03430000
   3 - CLOSE FILE (RESET EOF FLAGS IN LPDT)                             03435000
   4 - CLOSE DEVICE (RESET EOF FLAGS AND REWIND TAPE)                   03440000
   5 - REWIND                                                           03445000
   6 - WRITE FILE MARK                                                  03450000
   7 - FORWARD SPACE FILE                                               03455000
   8 - BACKSPACE FILE                                                   03460000
   9 - REWIND AND UNLOAD                                                03465000
  10 - GAP TAPE                                                         03470000
  11 - FORWARD SPACE RECORD                                             03475000
  12 - BACKSPACE RECORD                                                 03480000
  13 - READ RECORD BACKWARDS                                            03485000
  14 - SUPPLY TOTAL RECORD BYTE COUNT                                   03490000
  15 - READ STATUS                                                      03495000
  16 - SET DENSITY                                                      03500000
  17 - DOWNLOAD DIAGNOSTIC MONITOR ROUTINE                              03505000
  18 - DOWNLOAD AND RUN DIAGNOSTIC                                      03510000
  19 - READ DIAGNOSTIC STATUS                                           03515000
  20 - PERFORM HPIB LOOPBACK                                            03520000
  21 - PERFORM SELF TEST                                                03525000
  22 - END DIAGNOSTIC MODE                                              03530000
                                                                        03535000
                                                                        03540000
$PAGE                                                                   03545000
The following is a description of each of the mag tape                  03550000
request codes.                                                          03555000
                                                                        03560000
Read- This command transfers data from the tape to the                  03565000
      user until a record mark or an EOF is found                       03570000
                                                                        03575000
Write- This command transfers data and automatically writes             03580000
       a record mark following the transfer of data.                    03585000
                                                                        03590000
Open File -No operation. Returns good status.                           03595000
                                                                        03600000
Close file- Reset EOF flags in LPDT. Returns good status.               03605000
                                                                        03610000
Rewind- This command causes the transport to rewind the tape            03615000
        at 250 ips until load point.                                    03620000
                                                                        03625000
Write File Mark- This command causes a file mark to be                  03630000
                 written on the tape.                                   03635000
                                                                        03640000
Foward Space File- This command causes the final position of            03645000
                   the tape to be immediately following the             03650000
                   EOF just read and just preceeding the next           03655000
                   record or file mark.                                 03660000
                                                                        03665000
Backspace File- Similar to Forward Space File, motion stops             03670000
                after the first file mark or load point is              03675000
                detected in a reverse direction.                        03680000
                                                                        03685000
Rewind and Unload- The tape is rewound and unloaded.                    03690000
                                                                        03695000
Gap Tape- This command allows the user to forward space                 03700000
          erase approximately 3.6 inches of tape in PE                  03705000
          mode and 3.4 in GCR mode                                      03710000
                                                                        03715000
Foward Space Record- The tape is moved in a forward direction           03720000
                     until an Inter-Record gap or EOF or EOT            03725000
                     is detected. The drive motion stops when           03730000
                     a record mark or EOF is detected but               03735000
                     continues running when an EOT is found.            03740000
                     If no EOF or record is encountered, tape           03745000
                     runaway status is returned and motion stops.       03750000
                                                                        03755000
Backspace Record- Similar to Foward Space File/Record. Motion stops     03760000
                  after the first file mark or load point is detected   03765000
                  in a reverse direction.                               03770000
                                                                        03775000
Record Backwards- This command is similar to the Read record            03780000
                  in the forward direction. But the order of            03785000
                  the data will be reversed.                            03790000
                                                                        03795000
Supply Total Record Byte Count- Gives the number of bytes of            03800000
                                data read or written to tape.           03805000
                                                                        03810000
Read Status- This command returns 5 bytes of status informa-            03815000
             tion.                                                      03820000
                                                                        03825000
$PAGE                                                                   03830000
Set Density- Sets the unit to either GCR (6250) mode or to              03835000
             PE (1600) mode.                                            03840000
                                                                        03845000
Download diagnostic monitor- This needs to be done before requests      03850000
                             requests 17 and 18.                        03855000
                                                                        03860000
Download and run diagnostic routine- This runs various                  03865000
                            diagnostic routines.                        03870000
                                                                        03875000
Read Diagostic Status- The results of a diagnostic routine              03880000
                       are returned.                                    03885000
                                                                        03890000
Perform HPIB Loopback- Assures correct operation of the                 03895000
                       HPIB communication link(PHI and                  03900000
                       Z80A processor).                                 03905000
                                                                        03910000
Peform Self Test- The unit performs internal tests.                     03915000
                                                                        03920000
End Diagnostic Mode- Must be used to get out of diagnostic              03925000
                     functions 17 and 18.                               03930000
                                                                        03935000
$PAGE                                                                   03940000
                       DRIVER RETURN STATUS CODES                       03945000
                       --------------------------                       03950000
                                                                        03955000
                                                                        03960000
 GENERAL STATUS (13:3)       QUALIFYING STATUS (8:5)      OVERALL (8:8) 03965000
  0 - PENDING               1 - WAITING FOR COMPLETION         %10      03970000
                            2 - ERROR RECOVERY WAIT            %20      03975000
                            3 - NOT READY WAIT                 %30      03980000
                            4 - NO WRITE RING WAIT             %40      03985000
                                                                        03990000
  1 - SUCCESSFUL            0 - NO ERRORS                        1      03995000
                            2 - RETRY WAS NECESSARY            %21      04000000
                            3 - EOT AFTER WRITE                %31      04005000
                            4 - BOT AFTER BACK-READ            %41      04010000
                                                                        04015000
  2 - END OF FILE           1 - A TAPE MARK WAS READ                    04020000
                                OR P1 WAS NONZERO AND                   04025000
                                THE LAST RECORD READ                    04030000
                                WAS A TAPE MARK                %12      04035000
                          2-7 - A DATA DEPENDENT EOF                    04040000
                                CONDITION AS SPECIFIED                  04045000
                                BY EOFCHECK                             04050000
                                                                        04055000
 3 - UNUSUAL CONDITION      3 - REQUEST ABORTED                %33      04060000
                            4 - PRIOR'ERR'ABORT                %43      04065000
                            5 - PASS'EOV'ABORT                 %53      04070000
                            6 - POWERFAIL ABORT                %63      04075000
                            7 - BOT AND BACKSPACE REQUESTED    %73      04080000
                          %10 - TAPE RUNAWAY                  %103      04085000
                          %11 - EOT AND WRITE REQUESTED       %113      04090000
                          %21 - DEVICE POWERED UP             %213      04095000
                          %22 - BOT AND BACK-READ REQUESTED   %223      04100000
                                                                        04105000
 4 - IRRECOVERABLE ERROR    0 - INVALID REQUEST                  4      04110000
                            1 - TRANSMISSION ERROR             %14      04115000
                            3 - TIMING ERROR                   %34      04120000
                            4 - SIO FAILURE                    %44      04125000
                            5 - UNIT FAILURE                   %54      04130000
                          %12 - SYSTEM ERROR                  %124      04135000
                          %14 - CHANNEL FAILURE               %144      04140000
                                                                        04145000
                                                                        04150000
>>                                                                      04155000
$CONTROL MAP, PRIVILEGED                                                04160000
                                                                        04165000
$title "Buckhorn Mag Tape MPE I/O Driver."                              04170000
                                                                        04175000
begin                                                                   04180000
                                                                        04185000
$INCLUDE INCLLPDT                                                       04190000
$PAGE                                                                   04195000
$INCLUDE INCLIOQ                                                        04200000
                                                                        04205000
$title "HP 7976A MAG TAPE MPE-V DRIVER"                                 04210000
                                                                        04215000
  equate                                                                04220000
                                                                        04225000
<< Function Codes.>>                                                    04230000
                                                                        04235000
    FC'READ           =  0,                                             04240000
    FC'WRITE          =  1,                                             04245000
    FC'OPEN'FILE      =  2,                                             04250000
    FC'CLOSE'FILE     =  3,                                             04255000
    FC'CLOSE'DEVICE   =  4,                                             04260000
    FC'REWIND         =  5,                                             04265000
    FC'FILE'MARK      =  6,                                             04270000
    FC'NEXT'FILE      =  7, << Forward space to next file.   >>         04275000
    FC'PREV'FILE      =  8, << Backspace to previous file.   >>         04280000
    FC'REWIND'OFFLINE =  9,                                             04285000
    FC'TAPE'GAP       = 10,                                             04290000
    FC'FOR'SPACE'REC  = 11, << Forward space to next record. >>         04295000
    FC'BAC'SPACE'REC  = 12, << Back space to previous record.>>         04300000
    FC'BACK'READ      = 13, << Read backwards.               >>         04305000
    FC'TRANSFER'COUNT = 14, << Byte count, prior transfer.   >>         04310000
    FC'READ'STATUS    = 15,                                             04315000
    FC'DENSITY        = 16,                                             04320000
    FC'LOAD'DIAG'17   = 17,                                             04325000
    FC'LOAD'DIAG'18   = 18,                                             04330000
    FC'DIAG'STATUS    = 19, << Read diagnostic status.       >>         04335000
    FC'LOOPBACK       = 20,                                             04340000
    FC'SELFTEST       = 21,                                             04345000
    FC'END'DIAG       = 22,                                             04350000
    FC'ENABLE'EOV'CHECK = 128, << Enable End Of Vol check >>   <<J8873>>04355000
                                                                        04360000
<< Mag Tape Commands.>>                                                 04365000
                                                                        04370000
    TC'WRITE          =   5,                                            04375000
    TC'FILE'MARK      =   6,                                            04380000
    TC'TAPE'GAP       =   7,                                            04385000
    TC'READ           = %10,                                            04390000
    TC'FOR'SPACE'REC  = %11, << Forward space to next record.>>         04395000
    TC'BAC'SPACE'REC  = %12, << Back space to prior record.  >>         04400000
    TC'NEXT'FILE      = %13, << Forward space to next file.  >>         04405000
    TC'PREV'FILE      = %14, << Back space to prior file.    >>         04410000
    TC'REWIND         = %15,                                            04415000
    TC'REWIND'OFFLINE = %16,                                            04420000
    TC'BACK'READ      = %17, << Backward read.               >>         04425000
    TC'DENSITY'6250   = %20,                                            04430000
    TC'DENSITY'1600   = %21,                                            04435000
                                                                        04440000
<< IOQ'STATUS return values.>>                                          04445000
                                                                        04450000
    COMPLETION'WAIT  =  %10,                                            04455000
    NOT'READY'WAIT   =  %30,                                            04460000
    WRITE'RING'WAIT  =  %40,                                            04465000
    GOOD'IO          =    1,                                            04470000
    GOOD'RETRY       =  %21,                                            04475000
    GOOD'EOT'WRITE   =  %31, << EOT after successful write.    >>       04480000
    GOOD'BOT         =  %41, << BOT after successful process.  >>       04485000
    SYSTEM'ABORT     =  %33,                                            04490000
    PRIOR'ERR'ABORT  =  %43,                                            04495000
    PASS'EOV'ABORT   =  %53, << Attempt to pass End of Vol >>  <<J8873>>04500000
    POWERFAIL'ABORT  =  %63,                                            04505000
    BACKSPACE'BOT    =  %73, << BOT and backspace requested.   >>       04510000
    TAPE'RUNAWAY     = %103,                                            04515000
    EOT'WRITE        = %113, << EOT and write requested.       >>       04520000
    POWER'UP         = %213,                                            04525000
    DENSITY'ERROR    = %233,                                            04530000
    INVALID'REQUEST  =    4,                                            04535000
    TRANSFER'ERROR   =  %14,                                            04540000
    TIMING'ERROR     =  %34,                                            04545000
    CHAN'PGM'FAILURE =  %44,                                            04550000
    UNIT'FAILURE     =  %54,                                            04555000
    SYSTEM'ERROR     = %124,                                            04560000
    CHAN'IO'FAILURE  = %144,                                            04565000
                                                                        04570000
<< Channel Program Indexes.>>                                           04575000
                                                                        04580000
    RD'WR'SKIP     =  13, << Read/Write bypass switch.   >>             04585000
    RD'BYTE'CNT    =  25, << Read byte count.            >>             04590000
    RD'BANK'ADR    =  27, << Read buffer bank.           >>             04595000
    RD'BUF'ADR     =  28, << Read buffer address.        >>             04600000
    RD'CNT'BANK    =  37, << Transfer count buffer bank. >>             04605000
    RD'STATUS'PGM  =  43, << Read Status Channel Program.>>             04610000
    WR'BYTE'CNT    =  82, << Write byte count.           >>             04615000
    WR'BANK'ADR    =  84, << Write buffer bank.          >>             04620000
    WR'BUF'ADR     =  85, << Write buffer address.       >>             04625000
    IDLE'PGM       =  94, << Idle Channel Program.       >>             04630000
    SELECT'UNIT    = 116, << Unit number for Select Unit.>>             04635000
    MOTION'CMD     = 117, << Motion command.             >>             04640000
    STOP'POLL'CMD  = 118, << Stop poll for data command. >>             04645000
    END'CMD        = 119, << End command.                >>             04650000
    DEVICE'STATUS  = 120, << Device status area.         >>             04655000
    SHORT'READ'BUF = 123, << Short Read buffer area.     >>             04660000
    BYTE'COUNT     = 126,                                               04665000
    IDLE'END'CMD   = 127, << Idle Channel End command.   >>             04670000
                                                                        04675000
<< Driver Substates for Command Queuing.>>                              04680000
                                                                        04685000
    NEW'REQUEST    = 0, << Not command queued.               >>         04690000
    FIRST'BREAK    = 1, << First request started.  Wait for  >>         04695000
                        << break in first request then issue >>         04700000
                        << second request.                   >>         04705000
    SECOND'REQUEST = 2, << first reqeust done.  Waiting for  >>         04710000
                        << second request to start.          >>         04715000
    FINAL'COMPLETE = 3, << second request started.  Waiting  >>         04720000
                        << for final completion.             >>         04725000
    FINISH         = 4, << Second half of write done, finish >><<J7668>>04730000
                        << up the request.                   >><<J7668>>04735000
    ERRSDT         = 7, << Error occurred during first half  >><<J7668>>04740000
                        << of write. Request completed.      >><<J7668>>04745000
                                                                        04750000
<< Misc Pointers and Program Constants.>>                               04755000
                                                                        04760000
    CONSOLE             =     0, << For console messages.        >>     04765000
    DIT'SAVE'INDEX      =     6,                                        04770000
    DIT'TIMEOUT'INDEX   =     8, << Bit 0 = 1, timeout occured. >>      04775000
    DIT'STATUS'INDEX    =     9, << Last interrupt status.      >>      04780000
    DIT'TIMEOUT'REQUEST =    11, << Timeout req entry indx   >><<J7668>>04785000
    DIT'ERR'LOG'INDEX   =    12,                                        04790000
    MAXIMUM'TRANSFER    = 16384,                                        04795000
    NOT'READY'MSG       =    11, << Not ready message index.    >>      04800000
    NO'WRITE'RING'MSG   =   220, << No write ring message index. >>     04805000
    IOQ'MISC'INDEX      =     3,                                        04810000
    IOQ'DST'OFFSET'INDEX =    5,                                        04815000
    IOQ'FUNCTION'INDEX  =     6,                                        04820000
    IOQ'PARM'2'INDEX    =     9,                                        04825000
    REQUEST'DONE        =     5,                                        04830000
    OPERATOR'WAIT       =     7, << Operator intervention wait.  >>     04835000
    INTERRUPT'WAIT      =   %13,                                        04840000
    SYSDB               = %1000,                                        04845000
    SYS'LPDT'INDEX      =   %10, << SYSDB location of LPDT ptr.  >>     04850000
    SYSBUFF'INDEX       =     6, << SYSDB loaction of SYSBUF ptr.>>     04855000
    PE'1600             =     1, << 1600 (PE) density mode.      >>     04860000
    QING                =     1,                                        04865000
    NOT'QED             =     0,                                        04870000
    FCU'MTU'REJECT      =     2,                                        04875000
    PROTOCOL'REJECT     =     3,                                        04880000
    TIMEOUT'REJECT      =     4,                                        04885000
    SELF'TEST'ERROR     =     7,                                        04890000
    TWO'EOF'ENCOUNTERED =     3,                               <<J8873>>04895000
    CP'VA'1'INDEX       =     1;                                        04900000
                                                                        04905000
  define                                                                04910000
                                                                        04915000
<< Misc Bit Definitions.>>                                              04920000
                                                                        04925000
    CMD'QING             = (0:1)#, << Command queuing.         <<J7668>>04930000
    CMD'QING'STATE       = (7:3)#, << Command queuing state.   <<J7668>>04935000
    LPDT'EOF             = (7:3)#,                                      04940000
    FUNCTION'BITS        = (8:8)#, << IOQ'FUNCTION function code.>>     04945000
                                                                        04950000
<< Device Information Table (DIT) elements defined.>>                   04955000
                                                                        04960000
    DIT'LDEV            = P'DIT (3).( 8:8)#,                            04965000
    DIT'ILT'PTR         = P'DIT (5)#,                                   04970000
    DIT'REWIND          = P'DIT (6).( 0:1)#,                            04975000
    DIT'REWIND'OFFLINE  = P'DIT (6).( 1:1)#,                            04980000
    DIT'SHORT'READ      = P'DIT (6).( 2:1)#,                   <<J7668>>04985000
    DIT'FIRST'OP        = P'DIT (6).( 3:1)#,                   <<J7668>>04990000
    DIT'POWERFAIL       = P'DIT (6).( 5:1)#,                            04995000
    DSAVE'EOFS          = (9:2)#,                              <<J8873>>05000000
    DIT'DSAVE'EOFS      = P'DIT (6).DSAVE'EOFS#,               <<J8873>>05005000
    DIT'PENDING'ABORT   = P'DIT (6).(15:1)#,                            05010000
    DIT'ERROR'STATUS    = P'DIT (7)#,                                   05015000
    DIT'TIMEOUT         = P'DIT (8).( 0:1)#,                            05020000
    DIT'END'OF'FILE     = P'DIT (9).( 0:1)#,                            05025000
    DIT'LOAD'POINT      = P'DIT (9).( 1:1)#,                            05030000
    DIT'END'OF'TAPE     = P'DIT (9).( 2:1)#,                            05035000
    DIT'ONE'TRACK'ERROR = P'DIT (9).( 3:1)#,                            05040000
    DIT'COMMAND'REJECT  = P'DIT (9).( 4:1)#,                            05045000
    DIT'FILE'PROTECT    = P'DIT (9).( 5:1)#,                            05050000
    DIT'MULT'TRACK'ERR  = P'DIT (9).( 6:1)#,                            05055000
    DIT'ONLINE          = P'DIT (9).( 7:1)#,                            05060000
    DIT'TIMING'ERROR    = P'DIT (9).(11:1)#,                            05065000
    DIT'TAPE'RUNAWAY    = P'DIT (9).(12:1)#,                            05070000
    DIT'DEVICE'BUSY     = P'DIT (9).(13:3)#,                            05075000
    DIT'ERROR'LOG'0     = P'DIT (12)#,                                  05080000
    DIT'ERROR'LOG'1     = P'DIT (13)#,                                  05085000
    DIT'ERROR'LOG'2     = P'DIT (14)#,                                  05090000
                                                                        05095000
<< Interrupt Linkage Table (ILT) elements defined.>>                    05100000
                                                                        05105000
    ILT'CHAN'PGM'PTR     = P'ILT (8)#,                                  05110000
    ILT'STATUS'PTR       = P'ILT (9)#,                                  05115000
    ILT'IDLE'PGM'RUNNING = P'ILT (13).(1:1)#,                           05120000
                                                                        05125000
<< I/O Queue (IOQ) elements defined.>>                                  05130000
                                                                        05135000
    IOQ'BACKSPACE'EOF  = IOQ'QMISC.(4:1)#,                              05140000
    IOQ'CMD'QING       = IOQ'QMISC.(0:1)#,                     <<J7668>>05145000
    IOQ'CMD'QING'STATE = IOQ'QMISC.(7:3)#,                     <<J7668>>05150000
    IOQ'RETRY'COUNT    = IOQ'QMISC.(12:4)#,                             05155000
    IOQ'WRITE'PAST'EOT = IOQ'PARM2.(13:1)#,                             05160000
    IOQ'DENSITY        = IOQ'PARM2.(13:3)#,                             05165000
                                                                        05170000
                                                                        05175000
<< Logical Physical Device Table (LPDT) elements defined.>>             05180000
                                                                        05185000
    LPDT'END'OF'FILE    = P'LPDT (LPDT'LDEV'INDEX * 2 + 1).(7:3)#,      05190000
                                                                        05195000
<< Channel Program (CP) elements defined.>>                             05200000
                                                                        05205000
      CP'FILE'PROTECT   = P'CHAN'PGM (120).( 5:1)#,                     05210000
    L'CP'ONLINE         = L'CHAN'PGM (120).( 7:1)#,                     05215000
    L'CP'POWERED'DOWN   = L'CHAN'PGM (121).( 1:1)#,                     05220000
    L'CP'POWERED'UP     = L'CHAN'PGM (121).( 2:1)#,                     05225000
      CP'ERROR'DETAIL   = P'CHAN'PGM (121).( 8:3)#,                     05230000
      CP'RETRY'COUNT    = P'CHAN'PGM (121).(11:5)#,                     05235000
      CP'REJECT'CODE    = P'CHAN'PGM (122).( 0:8)#,                     05240000
      CP'POWERFAIL      = P'CHAN'PGM ( -2).( 2:1)#,                     05245000
    L'CP'POWERFAIL      = L'CHAN'PGM ( -2).( 2:1)#,                     05250000
      CP'VA'ERROR'CODE  = P'CHAN'PGM'VAR'AREA.(0:3)#,                   05255000
      CP'VA'DSJ'VECTOR  = P'CHAN'PGM'VAR'AREA (1).(14:2)#,              05260000
                                                                        05265000
<< Misc.>>                                                              05270000
                                                                        05275000
    begin'case      = begin#,                                           05280000
    begin'else      = begin#,                                           05285000
    begin'frame     = begin#,                                           05290000
    begin'if        = begin#,                                           05295000
    begin'procedure = begin#,                                           05300000
    begin'while     = begin#,                                           05305000
    end'case        = end#,                                             05310000
    end'else        = end#,                                             05315000
    end'frame       = end#,                                             05320000
    end'if          = end#,                                             05325000
    end'procedure   = end#,                                             05330000
    end'while       = end#;                                             05335000
$page                                                                   05340000
                                                                        05345000
                                                                        05350000
<< Driver DB Area Definition.>>                                         05355000
                                                                        05360000
                                                                        05365000
  array INITIAL (0:156) = DB :=                                         05370000
                                                                        05375000
    [8/15, 8/%21], << Mag Tape DIT Size,                          >>    05380000
                   << not C.R./Run Idle CP/DR type.               >>    05385000
                0, << Not used.                                   >>    05390000
           %26622, << Unit Extract Instruction - EXF, J=9, K=2.   >>    05395000
      [8/64, 8/3], << Channel Pgm size/2, Status Return area size.>>    05400000
                                                                        05405000
<< Mag Tape DIT >>                                                      05410000
                                                                        05415000
                0, << DIT'FLAG             >>                           05420000
                0, << DIT'LINK             >>                           05425000
                0, << DIT'IOQ'PTR          >>                           05430000
                0, << DIT'LDEV             >>                           05435000
                0, << DIT'DLT'PTR          >>                           05440000
                0, << DIT'ILT'PTR          >>                           05445000
                0, << DIT'SAVE             >>                           05450000
                0, << DIT'ERROR'STATUS     >>                           05455000
                0, << DIT'TIMEOUT          >>                           05460000
                0, << DIT'STATUS >>                                     05465000
           %40000, << HP-IB - Unit number  >>                           05470000
                0, << DIT'TIMEOUT'REQUEST  >>                           05475000
                0, << DIT'ERROR'LOG 0      >>                           05480000
                0, <<       "       1      >>                           05485000
                0, <<       "       2      >>                           05490000
                                                                        05495000
<< CHANNEL PROGRAM.>>                                                   05500000
                                                                        05505000
<< Read/Motion Requests.>>                                              05510000
                                                                        05515000
<<   0 >>       0, << Jump to start.>>                                  05520000
<<   1 >>       0,                                                      05525000
                                                                        05530000
<<   2 >>   %2001, << Unit select.              >>                      05535000
<<   3 >>       1, << Byte count.               >>                      05540000
<<   4 >>       0,                                                      05545000
<<   5 >>  %42000, << Left byte, update disable.>>                      05550000
<<   6 >>       0, << Logical device number.    >>                      05555000
                                                                        05560000
<<   7 >>   %2001, << Read/Motion.              >>                      05565000
<<   8 >>       1, << Byte count.               >>                      05570000
<<   9 >>       0,                                                      05575000
<<  10 >>  %42000, << Left byte, update disable.>>                      05580000
<<  11 >>       0, << Adr of Read Command.      >>                      05585000
                                                                        05590000
<<  12 >>       0, << Jump.                    >>                       05595000
<<  13 >>       0, << 0 for read, 2 for motion.>>                       05600000
                                                                        05605000
<<  14 >>    %601, << Interrupt/halt.      >>                           05610000
<<  15 >>       0, << Code = 0, successful.>>                           05615000
                                                                        05620000
<< Start another READ request or allow a previous READ to finish.>>     05625000
                                                                        05630000
<< Motion Completion.>>                                                 05635000
                                                                        05640000
<<  16 >>   %1000, << Wait for command completion.>>                    05645000
<<  17 >>       0,                                                      05650000
                                                                        05655000
<<  18 >>   %2401, << DSJ, check Mag Tape condition.>>                  05660000
<<  19 >>       0,                                                      05665000
<<  20 >>       0, << Status vector = 0.       >>                       05670000
<<  21 >>      33, << Status vector = 1.       >>                       05675000
                                                                        05680000
<<  22 >>       0, << Jump.                     >>                      05685000
<<  23 >>       0, << 0 for read, 19 for motion.>>                      05690000
                                                                        05695000
<<  24 >>   %1400, << Read.      >>                                     05700000
<<  25 >>       0, << Byte count.>>                                     05705000
<<  26 >>       0,                                                      05710000
<<  27 >>       0, << Bank +     >>                                     05715000
<<  28 >>       0, << buffer adr.>>                                     05720000
                                                                        05725000
<<  29 >>   %2007, << Stop poll for data.       >>                      05730000
<<  30 >>       1,                                                      05735000
<<  31 >>       0,                                                      05740000
<<  32 >>  %42000, << Left byte, update disable.>>                      05745000
<<  33 >>       0,                                                      05750000
                                                                        05755000
<<  34 >>   %1402, << Read transfer count.>>                            05760000
<<  35 >>       2,                                                      05765000
<<  36 >>       0,                                                      05770000
<<  37 >>       0, << %2000 + bank +      >>                            05775000
<<  38 >>       0, << Count buffer adr.   >>                            05780000
                                                                        05785000
<<  39 >>   %2401, << DSJ, check Mag Tape condition.>>                  05790000
<<  40 >>       0,                                                      05795000
<<  41 >>       0,                                                      05800000
<<  42 >>      12,                                                      05805000
                                                                        05810000
<<  43 >>   %1401, << Read status bytes.>>                              05815000
<<  44 >>       5,                                                      05820000
<<  45 >>       0,                                                      05825000
<<  46 >>   %2000,                                                      05830000
<<  47 >>       0, << Status buffer adr.>>                              05835000
                                                                        05840000
<<  48 >>   %2007, << Write END, stop poll for data.>>                  05845000
<<  49 >>       1,                                                      05850000
<<  50 >>       0,                                                      05855000
<<  51 >>  %42000, << left byte, update disable.    >>                  05860000
<<  52 >>       0,                                                      05865000
                                                                        05870000
<<  53 >>    %601, << Interrupt/halt.      >>                           05875000
<<  54 >>       0, << Code = 0, successful.>>                           05880000
                                                                        05885000
<<  55 >>   %1401, << Read status bytes.>>                              05890000
<<  56 >>       5,                                                      05895000
<<  57 >>       0,                                                      05900000
<<  58 >>   %2000,                                                      05905000
<<  59 >>       0, << Status buffer adr.>>                              05910000
                                                                        05915000
<<  60 >>   %2007, << Stop poll for data.       >>                      05920000
<<  61 >>       1,                                                      05925000
<<  62 >>       0,                                                      05930000
<<  63 >>  %42000, << Left byte, update disable.>>                      05935000
<<  64 >>       0,                                                      05940000
                                                                        05945000
<<  65 >>    %601, << Interrupt/halt. >>                                05950000
<<  66 >>       1, << Code = 1, error.>>                                05955000
                                                                        05960000
<< End of read data sequence.>>                                         05965000
                                                                        05970000
<< Write Requests.>>                                                    05975000
                                                                        05980000
<<  67 >>   %2001, << Unit select.>>                                    05985000
<<  68 >>       1,                                                      05990000
<<  69 >>       0,                                                      05995000
<<  70 >>  %42000, << Left byte, update disable.>>                      06000000
<<  71 >>       0, << Logical Device adr.       >>                      06005000
                                                                        06010000
<<  72 >>   %2001, << Write motion.             >>                      06015000
<<  73 >>       1,                                                      06020000
<<  74 >>       0,                                                      06025000
<<  75 >>  %42000, << Left byte, update disable.>>                      06030000
<<  76 >>       0, << Write Command adr.        >>                      06035000
                                                                        06040000
<<  77 >>   %2401, << DSJ, check Mag Tape condition.>>                  06045000
<<  78 >>       0,                                                      06050000
<<  79 >>       0,                                                      06055000
<<  80 >>     -26,                                                      06060000
                                                                        06065000
<<  81 >>   %2000, << Write record.    >>                               06070000
<<  82 >>       0, << Byte count.      >>                               06075000
<<  83 >>       0,                                                      06080000
<<  84 >>       0, << Bank +           >>                               06085000
<<  85 >>       0, << write buffer adr.>>                               06090000
                                                                        06095000
<<  86 >>    %601, << Interrupt/halt.      >>                           06100000
<<  87 >>       0, << Code = 0, successful.>>                           06105000
                                                                        06110000
<< Start another WRITE request or allow a previous WRITE to >>          06115000
<< complete.                                                >>          06120000
                                                                        06125000
<< Motion Completion.>>                                                 06130000
                                                                        06135000
<<  88 >>   %1000, << Wait for command completion.>>                    06140000
<<  89 >>       0,                                                      06145000
                                                                        06150000
<<  90 >>   %2401, << DSJ, check Mag Tape condition.>>                  06155000
<<  91 >>       0,                                                      06160000
<<  92 >>     -51,                                                      06165000
<<  93 >>     -39,                                                      06170000
                                                                        06175000
<< End of Write sequence.>>                                             06180000
                                                                        06185000
<< Idle Channel Program begins.>>                                       06190000
                                                                        06195000
<<  94 >>   %2007, << End.>>                                            06200000
<<  95 >>       1,                                                      06205000
<<  96 >>       0,                                                      06210000
<<  97 >>  %42000,                                                      06215000
<<  98 >>       0,                                                      06220000
                                                                        06225000
<<  99 >>   %1000, << Wait for Mag Tape poll.>>                         06230000
<< 100 >>       0,                                                      06235000
                                                                        06240000
<< 101 >>   %2400, << DSJ, clear any pending DSJ'S.>>                   06245000
<< 102 >>       0,                                                      06250000
<< 103 >>       0,                                                      06255000
                                                                        06260000
<< 104 >>   %1401, << Read status into ILT.              >>             06265000
<< 105 >>       5,                                                      06270000
<< 106 >>       0,                                                      06275000
<< 107 >>   %2000,                                                      06280000
<< 108 >>       0, << Idle Channel Pgm status return adr.>>             06285000
                                                                        06290000
<< 109 >>   %2007, << End.                       >>                     06295000
<< 110 >>       1,                                                      06300000
<< 111 >>       0,                                                      06305000
<< 112 >>  %42000, << Left byte, update disabled.>>                     06310000
<< 113 >>       0,                                                      06315000
                                                                        06320000
<< 114 >>    %601, << Interrupt/halt.      >>                           06325000
<< 115 >>       0, << Code = 0, Successful.>>                           06330000
                                                                        06335000
<< 116 >>       0, << Unit number for select command.  >>               06340000
<< 117 >>       0, << Motion Command Word.             >>               06345000
<< 118 >>       2, << Stop poll for data command.      >>               06350000
<< 119 >>     %10, << End command.                     >>               06355000
<< 120 >>       0, << 6 byte status buffer, byte 1 & 2.>>               06360000
<< 121 >>       0, << "  "     "      "      "   3 & 4.>>               06365000
<< 122 >>       0, << "  "     "      "      "   5 & 6.>>               06370000
<< 123 >>       0, << 6 byte shord read buffer.        >>               06375000
<< 124 >>       0,                                                      06380000
<< 125 >>       0,                                                      06385000
<< 126 >>       0, << Transfer count.                        >>         06390000
<< 127 >>       4;                                                      06395000
$page                                                                   06400000
                                                                        06405000
                                                                        06410000
<< EXTERNAL PROCEDURE DECLARATIONS.>>                                   06415000
                                                                        06420000
                                                                        06425000
procedure ABORTTIMEREQ (TRLX);                                          06430000
                                                                        06435000
  value                                                                 06440000
    TRLX;                                                               06445000
                                                                        06450000
  integer                                                               06455000
    TRLX;                                                               06460000
                                                                        06465000
  option                                                                06470000
    external;                                                           06475000
                                                                        06480000
                                                                        06485000
procedure CHECKINDEX (INDEX, TABLE);                                    06490000
                                                                        06495000
  value                                                                 06500000
    INDEX,                                                              06505000
    TABLE;                                                              06510000
                                                                        06515000
  integer                                                               06520000
    INDEX;                                                              06525000
                                                                        06530000
  integer pointer                                                       06535000
    TABLE;                                                              06540000
                                                                        06545000
  option                                                                06550000
    external;                                                           06555000
                                                                        06560000
                                                                        06565000
procedure EOFCHECK (IOQ'ENTRY'INDEX, BUF'BANK'ADR, TRANSFER'COUNT,      06570000
                    HCHK);                                              06575000
                                                                        06580000
  value                                                                 06585000
    IOQ'ENTRY'INDEX,                                                    06590000
    BUF'BANK'ADR,                                                       06595000
    TRANSFER'COUNT,                                                     06600000
    HCHK;                                                               06605000
                                                                        06610000
  integer                                                               06615000
    IOQ'ENTRY'INDEX,                                                    06620000
    TRANSFER'COUNT,                                                     06625000
    HCHK;                                                               06630000
                                                                        06635000
  double                                                                06640000
    BUF'BANK'ADR;                                                       06645000
                                                                        06650000
  option                                                                06655000
    external;                                                           06660000
                                                                        06665000
                                                                        06670000
procedure GIP'HPIB;                                                     06675000
                                                                        06680000
  option                                                                06685000
    external;                                                           06690000
                                                                        06695000
                                                                        06700000
procedure HELP;                                                         06705000
                                                                        06710000
  option                                                                06715000
    external;                                                           06720000
                                                                        06725000
logical procedure IOMESSAGE (SETNO, MSGNO, MASK, P1, P2, P3, P4,        06730000
                             P5, DEST, REPLY, OFFSET, P'DIT,            06735000
                             IOTYPE);                                   06740000
  value                                                                 06745000
    SETNO,                                                              06750000
    MSGNO,                                                              06755000
    MASK,                                                               06760000
    P1, P2, P3, P4, P5,                                                 06765000
    DEST,                                                               06770000
    REPLY,                                                              06775000
    OFFSET,                                                             06780000
    P'DIT,                                                              06785000
    IOTYPE;                                                             06790000
                                                                        06795000
  integer                                                               06800000
    SETNO,                                                              06805000
    MSGNO,                                                              06810000
    MASK,                                                               06815000
    P1, P2, P3, P4, P5,                                                 06820000
    DEST,                                                               06825000
    REPLY,                                                              06830000
    OFFSET,                                                             06835000
    IOTYPE;                                                             06840000
                                                                        06845000
  logical pointer                                                       06850000
    P'DIT;                                                              06855000
                                                                        06860000
  option                                                                06865000
    variable,                                                           06870000
    external;                                                           06875000
                                                                        06880000
                                                                        06885000
procedure MASTERCLEARHPIB (DIT);                                        06890000
                                                                        06895000
  array                                                                 06900000
    DIT;                                                                06905000
                                                                        06910000
  option                                                                06915000
    external;                                                           06920000
                                                                        06925000
                                                                        06930000
procedure SIODM (P'DIT, FLAGS);                                         06935000
                                                                        06940000
  value                                                                 06945000
    P'DIT,                                                              06950000
    FLAGS;                                                              06955000
                                                                        06960000
  logical                                                               06965000
    FLAGS;                                                              06970000
                                                                        06975000
  logical pointer                                                       06980000
    P'DIT;                                                              06985000
                                                                        06990000
  option                                                                06995000
    external;                                                           07000000
                                                                        07005000
                                                                        07010000
procedure START'HPIB (P'DIT, P'CHAN'PGM, QFLAG);                        07015000
                                                                        07020000
  value                                                                 07025000
    P'DIT,                                                              07030000
    P'CHAN'PGM,                                                         07035000
    QFLAG;                                                              07040000
                                                                        07045000
  logical                                                               07050000
    QFLAG;                                                              07055000
                                                                        07060000
  logical pointer                                                       07065000
    P'DIT,                                                              07070000
    P'CHAN'PGM;                                                         07075000
                                                                        07080000
  option                                                                07085000
    external;                                                           07090000
                                                                        07095000
                                                                        07100000
integer procedure TIMEREQ (CODE, REQ, TIME);                            07105000
                                                                        07110000
  value                                                                 07115000
    CODE,                                                               07120000
    REQ,                                                                07125000
    TIME;                                                               07130000
                                                                        07135000
  integer                                                               07140000
    CODE,                                                               07145000
    REQ;                                                                07150000
                                                                        07155000
  double                                                                07160000
    TIME;                                                               07165000
                                                                        07170000
  option                                                                07175000
    external;                                                           07180000
$page                                                                   07185000
<< Buckhorn Initialization Procedure - MTINIT.>>                        07190000
                                                                        07195000
procedure MTINIT (P'DIT);                                               07200000
                                                                        07205000
  value                                                                 07210000
    P'DIT;                                                              07215000
                                                                        07220000
  logical pointer                                                       07225000
    P'DIT;                                                              07230000
                                                                        07235000
<< This procedure initializes the buffer addresses for most READ, >>    07240000
<< WRITE, and END commands in the Channel Pgm.                    >>    07245000
                                                                        07250000
begin'procedure                                                         07255000
                                                                        07260000
  logical pointer                                                       07265000
    P'ILT; << Pointer to Interrupt Linkage Table.>>                     07270000
                                                                        07275000
  integer pointer                                                       07280000
    P'CHAN'PGM,    << Point to Channel Pgm.            >>               07285000
    P'IDLE'PGM,    << Point to Idle Channel Pgm.       >>               07290000
    P'IDLE'STATUS; << Point to Idle Channel Status.    >>               07295000
                                                                        07300000
  integer                                                               07305000
    SYSDB'CHAN'PGM,    << SYSDB adr of Channel Pgm.            >>       07310000
    SYSDB'IDLE'STATUS; << SYSDB adr of Idle Channel Pgm status.>>       07315000
                                                                        07320000
<< Initialize local variables.>>                                        07325000
                                                                        07330000
  @P'ILT            := DIT'ILT'PTR;                                     07335000
  @P'CHAN'PGM       := ILT'CHAN'PGM'PTR;                                07340000
  @P'IDLE'PGM       := @P'CHAN'PGM + IDLE'PGM;                          07345000
  @P'IDLE'STATUS    := ILT'STATUS'PTR;                                  07350000
  SYSDB'CHAN'PGM    := @P'CHAN'PGM + SYSDB;                             07355000
  SYSDB'IDLE'STATUS := @P'IDLE'STATUS + SYSDB;                          07360000
                                                                        07365000
  if ILT'IDLE'PGM'RUNNING then                                          07370000
                                                                        07375000
    << Idle Channel Program is already running.>>                       07380000
                                                                        07385000
    return;                                                             07390000
                                                                        07395000
<< Idle Channel Pgm wasn't running.  Initialize the channel program.>>  07400000
                                                                        07405000
  P'CHAN'PGM (  6) := SYSDB'CHAN'PGM + SELECT'UNIT;                     07410000
  P'CHAN'PGM ( 11) := SYSDB'CHAN'PGM + MOTION'CMD;                      07415000
  P'CHAN'PGM ( 33) := SYSDB'CHAN'PGM + STOP'POLL'CMD;                   07420000
  P'CHAN'PGM ( 38) := SYSDB'CHAN'PGM + BYTE'COUNT;                      07425000
  P'CHAN'PGM ( 47) := SYSDB'CHAN'PGM + DEVICE'STATUS;                   07430000
  P'CHAN'PGM ( 52) := SYSDB'CHAN'PGM + END'CMD;                         07435000
  P'CHAN'PGM ( 59) := SYSDB'CHAN'PGM + DEVICE'STATUS;                   07440000
  P'CHAN'PGM ( 64) := SYSDB'CHAN'PGM + END'CMD;                         07445000
  P'CHAN'PGM ( 71) := SYSDB'CHAN'PGM + SELECT'UNIT;                     07450000
  P'CHAN'PGM ( 76) := SYSDB'CHAN'PGM + MOTION'CMD;                      07455000
  P'CHAN'PGM ( 98) := SYSDB'CHAN'PGM + IDLE'END'CMD;                    07460000
  P'CHAN'PGM (108) := SYSDB'IDLE'STATUS;                                07465000
  P'CHAN'PGM (113) := SYSDB'CHAN'PGM + END'CMD;                         07470000
                                                                        07475000
<< Start the Idle Channel Program.>>                                    07480000
                                                                        07485000
  START'HPIB (P'DIT, P'IDLE'PGM, FALSE);                                07490000
                                                                        07495000
end'procedure; << MTINIT >>                                             07500000
$page                                                                   07505000
                                                                        07510000
                                                                        07515000
<< Buckhorn Driver Procedure - MTDRVR.>>                                07520000
                                                                        07525000
                                                                        07530000
integer procedure MTDRVR (WS'IOQ'INDEX, P'DIT, BUF'BANK,                07535000
                          BUF'ADR, P'CHAN'PGM, DRTN);                   07540000
                                                                        07545000
<< This procedure initiates and completes I/O requests for the >>       07550000
<< Buckhorn tape drive connected to he HP-IB and controlled by >>       07555000
<< the GIC.                                                    >>       07560000
                                                                        07565000
<< State returns for MTDRVR:             >>                             07570000
<<    5 - Request completed.             >>                             07575000
<<    7 - Operator intervention required.>>                             07580000
<<  %13 - Wait for operation completion. >>                             07585000
                                                                        07590000
  value                                                                 07595000
    P'DIT,                                                              07600000
    WS'IOQ'INDEX,                                                       07605000
    BUF'BANK,                                                           07610000
    BUF'ADR,                                                            07615000
    P'CHAN'PGM,                                                         07620000
    DRTN;                                                               07625000
                                                                        07630000
  integer                                                      <<J8488>>07635000
    WS'IOQ'INDEX,                                              <<J8488>>07640000
    DRTN;                                                      <<J8488>>07645000
                                                               <<J8488>>07650000
  logical                                                      <<J8488>>07655000
    BUF'BANK,                                                  <<J8488>>07660000
    BUF'ADR;                                                   <<J8488>>07665000
                                                               <<J8488>>07670000
  logical pointer                                                       07675000
    P'DIT;                                                              07680000
                                                                        07685000
 integer pointer                                                        07690000
    P'CHAN'PGM;                                                         07695000
                                                                        07700000
  option                                                                07705000
    privileged,                                                         07710000
    uncallable;                                                         07715000
                                                                        07720000
begin'procedure                                                         07725000
                                                                        07730000
  logical pointer                                                       07735000
    P'IOQ'TABLE = 5;                                                    07740000
                                                                        07745000
  integer pointer                                                       07750000
    IP'IOQ'TABLE = 5,                                                   07755000
    P'CHAN'PGM'VAR'AREA,       << ILT's Channel Pgm Variable Area.>>    07760000
    P'IDLE'PGM,                << Start of Idle Channel Pgm.      >>    07765000
    P'READ'STATUS,             << Channel Pgm read status routine.>>    07770000
    SBUF = DB + SYSBUFF'INDEX, << SYSGLOB pointer to SYSBUFF.     >>    07775000
                               << DB has been set to SYSGLOB      >>    07780000
                               << prior to driver being called.   >>    07785000
    P'LPDT = DB + SYS'LPDT'INDEX; << SYSGLOB pointer to Logical   >>    07790000
                                  << Physical Device Table.       >>    07795000
                                                                        07800000
  integer                                                               07805000
    IOQ'ENTRY'INDEX,     << Index of IOQ currently ref. >>              07810000
    TRANSFER'COUNT,   << Byte transfer count.>>                         07815000
    BYTES'TRANSFERED,                                                   07820000
    WS'FUNCTION,      << Function code.      >>                         07825000
    LPDT'LDEV'INDEX,                                                    07830000
    TAPE'COMMAND,                                                       07835000
    DRIVER'STATE = MTDRVR,                                              07840000
    S0      = S - 0,                                                    07845000
    S1      = S - 1,                                                    07850000
    S3      = S - 3,                                                    07855000
    X       = X;                                                        07860000
                                                                        07865000
  double                                                                07870000
    BUF'BANK'ADR, << Bank and address of buffer used for >>             07875000
                  << transfer.                           >>             07880000
    WS'BUF'BANK'ADR;                                                    07885000
                                                                        07890000
  logical array                                                         07895000
    L'CHAN'PGM (*) = P'CHAN'PGM;                                        07900000
                                                                        07905000
  logical                                                               07910000
    LPDT'INDEX;                                                         07915000
<<-------------------------------------------->>               <<J7668>>07920000
<<                                            >>               <<J7668>>07925000
<< SET'ABORT -- USED WHEN AN ERROR OCCURS ON  >>               <<J7668>>07930000
<< CURRENT REQUEST AND NEXT REQUEST SHOULD BE >>               <<J7668>>07935000
<< MARKED AS ABORTED                          >>               <<J7668>>07940000
<<-------------------------------------------->>               <<J7668>>07945000
                                                               <<J7668>>07950000
  SUBROUTINE SET'ABORT;                                        <<J7668>>07955000
  BEGIN                                                        <<J7668>>07960000
    IF IOQ'QLINK <> 0 THEN                                     <<J7668>>07965000
     BEGIN'IF                                                  <<J7668>>07970000
       IOQ'ENTRY'INDEX := IOQ'QLINK;                           <<J7668>>07975000
       IF IOQ'CMD'QING'STATE <> NEW'REQUEST THEN               <<J7668>>07980000
          IOQ'ABORT :=1;                                       <<J7668>>07985000
       IOQ'ENTRY'INDEX := WS'IOQ'INDEX;                        <<J7668>>07990000
     END'IF;                                                   <<J7668>>07995000
  END;                                                         <<J7668>>08000000
                                                               <<J7668>>08005000
$PAGE                                                          <<J7668>>08010000
                                                               <<J7668>>08015000
                                                                        08020000
<< Initialize local pointers and variables.>>                           08025000
                                                                        08030000
  IOQ'ENTRY'INDEX:= WS'IOQ'INDEX;                                       08035000
  @P'CHAN'PGM'VAR'AREA := DIT'ILT'PTR;                                  08040000
  @P'IDLE'PGM          := @P'CHAN'PGM + IDLE'PGM;                       08045000
  @P'READ'STATUS       := @P'CHAN'PGM + RD'STATUS'PGM;                  08050000
  BUF'BANK'ADR         := double (BUF'BANK) &dlsl (16) +                08055000
                          double (BUF'ADR);                             08060000
                                                               <<J7668>>08065000
  << RESET CHANNEL PROGRAM AREA MODIFIED FOR WRITES>>          <<J7668>>08070000
                                                               <<J7668>>08075000
    P'CHAN'PGM(66) := 1;                                       <<J7668>>08080000
                                                               <<J7668>>08085000
                                                                        08090000
<< Check for Device powerfail.>>                                        08095000
                                                                        08100000
  if L'CP'POWERFAIL then                                                08105000
  begin'if                                                              08110000
                                                                        08115000
    << Device has powerfailed.>>                                        08120000
                                                                        08125000
    CP'POWERFAIL  := 0;                                                 08130000
    DIT'POWERFAIL := 1;                                                 08135000
                                                                        08140000
  end'if;                                                               08145000
                                                                        08150000
<< Idle Channel program initiation.>>                                   08155000
                                                                        08160000
     if IOQ'ENTRY'INDEX = 0 then                                        08165000
  begin'if                                                              08170000
                                                                        08175000
    << No IOQ exists so start Idle Channel Pgm.>>                       08180000
                                                                        08185000
    START'HPIB (P'DIT, P'IDLE'PGM, FALSE);                              08190000
    if < then                                                           08195000
    begin'if                                                            08200000
                                                                        08205000
      << Idle channel pgm failed to start.>>                            08210000
                                                                        08215000
      MASTERCLEARHPIB (P'DIT); << Halt channel program.  >>             08220000
                                                               <<J7668>>08225000
      DIT'REWIND :=0;                                          <<J7668>>08230000
      DIT'REWIND'OFFLINE := 0;                                 <<J7668>>08235000
      DIT'SHORT'READ     := 0;                                 <<J7668>>08240000
      DIT'POWERFAIL      := 0;                                 <<J7668>>08245000
      DIT'PENDING'ABORT  := 0;                                 <<J7668>>08250000
                                                               <<J7668>>08255000
      DRIVER'STATE           := REQUEST'DONE;                           08260000
                                                                        08265000
      return;                                                           08270000
                                                                        08275000
    end'if;                                                             08280000
                                                                        08285000
    P'CHAN'PGM'VAR'AREA := 0;                                           08290000
    DRIVER'STATE        := REQUEST'DONE;                                08295000
                                                                        08300000
    return;                                                             08305000
                                                                        08310000
  end'if;                                                               08315000
                                                                        08320000
<< System Abort Request.>>                                              08325000
                                                                        08330000
  if IOQ'ABORT then                                                     08335000
  begin'if                                                              08340000
                                                                        08345000
    << System says to abort the request.>>                              08350000
                                                                        08355000
    if not DIT'PENDING'ABORT then                                       08360000
    begin'if                                                            08365000
                                                                        08370000
      << This is the first pass of the abort processing.>>              08375000
                                                                        08380000
      if not (IOQ'QLINK = 0) then                                       08385000
      begin'if                                                          08390000
                                                                        08395000
        << There is another IOQ.  Get it.>>                             08400000
                                                                        08405000
        IOQ'ENTRY'INDEX:= IOQ'QLINK;                                    08410000
                                                                        08415000
        if not (IOQ'CMD'QING'STATE = NEW'REQUEST) then                  08420000
                                                                        08425000
          << This request has been queued.  Set system abort.>>         08430000
                                                                        08435000
          IOQ'ABORT := 1;                                               08440000
                                                                        08445000
        << Return to original request.>>                                08450000
                                                                        08455000
        WS'IOQ'INDEX := IOQ'ENTRY'INDEX;                                08460000
                                                                        08465000
      end'if;                                                           08470000
                                                                        08475000
      << Set up Channel Pgm for device clear and start it.>>            08480000
                                                                        08485000
      P'CHAN'PGM ( 1) :=    88;                                         08490000
      P'CHAN'PGM (92) :=     0;                                         08495000
      P'CHAN'PGM (93) :=     0;                                         08500000
      P'CHAN'PGM (94) := %4400;                                         08505000
      P'CHAN'PGM (95) :=     0;                                         08510000
      P'CHAN'PGM (96) :=     0;                                         08515000
      P'CHAN'PGM (97) :=     1;                                         08520000
                                                                        08525000
      START'HPIB (P'DIT, P'CHAN'PGM, FALSE);                            08530000
                                                                        08535000
      << Set pending abort for second pass of abort processing.>>       08540000
                                                                        08545000
      DIT'PENDING'ABORT := 1;                                           08550000
      IOQ'STAT          := COMPLETION'WAIT;                             08555000
                                                                        08560000
      return;                                                           08565000
                                                                        08570000
    end'if                                                              08575000
                                                                        08580000
    else                                                                08585000
                                                                        08590000
    begin'else                                                          08595000
                                                                        08600000
      << This is the second pass of a system abort.  Set the >>         08605000
      << channel program for normal processing.              >>         08610000
                                                                        08615000
      P'CHAN'PGM (92) :=    -51;                                        08620000
      P'CHAN'PGM (93) :=    -39;                                        08625000
      P'CHAN'PGM (94) :=  %2007;                                        08630000
      P'CHAN'PGM (95) :=      1;                                        08635000
      P'CHAN'PGM (96) :=      0;                                        08640000
      P'CHAN'PGM (97) := %42000;                                        08645000
                                                                        08650000
      DIT'PENDING'ABORT  := 0;                                          08655000
      IOQ'CMD'QING'STATE := 0;                                          08660000
                                                                        08665000
      if IOQ'PFAIL then                                                 08670000
                                                                        08675000
        << System powerfail abort.>>                                    08680000
                                                                        08685000
         IOQ'STAT := POWERFAIL'ABORT                                    08690000
                                                                        08695000
      else                                                              08700000
                                                                        08705000
        << System requested abort.>>                                    08710000
                                                                        08715000
         IOQ'STAT := SYSTEM'ABORT;                                      08720000
                                                                        08725000
      DRIVER'STATE := REQUEST'DONE;                                     08730000
                                                                        08735000
      return;                                                           08740000
                                                                        08745000
    end'else;                                                           08750000
  end'if;                                                               08755000
                                                                        08760000
<< Device Powerfail Completion.>>                                       08765000
                                                                        08770000
  if DIT'POWERFAIL then                                                 08775000
  begin'if                                                              08780000
                                                                        08785000
    << Device has powerfailed.>>                                        08790000
                                                                        08795000
    DIT'POWERFAIL := 0;                                                 08800000
                                                                        08805000
    if not IOQ'CMD'QING then   << if not command queuing,>>             08810000
      MASTERCLEARHPIB (P'DIT); << halt channel program.  >>             08815000
                                                                        08820000
                                                               <<J7668>>08825000
    SET'ABORT; << IF QUEUING ABORT NEXT REQUEST>>              <<J7668>>08830000
    IOQ'CMD'QING'STATE     := 0;                                        08835000
    IOQ'STAT               := POWER'UP;                                 08840000
    DRIVER'STATE           := REQUEST'DONE;                             08845000
                                                                        08850000
    return;                                                             08855000
                                                                        08860000
  end'if;                                                               08865000
                                                                        08870000
<< Timeout.>>                                                           08875000
                                                                        08880000
  if DIT'TIMEOUT then                                                   08885000
  begin'if                                                              08890000
                                                                        08895000
    << A timeout has occured.>>                                         08900000
                                                                        08905000
    ABORTTIMEREQ (P'DIT (DIT'TIMEOUT'REQUEST)); << Stop timer.>>        08910000
                                                                        08915000
    P'DIT (DIT'TIMEOUT'INDEX) := 0; << Reset timeout.>>                 08920000
                                                                        08925000
    << Rewind and offline command is performed on a timeout.>>          08930000
                                                                        08935000
    DIT'REWIND'OFFLINE        := 1;                                     08940000
    TAPE'COMMAND              := TC'REWIND'OFFLINE;                     08945000
                                                                        08950000
    go to PROCESS'CONTINUE;                                             08955000
                                                                        08960000
  end'if;                                                               08965000
$page                                                                   08970000
                                                                        08975000
<< Command Queuing.>>                                                   08980000
  if IOQ'FUNC = FC'WRITE or                                             08985000
     IOQ'FUNC = FC'READ  or                                             08990000
     IOQ'FUNC = FC'BACK'READ then                                       08995000
  begin'if                                                              09000000
                                                                        09005000
    << We only command queue reads or writes.>>                         09010000
                                                                        09015000
    if IOQ'COUNT = 0 then                                               09020000
    begin'if                                                            09025000
                                                                        09030000
      << There are zero bytes to transfer.>>                            09035000
                                                                        09040000
      if IOQ'FUNC = FC'READ then                                        09045000
      begin'if                                                          09050000
                                                                        09055000
        << Treat a zero byte read as a forward space to >>              09060000
        << next record command.                         >>              09065000
                                                                        09070000
        IOQ'FUNC          := FC'FOR'SPACE'REC;                          09075000
        TRANSFER'COUNT    := IOQ'COUNT;                                 09080000
        WS'FUNCTION       := IOQ'FUNC;                                  09085000
        TAPE'COMMAND      := TC'FOR'SPACE'REC;                          09090000
                                                                        09095000
        go to PROCESS'CONTINUE;                                         09100000
                                                                        09105000
      end'if;                                                           09110000
                                                                        09115000
      if IOQ'FUNC = FC'WRITE then                                       09120000
      begin'if                                                          09125000
                                                                        09130000
        << Save transfer count and function.>>                          09135000
                                                                        09140000
        TRANSFER'COUNT := IOQ'COUNT;                                    09145000
        WS'FUNCTION    := IOQ'FUNC;                                     09150000
                                                                        09155000
        if not (DRIVER'STATE = 2) then                                  09160000
        begin'if                                                        09165000
                                                                        09170000
          << We are not in the completor state.>>                       09175000
                                                                        09180000
          CP'FILE'PROTECT := 0;                                         09185000
                                                                        09190000
          go to PROCESS'COMPLETOR;                                      09195000
                                                                        09200000
        end'if;                                                         09205000
                                                                        09210000
        << A zero byte write is a test for write ring mount.>>          09215000
                                                                        09220000
        go to TEST'WRITE;                                               09225000
                                                                        09230000
      end'if;                                                           09235000
                                                                        09240000
      if IOQ'FUNC = FC'BACK'READ then                                   09245000
      begin'if                                                          09250000
                                                                        09255000
        << Treat a zero byte back read as a backspace record. >>        09260000
                                                                        09265000
        IOQ'FUNC          := FC'BAC'SPACE'REC;                          09270000
        TRANSFER'COUNT    := IOQ'COUNT;                                 09275000
        WS'FUNCTION       := IOQ'FUNC;                                  09280000
        TAPE'COMMAND      := TC'BAC'SPACE'REC;                          09285000
                                                                        09290000
        if DIT'LOAD'POINT then                                          09295000
        begin'if                                                        09300000
                                                                        09305000
          << We can't backspace at BOT.>>                               09310000
                                                                        09315000
          IOQ'CMD'QING'STATE := 0;                                      09320000
          IOQ'STAT           := BACKSPACE'BOT;                          09325000
          DRIVER'STATE       := 0;                                      09330000
                                                                        09335000
          return;                                                       09340000
                                                                        09345000
        end'if;                                                         09350000
                                                                        09355000
        go to PROCESS'CONTINUE;                                         09360000
                                                                        09365000
      end'if;                                                           09370000
    end'if;                                                             09375000
                                                                        09380000
    << There is data to transfer.>>                                     09385000
                                                                        09390000
    if (IOQ'QLINK = 0) lor (DIT'FIRST'OP = 0) then             <<J7692>>09395000
    begin'if                                                            09400000
                                                                        09405000
      << There isn't another IOQ so no command queuing processing.>>    09410000
                                                                        09415000
      IOQ'CMD'QING := NOT'QED;                                          09420000
                                                                        09425000
      if IOQ'CMD'QING'STATE  = FIRST'BREAK then                         09430000
         IOQ'CMD'QING'STATE := SECOND'REQUEST;                          09435000
                                                                        09440000
    end'if                                                              09445000
                                                                        09450000
    else                                                                09455000
                                                                        09460000
    begin'else                                                          09465000
                                                                        09470000
      << There is another IOQ.>>                                        09475000
                                                                        09480000
      if IOQ'CMD'QING'STATE = SECOND'REQUEST then                       09485000
                                                                        09490000
        << At first break, alternate request is running.>>              09495000
                                                                        09500000
        if CP'VA'ERROR'CODE > 5 then                                    09505000
        begin'if                                                        09510000
                                                                        09515000
          << There was a DMA abort (value 6) or a Channel pgm >>        09520000
          << error (value 7).  Log the error.                 >>        09525000
                                                                        09530000
          DIT'ERROR'STATUS := [8/3, 8/DIT'ERR'LOG'INDEX];               09535000
          DIT'ERROR'LOG'0  := P'CHAN'PGM'VAR'AREA;                      09540000
          SET'ABORT;                                           <<J7668>>09545000
          if not IOQ'CMD'QING then   << if not command queuing,>>       09550000
            MASTERCLEARHPIB (P'DIT); << halt channel program.  >>       09555000
                                                                        09560000
          P'DIT (DIT'SAVE'INDEX) := 0;                                  09565000
          IOQ'CMD'QING'STATE     := 0;                                  09570000
          DRIVER'STATE           := REQUEST'DONE;                       09575000
          IOQ'STAT               := CHAN'IO'FAILURE;                    09580000
                                                                        09585000
          return;                                                       09590000
                                                                        09595000
        end'if                                                          09600000
                                                                        09605000
        else                                                            09610000
                                                                        09615000
          go to QUEUING'SKIP;                                           09620000
                                                               <<J7692>>09625000
      << Another request can be issued. A check must be >>     <<J7692>>09630000
      << made first for errors from a previous request  >>     <<J7692>>09635000
                                                                        09640000
      if not (IOQ'CMD'QING'STATE = FIRST'BREAK) then                    09645000
        go to QUEUING'SKIP;                                             09650000
                                                                        09655000
      << We are at first break.  Make queue state a second request.>>   09660000
                                                                        09665000
      IOQ'CMD'QING'STATE := SECOND'REQUEST;                             09670000
                                                                        09675000
                                                               <<J7668>>09680000
      if not (CP'VA'DSJ'VECTOR = 0) then                       <<J7668>>09685000
                                                               <<J7668>>09690000
       begin'if                                                <<J7668>>09695000
                                                               <<J7668>>09700000
                                                                        09705000
        << The jump vector returned from a DSJ channel instruction >>   09710000
        << was not zero (stored in CPVA (1).(14:2)) which indicates>>   09715000
        << an error occured in the Channel Pgm.                    >>   09720000
                                                                        09725000
        if  not ( L'CP'ONLINE  ) then go to QUEUING'SKIP;      <<J7668>>09730000
        if (not ((L'CHAN'PGM (DEVICE'STATUS) land %17037) = 0))<<J7668>>09735000
        land (IOQ'FUNC = FC'WRITE) then go to QUEUING'SKIP;    <<J7668>>09740000
                                                               <<J7668>>09745000
          << Check for errors in previous read  and >>         <<J7668>>09750000
          << backread.                              >>         <<J7668>>09755000
                                                               <<J7668>>09760000
        if (not ((L'CHAN'PGM (DEVICE'STATUS) land %15037) = 0))<<J7668>>09765000
        then                                                   <<J7668>>09770000
                                                                        09775000
          << One of the fatal error bits was on so skip command >>      09780000
          << queuing.                                           >>      09785000
                                                                        09790000
          go to QUEUING'SKIP;                                           09795000
                                                               <<J7668>>09800000
       end'if;                                                 <<J7668>>09805000
                                                               <<J7668>>09810000
                                                                        09815000
      << Get the next IOQ.>>                                            09820000
                                                                        09825000
      IOQ'ENTRY'INDEX := IOQ'QLINK;                                     09830000
                                                                        09835000
      if (IOQ'FUNC = FC'READ   or                                       09840000
          IOQ'FUNC = FC'WRITE) and                                      09845000
          IOQ'COUNT= 0 then                                             09850000
      begin'if                                                          09855000
                                                                        09860000
        << There is a zero word transfer in the next IOQ.>>             09865000
        << Mark next IOQ as not queued.  Get back to IOQ >>             09870000
        << passed to driver and mark it as not queued.   >>             09875000
        << Skip further queuing processing.              >>             09880000
                                                                        09885000
        IOQ'CMD'QING := NOT'QED;                                        09890000
        IOQ'ENTRY'INDEX:= WS'IOQ'INDEX;                                 09895000
        IOQ'CMD'QING := NOT'QED;                                        09900000
                                                                        09905000
        go to QUEUING'SKIP;                                             09910000
                                                                        09915000
      end'if;                                                           09920000
                                                                        09925000
      if IOQ'FUNC <>                                                    09930000
      IOQ(WS'IOQ'INDEX+ IOQ'FUNC'INDEX).                                09935000
                      FUNCTION'BITS then                                09940000
      begin'if                                                          09945000
                                                                        09950000
        << The next IOQ function is different from the IOQ    >>        09955000
        << passed to the driver.  Mark next IOQ as not queued.>>        09960000
        << Get back to IOQ passed to driver and mark it not   >>        09965000
        << queued.  Skip further queuing processing.          >>        09970000
                                                                        09975000
        IOQ'CMD'QING := NOT'QED;                                        09980000
        IOQ'ENTRY'INDEX:= WS'IOQ'INDEX;                                 09985000
        IOQ'CMD'QING := NOT'QED;                                        09990000
                                                                        09995000
        go to QUEUING'SKIP;                                             10000000
                                                                        10005000
      end'if;                                                           10010000
                                                                        10015000
      << If we make it to here, set command queuing in the next IOQ.>>  10020000
                                                                        10025000
      IOQ'CMD'QING := QING;                                             10030000
                                                                        10035000
    end'else;                                                           10040000
  end'if;                                                               10045000
$page                                                                   10050000
                                                                        10055000
QUEUING'SKIP:                                                           10060000
                                                                        10065000
  << The device works only with bytes.  A negative transfer count >>    10070000
  << designates a byte transfer, make the count positive.  A      >>    10075000
  << positive transfer count designates a word transfer, double   >>    10080000
  << it to create a byte count.  Save IOQ function.               >>    10085000
                                                                        10090000
  WS'FUNCTION      := IOQ'FUNC;                                         10095000
  TRANSFER'COUNT   := IOQ'COUNT;                                        10100000
  if TRANSFER'COUNT < 0 then                                            10105000
    TRANSFER'COUNT := -TRANSFER'COUNT                                   10110000
  else                                                                  10115000
    TRANSFER'COUNT := TRANSFER'COUNT &ASL (1);                          10120000
                                                                        10125000
  << Motion commands have a one pass channel program.>>                 10130000
                                                                        10135000
  if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                           10140000
    go to PROCESS'COMPLETOR;                                            10145000
                                                                        10150000
  if DRIVER'STATE = 2 or                                                10155000
     not (IOQ'CMD'QING'STATE = FINAL'COMPLETE) then                     10160000
  begin'if                                                              10165000
$page                                                                   10170000
                                                                        10175000
<< INITIATOR SECTION.>>                                                 10180000
                                                                        10185000
    << ************************** >>                           <<J8873>>10190000
    << Enable End Of Volume check >>                           <<J8873>>10195000
    << ************************** >>                           <<J8873>>10200000
                                                               <<J8873>>10205000
    IF WS'FUNCTION = FC'ENABLE'EOV'CHECK THEN                  <<J8873>>10210000
    BEGIN                                                      <<J8873>>10215000
    <<IF DIT'DSAVE'EOFS = 0 THEN>>                             <<J8873>>10220000
    <<BEGIN                     >>                             <<J8873>>10225000
        DIT'DSAVE'EOFS := 1;                                   <<J8873>>10230000
        IOQ'STAT := GOOD'IO;                                   <<J8873>>10235000
    <<END ELSE IOQ'IO'STATUS := INVALID'REQUEST; >>            <<J8873>>10240000
      DRIVER'STATE := REQUEST'DONE;                            <<J8873>>10245000
      RETURN;                                                  <<J8873>>10250000
    END;                                                       <<J8873>>10255000
                                                               <<J8873>>10260000
    << ************************* >>                            <<J8873>>10265000
    << Check see EOV flag set    >>                            <<J8873>>10270000
    << ************************* >>                            <<J8873>>10275000
                                                               <<J8873>>10280000
    IF DIT'DSAVE'EOFS = TWO'EOF'ENCOUNTERED THEN               <<J8873>>10285000
      IF WS'FUNCTION = FC'READ                                 <<J8873>>10290000
      OR WS'FUNCTION = FC'NEXT'FILE                            <<J8873>>10295000
      OR WS'FUNCTION = FC'TAPE'GAP                             <<J8873>>10300000
      OR WS'FUNCTION = FC'FOR'SPACE'REC                        <<J8873>>10305000
      THEN BEGIN                                               <<J8873>>10310000
        IOQ'STAT := PASS'EOV'ABORT;                            <<J8873>>10315000
        DRIVER'STATE := REQUEST'DONE;                          <<J8873>>10320000
        RETURN;                                                <<J8873>>10325000
      END;                                                     <<J8873>>10330000
    << Check for valid request.>>                                       10335000
                                                                        10340000
    if IOQ'CMD'QING'STATE = NEW'REQUEST then                            10345000
      if (WS'FUNCTION <  0) or                                          10350000
         (WS'FUNCTION > 22) or                                          10355000
         (TRANSFER'COUNT > MAXIMUM'TRANSFER) then                       10360000
      begin'if                                                          10365000
                                                                        10370000
        << Invalid request.>>                                           10375000
                                                                        10380000
        IOQ'CMD'QING'STATE := 0;                                        10385000
        DRIVER'STATE       := REQUEST'DONE;                             10390000
        IOQ'STAT           := INVALID'REQUEST;                          10395000
                                                                        10400000
        return;                                                         10405000
                                                                        10410000
      end'if;                                                           10415000
                                                                        10420000
    << Mark first Channel Pgm complete if that is the case.>>           10425000
                                                                        10430000
    if IOQ'CMD'QING'STATE = SECOND'REQUEST then                         10435000
      IOQ'CMD'QING'STATE := FINAL'COMPLETE;                             10440000
                                                                        10445000
<< Function processing. >>                                              10450000
                                                                        10455000
    case * WS'FUNCTION of                                               10460000
    begin'case                                                          10465000
$page                                                                   10470000
                                                                        10475000
      begin'frame << Case 0, Read record.>>                             10480000
                                                                        10485000
        if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                     10490000
        begin'if << accept data.>>                                      10495000
                                                                        10500000
          if TRANSFER'COUNT < 6 then                                    10505000
          begin'if                                                      10510000
                                                                        10515000
            << Short read.  Set up Channel Pgm.  Clear short read >>    10520000
            << buffer.  Set read count, read buffer address, bank,>>    10525000
            << short read.                                        >>    10530000
                                                                        10535000
            P'CHAN'PGM (SHORT'READ'BUF)         := 0;                   10540000
            P'CHAN'PGM (SHORT'READ'BUF + 1)     := 0;                   10545000
            P'CHAN'PGM (SHORT'READ'BUF + 2)     := 0;                   10550000
                                                                        10555000
            P'CHAN'PGM (RD'BYTE'CNT) := 6;                              10560000
                                                                        10565000
            P'CHAN'PGM (RD'BUF'ADR) :=                                  10570000
              @P'CHAN'PGM (SHORT'READ'BUF) + SYSDB;                     10575000
            P'CHAN'PGM (RD'BANK'ADR) := 0;                              10580000
                                                                        10585000
            DIT'SHORT'READ := 1;                                        10590000
                                                                        10595000
          end'if                                                        10600000
                                                                        10605000
          else                                                          10610000
          begin'else                                                    10615000
                                                               <<J7668>>10620000
            DIT'FIRST'OP := 1;                                 <<J7668>>10625000
                                                               <<J7668>>10630000
                                                               <<J7668>>10635000
            << Normal read.  Set Channel Pgm transfer count and >>      10640000
            << read buffer bank and address.                    >>      10645000
                                                                        10650000
            P'CHAN'PGM (RD'BYTE'CNT) := TRANSFER'COUNT;                 10655000
            P'CHAN'PGM (RD'BUF'ADR)  := BUF'ADR;                        10660000
            P'CHAN'PGM (RD'BANK'ADR) := BUF'BANK;                       10665000
                                                                        10670000
          end'else;                                                     10675000
                                                                        10680000
          P'CHAN'PGM ( 1) :=    14; <<JUMP TO START OF SECOND PRGM>>    10685000
          P'CHAN'PGM (RD'CNT'BANK) := %2000; <<BANK 0 TRANSFER COUNT>>  10690000
                                                                        10695000
          go to START'IO;                                               10700000
                                                                        10705000
        end'if;                                                         10710000
                                                                        10715000
        if IOQ'CMD'QING'STATE = NEW'REQUEST then                        10720000
        begin'if                                                        10725000
                                                                        10730000
          << Check for an EOF.>>                                        10735000
                                                                        10740000
          EOFCHECK (IOQ'ENTRY'INDEX, 0D, 0, 0);                         10745000
          if <> then                                                    10750000
          begin'if                                                      10755000
                                                                        10760000
          << We found an EOF.>>                                         10765000
                                                                        10770000
            if IOQ'CMD'QING then                                        10775000
            begin'if                                                    10780000
                                                                        10785000
              << Stop command queuing and set final complete.>>         10790000
                                                                        10795000
              IOQ'CMD'QING       := NOT'QED;                            10800000
              IOQ'CMD'QING'STATE := FINAL'COMPLETE;                     10805000
                                                                        10810000
              << It is possible at this point to be referencing >>      10815000
              << the next IOQ with WS'IOQ'INDEX due to command  >>      10820000
              << queuing.  Stop command queuing and set final   >>      10825000
              << complete queuing state on the original IOQ.    >>      10830000
              << From command queuing processing above, it is   >>      10835000
              << possible that this may be redundant at times.  >>      10840000
                                                                        10845000
              IOQ(WS'IOQ'INDEX+ IOQ'QMISC'INDEX).                       10850000
                CMD'QING := NOT'QED;                                    10855000
              IOQ(WS'IOQ'INDEX+ IOQ'QMISC'INDEX).                       10860000
                CMD'QING'STATE := FINAL'COMPLETE;                       10865000
                                                                        10870000
              go to START'IO;                                           10875000
                                                                        10880000
            end'if;                                                     10885000
                                                                        10890000
            IOQ'CMD'QING'STATE := 0;                                    10895000
            DRIVER'STATE       := REQUEST'DONE;                         10900000
                                                                        10905000
            return;                                                     10910000
                                                                        10915000
          end'if;                                                       10920000
        end'if;                                                         10925000
                                                                        10930000
        << Set up Channel pgm for read.  Set command queuing state >>   10935000
        << to first break.                                         >>   10940000
                                                                        10945000
        P'CHAN'PGM ( 1) :=     0; << JUMP TO START>>                    10950000
        P'CHAN'PGM ( 7) := %2001; << RESET MOTION CMD>>                 10955000
        P'CHAN'PGM ( 8) :=     1; << RESET BYTE COUNT>>                 10960000
        P'CHAN'PGM (20) :=     0; << RESET FOR READ>>                   10965000
        P'CHAN'PGM (21) :=    33; << RESET STATUS JUMP>>                10970000
        P'CHAN'PGM (23) :=     0;                                       10975000
        P'CHAN'PGM (24) := %1400; << RESET>>                            10980000
        P'CHAN'PGM (29) := %2007; << RESET END>>                        10985000
        P'CHAN'PGM (30) :=     1; << RESET END>>                        10990000
        P'CHAN'PGM (RD'WR'SKIP) := 0; << JUMP AROUND SPARE>>            10995000
        P'CHAN'PGM (MOTION'CMD) := TC'READ;                             11000000
                                                                        11005000
        IOQ'CMD'QING'STATE := FIRST'BREAK;                              11010000
                                                                        11015000
        go to START'IO;                                                 11020000
                                                                        11025000
      end'frame;  << Case 0, read record.>>                             11030000
$page                                                                   11035000
                                                                        11040000
      begin'frame << Case 1, write record.>>                   <<J7668>>11045000
                                                               <<J7668>>11050000
        if IOQ'CMD'QING'STATE = NEW'REQUEST then goto FRSHF;   <<J7668>>11055000
                                                               <<J7668>>11060000
        if IOQ'CMD'QING'STATE = FINISH then                    <<J7668>>11065000
          goto PROCESS'COMPLETOR;                              <<J7668>>11070000
                                                               <<J7668>>11075000
        if IOQ'CMD'QING'STATE = ERRSDT then                    <<J7668>>11080000
        begin'if                                               <<J7668>>11085000
          DRIVER'STATE := REQUEST'DONE; <<ERROR LOGGED>>       <<J7668>>11090000
          RETURN; <<ALREADY. JUST RETURN>>                     <<J7668>>11095000
                                                               <<J7668>>11100000
        end'if;                                                <<J7668>>11105000
                                                               <<J7668>>11110000
        if IOQ'CMD'QING'STATE = FINAL'COMPLETE then            <<J7668>>11115000
        begin'if                                               <<J7668>>11120000
                                                               <<J7668>>11125000
          if CP'VA'DSJ'VECTOR = 2 then                         <<J7668>>11130000
          begin'if                                             <<J7668>>11135000
            if not L'CP'ONLINE then                            <<J7668>>11140000
              begin'if                                         <<J7668>>11145000
               if IOQ'CMD'QING =NOT'QED then                   <<J7668>>11150000
                goto PROCESS'COMPLETOR                         <<J7668>>11155000
               else                                            <<J7668>>11160000
                                                               <<J7668>>11165000
               IOQ'ENTRY'INDEX := IOQ'QLINK; <<POINT TO NEXT>> <<J7668>>11170000
               IOQ'CMD'QING'STATE := NEW'REQUEST;              <<J7668>>11175000
               IOQ'CMD'QING := 0;                              <<J7668>>11180000
               IOQ'ENTRY'INDEX := WS'IOQ'INDEX; <<PT. TO CUR.>><<J7668>>11185000
               IOQ'CMD'QING'STATE := NEW'REQUEST;              <<J7668>>11190000
               IOQ'CMD'QING := 0;                              <<J7668>>11195000
               go to PROCESS'COMPLETOR;                        <<J7692>>11200000
                                                               <<J7668>>11205000
              end'if;                                          <<J7668>>11210000
                                                               <<J7668>>11215000
            if (L'CHAN'PGM(DEVICE'STATUS) land %17037)=0 then  <<J7668>>11220000
              go to SECHF;                                     <<J7668>>11225000
                                                               <<J7668>>11230000
         << CHECK TO SEE IF ERROR HAPPENED ON QUEUED COMMAND >><<J7668>>11235000
                                                               <<J7668>>11240000
            if IOQ'CMD'QING  = NOT'QED  THEN                   <<J7668>>11245000
              begin'if << NOT QUEUING >>                       <<J7668>>11250000
                GO TO PROCESS'COMPLETOR;                       <<J8488>>11255000
              end'if                                           <<J7668>>11260000
            else << QUEUED REQUEST HAD AN ERROR >>             <<J7668>>11265000
              begin'if                                         <<J7668>>11270000
                if IOQ'QLINK <> 0 then                         <<J7668>>11275000
                  begin'if                                     <<J7668>>11280000
                    IOQ'ENTRY'INDEX := IOQ'QLINK; <<PT. NEXT>> <<J7668>>11285000
                    IOQ'CMD'QING'STATE := ERRSDT; <<MARK CMP>> <<J7668>>11290000
                    IOQ'STAT := TRANSFER'ERROR;                <<J7668>>11295000
                    DIT'ERROR'STATUS :=                        <<J7668>>11300000
                                  [8/3, 8/DIT'ERR'LOG'INDEX];  <<J7668>>11305000
                    DIT'ERROR'LOG'0  :=                        <<J7668>>11310000
                                  P'CHAN'PGM (DEVICE'STATUS);  <<J7668>>11315000
                    DIT'ERROR'LOG'1  :=                        <<J7668>>11320000
                                  P'CHAN'PGM (DEVICE'STATUS+1);<<J7668>>11325000
                    DIT'ERROR'LOG'2  :=                        <<J7668>>11330000
                                  P'CHAN'PGM (DEVICE'STATUS+2);<<J7668>>11335000
                    IOQ'ENTRY'INDEX  := WS'IOQ'INDEX;<<PT BK>> <<J7668>>11340000
                                                               <<J7668>>11345000
                                                               <<J7668>>11350000
                    GO TO SECHF;                               <<J7668>>11355000
                  end'if;                                      <<J7668>>11360000
              end'if;                                          <<J7668>>11365000
                                                               <<J7668>>11370000
          end'if;                                              <<J7668>>11375000
        end'if;                                                <<J7668>>11380000
                                                               <<J7668>>11385000
SECHF: << DO SECOND HALF OF WRITE >>                           <<J7668>>11390000
                                                                        11395000
                                                               <<J7668>>11400000
          DIT'FIRST'OP := 1;                                   <<J7668>>11405000
                                                               <<J7668>>11410000
          P'CHAN'PGM (1) := 86; <<JUMP TO SECOND CHANNEL PRGM>>         11415000
          IOQ'CMD'QING'STATE := FINISH;                        <<J7668>>11420000
                                                                        11425000
          go to START'IO;                                               11430000
                                                                        11435000
                                                               <<J7668>>11440000
FRSHF: << START FIRST HALF OF WRITE >>                         <<J7668>>11445000
        if DIT'END'OF'TAPE and                                          11450000
           not IOQ'WRITE'PAST'EOT then                                  11455000
        begin'if                                                        11460000
                                                                        11465000
          << Write after EOT detected not allowed.>>                    11470000
                                                                        11475000
          if IOQ'CMD'QING then                                          11480000
          begin'if                                                      11485000
                                                                        11490000
            << Stop command queuing and set new request.>>              11495000
                                                                        11500000
            IOQ'CMD'QING       := NOT'QED;                              11505000
            IOQ'CMD'QING'STATE := NEW'REQUEST;                          11510000
                                                                        11515000
            << It is possible at this point to be referencing >>        11520000
            << the next IOQ with WS'IOQ'INDEX due to command  >>        11525000
            << queuing.  Stop command queuing and set final   >>        11530000
            << complete queuing state on the original IOQ.    >>        11535000
            << From command queuing processing above, it is   >>        11540000
            << possible that this may be redundant at times.  >>        11545000
                                                                        11550000
            IOQ(WS'IOQ'INDEX+ IOQ'QMISC'INDEX).                         11555000
              CMD'QING := NOT'QED;                                      11560000
            IOQ(WS'IOQ'INDEX+ IOQ'QMISC'INDEX).                         11565000
              CMD'QING'STATE := FINAL'COMPLETE;                         11570000
                                                                        11575000
            << Point to previous IOQ.>>                                 11580000
                                                                        11585000
            IOQ'ENTRY'INDEX:= WS'IOQ'INDEX;                             11590000
                                                                        11595000
            go to START'IO;                                             11600000
                                                                        11605000
          end'if;                                                       11610000
                                                                        11615000
          IOQ'CMD'QING'STATE := 0;                                      11620000
          DRIVER'STATE       := REQUEST'DONE;                           11625000
          IOQ'STAT           := EOT'WRITE;                              11630000
                                                                        11635000
          return;                                                       11640000
                                                                        11645000
        end'if;                                                         11650000
                                                                        11655000
        << If we are queuing, check to see if the data segment >>       11660000
        << is in memory.  If not, stop command queuing and     >>       11665000
        << don't queue up the write.                           >>       11670000
                                                                        11675000
        if IOQ'CMD'QING then                                            11680000
        begin                                                           11685000
                                                                        11690000
          TOS := absolute (2);                                          11695000
          TOS:= TOS + (IOQ'BUF'DSTN &lsl(2));                           11700000
          TOS := absolute (S0);                                         11705000
                                                                        11710000
          if TOS.(0:1) then                                             11715000
                                                                        11720000
          begin                                                         11725000
                                                                        11730000
            << Data segment isn't in memory.  Clean up the stack.>>     11735000
            << Stop command queuing.  Don't queue up the command.>>     11740000
                                                                        11745000
            assemble (ddel);                                            11750000
                                                                        11755000
            IOQ'CMD'QING       := NOT'QED;                              11760000
            IOQ'CMD'QING'STATE := NEW'REQUEST;                          11765000
                                                                        11770000
            IOQ'ENTRY'INDEX:= WS'IOQ'INDEX;                             11775000
                                                                        11780000
            IOQ'CMD'QING       := NOT'QED;                              11785000
            IOQ'CMD'QING'STATE := FINISH;                      <<J7668>>11790000
                                                                        11795000
            go to START'IO;                                             11800000
                                                                        11805000
          end;                                                          11810000
                                                                        11815000
          << Data segment is in memory.  Clean up the stack and >>      11820000
          << continue.                                          >>      11825000
                                                                        11830000
          assemble (ddel);                                              11835000
                                                                        11840000
        end;                                                            11845000
                                                                        11850000
        P'CHAN'PGM (  1) := 65; <<JUMP TO START>>                       11855000
        P'CHAN'PGM ( 82) := TRANSFER'COUNT;                             11860000
                                                                        11865000
        << Due to command queuing processing, WS'IOQ'INDEX may be >>    11870000
        << pointing to the wrong IOQ.  Recalculate the bank   >>        11875000
        << and address for the write buffer to ensure we are  >>        11880000
        << writing to the correct address.                    >>        11885000
                                                                        11890000
        TOS := absolute (2);               << Point to DST.        >>   11895000
        TOS := TOS + (4* IOQ'BUF'DSTN + 2);                             11900000
                                           << Point to Bank number.>>   11905000
        TOS := absolute (S0).(8:8);        << Bank number.         >>   11910000
        TOS := absolute (S1 + 1);          << DST address.         >>   11915000
        TOS := TOS + 1;                    << Point to stack DB reg>>   11920000
        assemble (LSEA);                   << TOS holds stack DB   >>   11925000
                                           << register contents.   >>   11930000
        << Results of the above is:                    >>               11935000
        << S     = contains stack DB register contents.>>               11940000
        << S - 1 = contains the DST address.           >>               11945000
        << S - 2 = contains the Bank number.           >>               11950000
        << S - 3 = DST table pointer to Bank.          >>               11955000
                                                                        11960000
        if not IOQ'DBREL then                                           11965000
          S0 := 0;                                                      11970000
                                                                        11975000
        L'CHAN'PGM ( 85) := TOS +                                       11980000
          integer (IOQ'BUFADR) +                                        11985000
          (S1 - 1);                                                     11990000
        assemble (del);                                                 11995000
                                                                        12000000
        P'CHAN'PGM ( 84) := TOS;  <<BANK NUMBER>>                       12005000
        assemble (del);                                                 12010000
                                                                        12015000
        P'CHAN'PGM ( 66) := 2;      << SET TO GET ERRS >>      <<J7668>>12020000
        P'CHAN'PGM ( 72) := %2001; <<RESET MOTION CMD>>                 12025000
        P'CHAN'PGM ( 73) :=     1; <<RESET BYTE COUNT>>                 12030000
        P'CHAN'PGM ( 81) := %2000; <<RESET>>                            12035000
        P'CHAN'PGM ( 83) :=     0; <<RESET>>                            12040000
        P'CHAN'PGM ( 86) :=  %601; <<RESET INT/HALT>>                   12045000
        P'CHAN'PGM ( 87) :=     0;                                      12050000
        P'CHAN'PGM ( 92) :=   -51; <<RESET STATUS JUMP>>                12055000
        P'CHAN'PGM ( 93) :=   -39; <<RESET STATUS JUMP>>                12060000
        P'CHAN'PGM (117) := TC'WRITE;                                   12065000
                                                                        12070000
        IOQ'CMD'QING'STATE := FIRST'BREAK;                              12075000
                                                                        12080000
        go to START'IO;                                                 12085000
                                                                        12090000
      end'frame;  << Case 1, write record.>>                            12095000
$page                                                                   12100000
                                                                        12105000
      begin'frame << Case 2, open file.>>                               12110000
                                                                        12115000
        go to GOOD'END;                                                 12120000
                                                                        12125000
      end'frame;  << Case 2, open file.>>                               12130000
                                                                        12135000
                                                                        12140000
                                                                        12145000
                                                                        12150000
      begin'frame << Case 3, close file.>>                              12155000
                                                                        12160000
        go to GOOD'END;                                                 12165000
                                                                        12170000
      end'frame;  << Case 3, close file.>>                              12175000
                                                                        12180000
                                                                        12185000
                                                                        12190000
                                                                        12195000
      begin'frame << Case 4, close device.>>                            12200000
                                                                        12205000
        LPDT'INDEX    := DIT'LDEV* SIZE'OF'LPDT'ENTRY;                  12210000
        LPDT'EOF'TYPE := 1;                                             12215000
                                                                        12220000
        if DIT'REWIND and not DIT'ONLINE then                           12225000
        begin'if                                                        12230000
                                                                        12235000
          P'DIT (DIT'SAVE'INDEX) := 0;                                  12240000
          go to GOOD'END;                                               12245000
                                                                        12250000
        end'if;                                                         12255000
                                                                        12260000
        TAPE'COMMAND := TC'REWIND'OFFLINE;                              12265000
                                                                        12270000
      end'frame;  << Case 4, close device.>>                            12275000
                                                                        12280000
                                                                        12285000
                                                                        12290000
                                                                        12295000
      begin'frame << Case 5, rewind.>>                                  12300000
                                                                        12305000
        if DIT'REWIND and DIT'LOAD'POINT then                           12310000
                                                                        12315000
          go to GOOD'END;                                               12320000
                                                                        12325000
        TAPE'COMMAND := TC'REWIND;                                      12330000
                                                                        12335000
      end'frame;  << Case 5, rewind.>>                                  12340000
                                                                        12345000
                                                                        12350000
                                                                        12355000
                                                                        12360000
      begin'frame << Case 6, write file mark.>>                         12365000
                                                                        12370000
        if DIT'END'OF'TAPE and not IOQ'WRITE'PAST'EOT then              12375000
        begin'if                                                        12380000
                                                                        12385000
          << Attempted to write after EOT detected.>>                   12390000
                                                                        12395000
          IOQ'CMD'QING'STATE := 0;                                      12400000
          DRIVER'STATE       := REQUEST'DONE;                           12405000
          IOQ'STAT           := EOT'WRITE;                              12410000
                                                                        12415000
          return;                                                       12420000
                                                                        12425000
        end'if;                                                         12430000
                                                                        12435000
        TAPE'COMMAND       := TC'FILE'MARK;                             12440000
        IOQ'CMD'QING'STATE := FIRST'BREAK;                              12445000
                                                                        12450000
      end'frame;  << Case 6, write file mark.>>                         12455000
                                                                        12460000
                                                                        12465000
                                                                        12470000
                                                                        12475000
      begin'frame << Case 7, forward space file.>>                      12480000
                                                                        12485000
        TAPE'COMMAND := TC'NEXT'FILE;                                   12490000
                                                                        12495000
      end'frame;  << Case 7, forward space file.>>                      12500000
                                                                        12505000
                                                                        12510000
                                                                        12515000
                                                                        12520000
      begin'frame << Case 8, backspace file.>>                          12525000
                                                                        12530000
        if DIT'LOAD'POINT then                                          12535000
        begin'if                                                        12540000
                                                                        12545000
          << Tried to backspace at BOT.>>                               12550000
                                                                        12555000
          IOQ'CMD'QING'STATE := 0;                                      12560000
          DRIVER'STATE       := REQUEST'DONE;                           12565000
          IOQ'STAT           := BACKSPACE'BOT;                          12570000
                                                                        12575000
          return;                                                       12580000
                                                                        12585000
        end'if;                                                         12590000
                                                                        12595000
        TAPE'COMMAND := TC'PREV'FILE;                                   12600000
                                                                        12605000
      end'frame;  << Case 8, backspace file.>>                          12610000
                                                                        12615000
                                                                        12620000
                                                                        12625000
                                                                        12630000
      begin'frame << Case 9, rewind and offline.>>                      12635000
                                                                        12640000
        if DIT'REWIND and not DIT'ONLINE then                           12645000
                                                                        12650000
          go to GOOD'END;                                               12655000
                                                                        12660000
        TAPE'COMMAND := TC'REWIND'OFFLINE;                              12665000
                                                                        12670000
      end'frame;  << Case 9, rewind and offline.>>                      12675000
                                                                        12680000
                                                                        12685000
                                                                        12690000
                                                                        12695000
      begin'frame << Case 10, gap tape.>>                               12700000
                                                                        12705000
        TAPE'COMMAND := TC'TAPE'GAP;                                    12710000
                                                                        12715000
      end'frame;  << Case 10, gap tape.>>                               12720000
                                                                        12725000
                                                                        12730000
                                                                        12735000
                                                                        12740000
      begin'frame << Case 11, forward space record.>>                   12745000
                                                                        12750000
        EOFCHECK(IOQ'ENTRY'INDEX, 0D, 0, 0);                            12755000
        if <> then                                                      12760000
        begin'if                                                        12765000
                                                                        12770000
          << EOF found.>>                                               12775000
                                                                        12780000
          IOQ'CMD'QING'STATE := 0;                                      12785000
          DRIVER'STATE       := REQUEST'DONE;                           12790000
                                                                        12795000
          return;                                                       12800000
                                                                        12805000
        end'if;                                                         12810000
                                                                        12815000
        TAPE'COMMAND := TC'FOR'SPACE'REC;                               12820000
                                                                        12825000
      end'frame;  << Case 11, forward space record.>>                   12830000
                                                                        12835000
                                                                        12840000
                                                                        12845000
                                                                        12850000
      begin'frame << Case 12, backspace record.>>                       12855000
                                                                        12860000
        EOFCHECK(IOQ'ENTRY'INDEX, 0D, 0, 0);                            12865000
        if <> then                                                      12870000
        begin'if                                                        12875000
                                                                        12880000
          << EOF found.>>                                               12885000
                                                                        12890000
          IOQ'CMD'QING'STATE := 0;                                      12895000
          DRIVER'STATE       := REQUEST'DONE;                           12900000
                                                                        12905000
          return;                                                       12910000
                                                                        12915000
        end'if;                                                         12920000
                                                                        12925000
        if DIT'LOAD'POINT then                                          12930000
        begin'if                                                        12935000
                                                                        12940000
          << Tried to backspace at BOT.>>                               12945000
                                                                        12950000
          IOQ'CMD'QING'STATE := 0;                                      12955000
          DRIVER'STATE       := REQUEST'DONE;                           12960000
          IOQ'STAT           := BACKSPACE'BOT;                          12965000
                                                                        12970000
          return;                                                       12975000
                                                                        12980000
        end'if;                                                         12985000
                                                                        12990000
        TAPE'COMMAND := TC'BAC'SPACE'REC;                               12995000
                                                                        13000000
      end'frame;  << Case 12, backspace record.>>                       13005000
$page                                                                   13010000
                                                                        13015000
      begin'frame << Case 13, backread.>>                               13020000
                                                                        13025000
        if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                     13030000
        begin'if                                                        13035000
                                                                        13040000
          << Complete the request.>>                                    13045000
                                                               <<J7668>>13050000
          DIT'FIRST'OP := 1;                                   <<J7668>>13055000
                                                               <<J7668>>13060000
                                                               <<J7668>>13065000
          P'CHAN'PGM ( 1) := 14; << JUMP TO START OF SECOND PRGM>>      13070000
          P'CHAN'PGM (37) := %2000; << BANK 0 TRANSFER COUNT>>          13075000
          P'CHAN'PGM (RD'BYTE'CNT) := TRANSFER'COUNT;                   13080000
          P'CHAN'PGM (RD'BANK'ADR) := BUF'BANK;                         13085000
          P'CHAN'PGM (RD'BUF'ADR)  := BUF'ADR;                          13090000
                                                                        13095000
          go to START'IO;                                               13100000
                                                                        13105000
        end'if;                                                         13110000
                                                                        13115000
        if IOQ'CMD'QING'STATE = NEW'REQUEST then                        13120000
        begin'if                                                        13125000
                                                                        13130000
          << Check for EOF.>>                                           13135000
                                                                        13140000
          EOFCHECK(IOQ'ENTRY'INDEX, 0D, 0, 0);                          13145000
          if <> then                                                    13150000
          begin'if                                                      13155000
                                                                        13160000
          << We found an EOF.>>                                         13165000
                                                                        13170000
            if IOQ'CMD'QING then                                        13175000
            begin'if                                                    13180000
                                                                        13185000
              << Stop command queuing and set final complete.>>         13190000
                                                                        13195000
              IOQ'CMD'QING       := NOT'QED;                            13200000
              IOQ'CMD'QING'STATE := FINAL'COMPLETE;                     13205000
                                                                        13210000
              << It is possible at this point to be referencing >>      13215000
              << the next IOQ with WS'IOQ'INDEX due to command  >>      13220000
              << queuing.  Stop command queuing and set final   >>      13225000
              << complete queuing state on the original IOQ.    >>      13230000
              << From command queuing processing above, it is   >>      13235000
              << possible that this may be redundant at times.  >>      13240000
                                                                        13245000
              IOQ(WS'IOQ'INDEX+ IOQ'QMISC'INDEX).                       13250000
                CMD'QING := NOT'QED;                                    13255000
              IOQ(WS'IOQ'INDEX+ IOQ'QMISC'INDEX).                       13260000
                CMD'QING'STATE := FINAL'COMPLETE;                       13265000
                                                                        13270000
              go to START'IO;                                           13275000
                                                                        13280000
            end'if;                                                     13285000
                                                                        13290000
            IOQ'CMD'QING'STATE := 0;                                    13295000
            DRIVER'STATE       := REQUEST'DONE;                         13300000
                                                                        13305000
            return;                                                     13310000
                                                                        13315000
          end'if;                                                       13320000
        end'if;                                                         13325000
                                                                        13330000
        if DIT'LOAD'POINT then                                          13335000
        begin'if                                                        13340000
                                                                        13345000
          << We can't backread at BOT.>>                                13350000
                                                                        13355000
          if IOQ'CMD'QING then                                          13360000
          begin'if                                                      13365000
                                                                        13370000
            << Stop command queuing and set final complete.>>           13375000
                                                                        13380000
            IOQ'CMD'QING       := NOT'QED;                              13385000
            IOQ'CMD'QING'STATE := FINAL'COMPLETE;                       13390000
                                                                        13395000
            << It is possible at this point to be referencing >>        13400000
            << the next IOQ with WS'IOQ'INDEX due to command  >>        13405000
            << queuing.  Stop command queuing and set final   >>        13410000
            << complete queuing state on the original IOQ.    >>        13415000
            << From command queuing processing above, it is   >>        13420000
            << possible that this may be redundant at times.  >>        13425000
                                                                        13430000
            IOQ(WS'IOQ'INDEX+ IOQ'QMISC'INDEX).                         13435000
              CMD'QING := NOT'QED;                                      13440000
            IOQ(WS'IOQ'INDEX+ IOQ'QMISC'INDEX).                         13445000
              CMD'QING'STATE := FINAL'COMPLETE;                         13450000
                                                                        13455000
              go to START'IO;                                           13460000
                                                                        13465000
          end'if;                                                       13470000
                                                                        13475000
            IOQ'CMD'QING'STATE := 0;                                    13480000
            IOQ'STAT           := GOOD'BOT;                             13485000
            DRIVER'STATE       := REQUEST'DONE;                         13490000
                                                                        13495000
            return;                                                     13500000
                                                                        13505000
        end'if;                                                         13510000
                                                                        13515000
        P'CHAN'PGM ( 1) :=     0; <<JUMP TO START   >>                  13520000
        P'CHAN'PGM ( 7) := %2001; <<RESET MOTION CMD>>                  13525000
        P'CHAN'PGM ( 8) :=     1; <<RESET BYTE COUNT>>                  13530000
        P'CHAN'PGM (20) :=     0; <<RESET FOR READ  >>                  13535000
        P'CHAN'PGM (23) :=     0;                                       13540000
        P'CHAN'PGM (24) := %1400; <<RESET>>                             13545000
        P'CHAN'PGM (RD'WR'SKIP) :=0; <<JUMP AROUND SPARE>>              13550000
        P'CHAN'PGM (MOTION'CMD) := TC'BACK'READ;                        13555000
                                                                        13560000
        IOQ'CMD'QING'STATE := FIRST'BREAK;                              13565000
                                                                        13570000
        go to START'IO;                                                 13575000
                                                                        13580000
      end'frame;  << Case 13, back read.>>                              13585000
$page                                                                   13590000
                                                                        13595000
      begin'frame << Case 14, transfer count.>>                         13600000
                                                                        13605000
        << Get last transfer count.>>                                   13610000
                                                                        13615000
        if TRANSFER'COUNT < 2 then                                      13620000
        begin'if                                                        13625000
                                                                        13630000
          IOQ'CMD'QING'STATE := 0;                                      13635000
          DRIVER'STATE       := REQUEST'DONE;                           13640000
          IOQ'STAT           := INVALID'REQUEST;                        13645000
                                                                        13650000
          return;                                                       13655000
                                                                        13660000
        end'if;                                                         13665000
                                                                        13670000
        TOS := BUF'BANK'ADR;                                            13675000
        TOS := P'CHAN'PGM (BYTE'COUNT);                                 13680000
        assemble (SSEA); << Store single word from S into         >>    13685000
                         << the address from S-1 (buffer address) >>    13690000
                         << and S-2 (bank).                       >>    13695000
                                                                        13700000
        go to NO'ERROR;                                                 13705000
                                                                        13710000
      end'frame;  << Case 14, transfer count.>>                         13715000
$page                                                                   13720000
                                                                        13725000
      begin'frame << Case 15, read status.>>                            13730000
                                                                        13735000
        if TRANSFER'COUNT < 1 then                                      13740000
        begin'if                                                        13745000
                                                                        13750000
          IOQ'CMD'QING'STATE := 0;                                      13755000
          DRIVER'STATE       := REQUEST'DONE;                           13760000
          IOQ'STAT           := INVALID'REQUEST;                        13765000
                                                                        13770000
          return;                                                       13775000
                                                                        13780000
        end'if;                                                         13785000
                                                                        13790000
        if TRANSFER'COUNT > 5 then                                      13795000
                                                                        13800000
          << Set maximum status byte count.>>                           13805000
                                                                        13810000
           TRANSFER'COUNT := 5;                                         13815000
                                                                        13820000
        << Push address of buffer onto TOS. S = buffer address >>       13825000
        << and S-1 = bank.                                     >>       13830000
                                                                        13835000
        TOS := BUF'BANK'ADR;                                            13840000
                                                                        13845000
        if TRANSFER'COUNT < 3 then                                      13850000
        begin'if                                                        13855000
                                                                        13860000
          << Single status word requested.  Push single status >>       13865000
          << into TOS.  Store single word from S into address  >>       13870000
          << from S-1 (bank) and S-2 (address).                >>       13875000
                                                                        13880000
          TOS := P'DIT (DEVICE'STATUS);                                 13885000
          assemble (ssea);                                              13890000
                                                                        13895000
        end'if                                                          13900000
                                                                        13905000
        else                                                            13910000
                                                                        13915000
        if TRANSFER'COUNT < 5 then                                      13920000
        begin'if                                                        13925000
                                                                        13930000
          << Two word status requested.  Push double word   >>          13935000
          << status onto TOS.  Store double word from S and >>          13940000
          << S-1 into address from S-2 (bank) and S-3       >>          13945000
          << (address).                                     >>          13950000
                                                                        13955000
          TOS := P'DIT (DEVICE'STATUS);                                 13960000
          TOS := P'CHAN'PGM (DEVICE'STATUS + 1);                        13965000
          assemble (SDEA);                                              13970000
                                                                        13975000
        end'if                                                          13980000
                                                                        13985000
        else                                                            13990000
        begin'else                                                      13995000
                                                                        14000000
          << Three word status requested.  Push double word >>          14005000
          << status onto TOS.  Store double word from S and >>          14010000
          << S-1 into address from S-2 (bank) and S-3       >>          14015000
          << (address).                                     >>          14020000
                                                                        14025000
          TOS := P'CHAN'PGM (DEVICE'STATUS);                            14030000
          TOS := P'CHAN'PGM (DEVICE'STATUS + 1);                        14035000
          assemble (SDEA);                                              14040000
                                                                        14045000
          << Increment address on TOS for third word of status.>>       14050000
          << Push third word of status onto TOS.  Store single >>       14055000
          << word from S into address from S-1 (bank) and S-2  >>       14060000
          << (address).                                        >>       14065000
                                                                        14070000
          TOS := TOS + 2;                                               14075000
          TOS := P'CHAN'PGM (DEVICE'STATUS + 2);                        14080000
          assemble (SSEA);                                              14085000
                                                                        14090000
        end'else;                                                       14095000
                                                                        14100000
        go to GOOD'END;                                                 14105000
                                                                        14110000
      end'frame;  << Case 15, read status.>>                            14115000
                                                                        14120000
                                                                        14125000
                                                                        14130000
                                                                        14135000
      begin'frame << Case 16, set density.>>                            14140000
                                                                        14145000
        if IOQ'DENSITY = PE'1600 then                                   14150000
          TAPE'COMMAND := TC'DENSITY'1600                               14155000
        else                                                            14160000
          TAPE'COMMAND := TC'DENSITY'6250;                              14165000
                                                                        14170000
      end'frame;  << Case 16, set density.>>                            14175000
$page                                                                   14180000
                                                                        14185000
      begin'frame << Case 17, download diagnostic.>>                    14190000
                                                                        14195000
        if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                     14200000
                                                                        14205000
          go to CHECK'ERROR;                                            14210000
                                                                        14215000
        P'CHAN'PGM ( 1)          :=    70; <<JUMP TO START>>            14220000
        P'CHAN'PGM (72)          :=     0; <<JUMP AROUND>>              14225000
        P'CHAN'PGM (73)          :=     7;                              14230000
        P'CHAN'PGM (81)          := %2003;                              14235000
        P'CHAN'PGM (86)          :=  %601; <<RESET INTERRUPT HALT>>     14240000
        P'CHAN'PGM (92)          :=   -51; <<RESET STATUS JUMP>>        14245000
        P'CHAN'PGM (93)          :=   -93; <<RESET STATUS JUMP>>        14250000
        P'CHAN'PGM (WR'BYTE'CNT) := TRANSFER'COUNT;                     14255000
        P'CHAN'PGM (WR'BUF'ADR)  := BUF'ADR;                            14260000
        P'CHAN'PGM (WR'BANK'ADR) := BUF'BANK;                           14265000
        P'CHAN'PGM (MOTION'CMD) := TC'WRITE;                            14270000
                                                                        14275000
        IOQ'CMD'QING'STATE := FINAL'COMPLETE;                           14280000
                                                                        14285000
        go to START'IO;                                                 14290000
                                                                        14295000
      end'frame;  << Case 17, download diagnostic.>>                    14300000
                                                                        14305000
                                                                        14310000
                                                                        14315000
                                                                        14320000
      begin'frame << Case 18, download diagnostic.>>                    14325000
                                                                        14330000
        if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                     14335000
                                                                        14340000
          go to CHECK'ERROR;                                            14345000
                                                                        14350000
        P'CHAN'PGM ( 1)          :=   70;  <<JUMP TO START>>            14355000
        P'CHAN'PGM (72)          :=    0;  <<JUMP AROUND>>              14360000
        P'CHAN'PGM (73)          :=    7;                               14365000
        P'CHAN'PGM (81)          := %2004; << DL DIAG>>                 14370000
        P'CHAN'PGM (86)          :=     0; << JUMP 0>>                  14375000
        P'CHAN'PGM (92)          :=   -41; << GO INTERUPT HALT CODE=0>> 14380000
        P'CHAN'PGM (93)          :=   -41; << GOTO INTERUPT HALT >>     14385000
        P'CHAN'PGM (WR'BYTE'CNT) := TRANSFER'COUNT;                     14390000
        P'CHAN'PGM (WR'BUF'ADR)  := BUF'ADR;                            14395000
        P'CHAN'PGM (WR'BANK'ADR) := BUF'BANK;                           14400000
        P'CHAN'PGM (MOTION'CMD) := TC'WRITE;                            14405000
                                                                        14410000
        IOQ'CMD'QING'STATE := FINAL'COMPLETE;                           14415000
                                                                        14420000
        go to START'IO;                                                 14425000
                                                                        14430000
      end'frame;  << Case 18, download diagnostic.>>                    14435000
                                                                        14440000
                                                                        14445000
                                                                        14450000
                                                                        14455000
      begin'frame << Case 19, read diagnostic status.>>                 14460000
                                                                        14465000
        if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                     14470000
                                                                        14475000
          go to CHECK'ERROR;                                            14480000
                                                                        14485000
        P'CHAN'PGM ( 1)          :=     5;  <<JUMP TO START>>           14490000
        P'CHAN'PGM ( 7)          :=     0;                              14495000
        P'CHAN'PGM ( 8)          :=    15;                              14500000
        P'CHAN'PGM (24)          := %1403;  << READ DIAG STATUS>>       14505000
        P'CHAN'PGM (29)          :=     0;  <<JUMP TO INT HALT 0>>      14510000
        P'CHAN'PGM (30)          :=    22;                              14515000
        P'CHAN'PGM (RD'BYTE'CNT) := TRANSFER'COUNT;                     14520000
        P'CHAN'PGM (RD'BUF'ADR)  := BUF'ADR;                            14525000
        P'CHAN'PGM (RD'BANK'ADR) := BUF'BANK;                           14530000
        P'CHAN'PGM (MOTION'CMD) := TC'READ;                             14535000
                                                                        14540000
        IOQ'CMD'QING'STATE := FINAL'COMPLETE;                           14545000
                                                                        14550000
        go to START'IO;                                                 14555000
                                                                        14560000
      end'frame;  << Case 19, read diagnostic status.>>                 14565000
$page                                                                   14570000
                                                                        14575000
      begin'frame << Case 20, loopback.>>                               14580000
                                                                        14585000
        if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                     14590000
                                                                        14595000
          go to CHECK'ERROR;                                            14600000
                                                                        14605000
        P'CHAN'PGM ( 1)          := 79;      <<JUMP TO START>>          14610000
        P'CHAN'PGM (81)          := %4016;   <<WRITE LOOPBACK COMMAND>> 14615000
        P'CHAN'PGM (82)          := TRANSFER'COUNT;                     14620000
        P'CHAN'PGM (83)          := 0;                                  14625000
        P'CHAN'PGM (85)          := BUF'ADR;                            14630000
        P'CHAN'PGM (86)          := 0;                                  14635000
        P'CHAN'PGM (87)          := 0;   <<BYPASS INT HALT>>            14640000
        P'CHAN'PGM (92)          := -70; <<JUMP READ LOOPBACK DSJ=0>>   14645000
        P'CHAN'PGM (93)          := -39; <<GO READ STATUS DSJ=1>>       14650000
        P'CHAN'PGM (WR'BANK'ADR) := BUF'BANK;                           14655000
        P'CHAN'PGM (24)          := %3416; <<START READ LOOPBACK DSJ=0>>14660000
        P'CHAN'PGM (RD'BYTE'CNT) := TRANSFER'COUNT;                     14665000
        P'CHAN'PGM (26)          := 0;                                  14670000
        P'CHAN'PGM (RD'BANK'ADR) := BUF'BANK;                           14675000
        P'CHAN'PGM (RD'BUF'ADR)  := BUF'ADR;                            14680000
        P'CHAN'PGM (29)          := 0; <<JUMP TO DSJ>>                  14685000
        P'CHAN'PGM (30)          := 8;                                  14690000
                                                                        14695000
        IOQ'CMD'QING'STATE := FINAL'COMPLETE;                           14700000
                                                                        14705000
        go to START'IO;                                                 14710000
                                                                        14715000
      end'frame;  << Case 20, loopback.>>                               14720000
$page                                                                   14725000
                                                                        14730000
      begin'frame << Case 21, selftest.>>                               14735000
                                                                        14740000
        if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                     14745000
                                                                        14750000
          go to CHECK'ERROR;                                            14755000
                                                                        14760000
        P'CHAN'PGM ( 1)          :=    22; <<JUMP TO START>>            14765000
        P'CHAN'PGM (20)          :=    59; << FIX JUMP VECTOR >>        14770000
        P'CHAN'PGM (21)          :=    59; << FIX JUMP VECTOR >>        14775000
        P'CHAN'PGM (24)          := %4017; <<SELF TEST>>                14780000
        P'CHAN'PGM (26)          :=     0;                              14785000
        P'CHAN'PGM (29)          :=     0; <<BYTE COUNT>>               14790000
        P'CHAN'PGM (30)          :=   -15; <<BYPASS SPFD>>              14795000
        P'CHAN'PGM (81)          := %3417; <<READ SELFTEST RESULTS>>    14800000
        P'CHAN'PGM (82)          :=     1; <<ONLY ONE BYTE RETURNED>>   14805000
        P'CHAN'PGM (83)          :=     0;                              14810000
        P'CHAN'PGM (85)          := BUF'ADR;                            14815000
        P'CHAN'PGM (86)          :=  %601; <<RESET INT HALT>>           14820000
        P'CHAN'PGM (87)          :=     0;                              14825000
        P'CHAN'PGM (RD'BYTE'CNT) :=     1;                              14830000
        P'CHAN'PGM (RD'BANK'ADR) := BUF'BANK;                           14835000
        P'CHAN'PGM (RD'BUF'ADR)  := BUF'ADR;                            14840000
        P'CHAN'PGM (WR'BANK'ADR) := BUF'BANK;                           14845000
                                                                        14850000
        IOQ'CMD'QING'STATE := FINAL'COMPLETE;                           14855000
                                                                        14860000
        go to START'IO;                                                 14865000
                                                                        14870000
      end'frame;  << Case 21, selftest.>>                               14875000
                                                                        14880000
                                                                        14885000
                                                                        14890000
                                                                        14895000
      begin'frame << Case 22, end diagnostic.>>                         14900000
                                                                        14905000
        if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                     14910000
                                                                        14915000
          go to CHECK'ERROR;                                            14920000
                                                                        14925000
        P'CHAN'PGM (1) := (46);                                         14930000
                                                                        14935000
        IOQ'CMD'QING'STATE := FINAL'COMPLETE;                           14940000
                                                                        14945000
        go to START'IO;                                                 14950000
                                                                        14955000
      end'frame;  << Case 22, end diagnostic.>>                         14960000
                                                                        14965000
    end'case;                                                           14970000
$page                                                                   14975000
                                                                        14980000
PROCESS'CONTINUE:                                                       14985000
                                                                        14990000
    P'CHAN'PGM ( 1)               :=     0;                             14995000
    P'CHAN'PGM ( 7)               := %2001; <<RESET>>                   15000000
    P'CHAN'PGM ( 8)               :=     1; <<RESET>>                   15005000
    P'CHAN'PGM (20)               :=    21; <<BRANCH AROUND RD LOGIC>>  15010000
    P'CHAN'PGM (21)               :=    33;                             15015000
    P'CHAN'PGM (MOTION'CMD) := TAPE'COMMAND;                            15020000
    P'CHAN'PGM (RD'WR'SKIP)       :=     2;                             15025000
                             << BRANCH AROUND READ/WRITE DATA LOGIC >>  15030000
                                                                        15035000
    if IOQ'CMD'QING'STATE = FINAL'COMPLETE then                         15040000
                                                                        15045000
      go to CHECK'ERROR;                                                15050000
                                                                        15055000
    IOQ'CMD'QING'STATE := FINAL'COMPLETE;                               15060000
                                                                        15065000
START'IO:                                                               15070000
                                                                        15075000
    << Start Channel Pgm.>>                                             15080000
                                                                        15085000
    START'HPIB (P'DIT, P'CHAN'PGM, TRUE);                               15090000
    if < then                                                           15095000
    begin'if                                                            15100000
                                                                        15105000
      << Channel pgm failed to start.>>                                 15110000
                                                                        15115000
      if not IOQ'CMD'QING then   << If not command queuing,>>           15120000
        MASTERCLEARHPIB (P'DIT); << halt channel program.  >>           15125000
                                                                        15130000
      P'DIT (DIT'SAVE'INDEX) := 0;                                      15135000
      IOQ'CMD'QING'STATE     := 0;                                      15140000
      IOQ'STAT               := CHAN'PGM'FAILURE;                       15145000
      DRIVER'STATE           := REQUEST'DONE;                           15150000
                                                                        15155000
      return;                                                           15160000
                                                                        15165000
    end'if;                                                             15170000
                                                                        15175000
    P'CHAN'PGM'VAR'AREA := 0;                                           15180000
    DIT'REWIND          := 0;  << Reset rewound bit.>>                  15185000
    DRIVER'STATE        := INTERRUPT'WAIT;                              15190000
                                                                        15195000
    if IOQ'BACKSPACE'EOF then                                           15200000
                                                                        15205000
      return;                                                           15210000
                                                                        15215000
      IOQ'STAT          := COMPLETION'WAIT;                             15220000
                                                                        15225000
    return;                                                             15230000
                                                                        15235000
  end'if << Initiator section.>>                                        15240000
$page                                                                   15245000
                                                                        15250000
<< CONTINUATOR SECTION.>>                                               15255000
                                                                        15260000
  else                                                                  15265000
                                                                        15270000
PROCESS'COMPLETOR:                                                      15275000
                                                                        15280000
  begin'else                                                            15285000
                                                                        15290000
    if IOQ'SFAIL then                                                   15295000
    begin'if                                                            15300000
                                                               <<J7668>>15305000
                                                               <<J7668>>15310000
      SET'ABORT;                                               <<J7668>>15315000
                                                               <<J7668>>15320000
      << FAILURE ON DELAYED START I/O >>                                15325000
                                                                        15330000
      if not IOQ'CMD'QING then   << If not command queuing,>>           15335000
        MASTERCLEARHPIB (P'DIT); << halt channel program.  >>           15340000
                                                                        15345000
      P'DIT (DIT'SAVE'INDEX) := 0; << Device processing flags.>>        15350000
      IOQ'CMD'QING'STATE     := 0;                                      15355000
      DRIVER'STATE           := REQUEST'DONE;                           15360000
      IOQ'STAT               := CHAN'PGM'FAILURE;                       15365000
      DIT'ERROR'STATUS := [8/3, 8/DIT'ERR'LOG'INDEX];          <<J7668>>15370000
      return;                                                           15375000
                                                                        15380000
    end'if;                                                             15385000
$page                                                                   15390000
                                                                        15395000
CHECK'ERROR:                                                            15400000
                                                                        15405000
    << Check for channel errors.>>                                      15410000
                                                                        15415000
    if CP'VA'ERROR'CODE > 5 then  << DMA ABORT >>                       15420000
    begin'if                                                            15425000
                                                               <<J7668>>15430000
      SET'ABORT;                                               <<J7668>>15435000
                                                               <<J7668>>15440000
                                                               <<J7668>>15445000
      DIT'ERROR'STATUS := [8/3, 8/DIT'ERR'LOG'INDEX];                   15450000
              <<LOG CHANNEL STATUS>>                                    15455000
      DIT'ERROR'LOG'0 := P'CHAN'PGM'VAR'AREA;                           15460000
                                                                        15465000
      if not IOQ'CMD'QING then   << If not command queuing,>>           15470000
        MASTERCLEARHPIB (P'DIT); << halt channel program.  >>           15475000
                                                                        15480000
      P'DIT (DIT'SAVE'INDEX) := 0; << Device processing flags.>>        15485000
      IOQ'CMD'QING'STATE     := 0;                                      15490000
      DRIVER'STATE           := REQUEST'DONE;                           15495000
      IOQ'STAT               := CHAN'IO'FAILURE;                        15500000
                                                                        15505000
      return;                                                           15510000
                                                                        15515000
    end'if;                                                             15520000
                                                                        15525000
    if L'CP'POWERED'UP and not L'CP'ONLINE then                         15530000
    begin'if                                                            15535000
                                                                        15540000
      << Power restart has occured.>>                                   15545000
                                                               <<J7668>>15550000
      SET'ABORT;                                               <<J7668>>15555000
                                                               <<J7668>>15560000
                                                               <<J7668>>15565000
      if not IOQ'CMD'QING then   << If not command queuing,>>           15570000
        MASTERCLEARHPIB (P'DIT); << halt channel program.  >>           15575000
                                                                        15580000
      P'DIT (DIT'SAVE'INDEX) := 0; << Device processing flags.>>        15585000
      IOQ'CMD'QING'STATE     := 0;                                      15590000
      DRIVER'STATE           := REQUEST'DONE;                           15595000
      IOQ'STAT               := POWER'UP;                               15600000
                                                                        15605000
      return;                                                           15610000
                                                                        15615000
    end'if;                                                             15620000
                                                                        15625000
    << Get status bytes >>                                              15630000
                                                                        15635000
    P'DIT (DIT'STATUS'INDEX) := P'CHAN'PGM (DEVICE'STATUS);             15640000
    DIT'ERROR'LOG'0          := P'CHAN'PGM (DEVICE'STATUS);             15645000
    DIT'ERROR'LOG'1          := P'CHAN'PGM (DEVICE'STATUS + 1);         15650000
    DIT'ERROR'LOG'2          := P'CHAN'PGM (DEVICE'STATUS + 2);         15655000
                                                                        15660000
    << Check for I/O errors.>>                                          15665000
                                                                        15670000
    if CP'VA'DSJ'VECTOR <> 0 then                                       15675000
    begin'if                                                            15680000
                                                                        15685000
      << An error has occured.>>                                        15690000
      if not IOQ'CMD'QING THEN                                 <<J7668>>15695000
        P'CHAN'PGM'VAR'AREA (CP'VA'1'INDEX) := 0;              <<J7668>>15700000
                                                                        15705000
      if not DIT'ONLINE then                                   <<J7668>>15710000
      begin'if                                                 <<J7668>>15715000
                                                               <<J7668>>15720000
        << Unit not ready.>>                                   <<J7668>>15725000
                                                               <<J7668>>15730000
        if WS'FUNCTION = FC'CLOSE'DEVICE then                  <<J7668>>15735000
                                                               <<J7668>>15740000
          go to GOOD'END;                                      <<J7668>>15745000
                                                               <<J7668>>15750000
        if ((WS'FUNCTION = FC'WRITE) LAND (IOQ'CMD'QING =QING))<<J7668>>15755000
        then  begin'if                                         <<J7668>>15760000
          if IOQ'QLINK <> 0 then                               <<J7668>>15765000
          begin'if                                             <<J7668>>15770000
            IOQ'ENTRY'INDEX := IOQ'QLINK; <<POINT TO NEXT>>    <<J7668>>15775000
            if IOQ'CMD'QING'STATE = NEW'REQUEST then           <<J7668>>15780000
              begin'if                                         <<J7668>>15785000
                IOQ'ENTRY'INDEX := WS'IOQ'INDEX; <<PT BCK>>    <<J7668>>15790000
                GO TO NOTRDY;                                  <<J7668>>15795000
              end'if                                           <<J7668>>15800000
            else                                               <<J7668>>15805000
              begin'if   << DO NOT ISSUE REQUEST TWICE >>      <<J7668>>15810000
                IOQ'CMD'QING := NOT'QED;                       <<J7668>>15815000
                IOQ'CMD'QING'STATE := NEW'REQUEST;             <<J7668>>15820000
                IOQ'ENTRY'INDEX := WS'IOQ'INDEX; <<PT BCK>>    <<J7668>>15825000
                P'CHAN'PGM (1) := 86;                          <<J7668>>15830000
                go to START'IO;                                <<J7668>>15835000
              end'if;                                          <<J7668>>15840000
          end'if;                                              <<J7668>>15845000
        end'if;                                                <<J7668>>15850000
                                                               <<J7668>>15855000
NOTRDY:                                                        <<J7668>>15860000
          if IOMESSAGE(1, NOT'READY'MSG,%10000,                <<J7668>>15865000
           DIT'LDEV,,,,,CONSOLE) then                          <<J7668>>15870000
        begin'if                                                        15875000
                                                                        15880000
          DRIVER'STATE       := OPERATOR'WAIT;                          15885000
          IOQ'CMD'QING'STATE := 0;                                      15890000
          IOQ'STAT           := NOT'READY'WAIT;                         15895000
                                                                        15900000
          return;                                                       15905000
                                                                        15910000
        end'if;                                                         15915000
                                                                        15920000
        if not IOQ'CMD'QING then   << If not command queuing,>>         15925000
          MASTERCLEARHPIB (P'DIT); << halt channel program.  >>         15930000
                                                                        15935000
        P'DIT (DIT'SAVE'INDEX) := 0; << Device processing flags.>>      15940000
        IOQ'CMD'QING'STATE     := 0;                                    15945000
        DRIVER'STATE           := REQUEST'DONE;                         15950000
        IOQ'STAT               := SYSTEM'ERROR;                         15955000
                                                                        15960000
        return;                                                         15965000
                                                                        15970000
      end'if;                                                           15975000
$page                                                                   15980000
                                                                        15985000
TEST'WRITE:                                                             15990000
                                                                        15995000
      if WS'FUNCTION = FC'WRITE     or                                  16000000
         WS'FUNCTION = FC'FILE'MARK or                                  16005000
         WS'FUNCTION = FC'TAPE'GAP  or                                  16010000
         (WS'FUNCTION = FC'DENSITY land DIT'LOAD'POINT) then            16015000
      begin'if                                                          16020000
                                                                        16025000
        if DIT'FILE'PROTECT then                                        16030000
        begin'if                                                        16035000
                                                                        16040000
          << There is no write ring.  Write disabled.>>                 16045000
                                                                        16050000
          if IOMESSAGE (1, NO'WRITE'RING'MSG, %10000,                   16055000
                        DIT'LDEV,,,,, CONSOLE) then                     16060000
          begin'if                                                      16065000
                                                                        16070000
            P'DIT (DIT'TIMEOUT'INDEX) := 0;                             16075000
            P'DIT (DIT'TIMEOUT'REQUEST) :=                              16080000
              TIMEREQ (%20, @P'DIT, 1000D);                             16085000
                                                                        16090000
            IOQ'CMD'QING'STATE := NEW'REQUEST;                          16095000
            DRIVER'STATE       := INTERRUPT'WAIT;                       16100000
                                                                        16105000
            return;                                                     16110000
                                                                        16115000
          end'if;                                                       16120000
                                                                        16125000
          if not IOQ'CMD'QING then   << If not command queuing,>>       16130000
            MASTERCLEARHPIB (P'DIT); << halt channel program.  >>       16135000
                                                                        16140000
          P'DIT (DIT'SAVE'INDEX) := 0; << Device processing flags.>>    16145000
          IOQ'CMD'QING'STATE     := 0;                                  16150000
          DRIVER'STATE           := REQUEST'DONE;                       16155000
          IOQ'STAT               := SYSTEM'ERROR;                       16160000
                                                                        16165000
          return;                                                       16170000
                                                                        16175000
        end'if;                                                         16180000
                                                                        16185000
        if DRIVER'STATE = 2 then                                        16190000
                                                                        16195000
          go to GOOD'END;                                               16200000
                                                                        16205000
      end'if;                                                           16210000
$page                                                                   16215000
                                                                        16220000
      if L'CP'POWERED'DOWN then                                         16225000
      IOQ'STAT:= UNIT'FAILURE                                           16230000
                                                                        16235000
      else                                                              16240000
                                                                        16245000
      if DIT'COMMAND'REJECT and                                         16250000
         CP'ERROR'DETAIL = SELF'TEST'ERROR then                         16255000
         IOQ'STAT := UNIT'FAILURE                                       16260000
                                                                        16265000
      else                                                              16270000
                                                                        16275000
      if DIT'COMMAND'REJECT and                                         16280000
         CP'ERROR'DETAIL = FCU'MTU'REJECT and                           16285000
         CP'REJECT'CODE = %11 then                                      16290000
                                                                        16295000
        << Blank or 800 BPI tape.>>                                     16300000
                                                                        16305000
        IOQ'STAT := TRANSFER'ERROR                                      16310000
                                                                        16315000
      else                                                              16320000
                                                                        16325000
      if WS'FUNCTION = FC'DENSITY and                                   16330000
         DIT'COMMAND'REJECT then                                        16335000
         IOQ'STAT := DENSITY'ERROR                                      16340000
                                                                        16345000
      else                                                              16350000
                                                                        16355000
      if DIT'TAPE'RUNAWAY then                                          16360000
        IOQ'STAT := TAPE'RUNAWAY                                        16365000
                                                                        16370000
      else                                                              16375000
                                                                        16380000
      if DIT'COMMAND'REJECT then                                        16385000
        IOQ'STAT := if CP'ERROR'DETAIL = 5 then                         16390000
                                                                        16395000
                           << An error occured on a prior command.>>    16400000
                                                                        16405000
                           PRIOR'ERR'ABORT                              16410000
                         else                                           16415000
                           UNIT'FAILURE                                 16420000
                                                                        16425000
      else                                                              16430000
                                                                        16435000
      if not (DIT'DEVICE'BUSY = 0) then                                 16440000
        if WS'FUNCTION = FC'REWIND or                                   16445000
           WS'FUNCTION = FC'REWIND'OFFLINE then                         16450000
                                                                        16455000
          << Device is rewinding.>>                                     16460000
                                                                        16465000
          go to NO'ERROR                                                16470000
                                                                        16475000
        else                                                            16480000
                                                                        16485000
          IOQ'STAT := UNIT'FAILURE                                      16490000
                                                                        16495000
      else                                                              16500000
                                                                        16505000
      if DIT'TIMING'ERROR then                                          16510000
      IOQ'STAT := TIMING'ERROR                                          16515000
                                                                        16520000
      else                                                              16525000
                                                                        16530000
      if DIT'ONE'TRACK'ERROR then                                       16535000
      IOQ'STAT := TRANSFER'ERROR                                        16540000
                                                                        16545000
      else                                                              16550000
                                                                        16555000
      if DIT'MULT'TRACK'ERR then                                        16560000
      IOQ'STAT := TRANSFER'ERROR ELSE GOTO NO'ERROR;                    16565000
                                                                        16570000
      << Log the error status.>>                                        16575000
                                                                        16580000
      DIT'ERROR'STATUS := [8/3, 8/DIT'ERR'LOG'INDEX];                   16585000
                                                                        16590000
      if not IOQ'CMD'QING then   << If not command queuing,>>           16595000
        MASTERCLEARHPIB (P'DIT); << halt channel program.  >>           16600000
                                                                        16605000
                                                               <<J7668>>16610000
      DIT'REWIND :=0;                                          <<J7668>>16615000
      DIT'REWIND'OFFLINE := 0;                                 <<J7668>>16620000
      DIT'SHORT'READ     := 0;                                 <<J7668>>16625000
      DIT'POWERFAIL      := 0;                                 <<J7668>>16630000
      DIT'PENDING'ABORT  := 0;                                 <<J7668>>16635000
                                                               <<J7668>>16640000
      IOQ'CMD'QING'STATE     := 0;                                      16645000
                                                               <<J7668>>16650000
      <<   DO NOT LOG PRIOR ERROR ABORTS >>                    <<J7668>>16655000
      <<   ON READS; WITHOUT THIS THE LOG FILES ARE FILLED >>  <<J7668>>16660000
      <<   DURING A RESTORE WITH PRIOR ERROR ABORT MSGS >>     <<J7668>>16665000
                                                               <<J7668>>16670000
      if (IOQ'STAT = PRIOR'ERR'ABORT) land                     <<J7668>>16675000
      (WS'FUNCTION = FC'READ) then                             <<J7668>>16680000
        DIT'ERROR'STATUS := 0;                                 <<J7668>>16685000
                                                               <<J7668>>16690000
      DRIVER'STATE           := REQUEST'DONE;                           16695000
                                                                        16700000
      return;                                                           16705000
                                                                        16710000
    end'if;                                                             16715000
$page                                                                   16720000
                                                                        16725000
<< No I/O errors.>>                                                     16730000
                                                                        16735000
NO'ERROR:                                                               16740000
                                                                        16745000
    << *************************** >>                          <<J8873>>16750000
    << See if Operation is READ    >>                          <<J8873>>16755000
    << *************************** >>                          <<J8873>>16760000
                                                               <<J8873>>16765000
    IF WS'FUNCTION <> FC'READ AND DIT'DSAVE'EOFS > 0           <<J8873>>16770000
    THEN DIT'DSAVE'EOFS := 1;  << RESET TO INITIAL STATE >>    <<J8873>>16775000
    if DIT'REWIND'OFFLINE then                                          16780000
    begin'if                                                            16785000
                                                                        16790000
      IOQ'STAT           := BACKSPACE'BOT;                              16795000
                                                                        16800000
      DIT'REWIND'OFFLINE := 0;                                          16805000
      DRIVER'STATE       := OPERATOR'WAIT;                              16810000
      IOQ'CMD'QING'STATE := 0;                                          16815000
      IOQ'STAT           := WRITE'RING'WAIT;                            16820000
                                                                        16825000
      return;                                                           16830000
                                                                        16835000
    end'if;                                                             16840000
                                                                        16845000
    if DIT'END'OF'FILE then                                             16850000
    begin'if                                                            16855000
                                                                        16860000
      << Set End of File in LPDT.>>                                     16865000
                                                                        16870000
      LPDT'INDEX    := DIT'LDEV* SIZE'OF'LPDT'ENTRY;                    16875000
      LPDT'EOF'TYPE := 1;                                               16880000
                                                                        16885000
    end'if;                                                             16890000
                                                                        16895000
    if WS'FUNCTION = FC'FOR'SPACE'REC or                                16900000
       WS'FUNCTION = FC'BAC'SPACE'REC or                                16905000
       WS'FUNCTION = FC'BACK'READ   then                                16910000
    begin'if                                                            16915000
                                                                        16920000
      EOFCHECK(IOQ'ENTRY'INDEX, WS'BUF'BANK'ADR, 0, 0);        <<J7668>>16925000
      if <> then                                                        16930000
      begin'if                                                          16935000
                                                                        16940000
        IOQ'CMD'QING'STATE := 0;                                        16945000
        DRIVER'STATE       := REQUEST'DONE;                             16950000
                                                                        16955000
        return;                                                         16960000
                                                                        16965000
      end'if;                                                           16970000
    end'if                                                              16975000
                                                                        16980000
    else                                                                16985000
                                                                        16990000
    if WS'FUNCTION = FC'REWIND         or                               16995000
       WS'FUNCTION = FC'REWIND'OFFLINE or                               17000000
       WS'FUNCTION = FC'CLOSE'DEVICE   then                             17005000
    begin'if                                                            17010000
                                                                        17015000
                                                               <<J8873>>17020000
     << IN CASE OF REWIND/REWIND OFFLINE >>                    <<J8873>>17025000
      IF DIT'DSAVE'EOFS > 0 THEN   << CLEAR COUNTER >>         <<J8873>>17030000
        IF WS'FUNCTION = FC'CLOSE'DEVICE                       <<J8873>>17035000
          THEN DIT'DSAVE'EOFS := 0  << COUNTER CLEARED >>      <<J8873>>17040000
          ELSE DIT'DSAVE'EOFS := 1; << REENABLE THE COUNTER >> <<J8873>>17045000
      IOQ'COUNT          := 0;                                          17050000
      DIT'REWIND         := 1;                                          17055000
                                                                        17060000
      if WS'FUNCTION <> FC'REWIND or                                    17065000
         DIT'LOAD'POINT then                                            17070000
                                                                        17075000
        go to GOOD'END;                                                 17080000
                                                                        17085000
      << Reissue rewind command.>>                                      17090000
                                                                        17095000
      IOQ'CMD'QING'STATE := NEW'REQUEST;                                17100000
      DIT'LOAD'POINT     := 1;                                          17105000
      DRIVER'STATE       := OPERATOR'WAIT;                              17110000
                                                                        17115000
      return;                                                           17120000
                                                                        17125000
    end'if;                                                             17130000
                                                                        17135000
    if WS'FUNCTION = FC'READ and TRANSFER'COUNT <> 0 then               17140000
    begin'if                                                            17145000
                                                                        17150000
     << ******************************** >>                    <<J8873>>17155000
     << For READ, see if EOF encountered >>                    <<J8873>>17160000
     << ******************************** >>                    <<J8873>>17165000
                                                               <<J8873>>17170000
     IF DIT'DSAVE'EOFS > 0 AND                                 <<J8873>>17175000
       DIT'DSAVE'EOFS < TWO'EOF'ENCOUNTERED                    <<J8873>>17180000
       THEN IF DIT'END'OF'FILE THEN                            <<J8873>>17185000
         DIT'DSAVE'EOFS := DIT'DSAVE'EOFS + 1                  <<J8873>>17190000
         ELSE DIT'DSAVE'EOFS := 1;                             <<J8873>>17195000
      if DIT'SHORT'READ then                                            17200000
      begin'if                                                          17205000
                                                                        17210000
        DIT'SHORT'READ := 0; << Reset short read.>>                     17215000
                                                                        17220000
        << Get transfered byte count, bank and address of buffer >>     17225000
        << used for transfer, check for EOF.                     >>     17230000
                                                                        17235000
        BYTES'TRANSFERED := 6 - P'CHAN'PGM (RD'BYTE'CNT);               17240000
        WS'BUF'BANK'ADR := double                              <<J8992>>17245000
        (LOGICAL(@P'CHAN'PGM(SHORT'READ'BUF) + SYSDB));        <<J8992>>17250000
                                                                        17255000
        EOFCHECK(IOQ'ENTRY'INDEX, WS'BUF'BANK'ADR,                      17260000
             BYTES'TRANSFERED, 0);                                      17265000
        if > then                                                       17270000
        begin'if                                                        17275000
                                                                        17280000
          IOQ'CMD'QING'STATE := 0;                                      17285000
          DRIVER'STATE       := REQUEST'DONE;                           17290000
                                                                        17295000
          return;                                                       17300000
                                                                        17305000
        end'if;                                                         17310000
                                                                        17315000
        if < then                                                       17320000
        begin'if                                                        17325000
                                                                        17330000
          IOQ'BACKSPACE'EOF := 1;                                       17335000
          TAPE'COMMAND := TC'BAC'SPACE'REC;                             17340000
                                                                        17345000
          if DIT'LOAD'POINT then                                        17350000
          begin'if                                                      17355000
                                                                        17360000
            IOQ'CMD'QING'STATE := 0;                                    17365000
            DRIVER'STATE       := REQUEST'DONE;                         17370000
            IOQ'STAT           := BACKSPACE'BOT;                        17375000
                                                                        17380000
            return;                                                     17385000
                                                                        17390000
          end'if;                                                       17395000
                                                                        17400000
          go to PROCESS'CONTINUE;                                       17405000
                                                                        17410000
        end'if;                                                         17415000
                                                                        17420000
        if BYTES'TRANSFERED < TRANSFER'COUNT then                       17425000
          TRANSFER'COUNT := BYTES'TRANSFERED;                           17430000
                                                                        17435000
        << Transfer data to user's buffer.>>                            17440000
                                                                        17445000
        TOS := BUF'BANK'ADR;                  << Destination address.>> 17450000
        TOS := WS'BUF'BANK'ADR;               << Source address.     >> 17455000
        TOS := (TRANSFER'COUNT +1 ) &ASR (1); << Words to move.      >> 17460000
                                                                        17465000
        assemble (mabs); << Transfer it.>>                              17470000
                                                                        17475000
      end'if                                                            17480000
                                                                        17485000
      else                                                              17490000
      begin'else << NORMAL READ PROCESSING >>                           17495000
                                                                        17500000
        TRANSFER'COUNT := TRANSFER'COUNT - P'CHAN'PGM (RD'BYTE'CNT);    17505000
                                                                        17510000
        EOFCHECK(IOQ'ENTRY'INDEX, BUF'BANK'ADR,                         17515000
             TRANSFER'COUNT,0);                                         17520000
        if <> then  << EOF FOUND >>                                     17525000
        begin'if                                                        17530000
                                                                        17535000
          if < then                                                     17540000
            IOQ'BACKSPACE'EOF := 1;                                     17545000
                                                                        17550000
          X := if TRANSFER'COUNT < 127 then                             17555000
                 (TRANSFER'COUNT + 3) &ASR (1)                          17560000
               else                                                     17565000
                 128;                                                   17570000
          TOS := BUF'BANK'ADR;                                          17575000
                                                                        17580000
          while (X := X - 1) <> 0 do                                    17585000
          begin'while  << BLANK OUT USER'S BUFFER >>                    17590000
                                                                        17595000
            TOS := 0;                                                   17600000
            assemble (SSEA);                                            17605000
            TOS := TOS + 1;                                             17610000
          end'while;                                                    17615000
                                                                        17620000
          if IOQ'BACKSPACE'EOF then                                     17625000
          begin'if                                                      17630000
                                                                        17635000
            TAPE'COMMAND := TC'BAC'SPACE'REC;                           17640000
                                                                        17645000
            if DIT'LOAD'POINT then                                      17650000
            begin'if                                                    17655000
                                                                        17660000
              IOQ'CMD'QING'STATE := 0;                                  17665000
              DRIVER'STATE       := REQUEST'DONE;                       17670000
              IOQ'STAT           := BACKSPACE'BOT;                      17675000
                                                                        17680000
              return;                                                   17685000
                                                                        17690000
            end'if;                                                     17695000
                                                                        17700000
            go to PROCESS'CONTINUE;                                     17705000
                                                                        17710000
          end'if                                                        17715000
                                                                        17720000
          else                                                          17725000
                                                                        17730000
          begin'else                                                    17735000
                                                                        17740000
            IOQ'CMD'QING'STATE := 0;                                    17745000
            DRIVER'STATE       := REQUEST'DONE;                         17750000
                                                                        17755000
                                                               <<J7668>>17760000
            if not (CP'RETRY'COUNT = 0) then                   <<J7668>>17765000
              begin'if                                         <<J7668>>17770000
                 DIT'ERROR'STATUS :=[8/3, 8/DIT'ERR'LOG'INDEX];<<J7668>>17775000
                 IOQ'RETRY'COUNT := CP'RETRY'COUNT;            <<J7668>>17780000
                 IOQ'STAT        := GOOD'RETRY;                <<J7668>>17785000
                                                               <<J7668>>17790000
               end'if;                                         <<J7668>>17795000
                                                               <<J7668>>17800000
            return;                                                     17805000
                                                                        17810000
          end'else;                                                     17815000
        end'if;                                                         17820000
      end'else;                                                         17825000
                                                                        17830000
      if INTEGER(IOQ'COUNT) < 0 then                                    17835000
        IOQ'COUNT          := -TRANSFER'COUNT                           17840000
      else                                                              17845000
        IOQ'COUNT          := (TRANSFER'COUNT+ 1) &asr (1);             17850000
                                                                        17855000
    end'if                                                              17860000
                                                                        17865000
    else                                                                17870000
                                                                        17875000
    if WS'FUNCTION = FC'WRITE           or                              17880000
       WS'FUNCTION = FC'FILE'MARK then                                  17885000
    begin'if                                                            17890000
                                                                        17895000
      if DIT'END'OF'TAPE then                                           17900000
      begin'if                                                          17905000
                                                                        17910000
        IOQ'CMD'QING'STATE := 0;                                        17915000
        DRIVER'STATE       := REQUEST'DONE;                             17920000
        IOQ'STAT           := GOOD'EOT'WRITE;                           17925000
                                                                        17930000
                                                               <<J7668>>17935000
        if not (CP'RETRY'COUNT = 0) then                       <<J7668>>17940000
          begin'if                                             <<J7668>>17945000
            DIT'ERROR'STATUS :=[8/3, 8/DIT'ERR'LOG'INDEX];     <<J7668>>17950000
            IOQ'RETRY'COUNT := CP'RETRY'COUNT;                 <<J7668>>17955000
            IOQ'STAT        := GOOD'RETRY;                     <<J7668>>17960000
                                                               <<J7668>>17965000
           end'if;                                             <<J7668>>17970000
                                                               <<J7668>>17975000
        return;                                                         17980000
                                                                        17985000
      end'if;                                                           17990000
    end'if                                                              17995000
                                                                        18000000
    else                                                                18005000
                                                                        18010000
    if WS'FUNCTION = FC'BACK'READ then                                  18015000
    begin'if                                                            18020000
                                                                        18025000
      TRANSFER'COUNT := TRANSFER'COUNT - P'CHAN'PGM (RD'BYTE'CNT);      18030000
                                                                        18035000
      if INTEGER(IOQ'COUNT) < 0 then                                    18040000
        IOQ'COUNT          := -TRANSFER'COUNT                           18045000
      else                                                              18050000
        IOQ'COUNT          := (TRANSFER'COUNT+ 1) &asr (1);             18055000
                                                                        18060000
      if DIT'LOAD'POINT then                                            18065000
      begin'if                                                          18070000
                                                                        18075000
        IOQ'CMD'QING'STATE := 0;                                        18080000
        IOQ'STAT           := GOOD'BOT;                                 18085000
        DRIVER'STATE       := REQUEST'DONE;                             18090000
                                                                        18095000
        return;                                                         18100000
                                                                        18105000
      end'if;                                                           18110000
                                                                        18115000
    end'if                                                              18120000
                                                                        18125000
    else                                                                18130000
                                                                        18135000
    if WS'FUNCTION = FC'TRANSFER'COUNT then                             18140000
      IOQ'COUNT:= -2                                                    18145000
                                                                        18150000
    else                                                                18155000
                                                                        18160000
    if WS'FUNCTION = FC'DIAG'STATUS or                                  18165000
       WS'FUNCTION = FC'LOOPBACK then                                   18170000
    begin'if                                                            18175000
                                                                        18180000
      TRANSFER'COUNT := TRANSFER'COUNT - P'CHAN'PGM (RD'BYTE'CNT);      18185000
                                                                        18190000
      if INTEGER(IOQ'COUNT) < 0 then                                    18195000
        IOQ'COUNT          := -TRANSFER'COUNT                           18200000
      else                                                              18205000
        IOQ'COUNT          := (TRANSFER'COUNT+ 1) &asr (1);             18210000
                                                                        18215000
    end'if                                                              18220000
                                                                        18225000
    else                                                                18230000
                                                                        18235000
      IOQ'COUNT            := 0;                                        18240000
$page                                                                   18245000
                                                                        18250000
GOOD'END:                                                               18255000
                                                               <<J7668>>18260000
    if WS'FUNCTION = FC'REWIND         or                      <<J7668>>18265000
       WS'FUNCTION = FC'REWIND'OFFLINE or                      <<J7668>>18270000
       WS'FUNCTION = FC'CLOSE'DEVICE   then                    <<J7668>>18275000
                            << FIRST COMMAND AFTER A REWIND >> <<J7668>>18280000
         DIT'FIRST'OP := 0; << IS NOT QUEUED >>                <<J7668>>18285000
                                                               <<J7668>>18290000
                                                               <<J7668>>18295000
    if not (CP'RETRY'COUNT = 0) then                           <<J7668>>18300000
    begin'if                                                   <<J7668>>18305000
      DIT'ERROR'STATUS := [8/3, 8/DIT'ERR'LOG'INDEX];          <<J7668>>18310000
      IOQ'RETRY'COUNT := CP'RETRY'COUNT;                       <<J7668>>18315000
      IOQ'STAT        := GOOD'RETRY;                           <<J7668>>18320000
                                                               <<J7668>>18325000
    end'if                                                     <<J7668>>18330000
                                                               <<J7668>>18335000
    else                                                                18340000
                                                                        18345000
      IOQ'STAT := GOOD'IO;                                              18350000
                                                                        18355000
    IOQ'CMD'QING'STATE := 0;                                            18360000
    DRIVER'STATE       := REQUEST'DONE;                                 18365000
                                                                        18370000
    return;                                                             18375000
                                                                        18380000
  end'else;                                                             18385000
end'procedure; << MTDRVR >>                                             18390000
$page                                                                   18395000
                                                                        18400000
<< Main entry point >>                                                  18405000
                                                                        18410000
  assemble (PCAL SIODM;     << MONITOR.              >>                 18415000
            PCAL MTDRVR;    << INITIATOR.            >>                 18420000
            PCAL MTDRVR;    << COMPLETOR.            >>                 18425000
            CON  0;         << NO IO PROCESS.        >>                 18430000
            PCAL MTINIT;    << INITIALIZATION.       >>                 18435000
            CON  1;         << ONE INTERRUPT HANDLER.>>                 18440000
            PCAL GIP'HPIB); << INTERRUPT HANDLER.    >>                 18445000
end.                                                                    18450000
