         << LINES .001/.009 ARE RESERVED FOR SYSTEMS INTEGRATION >>     00000001
$SET X8=ON                                                              00010000
<< HIOCTAP2 - MODULE 46        >>                                       00015000
<< HP32033C MPE SOURCE E.00.01 >>                                       00020000
<< COPYRIGHT     "(C) copyright HEWLETT-PACKARD co. 1980.           >>  00025000
<<     This program may be used with one computer system at a       >>  00030000
<<     time and shall not otherwise be recorded, transmitted or     >>  00035000
<<     stored in a retrieval system.  Copying or other reproduction >>  00040000
<<     of this program except for archival purposes is prohibited   >>  00045000
<<     without the prior written consent of HEWLETT-PACKARD company.>>  00050000
<< **** Note - Dollar Copyright cannot be used with this module *** >>  00055000
                                                                        00060000
$CONTROL PRIVILEGED, UNCALLABLE, MAP, CODE, LIST, USLINIT               00065000
$TITLE "CS'80 MERLIN DRIVER - HPIB"                                     00070000
$TP                                                                     00075000
                                                               <<09421>>00080000
COMMENT --                                                     <<09421>>00085000
**********************************************************************  00090000
                                                                        00095000
======================================================================  00100000
|                       Change history                               |  00105000
| Author           Date              Brief Description               |  00110000
|--------------------------------------------------------------------|  00115000
|                                                                    |  00120000
|Satish Janardan  2/10/84  Create the Buffalo Driver.                |  00125000
|                                                                    |  00130000
|Frank Weger      7/18/84  Initialization and FCODE 91 changes.      |  00135000
|Jesse Chin       8/28/84  Fix problem with handling IOQ'ABORT.      |  00140000
|                          BR#530, SR#115204                         |  00145000
|Jesse Chin       9/11/84  Fix problem in Initiator IOQ'ABORT        |  00150000
|                          BR#857, SR#124685 (part of it).           |  00155000
|Frank Weger      9/17/84  DIT'IGNORE'INT change in Initiator        |  00160000
|Larry Byler/    10/ 3/84  Recover lost on-line interrupts:          |  00165000
|  Gary O'Neall              1.  SIODM now bypasses State 6 when set |  00170000
|                                by GIP, iff driver's                |  00175000
|                                DITP(DUNIT).(3:1) is set.  Means    |  00180000
|                                that driver is smart enough to exit |  00185000
|                                into State 6 when AVR is needed.    |  00190000
|                            2.  DIT'IGNORE'INT deleted.  Not needed |  00195000
|                                because (1.) assures no unwanted    |  00200000
|                                interrupts.                         |  00205000
|                            3.  HIOCTAP1 exits into state 6 when an |  00210000
|                                on line or off line has been detect-|  00215000
|                                ed -AND- all IOQ's have been com-   |  00220000
|                                pleted.                             |  00225000
|Jesse Chin      11/06/84  Powerfail lost data during STORE.         |  00230000
|                BR#1094, SR#132126                                  |  00235000
|                Using DIT.DMISC(5:1) to indicate last operation was |  00240000
|                WRITE. Also use DIT.DMISC(6:1) if powerfail during  |  00245000
|                executing of idle, this bit means that driver PFAIL |  00250000
|                the next operation.                                 |  00255000
|Jesse Chin      11/28/84  Buffalo loses online interrupt when DSTAT |  00260000
|                          on Buffalo. BR#1177, SR#135475            |  00265000
|                CPVA'STATUS = 2 used in powerfail logic will cause  |  00270000
|                later code to lose a pending interrupt for buffalo  |  00275000
|                (see line 25977 for logic depending on CPVA'STATUS) |  00280000
|Frank Weger     11/12/84  Add FCODE 78                        <<f9442>>00285000
|                                                                    |  00290000
|Frank Weger     12/10/84  Continuator, XFER'CNT now updated before  |  00295000
|                          return with powerfail abort on write.     |  00300000
|Frank Weger     12/17/84  Changes to write protect logic. SR#136481.|  00305000
|Jesse Chin      01/15/85  fix problem with infinite retries SR141432|  00310000
|                          BR#1278, also add logic in WRITE'PROTECT, |  00315000
|                          don't abort request for READ function     |  00320000
|Frank Weger     01/16/85  Changes to byte count conversion logic.   |  00325000
|Ross McDonald   01/27/86  Need to re-initialize device after system |  00330000
|                          powerfail if device is not locked.        |  00335000
|                          SR#4700-169292  Patch #I027               |  00340000
|Jim Quintenz    01/27/86  Don't zero the DIT's 20 bytes of status if|  00345000
|                          this is a retry, because it will be logged|  00350000
|                          by SIODM in HARDRES.  SR#4700-162990.     |  00355000
|                          SCO#I027.  (Line#22615)                   |  00360000
|                                                                    |  00365000
|********************************************************************|  00370000
|********************************************************************|  00375000
|  *****          New MERLIN Driver     May , 1986            *****  |  00380000
|Cynthia Kay                                                         |  00385000
|     The existing Buffalo Driver, HIOCTAP1, was modified to create  |  00390000
|     this new driver, HIOCTAP2.  The major difference between the   |  00395000
|     Buffalo and the Merlin is in the handling of Release Requests. |  00400000
|     The Merlin requires Release to be granted to do its preload    |  00405000
|     sequences.  This new driver handles those Release Requests     |  00410000
|     differently than in the Buffalo driver.  Basically, whenever   |  00415000
|     a Release command is finished with a QSTAT =2 we resend the    |  00420000
|     Release to the Merlin, allowing it to continue its operation.  |  00425000
|     For a detailed explanation of the problems associated with     |  00430000
|     Merlin, and the methods used to fix them in this driver, see   |  00435000
|     the STARS database  SR#4700-240382.  There are also two other  |  00440000
|     associated SR's -- SR#4700-255588  &  SR#4700-255950.          |  00445000
|********************************************************************|  00450000
|********************************************************************|  00455000
======================================================================  00460000
$PAGE                                                                   00465000
                                                                        00470000
                               TABLE OF CONTENTS                        00475000
                                                                        00480000
1  PRODUCT IDENTIFICATION                                               00485000
   1.1  Product name, mnemonic, and project number                      00490000
   1.2  Project personnel                                               00495000
   1.3  Project documents                                               00500000
                                                                        00505000
2  DRIVER DESIGN                                                        00510000
   2.1  Design approach                                                 00515000
   2.2  Major modules                                                   00520000
   2.3  Driver creation                                                 00525000
   2.4  Procedure interface                                             00530000
        2.4.1  BUFFALO'INIT                                             00535000
        2.4.2  MERLIN'DRIVER                                            00540000
   2.5  Procedure overview                                              00545000
        2.5.1  MERLIN'INIT                                              00550000
        2.5.2  MERLIN'DRIVER                                            00555000
        5.5.3  External procedures                                      00560000
   2.6  Procedure processing                                            00565000
        2.6.1  MERLIN'INIT                                              00570000
        2.6.2  MERLIN'DRIVER                                            00575000
               2.6.2.1  Driver initiator section                        00580000
               2.6.2.2  Driver completor section                        00585000
               2.6.2.3  Immediate report                                00590000
               2.6.2.4  Individual command processing                   00595000
               2.6.2.5  MERLIN'DRIVER flow diagram                      00600000
               2.6.2.6  Request processing                              00605000
               2.6.2.7  Non-supported functions                         00610000
                                                                        00615000
3  MAJOR DATA STRUCTURES                                                00620000
   3.1  Device reference table (DRT)                                    00625000
   3.2  Device information table (DIT)                                  00630000
   3.3  Interrupt linkage table (ILT)                                   00635000
   3.4  I/O queue request table (IOQ)                                   00640000
                                                                        00645000
4  IOQ I/O STATUS                                                       00650000
                                                                        00655000
5  Generic status layout                                                00660000
                                                                        00665000
6  CS/80 device status                                                  00670000
                                                                        00675000
7  Release considerations                                               00680000
                                                                        00685000
8  Lock/unlock considerations                                           00690000
   8.1  Private volumes                                                 00695000
   8.2  Serial and foreign volumes                                      00700000
                                                                        00705000
9  Logging considerations                                               00710000
                                                                        00715000
10 Unexpected interrupts handling                                       00720000
                                                                        00725000
11 Status considerations                                                00730000
                                                                        00735000
12 Driver schedule                                                      00740000
                                                                        00745000
$PAGE                                                                   00750000
1  PRODUCT IDENTIFICATION                                               00755000
                                                                        00760000
                                                                        00765000
 1.1  Product Name    :  HIOCTAP2 - MPE I/O Cartridge Tape              00770000
                                            Driver (HP-IB)              00775000
      Product Mnemonic:  Merlin                                         00780000
      Project Number  :  4083                                           00785000
                                                                        00790000
                                                                        00795000
 1.2  PROJECT PERSONNEL                                                 00800000
                                                                        00805000
      Project Manager - Rich Pearson                                    00810000
      Product Manager - Kathyrn Hoshor                                  00815000
      MTS             - Satish Janardan                                 00820000
                                                                        00825000
                                                                        00830000
 1.3  PROJECT DOCUMENTS                                                 00835000
                                                                        00840000
      The Merlin Book                - Greeley Division                 00845000
      CS/80 Instruction Set           - HP Part #5955-3442              00850000
      Merlin Investigation Report    - Computer Systems Division        00855000
      Merlin External Specifications - Computer Systems Division        00860000
                                                                        00865000
                                                                        00870000
$PAGE                                                                   00875000
2  DRIVER DESIGN                                                        00880000
                                                                        00885000
                                                                        00890000
 2.1  DESIGN APPROACH                                                   00895000
                                                                        00900000
      HIOCTAP2 will be a modified version of the HIOCTAP0  (LINUS)      00905000
      driver.  Requirements of these drivers are basically the same.    00910000
      The difference is the addition of immediate report for Merlin.    00915000
      Modifications will be to the extent of utilizing the maximum      00920000
      performance which the Merlin drive can provide.  These            00925000
      modifications will include changes to insure the driver is        00930000
      well structured and maintainable.                                 00935000
                                                                        00940000
 2.2  MAJOR MODULES                                                     00945000
                                                                        00950000
      The driver consists of a global area, a linkage area "outer       00955000
      block" for INITIAL, and two procedures (MERLIN'INIT and           00960000
      MERLIN'DRIVER) which initialize and process requests for          00965000
      particular operations from the device.                            00970000
                                                                        00975000
                                                                        00980000
 2.3  DRIVER CREATION                                                   00985000
                                                                        00990000
      At system start-up, the driver is created by PROGEN.  After system00995000
      start-up, the Input/Output Device Monitor (SIODM) is the creator  01000000
      of the driver.                                                    01005000
                                                                        01010000
      SIODM is invoked through the ATTACHIO process.  During            01015000
      interrupt processing the driver is executed on the Interrupt      01020000
      Control Stack (ICS).  Other processing is performed on the stack  01025000
      of the process which invoked the driver.                          01030000
                                                                        01035000
      For user processes, the driver is invoked through the             01040000
      following processes.  The File System creates the initial         01045000
      request and calls ATTACHIO.  ATTACHIO creates the appropriate     01050000
      request in the Input/Output Queue Table (IOQ).  ATTACHIO then     01055000
      calls the Serial Disc Interface (SDISCIO) which fills in          01060000
      various elements of the IOQ entry for the request.  SDISCIO       01065000
      then calls P'ATTACHIO which in turn calls SIODM.         <<09421>>01070000
      SIODM freezes the data segment (if any)                  <<09421>>01075000
      up appropriate information in the IOQ and creates a channel       01080000
      program to satisfy the request and sends it to the device.        01085000
                                                                        01090000
      When the device completes the request, an interrupt is generated  01095000
      which invokes the General Interrupt Processor (GIP).  GIP then    01100000
      calls AWAKEIO which calls SIODM.  SIODM calls the driver.<<09421>>01105000
      The driver checks for success or failure, marks the appropriate   01110000
      status and returns to SIODM.  SIODM unfreezes the data segment and01115000
      returns to SDISCIO, which returns to ATTACHIO, which returns to   01120000
      the File System.                                                  01125000
                                                                        01130000
      The file system processing can be bypassed by calling ATTACHIO    01135000
      directly.                                                         01140000
                                                                        01145000
$PAGE                                                                   01150000
 2.4  PROCEDURE INTERFACE                                               01155000
                                                                        01160000
                                                                        01165000
  2.4.1  MERLIN'INIT                                                    01170000
                                                                        01175000
         A single parameter is passed to MERLIN'INIT when called.       01180000
         This is a pointer to the Device Information Table (DIT)  entry 01185000
         for this particular device.                                    01190000
                                                                        01195000
                                                                        01200000
  2.4.2  MERLIN'DRIVER                                                  01205000
                                                                        01210000
         There are six parameters passed to MERLIN'DRIVER.  The first   01215000
         parameter passed is the index to the Input/Output Queue Table  01220000
         (IOQ) entry for the current request.  IOQ elements contain     01225000
         information relevant to the current request.                   01230000
                                                                        01235000
         The second parameter is a pointer to the Device Information    01240000
         Table (DIT)  entry.  DIT elements contain information about its01245000
         associated device.  This is information which must be saved    01250000
         between I/O requests to the driver.  There is one DIT entry per01255000
         physical device on the controller.                             01260000
                                                                        01265000
         The third and fourth parameters make up the absolute memory    01270000
         location of the data segment associated with the request.  The 01275000
         third parameter is the memory bank where the data is to be     01280000
         written to or read from by the device.  The fourth parameter is01285000
         the offset within the memory bank (memory address) where the   01290000
         data is to be written to or read from.                         01295000
                                                                        01300000
         The fifth parameter passed is a pointer to the Channel Program.01305000
         The channel program is actually a part of the Interrupt Linkage01310000
         Table (ILT)  entry for the device controller.  There is one ILT01315000
         entry per device controller.  This entry stores information    01320000
         concerning the device controller and the channel program or the01325000
         device.                                                        01330000
                                                                        01335000
         The last parameter passed is a pointer to the Device Reference 01340000
         Table (DRT)  entry.  This entry contains information for       01345000
         processing hardware interrupts.  There is one DRT entry per    01350000
         device controller.                                             01355000
                                                                        01360000
                                                                        01365000
$PAGE                                                                   01370000
 2.5  PROCEDURE OVERVIEW                                                01375000
                                                                        01380000
                                                                        01385000
  2.5.1  MERLIN'INIT                                                    01390000
                                                                        01395000
         MERLIN'INIT is responsible for performing a device clear to    01400000
         reset the device to a known state if this has not been already 01405000
         done.  It places the device into the immediate report enabled  01410000
         state (default).  It also initializes portions of the channel  01415000
         program for later use by MERLIN'DRIVER.                        01420000
                                                                        01425000
                                                                        01430000
  2.5.2  MERLIN'DRIVER                                                  01435000
                                                                        01440000
         MERLIN'DRIVER is the main procedure for the driver.  This      01445000
         procedure is responsible for initiating and completing I/O     01450000
         requests against the device.  MERLIN'DRIVER is always called   01455000
         by the I/O device monitor SIODM.                               01460000
                                                                        01465000
         MERLIN'DRIVER determines the reason for the call by examining  01470000
         the IOQ entry for the request and the DIT entry.  When a new   01475000
         request is initiated, MERLIN'DRIVER examines the function code 01480000
         and parameter fields contained in the IOQ to determine what    01485000
         operation is to be performed.  The proper command codes and    01490000
         program branches are then placed in the channel program and its01495000
         execution is begun with a call to the external procedure       01500000
         START'HPIB.                                                    01505000
                                                                        01510000
         Upon completion of the request, an interrupt is generated and  01515000
         MERLIN'DRIVER is again called.  The driver checks for current  01520000
         activity in progress, and this being the case, transfers to the01525000
         completion section of the driver.  The completion section      01530000
         examines the device status words returned by the channel       01535000
         program for errors or special conditions which might data      01540000
         transfer, or the operation of the device.  These conditions can01545000
         cause error retries and/or special notation back to the caller.01550000
                                                                        01555000
                                                                        01560000
$PAGE                                                                   01565000
  2.5.3  EXTERNAL PROCEDURES                                            01570000
                                                                        01575000
         The following is a brief description of the external procedures01580000
         called by the driver.                                          01585000
                                                                        01590000
         GIP'HPIB is a procedure that handles all General Interrupt     01595000
         Processing.                                                    01600000
                                                                        01605000
         IOMESSAGE is a procedure used for sending messages to the      01610000
         console.                                                       01615000
                                                                        01620000
         SIODM is the procedure known as the I/O Device Monitor process.01625000
         This procedure is the process by which an I/O driver is        01630000
         activated.                                                     01635000
                                                                        01640000
         START'HPIB is the procedure that starts channel program        01645000
         processing.                                                    01650000
                                                                        01655000
         MAINT'REQUEST sends an inter-process communication message to  01660000
         IOMESSAGE to perform maintenance processing on the device.     01665000
                                                                        01670000
         LDEVNOTRDY calls a procedure to print a device not ready       01675000
         message on the console.                                        01680000
                                                                        01685000
         GETDRT is a procedure that returns the value of a specified    01690000
         word in the Device Reference Table entry for the device.       01695000
                                                                        01700000
                                                                        01705000
$PAGE                                                                   01710000
 2.6  PROCEDURE PROCESSING                                              01715000
                                                                        01720000
                                                                        01725000
  2.6.1  MERLIN'INIT                                                    01730000
                                                                        01735000
         External interrupts are disabled to allow MERLIN'INIT to run   01740000
         to completion.                                                 01745000
                                                                        01750000
         MERLIN'INIT next aquires the pointer to the ILT array from the 01755000
         DIT array.  From the ILT array, pointers to the channel program01760000
         and channel program status area are acquired.                  01765000
                                                                        01770000
         If the SYSGLOB powerfail word is not zero, the initialized flag01775000
         is set to true, and the device is in the immediate report state01780000
         (driver default), no further processing is performed.          01785000
                                                                        01790000
         The lock flag is initialized.  If TRUE, an operator   <<09421>>01795000
         release request will be denied, that is, the operator <<09421>>01800000
         will not be allowed to unload the device.  In the     <<09421>>01805000
         general CS80 case, the lock flag is set TRUE for sys- <<09421>>01810000
         tem volumes and is never cleared while the system is  <<09421>>01815000
         running (system volumes may not be dismounted).  For  <<09421>>01820000
         non-system volumes the lock flag is initialized FALSE <<09421>>01825000
         and is then managed by appropriate function calls to  <<09421>>01830000
         the driver.  Since the cartridge tape is supported    <<09421>>01835000
         only as a serial disc (non-system) device, MERLIN'   <<09421>> 01840000
         INIT should always initialize this flag to FALSE,     <<09421>>01845000
         however the system/non-system bit is always checked,  <<09421>>01850000
         just in case.  MERLIN'INIT then initializes          <<09421>> 01855000
         various parts of the channel perform a device clear on the     01860000
         device and enable immediate report.  The initialized flag is   01865000
         then set to true to inhibit any further MERLIN'INIT processing 01870000
         except where it is appropriately desired.                      01875000
                                                                        01880000
                                                                        01885000
  2.6.2  MERLIN'DRIVER                                                  01890000
                                                                        01895000
                                                                        01900000
   2.6.2.1  DRIVER INITIATOR SECTION                                    01905000
                                                                        01910000
            This section is responsible for validating a new request and01915000
            issuing the channel program for execution of the request.   01920000
                                                                        01925000
                                                                        01930000
   2.6.2.2  DRIVER COMPLETOR SECTION                                    01935000
                                                                        01940000
            This section is responsible for checking the success or     01945000
            failure of a completed request, logging any device errors,  01950000
            and informing the calling process of the success or failure 01955000
            of the request (through the IOQ).                           01960000
                                                                        01965000
                                                                        01970000
$PAGE                                                                   01975000
   2.6.2.3  IMMEDIATE REPORT                                            01980000
                                                                        01985000
            Immediate report allows one command to be actively          01990000
            processing while other commands are queued and readied for  01995000
            execution within the same controller.  The use of immediate 02000000
            report can significantly contribute to performance          02005000
            improvement since the time spent executing the first command02010000
            is overlapped with the setup of the next command.           02015000
                                                                        02020000
            Immediate report is used only for write requests.  The      02025000
            device will respond with a success status immediately after 02030000
            the DMA transfer from memory to the device's internal buffer02035000
            is complete.  This allows another DMA transfer to be sent to02040000
            the device while the device is transfering the data from the02045000
            internal buffer to tape.                                    02050000
                                                                        02055000
            If immediate report is disabled, any failures of a request  02060000
            will be reported back to the user in the status area for    02065000
            that request.                                               02070000
                                                                        02075000
            If immediate report is enabled, any failure of a transfer of02080000
            data from the internal buffer to tape may not be reported   02085000
            immediately.  The user will be informed that the transfer   02090000
            was successful upon completion of the transfer from memory  02095000
            to the device's internal buffer.  If the device fails to    02100000
            write the data to tape, the failure may That is, since it is02105000
            possible to submit multiple DMA transfers to the device's   02110000
            buffer successfully before a prior one has been completely  02115000
            transferred to the tape, the failure may be indicated in the02120000
            status of a request submitted after the original failure.   02125000
                                                                        02130000
            With immediate report enabled, the user must check status   02135000
            from the last rewind, close file, or close device.  This is 02140000
            necessary to ensure that the last write performed was       02145000
            successful when transferred from the internal buffer to the 02150000
            tape.  Users who do not adhear to this run the risk of      02155000
            missing a failure status for the last record transferred to 02160000
            tape.                                                       02165000
                                                                        02170000
                                                                        02175000
$PAGE                                                                   02180000
   2.6.2.4  INDIVIDUAL COMMAND PROCESSING                               02185000
                                                                        02190000
            Each request will be processed through the initiator section02195000
            and completor section of MERLIN'DRIVER.  The initiator      02200000
            section is responsible for validating new requests.  If the 02205000
            request is new and has not been initiated, this section     02210000
            creates the channel program necessary to initiate and       02215000
            execute the request and exits.  The channel program is      02220000
            started with a call to the external procedure START'HPIB.   02225000
                                                                        02230000
            The completor section of MERLIN'DRIVER is responsible for   02235000
            determining the success or failure of the request.  Success 02240000
            or failure is determined by checking the QSTAT returned from02245000
            the report phase of a request.  If QSTAT is zero the request02250000
            completed successfully.  The I/O status for the request is  02255000
            marked as such and MERLIN'DRIVER exits.  A QSTAT of one     02260000
            indicates failure of the request.  The completor section    02265000
            logs the device status values in the DIT, interrogates the  02270000
            device status to determine the specific reason for the      02275000
            failure, places the appropriate error status in the I/O     02280000
            status for the error and exits.                             02285000
                                                                        02290000
            A QSTAT of two indicates a device power failure occured.    02295000
            Any request which has been initiated but not completed will 02300000
            have a powerfail status placed in the I/O status for the    02305000
            request.                                                    02310000
                                                                        02315000
            With immediate report enabled, the errors may not be        02320000
            reported back in the same IOQ that requested the write.     02325000
                                                                        02330000
                                                                        02335000
$PAGE                                                                   02340000
   2.6.2.5  MERLIN'DRIVER FLOW DIAGRAM                                  02345000
                                                                        02350000
      Initialize local variables.                                       02355000
        |                                                               02360000
        |                no                                             02365000
      Device initialized ---> call MERLIN'INIT                          02370000
        |yes                    |                                       02375000
        |<----------------------|                                       02380000
        |              no                                               02385000
      Another request? ---> Execute idle ---> Set driver state.         02390000
        |yes                channel program.      Exit.                 02395000
        |                                                               02400000
        |           yes                                                 02405000
      System abort? ---> Execute device ---> Set                        02410000
        |no              clear channel       driver                     02415000
        |                program.            state.                     02420000
        |                                    Exit.                      02425000
        |                                                               02430000
        |               yes                                             02435000
      Device powerfail? ---> Go PROCESS'COMPLETOR.                      02440000
        |no                                                             02445000
        |          no                                                   02450000
      New request? ---> Go PROCESS'COMPLETOR.                           02455000
        |yes                                                            02460000
        |            no                                                 02465000
      Request valid? ---> Go PROCESS'COMPLETOR.                         02470000
        |yes                                                            02475000
        |                                                               02480000
      Execute channel                                                   02485000
      program for                                                       02490000
      request processing.                                               02495000
        |                                                               02500000
        |                                                               02505000
      Set driver state.                                                 02510000
      Exit.                                                             02515000
                                                                        02520000
                                                                        02525000
      PROCESS'COMPLETOR                                                 02530000
        |                                                               02535000
        |                                                               02540000
      Log device status.                                                02545000
      Set request status.                                               02550000
      Set driver state.                                                 02555000
      Exit.                                                             02560000
                                                                        02565000
                                                                        02570000
$PAGE                                                                   02575000
   2.6.2.6  REQUEST PROCESSING                                          02580000
                                                                        02585000
            The following is a description of how the driver will       02590000
            process each individual function when requested.            02595000
                                                                        02600000
            The device recognizes byte transfers only, therefore, if the02605000
            IOQ transfer count is in words, the driver will convert it  02610000
            to bytes when sent to the device.  A positive transfer count02615000
            indicates a word transfer.  A negative transfer count       02620000
            indicates a byte transfer.                                  02625000
                                                                        02630000
            Any request that transfers more than 6144  bytes of data    02635000
            from or to the device will be processed in multiple         02640000
            transfers of 6144  bytes until the entire transfer count is 02645000
            satisfied.  If a failure occures prior to completion of the 02650000
            entire transfer, the request will be terminated.            02655000
                                                                        02660000
            All new requests will be sent to the device via a call to   02665000
            the external procedure START'HPIB.  A channel program will  02670000
            be initialized and started to initiate and execute the      02675000
            request.                                                    02680000
                                                                        02685000
            If the request has been completed, the I/O status will be   02690000
            placed in the IOQ entry for the request and the request     02695000
            marked complete.                                            02700000
                                                                        02705000
                                                                        02710000
          o LOCATE AND READ (function code 0)                           02715000
                                                                        02720000
              This request transfers data from tape to the host's       02725000
              memory.                                                   02730000
                                                                        02735000
              The maximum transfer count is 32767  words.               02740000
                                                                        02745000
              If the transfer count is zero, the request will locate the02750000
              record on tape only.  There will be no transfer of data.  02755000
                                                                        02760000
                                                                        02765000
          o LOCATE AND WRITE (function code 1)                          02770000
                                                                        02775000
              This command transfers one record from main memory to     02780000
              tape.                                                     02785000
                                                                        02790000
              The maximum transfer count is 32767 words.                02795000
                                                                        02800000
              A transfer count of zero requests a write ring presence   02805000
              check on the device.  If the device is write protected, a 02810000
              message will be sent to the console indicating the device 02815000
              is write protected.                                       02820000
                                                                        02825000
                                                                        02830000
$PAGE                                                                   02835000
          o OPEN FILE (function code 2)                                 02840000
                                                                        02845000
              This request generates a null operation with a good status02850000
              returned in the I/O status.  No channel program will be   02855000
              executed for this request.                                02860000
                                                                        02865000
                                                                        02870000
          o CLOSE FILE (function code 3)                                02875000
                                                                        02880000
              This request generates a null operation with a good status02885000
              returned in the I/O status.  No channel program will be   02890000
              executed for this request.                                02895000
                                                                        02900000
                                                                        02905000
          o CLOSE DEVICE (function code 4)                              02910000
                                                                        02915000
              A channel program will be executed to enable immediate    02920000
              report (driver default).                                  02925000
                                                                        02930000
                                                                        02935000
          o FILL WITH ZEROS (function code 5)                           02940000
                                                                        02945000
              This request fills logical blocks on the tape with zeros  02950000
              (octal 60).                                               02955000
                                                                        02960000
              The maximum transfer count is 32767 words.  A transfer    02965000
              count of zero is invalid.                                 02970000
                                                                        02975000
                                                                        02980000
          o FILL WITH BLANKS (function code 6)                          02985000
                                                                        02990000
              This request fills logical blocks on the tape with spaces 02995000
              (octal 40).                                               03000000
                                                                        03005000
              The maximum transfer count is 32767 words.  A transfer    03010000
              count of zero is invalid.                                 03015000
                                                                        03020000
                                                                        03025000
          o REQUEST DEVICE STATUS (function code 7)                     03030000
                                                                        03035000
              This command will transfer the actual device status from  03040000
              the last completed operation.                             03045000
                                                                        03050000
              The transfer count must be greater than 1  byte and will  03055000
              be invalid if it isn't.  The maximum number of bytes      03060000
              returned is 20.  A transfer count in excess of 20 will not03065000
              be considered an error and the 20 bytes of status will be 03070000
              returned.  (Refer to the CS/80 Instruction Set manual for 03075000
              definitions and layout of the status bytes).              03080000
                                                                        03085000
                                                                        03090000
          o INITIALIZE MEDIA (function code 8)                          03095000
                                                                        03100000
              This request initializes the media.                       03105000
                                                                        03110000
                                                                        03115000
$PAGE                                                                   03120000
          o UNLOAD (function code 9)                                    03125000
                                                                        03130000
              This request rewinds and unloads the tape.  The tape will 03135000
              be unloaded regardless of the state of the lock bit.      03140000
                                                                        03145000
                                                                        03150000
          o WRITE DISC LABEL (function code 11)                         03155000
                                                                        03160000
              This request will write a label to block zero on the      03165000
              tape.                                                     03170000
                                                                        03175000
              The maximum transfer count is 32767 words.  A transfer    03180000
              count of zero is invalid.                                 03185000
                                                                        03190000
                                                                        03195000
          o REQUEST VOLUME LIMIT (function code 13)                     03200000
                                                                        03205000
              This request returns the maximum volume address of the    03210000
              media in two words.                                       03215000
                                                                        03220000
              NOTE:  Merlin supports only single vector addresses.      03225000
                                                                        03230000
              The transfer count must be a minimum of two words.  A     03235000
              transfer count greater than two words will not be         03240000
              considered an error and the two words of volume limit will03245000
              be returned.                                              03250000
                                                                        03255000
                                                                        03260000
          o LOCATE AND VERIFY (function code 14)                        03265000
                                                                        03270000
              This request verifies the media and returns in two words  03275000
              the address of the first bad sector encountered.          03280000
                                                                        03285000
              Upon making this request, the user's buffer must contain  03290000
              the double word value of the verify length.               03295000
                                                                        03300000
              The transfer count must be a minimum of two words.  A     03305000
              transfer count greater than two words will not be         03310000
              considered an error and the two words of volume limit will03315000
              be returned.                                              03320000
                                                                        03325000
                                                                        03330000
                                                                        03335000
$PAGE                                                                   03340000
          o REQUEST GENERIC STATUS (function code 15)                   03345000
                                                                        03350000
              This request returns the generic status from the last     03355000
              completed operation performed by the device in one word.  03360000
              See the generic status layout later in this document.     03365000
                                                                        03370000
              The transfer count must be a minimum of one word.  A      03375000
              transfer count greater than one word will not be          03380000
              considered an error and the one word of generic status    03385000
              will be returned.                                         03390000
                                                                        03395000
                                                                        03400000
          o LOCK VOLUME (function code 16)                              03405000
                                                                        03410000
              This request locks the volume, disabling the front panel  03415000
              unload function, and returns a good status.  The lock bit 03420000
              in the DIT entry is turned on.  No channel program will be03425000
              executed for this request.                                03430000
                                                                        03435000
                                                                        03440000
          o UNLOCK VOLUME (function code 17)                            03445000
                                                                        03450000
              This request unlocks the volume, enabling the front panel 03455000
              unload function, and returns a good status.  The lock bit 03460000
              in the DIT entry is turned off.  No channel program will  03465000
              be executed for this request.                             03470000
                                                                        03475000
                                                                        03480000
          o READ LOCK BIT (function code 18)                            03485000
                                                                        03490000
              This request returns the volume locked status in one word.03495000
                                                                        03500000
              The transfer count must be a minimum of one word.  A      03505000
              transfer count greater than one word will not be          03510000
              considered an error and the one word of locked status will03515000
              be returned.  No channel program will be executed for this03520000
              request.                                                  03525000
                                                                        03530000
                                                                        03535000
$PAGE                                                                   03540000
          o IMMEDIATE REPORT (function code 29)                         03545000
                                                                        03550000
              This request enables or disables the immediate reporting  03555000
              feature of the device.                                    03560000
                                                                        03565000
              If QPARM2 is zero, immediate report will be disabled.  If 03570000
              QPARM2 is one, immediate report will be enabled.          03575000
                                                                        03580000
                                                                        03585000
          o IDENTIFY (function code 72)                                 03590000
                                                                        03595000
              This request returns Merlin's identity code in two bytes. 03600000
              Merlin's identity code is 0260 (hex).                     03605000
                                                                        03610000
              Bit Meaning                                               03615000
                                                                        03620000
              0-2      Storage device, value 000                        03625000
              3-6      Value 0001                                       03630000
              7        13037 protocol, value 0                          03635000
              8        Value 0                                          03640000
              9        Value 1                                          03645000
              10-15    Device dependent                                 03650000
                                                                        03655000
              The transfer count must be a minimum of one word.  A      03660000
              transfer count greater than one word will not be          03665000
              considered an error and the one word identity code will be03670000
              returned.                                                 03675000
                                                                        03680000
                                                                        03685000
          o INITIATE DIAGNOSTIC SELFTEST (function code 73)             03690000
                                                                        03695000
              This request will cause Merlin to perform its power-on    03700000
              selftest.  The loop count must be between zero and 255.   03705000
              Zero will be processed as a request for 255 loops (for    03710000
              Linus compatibility).  Any other value will be considered 03715000
              invalid.                                                  03720000
                                                                        03725000
                                                                        03730000
          o SELFTEST RESULTS (function code 74)                         03735000
                                                                        03740000
              This request will return the status from the selftest.    03745000
              The processing of this request is the same as the REQUEST 03750000
              STATUS function.                                          03755000
                                                                        03760000
                                                                        03765000
          o LOOPBACK WRITE (function code 75)                           03770000
                                                                        03775000
              This request determines if the communication link is      03780000
              operating properly by writting a test pattern (located in 03785000
              the user's buffer) into the device's internal buffer.     03790000
                                                                        03795000
              The transfer count must be greater than zero and less than03800000
              or equal to 600 words.  Any value outside this range is   03805000
              invalid.                                                  03810000
                                                                        03815000
                                                                        03820000
$PAGE                                                                   03825000
          o LOOPBACK READ (function code 76)                            03830000
                                                                        03835000
              This request reads the data written into the internal     03840000
              buffer from the LOOPBACK WRITE function.                  03845000
                                                                        03850000
              The transfer count must be the same as that used for the  03855000
              LOOPBACK Write request.                                   03860000
                                                                        03865000
                                                                        03870000
          o GENERAL PURPOSE COMMAND (function code 77).                 03875000
                                                                        03880000
              This request allows the requestor to create their own     03885000
              command requests to be sent through the initiate and      03890000
              report phases.  It is up to the user to ensure that       03895000
              commands submitted through this request are valid and in  03900000
              the proper sequence.  No execution phase is available for 03905000
              this request.                                             03910000
                                                                        03915000
              The transfer count must be a positive number indicating   03920000
              the number of command bytes to be transferred to the      03925000
              device.                                                   03930000
                                                               <<f9442>>03935000
                                                               <<f9442>>03940000
          o DESCRIBE (function code 78)                        <<f9442>>03945000
                                                               <<f9442>>03950000
              This request returns the describe bytes from     <<f9442>>03955000
              the device.                                      <<f9442>>03960000
                                                               <<f9442>>03965000
              The transfer count must be non-zero and will     <<f9442>>03970000
              be considered invalid if not.  The maximum       <<f9442>>03975000
              number of bytes returned is 37.  A transfer      <<f9442>>03980000
              count greater than 37 will not be considered     <<f9442>>03985000
              an error and the 37 describe bytes will be       <<f9442>>03990000
              returned.  (Refer to the CS/80 Instruction       <<f9442>>03995000
              Set manual for definition and layout of the      <<f9442>>04000000
              device describe bytes.)                          <<f9442>>04005000
                                                               <<f9442>>04010000
                                                                        04015000
          o RELEASE (function code 79)                                  04020000
                                                                        04025000
              This request releases the device for a period of time     04030000
              allowing it to service an internal requirement such as    04035000
              cartridge insertion (power on), unload sequence, or       04040000
              sparing.                                                  04045000
                                                                        04050000
                                                                        04055000
          o RELEASE DENIED (function code 80)                           04060000
                                                                        04065000
              This request prohibits the device from releasing itself.  04070000
                                                                        04075000
                                                                        04080000
          o SET RELEASE (function code 81)                              04085000
                                                                        04090000
              This request enables or disables an automatic release by  04095000
              the device during idle time.  It also enables or disables 04100000
              the release timeout interval.  The default for this is a  04105000
              two second timeout interval with automatic release        04110000
              enabled.                                                  04115000
                                                                        04120000
                                                                        04125000
$PAGE                                                                   04130000
          o SET ADDRESS (function code 82)                              04135000
                                                                        04140000
              This request will set the value of the target address.    04145000
              This address is then used by other commands in accessing  04150000
              data on the tape.  Upon completion of a transaction which 04155000
              uses the target address, the target address will point to 04160000
              the block after the last block accessed during that       04165000
              transaction.                                              04170000
                                                                        04175000
              NOTE:  Merlin supports only single vector addressing.     04180000
                                                                        04185000
                                                                        04190000
          o SPARE BLOCK (function code 88)                              04195000
                                                                        04200000
              This request allows the host to give the device permission04205000
              to become temporarily busy while sparing a block.         04210000
                                                                        04215000
                                                                        04220000
$PAGE                                                                   04225000
          o INITIATE UTILITY (function code 91)                         04230000
                                                                        04235000
              This request directs the device to perform one utility    04240000
              routine.  Merlin supports the following utilities:        04245000
                                                                        04250000
              1) Pattern Error Rate Test                                04255000
              2) Read Error Rate Test Log                               04260000
              3) Read Error Log                                         04265000
              4) Read Use Log                                           04270000
              5) Read Drive Tables (Manufacturer's and Spare Block)     04275000
              6) Recieve User Pattern (for Error Rate Test)             04280000
              7) Clear Logs                                             04285000
              8) Read Revision Number                                   04290000
              9) Preset Drive                                           04295000
             10) Read Error Summary                                     04300000
                                                                        04305000
              The maximum transfer count is 32767 words.  A transfer    04310000
              count of zero is invalid.                                 04315000
                                                                        04320000
                                                                        04325000
          o CHANNEL INDEPENDENT CLEAR (function code 92)                04330000
                                                                        04335000
              This request places the device into a known reset state.  04340000
              If this request is sent to unit 15, all devices on a      04345000
              shared controller and the controller will be reset, the   04350000
              unit number being left at zero upon completion of this    04355000
              command.                                                  04360000
                                                                        04365000
                                                                        04370000
          o CANCEL (function code 93)                                   04375000
                                                                        04380000
              This function causes the device to gracefully terminate   04385000
              the current transaction, leaving it in the reporting      04390000
              phase.                                                    04395000
                                                                        04400000
                                                                        04405000
          o HP-IB PARITY CHECKING (function code 94)                    04410000
                                                                        04415000
              This request enables or disables parity checking on the   04420000
              secondary command parameter.                              04425000
                                                                        04430000
              Parity checking will always be on except for diagnostic   04435000
              purposes through this function.                           04440000
                                                                        04445000
          o LAST STATUS REQUEST (function code 95)                      04450000
                                                                        04455000
              Same as function code 7.                                  04460000
                                                                        04465000
                                                                        04470000
          o GENERIC DIAG. REQUEST (function code 96)                    04475000
                                                                        04480000
                                                                        04485000
          o CHANNEL INDEPENDENT CLEAR (function code 97)                04490000
                                                                        04495000
              Same as function code 92.                                 04500000
                                                                        04505000
                                                                        04510000
   2.6.2.7  NON-SUPPORTED FUNCTIONS.                                    04515000
                                                                        04520000
            HIOCTAP2 will not support the following individual          04525000
            requests.                                                   04530000
                                                                        04535000
            Read With Three Vector Address                              04540000
            Write With Three Vector Address                             04545000
            Set Return Addressing Mode                                  04550000
            Set Rotational Position Sensing                             04555000
            Set Unit                                                    04560000
            Set Length                                                  04565000
            Set Burst Mode                                              04570000
            Write File Mark                                             04575000
            Selected Device Clear                                       04580000
            Copy Data                                                   04585000
            No Op                                                       04590000
                                                                        04595000
                                                                        04600000
3  MAJOR DATA STRUCTURES                                                04605000
                                                                        04610000
   There are four MPE tables used by the driver.  These are the Device  04615000
   Reference Table (DRT), Device Information Table (DIT), Interrupt     04620000
   Linkage Table (ILT), and Input/Output Queue (IOQ) table.             04625000
                                                                        04630000
                                                                        04635000
$PAGE                                                                   04640000
 3.1  DEVICE REFERENCE TABLE (DRT)                                      04645000
                                                                        04650000
      There is one DRT for each device controller configured on the     04655000
      system.  The contents of the table are used for processing        04660000
      interrupts.                                                       04665000
                                                                        04670000
      word 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC    04675000
             ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---          04680000
        0    |        Channel Program Pointer (SIOP)         |  DRT0    04685000
             |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|          04690000
        1    | Channel Program Variable Area Pointer (CPVA)  |  DRT1    04695000
             |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|          04700000
        2    |        Interrupt Handler Program Label |  DRT2           04705000
             |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|          04710000
        3    |ST|SH|PF|          Status |WS|GF|DT|WT|  DRT3             04715000
             ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---          04720000
                                                                        04725000
      DRT0 - Channel Program Pointer.                                   04730000
             Absolute address of the current I/O instruction in         04735000
             execution for this device.                                 04740000
                                                                        04745000
      DRT1 - Channel Program Variable Area Pointer.                     04750000
             Absolute address of the base of the Interrupt Linkage Table04755000
             (ILT) Points to first word of the Channel Program Variable 04760000
             Area of the ILT for controller.                            04765000
                                                                        04770000
      DRT2 - Interrupt Handler Program Label.                           04775000
             The external program label of the interrupt service routine04780000
             for the controller.                                        04785000
                                                                        04790000
      DRT3 - Channel Program Status.                                    04795000
             Contains channel program status information which is used  04800000
             by the channel program interpreter.                        04805000
               ST - channel program is running.                         04810000
               SH - SIOP or HIOP instruction pending.                   04815000
               PF - powerfail recovery in progress.                     04820000
               WS - waiting for device status request.                  04825000
               GF - GIC FIFO buffer not empty.                          04830000
               DT - DMA transfer active.                                04835000
               WT - channel program in wait state.                      04840000
                                                                        04845000
                                                                        04850000
$PAGE                                                                   04855000
 3.2  DEVICE INFORMATION TABLE (DIT)                                    04860000
                                                                        04865000
      There is one DIT per physical device.  If a physical device       04870000
      represents more than one logical device, the logical device number04875000
      is obtained from the IOQ array.                                   04880000
                                                                        04885000
    word    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC   04890000
          ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---             04895000
     0    |TM|DS|AC|RQ| 0| 0| 0|IO|IA|NO|ST| 0|   State   |  DFLAG      04900000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04905000
     1    | SYSDB relative pointer to the DIT for the next|  DLINK      04910000
          | device requesting this resource or service    |             04915000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04920000
     2    |          Pointer to the current IOQ           |  DIOQP      04925000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04930000
     3    |             Logical device number             |  DLDEV      04935000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04940000
     4    | SYSDB relative pointer to Device Linkage Table|  DDLTP      04945000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04950000
     5    | SYSDB relative pntr to Interrupt Linkage Table|  DILTP      04955000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04960000
     6    | Set to -1 when system powerfail occurs.       |  DSTAT      04965000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04970000
     7    | Hardware error status.  Set when the driver   |  DSERR      04975000
          | detects an error.  Whenever <> 0, the driver  |             04980000
          | monitor logs an I/O error and clears this word|             04985000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04990000
     8    |       index of first request in the queue     |  DQHEAD     04995000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05000000
     9    |       index of last request in the queue      |  DQTAIL     05005000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05010000
    10    | IOT |  |AV|RC| RL  |  | Physical Unit #       |  DUNIT      05015000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05020000
    11    |LK|NR|IM|PI|RG|LW|MP|              | SUBSTATE  |  DMISC      05025000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05030000
    12    | High order logical sector address of bad block|  DBADBLK1   05035000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05040000
    13    | Low order logical sector address of bad block.|  DBADBLK2   05045000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05050000
    14    | Byte transfer left when bad block occured     |  DBADXFER   05055000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05060000
    15    | Hardware logged error status - CPVA (0).      |  DLOGERROR  05065000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05070000
    16    | Relative offset of channel program abort.     |  CSIOPSTOP  05075000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05080000
    17    | Accum byte count of transfer > 6144 bytes.    |  DBYTECNT   05085000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05090000
    18    |                                               |             05095000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05100000
    19    | Device status (20 bytes), errors logged       |  DSTATUS    05105000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05110000
     .    |                     .                         |             05115000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05120000
     .    |                     .                         |             05125000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05130000
    25    |                     .                         |             05135000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             05140000
                                                                        05145000
$PAGE                                                                   05150000
      DFLAG - Device flags and request state.                           05155000
              TM    - Set if device is a terminal                       05160000
              DS    - If TM = 0 and this bit is set then device is      05165000
                      a disc, otherwise device dependent.               05170000
              AC    - A monitor is currently servicing this device.     05175000
              RQ    - A service request is pending while the monitor    05180000
                      is active.                                        05185000
              IO    - An I/O channel program is running for this        05190000
                      device.                                           05195000
              IA    - An interrupt or response has occurred for this    05200000
                      device.                                           05205000
              NO    - Not ready, start idle channel program then go to  05210000
                      state %10.                                        05215000
              ST    - The device monitor is starting an idle channel    05220000
                      program for this device.  There is no IOQ         05225000
                      associated with this state.                       05230000
              STATE - State of the device monitor.  Specifies the next  05235000
                      action to be taken by SIODM in servicing the      05240000
                      request:                                          05245000
                      0   - Start a new request.                        05250000
                      1   - Not used.                                   05255000
                      2   - Call driver initiator procedure.            05260000
                      3   - Call driver completor procedure.            05265000
                      4   - Not used.                                   05270000
                      5   - Request complete.                           05275000
                      6   - Initiate device recognition sequence.       05280000
                      7   - Start operator intervention wait.           05285000
                      %10 - Wait for interrupt (operator intervention), 05290000
                            restart at state 0.                         05295000
                      %11 - Wait for data segment freeze, then state 2. 05300000
                      %12 - Wait for driver initiator to be frozen,     05305000
                            then allocate controller (state 2).         05310000
                      %13 - Wait for I/O completion interrupt, then     05315000
                            state 3.                                    05320000
                      %14 - Wait for controller, then call driver       05325000
                            initiator.                                  05330000
                      %15 - Not used.                                   05335000
                      %16 - Wait for initiator make present, then       05340000
                            state 2.                                    05345000
                      %17 - Wait for completor make present, then       05350000
                            state 3.                                    05355000
                                                                        05360000
      DLINK,                                                            05365000
      DQHEAD,                                                           05370000
      DQTAIL - Not used.                                       <<09421>>05375000
                                                               <<09421>>05380000
      DUNIT - IOT      - I/O Type.  01 for this device.        <<09421>>05385000
              AV       - AVR flag.  Set by driver,  tested  by <<09421>>05390000
                         SIODM.                                <<09421>>05395000
                         1 - Driver  can   detect   unexpected <<09421>>05400000
                             (AVR) conditions and will exit to <<09421>>05405000
                             SIODM State 6  when  safe.  SIODM <<09421>>05410000
                             should bypass State 6 when called <<09421>>05415000
                             from GIP.  New functionality.     <<09421>>05420000
                         0 - Driver cannot detect  AVR  condi- <<09421>>05425000
                             tion.  SIODM should honor a State <<09421>>05430000
                             6 call from GIP.  Previous  func- <<09421>>05435000
                             tionality.                        <<09421>>05440000
              Unit     - Unit number for  multi-unit  control- <<09421>>05445000
                         lers.  Always 0 for this driver.      <<09421>>05450000
              RC       - This bit is the Release count bit.             05455000
                         It is used to count how many release           05460000
                         commands have been sent to the Merlin.         05465000
                         It will either be a 0 or a 1.                  05470000
                         0 - No release command has yet been            05475000
                             sent to the Merlin.                        05480000
                         1 - A release command has ben sent to          05485000
                             the Merlin.                                05490000
                         This bit is to insure that we never send       05495000
                         send more than two releases.                   05500000
             RL        - These are the Release command bits.            05505000
                         We can send a Release to the Merlin            05510000
                         from three areas and RL keeps track of         05515000
                         where Release was sent from.                   05520000
                         0 - No Release command sent.                   05525000
                         1 - Release sent from Initiator se.            05530000
                         2 - Release sent from Continuator.             05535000
                         3 - Release sent as a function code.           05540000
                                                                        05545000
      DMISC - Miscellaneous device information.                         05550000
              LK       - Lock flag denoting unload status of the        05555000
                         device.                                        05560000
                         0 - Allow operator unload of the volume.       05565000
                         1 - Deny operator unload of the volume.        05570000
              NR       - Not Ready.  Remembers  the  state  of <<09421>>05575000
                         DIT'DEV'NOT'RDY  the last time status <<09421>>05580000
                         was read from the  device.  Used  for <<09421>>05585000
                         detecting off-line transitions.       <<09421>>05590000
              IM       - Immediate report.                              05595000
                         0 - Disabled.                                  05600000
                         1 - Enabled.                                   05605000
              PI       - Pending  Interrupt.  Device  came  on <<09421>>05610000
                         line while driver was waiting on com- <<09421>>05615000
                         mand completion (i.e.,  not  in  idle <<09421>>05620000
                         CP).  On  line  interrupt was used to <<09421>>05625000
                         complete  command,  so  SIODM  didn't <<09421>>05630000
                         wake  DEVREC.  The interrupt also set <<09421>>05635000
                         this bit.  If the  bit  is  set  when <<09421>>05640000
                         SIODM  starts  the idle CP, we return <<09421>>05645000
                         the  Unexpected  Interrupt  state  so <<09421>>05650000
                         that SIODM will wake DEVREC.          <<09421>>05655000
              RG       - Release Granted.  Device requested  a <<09421>>05660000
                         release  and  driver  O.K.'ed it.  If <<09421>>05665000
                         this bit is set when we are ready  to <<09421>>05670000
                         start  the idle CP, we issue a status <<09421>>05675000
                         request CP instead.  This is  because <<09421>>05680000
                         the  device  does  not set a DSJ of 2 <<09421>>05685000
                         when completing the  release  due  to <<09421>>05690000
                         coming on line! It needs an addition- <<09421>>05695000
                         al command to do so.  The status  re- <<09421>>05700000
                         quest  CP  ensures that we finish all <<09421>>05705000
                         on line processing before we exit.    <<09421>>05710000
              LW       - Last operation is a WRITE.            <<J9456>>05715000
              MP       - Must Powerfail the next operation.    <<J9456>>05720000
              SUBSTATE - Idle channel program state.                    05725000
                         0 - Normal idle channel program wait.          05730000
                         1 - Idle request being serviced wait.          05735000
                                                                        05740000
      DBADBLK1 - High order logical sector address of bad block         05745000
                 encountered.                                           05750000
                                                                        05755000
      DBADBLK2 - Low order logical sector address of bad block          05760000
                 encountered.                                           05765000
                                                                        05770000
      DBADXFER - Byte transfer left when bad block occured.             05775000
                                                                        05780000
      DLOGERROR - CPVA (0) logged on hardware error status.             05785000
                                                                        05790000
      DSIOPSTOP - Relative offset location of channel program when      05795000
                  error in CPVA (0) occured.                            05800000
                                                                        05805000
      DBYTECNT - Accummulative transfer count for transfers greater     05810000
                 than 6144 bytes.                                       05815000
                                                                        05820000
      DSTATUS - 20  bytes of status logged when a status error occurs.  05825000
                (Refer to CS/80 Instruction Set manual for description.)05830000
                                                                        05835000
                                                                        05840000
$PAGE                                                                   05845000
 3.3  INTERRUPT LINKAGE TABLE (ILT)                                     05850000
                                                                        05855000
      There is one ILT for each device controller configured on the     05860000
      system.                                                           05865000
                                                                        05870000
      Word    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC 05875000
            ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---           05880000
        0   |                    Channel                    |  ICPVA0   05885000
        1   |                    Program                    |  ICPVA1   05890000
        2   |                    Variable                   |  ICPVA2   05895000
        3   |                  Area (ICPVA)                 |  ICPVA3   05900000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05905000
        4   |                   DMA Abort                   |  ICPVA4   05910000
        5   |                    Address                    |  ICPVA5   05915000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05920000
        6   |                       0                       |  ISRQL    05925000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05930000
        7   |LI|     CHANQUE     |     |   CHAN    |  DEV   |  ICNTRL   05935000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05940000
        8   | SYSDB relative pointer to Channel Program area|  ISIOP    05945000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05950000
        9   | SYSDB relative pointer to idle status area.   |  ISTAP    05955000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05960000
       10   | Single instruction that is executed to extract|  IUNIT    05965000
            | the device unit number from the status pointed|           05970000
            | to by ISTAP.                                  |           05975000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05980000
       11   | SYSDB  relative  DIT  pointer  of  the  device|  ICDP     05985000
            | currently using the  channel to perform a data|           05990000
            | operation.                                    |           05995000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06000000
       12   |       SIOPSIZE        |         CQUEN         |  IQUEUE   06005000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06010000
       13   |RW|WP|IG|                          |  HCUNIT   |  IFLAG    06015000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06020000
       14   | SYSDB relative DIT pointer for unit 0  *      |  IDITP0   06025000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06030000
       15   | 20 bytes of idle channel program status area. |  ISTAT    06035000
        .   |                     .                         |           06040000
        .   |                     .                         |           06045000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06050000
       25   |           Channel program area.               |           06055000
        .   |                     .                         |           06060000
        .   |                     .                         |           06065000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06070000
                                                                        06075000
      * This driver does not support more than one unit.                06080000
                                                                        06085000
$PAGE                                                                   06090000
      ICPVA0 - Channel Program Variable Area                            06095000
               ICPVA0 is used by the channel program processor to store 06100000
               status information after I/O  channel aborts.            06105000
      ICPVA1 - Used by the driver to indicate if status should be       06110000
               examined for special conditions or errors.               06115000
      ICPVA2 - Not used.                                                06120000
      ICPVA3 - Not used.                                                06125000
      ICPVA4 & ICPVA5 - Absolute address where a DMA abort occurred.    06130000
      ICNTRL - Controller Information                                   06135000
               LI      - If this bit is set, the controller is sharing  06140000
                         a software channel resource in order to limit  06145000
                         bandwidth.                                     06150000
               CHANQUE - The software channel resource number.          06155000
               CHAN    - Channel number (four most significant bits of  06160000
                         DRTN).                                         06165000
               DEV     - Device number (three least significant bits of 06170000
                         DRTN).                                         06175000
                                                                        06180000
      IQUEUE -                                                          06185000
               SIOPSIZE - Channel program area size,                    06190000
                          (number of words + 1) / 2.                    06195000
               CQUEN    - For a multi-unit controller this field        06200000
                          contains the software controller resource     06205000
                          number.                                       06210000
                                                                        06215000
      IFLAG - Controller and Channel Program state flags.               06220000
              RW     - RUNWAIT, an idle channel program should be       06225000
                       started when there are no active requests to     06230000
                       process.                                         06235000
              WP     - WAITPROG, an idle channel program has been       06240000
                       started for this controller.  This bit is reset  06245000
                       by an interrupt.                                 06250000
              IG     - IGNOREHI, an HIOP  instruction has been issued   06255000
                       against this statement.  Therefore ignore the    06260000
                       interrupt generated by the channel code when this06265000
                       program halts.                                   06270000
              HCUNIT - Highest configured unit number for this          06275000
                       controller.                                      06280000
                                                                        06285000
      ISTAT - 20  bytes resevered for status.                           06290000
$PAGE                                                                   06295000
 3.4  I/O QUEUE REQUEST TABLE (IOQ)                                     06300000
                                                                        06305000
      WORD    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC 06310000
       (%)  ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---           06315000
        0   |            Request dependent flags            |  QFLAG    06320000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06325000
        1   | SYSDB relative pointer to next IOQ element.   |  QLINK    06330000
            | Points to first word of element.              |           06335000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06340000
        2   |     Logical device number                     |  QLDEV    06345000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06350000
        3   |RS|OP|IM|LF|SP|VE|UR|   RC   |     |    WC     |  QMISC    06355000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06360000
        4   | S| If QFLAG.(3:1) is clear then this is the   |  QDSTN    06365000
            |    DST number of the target data segment.  If |           06370000
            |    S is set, QADDR is DB relative.            |           06375000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06380000
        5   | offset in the data segment or system buffer   |  QADDR    06385000
            | table to the target data buffer.              |           06390000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06395000
        6   |                       | Function code.        |  QFUNC    06400000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06405000
        7   | On initiation, specifies the word count (> 0) |  QCOUNT   06410000
            | or byte count (< 0).  At completion of the    |           06415000
            | request this location contains the actual     |           06420000
            | transmission count in the same units (bytes   |           06425000
            | or words) as in the request.                  |           06430000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06435000
        8   | High order address of location on tape.       |  QPARM1   06440000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06445000
        9   | Low order address of location on tape.        |  QPARM2   06450000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           06455000
       10   |                       |  QUALIFIER   | STATUS |  QSTAT    06460000
            ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---           06465000
       11   |         Process Control Block number          |  QPCB     06470000
            ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---           06475000
                                                                        06480000
                                                                        06485000
$PAGE                                                                   06490000
      QFLAG - Request dependent flags.                                  06495000
              Bit  0 - ABORT, abort this request and return an error    06500000
                       indication to the caller.                        06505000
                   1 - SPECIAL, apply special handling to this request  06510000
                       (not used).                                      06515000
                   2 - DIAG, this is a request from the diagnostic      06520000
                       subsystem.                                       06525000
                   3 - SYSBUFF, target is an index relative to the SBUF 06530000
                       Table of the data buffer.                        06535000
                   4 - IOWAKE, wake caller on completion of request.    06540000
                   5 - BLOCKED, blocked I/O.  The caller is waited in   06545000
                       ATTACHIO until the request is completed.  Implies06550000
                       IOWAKE.                                          06555000
                   6 - COMPLETED, the request has been completed and    06560000
                       the caller awakened if he had requested (with    06565000
                       IOWAKE).                                         06570000
                   7 - DATAFRZN, set by the memory management routines  06575000
                       (MAM) when a MAKEPRESENT request is successfully 06580000
                       completed and indicates the data segment is      06585000
                       frozen in memory.                                06590000
                   8 - MAMERRORD, an error has occurred while MAM was   06595000
                       trying to make the target data segment present   06600000
                       and freeze it in memory.                         06605000
                   9 - PREQ, (not used).                                06610000
                  10 - SFAIL, delayed failure of SIO instruction.  If a 06615000
                       call to START'HPIB resulted in the request being 06620000
                       added to the the channel queue, this bit         06625000
                       indicates that the SIO instruction failed when   06630000
                       the request was selected for execution.          06635000
                  11 - PFAIL, The request was aborted because of a      06640000
                       system power failure.                            06645000
                                                                        06650000
      QMISC - Driver request dependent flags.                           06655000
              RS - Request status failed.                               06660000
              OP - Operator requested release.                          06665000
              IM - Internal maintenance fault.                          06670000
              LF - Media loaded.                                        06675000
              SP - System powerfail.                                    06680000
              VE - Verify error.                                        06685000
              UR - Unload due to no write ring.                         06690000
              RC - Retry count field.                                   06695000
              WC - Wait code.                                           06700000
                   0 - new request.                                     06705000
                   1 - completion wait.                                 06710000
                   2 - not ready wait.                                  06715000
                   3 - release/release deny wait.                       06720000
                   4 - IOQ defer wait.                                  06725000
                   7 - synchronization wait.                            06730000
                                                                        06735000
$PAGE                                                                   06740000
      QSTAT - STATUS    - General status indicating the final state of  06745000
                          the request.  The following codes are used:   06750000
                          0 - Not started or awaiting completion.       06755000
                          1 - Successful completion.                    06760000
                          2 - End-Of-File detected.                     06765000
                          3 - Unusual, but recoverable, condition detect06770000
                          4 - Irrecoverable error has occurred.         06775000
              QUALIFIER - A code which further defines or qualifies the 06780000
                          general status.  (See Driver Return Status    06785000
                          Codes.)                                       06790000
                                                                        06795000
      QPCB  - The Process Control Block (PCB) number of the process     06800000
              which made this request.  If zero, the request is not     06805000
              associated with any process and the IOQ element is to be  06810000
              returned by the system when the request has completed.    06815000
$PAGE                                                                   06820000
4  IOQ I/O STATUS                                                       06825000
                                                                        06830000
   The following status values are returned by the Buckhorn driver.     06835000
                                                                        06840000
   General Status (13:3)     Qualifying Status (8:5)        Overall     06845000
                                                            Value       06850000
                                                                        06855000
   0 - Pending               1 - Completion wait            %10         06860000
                             3 - Not ready wait             %30         06865000
                                                                        06870000
   1 - Successful            0 - No errors                    1         06875000
                             2 - Retry was necessary        %21         06880000
                                                                        06885000
   3 - Unusual condition     1 - Status interrogation       %13*        06890000
                                 required                               06895000
                             3 - Request aborted            %33         06900000
                             4 - Prior error abort          %43         06905000
                             6 - Powerfail abort            %63         06910000
                           %21 - Device powered up         %213*        06915000
                                                                        06920000
   4 - Irrecoverable error   0 - Invalid request              4         06925000
                             1 - Track/Sector error         %14         06930000
                             2 - I/O timed out before       %24         06935000
                                 complete                               06940000
                             4 - SIO failure                %44         06945000
                             5 - Unit failure               %54         06950000
                             6 - Invalid address            %64         06955000
                           %12 - System error              %124         06960000
                           %14 - Channel failure           %144         06965000
                           %15 - Unitialized media         %154         06970000
                           %16 - No spares available       %164         06975000
                                                                        06980000
   * These status are used for diagnostic reporting only.               06985000
                                                                        06990000
                                                                        06995000
$PAGE                                                                   07000000
5  GENERIC STATUS LAYOUT                                                07005000
                                                                        07010000
   Bit    Meaning                                                       07015000
                                                                        07020000
   15     Immediate report                                              07025000
          0 = Disabled                                                  07030000
          1 = Enabled                                                   07035000
                                                                        07040000
   12-14  Reject Errors                                                 07045000
          000 = No Fatal Error                                          07050000
          001 = Channel Parity Error                                    07055000
          010 = Illegal Opcode                                          07060000
          011 = Illegal Module Address                                  07065000
          100 = Address Bounds Violation                                07070000
          101 = Illegal Parameter Length                                07075000
          110 = Illegal Message Sequence                                07080000
          111 = Illegal Message Length                                  07085000
                                                                        07090000
    8-11  Fault Errors                                                  07095000
          0000 = No Fault Errors                                        07100000
          0001 = Cross Unit Fault                                       07105000
          0010 = Controller Fault                                       07110000
          0011 = Unit Fault                                             07115000
          0100 = Diagnostic Failure                                     07120000
          0101 = Release Required                                       07125000
          0110 = Powerfail                                              07130000
          0111 = Retransmit Data                                        07135000
                                                                        07140000
    4-7   Access Errors                                                 07145000
          0000 = No Access Errors                                       07150000
          0001 = Illegal Parallel Operation                             07155000
          0010 = Unitialized Media                                      07160000
          0011 = No Spares Available                                    07165000
          0100 = Unit Not Ready                                         07170000
          0101 = Write Protected                                        07175000
          0110 = No Data Found                                          07180000
          0111 = Unrecoverable Data Overflow                            07185000
          1000 = Unrecoverable Data                                     07190000
          1001 = End-of-file                                            07195000
          1010 = End-of-volume                                          07200000
                                                                        07205000
    0-3   Information Fields                                            07210000
          0000 = No Information                                         07215000
          0001 = Operator Release Request                               07220000
          0010 = Diagnostic Release Request                             07225000
          0011 = Internal Maintenance Release Request                   07230000
          0100 = Media Wear                                             07235000
          0101 = Auto Sparing Invoked                                   07240000
          0110 = Recoverable Data Overflow                              07245000
          0111 = Marginal Data                                          07250000
          1000 = Recoverable Data                                       07255000
          1001 = Maintenance Track Overflow                             07260000
                                                                        07265000
   Refer to the CS/80 Instruction Set manual for definition of          07270000
   these items.                                                         07275000
                                                                        07280000
                                                                        07285000
$PAGE                                                                   07290000
6.1  CS/80 DEVICE STATUS                                                07295000
                                                                        07300000
   BYTE      STRUCTURE       FIELD                                      07305000
   ----      ---------       -----                                      07310000
                                                                        07315000
   0         VVVVUUUU        ID, VVVV - Volume, UUUU - Unit             07320000
   1         SSSSSSSS        ID, S - Value of the lowest numbered unit  07325000
                                     with status pending.  All ones     07330000
                                     indicate no units have status      07335000
                                     pending.                           07340000
   2-3       RRRRRRRR        Reject Error                               07345000
   4-5       FFFFFFFF        Fault Error                                07350000
   6-7       AAAAAAAA        Access Error                               07355000
   8-9       IIIIIIII        Information Error                          07360000
                                                                        07365000
   P1-P10    PPPPPPPP        Ten Parameter Associated Bytes             07370000
                                                                        07375000
   Reject Errors Field       Bits  0-15   00A00BCD EFG0H000             07380000
   Fault Errors Field        Bits 16-31   0A0B00C0 D0EFG0HI             07385000
   Access Errors Field       Bits 32-47   ABCDEF00 GH0IJ000             07390000
   Information Errors Field  Bits 48-63   ABCDE00F 0GHI0J00             07395000
                                                                        07400000
   Bit Pos.  Bit No.  Usage   [Reject Errors Field]                     07405000
                                                                        07410000
      A           2   Channel Parity Error                              07415000
      B           5   Illegal Opcode                                    07420000
      C           6   Module Addressing Error                           07425000
      D           7   Address Bounds Error                              07430000
      E           8   Parameter Bounds Error                            07435000
      F           9   Illegal Parameter                                 07440000
      G          10   Message Sequence Violation                        07445000
      H          12   Message Length Difference                         07450000
                                                                        07455000
   Bit Pos.  Bit No.  Usage   [Fault Errors Field]                      07460000
                                                                        07465000
      A          17   Cross-Unit (Linus)                                07470000
      B          19   Controller Fault                                  07475000
      C          22   Unit Fault                                        07480000
      D          24   Diagnostic Result Failed                          07485000
                      (P1-P6 = 6 bytes result)                          07490000
      E          26   Release Required for Operator Request             07495000
                      (Load/Unload)                                     07500000
      F          27   Release Required for Diagnostic Request           07505000
                      (HIO, Selftest)                                   07510000
      G          28   Release Required for Internal Maintenance         07515000
                      (Head Alignment, Error Log)                       07520000
      H          30   Power Fail                                        07525000
      I          31   Retransmit/Release Completed                      07530000
                                                                        07535000
$PAGE                                                                   07540000
   Bit Pos.  Bit No.  Usage   [Access Errors Field]                     07545000
                                                                        07550000
      A          32   Illegal Parallel Operation (Not Implemented)      07555000
      B          33   Uninitialized Media                               07560000
      C          34   No Spares Available                               07565000
      D          35   Not Ready                                         07570000
      E          36   Write Protect (Linus)                             07575000
      F          37   No Data Found (Linus)                             07580000
      G          40   Unrecoverable Data Overflow                       07585000
      H          41   Unrecoverable Data                                07590000
                      (P1-P6  = 6 bytes of bad block address)           07595000
      I          43   End of File (Linus)                               07600000
      J          44   End of Volume                                     07605000
                                                                        07610000
   Bit Pos.  Bit No.  Usage   [Information Errors Field]                07615000
                                                                        07620000
      A          48   Release Request for Operator Request              07625000
                      (Load/Unload)                                     07630000
      B          49   Release Request for Diagnostic Request            07635000
                      (HIO, Selftest)                                   07640000
      C          50   Release Request for Internal Maintenance          07645000
                      (Head Alignment, Error Log)                       07650000
      D          51   Media Wearing                                     07655000
      E          52   Data Overrun                                      07660000
      F          55   Auto-sparing Invoked (Linus)                      07665000
      G          57   Recoverable Data Overflow                         07670000
      H          58   Marginal Data                                     07675000
                      (P1-P6  = 6 bytes of marginal block address)      07680000
      I          59   Recoverable Data                                  07685000
                      (P1-P6  = 6 bytes of recoverable block address)   07690000
      J          61   Maintenance Track Overflow                        07695000
                                                                        07700000
   Parameter Usage:                                                     07705000
                                                                        07710000
   Byte -->              |  1  2  3  4  5  6       7   8   9   10     | 07715000
                                                                        07720000
   No Error              | New Target Address |                       | 07725000
   Diagnostic Result (24)| Diagnostic Results |  Device fault log --  | 07730000
   Unrecoverable Data(41)| Address of Block   |  except after a Spare | 07735000
   Marginal Data     (58)| Address of Block   |  indicate length of   | 07740000
   Recoverable Data  (59)| Address of Block   |  unrecoverable field  | 07745000
                                                                        07750000
   * SPECIAL NOTE:  Drive status are not pertinent unless a QSTAT 1     07755000
                    occurred prior to taking status.  Driver will often 07760000
                    do a LOC & WRT with zero length to force the "Not   07765000
                    Ready" condition to appear in status.               07770000
                                                                        07775000
$PAGE                                                                   07780000
6.2   GENERIC STATUS LAYOUT                                             07785000
                                                                        07790000
        Bit     Meaning                                                 07795000
                                                                        07800000
        0-3     Fatal Errors                                            07805000
                0000 = No fatal error.                                  07810000
                0001 = Tape runaway.                                    07815000
                0010 = Multiple tracks in error (MTE).                  07820000
                0011 = Timing error.                                    07825000
                0100 = Command reject.                                  07830000
                0101 = Unit failure.                                    07835000
                0110 = Data parity error.                               07840000
                0111 = Command parity error.                            07845000
                                                                        07850000
        4-6     Density                                                 07855000
                000 = Unrecognized density.                             07860000
                001 = 800 BPI (NRZI).                                   07865000
                010 = 1600 BPI (PE).                                    07870000
                011 = 6250 BPI (GCR).                                   07875000
                                                                        07880000
        7-8     Unit Number                                             07885000
                00 = Unit 0                                             07890000
                01 = Unit 1                                             07895000
                10 = Unit 2                                             07900000
                11 = Unit 3                                             07905000
                                                                        07910000
        9       End-of-file (EOF).                                      07915000
        10      Beginning-of-tape (BOT)/Load Point.                     07920000
        11      End-of-tape (EOT).                                      07925000
        12      Immediate Report Enabled.                               07930000
        13      Single Track in Error (STE).                            07935000
        14      Unit Online.                                            07940000
        15      File Protect (no write ring).                           07945000
                                                                        07950000
                                                                        07955000
$PAGE                                                                   07960000
7  RELEASE CONSIDERATIONS                                               07965000
                                                                        07970000
   Release will always be granted for Internal Maintenance requests (   07975000
   Head Alignment, Error Log).                                          07980000
                                                                        07985000
   Release will always be denied for Diagnostic requests                07990000
   (HIO, Selftest).  Release will be denied for Operator (Load/Unload)  07995000
   request when the disc is in a locked state and granted when the disc 08000000
   is in an unlocked state.                                             08005000
                                                                        08010000
   On a status return, under the fault error field, the internal        08015000
   maintenance status should be the only status generating a release    08020000
   required.  Operator and diagnostic requests generating a release     08025000
   required should never occur and such occurrences will be flagged as  08030000
   errors.                                                              08035000
                                                                        08040000
                                                                        08045000
8  LOCK/UNLOCK CONSIDERATIONS                                           08050000
                                                                        08055000
   The driver maintains a Lock/Unlock bit in the DIT which is set or    08060000
   cleared when various MPE modules call the driver Lock and Unlock     08065000
   function code.  Operator request to unload the volume mounted will be08070000
   denied when the Lock bit is set and allowed only when the Lock bit is08075000
   cleared.                                                             08080000
                                                                        08085000
                                                                        08090000
 8.1  PRIVATE VOLUMES                                                   08095000
                                                                        08100000
      These are locked by the PVSYS module at the first logical mount   08105000
      and are unlocked at the last logical dismount.                    08110000
                                                                        08115000
                                                                        08120000
 8.2  SERIAL AND FOREIGN VOLUMES                                        08125000
                                                                        08130000
      These are locked for each FOPEN to the file and unlocked after    08135000
      each DCLOSE to the file.                                          08140000
                                                                        08145000
      Note:  PVPROC will lock all non-system volumes while processing   08150000
             any unexpected interrupts passed to it by DEVREC.          08155000
                                                                        08160000
                                                                        08165000
$PAGE                                                                   08170000
9  LOGGING CONSIDERATIONS                                               08175000
                                                                        08180000
   CPVA(0) along with the channel program aborted relative offset is    08185000
   logged for the following reasons:                                    08190000
                                                                        08195000
   1) DMA Abort -  DMA transfer aborted by memory errors.               08200000
   2) Channel Program Execution Error -  An error is detected by        08205000
      the CPP while servicing the channel program.                      08210000
                                                                        08215000
   20 bytes of disc status are logged for any errors occurring in the   08220000
   status fields.  (See CS/80 Device Status)                            08225000
                                                                        08230000
   Logging will not occur for the status Data Overrun since this can    08235000
   occur even under normal operating conditions when there are several  08240000
   high speed devices on more than one GIC.                             08245000
                                                                        08250000
   Logging is exempted when the driver is in diagnostics mode.          08255000
                                                                        08260000
                                                                        08265000
10  UNEXPECTED INTERRUPTS HANDLING                                      08270000
                                                                        08275000
    Earlier versions of this driver (as well as other CS80 de- <<09421>>08280000
    vice drivers) had to deal with so-called unexpected inter- <<09421>>08285000
    rupts, that is, interrupts generated by the device but not <<09421>>08290000
    in response to a driver-initiated I/O request. Historical- <<09421>>08295000
    ly, the only such interrupts before CS80 came  along  were <<09421>>08300000
    on  line and off line interrupts which should cause DEVREC <<09421>>08305000
    and PVPROC to run.                                         <<09421>>08310000
      With CS80 came other unexpected interrupts (release  re- <<09421>>08315000
    quests for internal maintenance, etc.).  DEVREC and PVPROC <<09421>>08320000
    are not interested in these. Trouble is, GIP and SIODM had <<09421>>08325000
    already AWAKEned DEVREC.  The best the driver could do was <<09421>>08330000
    support a cumbersome mechanism to tell PVPROC "Hey I real- <<09421>>08335000
    ly didn't mean it" when PVPROC came to call.               <<09421>>08340000
      By enlisting SIODM's co-operation, this version  of  the <<09421>>08345000
    driver has eliminated all that.  When GIP calls SIODM with <<09421>>08350000
    State 6 (Unexpected Interrupt), SIODM examines a previous- <<09421>>08355000
    ly unused DIT bit (DITP(DUNIT).(3:1)) which has  been  re- <<09421>>08360000
    served for this function.  Drivers which can tell the dif- <<09421>>08365000
    ference between on line/off line interrupts and other  un- <<09421>>08370000
    expected interrupts set this bit.  SIODM then goes direct- <<09421>>08375000
    ly to State 0, bypassing State 6. If the driver determines <<09421>>08380000
    that this interrupt should cause DEVREC to run,  it  exits <<09421>>08385000
    to State 6 of SIODM. If the interrupt came about while the <<09421>>08390000
    driver was processing an I/O request, it is deferred until <<09421>>08395000
    all IOQ entries for the device have been processed.        <<09421>>08400000
      Drivers which have not been enhanced initialize this bit <<09421>>08405000
    to 0, so SIODM works the way it did before for those driv- <<09421>>08410000
    ers (backward compatible).                                 <<09421>>08415000
                                                                        08420000
                                                                        08425000
11  STATUS CONSIDERATIONS                                               08430000
                                                                        08435000
    While the idle channel program is running, status will be read into 08440000
    the ILT table pointed to by ILT(ISTAP).  While an IOQ is being      08445000
    processed by the driver, status will be read into the DIT table.    08450000
    The driver will always reset the read status pointer back to the ILT08455000
    after processing an IOQ request.  This is neccesary since SIODM will08460000
    not call the driver to reschedule the idle when the idle has not    08465000
    been aborted.  This will occur for the driver functions which do not08470000
    execute a START'HPIB (ie. Lock, Unlock, Fopen, etc.)                08475000
                                                                        08480000
                                                                        08485000
$PAGE                                                                   08490000
              Parameters for CS'80 Merlin Driver Requests               08495000
              --------------------------------------------              08500000
                                                                        08505000
[ Note:  Count = (+) denotes #words ]                                   08510000
[              = (-) denotes #bytes ]                                   08515000
[                                   ]                                   08520000
                                                                        08525000
OPERATION            FUNCTION    PARAMETERS                             08530000
---------            --------    ----------                             08535000
                                                                        08540000
 Read                     0      Count - Transfer count                 08545000
                                                                        08550000
                                 Bank & Buffaddr contains               08555000
                                 data read.                             08560000
                                                                        08565000
                                 P1,P2 - Dbl wrd logical                08570000
                                         block address                  08575000
                                                                        08580000
 Write                    1      Count - Transfer count                 08585000
                                                                        08590000
                                 Bank & Buffaddr contains               08595000
                                 data for write.                        08600000
                                                                        08605000
                                 P1,P2 - Dbl wrd logical                08610000
                                         block address                  08615000
                                                                        08620000
 File Open                2      No parameters                          08625000
                                                                        08630000
 File Close               3      No parameters                          08635000
                                                                        08640000
 Device Close             4      No parameters                          08645000
                                                                        08650000
 Fill With Zeros          5      Count - Transfer count                 08655000
                                                                        08660000
                                 P1,P2 - Dbl wrd logical                08665000
                                         block address                  08670000
                                                                        08675000
 Fill With Blanks         6      Count - Transfer count                 08680000
                                                                        08685000
                                 P1,P2 - Dbl wrd logical                08690000
                                         block address                  08695000
                                                                        08700000
 Request Status           7      Count - Transfer count                 08705000
                                         (max status size 20 bytes)     08710000
                                                                        08715000
                                 Bank & Buffaddr for the return         08720000
                                 of the status.                         08725000
                                                                        08730000
 Initialize Media         8      P1 - Initialize Options                08735000
                                      [0=Retain factory,                08740000
                                         field spares]                  08745000
                                      [1=Retain factory                 08750000
                                         spares only]                   08755000
                                      [0=Retain]                        08760000
                                      [2=]                              08765000
                                                                        08770000
                            ???  P2 - Block Interleave                  08775000
                                      byte (binary number)              08780000
                                                                        08785000
 Unload Cartridge         9      No parameters                          08790000
                                                                        08795000
                                                                        08800000
 Write Disc Label        11      Count - Label count                    08805000
                                                                        08810000
                                 Bank & Buffaddr contains               08815000
                                 label info. to be written.             08820000
                                                                        08825000
                                 P1,P2 - Dbl wrd logical                08830000
                                         block address.                 08835000
                                                                        08840000
 Request Volume Limit    13      Bank & Buffaddr returns                08845000
                                 dbl wrd of size of tape                08850000
                                 mounted on the drive.                  08855000
                                                                        08860000
 Verify                  14      Count - Verify length                  08865000
                                         [0=Verify entire disc]         08870000
                                                                        08875000
                                 Bank & Buffaddr returns                08880000
                                 dbl wrd logical block                  08885000
                                 address of 1st bad block               08890000
                                 encountered with a error.              08895000
                                                                        08900000
                                 P1,P2 - Dbl wrd logical block address  08905000
                                         to begin doing verification.   08910000
                                                                        08915000
Generic Status           15      No parameters                          08920000
                                                                        08925000
Lock                     16      No parameters                          08930000
                                                                        08935000
Unlock                   17      No parameters                          08940000
                                                                        08945000
Read lock bit            18      Bank & Buffaddr returns                08950000
                                 the state of the DITs                  08955000
                                 lock flag.                             08960000
                                                                        08965000
Identify                 72      Bank & Buffaddr contains               08970000
                                 device ID returned.                    08975000
                                                                        08980000
Initiate Diag Selftest   73      P1 - 2 bytes loop count                08985000
                                      (#times to do diag)               08990000
                                 P2 - Selftest section                  08995000
                                      number to execute                 09000000
                                                                        09005000
Read Selftest Results    74      Bank & Buffaddr contains               09010000
                                 selftest results.                      09015000
                                                                        09020000
Loopback Write           75      Count - Transfer count                 09025000
                                                                        09030000
                                 Bank & Bankaddr contains               09035000
                                 loopback data for write.               09040000
                                 [Data sequence must begin              09045000
                                 with a Hex FF and each                 09050000
                                 byte which follows must                09055000
                                 equals its predecessor+1]              09060000
                                                                        09065000
Loopback Read            76      Count - Transfer count                 09070000
                                                                        09075000
                                 Bank & Buffaddr contains               09080000
                                 loopback data read.                    09085000
                                                                        09090000
General purpose command  77      Count - #Command bytes                 09095000
                                                                        09100000
                                 Bank & Buffaddr contains               09105000
                                 the command data bytes to              09110000
                                 be sent thru the command               09115000
                                 and reporting msg phase.               09120000
                                                                        09125000
Describe                 78      Count - Describe length       <<f9442>>09130000
                                                               <<f9442>>09135000
                                 Bank & Buffaddr returns       <<f9442>>09140000
                                 with the describe data        <<f9442>>09145000
                                                               <<f9442>>09150000
Release                  79      No parameters                          09155000
                                                                        09160000
Release Denied           80      No parameters                          09165000
                                                                        09170000
Set Release              81      P1 - 1 Suppress release                09175000
                                        timeout [T bit=1]               09180000
                                 P2 - 1 Release automatically           09185000
                                        during idle time                09190000
                                        [Z bit=1]                       09195000
                                                                        09200000
Set Address              82      Bank & Buffaddr contains               09205000
                                 dbl wrd of logical block               09210000
                                 address.                               09215000
                                                                        09220000
Spare Block              88      Bank & Buffaddr contains               09225000
                                 dbl wrd of logical block               09230000
                                 address of the block to be             09235000
                                 spared.                                09240000
                                                                        09245000
                                 P2 - 0 Spare retaining                 09250000
                                        data without                    09255000
                                        target block                    09260000
                                    - 1 Spare without                   09265000
                                        retaining data                  09270000
                                    - 4 Spare retaining                 09275000
                                        data with target                09280000
                                        block                           09285000
                                                                        09290000
Initiate Utility         91     ----------------------------            09295000
                                |Case 1: No Exec Message   |            09300000
                                |                          |            09305000
                                |Count - Not Applicable    |            09310000
                                |Bank & Buffaddr contains: |            09315000
                                |                          |            09320000
                                |Word   0: Util byte cnt[N]|            09325000
                                |Word 1-N: Util parm bytes |            09330000
                                |          if byte cnt <> 0|            09335000
                                |                          |            09340000
                                |P1 - 0 No exec message    |            09345000
                                ----------------------------            09350000
                                                                        09355000
                                ----------------------------            09360000
                                |Case 2: Send Exec Message |            09365000
                                |                          |            09370000
                                |Count - Exec msg length   |            09375000
                                |Bank & Buffaddr contains: |            09380000
                                |                          |            09385000
                                |Word 0-Count: Utility data|            09390000
                                |       bytes to be sent to|            09395000
                                |       the device.        |            09400000
                                |                          |            09405000
                                |P1 - 1 Send exec message  |            09410000
                                ----------------------------            09415000
                                                                        09420000
                                ----------------------------            09425000
                                |Case 3: Rcv Exec Message  |            09430000
                                |                          |            09435000
                                |Count - Exec msg length   |            09440000
                                |Bank & Buffaddr contains: |            09445000
                                |                          |            09450000
                                |Word   0: Util byte cnt[N]|            09455000
                                |Word 1-N: Util parm bytes |            09460000
                                |          if byte cnt <> 0|            09465000
                                |                          |            09470000
                                |Bank & Buffaddr+10 return:|            09475000
                                |                          |            09480000
                                |Word 0-N: Util data infor.|            09485000
                                |          (optional)      |            09490000
                                |                          |            09495000
                                |P1 - 2 Rcv exec message   |            09500000
                                ----------------------------            09505000
                                                                        09510000
                                ----------------------------            09515000
                                |For All Cases]            |            09520000
                                |                          |            09525000
                                |P1 - Exec msg qualifier   |            09530000
                                |P2 - Utility number       |            09535000
                                ----------------------------            09540000
                                                                        09545000
Device Clear             92      No parameters                          09550000
                                                                        09555000
Cancel                   93      No parameters                          09560000
                                                                        09565000
Parity Checking          94      P1 - 0 Disables checking               09570000
                                    - 1 Enables checking                09575000
                                                                        09580000
                                                                        09585000
DIAGNOSTIC FUNCTIONS:  Will primarily be used by the MPE online         09590000
                       diagnostic package.  The diagnostic request      09595000
                       bit in the first word (QFLAG) of the disc        09600000
                       request queue should be set to allow the         09605000
                       diagnostic caller to handle its own status.      09610000
                       Otherwise the driver will assume that it had     09615000
                       been called by an MPE OS module and will         09620000
                       provide status and error logging will take       09625000
                       place.                                           09630000
                                                                        09635000
;                                                              <<09421>>09640000
                                                                        09645000
BEGIN                                                                   09650000
$INCLUDE INCLLPDT                                                       09655000
$PAGE "MPE TABLE ACCESS:  I/O QUEUE HEAD (SBH)"                <<09421>>09660000
$INCLUDE INCLSBH                                                        09665000
<<=================================================================>>   09670000
<<                                                                 >>   09675000
<<                         END INCLSBH                             >>   09680000
<<                                                                 >>   09685000
<<=================================================================>>   09690000
$PAGE "MPE TABLE ACCESS:  I/O QUEUE (IOQ)"                     <<09421>>09695000
$INCLUDE INCLIOQ                                                        09700000
<<=================================================================>>   09705000
<<                                                                 >>   09710000
<<                          END INCLIOQ                            >>   09715000
<<                                                                 >>   09720000
<<=================================================================>>   09725000
$PAGE    "QMISC bit definitions"                               <<09421>>09730000
DEFINE                                                                  09735000
   << QMISC bit definitions >>                                          09740000
                                                                        09745000
   IOQ'RSTAT'FAIL = IOQ'QMISC.( 0:1)#, << Request status failed flag >> 09750000
   IOQ'OPER'REQ   = IOQ'QMISC.( 1:1)#, << Operator req release flg   >> 09755000
   IOQ'IM'FAULT   = IOQ'QMISC.( 2:1)#, << Inter maintenance fault flg>> 09760000
   IOQ'MEDIA'LOAD = IOQ'QMISC.( 3:1)#, << Media load flag            >> 09765000
   IOQ'SYS'PFAIL  = IOQ'QMISC.( 4:1)#, << System powerfail flag      >> 09770000
   IOQ'VERIFY'ERR = IOQ'QMISC.( 5:1)#, << Verify error flag          >> 09775000
   IOQ'UNLOAD'RING= IOQ'QMISC.( 6:1)#, << No write ring              >> 09780000
   IOQ'RETRY'COUNT= IOQ'QMISC.( 7:3)#, << Retry count in QMISC       >> 09785000
                                                                        09790000
   IOQ'WAITCODE   = IOQ'QMISC.(12:4)#; << Indicates type of wait     >> 09795000
                                       <<                            >> 09800000
                                       << 0 - New request            >> 09805000
                                       << 1 - Completion             >> 09810000
                                       << 2 - Not ready              >> 09815000
                                       << 3 - Release/Release deny   >> 09820000
                                       << 4 - IOQ defer              >> 09825000
                                       << 5 - Sync. with device      >> 09830000
                                       << 6 - No write ring          >> 09835000
                                       << 7 - Abort IOQ              >> 09840000
$PAGE  "Device Information Table (DIT)"                        <<09421>>09845000
  << **************************************** >>                        09850000
  << Device Information Table (DIT) Elements. >>                        09855000
  << **************************************** >>                        09860000
                                                                        09865000
EQUATE                                                                  09870000
                                                                        09875000
   << ********** >>                                                     09880000
   << DIT words. >>                                                     09885000
   << ********** >>                                                     09890000
                                                                        09895000
   DIT'SIZE  = 29,  << Size of DIT                          >>          09900000
   DLDEV     =  3,  << Logical device                       >>          09905000
   DILTP     =  5,  << Interrupt linkage table pointer      >>          09910000
   DSTAT     =  6,  << Device powerfail status              >>          09915000
   DSERR     =  7,  << DIT error log lenght/offset          >>          09920000
   DUNIT     = 10,                                                      09925000
   DMISC     = 11,  << Device dependent word                >>          09930000
   DBADBLK1  = 12,  << High order addr of bad block         >>          09935000
   DBADBLK2  = 13,  << Low order addr of bad block          >>          09940000
   DBADXFER  = 14,  << Byte xfer left after bad block       >>          09945000
   DLOGERROR = 15,  << DIT hardware error logged status     >>          09950000
   DSIOPSTOP = 16,  << DIT CP stopped relative offset       >>          09955000
   DBYTECNT  = 17,  << Accum byte count > 6144 bytes        >>          09960000
   DSTATUS   = 19,  << Buffalo status                       >>          09965000
                                                                        09970000
   << DIT status offset >>                                              09975000
                                                                        09980000
   ID'FIELD      = DSTATUS,    << Identification field      >>          09985000
   REJECT'FIELD  = DSTATUS+1,  << Reject errors field       >>          09990000
   FAULT'FIELD   = DSTATUS+2,  << Fault errors field        >>          09995000
   ACCESS'FIELD  = DSTATUS+3,  << Access errors field       >>          10000000
   INFOR'FIELD   = DSTATUS+4,  << Information field         >>          10005000
   PARM'FIELD    = DSTATUS+5;  << Parameter fields          >>          10010000
$PAGE                                                                   10015000
DEFINE                                                                  10020000
                                                                        10025000
   << ********* >>                                                      10030000
   << DIT bits. >>                                                      10035000
   << ********* >>                                                      10040000
                                                                        10045000
   DLDEV'LD'BITS          = (0:16)#,                                    10050000
   DUNIT'AV'BIT           = ( 3:1)#,                           <<09421>>10055000
   DUNIT'RC'BIT           = ( 4:1)#,                                    10060000
   DUNIT'RL'BIT           = ( 5:2)#,                                    10065000
   DUNIT'IO'BIT           = ( 0:2)#,                                    10070000
   DMISC'LK'BIT           = ( 0:1)#,                                    10075000
   DMISC'NR'BIT           = ( 1:1)#,                           <<09421>>10080000
   DMISC'IM'BIT           = ( 2:1)#,                                    10085000
   DMISC'PI'BIT           = ( 3:1)#,                           <<09421>>10090000
   DMISC'RG'BIT           = ( 4:1)#,                           <<09421>>10095000
   DMISC'LW'BIT           = ( 5:1)#,                           <<J9456>>10100000
   DMISC'MP'BIT           = ( 6:1)#,                           <<J9456>>10105000
   DMISC'SS'BITS          = (12:4)#, << SUBSTATE of the driver   >>     10110000
                                                                        10115000
   ID'FIELD'UA'BITS       = ( 8:8)#, << Unit attention bits      >>     10120000
                                                                        10125000
   REJECT'FIELD'CP'BIT    = ( 2:1)#, << Channel parity bit       >>     10130000
   REJECT'FIELD'IO'BIT    = ( 5:1)#, << Illegal opcode bit       >>     10135000
   REJECT'FIELD'MD'BIT    = ( 6:1)#, << Module addr error bit    >>     10140000
   REJECT'FIELD'AB'BIT    = ( 7:1)#, << Addr bounds bit          >>     10145000
   REJECT'FIELD'PB'BIT    = ( 8:1)#, << Parameter bounds bit     >>     10150000
   REJECT'FIELD'IP'BIT    = ( 9:1)#, << Illegal parameter bit    >>     10155000
   REJECT'FIELD'MS'BIT    = (10:1)#, << Msg seq violation bit    >>     10160000
   REJECT'FIELD'ML'BIT    = (12:1)#, << Msg length differ bit    >>     10165000
                                                                        10170000
   FAULT'FIELD'CU'BIT     = ( 1:1)#, << Error during copy oper   >>     10175000
   FAULT'FIELD'CF'BIT     = ( 3:1)#, << Controller fault bit     >>     10180000
   FAULT'FIELD'UF'BIT     = ( 6:1)#, << Unit fault bit           >>     10185000
   FAULT'FIELD'DF'BIT     = ( 8:1)#, << Diag failed bit          >>     10190000
   FAULT'FIELD'OR'BIT     = (10:1)#, << Oper rel required bit    >>     10195000
   FAULT'FIELD'DR'BIT     = (11:1)#, << Diag rel required bit    >>     10200000
   FAULT'FIELD'IM'BIT     = (12:1)#, << Int maint required bit   >>     10205000
   FAULT'FIELD'PF'BIT     = (14:1)#, << Power fail bit           >>     10210000
   FAULT'FIELD'RE'BIT     = (15:1)#, << Rrtransmit/Rel cmplt bit >>     10215000
                                                                        10220000
   ACCESS'FIELD'IP'BIT    = ( 0:1)#, << Illegal /  operation bit >>     10225000
   ACCESS'FIELD'UM'BIT    = ( 1:1)#, << Uninitialized media bit  >>     10230000
   ACCESS'FIELD'NS'BIT    = ( 2:1)#, << No spare available bit   >>     10235000
   ACCESS'FIELD'DN'BIT    = ( 3:1)#, << Device not ready bit     >>     10240000
   ACCESS'FIELD'WP'BIT    = ( 4:1)#, << Write protect bit        >>     10245000
   ACCESS'FIELD'ND'BIT    = ( 5:1)#, << No data found bit        >>     10250000
   ACCESS'FIELD'UO'BIT    = ( 8:1)#, << Unrecov data overflow bit>>     10255000
   ACCESS'FIELD'UD'BIT    = ( 9:1)#, << Unrecov data bit         >>     10260000
   ACCESS'FIELD'EF'BIT    = (11:1)#, << End of file bit          >>     10265000
   ACCESS'FIELD'EV'BIT    = (12:1)#, << End of volume bit        >>     10270000
                                                                        10275000
   INFOR'FIELD'OR'BIT     = ( 0:1)#, << Operator rel request bit >>     10280000
   INFOR'FIELD'DR'BIT     = ( 1:1)#, << Diag rel request bit     >>     10285000
   INFOR'FIELD'IM'BIT     = ( 2:1)#, << Int maint request bit    >>     10290000
   INFOR'FIELD'MW'BIT     = ( 3:1)#, << Media wearing out bit    >>     10295000
   INFOR'FIELD'DO'BIT     = ( 4:1)#, << Data overrun bit         >>     10300000
   INFOR'FIELD'DB'BIT     = ( 7:1)#, << Defective blk auto spared>>     10305000
   INFOR'FIELD'RO'BIT     = ( 9:1)#, << Recov data overflow bit  >>     10310000
   INFOR'FIELD'MD'BIT     = (10:1)#, << Marginal data bit        >>     10315000
   INFOR'FIELD'RD'BIT     = (11:1)#, << Recov data bit           >>     10320000
   INFOR'FIELD'MT'BIT     = (13:1)#, << Maint track overflow bit >>     10325000
$PAGE                                                                   10330000
   << ************* >>                                                  10335000
   << DIT elements. >>                                                  10340000
   << ************* >>                                                  10345000
                                                                        10350000
   DIT'ADDR1'BAD'BLOCK  =  P'DIT (DBADBLK1    )                     #,  10355000
   DIT'ADDR2'BAD'BLOCK  =  P'DIT (DBADBLK2    )                     #,  10360000
   DIT'BAD'TRANSFER     =  P'DIT (DBADXFER    )                     #,  10365000
   DIT'ILT'PTR          =  P'DIT (DILTP       )                     #,  10370000
   DIT'LDEV             =  P'DIT (DLDEV       )                     #,  10375000
   DIT'LOG'ERROR        =  P'DIT (DLOGERROR   )                     #,  10380000
   DIT'SAVE'WORD        =  P'DIT (DSTAT       )                     #,  10385000
   DIT'SIOP'STOP        =  P'DIT (DSIOPSTOP   )                     #,  10390000
   DIT'ERROR'STATUS     =  P'DIT (DSERR       )                     #,  10395000
   DIT'DVR'DETECTS'AVR  =  P'DIT (DUNIT       ).DUNIT'AV'BIT#, <<09421>>10400000
   DIT'IO'TYPE          =  P'DIT (DUNIT       ).DUNIT'IO'BIT#,          10405000
   DIT'RELEASE'COUNT    =  P'DIT (DUNIT       ).DUNIT'RC'BIT#,          10410000
   DIT'RELEASE'CMD      =  P'DIT (DUNIT       ).DUNIT'RL'BIT#,          10415000
   DIT'LOCK'FLG         =  P'DIT (DMISC       ).DMISC'LK'BIT        #,  10420000
   DIT'NOT'RDY'EARLIER  =  P'DIT (DMISC       ).DMISC'NR'BIT#, <<09421>>10425000
   DIT'IMMEDIATE'MODE   =  P'DIT (DMISC       ).DMISC'IM'BIT        #,  10430000
   DIT'PENDING'INTERRUPT=  P'DIT (DMISC       ).DMISC'PI'BIT#, <<09421>>10435000
   DIT'RELEASE'GRANTED  =  P'DIT (DMISC       ).DMISC'RG'BIT#, <<09421>>10440000
   DIT'LAST'WAS'WRITE   =  P'DIT (DMISC       ).DMISC'LW'BIT#, <<J9456>>10445000
   DIT'MUST'PF'NEXT     =  P'DIT (DMISC       ).DMISC'MP'BIT#, <<J9456>>10450000
   DIT'SUBSTATE         =  P'DIT (DMISC       ).DMISC'SS'BITS       #,  10455000
$PAGE                                                                   10460000
   DIT'FIRST'STAT'WORD  =  P'DIT (ID'FIELD    )                     #,  10465000
   DIT'UNIT'ATTENTION   =  P'DIT (ID'FIELD    ).ID'FIELD'UA'BITS    #,  10470000
                                                                        10475000
   DIT'CHAN'PARITY'ERR  =  P'DIT (REJECT'FIELD).REJECT'FIELD'CP'BIT #,  10480000
   DIT'ILL'OPCODE       =  P'DIT (REJECT'FIELD).REJECT'FIELD'IO'BIT #,  10485000
   DIT'MODULE'ADDR'ERR  =  P'DIT (REJECT'FIELD).REJECT'FIELD'MD'BIT #,  10490000
   DIT'ADDR'BOUNDS      =  P'DIT (REJECT'FIELD).REJECT'FIELD'AB'BIT #,  10495000
   DIT'PARAMETER'BOUND  =  P'DIT (REJECT'FIELD).REJECT'FIELD'PB'BIT #,  10500000
   DIT'ILL'PARAMETER    =  P'DIT (REJECT'FIELD).REJECT'FIELD'IP'BIT #,  10505000
   DIT'ILL'MSG'SEQ      =  P'DIT (REJECT'FIELD).REJECT'FIELD'MS'BIT #,  10510000
   DIT'MSG'LENGTH'ERR   =  P'DIT (REJECT'FIELD).REJECT'FIELD'ML'BIT #,  10515000
                                                                        10520000
   DIT'COPY'ERR         =  P'DIT (FAULT'FIELD ).FAULT'FIELD'CU'BIT #,   10525000
   DIT'CONTROLLER'FAULT =  P'DIT (FAULT'FIELD ).FAULT'FIELD'CF'BIT #,   10530000
   DIT'UNIT'FAULT       =  P'DIT (FAULT'FIELD ).FAULT'FIELD'UF'BIT #,   10535000
   DIT'DIAG'FAIL        =  P'DIT (FAULT'FIELD ).FAULT'FIELD'DF'BIT #,   10540000
   DIT'OPR'REL'REQ      =  P'DIT (FAULT'FIELD ).FAULT'FIELD'OR'BIT #,   10545000
   DIT'DIAG'REL'REQ     =  P'DIT (FAULT'FIELD ).FAULT'FIELD'DR'BIT #,   10550000
   DIT'INT'MAINT'REQ    =  P'DIT (FAULT'FIELD ).FAULT'FIELD'IM'BIT #,   10555000
   DIT'DEV'POWERFAIL    =  P'DIT (FAULT'FIELD ).FAULT'FIELD'PF'BIT #,   10560000
   DIT'RETRANSMIT       =  P'DIT (FAULT'FIELD ).FAULT'FIELD'RE'BIT #,   10565000
                                                                        10570000
   DIT'ILL'OPERATION    =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'IP'BIT #,  10575000
   DIT'UNINIT'MEDIA     =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'UM'BIT #,  10580000
   DIT'SPARE'UNAVAIL    =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'NS'BIT #,  10585000
   DIT'DEV'NOT'RDY      =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'DN'BIT #,  10590000
   DIT'WRITE'PROTECT    =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'WP'BIT #,  10595000
   DIT'NO'DATA'FOUND    =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'ND'BIT #,  10600000
   DIT'DATA'OVERFLOW    =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'UO'BIT #,  10605000
   DIT'UNRECOV'DATA     =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'UD'BIT #,  10610000
   DIT'END'OF'FILE      =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'EF'BIT #,  10615000
   DIT'END'OF'VOLUME    =  P'DIT (ACCESS'FIELD).ACCESS'FIELD'EV'BIT #,  10620000
                                                                        10625000
   DIT'I'OPR'REL'REQ    =  P'DIT (INFOR'FIELD ).INFOR'FIELD'OR'BIT #,   10630000
   DIT'I'DIAG'REL'REQ   =  P'DIT (INFOR'FIELD ).INFOR'FIELD'DR'BIT #,   10635000
   DIT'I'INT'MAINT'REQ  =  P'DIT (INFOR'FIELD ).INFOR'FIELD'IM'BIT #,   10640000
   DIT'MEDIA'WEAR'OUT   =  P'DIT (INFOR'FIELD ).INFOR'FIELD'MW'BIT #,   10645000
   DIT'DATA'OVERRUN     =  P'DIT (INFOR'FIELD ).INFOR'FIELD'DO'BIT #,   10650000
   DIT'DEFECT'BLK'SPARE =  P'DIT (INFOR'FIELD ).INFOR'FIELD'DB'BIT #,   10655000
   DIT'NO'DATA'OVERFLOW =  P'DIT (INFOR'FIELD ).INFOR'FIELD'RO'BIT #,   10660000
   DIT'MARGINAL'DATA    =  P'DIT (INFOR'FIELD ).INFOR'FIELD'MD'BIT #,   10665000
   DIT'RECOV'DATA       =  P'DIT (INFOR'FIELD ).INFOR'FIELD'RD'BIT #,   10670000
   DIT'MAINT'TRACK      =  P'DIT (INFOR'FIELD ).INFOR'FIELD'MT'BIT #,   10675000
                                                                        10680000
   DIT'PARM'FIELD1      =  P'DIT (PARM'FIELD+1)                     #,  10685000
   DIT'PARM'FIELD2      =  P'DIT (PARM'FIELD+2)                     #;  10690000
$PAGE   "Driver function codes"                                <<09421>>10695000
EQUATE                                                                  10700000
                                                                        10705000
  << *************** >>                                                 10710000
  << Function Codes. >>                                                 10715000
  << *************** >>                                                 10720000
                                                                        10725000
  FC'READ           = 0 ,                                               10730000
  FC'WRITE          = 1 ,                                               10735000
  FC'OPEN'FILE      = 2 ,                                               10740000
  FC'CLOSE'FILE     = 3 ,                                               10745000
  FC'CLOSE'DEVICE   = 4 ,                                               10750000
  FC'REQ'LAST'STAT  = 5 , << Request status from last I/O. >>           10755000
  FC'INIT'MEDIA     = 6 , << Initialize the media.         >>           10760000
  FC'UNLOAD'CART    = 7 ,                                               10765000
  FC'REQ'VOL'LIMIT  = 8 , << Request the size of volume.   >>           10770000
  FC'LOC'N'VERIFY   = 9 , << Locate and verify the media.  >>           10775000
  FC'REQ'GENERIC    = 10, << Request generic status.       >>           10780000
  FC'LOCK           = 11, << Lock the volume from release. >>           10785000
  FC'UNLOCK         = 12,                                               10790000
  FC'READ'LOCK'BIT  = 13,                                               10795000
  FC'IMMEDIATE'MODE = 14,                                               10800000
  FC'IDENTIFY       = 15,                                               10805000
  FC'INIT'SELFTEST  = 16, << Perform diagnostic selftest.  >>           10810000
  FC'LOOPBACK'WRITE = 17,                                               10815000
  FC'LOOPBACK'READ  = 18,                                               10820000
  FC'RELEASE        = 19,                                               10825000
  FC'RELEASE'DENIED = 20,                                               10830000
  FC'SET'RELEASE    = 21,                                               10835000
  FC'SET'ADDRESS    = 22,                                               10840000
  FC'SPARE'BLOCK    = 23, << Allow drive to do sparing.    >>           10845000
  FC'INITIATE'UTIL  = 24,                                               10850000
  FC'DEVICE'CLEAR   = 25,                                               10855000
  FC'CANCEL'TRAN    = 26,                                               10860000
  FC'PARITY'CHECK   = 27, << Enable/disable parity on cmds.>>           10865000
  FC'GENERIC'DIAG   = 28, << Generic diagnostic commands.  >>           10870000
$PAGE   "IOQ Status return values"                             <<09421>>10875000
  << ************************ >>                                        10880000
  << IO Status Return Values. >>                                        10885000
  << ************************ >>                                        10890000
                                                                        10895000
  WRITE'RING'WAIT  =  %40,                                              10900000
                                                                        10905000
  GOOD'IO          =    1,                                              10910000
  GOOD'RETRY       =  %21,                                              10915000
                                                                        10920000
  READ'LAST'STAT   =  %13, << Status interrog required       >>         10925000
  SYSTEM'ABORT     =  %33,                                              10930000
  PRIOR'ERR'ABORT  =  %43,                                              10935000
  POWERFAIL'ABORT  =  %63,                                              10940000
  BACKSPACE'BOT    =  %73, << BOT and backspace requested.   >>         10945000
  DEV'POWER'ON     = %213, << Device powered on              >>         10950000
                                                                        10955000
  INVALID'REQUEST  =    4,                                              10960000
  TRACK'SECT'ERROR =  %14, << Unrecov track/sector error     >>         10965000
  TIMEOUT'ERROR    =  %24, << Timed out error                >>         10970000
  CHAN'PGM'FAILURE =  %44,                                              10975000
  UNIT'FAILURE     =  %54,                                              10980000
  INVALID'ADDR     =  %64, << Invalid address                >>         10985000
  SYSTEM'ERROR     = %124,                                              10990000
  CHAN'IO'FAILURE  = %144,                                              10995000
  UNINIT'MEDIA'ERR = %154, << Uninitialized media            >>         11000000
  NO'SPARE'ERR     = %164; << No spare abailable             >>         11005000
$PAGE  "Interrupt Linkage Table (ILT)"                         <<09421>>11010000
EQUATE                                                                  11015000
   << ********* >>                                                      11020000
   << ILT words >>                                                      11025000
   << ********* >>                                                      11030000
                                                                        11035000
   << Idle CP status offset >>                                          11040000
                                                                        11045000
   ILT'FAULT'FIELD  = 2,       << Idle fault errors field         >>    11050000
   ILT'ACCESS'FIELD = 3,       << Idle access errors field        >>    11055000
   ILT'INFOR'FIELD  = 4;       << Idle information field          >>    11060000
                                                                        11065000
DEFINE                                                                  11070000
   << ********* >>                                                      11075000
   << ILT bits  >>                                                      11080000
   << ********* >>                                                      11085000
                                                                        11090000
   ILT'DN'BITS      = ( 7:9)#, << DRT extract from ILT(ILT'CNTRL) >>    11095000
                                                                        11100000
   CPVA'EC'BITS     = ( 0:3)#, << CPVAP, error code               >>    11105000
   CPVA'ST'BITS     = (12:4)#, << CPVAP, status from the CP       >>    11110000
                                                                        11115000
   << ************ >>                                                   11120000
   << ILT elements >>                                                   11125000
   << ************ >>                                                   11130000
                                                                        11135000
   ILT'DRT'NUMBER       = P'ILT(ILT'CNTRL).ILT'DN'BITS#,                11140000
                                                                        11145000
   CPVA'ERRORCODE       = P'CPVA(0).CPVA'EC'BITS#,                      11150000
   CPVA'STATUS          = P'CPVA(1).CPVA'ST'BITS#;                      11155000
$PAGE  "Generic Status elements"                               <<09421>>11160000
DEFINE                                                                  11165000
  << ************************ >>                                        11170000
  << Generic Status Elements. >>                                        11175000
  << ************************ >>                                        11180000
                                                                        11185000
  GS'FATAL'ERROR      = GENERIC'STATUS.( 0:4)#,                         11190000
  GS'DENSITY          = GENERIC'STATUS.( 4:3)#,                         11195000
  GS'UNIT'NUMBER      = GENERIC'STATUS.( 7:2)#,                         11200000
  GS'END'OF'FILE      = GENERIC'STATUS.( 9:1)#,                         11205000
  GS'LOAD'POINT       = GENERIC'STATUS.(10:1)#,                         11210000
  GS'END'OF'TAPE      = GENERIC'STATUS.(11:1)#,                         11215000
  GS'IMMED'RPT'ENABLE = GENERIC'STATUS.(12:1)#,                         11220000
  GS'RECOVERED'ERR    = GENERIC'STATUS.(13:1)#,                         11225000
  GS'UNIT'ONLINE      = GENERIC'STATUS.(14:1)#,                         11230000
  GS'FILE'PROTECT     = GENERIC'STATUS.(15:1)#;                         11235000
$PAGE  "Type, subtype, CS80 and device commands"               <<09421>>11240000
EQUATE                                                                  11245000
                                                                        11250000
   << CS'80 Buffalo drive type and subtype >>                           11255000
                                                                        11260000
   TYPE'BUFFALO      = 3,                                               11265000
   SUBTYPE'BUFFALO   = 3,                                               11270000
                                                                        11275000
   << ILTP parameters >>                                                11280000
                                                                        11285000
   ILT'CNTRL =  7,  << DRT word                             >>          11290000
   ILT'SIOP  =  8,  << Channel program area pointer         >>          11295000
   ILT'STAP  =  9,  << Status area pointer                  >>          11300000
                                                                        11305000
   << CS'80 Secondaries commands >>                                     11310000
                                                                        11315000
   WRT'CMD'SEC      =   %2005,  << wrt w/cmd msg sec        >>          11320000
   READ'TRANS'SEC   =   %3402,  << read w/trans msg sec     >>          11325000
   WRT'TRANS'SEC    =   %4002,  << wrt w/trans msg sec      >>          11330000
   READ'EXEC'SEC    =   %1416,  << read w/exec msg sec      >>          11335000
   WRT'EXEC'SEC     =   %2016,  << wrt w/exec msg sec       >>          11340000
                                                                        11345000
   << CS'80 Buffalo driver command data bytes >>                        11350000
   << List is in alphabete order              >>                        11355000
                                                                        11360000
   CDB'CANCEL         =  %11,  << Cancel command            >>          11365000
   CDB'CI'CLEAR       =  %10,  << Channel independent clear >>          11370000
   CDB'DESCRIBE       =  %65,  << Describe command          >>          11375000
   CDB'INIT'DIAG      =  %63,  << Init diagnostic command   >>          11380000
   CDB'INIT'MEDIA     =  %67,  << Initialize media command  >>          11385000
   CDB'INIT'UTIL      =  %60,  << No executing message      >>          11390000
   CDB'JUMP'SPARE     =    4,  << Jump spare parameter      >>          11395000
   CDB'NOP            =  %64,  << No operation command      >>          11400000
   CDB'PARITY'OP      =    1,  << Parity opcode command     >>          11405000
   CDB'READ           =    0,  << Locate & read command     >>          11410000
   CDB'READ'LOOPBK    =   %2,  << Read loopback command     >>          11415000
   CDB'RELEASE        =  %16,  << Release command           >>          11420000
   CDB'RELEASE'DENY   =  %17,  << Release denied command    >>          11425000
   CDB'REQ'STATUS     =  %15,  << Request status command    >>          11430000
   CDB'SET'LENGTH     =  %30,  << Set length command        >>          11435000
   CDB'SET'OPTIONS    =  %70,  << Set options command       >>          11440000
   CDB'SET'MASK       =  %76,  << Set status mask cmd       >>          11445000
   CDB'SET'RELEASE    =  %73,  << Set release command       >>          11450000
   CDB'SET'RETADR     = %110,  << Set return addr mode cmd  >>          11455000
   CDB'SET'RETRY      =  %72,  << Set retry time command    >>          11460000
   CDB'SET'SNGL'VEC   =  %20,  << Set single vec addr cmd   >>          11465000
   CDB'SET'UNIT       =  %40,  << Set unit number command   >>          11470000
   CDB'SET'VOL        = %100,  << Set volume number command >>          11475000
   CDB'SKIP'SPARE     =    6,  << Skip spare parameter      >>          11480000
   CDB'SPARE'BLK      =   %6,  << Spare block command       >>          11485000
   CDB'UNLOAD         = %112,  << Unload command            >>          11490000
   CDB'VERIFY         =   %4,  << Verify command            >>          11495000
   CDB'WRITE          =   %2,  << Locate & write command    >>          11500000
   CDB'WRT'LOOPBK     =   %3,  << Write loopback command    >>          11505000
$PAGE  "SIOP-relative channel program section offsets"         <<09421>>11510000
   << Channel program offsets relative to SIOP >>                       11515000
                                                                        11520000
   FIRST'ID      = 0,             << Initialization offset  >> <<f9010>>11525000
   FIRSTBRANCH   = FIRST'ID+4,                                 <<f9010>>11530000
   BRANCHPT      = FIRSTBRANCH+1, << Branch offset          >>          11535000
   IDLE          = BRANCHPT+1,   << Idle CP offset          >>          11540000
   IDLE'WAIT     = IDLE+5,       << Idle when dev not ready >>          11545000
   SYNCDSJ       = IDLE'WAIT+14, << Get insync w. CS80 cmds >>          11550000
   IDENT         = SYNCDSJ+9,    << Identify section offset >>          11555000
   DXFER         = IDENT+4,      << Data xfer sec. offset   >>          11560000
   RSTAT         = DXFER+21,     << Read status offset      >>          11565000
   DIAG          = RSTAT+23,     << Read status offset      >>          11570000
   PON           = DIAG+14,      << Power on offset         >>          11575000
   CHAN'CLEAR    = PON+19,       << Channel clear offset    >> <<09421>>11580000
   STAT'CDB      = CHAN'CLEAR+19,<< Identify section offset?>> <<09421>>11585000
   LOC'WRT'CDB   = STAT'CDB+1,   << Loc & write CDB offset  >>          11590000
   PON'CDB'1     = LOC'WRT'CDB+4,<< CI clear and parity on  >>          11595000
   PON'CDB'2     = PON'CDB'1+1,  << Enable immediate rpt mod>>          11600000
   INITFLG       = PON'CDB'2+1,  << Init flag offset        >>          11605000
   FILL'WRD      = INITFLG+1,    << Fill word offset        >>          11610000
   DESC'AREA     = FILL'WRD+1,   << Describe area offset    >>          11615000
   CDB'AREA'WRD  = DESC'AREA+10, << CDB storage area offset >>          11620000
   CPGM'SIZE     = CDB'AREA'WRD+10, << Length of CP          >>         11625000
   CPGM'SIZED2   = (CPGM'SIZE+2)/2, << Length of CP / 2      >>         11630000
   INIT'ARY'SIZE = 4+DIT'SIZE+CPGM'SIZE,<< Len of init array>>          11635000
                                                                        11640000
   DESC'AREA'BYTE = DESC'AREA*2,    << Desc area byte offset>>          11645000
   CDB'AREA'BYTE  = CDB'AREA'WRD*2, << CDB area byte offset >>          11650000
                                    << Valid only for single>>          11655000
                                    << vector addresses.    >>          11660000
   VOLUME'LIMIT   = (DESC'AREA'BYTE + 30) / 2,                          11665000
                                                               <<09421>>11670000
                                                               <<09421>>11675000
   << Entries points to the channel program sections.>>                 11680000
                                                                        11685000
   CP'BASE         = FIRSTBRANCH+2,    << CP base              >>       11690000
   ENTER'IDLE      = IDLE-CP'BASE,     << Idle CP entry        >>       11695000
   ENTER'IDLE'WAIT = IDLE'WAIT-CP'BASE,<< Idle wait CP entry   >>       11700000
   ENTER'SYNC'DSJ  = SYNCDSJ-CP'BASE,  << Offset from 1st jump >>       11705000
   ENTER'DATA'XFER = DXFER-CP'BASE,    << Data xfer entry      >>       11710000
   ENTER'STAT'REQ  = RSTAT-CP'BASE,    << Request status entry >>       11715000
   ENTER'DIAG      = DIAG-CP'BASE,     << Diag function entry  >>       11720000
   ENTER'CHAN'CLEAR=CHAN'CLEAR-CP'BASE,<< Power on (up) entry  <<09421>>11725000
   ENTER'IDENTIFY  = IDENT-CP'BASE;    << Identify entry       >>       11730000
$PAGE  "CP offsets within sections"                            <<09421>>11735000
DEFINE                                                                  11740000
   << Channel program sections offsets >>                               11745000
                                                                        11750000
   CP'FIRST'BRANCH         = SIOP(BRANCHPT   )        #,                11755000
   CP'IDLE'CDB'OFFSET      = SIOP(IDLE   + 16)        #,                11760000
   CP'IDENT'HPIB'ID        = SIOP(IDENT  +  1)        #,                11765000
   CP'DXFER'WRITE'READ     = SIOP(DXFER  +  0)        #,                11770000
   CP'DXFER'CDB'LENGTH     = SIOP(DXFER  +  1)        #,                11775000
   CP'DXFER'CDB'BANK       = SIOP(DXFER  +  3).( 8: 8)#,                11780000
   CP'DXFER'CDB'OFFSET     = SIOP(DXFER  +  4)        #,                11785000
   CP'DXFER'WAIT'5         = SIOP(DXFER  +  5)        #,                11790000
   CP'DXFER'WAIT'6         = SIOP(DXFER  +  6)        #,                11795000
   CP'DXFER'CMD'TO'EXEC    = SIOP(DXFER  +  7)        #,                11800000
   CP'DXFER'DATA'SIZE      = SIOP(DXFER  +  8)        #,                11805000
   CP'DXFER'DATA'TYPE      = SIOP(DXFER  + 10).( 0: 8)#,                11810000
   CP'DXFER'DONT'C'ADDR    = SIOP(DXFER  + 10).( 4: 1)#,                11815000
   CP'DXFER'DATA'BANK      = SIOP(DXFER  + 10).( 8: 8)#,                11820000
   CP'DXFER'DATA'OFFSET    = SIOP(DXFER  + 11)        #,                11825000
   CP'DXFER'12'WAIT        = SIOP(DXFER  + 12)        #,                11830000
   CP'DXFER'13'WAIT        = SIOP(DXFER  + 13)        #,                11835000
   CP'RSTAT'CDB'OFFSET     = SIOP(RSTAT  +  4)        #,                11840000
   CP'RSTAT'STAT'AREA      = SIOP(RSTAT  + 11)        #,                11845000
   CP'DIAG'CMD'TO'EXEC     = SIOP(DIAG   +  0)        #,                11850000
   CP'DIAG'CDB'LENGTH      = SIOP(DIAG   +  1)        #,                11855000
   CP'DIAG'CDB'BANK        = SIOP(DIAG   +  3).( 8: 8)#,                11860000
   CP'DIAG'CDB'OFFSET      = SIOP(DIAG   +  4)        #,                11865000
   CP'DIAG'WAIT'5          = SIOP(DIAG   +  5)        #,                11870000
   CP'DIAG'WAIT'6          = SIOP(DIAG   +  6)        #,                11875000
   CP'PON'CDB'OFFSET       = SIOP(PON    +  4)        #,                11880000
   CP'DIAG'DSJ'PON         = SIOP(DIAG   + 11)        #,                11885000
   CP'PON'CDB'2'OFFSET     = SIOP(PON    + 16)        #,                11890000
   CP'CCLR'CDB'OFFSET      = SIOP(CHAN'CLEAR+4 )      #,       <<09421>>11895000
   CP'CCLR'CDB'2'OFFSET    = SIOP(CHAN'CLEAR+16)      #,       <<09421>>11900000
   CP'INIT'DVR'FLAG        = SIOP(INITFLG    )        #,                11905000
   CP'FILL'WORD            = SIOP(FILL'WRD   )        #;                11910000
$PAGE  "CS'80 BUFFALO DRIVER - HPIB"                           <<09421>>11915000
EQUATE                                                                  11920000
   << Buffalo driver states kept in IOQ'QMISC >>               <<f9010>>11925000
                                                                        11930000
   CMPLTION'WAIT  = 1,  << Waiting for I/O completion intrpt>>          11935000
   NOT'RDY'WAIT   = 2,  << Not ready wait in progress       >>          11940000
   REL'WAIT       = 3,  << Rel/Rel denied completion wait   >>          11945000
   IOQ'DEFER'WAIT = 4,  << IOQ being deferred wait          >>          11950000
   SYNC'WAIT      = 5,  << Driver/firmware sync wait        >>          11955000
   OPINTRVNWAIT   = 6,  << Unit not ready wait for operator >>          11960000
   ABORT'IOQ'WAIT = 7,  << Abort current I/O wait           >>          11965000
                                                                        11970000
   << Buffalo driver state kept in DIT'DMISC >>                <<f9010>>11975000
   NORMAL'IDLE    = 0,                                         <<f9010>>11980000
   IDLE'REQ'WAIT  = 1,  << Idle request completion wait     >>          11985000
                                                                        11990000
   << SIODM monitor states kept in DIT'DFLAG >>                <<f9010>>11995000
                                                                        12000000
   INITIATOR'STATE  =   2,                                              12005000
   COMPLETOR'STATE  =   3,                                              12010000
   REQUEST'COMPLETE =   5,  << Request done                 >>          12015000
   UNXPCT'INTERRUPT =   6,  << Unexpected interrupt         >> <<09421>>12020000
   NOT'READY        =   7,  << Unit not ready               >>          12025000
   INTERRUPT'WAIT   = %13,  << Waiting for I/O completion   >>          12030000
                                                                        12035000
   << I/O message parameters >>                                         12040000
                                                                        12045000
   CONSOLE           =   0, << Output msg to system console >>          12050000
   NSYS'DENY'MSG     =  26, << Non-sysdisc unload denied msg>>          12055000
   NOT'READY'MSG     =  11, << Not ready message index.     >>          12060000
   NO'WRITE'RING'MSG = 220, << No write ring message index. >>          12065000
                                                                        12070000
$PAGE                                                                   12075000
   << ***********************************. >>                           12080000
   << Misc Pointers And Program Constants. >>                           12085000
   << ************************************ >>                           12090000
                                                                        12095000
   CPVA'TIMEOUT       = %160004,<< CPVA returned if GIC timeout>>       12100000
   CTRL'UNIT          = %17,    << Controller unit             >>       12105000
   MAX'DESC'BYTE      = 37,     << Max# descrive bytes         >>       12110000
   SIX'K'BYTES        = 6144,   << 6K bytes                    >>       12115000
   SYSDB              = %1000,  << Address of SYSDB area       >>       12120000
   DEV'STAT'WORD'SIZE = 10,                                             12125000
   DMA'ABORT          = 6,                                              12130000
   CHANNEL'ABORT      = 7,                                              12135000
   RETRY'LIMIT        = 7,                                              12140000
   WAIT'INSTR         = %1000,   << HPIB wait instruction      >>       12145000
   BLANKS             = %20040,  << Word filled with spaces    >>       12150000
   ZERO               = 0,                                              12155000
   ONE                = 1,                                              12160000
   TWO                = 2,                                              12165000
   THREE              = 3,                                              12170000
   FOUR               = 4,                                     <<09421>>12175000
   FIVE               = 5,       << continuing the madness  >> <<09421>>12180000
   NINETEEN           = 19;                                             12185000
$PAGE                                                                   12190000
DEFINE                                                                  12195000
   HELL'FROZE'OVER = 1 > 2#,                                            12200000
                                                                        12205000
   << Statement defines >>                                              12210000
                                                                        12215000
   DISABLE    = ASSEMBLE (SED 0)#,                                      12220000
   SETDB'SYS  = BEGIN                                                   12225000
                TOS := %1000D;                                          12230000
                ASSEMBLE ( XCHD; DDEL );                                12235000
                END#,                                                   12240000
   SETDB'SIOP = BEGIN                                                   12245000
                TOS := ABS'SIOP'ADDR;                                   12250000
                ASSEMBLE ( XCHD; DDEL );                                12255000
                END#,                                                   12260000
   LOG'STATUS = DIT'ERROR'STATUS := [8/10,8/DSTATUS]#;                  12265000
                                                                        12270000
LOGICAL                                                                 12275000
   SPU'POWERFAIL = DB + %72,  << SYSDB rel powerfail word   >>          12280000
   SYSTEM'UP     = DB + %73;  << SYSDB rel system up word   >>          12285000
                                                                        12290000
BYTE ARRAY                                                              12295000
   SIODB'BYTE'ARRAY(*) = DB + 0;  << When DB = ABS'SIOP >>              12300000
$PAGE                                                                   12305000
<<                                                                      12310000
        ******************************************                      12315000
        *                                        *                      12320000
        *   Buffalo driver DB area definitions   *                      12325000
        *                                        *                      12330000
        ******************************************                      12335000
>>                                                                      12340000
                                                                        12345000
   ARRAY INITIAL(0:INIT'ARY'SIZE) = DB :=                               12350000
   [8/DIT'SIZE,8/%21], << Disc DIT size, core resident        >>        12355000
                       << Idle channel program, driver type 1 >>        12360000
                 ZERO, << Not used                            >>        12365000
                    0, << Unit extract instruction - NOP >>    <<f9010>>12370000
   [8/CPGM'SIZED2,8/10],<<CP size/2,10 words of status        >>        12375000
                                                                        12380000
   <<--------------->>                                                  12385000
   << Buffalo's DIT >>                                                  12390000
   <<--------------->>                                                  12395000
                                                                        12400000
   << 0  >>    ZERO,   << DFLAG                >>                       12405000
   << 1  >>    ZERO,   << DLINK                >>                       12410000
   << 2  >>    ZERO,   << DIOQP                >>                       12415000
   << 3  >>    ZERO,   << DLDEV                >>                       12420000
   << 4  >>    ZERO,   << DDLTP                >>                       12425000
   << 5  >>    ZERO,   << DILTP                >>                       12430000
   << 6  >>    ZERO,   << DSTAT                >>                       12435000
   << 7  >>    ZERO,   << DSERR                >>                       12440000
   << 8  >>    ZERO,   << DQHEAD               >>                       12445000
   << 9  >>    ZERO,   << DQTAIL               >>                       12450000
   << 10 >>    ZERO,   << DUNIT                >>                       12455000
   << 11 >>  %20000,   << DMISC(Immediate mode)>>                       12460000
   << 12 >>    ZERO,   << DBADBLK1             >>                       12465000
   << 13 >>    ZERO,   << DBADBLK2             >>                       12470000
   << 14 >>    ZERO,   << DBADXFER             >>                       12475000
   << 15 >>    ZERO,   << DLOGERROR            >>                       12480000
   << 16 >>    ZERO,   << DSIOPSTOP            >>                       12485000
   << 17 >> ZERO,ZERO, << DBYTECNT             >>                       12490000
          0,0,0,0,0,   << DSTATUS              >>                       12495000
          0,0,0,0,0,                                                    12500000
$PAGE "   Channel Program area"                                <<09421>>12505000
   <<--------------------------------------------------->>              12510000
   << Buffalo channel program (CP)                      >>              12515000
   <<--------------------------------------------------->>              12520000
                                                                        12525000
<< 0>>  << JUMP >>         0, << Initialization entry>>        <<f9010>>12530000
<< 1>>                     0,                                  <<f9010>>12535000
                                                               <<f9010>>12540000
<< 0>>  << IDENTIFY >> %3000, << Check for device present>>    <<f9010>>12545000
<< 1>>                     0,                                  <<f9010>>12550000
                                                               <<f9010>>12555000
<< 0>>  << JUMP >>         0, << Branch point to CP sect>>              12560000
<< 1>>                     0,                                           12565000
                                                                        12570000
   <<-------------------------------------------------->>               12575000
   << Idle CP - On hard error, requests status and on  >>               12580000
   <<           power on returns an idle PON status    >>               12585000
   <<-------------------------------------------------->>               12590000
                                                                        12595000
<< 0>>  << DSJ  >>     %2402, << DSJ to check power on >>               12600000
<< 1>>                     0, << Return byte           >>               12605000
<< 2>>                     0, << Normal return         >>               12610000
<< 3>>                     7, << Hard error /req status>>               12615000
<< 4>>                    21, << Idle power on occured >>               12620000
                                                                        12625000
<< 0>>  << WAIT >>     %1000, << Wait for PPOLL        >>               12630000
<< 1>>                     0,                                           12635000
                                                                        12640000
<< 2>>  << DSJ >>      %2402, << Reporting msg secondary>>              12645000
<< 3>>                     0, << Return byte           >>               12650000
<< 4>>                    12, << Normal completion     >>               12655000
<< 5>>                     0, << Hard error /req status>>               12660000
<< 6>>                    14, << Idle power on occurred>>               12665000
                                                                        12670000
<< 7>>  << LOC & WRT >>%2005, << Command msg secondary >>               12675000
<< 8>>                     7, << Cmd buffer length     >>               12680000
<< 9>>                     0, << No burst              >>               12685000
<<10>>                %42000, << Cmd buffer bank       >>               12690000
<<11>>                     0, << Cmd buffer abs addr   >>               12695000
                                                                        12700000
<<12>>  << WAIT >>     %1000, << Wait for PPOLL        >>               12705000
<<13>>                     0,                                           12710000
                                                                        12715000
<<14>>  << DSJ >>      %2402, << Reporting msg secondary>>              12720000
<<15>>                     0, << Return byte           >>               12725000
<<16>>                     0, << Normal completion     >>               12730000
<<17>>                    29, << Hard error /req status>>               12735000
<<18>>                     2, << Power on occurred     >>               12740000
                                                                        12745000
<<19>>  << INT/HLT0 >>  %601, << Interrupt/halt        >>               12750000
<<20>>                     0, << Code of 0 in CPVA(1)  >>               12755000
                                                                        12760000
<<21>>  << INT/HLT4 >>  %601, << Interrupt/halt        >>               12765000
<<22>>                     4, << Code of 4 in CPVA(1)  >>               12770000
$PAGE                                                                   12775000
   <<-------------------------------------------------->>               12780000
   <<         Identify instruction                     >>               12785000
   <<-------------------------------------------------->>               12790000
                                                                        12795000
<< 0>>  << IDENTIFY >> %3000,                                           12800000
<< 1>>                     0, << Id return byte        >>               12805000
                                                                        12810000
<< 2>>  << INT/HLT0 >>  %601, << Interrupt/halt        >>      <<09421>>12815000
<< 3>>                     0, << Code of 0 in CPVA(1)  >>               12820000
$PAGE                                                                   12825000
   <<-------------------------------------------------->>               12830000
   << [DXFER] Real-time & some general purpose cmds    >>               12835000
   << Command - Execution - Reporting message sections >>               12840000
   <<-------------------------------------------------->>               12845000
                                                                        12850000
<< 0>>  << WRITE CTRL>>%2005, << Command msg secondary >>               12855000
<< 1>>                     0, << Cmd buffer length     >>               12860000
<< 2>>                     0, << No burst              >>               12865000
<< 3>>                 %2000, << Cmd buffer bank       >>               12870000
<< 4>>                     0, << Cmd buffer abs addr   >>               12875000
                                                                        12880000
<< 5>>  << WAIT >>     %1000, << Wait for PPOLL        >>               12885000
<< 6>>                     0,                                           12890000
                                                                        12895000
<< 7>>  <<RD/WRT CTRL>>%1416, << Execution msg secondary>>              12900000
<< 8>>                     0, << #bytes to read/write  >>               12905000
<< 9>>                     0, << No Burst              >>               12910000
<<10>>                     0, << Data bank             >>               12915000
<<11>>                     0, << Data buffer abs addr  >>               12920000
                                                                        12925000
<<12>>  << WAIT >>     %1000, << Wait for PPOLL        >>               12930000
<<13>>                     0,                                           12935000
                                                                        12940000
<<14>>  << DSJ >>      %2402, << Reporting msg secondary>>              12945000
<<15>>                     0, << Return byte           >>               12950000
<<16>>                     0, << Normal completion     >>               12955000
<<17>>                     2, << Hard error /req status>>               12960000
<<18>>                    39, << Power on occurred     >>               12965000
                                                                        12970000
<<19>>  << INT/HLT0 >>  %601, << Interrupt/halt        >>               12975000
<<20>>                     0, << Code of 0 in CPVA(1)  >>               12980000
$PAGE                                                                   12985000
   <<-------------------------------------------------->>               12990000
   << [RSTAT] Status interrogation section             >>               12995000
   << Command - Execution - Reporting message sections >>               13000000
   <<-------------------------------------------------->>               13005000
                                                                        13010000
<< 0>>  << WRITE CTRL>>%2005, << Command msg secondary >>               13015000
<< 1>>                     1, << Cmd buffer length     >>               13020000
<< 2>>                     0, << No Burst              >>               13025000
<< 3>>                %42000, << Cmd buffer bank       >>               13030000
<< 4>>  << STAT CDB >>     0, << Cmd buffer abs addr   >>               13035000
                                                                        13040000
<< 5>>  << WAIT >>     %1000, << Wait for PPOLL        >>               13045000
<< 6>>                     0,                                           13050000
                                                                        13055000
<< 7>>  << READ CTRL >>%1416, << Execution msg secondary>>              13060000
<< 8>>                    20, << #status bytes to read >>               13065000
<< 9>>                     0, << No Burst              >>               13070000
<<10>>                 %2000, << Data bank             >>               13075000
<<11>>  << STAT AREA >>    0, << Data buffer abs addr  >>               13080000
                                                                        13085000
<<12>>  << WAIT >>     %1000, << Wait for PPOLL        >>               13090000
<<13>>                     0,                                           13095000
                                                                        13100000
<<14>>  << DSJ >>      %2402, << Reporting msg secondary>>              13105000
<<15>>                     0, << Return byte           >>               13110000
<<16>>                     0, << Normal completion     >>               13115000
<<17>>                     2, << Hard error /req status>>               13120000
<<18>>                    18, << Power on occurred     >>               13125000
                                                                        13130000
<<19>>  << INT/HLT1 >>  %601, << Interrupt/halt        >>               13135000
<<20>>                     1, << Code of 1 in CPVA(1)  >>               13140000
                                                                        13145000
<<21>>  << INT/HLT3 >>  %601, << Interrupt/halt        >>               13150000
<<22>>                     3, << Code of 3 in CPVA(1)  >>               13155000
$PAGE                                                                   13160000
   <<-------------------------------------------------->>               13165000
   << [DIAG] complementary, GP, diag, trans commands   >>               13170000
   << Command/Trans - Reporting message sections       >>               13175000
   <<-------------------------------------------------->>               13180000
                                                                        13185000
<< 0>>  << WRITE CTRL>>%2005, << Cmd/trans msg secondary>>              13190000
<< 1>>                     0, << Cmd buffer length     >>               13195000
<< 2>>                     0, << No Burst              >>               13200000
<< 3>>                 %2000, << Cmd buffer bank       >>               13205000
<< 4>>                     0, << Cmd buffer abs addr   >>               13210000
                                                                        13215000
<< 5>>  << WAIT >>     %1000, << Wait for PPOLL        >>               13220000
<< 6>>                     0,                                           13225000
                                                                        13230000
<< 7>>  << DSJ >>      %2402, << Reporting msg secondary>>              13235000
<< 8>>                     0, << Return byte           >>               13240000
<< 9>>                     0, << Normal completion     >>               13245000
<<10>>                   -35, << Hard error /req status>>               13250000
<<11>>                     2, << Power on occurred     >>               13255000
                                                                        13260000
<<12>>  << INT/HLT0 >>  %601, << Interrupt/halt        >>               13265000
<<13>>                     0, << Code of 0 in CPVA(1)  >>               13270000
$PAGE                                                                   13275000
   <<-------------------------------------------------->>               13280000
   << [PON] Channel independent clear on the device    >>               13285000
   << should be done, and parity on.                   >>               13290000
   <<-------------------------------------------------->>               13295000
                                                                        13300000
<< 0>>  << WRITE TRAN>>%4002, << Trans msg secondary   >>               13305000
<< 1>>                     2, << Cmd buffer length     >>               13310000
<< 2>>                     0, << No Burst              >>               13315000
<< 3>>  <<CI CLEAR >>  %2000, << Cmd buffer bank       >>               13320000
<< 4>>                     0, << Cmd buffer abs addr   >>               13325000
                                                                        13330000
<< 5>>  << WAIT >>     %1000, << Wait for PPOLL        >>               13335000
<< 6>>                     0,                                           13340000
                                                                        13345000
<< 7>>  << DSJ >>      %2402, << Reporting msg secondary>>              13350000
<< 8>>                     0, << Return byte           >>               13355000
<< 9>>                     0, << Normal completion     >>               13360000
<<10>>                   -49, << Hard error /req status>>               13365000
<<11>>                   -12, << Power on occurred     >>               13370000
                                                                        13375000
<<12>>  << WRITE TRAN>>%4002, << Trans msg secondary   >>               13380000
<<13>>                     2, << Cmd buffer length     >>               13385000
<<14>>                     0, << No Burst              >>               13390000
<<15>>                 %2000, << Cmd buffer bank       >>               13395000
<<16>>                     0, << Cmd buffer abs addr   >>               13400000
                                                                        13405000
<<17>>  << INT/HLT2 >>  %601, << Interrupt/halt        >>      <<09421>>13410000
<<18>>                     2, << Code of 2 in CPVA(1)  >>               13415000
$PAGE                                                          <<09421>>13420000
   <<-------------------------------------------------->>      <<09421>>13425000
   << [CHAN'CLEAR] Chennel independent clear, and      >>      <<09421>>13430000
   << turn parity on.  Same as PON except for CPVA(1)  >>      <<09421>>13435000
   << return code.  Separates Channel Clear from pend- >>      <<09421>>13440000
   << ing interrupt phenomena.                         >>      <<09421>>13445000
   <<-------------------------------------------------->>      <<09421>>13450000
                                                               <<09421>>13455000
<< 0>>  << WRITE TRAN>>%4002, << Trans msg secondary   >>      <<09421>>13460000
<< 1>>                     2, << Cmd buffer length     >>      <<09421>>13465000
<< 2>>                     0, << No Burst              >>      <<09421>>13470000
<< 3>>  <<CI CLEAR >>  %2000, << Cmd buffer bank       >>      <<09421>>13475000
<< 4>>                     0, << Cmd buffer abs addr   >>      <<09421>>13480000
                                                               <<09421>>13485000
<< 5>>  << WAIT >>     %1000, << Wait for PPOLL        >>      <<09421>>13490000
<< 6>>                     0,                                  <<09421>>13495000
                                                               <<09421>>13500000
<< 7>>  << DSJ >>      %2402, << Reporting msg secondary>>     <<09421>>13505000
<< 8>>                     0, << Return byte           >>      <<09421>>13510000
<< 9>>                     0, << Normal completion     >>      <<09421>>13515000
<<10>>                   -68, << Hard error /req status>>      <<09421>>13520000
<<11>>                   -31, << Power on occurred     >>      <<09421>>13525000
                                                               <<09421>>13530000
<<12>>  << WRITE TRAN>>%4002, << Trans msg secondary   >>      <<09421>>13535000
<<13>>                     2, << Cmd buffer length     >>      <<09421>>13540000
<<14>>                     0, << No Burst              >>      <<09421>>13545000
<<15>>                 %2000, << Cmd buffer bank       >>      <<09421>>13550000
<<16>>                     0, << Cmd buffer abs addr   >>      <<09421>>13555000
                                                               <<09421>>13560000
<<17>>  << INT/HLT5 >>  %601, << Interrupt/halt        >>      <<09421>>13565000
<<18>>                     5, << Code of 5 in CPVA(1)  >>      <<09421>>13570000
$PAGE                                                                   13575000
   <<-------------------------------------------------->>               13580000
   <<  Miscellaneous storage and constants area        >>               13585000
   <<-------------------------------------------------->>               13590000
                                                                        13595000
<< =============================================== >>                   13600000
<<               STAT'CDB area                     >>                   13605000
<< =============================================== >>                   13610000
                                                                        13615000
<<  0>> << STATUS'CDB >> %15, << CDB for request status>>               13620000
                                                                        13625000
<< =============================================== >>                   13630000
<<              LOC'WRT'CDB area                   >>                   13635000
<< =============================================== >>                   13640000
                                                                        13645000
<<  0>> <<LOC & WRT CDB>>%40, << Set unit              >>               13650000
<<  1>>               %14000, << Set length zero       >>               13655000
<<  2>>                    0,                                           13660000
<<  3>>                    2, << locate & write        >>               13665000
                                                                        13670000
<< =============================================== >>                   13675000
<<                PON'CDB'1 area                   >>                   13680000
<< =============================================== >>                   13685000
                                                                        13690000
<<  0>> <<PON CDB>>   %20010, << CI clear              >>               13695000
                                                                        13700000
<< =============================================== >>                   13705000
<<                PON'CDB'2 area                   >>                   13710000
<< =============================================== >>                   13715000
                                                                        13720000
<<  0>>                 %401, << Set parity on commands>>               13725000
                                                                        13730000
<<  0>> << INITFLG >>      0, << Initialization flag   >>               13735000
                                                                        13740000
<<  0>> << FILL WORD >>    0, << Fill W/zeros, blanks  >>               13745000
                                                                        13750000
<< =============================================== >>                   13755000
<<                 DESC'AREA area                  >>                   13760000
<< =============================================== >>                   13765000
                                                                        13770000
<<  0>> << DESC >> 0,0,0,0,0, << Describe area         >>               13775000
<<  5>> << AREA >> 0,0,0,0,0,                                           13780000
                                                                        13785000
<< =============================================== >>                   13790000
<<                CDB'AREA'WRD area                >>                   13795000
<< =============================================== >>                   13800000
                                                                        13805000
<<  0>> << CDB  >> 0,0,0,0,0, << CDB area/desc area    >>               13810000
<<  5>> << AREA >> 0,0,0,0,0;                                           13815000
                                                                        13820000
$PAGE "   External procedure declarations"                     <<09421>>13825000
<<                                                                      13830000
         ***************************************                        13835000
         *                                     *                        13840000
         *   External procedure declarations   *                        13845000
         *                                     *                        13850000
         ***************************************                        13855000
>>                                                                      13860000
                                                                        13865000
INTEGER PROCEDURE GETDRT(DRTN,OFFSET);                                  13870000
   VALUE DRTN,OFFSET;                                                   13875000
   INTEGER DRTN,OFFSET;                                                 13880000
   OPTION EXTERNAL;                                                     13885000
                                                                        13890000
PROCEDURE GIP'HPIB;                                                     13895000
   OPTION EXTERNAL;                                                     13900000
                                                                        13905000
LOGICAL PROCEDURE IOMESSAGE(SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,            13910000
                            DEST,REPLY,OFFSET,P'DIT,IOTYPE);            13915000
   VALUE SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,             13920000
         P'DIT,IOTYPE;                                                  13925000
   INTEGER SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET;           13930000
   INTEGER IOTYPE;                                                      13935000
   INTEGER POINTER P'DIT;                                               13940000
   OPTION VARIABLE, EXTERNAL;                                           13945000
                                                                        13950000
PROCEDURE LDEVNOTRDY(P'DIT);                                            13955000
   VALUE P'DIT;                                                         13960000
   POINTER P'DIT;                                                       13965000
   OPTION EXTERNAL;                                                     13970000
                                                                        13975000
PROCEDURE MAINT'REQUEST(LDEV,TYPE,SUBTYPE);                             13980000
   VALUE LDEV,TYPE,SUBTYPE;                                             13985000
   INTEGER LDEV,TYPE,SUBTYPE;                                           13990000
   OPTION EXTERNAL;                                                     13995000
                                                                        14000000
PROCEDURE SIODM(P'DIT,FLAGS);                                           14005000
   VALUE P'DIT,FLAGS;                                                   14010000
   LOGICAL FLAGS;                                                       14015000
   POINTER P'DIT;                                                       14020000
   OPTION EXTERNAL;                                                     14025000
                                                                        14030000
PROCEDURE START'HPIB(P'DIT,SIOP,QFLAG);                                 14035000
   VALUE P'DIT,SIOP,QFLAG;                                              14040000
   LOGICAL QFLAG;                                                       14045000
   POINTER P'DIT,SIOP;                                                  14050000
   OPTION EXTERNAL;                                                     14055000
                                                                        14060000
PROCEDURE PUTDRT(DRT,OFFSET,NUM);                                       14065000
   VALUE DRT,OFFSET,NUM;                                                14070000
   INTEGER DRT,OFFSET,NUM;                                              14075000
   OPTION EXTERNAL;                                                     14080000
                                                               <<09421>>14085000
PROCEDURE HELP;                                                <<09421>>14090000
   OPTION EXTERNAL;                                            <<09421>>14095000
$PAGE "   Procedure BUFFALO'INIT"                              <<09421>>14100000
<<                                                                      14105000
         *********************************************                  14110000
         *                                           *                  14115000
         *   CS'80 driver initialization procedure   *                  14120000
         *                                           *                  14125000
         *********************************************                  14130000
>>                                                                      14135000
                                                                        14140000
<<---------------------------------------------------->>                14145000
<<                                                    >>                14150000
<<   This procedure initializes the cs'80 channel     >>                14155000
<<   program area and sends out a device clear to     >>                14160000
<<   reset the drive to a known state.                >>                14165000
<<                                                    >>                14170000
<<---------------------------------------------------->>                14175000
                                                                        14180000
PROCEDURE MERLIN'INIT(P'DIT);                                           14185000
   VALUE P'DIT;                                                         14190000
   INTEGER POINTER P'DIT;                                               14195000
                                                                        14200000
BEGIN                                                                   14205000
                                                                        14210000
INTEGER POINTER                                                         14215000
   P'ILT,                              << ILT pointer               >>  14220000
   SIOP;                               << channel program pointer   >>  14225000
                                                                        14230000
LOGICAL                                                                 14235000
   LPDT'INDEX;                                                          14240000
                                                                        14245000
DISABLE;                               << On entry-want MERLIN'INIT>>   14250000
                                       << to complete               >>  14255000
                                                                        14260000
@P'ILT := P'DIT(DILTP);                << pointer to the ILT        >>  14265000
@SIOP  := P'ILT(ILT'SIOP);             << pointer to the SIOP       >>  14270000
                                                                        14275000
       << Need to re-initialize after powerfail >>             <<01924>>14280000
       <<         if device is not locked       >>             <<01924>>14285000
     if spu'powerfail <> 0 and logical(dit'lock'flg) then      <<01924>>14290000
        return;                                                <<01924>>14295000
                                                                        14300000
LPDT'INDEX   := DIT'LDEV * SIZE'OF'LPDT'ENTRY;                          14305000
                                                               <<09421>>14310000
<< Lock device only if it's a system volume (don't ask  why >> <<09421>>14315000
<< it's a system volume).                                   >> <<09421>>14320000
                                                               <<09421>>14325000
DIT'LOCK'FLG := NOT LPDT'NON'SYS'DOMAIN;                       <<09421>>14330000
DIT'PENDING'INTERRUPT := FALSE;                                <<09421>>14335000
DIT'NOT'RDY'EARLIER   := FALSE;                                <<09421>>14340000
<< Set the IO type to = 1.  This means we are an HPIB Driver.>>         14345000
<< If this bit is 0, then other modules will think we are an>>          14350000
<< SIO Driver.                                   >>                     14355000
DIT'IO'TYPE := 1;                                                       14360000
DIT'DVR'DETECTS'AVR   := TRUE;  << We're a sma-a-art driver >> <<09421>>14365000
<< Initialize these two variables to 0.  Since we have just >>          14370000
<< come up, there have not been any releases granted yet. >>            14375000
DIT'RELEASE'COUNT := 0;                                                 14380000
DIT'RELEASE'CMD := 0;                                                   14385000
                                                                        14390000
CP'IDLE'CDB'OFFSET   := @SIOP  + SYSDB + LOC'WRT'CDB;                   14395000
CP'DXFER'CDB'OFFSET  := @SIOP  + SYSDB + CDB'AREA'WRD;                  14400000
CP'RSTAT'CDB'OFFSET  := @SIOP  + SYSDB + STAT'CDB;                      14405000
CP'RSTAT'STAT'AREA   := @P'DIT + SYSDB + DSTATUS;                       14410000
CP'DIAG'CDB'OFFSET   := @SIOP  + SYSDB + CDB'AREA'WRD;                  14415000
CP'PON'CDB'OFFSET    := @SIOP  + SYSDB + PON'CDB'1;                     14420000
CP'PON'CDB'2'OFFSET  := @SIOP  + SYSDB + PON'CDB'2;                     14425000
CP'CCLR'CDB'OFFSET   := @SIOP  + SYSDB + PON'CDB'1;            <<09421>>14430000
CP'CCLR'CDB'2'OFFSET := @SIOP  + SYSDB + PON'CDB'2;            <<09421>>14435000
CP'FIRST'BRANCH      := ENTER'CHAN'CLEAR;                      <<09421>>14440000
                                       << For series 33 and 64      >>  14445000
                                       << microcode bug             >>  14450000
PUTDRT(ILT'DRT'NUMBER,THREE,ZERO);                                      14455000
START'HPIB(P'DIT,SIOP,FALSE);                                           14460000
DIT'SUBSTATE     := IDLE'REQ'WAIT;                                      14465000
                                                                        14470000
CP'INIT'DVR'FLAG := TRUE;                                               14475000
                                                                        14480000
END;                                                                    14485000
$PAGE "   BUFFALO'DRIVER - local declarations"                 <<09421>>14490000
<<                                                                      14495000
         **************************************************             14500000
         *                                                *             14505000
         * CS'80 disc driver procedure  -  MERLIN'DRIVER *              14510000
         *                                                *             14515000
         **************************************************             14520000
>>                                                                      14525000
                                                                        14530000
<<--------------------------------------------------------->>           14535000
<<                                                         >>           14540000
<<   This procedure initiates and completes i/o requests   >>           14545000
<<   for the CS'80 discs connected to the HP-IB and con-   >>           14550000
<<   trolled by the general I/O channel (GIC).             >>           14555000
<<                                                         >>           14560000
<<   Mode returns in MERLIN'DRIVER -                      >>            14565000
<<     5 - Request completed                               >>           14570000
<<     6 - Unexpected (AVR) interrupt                      >>  <<09421>>14575000
<<     7 - Not ready wait                                  >>           14580000
<<   %13 - Wait for completion                             >>           14585000
<<                                                         >>           14590000
<<--------------------------------------------------------->>           14595000
                                                                        14600000
INTEGER PROCEDURE MERLIN'DRIVER(P'IOQ,P'DIT,BANK,BUFFADDR,SIOP,DRTN);   14605000
   VALUE P'DIT,P'IOQ,BANK,BUFFADDR,DRTN;                                14610000
   INTEGER BANK,BUFFADDR,DRTN,P'IOQ;                                    14615000
   INTEGER POINTER P'DIT;                                               14620000
   INTEGER ARRAY SIOP;                                                  14625000
   OPTION PRIVILEGED,UNCALLABLE;                                        14630000
                                                                        14635000
BEGIN                                                                   14640000
                                                                        14645000
LOGICAL POINTER                                                         14650000
   SIOP'BASE;                                                           14655000
                                                                        14660000
INTEGER POINTER                                                         14665000
   P'ILT,                              << ILT pointer               >>  14670000
   P'CPVA = P'ILT;                     << CP variable area ptr      >>  14675000
                                                                        14680000
DOUBLE                                                                  14685000
   TRANSFER'COUNT,                     << Buffer transfer count     >>  14690000
   BYTES'LEFT,                                                          14695000
   ABS'SIOP'ADDR,                                                       14700000
   VER'LEN,                            << Byte length of a verify   >>  14705000
   BANK'N'BUFF'ADDR = Q - 7;           << Bank and buffer address   >>  14710000
                                                                        14715000
DOUBLE POINTER                                                          14720000
   DIT'TRANSFERED'COUNT,                                                14725000
   DP'DIT = P'DIT;                                                      14730000
                                                                        14735000
INTEGER                                                                 14740000
   DRIVER'STATE = MERLIN'DRIVER,      << Driver return state       >>   14745000
   FCODE,                              << Function code             >>  14750000
   INDEX,                                                               14755000
   I,                                                                   14760000
   ADDRESS'OFFSET;                                                      14765000
$PAGE                                                          <<09421>>14770000
LOGICAL                                                                 14775000
   GENERIC'STATUS,                                                      14780000
   IOQ'ENTRY'INDEX,                                                     14785000
   LPDT'INDEX,                                                          14790000
   L'TRANSFER'COUNT = TRANSFER'COUNT + ONE,                             14795000
   L'BYTES'LEFT = BYTES'LEFT + ONE,                                     14800000
   PARM,                                                                14805000
   L1'VER'LEN = VER'LEN,               << First word of ver. len.   >>  14810000
   L2'VER'LEN = VER'LEN + ONE;         << 2'nd  word of ver. len.   >>  14815000
                                                               <<09421>>14820000
<<---------------------------------------------------->>       <<09421>>14825000
<<   Map from external to internal function code      >>       <<09421>>14830000
<<                                                    >>       <<09421>>14835000
<<   Function code 0 -4  --> Internal code 0 -4       >>       <<09421>>14840000
<<   Function code 5     --> Internal code 1          >>       <<09421>>14845000
<<   Function code 6     --> Internal code 1          >>       <<09421>>14850000
<<   Function code 7 -9  --> Internal code 5 -7       >>       <<09421>>14855000
<<   Function code 11    --> Internal code 1          >>       <<09421>>14860000
<<   Function code 13-18 --> Internal code 8 -13      >>       <<09421>>14865000
<<   Function code 29    --> Internal code 14         >>       <<09421>>14870000
<<   Function code 72-73 --> Internal code 15-16      >>       <<09421>>14875000
<<   Function code 74    --> Internal code 5          >>       <<09421>>14880000
<<   Function code 75-76 --> Internal code 17-18      >>       <<09421>>14885000
<<   Function code 78    --> Internal code 8          >>       <<f9442>>14890000
<<   Function code 79-82 --> Internal code 19-22      >>       <<09421>>14895000
<<   Function code 88    --> Internal code 23         >>       <<09421>>14900000
<<   Function code 91-94 --> Internal code 24-27      >>       <<09421>>14905000
<<   Function code 95    --> Internal code 5          >>       <<09421>>14910000
<<   Function code 100   --> Internal code 28         >>       <<09421>>14915000
<<   Function code 101   --> Internal code 25         >>       <<09421>>14920000
<<---------------------------------------------------->>       <<09421>>14925000
                                                               <<09421>>14930000
EQUATE                                                         <<09421>>14935000
   MAX'IOQ'FUNC       = 101,                                   <<09421>>14940000
   UNDEFINED'IOQ'FUNC =  -1;                                   <<09421>>14945000
                                                               <<09421>>14950000
LOGICAL ARRAY  << Can't use BYTE ARRAY, can't do PB-rel LDB >> <<09421>>14955000
   IOQ'FUNC'TO'FCODE(0:MAX'IOQ'FUNC) = PB :=                   <<09421>>14960000
                                                               <<09421>>14965000
<< IOQ'FUNC                                                 >> <<09421>>14970000
<<     UNITS  0    1    2    3    4    5    6    7    8    9>> <<09421>>14975000
<<  TENS                                                    >> <<09421>>14980000
<<    0 >>    0,   1,   2,   3,   4,   1,   1,   5,   6,   7,  <<09421>>14985000
<<    1 >>   -1,   1,  -1,   8,   9,  10,  11,  12,  13,  -1,  <<09421>>14990000
<<    2 >>   -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  14,  <<09421>>14995000
<<    3 >>   -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  <<09421>>15000000
<<    4 >>   -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  <<09421>>15005000
<<    5 >>   -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  <<09421>>15010000
<<    6 >>   -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  <<09421>>15015000
<<    7 >>   -1,  -1,  15,  16,   5,  17,  18,  -1,   8,  19,  <<f9442>>15020000
<<    8 >>   20,  21,  22,  -1,  -1,  -1,  -1,  -1,  23,  -1,  <<09421>>15025000
<<    9 >>   -1,  24,  25,  26,  27,   5,  -1,  -1,  -1,  -1,  <<09421>>15030000
<<   10 >>   28,  25;                                          <<09421>>15035000
$PAGE "   BUFFALO'DRIVER - subroutine SIOP'BYTE"               <<09421>>15040000
<<****************************************************>>                15045000
<<                                                    >>                15050000
<<   CS'80 disc driver subroutines                    >>                15055000
<<                                                    >>                15060000
<<****************************************************>>                15065000
                                                                        15070000
<<---------------------------------------------------->>                15075000
<<   SIOP'BYTE -- Subroutine to store the CS'80       >>                15080000
<<       command bytes into the channel program area. >>                15085000
<<---------------------------------------------------->>                15090000
                                                                        15095000
SUBROUTINE SIOP'BYTE(BYTE'OFFSET,ABYTE);                                15100000
   VALUE BYTE'OFFSET,ABYTE;                                             15105000
   LOGICAL BYTE'OFFSET,ABYTE;                                           15110000
                                                                        15115000
BEGIN << Of "subroutine SIOP'BYTE" >>                                   15120000
                                                                        15125000
SETDB'SIOP;                                                             15130000
SIODB'BYTE'ARRAY(BYTE'OFFSET) := ABYTE;                                 15135000
SETDB'SYS;                                                              15140000
                                                                        15145000
END; << Of "subroutine SIOP'BYTE" >>                                    15150000
$PAGE "   BUFFALO'DRIVER - subroutine UPDATE'XFER'CNT"         <<09421>>15155000
<<---------------------------------------------------->>                15160000
<<   UPDATE'XFER'CNT -- Update transfer count         >>                15165000
<<---------------------------------------------------->>                15170000
                                                                        15175000
SUBROUTINE UPDATE'XFER'CNT;                                             15180000
                                                                        15185000
BEGIN << Of "subroutine UPDATE'XFER'CNT" >>                             15190000
                                                                        15195000
IF DIT'TRANSFERED'COUNT = 0D THEN                                       15200000
   IF INTEGER(IOQ'COUNT) < ZERO THEN                                    15205000
                                       << Return byte count         >>  15210000
      IOQ'COUNT := -INTEGER(TRANSFER'COUNT -                            15215000
                      DOUBLE(CP'DXFER'DATA'SIZE))                       15220000
   ELSE                                                                 15225000
                                       << Return word count         >>  15230000
      IOQ'COUNT := INTEGER((TRANSFER'COUNT -                            15235000
                      DOUBLE(CP'DXFER'DATA'SIZE) + 1D) / 2D)            15240000
ELSE                                                                    15245000
   BEGIN                                                                15250000
   IF INTEGER(IOQ'COUNT) < ZERO THEN                                    15255000
                                       << Return byte count         >>  15260000
      IOQ'COUNT := -INTEGER(DIT'TRANSFERED'COUNT -                      15265000
                      DOUBLE(CP'DXFER'DATA'SIZE))                       15270000
   ELSE                                                                 15275000
                                       << Return word count         >>  15280000
      IOQ'COUNT := INTEGER((DIT'TRANSFERED'COUNT -                      15285000
                      DOUBLE(CP'DXFER'DATA'SIZE) + 1D) / 2D);           15290000
                                                                        15295000
   DIT'TRANSFERED'COUNT := 0D;         << Reset the count to zero.  >>  15300000
   END; << Of else "if DIT'TRANSFERED'COUNT = 0D ..." >>                15305000
                                                                        15310000
CP'DXFER'DATA'SIZE  := ZERO;           << Reset the transfer count >>   15315000
                                                                        15320000
END; << Of "subroutine UPDATE'XFER'CNT" >>                              15325000
$PAGE "   BUFFALO'DRIVER - subroutine ABORTING"                <<09421>>15330000
<<---------------------------->>                               <<J9110>>15335000
<<   ABORTING  -- Completor   >>                               <<J9110>>15340000
<<---------------------------->>                               <<J9110>>15345000
                                                               <<J9110>>15350000
LOGICAL SUBROUTINE ABORTING;                                   <<J9110>>15355000
BEGIN                                                          <<J9110>>15360000
  IF P'IOQ <> 0 AND IOQ'ABORT THEN                             <<J9110>>15365000
  BEGIN                                                        <<J9110>>15370000
<< don't PFAIL the READ operation >>                           <<09574>>15375000
    if ioq'pfail=1 and fcode=fc'read then                      <<09574>>15380000
    begin                                                      <<09574>>15385000
      ioq'pfail := 0;                                          <<09574>>15390000
      ioq'abort := 0;                                          <<09574>>15395000
      aborting := false;                                       <<09574>>15400000
      return;                                                  <<09574>>15405000
    end;                                                       <<09574>>15410000
    IOQ'STAT := IF IOQ'PFAIL=1 THEN POWERFAIL'ABORT            <<J9456>>15415000
                ELSE SYSTEM'ABORT;                             <<J9456>>15420000
    DRIVER'STATE := REQUEST'COMPLETE;                          <<J9110>>15425000
    IOQ'WAITCODE := 0;                                         <<J9110>>15430000
                                                               <<J9195>>15435000
    UPDATE'XFER'CNT;                                           <<J9110>>15440000
    ABORTING := TRUE;                                          <<J9110>>15445000
  END                                                          <<J9110>>15450000
  ELSE ABORTING := FALSE;                                      <<J9110>>15455000
END;   << End of ABORTING >>                                   <<J9110>>15460000
$PAGE "   BUFFALO'DRIVER - subroutine PENDING'INTERRUPT"       <<09421>>15465000
<<---------------------------------------------------------->> <<09421>>15470000
<<                     PENDING'INTERRUPT                    >> <<09421>>15475000
<<---------------------------------------------------------->> <<09421>>15480000
                                                               <<09421>>15485000
LOGICAL SUBROUTINE PENDING'INTERRUPT;                          <<09421>>15490000
                                                               <<09421>>15495000
BEGIN COMMENT --                                               <<09421>>15500000
  PENDING'INTERRUPT is called whenever the idle  channel  pro- <<09421>>15505000
gram is due to be started.  If an earlier IOQ (or the idle CP) <<09421>>15510000
completed with a PON (on-line transition), or we  detected  an <<09421>>15515000
off-line  transition, DIT'PENDING'INTERRUPT was set if the de- <<09421>>15520000
vice was not locked. If so, now is the time to create the (un- <<09421>>15525000
expected) interrupt associated with the PON.  We  do  this  by <<09421>>15530000
setting all necessary conditions and returning TRUE. The call- <<09421>>15535000
er is expected to RETURN from the driver. If there is no pend- <<09421>>15540000
ing interrupt, we return FALSE and the caller  can  then  con- <<09421>>15545000
tinue with the idle channel program.                           <<09421>>15550000
;                                                              <<09421>>15555000
PENDING'INTERRUPT := FALSE;                                    <<09421>>15560000
IF LOGICAL (DIT'PENDING'INTERRUPT) THEN                        <<09421>>15565000
   BEGIN   << Clear PI, only interrupt if not locked.       >> <<09421>>15570000
   DIT'PENDING'INTERRUPT := FALSE;   << Just do it once.    >> <<09421>>15575000
   IF NOT LOGICAL (DIT'LOCK'FLG) THEN                          <<09421>>15580000
      BEGIN   << Only interrupt if nobody's locked us.      >> <<09421>>15585000
      PENDING'INTERRUPT := TRUE;                               <<09421>>15590000
      DRIVER'STATE := UNXPCT'INTERRUPT;                        <<09421>>15595000
      END;    << Only interrupt if nobody's locked us.      >> <<09421>>15600000
   END;    << Clear PI, only interrupt if not locked.       >> <<09421>>15605000
END;       << of PENDING'INTERRUPT.                         >> <<09421>>15610000
$PAGE "   BUFFALO'DRIVER - subroutine LOCATE'AND'WRITE'0"      <<09421>>15615000
<<---------------------------------------------------------->> <<09421>>15620000
<<                     LOCATE'AND'WRITE'0                   >> <<09421>>15625000
<<---------------------------------------------------------->> <<09421>>15630000
                                                               <<09421>>15635000
SUBROUTINE LOCATE'AND'WRITE'0;                                 <<09421>>15640000
                                                               <<09421>>15645000
BEGIN COMMENT --                                               <<09421>>15650000
  This subroutine sets up a channel program  to  request  last <<09421>>15655000
status from the device.  The only way to do this, it seems, is <<09421>>15660000
via the CS80 command Locate And Write to block address 0  with <<09421>>15665000
length 0.  LOCATE'AND'WRITE'0 is invoked by the Request Device <<09421>>15670000
Status function processor.  It is also used by the  driver  on <<09421>>15675000
its  own behalf as a workaround to a strange condition, namely <<09421>>15680000
that the device does not  generate  an  unsolicited  interrupt <<09421>>15685000
(with DSJ of 2) when it goes on-line!  So we must solicit that <<09421>>15690000
interrupt via a status request. Because the conditions we test <<09421>>15695000
may be true at times other than when we actually come on line, <<09421>>15700000
we may run these status requests unnecessarily.                <<09421>>15705000
;                                                              <<09421>>15710000
CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                            <<09421>>15715000
CP'DIAG'CDB'LENGTH  := 7;                                      <<09421>>15720000
CP'DIAG'DSJ'PON := TWO;                                                 15725000
<< Set cp'diag'dsj'pon to default value of 2 .>>                        15730000
                                                               <<09421>>15735000
SETDB'SIOP;                                                    <<09421>>15740000
SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 0 ) := CDB'SET'UNIT;          <<09421>>15745000
                                                               <<09421>>15750000
SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 1 ) := CDB'SET'LENGTH;        <<09421>>15755000
SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 2 ) := ZERO;                  <<09421>>15760000
SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 3 ) := ZERO;                  <<09421>>15765000
SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 4 ) := ZERO;                  <<09421>>15770000
SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 5 ) := ZERO;                  <<09421>>15775000
                                                               <<09421>>15780000
SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 6 ) := CDB'WRITE;             <<09421>>15785000
SETDB'SYS;                                                     <<09421>>15790000
                                                               <<09421>>15795000
CP'FIRST'BRANCH := ENTER'DIAG;                                 <<09421>>15800000
                                                               <<09421>>15805000
END;   << of LOCATE'AND'WRITE'0                             >> <<09421>>15810000
$PAGE "   BUFFALO'DRIVER - initiator section"                  <<09421>>15815000
<<****************************************************>>                15820000
<<****************************************************>>                15825000
<<                                                    >>                15830000
<<           HP9144 driver initiator section          >>       <<09421>>15835000
<<                                                    >>                15840000
<<****************************************************>>                15845000
<<****************************************************>>                15850000
                                                                        15855000
@SIOP'BASE            := @SIOP;                                         15860000
ABS'SIOP'ADDR         := DOUBLE(LOGICAL(@SIOP + SYSDB));                15865000
IOQ'ENTRY'INDEX       := P'IOQ;        << IOQ offset                >>  15870000
@P'ILT                := DIT'ILT'PTR;  << ILT pointer               >>  15875000
LPDT'INDEX            := DIT'LDEV * SIZE'OF'LPDT'ENTRY;                 15880000
@DIT'TRANSFERED'COUNT := @P'DIT + DBYTECNT;                             15885000
$PAGE                                                                   15890000
<<---------------------------------------------------->>                15895000
<<  Assure that the initialization section was called.>>                15900000
<<---------------------------------------------------->>                15905000
                                                                        15910000
IF NOT LOGICAL( CP'INIT'DVR'FLAG ) THEN                                 15915000
   BEGIN                                                                15920000
   MERLIN'INIT(P'DIT);                                                  15925000
   IF IOQ'ENTRY'INDEX <> ZERO THEN                                      15930000
      BEGIN                                                             15935000
      IOQ'WAITCODE := IOQ'DEFER'WAIT;                                   15940000
      DRIVER'STATE := INTERRUPT'WAIT;                                   15945000
      END; << Of "if IOQ'ENTRY'INDEX <> ZERO ..." >>                    15950000
   RETURN;                                                              15955000
                                                               <<09421>>15960000
   << Call to HELP assures STT entry, is never executed.    >> <<09421>>15965000
                                                               <<09421>>15970000
   HELP;                                                       <<09421>>15975000
   END; << Of "if NOT LOGICAL(SIOP..." >>                               15980000
$PAGE                                                                   15985000
<<---------------------------------------------------->>                15990000
<<   No IOQ - Service special conditions asssociated  >>                15995000
<<            with the idle CP or schedule an         >>                16000000
<<            idle channel program.                   >>                16005000
<<---------------------------------------------------->>                16010000
                                                                        16015000
IF DRIVER'STATE    = INITIATOR'STATE AND                                16020000
   IOQ'ENTRY'INDEX = ZERO            THEN                               16025000
                                                                        16030000
   BEGIN                                                                16035000
                                                                        16040000
   <<---------------------------------------------------->>             16045000
   << Must not reference IOQ before return               >>             16050000
   <<---------------------------------------------------->>             16055000
                                                                        16060000
                                       << The idle CP aborted.      >>  16065000
<< Check to see if we have had a cpva = 2.  If we have not, >>          16070000
<< then we set dit'release'cmd :=0 to reinitialize it.  This >>         16075000
<< is for the instance whan a Release is executed with a >>             16080000
<< QSTAT <>2 (which is rare).  In that case, we must reinitialize>>     16085000
<< this variable or if the command following the Release gets >>        16090000
<< a Qstat = 2 we will get messed up.>>                                 16095000
   IF CPVA'STATUS <> TWO THEN                                           16100000
      DIT'RELEASE'CMD := 0;                                             16105000
                                                                        16110000
   IF CPVA'ERRORCODE = DMA'ABORT     OR   << DMA abort              >>  16115000
      CPVA'ERRORCODE = CHANNEL'ABORT THEN << Channel abort          >>  16120000
                                                                        16125000
      BEGIN                                                             16130000
                                       << Not rdy msg to console    >>  16135000
      IF SYSTEM'UP THEN LDEVNOTRDY(P'DIT);                              16140000
                                                                        16145000
                                       << Schedule idle wait CP     >>  16150000
      CP'FIRST'BRANCH := ENTER'IDLE'WAIT;                               16155000
      START'HPIB(P'DIT,SIOP(FIRSTBRANCH),FALSE);               <<f9010>>16160000
      DRIVER'STATE    := REQUEST'COMPLETE;                              16165000
      DIT'SUBSTATE    := NORMAL'IDLE;                          <<f9010>>16170000
      P'CPVA          := 0;                                    <<f9010>>16175000
                                                                        16180000
      RETURN;                                                           16185000
      END; << Of "if CPVA'ERRORCODE = DMA'ABORT OR ..." >>              16190000
$PAGE                                                                   16195000
   IF CPVA'STATUS = ONE THEN                                            16200000
      BEGIN                                                             16205000
                                                               <<09421>>16210000
      <<---------------------------------------------------->> <<09421>>16215000
      <<  Device status available, see what it has to say.  >> <<09421>>16220000
      <<---------------------------------------------------->> <<09421>>16225000
                                                               <<09421>>16230000
      CPVA'STATUS := ZERO;                                              16235000
                                                                        16240000
      IF NOT LOGICAL (DIT'NOT'RDY'EARLIER)   << Dvc WAS rdy >> <<09421>>16245000
         AND LOGICAL (DIT'DEV'NOT'RDY) THEN  << Not rdy now >> <<09421>>16250000
                                                               <<09421>>16255000
         << Device went off line.                           >> <<09421>>16260000
                                                               <<09421>>16265000
         IF NOT LOGICAL (DIT'LOCK'FLG) THEN                    <<09421>>16270000
            BEGIN   << Recognize off-line transition.       >> <<09421>>16275000
            DIT'PENDING'INTERRUPT := TRUE;                     <<09421>>16280000
            DIT'RELEASE'GRANTED := FALSE;                      <<09421>>16285000
            DIT'NOT'RDY'EARLIER := DIT'DEV'NOT'RDY;            <<09421>>16290000
            END;    << Recognize off-line transition.       >> <<09421>>16295000
      IF DIT'DEV'POWERFAIL = ONE THEN                                   16300000
         BEGIN                         << Clear the device          >>  16305000
         CP'FIRST'BRANCH    := ENTER'CHAN'CLEAR;               <<09421>>16310000
         START'HPIB(P'DIT,SIOP,TRUE);                                   16315000
                                                                        16320000
         DIT'IMMEDIATE'MODE := ONE;    << Immediate reporting will  >>  16325000
                                       << be enabled.               >>  16330000
                                                                        16335000
         DIT'SUBSTATE       := IDLE'REQ'WAIT;                           16340000
         DRIVER'STATE       := REQUEST'COMPLETE;                        16345000
                                                                        16350000
         RETURN;                                                        16355000
         END; << Of "if DIT'DEV'POWERFAIL = ONE..." >>                  16360000
                                                                        16365000
      IF DIT'INT'MAINT'REQ   = ONE OR                                   16370000
         DIT'I'OPR'REL'REQ   = ONE OR                                   16375000
         DIT'I'DIAG'REL'REQ  = ONE OR                                   16380000
         DIT'I'INT'MAINT'REQ = ONE THEN                                 16385000
                                                                        16390000
         BEGIN                         << Release/Release deny      >>  16395000
                                       << request                   >>  16400000
         CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                            16405000
         CP'DIAG'CDB'LENGTH  := TWO;                                    16410000
                                                                        16415000
         SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'SET'UNIT + CTRL'UNIT);       16420000
<<  If we do grant a Release below, then we will set >>                 16425000
<< DIT'RELEASE'CMD = 1.  This is so we know that we granted a >>        16430000
<< Release from the Initiator section of the Driver.  We will >>        16435000
<< later use this value to determine where in the Driver to >>          16440000
<< go to resubmit the Release command.  Also, if we do grant>>          16445000
<< Release, we will change the default value of CP'DIAG'DSJ'PON>>       16450000
<< to be 19 instead.  This way, when we get a QSTAT =2 for the >>       16455000
<< Release we will skip around the Power-On Channel Clear >>            16460000
<< part of the Channel Program .  >>                                    16465000
<<  If we Deny Release, we will set DIT'RELEASE'CMD = 0, so we>>        16470000
<< know there has not been a Release.  We will also reset the >>        16475000
<< default value of 2 to CP'DIAG'DSJ'PON.>>                             16480000
         IF LOGICAL (DIT'INT'MAINT'REQ)   OR                   <<09421>>16485000
            LOGICAL (DIT'I'INT'MAINT'REQ) OR                   <<09421>>16490000
            LOGICAL (DIT'I'DIAG'REL'REQ) OR                             16495000
            LOGICAL (DIT'I'OPR'REL'REQ)   AND                  <<09421>>16500000
              (    LOGICAL (DIT'DEV'NOT'RDY) OR                <<09421>>16505000
               NOT LOGICAL (DIT'LOCK'FLG))   THEN              <<09421>>16510000
            BEGIN   << O.K. to release, but remember it.    >> <<09421>>16515000
            SIOP'BYTE (CDB'AREA'BYTE + 1, CDB'RELEASE);        <<09421>>16520000
            DIT'RELEASE'CMD := 1;                                       16525000
            CP'DIAG'DSJ'PON := NINETEEN;                                16530000
            DIT'RELEASE'GRANTED := TRUE;                       <<09421>>16535000
            END     << O.K. to release, but remember it.    >> <<09421>>16540000
         ELSE                                                  <<09421>>16545000
            BEGIN   << Can't release, probably LOCKed.      >> <<09421>>16550000
            SIOP'BYTE (CDB'AREA'BYTE + 1, CDB'RELEASE'DENY);   <<09421>>16555000
            DIT'RELEASE'CMD := 0;                                       16560000
            CP'DIAG'DSJ'PON := TWO;                                     16565000
            IOMESSAGE (1, NSYS'DENY'MSG, %10000, DIT'LDEV,,,,, <<09421>>16570000
                       CONSOLE);                               <<09421>>16575000
            END;    << Can't release, probably LOCKed.      >> <<09421>>16580000
<<  This is where we will jump to if DIT'RELEASE'CMD = 1 >>             16585000
<<  in later code.  >>                                                  16590000
RETRY'RELEASE1:                                                         16595000
                                                                        16600000
         CP'FIRST'BRANCH := ENTER'DIAG;                                 16605000
         START'HPIB(P'DIT,SIOP,TRUE);                                   16610000
         DIT'SUBSTATE    := IDLE'REQ'WAIT;                              16615000
         DRIVER'STATE    := REQUEST'COMPLETE;                           16620000
                                                                        16625000
         RETURN;                                                        16630000
         END; << Of "if DIT'INT'MAINT'REQ = ONE..." >>                  16635000
                                                                        16640000
      IF DIT'MAINT'TRACK = ONE THEN                                     16645000
         BEGIN   << Error log area overflowed.              >> <<09421>>16650000
         MAINT'REQUEST(DIT'LDEV,TYPE'BUFFALO,LPDT'SUBTYPE);             16655000
                                                                        16660000
         IF PENDING'INTERRUPT THEN                             <<09421>>16665000
            BEGIN                                              <<09421>>16670000
            DIT'SUBSTATE := NORMAL'IDLE;                       <<09421>>16675000
            RETURN;                                            <<09421>>16680000
            END;                                               <<09421>>16685000
                                                               <<09421>>16690000
         CP'FIRST'BRANCH := ENTER'IDLE;                        <<09421>>16695000
         IF DIT'SUBSTATE = IDLE'REQ'WAIT THEN                  <<09421>>16700000
            IF LOGICAL (DIT'RELEASE'GRANTED) THEN              <<09421>>16705000
            BEGIN                                              <<09421>>16710000
            LOCATE'AND'WRITE'0;  << Req Stat to force DSJ 2 >> <<09421>>16715000
            DIT'RELEASE'GRANTED := FALSE;                      <<09421>>16720000
            END                                                <<09421>>16725000
         ELSE                                                  <<09421>>16730000
            DIT'SUBSTATE := NORMAL'IDLE;                       <<09421>>16735000
         START'HPIB(P'DIT,SIOP,FALSE);                                  16740000
         DIT'SUBSTATE    := IDLE'REQ'WAIT;                              16745000
         DRIVER'STATE    := REQUEST'COMPLETE;                           16750000
                                                                        16755000
         RETURN;                                                        16760000
         END;    << Error log area overflowed.              >> <<09421>>16765000
      END; << Of "if CPVA'STATUS = ONE..." >>                           16770000
$PAGE                                                                   16775000
   <<------------------------------------------------------->> <<09421>>16780000
   <<   Check for Power On or coming on line (same thing)   >> <<09421>>16785000
   <<------------------------------------------------------->> <<09421>>16790000
<<  If CPVA = 2 then we will have to check if the last >>               16795000
<< command we did was a Release.  If it was a Release and >>            16800000
<< we got a CPVA of 2 then we want to resubmit the Release >>           16805000
<< to the Merlin.  So, we check the value of DIT'RELEASE'CMD>>          16810000
<< to see where in the Driver the Release command originated.>>         16815000
<< If   =0  Then there was no Release command and we skip the>>         16820000
<<          IF block.                  >>                               16825000
<< If   =1  Then the cmd came from the Initiator section and>>          16830000
<<          we will goto Retry'Release1 there.          >>              16835000
<< If   =2  Then the cmd came from the continuator and   >>             16840000
<<          we will goto Retry'Release2 there.   >>                     16845000
<< If   =3  Then the cmd was a function code sent to us >>              16850000
<<          and we will goto Retry'Request.            >>               16855000
<< If DIT'RELEASE'CMD <>0, then there was a Release cmd.  >>            16860000
<< In that case, we want to see if only one has been sent>>             16865000
<< so we check DIT'RELEASE'COUNT. If =0 then only one Release>>         16870000
<< has been sent and we can send a second one.  If we do >>             16875000
<< enter the IF block to resend the Release, then this variable>>       16880000
<< will be changed to =1.  This is so we only send 2 release >>         16885000
<< commands at most.  If DIT'RELEASE'COUNT =1 then we would>>           16890000
<< skip around the IF block.   >>                                       16895000
<< After the IF block, the two variables DIT'RELEASE'CMD  >>            16900000
<< and DIT'RELEASE'COUNT are reset to =0.>>                             16905000
   IF CPVA'STATUS = FOUR OR     << Idle PON occurred.       >> <<09421>>16910000
      CPVA'STATUS = TWO  THEN   << PON in CHAN'CLEAR/DIAG.  >> <<09421>>16915000
      BEGIN                            << Do a device clear         >>  16920000
      IF DIT'IMMEDIATE'MODE = 1 AND                            <<J9456>>16925000
      DIT'LAST'WAS'WRITE = 1 THEN                              <<J9456>>16930000
      DIT'MUST'PF'NEXT := TRUE;                                <<J9456>>16935000
      IF CPVA'STATUS = TWO THEN                                         16940000
         IF DIT'RELEASE'CMD <> 0 THEN                                   16945000
            IF DIT'RELEASE'COUNT = 0 THEN                               16950000
               BEGIN                                                    16955000
               CPVA'STATUS := 0;                                        16960000
               DIT'RELEASE'COUNT := 1;                                  16965000
               IF DIT'RELEASE'CMD = 1 THEN                              16970000
                  GOTO RETRY'RELEASE1                                   16975000
                  ELSE IF DIT'RELEASE'CMD = 2 THEN                      16980000
                     GOTO RETRY'RELEASE2                                16985000
                     ELSE GOTO RETRY'REQUEST;                           16990000
              END;                                                      16995000
      DIT'RELEASE'CMD := 0;                                             17000000
      DIT'RELEASE'COUNT := 0;                                           17005000
      CPVA'STATUS        := ZERO;                                       17010000
      IF NOT LOGICAL (DIT'LOCK'FLG) THEN                       <<09421>>17015000
         BEGIN   << Came on line unlocked, set for AVR.     >> <<09421>>17020000
         DIT'PENDING'INTERRUPT := TRUE;                        <<09421>>17025000
         DIT'RELEASE'GRANTED := FALSE;                         <<09421>>17030000
         END;    << Came on line unlocked, set for AVR.     >> <<09421>>17035000
      DIT'NOT'RDY'EARLIER := FALSE;                            <<09421>>17040000
      CP'FIRST'BRANCH    := ENTER'CHAN'CLEAR;                  <<09421>>17045000
      START'HPIB(P'DIT,SIOP,TRUE);                                      17050000
                                                                        17055000
      DIT'IMMEDIATE'MODE := ONE;       << Immediate reporting will  >>  17060000
                                       << be enabled.               >>  17065000
      DIT'SUBSTATE       := IDLE'REQ'WAIT;                              17070000
      DRIVER'STATE       := REQUEST'COMPLETE;                           17075000
                                                                        17080000
      RETURN;                                                           17085000
      END; << Of "if CPVA'STATUS = FOUR ..." >>                         17090000
$PAGE                                                                   17095000
   <<------------------------------------------------------->> <<09421>>17100000
   <<   Check pending interrupt, past release, schedule     >> <<09421>>17105000
   <<   idle channel program if neither.                    >> <<09421>>17110000
   <<------------------------------------------------------->> <<09421>>17115000
                                                               <<09421>>17120000
   IF PENDING'INTERRUPT THEN                                   <<09421>>17125000
      BEGIN                                                    <<09421>>17130000
      DIT'SUBSTATE := NORMAL'IDLE;                             <<09421>>17135000
      RETURN;                                                  <<09421>>17140000
      END;                                                     <<09421>>17145000
   CPVA'STATUS := ZERO;                                        <<09421>>17150000
   CP'FIRST'BRANCH := ENTER'IDLE;                              <<09421>>17155000
   IF DIT'SUBSTATE = IDLE'REQ'WAIT THEN                        <<09421>>17160000
      IF LOGICAL (DIT'RELEASE'GRANTED) THEN                    <<09421>>17165000
      BEGIN                                                    <<09421>>17170000
      LOCATE'AND'WRITE'0;   << Req Stat to force any DSJ 2. >> <<09421>>17175000
      DIT'RELEASE'GRANTED := FALSE;                            <<09421>>17180000
      END                                                      <<09421>>17185000
   ELSE                                                        <<09421>>17190000
      DIT'SUBSTATE := NORMAL'IDLE;                             <<09421>>17195000
   START'HPIB(P'DIT,SIOP,FALSE);                                        17200000
   DRIVER'STATE    := REQUEST'COMPLETE;                                 17205000
                                                                        17210000
   RETURN;                                                              17215000
   END; << Of "if IOQ'ENTRY'INDEX = ZERO ..." >>                        17220000
$PAGE                                                                   17225000
<<---------------------------------------------------->>                17230000
<<   Idle request currently being serviced, defer     >>                17235000
<<   current request until idle request completed     >>                17240000
<<---------------------------------------------------->>                17245000
                                                                        17250000
IF DRIVER'STATE = INITIATOR'STATE AND                                   17255000
   DIT'SUBSTATE = IDLE'REQ'WAIT THEN                                    17260000
   BEGIN                                                                17265000
   IOQ'WAITCODE := IOQ'DEFER'WAIT;                                      17270000
   DRIVER'STATE := INTERRUPT'WAIT;                                      17275000
                                                                        17280000
   RETURN;                                                              17285000
   END; << Of "if DRIVER'STATE = INITIATOR'STATE ..." >>                17290000
$PAGE                                                                   17295000
<<---------------------------------------------------->>                17300000
<<   Convert the transfer count to bytes.             >>                17305000
<<---------------------------------------------------->>                17310000
                                                                        17315000
IF INTEGER(IOQ'COUNT) < ZERO THEN                                       17320000
   TRANSFER'COUNT := - DOUBLE(INTEGER(IOQ'COUNT))              <<09575>>17325000
ELSE                                                                    17330000
   TRANSFER'COUNT := DOUBLE(IOQ'COUNT) * 2D;                            17335000
$PAGE                                                                   17340000
<<---------------------------------------------------->>                17345000
<<   Map from external to internal function code      >>                17350000
<<                                                    >>                17355000
<<   Function code 0 -4  --> Internal code 0 -4       >>                17360000
<<   Function code 5     --> Internal code 1          >>                17365000
<<   Function code 6     --> Internal code 1          >>                17370000
<<   Function code 7 -9  --> Internal code 5 -7       >>                17375000
<<   Function code 11    --> Internal code 1          >>                17380000
<<   Function code 13-18 --> Internal code 8 -13      >>                17385000
<<   Function code 29    --> Internal code 14         >>                17390000
<<   Function code 72-73 --> Internal code 15-16      >>                17395000
<<   Function code 74    --> Internal code 5          >>                17400000
<<   Function code 75-76 --> Internal code 17-18      >>                17405000
<<   Function code 78    --> Internal code 8          >>       <<f9442>>17410000
<<   Function code 79-82 --> Internal code 19-22      >>                17415000
<<   Function code 88    --> Internal code 23         >>                17420000
<<   Function code 91-94 --> Internal code 24-27      >>                17425000
<<   Function code 95    --> Internal code 5          >>                17430000
<<   Function code 100   --> Internal code 28         >>                17435000
<<   Function code 101   --> Internal code 25         >>                17440000
<<---------------------------------------------------->>                17445000
                                                                        17450000
FCODE := IOQ'FUNC'TO'FCODE(IOQ'FUNC);                          <<09421>>17455000
IF FCODE = UNDEFINED'IOQ'FUNC THEN                             <<09421>>17460000
   BEGIN                                                       <<09421>>17465000
   IOQ'STAT     := INVALID'REQUEST;                                     17470000
   IOQ'COUNT    := ZERO;                                                17475000
   DRIVER'STATE := REQUEST'COMPLETE;                                    17480000
                                                                        17485000
   RETURN;                                                              17490000
   END;                                                        <<09421>>17495000
$PAGE                                                                   17500000
<<---------------------------------------------------->>                17505000
<<   IOQ deferred request completion - redo request   >>                17510000
<<---------------------------------------------------->>                17515000
                                                                        17520000
IF IOQ'WAITCODE = IOQ'DEFER'WAIT THEN                                   17525000
   BEGIN                                                                17530000
   DIT'SUBSTATE := ZERO;               << Reset substate            >>  17535000
   IF DIT'MAINT'TRACK = ONE THEN                                        17540000
      MAINT'REQUEST(DIT'LDEV,TYPE'BUFFALO,LPDT'SUBTYPE);                17545000
   GOTO RETRY'REQUEST;                                                  17550000
   END; << Of "if IOQ'WAITCODE = IOQ'DEFER'WAIT..." >>                  17555000
                                                                        17560000
<<---------------------------------------------------->>                17565000
<<   Not ready completion - Go to completor section   >>                17570000
<<---------------------------------------------------->>                17575000
                                                                        17580000
IF IOQ'WAITCODE = NOT'RDY'WAIT THEN                                     17585000
   GOTO CONTINUATOR;                                                    17590000
                                                                        17595000
$PAGE                                                                   17600000
<<---------------------------------------------------->>                17605000
<<   Initiator call - initialize or reset variables   >>                17610000
<<                    possibly changed in last req.   >>                17615000
<<                  - case to a driver function code  >>                17620000
<<---------------------------------------------------->>                17625000
                                                                        17630000
IF (DRIVER'STATE   = INITIATOR'STATE) LOR                               17635000
                                       << More data to process for  >>  17640000
                                       << the read function.        >>  17645000
   ((CPVA'STATUS   = ZERO)                 LAND                         17650000
   (TRANSFER'COUNT > DIT'TRANSFERED'COUNT) LAND                         17655000
   (FCODE          = FC'READ))        LOR                               17660000
                                       << More data to process for  >>  17665000
                                       << the write function.       >>  17670000
   ((CPVA'STATUS   = ZERO)                 LAND                         17675000
   (TRANSFER'COUNT > DIT'TRANSFERED'COUNT) LAND                         17680000
   (FCODE          = FC'WRITE))       THEN                              17685000
                                                                        17690000
   BEGIN                                                                17695000
                                                               <<f9546>>17700000
     IF IOQ'UNLOAD'RING <> 0 THEN                              <<f9546>>17705000
        BEGIN                                                  <<f9546>>17710000
        IOQ'UNLOAD'RING := 0;                                  <<f9546>>17715000
        DIT'TRANSFERED'COUNT := 0D;                            <<f9546>>17720000
        END;                                                   <<f9546>>17725000
                                                                        17730000
     if aborting then return;                                  <<J9195>>17735000
     IF FCODE = FC'WRITE THEN DIT'LAST'WAS'WRITE := TRUE       <<J9456>>17740000
     ELSE DIT'LAST'WAS'WRITE := FALSE;                         <<J9456>>17745000
                                       << Perform only on a retry.  >>  17750000
   IF HELL'FROZE'OVER THEN                                              17755000
      BEGIN                                                             17760000
RETRY'REQUEST:                                                          17765000
                                                                        17770000
                                       << Do the whole read/write   >>  17775000
                                       << process over again.       >>  17780000
      IF FCODE = FC'READ  OR                                            17785000
         FCODE = FC'WRITE THEN                                          17790000
                                                                        17795000
         DIT'TRANSFERED'COUNT := 0D;                                    17800000
                                                                        17805000
      END; << Of "if HELL'FROZE'OVER ..." >>                            17810000
     IF DIT'MUST'PF'NEXT = 1 THEN                              <<J9456>>17815000
     BEGIN                                                     <<J9456>>17820000
       DIT'MUST'PF'NEXT := FALSE;                              <<J9456>>17825000
       IOQ'STAT         := POWERFAIL'ABORT;                    <<J9456>>17830000
       DRIVER'STATE     := REQUEST'COMPLETE;                   <<J9456>>17835000
       RETURN;                                                 <<J9456>>17840000
     END;                                                      <<J9456>>17845000
                                                                        17850000
$PAGE                                                                   17855000
CASE FCODE OF                                                           17860000
   BEGIN << Of "case FCODE..." >>                                       17865000
                                                                        17870000
<<--------------------------------------------------------->>           17875000
<<                                                         >>           17880000
<<    CODE   Function                    Internal FCODE    >>           17885000
<<    ----   --------                    --------------    >>           17890000
<<                                                         >>           17895000
<<      0    Read                              0           >>           17900000
<<      1    Write                             1           >>           17905000
<<      2    File open                         2           >>           17910000
<<      3    File close                        3           >>           17915000
<<      4    Device close                      4           >>           17920000
<<      5    Fill with zero                    1           >>           17925000
<<      6    File with blanks                  1           >>           17930000
<<      7    Request last status               5           >>           17935000
<<      8    Initialize media                  6           >>           17940000
<<      9    Unload                            7           >>           17945000
<<     11    Write disc label                  1           >>           17950000
<<     13    Request volume limit              8           >>           17955000
<<     14    Locate and verify                 9           >>           17960000
<<     15    Request generic status           10           >>           17965000
<<     16    Lock                             11           >>           17970000
<<     17    Unlock                           12           >>           17975000
<<     18    Read lock bit                    13           >>           17980000
<<     29    Immediate mode                   14           >>           17985000
<<     72    Identify                         15           >>           17990000
<<     73    Initiate diagnostic selftest     16           >>           17995000
<<     74    Selftest result                   5           >>           18000000
<<     75    Loopback write                   17           >>           18005000
<<     76    Loopback read                    18           >>           18010000
<<     78    Describe                          8           >>  <<f9442>>18015000
<<     79    Release                          19           >>           18020000
<<     80    Release denied                   20           >>           18025000
<<     81    Set release                      21           >>           18030000
<<     82    Set address                      22           >>           18035000
<<     88    Spare block                      23           >>           18040000
<<     91    Initiate utility                 24           >>           18045000
<<     92    Device clear                     25           >>           18050000
<<     93    Cancel transaction               26           >>           18055000
<<     94    Parity checking                  27           >>           18060000
<<     95    Last status request               5           >>           18065000
<<    100    Generic diagnostic request       28           >>           18070000
<<    101    Channel independent clear        25           >>           18075000
<<                                                         >>           18080000
<<--------------------------------------------------------->>           18085000
$PAGE                                                                   18090000
<<---------------------------------------------------->>                18095000
<<                                                    >>                18100000
<<   Read [function code = 0]                         >>                18105000
<<                                                    >>                18110000
<<   TRANSFER'COUNT - transfer count                  >>                18115000
<<   BANK & BUFFADDR - contains data read             >>                18120000
<<   P1 - high order dbl word logical sector address  >>                18125000
<<   P2 - low order dbl word logical sector address   >>                18130000
<<                                                    >>                18135000
<<---------------------------------------------------->>                18140000
                                                                        18145000
   BEGIN << Of case 0 >>                                                18150000
                                                                        18155000
   CP'DXFER'WRITE'READ  := WRT'CMD'SEC;                                 18160000
   CP'DXFER'WAIT'5      := WAIT'INSTR;                                  18165000
   CP'DXFER'WAIT'6      := ZERO;                                        18170000
   CP'DXFER'12'WAIT     := WAIT'INSTR;                                  18175000
   CP'DXFER'13'WAIT     := ZERO;                                        18180000
   CP'DXFER'CMD'TO'EXEC := READ'EXEC'SEC;                               18185000
                                                                        18190000
   <<---------------------------------------------------->>             18195000
   << On the first read operation, set the address of    >>             18200000
   << where to read the data from on the tape, and the   >>             18205000
   << unit number.                                       >>             18210000
   <<---------------------------------------------------->>             18215000
                                                                        18220000
   IF DIT'TRANSFERED'COUNT = 0D THEN                                    18225000
      BEGIN                            << first read operation      >>  18230000
      SETDB'SIOP;                                                       18235000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 0 ) := CDB'SET'UNIT;             18240000
                                                                        18245000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 1 ) := CDB'SET'SNGL'VEC;         18250000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 2 ) := ZERO;                     18255000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 3 ) := ZERO;                     18260000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 4 ) := IOQ'PARM1.(0:8);          18265000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 5 ) := IOQ'PARM1.(8:8);          18270000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 6 ) := IOQ'PARM2.(0:8);          18275000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 7 ) := IOQ'PARM2.(8:8);          18280000
                                                                        18285000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 15) := CDB'READ;                 18290000
      SETDB'SYS;                                                        18295000
      I := 8;                                                           18300000
                                                                        18305000
      CP'DXFER'CDB'LENGTH  := 16;      << CDB byte count            >>  18310000
      CP'DXFER'DATA'TYPE   := ZERO;                                     18315000
      CP'DXFER'DATA'BANK   := BANK;    << data bank                 >>  18320000
      CP'DXFER'DATA'OFFSET := BUFFADDR; << data buffer abs adr      >>  18325000
      END << Of 'if DIT'TRANSFERED'COUNT = 0D ...' >>                   18330000
   ELSE                                                                 18335000
      BEGIN                                                             18340000
      SETDB'SIOP;                                                       18345000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 7 ) := CDB'READ;                 18350000
      SETDB'SYS;                                                        18355000
      I := 0;                                                           18360000
      CP'DXFER'CDB'LENGTH  := 8;       << CDB byte count            >>  18365000
      END; << Of else "if DIT'TRANSFERED'COUNT = 0D ..." >>             18370000
                                                                        18375000
   <<---------------------------------------------------->>             18380000
   << Set auto jump sparing method, and set              >>             18385000
   << immediate report mode.                             >>             18390000
   <<---------------------------------------------------->>             18395000
                                                                        18400000
   SIOP'BYTE(CDB'AREA'BYTE + I + 0 , CDB'SET'OPTIONS);                  18405000
   PARM := CDB'JUMP'SPARE;                                              18410000
                                                                        18415000
   IF DIT'IMMEDIATE'MODE = ONE THEN                                     18420000
      PARM.(12:1) := ONE;                                               18425000
   SIOP'BYTE(CDB'AREA'BYTE + I + 1 , PARM);                             18430000
                                                                        18435000
   <<---------------------------------------------------->>             18440000
   << Determine the amount of data to read.  Maximum read>>             18445000
   << at a time is 6K bytes.                             >>             18450000
   <<---------------------------------------------------->>             18455000
                                                                        18460000
   BYTES'LEFT := TRANSFER'COUNT - DIT'TRANSFERED'COUNT;                 18465000
   IF BYTES'LEFT < DOUBLE(SIX'K'BYTES) THEN                             18470000
      BEGIN                                                             18475000
      SETDB'SIOP;                                                       18480000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 2) := CDB'SET'LENGTH;        18485000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 3) := ZERO;                  18490000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 4) := ZERO;                  18495000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 5) := L'BYTES'LEFT.(0:8);    18500000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 6) := L'BYTES'LEFT.(8:8);    18505000
      SETDB'SYS;                                                        18510000
                                                                        18515000
      IF BYTES'LEFT = 0D THEN          << No data to read           >>  18520000
         BEGIN                                                          18525000
         CP'DXFER'WAIT'5      := ZERO; << Bypass exec msg           >>  18530000
         CP'DXFER'WAIT'6      := 5;    << Jump *+5                  >>  18535000
         END << Of "if BYTES'LEFT = 0D..." >>                           18540000
                                                                        18545000
      ELSE                                                              18550000
         BEGIN                                                          18555000
         CP'DXFER'DATA'SIZE := L'BYTES'LEFT; << Set up read count   >>  18560000
         END; << Else of "if BYTES'LEFT = 0D..." >>                     18565000
      DIT'TRANSFERED'COUNT := TRANSFER'COUNT;                           18570000
      END << Of "if BYTES'LEFT < DOUBLE(SIX'K'BYTES) ..." >>            18575000
   ELSE                                                                 18580000
      BEGIN                                                             18585000
      SETDB'SIOP;                                                       18590000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 2) := CDB'SET'LENGTH;        18595000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 3) := ZERO;                  18600000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 4) := ZERO;                  18605000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 5) := SIX'K'BYTES.(0:8);     18610000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 6) := SIX'K'BYTES.(8:8);     18615000
      SETDB'SYS;                                                        18620000
                                                                        18625000
      CP'DXFER'DATA'SIZE   := SIX'K'BYTES; << Set up read count     >>  18630000
      DIT'TRANSFERED'COUNT := DIT'TRANSFERED'COUNT +                    18635000
                              DOUBLE(SIX'K'BYTES);                      18640000
      END; << Of else "if BYTES'LEFT < DOUBLE(SIX'K'BYTES) ..." >>      18645000
                                                                        18650000
   CP'FIRST'BRANCH := ENTER'DATA'XFER;                                  18655000
                                                                        18660000
   END; << Of case 0 >>                                                 18665000
$PAGE                                                                   18670000
<<---------------------------------------------------->>                18675000
<<                                                    >>                18680000
<<   Write [function code = 1] and                    >>                18685000
<<   Fill with zeros [function code = 5] and          >>                18690000
<<   Fill with blanks [function code = 6] and         >>                18695000
<<   Write disc label [function code = 11]            >>                18700000
<<                                                    >>                18705000
<<   TRANSFER'COUNT - transfer count                  >>                18710000
<<   BANK & BUFFADDR - contains data for write        >>                18715000
<<   P1 - high order dbl word logical sector address  >>                18720000
<<   P2 - low order dbl word logical sector address   >>                18725000
<<                                                    >>                18730000
<<---------------------------------------------------->>                18735000
                                                                        18740000
   BEGIN << Of case 1 >>                                                18745000
                                                                        18750000
                                       << Transfer count should not >>  18755000
                                       << be zero for Fill with zero>>  18760000
                                       << Fill with space, or       >>  18765000
                                       << Write disc label.         >>  18770000
   IF (IOQ'FUNC       = 5 OR                                            18775000
       IOQ'FUNC       = 6 OR                                            18780000
       IOQ'FUNC       = 11) AND                                         18785000
      TRANSFER'COUNT  = 0D  THEN                                        18790000
      BEGIN                            << Exit with invalid func.   >>  18795000
      IOQ'STAT      := INVALID'REQUEST;                                 18800000
      IOQ'COUNT     := ZERO;                                            18805000
      DRIVER'STATE  := REQUEST'COMPLETE;                                18810000
      RETURN;                                                           18815000
      END; << Of "if IOQ'FUNC = 5 ..." >>                               18820000
                                                                        18825000
   CP'DXFER'WRITE'READ  := WRT'CMD'SEC;                                 18830000
   CP'DXFER'WAIT'5      := WAIT'INSTR;                                  18835000
   CP'DXFER'WAIT'6      := ZERO;                                        18840000
   CP'DXFER'12'WAIT     := WAIT'INSTR;                                  18845000
   CP'DXFER'13'WAIT     := ZERO;                                        18850000
   CP'DXFER'CMD'TO'EXEC := WRT'EXEC'SEC;                                18855000
                                                                        18860000
   <<---------------------------------------------------->>             18865000
   << On the first write operation, set the address of   >>             18870000
   << where to write the data on the tape, and the unit  >>             18875000
   << number.                                            >>             18880000
   <<---------------------------------------------------->>             18885000
                                                                        18890000
   IF DIT'TRANSFERED'COUNT = 0D THEN                                    18895000
      BEGIN                            << first write operation     >>  18900000
      SETDB'SIOP;                                                       18905000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 0 )  := CDB'SET'UNIT;            18910000
                                                                        18915000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 1 )  := CDB'SET'SNGL'VEC;        18920000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 2 )  := ZERO;                    18925000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 3 )  := ZERO;                    18930000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 4 )  := IOQ'PARM1.(1:8);         18935000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 5 )  := IOQ'PARM1.(8:8);         18940000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 6 )  := IOQ'PARM2.(0:8);         18945000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 7 )  := IOQ'PARM2.(8:8);         18950000
                                                                        18955000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 15)  := CDB'WRITE;               18960000
      SETDB'SYS;                                                        18965000
      I := 8;                                                           18970000
                                                                        18975000
      CP'DXFER'CDB'LENGTH  := 16;      << CDB byte count            >>  18980000
                                       << For the write function    >>  18985000
                                       << send out the user's data  >>  18990000
                                       << else send zeros or spaces >>  18995000
      IF IOQ'FUNC = ONE OR                                              19000000
         IOQ'FUNC = 11  THEN                                            19005000
         BEGIN                                                          19010000
         CP'DXFER'DATA'TYPE   := ZERO;                                  19015000
         CP'DXFER'DATA'BANK   := BANK; << Data bank                 >>  19020000
         CP'DXFER'DATA'OFFSET := BUFFADDR; << Data buffer abs adr   >>  19025000
         END << Of "if IOQ'FUNC = ONE ..." >>                           19030000
      ELSE                                                              19035000
         BEGIN                                                          19040000
         CP'DXFER'DATA'TYPE   := ZERO;                                  19045000
         CP'DXFER'DONT'C'ADDR := ONE;   << Wrt from single addr     >>  19050000
         CP'DXFER'DATA'BANK   := ZERO;                                  19055000
         CP'DXFER'DATA'OFFSET := @SIOP + SYSDB + FILL'WRD;              19060000
         CP'FILL'WORD         := IF IOQ'FUNC = 5 THEN                   19065000
                                    ZERO << Fill word of zeros      >>  19070000
                                 ELSE                                   19075000
                                    BLANKS; << Fill word of blanks  >>  19080000
         END; << Of else "if IOQ'FUNC = ONE ..." >>                     19085000
      END << Of "if DIT'TRANSFERED'COUNT = 0D ..." >>                   19090000
   ELSE                                                                 19095000
      BEGIN                                                             19100000
      SETDB'SIOP;                                                       19105000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 7 )  := CDB'WRITE;               19110000
      SETDB'SYS;                                                        19115000
      I := 0;                                                           19120000
      CP'DXFER'CDB'LENGTH  :=  8;      << CDB byte count            >>  19125000
      END; << Of else "if DIT'TRANSFERED'COUNT = 0D ..." >>             19130000
                                                                        19135000
   <<---------------------------------------------------->>             19140000
   << Set the sparing method given by the user, and set  >>             19145000
   << immediate report mode.                             >>             19150000
   <<---------------------------------------------------->>             19155000
                                                                        19160000
   SIOP'BYTE(CDB'AREA'BYTE + I + 0 , CDB'SET'OPTIONS);                  19165000
   PARM := ZERO;                                                        19170000
   IF IOQ'PARM1.(0:1) = ONE THEN                                        19175000
      PARM.(13:3) := CDB'SKIP'SPARE                                     19180000
   ELSE                                                                 19185000
      PARM.(13:3) := CDB'JUMP'SPARE;                                    19190000
                                                                        19195000
   IF DIT'IMMEDIATE'MODE = ONE THEN                                     19200000
      PARM.(12:1) := ONE;                                               19205000
   SIOP'BYTE(CDB'AREA'BYTE + I + 1 , PARM);                             19210000
                                                                        19215000
   <<---------------------------------------------------->>             19220000
   << Determine the amount of data to write.  Maximum on >>             19225000
   << a single write operation is 6K bytes.              >>             19230000
   <<---------------------------------------------------->>             19235000
                                                                        19240000
   BYTES'LEFT := TRANSFER'COUNT - DIT'TRANSFERED'COUNT;                 19245000
   IF BYTES'LEFT < DOUBLE(SIX'K'BYTES) THEN                             19250000
      BEGIN                                                             19255000
      SETDB'SIOP;                                                       19260000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 2) := CDB'SET'LENGTH;        19265000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 3) := ZERO;                  19270000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 4) := ZERO;                  19275000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 5) := L'BYTES'LEFT.(0:8);    19280000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 6) := L'BYTES'LEFT.(8:8);    19285000
      SETDB'SYS;                                                        19290000
                                                                        19295000
      IF BYTES'LEFT = 0D THEN          << No data to write          >>  19300000
         BEGIN                                                          19305000
         CP'DXFER'WAIT'5      := ZERO; << Bypass exec msg           >>  19310000
         CP'DXFER'WAIT'6      := 5;    << Jump *+5                  >>  19315000
         END << Of "if BYTES'LEFT = 0D..." >>                           19320000
      ELSE                                                              19325000
         BEGIN                                                          19330000
         CP'DXFER'DATA'SIZE := L'BYTES'LEFT; << Set up write count  >>  19335000
         END; << Of else "if BYTES'LEFT = 0D ..." >>                    19340000
                                                                        19345000
      DIT'TRANSFERED'COUNT := TRANSFER'COUNT;                           19350000
      END << Of "if BYTES'LEFT < DOUBLE(SIX'K'BYTES) ..." >>            19355000
   ELSE                                                                 19360000
      BEGIN                                                             19365000
      SETDB'SIOP;                                                       19370000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 2) := CDB'SET'LENGTH;        19375000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 3) := ZERO;                  19380000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 4) := ZERO;                  19385000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 5) := SIX'K'BYTES.(0:8);     19390000
      SIODB'BYTE'ARRAY(CDB'AREA'BYTE + I + 6) := SIX'K'BYTES.(8:8);     19395000
      SETDB'SYS;                                                        19400000
                                                                        19405000
      CP'DXFER'DATA'SIZE   := SIX'K'BYTES; << Set up write count    >>  19410000
      DIT'TRANSFERED'COUNT := DIT'TRANSFERED'COUNT +                    19415000
                              DOUBLE(SIX'K'BYTES);                      19420000
      END; << Of else "if BYTES'LEFT < DOUBLE(SIX'K'BYTES) ..." >>      19425000
                                                                        19430000
   CP'FIRST'BRANCH := ENTER'DATA'XFER;                                  19435000
                                                                        19440000
   END; << Of case 1 >>                                                 19445000
$PAGE                                                                   19450000
<<---------------------------------------------------->>                19455000
<<                                                    >>                19460000
<<   File open [function code = 2]                    >>                19465000
<<                                                    >>                19470000
<<---------------------------------------------------->>                19475000
                                                                        19480000
                                                                        19485000
   BEGIN << Of case 2 >>                                                19490000
                                       << Exit with a good transfer >>  19495000
   IOQ'STAT      := GOOD'IO;                                            19500000
   IOQ'COUNT     := ZERO;                                               19505000
   DRIVER'STATE  := REQUEST'COMPLETE;                                   19510000
                                                                        19515000
   RETURN;                                                              19520000
   END; << Of case 2 >>                                                 19525000
$PAGE                                                                   19530000
<<---------------------------------------------------->>                19535000
<<                                                    >>                19540000
<<   File close [function code = 3]                   >>                19545000
<<                                                    >>                19550000
<<---------------------------------------------------->>                19555000
                                                                        19560000
                                                                        19565000
   BEGIN << Of case 3 >>                                                19570000
                                       << Exit with a good transfer >>  19575000
   IOQ'STAT      := GOOD'IO;                                            19580000
   IOQ'COUNT     := ZERO;                                               19585000
   DRIVER'STATE  := REQUEST'COMPLETE;                                   19590000
                                                                        19595000
   RETURN;                                                              19600000
   END; << Of case 3 >>                                                 19605000
$PAGE                                                                   19610000
<<---------------------------------------------------->>                19615000
<<                                                    >>                19620000
<<   Device close [function code = 4]                 >>                19625000
<<                                                    >>                19630000
<<   Immediate report mode default.                   >>                19635000
<<                                                    >>                19640000
<<---------------------------------------------------->>                19645000
                                                                        19650000
                                                                        19655000
   BEGIN << Of case 4 >>                                                19660000
                                                                        19665000
   DIT'IMMEDIATE'MODE := ONE;          << Enable immediate reporting>>  19670000
                                                                        19675000
   IOQ'STAT           := GOOD'IO;      << Exit with a good transfer >>  19680000
   IOQ'COUNT          := ZERO;                                          19685000
   DRIVER'STATE       := REQUEST'COMPLETE;                              19690000
                                                                        19695000
   RETURN;                                                              19700000
   END; << Of case 4 >>                                                 19705000
$PAGE                                                                   19710000
<<---------------------------------------------------->>                19715000
<<                                                    >>                19720000
<<   Request status [function code = 7] and           >>                19725000
<<   Selftest result [function code = 74] and         >>                19730000
<<   Request last status [function code = 95]         >>                19735000
<<                                                    >>                19740000
<<   TRANSFER'COUNT - status length (max 20 bytes)    >>                19745000
<<   BANK & BUFFADDR - return the status              >>                19750000
<<                                                    >>                19755000
<<---------------------------------------------------->>                19760000
                                                                        19765000
   BEGIN << Of case 5 >>                                                19770000
                                                                        19775000
   IF TRANSFER'COUNT = 0D THEN                                          19780000
      BEGIN                            << Exit with invalid func.   >>  19785000
      IOQ'STAT      := INVALID'REQUEST;                                 19790000
      IOQ'COUNT     := ZERO;                                            19795000
      DRIVER'STATE  := REQUEST'COMPLETE;                                19800000
                                                                        19805000
      RETURN;                                                           19810000
      END;                                                              19815000
                                                                        19820000
                                       << Max 10 wrds               >>  19825000
   IF TRANSFER'COUNT > DOUBLE(DEV'STAT'WORD'SIZE) THEN                  19830000
      IOQ'COUNT        := DEV'STAT'WORD'SIZE;                           19835000
                                                                        19840000
   LOCATE'AND'WRITE'0;   << Sets up CP to force stat req.   >> <<09421>>19845000
                                                                        19850000
   END; << Of case 5 >>                                                 19855000
$PAGE                                                                   19860000
<<---------------------------------------------------->>                19865000
<<                                                    >>                19870000
<<   Initialize media [function code = 8]             >>                19875000
<<                                                    >>                19880000
<<   P1 - 00000CWZ                                    >>                19885000
<<      C = 1 - Run certification utility on tape     >>                19890000
<<      W = 1 - Every 512 block is allocated as spare >>                19895000
<<      Z = 1 - Reset sparing table to initial spares >>                19900000
<<                 as defined by W bit.               >>                19905000
<<   P2 - Block interleave byte (binary number)       >>                19910000
<<                                                    >>                19915000
<<---------------------------------------------------->>                19920000
                                                                        19925000
   BEGIN << Of case 6 >>                                                19930000
                                                                        19935000
   IF NOT (ZERO <= INTEGER(IOQ'PARM1) <= FOUR) THEN                     19940000
      BEGIN                            << Exit with invalid func.   >>  19945000
      IOQ'STAT      := INVALID'REQUEST;                                 19950000
      IOQ'COUNT     := ZERO;                                            19955000
      DRIVER'STATE  := REQUEST'COMPLETE;                                19960000
                                                                        19965000
      RETURN;                                                           19970000
      END;                                                              19975000
                                                                        19980000
   CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                                  19985000
   CP'DIAG'CDB'LENGTH  := FOUR;                                         19990000
   CP'DIAG'DSJ'PON := TWO;                                              19995000
                                                                        20000000
   SETDB'SIOP;                                                          20005000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 0 ) := CDB'SET'UNIT;                20010000
                                                                        20015000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 1 ) := CDB'INIT'MEDIA;              20020000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 2 ) := IOQ'PARM1.(8:8);             20025000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 3 ) := IOQ'PARM2.(8:8);             20030000
   SETDB'SYS;                                                           20035000
                                                                        20040000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       20045000
                                                                        20050000
   END; << Of case 6 >>                                                 20055000
$PAGE                                                                   20060000
<<---------------------------------------------------->>                20065000
<<                                                    >>                20070000
<<       Unload [function code = 9]                   >>                20075000
<<                                                    >>                20080000
<<---------------------------------------------------->>                20085000
                                                                        20090000
   BEGIN << Of case 7 >>                                                20095000
                                                                        20100000
   CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                                  20105000
   CP'DIAG'CDB'LENGTH  := 2;                                            20110000
                                                                        20115000
   SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'SET'UNIT);                         20120000
   CP'DIAG'DSJ'PON := TWO;                                              20125000
   SIOP'BYTE(CDB'AREA'BYTE + 1 , CDB'UNLOAD);                           20130000
                                                                        20135000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       20140000
                                                                        20145000
   END; << Of case 7 >>                                                 20150000
$PAGE                                                                   20155000
<<---------------------------------------------------->>                20160000
<<                                                    >>                20165000
<<   Request volume limit [function code = 13] and    >>       <<f9442>>20170000
<<   Describe             [function code = 78]        >>       <<f9442>>20175000
<<                                                    >>                20180000
<<   BANK & BUFFADDR - Returns a dbl wrd address of   >>                20185000
<<                     the maximum volume limit and   >>       <<f9442>>20190000
<<                     the describe bytes.            >>       <<f9442>>20195000
<<                                                    >>                20200000
<<---------------------------------------------------->>                20205000
                                                                        20210000
   BEGIN << Of case 8 >>                                                20215000
                                                               <<f9442>>20220000
   IF TRANSFER'COUNT = 0D THEN                                 <<f9442>>20225000
      BEGIN                    << Exit with invalid function >><<f9442>>20230000
      IOQ'STAT       := INVALID'REQUEST;                       <<f9442>>20235000
      IOQ'COUNT      := ZERO;                                  <<f9442>>20240000
      DRIVER'STATE   := REQUEST'COMPLETE;                      <<f9442>>20245000
                                                                        20250000
      RETURN;                                                  <<f9442>>20255000
      END;                                                     <<f9442>>20260000
                                                               <<f9442>>20265000
   CP'DIAG'CMD'TO'EXEC  := WRT'CMD'SEC;                                 20270000
   CP'DXFER'CDB'LENGTH  := TWO;        << CDB byte count            >>  20275000
   CP'DXFER'WAIT'5      := WAIT'INSTR;                                  20280000
   CP'DXFER'WAIT'6      := ZERO;                                        20285000
   CP'DXFER'12'WAIT     := WAIT'INSTR;                                  20290000
   CP'DXFER'13'WAIT     := ZERO;                                        20295000
   CP'DXFER'CMD'TO'EXEC := READ'EXEC'SEC;                               20300000
   CP'DXFER'DATA'SIZE   := MAX'DESC'BYTE; << Max# DESC bytes        >>  20305000
   CP'DXFER'DATA'TYPE   := ZERO;                                        20310000
   CP'DXFER'DATA'BANK   := ZERO;       << Describe area             >>  20315000
   CP'DXFER'DATA'OFFSET := @SIOP + SYSDB + DESC'AREA;                   20320000
                                                                        20325000
   SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'SET'UNIT);                         20330000
   SIOP'BYTE(CDB'AREA'BYTE + 1 , CDB'DESCRIBE);                         20335000
                                                                        20340000
   CP'FIRST'BRANCH     := ENTER'DATA'XFER;                              20345000
                                                                        20350000
   END; << Of case 8 >>                                                 20355000
$PAGE                                                                   20360000
<<---------------------------------------------------->>                20365000
<<                                                    >>                20370000
<<   Locate and verify [function code = 14]           >>                20375000
<<                                                    >>                20380000
<<   BANK & BUFFADDR - Entry   a dbl wrd address of   >>                20385000
<<                     verify length                  >>                20390000
<<   BANK & BUFFADDR - Returns a dbl wrd address of   >>                20395000
<<                     1st bad sector encountered     >>                20400000
<<   P1 - high order dbl word logical sector address  >>                20405000
<<   P2 - low order dbl word logical sector address   >>                20410000
<<                                                    >>                20415000
<<---------------------------------------------------->>                20420000
                                                                        20425000
   BEGIN << Of case 9 >>                                                20430000
                                                                        20435000
   SETDB'SIOP;                                                          20440000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 0)  := CDB'SET'UNIT;                20445000
                                                                        20450000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 1)  := CDB'SET'SNGL'VEC;            20455000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 2)  := ZERO;                        20460000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 3)  := ZERO;                        20465000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 4)  := IOQ'PARM1.(0:8);             20470000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 5)  := IOQ'PARM1.(8:8);             20475000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 6)  := IOQ'PARM2.(0:8);             20480000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 7)  := IOQ'PARM2.(8:8);             20485000
                                                                        20490000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 8)  := CDB'SET'LENGTH;              20495000
   SETDB'SYS;                                                           20500000
                                                                        20505000
   TOS     := BANK'N'BUFF'ADDR;        << Get bank &offset of buffer>>  20510000
   ASSEMBLE(LDEA;DXCH,DDEL);           << Get frst 2 words of buffer>>  20515000
   VER'LEN := TOS;                     << Store verify byte length  >>  20520000
                                                                        20525000
   CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                                  20530000
   CP'DIAG'CDB'LENGTH  := 14;          << CDB byte count            >>  20535000
   CP'DIAG'DSJ'PON := TWO;                                              20540000
                                                                        20545000
                                       << Put len in cmnd seq.      >>  20550000
   SIOP'BYTE(CDB'AREA'BYTE +  9, L1'VER'LEN.(0:8));                     20555000
   SIOP'BYTE(CDB'AREA'BYTE + 10, L1'VER'LEN.(8:8));                     20560000
   SIOP'BYTE(CDB'AREA'BYTE + 11, L2'VER'LEN.(0:8));                     20565000
   SIOP'BYTE(CDB'AREA'BYTE + 12, L2'VER'LEN.(8:8));                     20570000
   SIOP'BYTE(CDB'AREA'BYTE + 13, CDB'VERIFY);                           20575000
                                                                        20580000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       20585000
                                                                        20590000
   END; << Of case 9 >>                                                 20595000
$PAGE                                                                   20600000
<<---------------------------------------------------->>                20605000
<<                                                    >>                20610000
<<   Request generic status [function = 15]           >>                20615000
<<                                                    >>                20620000
<< This request returns generic status of the prior   >>                20625000
<< request.                                           >>                20630000
<<---------------------------------------------------->>                20635000
                                                                        20640000
   BEGIN << Of case 10 >>                                               20645000
                                                                        20650000
   IF TRANSFER'COUNT < 2D THEN         << Exit with invalid func.   >>  20655000
      BEGIN                                                             20660000
      IOQ'STAT     := INVALID'REQUEST;                                  20665000
      IOQ'COUNT    := ZERO;                                             20670000
      DRIVER'STATE := REQUEST'COMPLETE;                                 20675000
                                                                        20680000
      RETURN;                                                           20685000
      END;                                                              20690000
                                                                        20695000
   GENERIC'STATUS := ZERO;                                              20700000
                                                                        20705000
   << ************ >>                                                   20710000
   << Fatal error. >>                                                   20715000
   << ************ >>                                                   20720000
                                                                        20725000
   IF     DIT'CONTROLLER'FAULT = ONE THEN                               20730000
      GS'FATAL'ERROR := TWO                                             20735000
                                                                        20740000
   ELSE IF DIT'ILL'OPCODE      = ONE AND                                20745000
           DIT'ILL'OPERATION   = ONE AND                                20750000
           DIT'ILL'PARAMETER   = ONE AND                                20755000
           DIT'MSG'LENGTH'ERR  = ONE AND                                20760000
           DIT'ILL'MSG'SEQ     = ONE AND                                20765000
           DIT'PARAMETER'BOUND = ONE AND                                20770000
           DIT'ADDR'BOUNDS     = ONE AND                                20775000
           DIT'MODULE'ADDR'ERR = ONE THEN                               20780000
      GS'FATAL'ERROR := FOUR                                            20785000
                                                                        20790000
   ELSE IF DIT'UNIT'FAULT      = ONE THEN                               20795000
      GS'FATAL'ERROR := 5                                               20800000
                                                                        20805000
   ELSE IF DIT'NO'DATA'FOUND   = ONE THEN                               20810000
      GS'FATAL'ERROR := 6                                               20815000
                                                                        20820000
   ELSE IF DIT'CHAN'PARITY'ERR = ONE THEN                               20825000
      GS'FATAL'ERROR := 7;                                              20830000
                                                                        20835000
   << ************ >>                                                   20840000
   << Unit number. >>                                                   20845000
   << ************ >>                                                   20850000
                                                                        20855000
   GS'UNIT'NUMBER := ZERO;                                              20860000
                                                                        20865000
   << ************ >>                                                   20870000
   << End of file. >>                                                   20875000
   << ************ >>                                                   20880000
                                                                        20885000
   GS'END'OF'FILE := FALSE;                                             20890000
                                                                        20895000
   << *********** >>                                                    20900000
   << Load point. >>                                                    20905000
   << *********** >>                                                    20910000
                                                                        20915000
   GS'LOAD'POINT := FALSE;                                              20920000
                                                                        20925000
   << ************ >>                                                   20930000
   << End of tape. >>                                                   20935000
   << ************ >>                                                   20940000
                                                                        20945000
   IF DIT'END'OF'VOLUME = ONE THEN                                      20950000
      GS'END'OF'TAPE := TRUE;                                           20955000
                                                                        20960000
   << ***************** >>                                              20965000
   << Immediate report. >>                                              20970000
   << ***************** >>                                              20975000
                                                                        20980000
   IF DIT'IMMEDIATE'MODE = ONE THEN                                     20985000
      GS'IMMED'RPT'ENABLE := TRUE;                                      20990000
                                                                        20995000
   << **************** >>                                               21000000
   << Recovered error. >>                                               21005000
   << **************** >>                                               21010000
                                                                        21015000
   IF DIT'RECOV'DATA       = ONE AND                                    21020000
      DIT'MARGINAL'DATA    = ONE AND                                    21025000
      DIT'NO'DATA'OVERFLOW = ONE THEN                                   21030000
      GS'RECOVERED'ERROR := TRUE;                                       21035000
                                                                        21040000
   << ************ >>                                                   21045000
   << Unit online. >>                                                   21050000
   << ************ >>                                                   21055000
                                                                        21060000
   IF DIT'DEV'NOT'RDY = ZERO THEN                                       21065000
      GS'UNIT'ONLINE := TRUE;                                           21070000
                                                                        21075000
   << ************* >>                                                  21080000
   << File protect. >>                                                  21085000
   << ************* >>                                                  21090000
                                                                        21095000
   IF DIT'WRITE'PROTECT = ONE THEN                                      21100000
      GS'FILE'PROTECT := TRUE;                                          21105000
                                                                        21110000
   << ************************************** >>                         21115000
   << Put generic status into user's buffer. >>                         21120000
   << ************************************** >>                         21125000
                                                                        21130000
                                       << Return the generic status >>  21135000
   TOS := BANK'N'BUFF'ADDR;            << User's buffer address     >>  21140000
   TOS := GENERIC'STATUS;              << Generic status            >>  21145000
   ASSEMBLE (SSEA);                                                     21150000
                                                                        21155000
   IOQ'STAT     := GOOD'IO;                                             21160000
   IOQ'COUNT    := ONE;                                                 21165000
   DRIVER'STATE := REQUEST'COMPLETE;                                    21170000
                                                                        21175000
   RETURN;                                                              21180000
   END; << Of case 10 >>                                                21185000
$PAGE                                                                   21190000
<<---------------------------------------------------->>                21195000
<<                                                    >>                21200000
<<   Lock [function code = 16]                        >>                21205000
<<                                                    >>                21210000
<<---------------------------------------------------->>                21215000
                                                                        21220000
   BEGIN << Of case 11 >>                                               21225000
                                                                        21230000
   DIT'LOCK'FLG := ONE;                                                 21235000
                                                                        21240000
                                       << Exit with a good transfer >>  21245000
   IOQ'STAT     := GOOD'IO;                                             21250000
   IOQ'COUNT    := ZERO;                                                21255000
   DRIVER'STATE := REQUEST'COMPLETE;                                    21260000
                                                                        21265000
   RETURN;                                                              21270000
   END; << Of case 11 >>                                                21275000
$PAGE                                                                   21280000
<<---------------------------------------------------->>                21285000
<<                                                    >>                21290000
<<   Unlock [function code = 17]                      >>                21295000
<<                                                    >>                21300000
<<---------------------------------------------------->>                21305000
                                                                        21310000
   BEGIN << Of case 12 >>                                               21315000
                                                                        21320000
   DIT'LOCK'FLG := ZERO;                                                21325000
                                                                        21330000
                                       << Exit with a good transfer >>  21335000
   IOQ'STAT     := GOOD'IO;                                             21340000
   IOQ'COUNT    := ZERO;                                                21345000
   DRIVER'STATE := REQUEST'COMPLETE;                                    21350000
                                                                        21355000
   RETURN;                                                              21360000
   END; << Of case 12 >>                                                21365000
$PAGE                                                                   21370000
<<---------------------------------------------------->>                21375000
<<                                                    >>                21380000
<<   Read lock bit [function code = 18]               >>                21385000
<<                                                    >>                21390000
<<       BANK & BUFFADDR - contain lock bit state     >>                21395000
<<                                                    >>                21400000
<<---------------------------------------------------->>                21405000
                                                                        21410000
   BEGIN << Of case 13 >>                                               21415000
                                                                        21420000
                                       << Return the lock bit value >>  21425000
   TOS := BANK'N'BUFF'ADDR;                                             21430000
   TOS := DIT'LOCK'FLG;                                                 21435000
   ASSEMBLE(SSEA);                                                      21440000
                                                                        21445000
                                       << Exit with a good transfer >>  21450000
   IOQ'STAT     := GOOD'IO;                                             21455000
   IOQ'COUNT    := ONE;                                                 21460000
   DRIVER'STATE := REQUEST'COMPLETE;                                    21465000
                                                                        21470000
   RETURN;                                                              21475000
   END; << Of case 13 >>                                                21480000
$PAGE                                                                   21485000
<<---------------------------------------------------->>                21490000
<<                                                    >>                21495000
<<   Immediate report mode [function code = 29]       >>                21500000
<<                                                    >>                21505000
<<   P2 - 1 Enable immediate report mode              >>                21510000
<<      - 0 Disable immediate report mode             >>                21515000
<<                                                    >>                21520000
<<---------------------------------------------------->>                21525000
                                                                        21530000
   BEGIN << Of case 14 >>                                               21535000
                                                                        21540000
   IF NOT (ZERO <= INTEGER(IOQ'PARM2) <= ONE) THEN                      21545000
      BEGIN                            << Exit with invalid func.   >>  21550000
      IOQ'STAT     := INVALID'REQUEST;                                  21555000
      IOQ'COUNT    := ZERO;                                             21560000
      DRIVER'STATE := REQUEST'COMPLETE;                                 21565000
                                                                        21570000
      RETURN;                                                           21575000
      END;                                                              21580000
                                                                        21585000
   DIT'IMMEDIATE'MODE := IOQ'PARM2;                                     21590000
                                       << Exit with a good transfer >>  21595000
   IOQ'STAT           := GOOD'IO;                                       21600000
   IOQ'COUNT          := ZERO;                                          21605000
   DRIVER'STATE       := REQUEST'COMPLETE;                              21610000
                                                                        21615000
   RETURN;                                                              21620000
   END; << Of case 14 >>                                                21625000
$PAGE                                                                   21630000
<<---------------------------------------------------->>                21635000
<<                                                    >>                21640000
<<   Identify [function code = 72]                    >>                21645000
<<                                                    >>                21650000
<<---------------------------------------------------->>                21655000
                                                                        21660000
   BEGIN << Of case 15 >>                                               21665000
                                                                        21670000
   IF TRANSFER'COUNT < 2D THEN         << Invalid transfer count    >>  21675000
      BEGIN                                                             21680000
      IOQ'STAT     := INVALID'REQUEST;                                  21685000
      IOQ'COUNT    := ZERO;                                             21690000
      DRIVER'STATE := REQUEST'COMPLETE;                                 21695000
                                                                        21700000
      RETURN;                                                           21705000
      END;                                                              21710000
                                                                        21715000
   CP'FIRST'BRANCH := ENTER'IDENTIFY;                                   21720000
                                                                        21725000
   END; << Of case 15 >>                                                21730000
$PAGE                                                                   21735000
<<---------------------------------------------------->>                21740000
<<                                                    >>                21745000
<<   Initiate diag. selftest [function code = 73]     >>                21750000
<<                                                    >>                21755000
<<   P1 - 2 bytes loop count (execution count)        >>                21760000
<<   P2 - diagnostic section number                   >>                21765000
<<                                                    >>                21770000
<<---------------------------------------------------->>                21775000
                                                                        21780000
   BEGIN << Of case 16 >>                                               21785000
                                                                        21790000
   CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                                  21795000
   CP'DIAG'CDB'LENGTH  := 5;                                            21800000
   CP'DIAG'DSJ'PON := TWO;                                              21805000
                                                                        21810000
   SETDB'SIOP;                                                          21815000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 0 ) := CDB'SET'UNIT + CTRL'UNIT;    21820000
                                                                        21825000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 1 ) := CDB'INIT'DIAG;               21830000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 2 ) := IOQ'PARM1.(0:8);             21835000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 3 ) := IOQ'PARM1.(8:8);             21840000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 4 ) := IOQ'PARM2.(8:8);             21845000
   SETDB'SYS;                                                           21850000
                                                                        21855000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       21860000
                                                                        21865000
   END; << Of case 16 >>                                                21870000
$PAGE                                                                   21875000
<<---------------------------------------------------->>                21880000
<<                                                    >>                21885000
<<   Loopback write [function code = 75]              >>                21890000
<<                                                    >>                21895000
<<   TRANSFER'COUNT - transfer count                  >>                21900000
<<   BANK & BUFFADDR - contains loopbk data for wrt.  >>                21905000
<<                     must begin w/hex FF followed   >>                21910000
<<                     by bytes equal to its prede-   >>                21915000
<<                     cessor plus one                >>                21920000
<<                                                    >>                21925000
<<---------------------------------------------------->>                21930000
                                                                        21935000
   BEGIN << Of case 17 >>                                               21940000
                                                                        21945000
   IF TRANSFER'COUNT = 0D    OR                                         21950000
      TRANSFER'COUNT > 1200D THEN                                       21955000
      BEGIN                            << Exit with invalid func.   >>  21960000
      IOQ'STAT      := INVALID'REQUEST;                                 21965000
      IOQ'COUNT     := ZERO;                                            21970000
      DRIVER'STATE  := REQUEST'COMPLETE;                                21975000
                                                                        21980000
      RETURN;                                                           21985000
      END;                                                              21990000
                                                                        21995000
   CP'DXFER'WRITE'READ  := WRT'TRANS'SEC;                               22000000
   CP'DXFER'CDB'LENGTH  := 5;          << CDB byte count            >>  22005000
   CP'DXFER'WAIT'5      := ZERO;                                        22010000
   CP'DXFER'WAIT'6      := ZERO;                                        22015000
   CP'DXFER'12'WAIT     := ZERO;                                        22020000
   CP'DXFER'13'WAIT     := ZERO;                                        22025000
   CP'DXFER'CMD'TO'EXEC := WRT'TRANS'SEC;                               22030000
   CP'DXFER'DATA'SIZE   := L'TRANSFER'COUNT;                            22035000
   CP'DXFER'DATA'TYPE   := ZERO;                                        22040000
   CP'DXFER'DATA'BANK   := BANK;                                        22045000
   CP'DXFER'DATA'OFFSET := BUFFADDR;   << Data buffer abs adr       >>  22050000
                                                                        22055000
   SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'WRT'LOOPBK);                       22060000
   SIOP'BYTE(CDB'AREA'BYTE + 1 , ZERO);                                 22065000
   SIOP'BYTE(CDB'AREA'BYTE + 2 , ZERO);                                 22070000
   SIOP'BYTE(CDB'AREA'BYTE + 3 , L'TRANSFER'COUNT.(0:8));               22075000
   SIOP'BYTE(CDB'AREA'BYTE + 4 , L'TRANSFER'COUNT.(8:8));               22080000
                                                                        22085000
   CP'FIRST'BRANCH     := ENTER'DATA'XFER;                              22090000
                                                                        22095000
   END; << Of case 17 >>                                                22100000
$PAGE                                                                   22105000
<<---------------------------------------------------->>                22110000
<<                                                    >>                22115000
<<   Loopback read [function code = 76]               >>                22120000
<<                                                    >>                22125000
<<   TRANSFER'COUNT - transfer count                  >>                22130000
<<   BANK & BUFFADDR - contains loopback data read    >>                22135000
<<                                                    >>                22140000
<<---------------------------------------------------->>                22145000
                                                                        22150000
   BEGIN << Of case 18 >>                                               22155000
                                                                        22160000
   IF TRANSFER'COUNT = 0D    OR                                         22165000
      TRANSFER'COUNT > 1200D THEN                                       22170000
      BEGIN                            << Exit with invalid func.   >>  22175000
      IOQ'STAT     := INVALID'REQUEST;                                  22180000
      IOQ'COUNT    := ZERO;                                             22185000
      DRIVER'STATE := REQUEST'COMPLETE;                                 22190000
                                                                        22195000
      RETURN;                                                           22200000
      END;                                                              22205000
                                                                        22210000
   CP'DXFER'WRITE'READ  := WRT'TRANS'SEC;                               22215000
   CP'DXFER'CDB'LENGTH  := 5;          << CDB byte count            >>  22220000
   CP'DXFER'WAIT'5      := ZERO;                                        22225000
   CP'DXFER'WAIT'6      := ZERO;                                        22230000
   CP'DXFER'12'WAIT     := ZERO;                                        22235000
   CP'DXFER'13'WAIT     := ZERO;                                        22240000
   CP'DXFER'CMD'TO'EXEC := READ'TRANS'SEC;                              22245000
   CP'DXFER'DATA'SIZE   := L'TRANSFER'COUNT;                            22250000
   CP'DXFER'DATA'TYPE   := ZERO;                                        22255000
   CP'DXFER'DATA'BANK   := BANK;                                        22260000
   CP'DXFER'DATA'OFFSET := BUFFADDR;   << Data buffer abs adr       >>  22265000
                                                                        22270000
   SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'READ'LOOPBK);                      22275000
   SIOP'BYTE(CDB'AREA'BYTE + 1 , ZERO);                                 22280000
   SIOP'BYTE(CDB'AREA'BYTE + 2 , ZERO);                                 22285000
   SIOP'BYTE(CDB'AREA'BYTE + 3 , L'TRANSFER'COUNT.(0:8));               22290000
   SIOP'BYTE(CDB'AREA'BYTE + 4 , L'TRANSFER'COUNT.(8:8));               22295000
                                                                        22300000
   CP'FIRST'BRANCH     := ENTER'DATA'XFER;                              22305000
                                                                        22310000
   END; << Of case 18 >>                                                22315000
$PAGE                                                                   22320000
<<---------------------------------------------------->>                22325000
<<                                                    >>                22330000
<<   Release [function code = 79]                     >>                22335000
<<                                                    >>                22340000
<<---------------------------------------------------->>                22345000
                                                                        22350000
   BEGIN << Of case 19 >>                                               22355000
                                                                        22360000
<<  Set DIT'RELEASE'CMD =3 so we know the Release was >>                22365000
<< a funciton code.  If we have to resend the Release,>>                22370000
<< we will goto Retry'Request in this case.   >>                        22375000
   DIT'RELEASE'CMD := 3;                                                22380000
   CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                                  22385000
   CP'DIAG'CDB'LENGTH  := TWO;                                          22390000
   CP'DIAG'DSJ'PON := NINETEEN;                                         22395000
                                                                        22400000
   SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'SET'UNIT + CTRL'UNIT);             22405000
   SIOP'BYTE(CDB'AREA'BYTE + 1 , CDB'RELEASE);                          22410000
                                                                        22415000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       22420000
                                                                        22425000
   END; << Of case 19 >>                                                22430000
$PAGE                                                                   22435000
<<---------------------------------------------------->>                22440000
<<                                                    >>                22445000
<<   Release denied [function code = 80]              >>                22450000
<<                                                    >>                22455000
<<---------------------------------------------------->>                22460000
                                                                        22465000
   BEGIN << Of case 20 >>                                               22470000
                                                                        22475000
   CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                                  22480000
   CP'DIAG'CDB'LENGTH  := TWO;                                          22485000
   CP'DIAG'DSJ'PON := TWO;                                              22490000
                                                                        22495000
   SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'SET'UNIT + CTRL'UNIT);             22500000
   SIOP'BYTE(CDB'AREA'BYTE + 1 , CDB'RELEASE'DENY);                     22505000
                                                                        22510000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       22515000
                                                                        22520000
   END; << Of case 20 >>                                                22525000
$PAGE                                                                   22530000
<<---------------------------------------------------->>                22535000
<<                                                    >>                22540000
<<   Set release [function code = 81]                 >>                22545000
<<                                                    >>                22550000
<<   P1 - 0 enable release timeout [T=0]              >>                22555000
<<        1 suppress release timeout [T=1]            >>                22560000
<<   P2 - 0 auto release during idle time [Z=0]       >>                22565000
<<        1 no auto release during idle time [Z=1]    >>                22570000
<<                                                    >>                22575000
<<---------------------------------------------------->>                22580000
                                                                        22585000
   BEGIN << Of case 21 >>                                               22590000
                                                                        22595000
   CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                                  22600000
   CP'DIAG'CDB'LENGTH  := THREE;                                        22605000
   CP'DIAG'DSJ'PON := TWO;                                              22610000
                                                                        22615000
   PARM          := ZERO;                                               22620000
   IF IOQ'PARM1 = ONE THEN                                              22625000
      PARM.(0:1) := ONE;               << Suppress release timeout  >>  22630000
   IF IOQ'PARM2 = ONE THEN                                              22635000
      PARM.(1:1) := ONE;               << Dont release during idle  >>  22640000
                                       << timeout                   >>  22645000
                                                                        22650000
   SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'SET'UNIT + CTRL'UNIT);             22655000
   SIOP'BYTE(CDB'AREA'BYTE + 1 , CDB'SET'RELEASE);                      22660000
   SIOP'BYTE(CDB'AREA'BYTE + 2 , PARM.(0:8));                           22665000
                                                                        22670000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       22675000
                                                                        22680000
   END; << Of case 21 >>                                                22685000
$PAGE                                                                   22690000
<<---------------------------------------------------->>                22695000
<<                                                    >>                22700000
<<   Set address [function code = 82]                 >>                22705000
<<                                                    >>                22710000
<<   BANK & BUFFADDR - Contains a dbl wrd address     >>                22715000
<<                     of the block to be addressed.  >>                22720000
<<                                                    >>                22725000
<<---------------------------------------------------->>                22730000
                                                                        22735000
   BEGIN << Of case 22 >>                                               22740000
                                                                        22745000
   CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                                  22750000
   CP'DIAG'CDB'LENGTH  := 8;                                            22755000
   CP'DIAG'DSJ'PON := TWO;                                              22760000
                                                                        22765000
                                       << Get the block address.    >>  22770000
   TOS            := BANK'N'BUFF'ADDR; << Get bank &offset of buffer>>  22775000
   ASSEMBLE(LDEA;DXCH,DDEL);           << Get frst 2 words of buffer>>  22780000
   ADDRESS'OFFSET := TOS;                                               22785000
   PARM           := TOS;                                               22790000
                                                                        22795000
   SETDB'SIOP;                                                          22800000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 0 ) := CDB'SET'UNIT;                22805000
                                                                        22810000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 1 ) := CDB'SET'SNGL'VEC;            22815000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 2 ) := ZERO;                        22820000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 3 ) := ZERO;                        22825000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 4 ) := PARM.(0:8);                  22830000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 5 ) := PARM.(8:8);                  22835000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 6 ) := ADDRESS'OFFSET.(0:8);        22840000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 7 ) := ADDRESS'OFFSET.(8:8);        22845000
   SETDB'SYS;                                                           22850000
                                                                        22855000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       22860000
                                                                        22865000
   END; << Of case 22 >>                                                22870000
$PAGE                                                                   22875000
<<---------------------------------------------------->>                22880000
<<                                                    >>                22885000
<<   Spare block [function code = 88]                 >>                22890000
<<                                                    >>                22895000
<<   BANK & BUFFADDR - contains dbl wrd address of    >>                22900000
<<                     the block to be spared         >>                22905000
<<   P2 - 0 Spare retaining data (no target sector)   >>                22910000
<<        1 Spare without retaining data              >>                22915000
<<        4 Spare retaining data (target included)    >>                22920000
<<                                                    >>                22925000
<<---------------------------------------------------->>                22930000
                                                                        22935000
   BEGIN << Of case 23 >>                                               22940000
                                                                        22945000
   IF NOT (ZERO <= INTEGER(IOQ'PARM2) <= FOUR) THEN                     22950000
      BEGIN                            << Exit with invalid func.   >>  22955000
      IOQ'STAT     := INVALID'REQUEST;                                  22960000
      IOQ'COUNT    := ZERO;                                             22965000
      DRIVER'STATE := REQUEST'COMPLETE;                                 22970000
                                                                        22975000
      RETURN;                                                           22980000
      END;                                                              22985000
                                                                        22990000
                                       << Get the block address.    >>  22995000
   TOS            := BANK'N'BUFF'ADDR; << Get bank &offset of buffer>>  23000000
   ASSEMBLE(LDEA;DXCH,DDEL);           << Get frst 2 words of buffer>>  23005000
   ADDRESS'OFFSET := TOS;                                               23010000
   PARM           := TOS;                                               23015000
                                                                        23020000
   CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                                  23025000
   CP'DIAG'CDB'LENGTH  := 10;                                           23030000
   CP'DIAG'DSJ'PON := TWO;                                              23035000
                                                                        23040000
   SETDB'SIOP;                                                          23045000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 0 ) := CDB'SET'UNIT;                23050000
                                                                        23055000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 1 ) := CDB'SET'SNGL'VEC;            23060000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 2 ) := ZERO;                        23065000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 3 ) := ZERO;                        23070000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 4 ) := PARM.(0:8);                  23075000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 5 ) := PARM.(8:8);                  23080000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 6 ) := ADDRESS'OFFSET.(0:8);        23085000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 7 ) := ADDRESS'OFFSET.(8:8);        23090000
                                                                        23095000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 8 ) := CDB'SPARE'BLK;               23100000
   SIODB'BYTE'ARRAY(CDB'AREA'BYTE + 9 ) := IOQ'PARM2.(8:8);             23105000
   SETDB'SYS;                                                           23110000
                                                                        23115000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       23120000
                                                                        23125000
   END; << Of case 23 >>                                                23130000
$PAGE                                                                   23135000
<<---------------------------------------------------->>                23140000
<<                                                    >>                23145000
<<   Initiate utility [function code = 91]            >>                23150000
<<                                                    >>                23155000
<<   TRANSFER'COUNT - Executing message length        >>                23160000
<<   BANK & BUFFADDR - Contains utility byte count    >>                23165000
<<                     with utility parameter bytes   >>                23170000
<<                     to follow (optional).          >>                23175000
<<   BANK & BUFFADDR+10 - Returns utility data        >>                23180000
<<                        information (optional).     >>                23185000
<<   P1 - 0 No executing message                      >>                23190000
<<      - 1 Send executing message to the device      >>                23195000
<<      - 2 Receive executing message from device     >>                23200000
<<   P2 - Utility number                              >>                23205000
<<                                                    >>                23210000
<<  *NOTE:  See Buffalo Driver ERS documentation      >>                23215000
<<          for a more thorough description           >>                23220000
<<                                                    >>                23225000
<<---------------------------------------------------->>                23230000
                                                                        23235000
   BEGIN << Of case 24 >>                                               23240000
                                                                        23245000
                                       << Exit with invalid func.  >>   23250000
   IF NOT (ZERO <= INTEGER(IOQ'PARM1) <= TWO) THEN                      23255000
      BEGIN                                                             23260000
      IOQ'STAT     := INVALID'REQUEST;                                  23265000
      IOQ'COUNT    := ZERO;                                             23270000
      DRIVER'STATE := REQUEST'COMPLETE;                                 23275000
                                                                        23280000
      RETURN;                                                           23285000
      END;                                                              23290000
                                                                        23295000
                                       << Invalid transfer count    >>  23300000
   IF TRANSFER'COUNT = 0D THEN                                          23305000
      BEGIN                                                             23310000
      IOQ'STAT     := INVALID'REQUEST;                                  23315000
      IOQ'COUNT    := ZERO;                                             23320000
      DRIVER'STATE := REQUEST'COMPLETE;                                 23325000
                                                                        23330000
      RETURN;                                                           23335000
      END;                                                              23340000
                                                                        23345000
   SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'SET'UNIT);                         23350000
   SIOP'BYTE(CDB'AREA'BYTE + 1 , CDB'NOP);                              23355000
   SIOP'BYTE(CDB'AREA'BYTE + 2 , CDB'INIT'UTIL + IOQ'PARM1.(8:8));      23360000
   SIOP'BYTE(CDB'AREA'BYTE + 3 , IOQ'PARM2.(8:8));                      23365000
                                                                        23370000
   IF IOQ'PARM1 <> ONE THEN            << Fetch util parm bytes     >>  23375000
      BEGIN                                                             23380000
      TOS := BANK'N'BUFF'ADDR;                                          23385000
      ASSEMBLE (LSEA);                                                  23390000
      INDEX := TOS;                    << #Util parm bytes          >>  23395000
      ASSEMBLE (DEL;DEL);                                               23400000
      IF INDEX <> ZERO THEN                                             23405000
         BEGIN                                                          23410000
         IF INDEX > 18 THEN            << Exceed max bytes allow    >>  23415000
            BEGIN                                                       23420000
            IOQ'STAT     := INVALID'REQUEST;                            23425000
            IOQ'COUNT    := ZERO;                                       23430000
            DRIVER'STATE := REQUEST'COMPLETE;                           23435000
                                                                        23440000
            RETURN;                                                     23445000
            END;                                                        23450000
         PARM := (INDEX + ONE) / TWO;  << Convert byte cnt to words >>  23455000
                                       << Destination of CDB area   >>  23460000
         TOS := 0;                                             <<f9010>>23465000
         TOS := @SIOP + SYSDB + CDB'AREA'WRD + TWO;                     23470000
         TOS := BANK'N'BUFF'ADDR + %1D;<< Source                    >>  23475000
         TOS := PARM;                  << #Words to move            >>  23480000
         ASSEMBLE (MABS);              << Move using abs addr       >>  23485000
         END; << Of "if <> THEN ..." >>                                 23490000
      END; << Of "if IOQ'PARM1 <> ONE ..." >>                           23495000
                                                                        23500000
   CASE IOQ'PARM1 OF                                                    23505000
                                                                        23510000
      BEGIN                                                             23515000
      BEGIN << No exec msg >>                                           23520000
                                                                        23525000
      CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                               23530000
      CP'DIAG'DSJ'PON := TWO;                                           23535000
      CP'DIAG'CDB'LENGTH  := FOUR + INDEX;                              23540000
      CP'FIRST'BRANCH     := ENTER'DIAG;                                23545000
                                                                        23550000
      END; << No exec msg >>                                            23555000
                                                                        23560000
      BEGIN << Send exec msg to device >>                               23565000
                                                                        23570000
      CP'DXFER'WRITE'READ  := WRT'CMD'SEC;                              23575000
      CP'DXFER'CDB'LENGTH  := FOUR;                                     23580000
      CP'DXFER'WAIT'5      := WAIT'INSTR;                               23585000
      CP'DXFER'WAIT'6      := ZERO;                                     23590000
      CP'DXFER'12'WAIT     := WAIT'INSTR;                               23595000
      CP'DXFER'13'WAIT     := ZERO;                                     23600000
      CP'DXFER'CMD'TO'EXEC := WRT'EXEC'SEC;                             23605000
                                              << Exec msg count     >>  23610000
      CP'DXFER'DATA'SIZE   := INTEGER(TRANSFER'COUNT);                  23615000
      CP'DXFER'DATA'TYPE   := ZERO;                                     23620000
      CP'DXFER'DATA'BANK   := BANK;                                     23625000
      CP'DXFER'DATA'OFFSET := BUFFADDR;                                 23630000
      CP'FIRST'BRANCH      := ENTER'DATA'XFER;                          23635000
                                                                        23640000
      END; << Send exec msg to device >>                                23645000
                                                                        23650000
      BEGIN << Receive exec msg from device >>                          23655000
                                                                        23660000
      CP'DXFER'WRITE'READ  := WRT'CMD'SEC;                              23665000
      CP'DXFER'CDB'LENGTH  := FOUR + INDEX;                             23670000
      CP'DXFER'WAIT'5      := WAIT'INSTR;                               23675000
      CP'DXFER'WAIT'6      := ZERO;                                     23680000
      CP'DXFER'12'WAIT     := WAIT'INSTR;                               23685000
      CP'DXFER'13'WAIT     := ZERO;                                     23690000
      CP'DXFER'CMD'TO'EXEC := READ'EXEC'SEC;                            23695000
                                              << Exec msg count     >>  23700000
      CP'DXFER'DATA'SIZE   := INTEGER(TRANSFER'COUNT);                  23705000
      CP'DXFER'DATA'TYPE   := ZERO;                                     23710000
      CP'DXFER'DATA'BANK   := BANK;                                     23715000
      CP'DXFER'DATA'OFFSET := BUFFADDR+10;                              23720000
      CP'FIRST'BRANCH      := ENTER'DATA'XFER;                          23725000
                                                                        23730000
      END; << Send exec msg to device >>                                23735000
      END; << Of "case IOQ'PARM1 of ..." >>                             23740000
                                                                        23745000
   END; << Of case 24 >>                                                23750000
$PAGE                                                                   23755000
<<---------------------------------------------------->>                23760000
<<                                                    >>                23765000
<<   Clear device [function code = 92] and            >>                23770000
<<   Channel independant clear [function code = 101]  >>                23775000
<<                                                    >>                23780000
<<  P1 = -IOQ'FUNC - Add set unit command             >>                23785000
<<  P2 - The unit number between 0 and 15.            >>                23790000
<<---------------------------------------------------->>                23795000
                                                                        23800000
   BEGIN << Of case 25 >>                                               23805000
                                                                        23810000
   CP'DIAG'CMD'TO'EXEC := WRT'TRANS'SEC;                                23815000
   CP'DIAG'CDB'LENGTH  := TWO;         << Just cancel cmd           >>  23820000
   CP'DIAG'DSJ'PON := TWO;                                              23825000
                                                                        23830000
   SIOP'BYTE(CDB'AREA'BYTE + 0, CDB'SET'UNIT);                          23835000
   SIOP'BYTE(CDB'AREA'BYTE + 1, CDB'CI'CLEAR);                          23840000
                                                                        23845000
   IF IOQ'PARM1 = -IOQ'FUNC THEN       << Change unit number?       >>  23850000
                                       << Valid unit ?              >>  23855000
      IF ZERO <= INTEGER(IOQ'PARM2) <= 15 THEN                          23860000
         SIOP'BYTE(CDB'AREA'BYTE, CDB'SET'UNIT + IOQ'PARM2)             23865000
      ELSE                             << Bad unit #                >>  23870000
         BEGIN                         << Exit with invalid func.   >>  23875000
         IOQ'STAT      := INVALID'REQUEST;                              23880000
         IOQ'COUNT     := ZERO;                                         23885000
         DRIVER'STATE  := REQUEST'COMPLETE;                             23890000
                                                                        23895000
         RETURN;                                                        23900000
         END; << Of else "if ZERO <= INTEGER(IOQ'PARM2) ..." >>         23905000
                                                                        23910000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       23915000
                                                                        23920000
   END; << Of case 25 >>                                                23925000
$PAGE                                                                   23930000
<<---------------------------------------------------->>                23935000
<<                                                    >>                23940000
<<   Cancel transaction [function code = 93]          >>                23945000
<<                                                    >>                23950000
<<                                                    >>                23955000
<<  P1 = -IOQ'FUNC - Add set unit command             >>                23960000
<<  P2 - The unit number between 0 and 15             >>                23965000
<<---------------------------------------------------->>                23970000
                                                                        23975000
   BEGIN << Of case 26 >>                                               23980000
                                                                        23985000
   CP'DIAG'CMD'TO'EXEC := WRT'TRANS'SEC;                                23990000
   CP'DIAG'DSJ'PON := TWO;                                              23995000
   CP'DIAG'CDB'LENGTH  := TWO;         << 2 cmd bytes               >>  24000000
                                                                        24005000
   SIOP'BYTE(CDB'AREA'BYTE + 0, CDB'SET'UNIT);                          24010000
   SIOP'BYTE(CDB'AREA'BYTE + 1, CDB'CANCEL);                            24015000
                                                                        24020000
   IF IOQ'PARM1 = -IOQ'FUNC THEN       << Change unit number?       >>  24025000
                                       << Valid unit ?              >>  24030000
      IF ZERO <= INTEGER(IOQ'PARM2) <= 15 THEN                          24035000
         SIOP'BYTE(CDB'AREA'BYTE, CDB'SET'UNIT + IOQ'PARM2)             24040000
      ELSE                             << Bad unit #                >>  24045000
         BEGIN                         << Exit with invalid func.   >>  24050000
         IOQ'STAT      := INVALID'REQUEST;                              24055000
         IOQ'COUNT     := ZERO;                                         24060000
         DRIVER'STATE  := REQUEST'COMPLETE;                             24065000
                                                                        24070000
         RETURN;                                                        24075000
         END; << Of else "if ZERO <= INTEGER(IOQ'PARM2) ..." >>         24080000
                                                                        24085000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       24090000
                                                                        24095000
   END; << Of case 26 >>                                                24100000
$PAGE                                                                   24105000
<<---------------------------------------------------->>                24110000
<<                                                    >>                24115000
<<   Parity checking [function code = 94]             >>                24120000
<<                                                    >>                24125000
<<   P1 - 0 disable parity checking                   >>                24130000
<<      - 1 enable parity checking                    >>                24135000
<<                                                    >>                24140000
<<---------------------------------------------------->>                24145000
                                                                        24150000
   BEGIN << Of case 27 >>                                               24155000
                                                                        24160000
   IF NOT (ZERO <= INTEGER(IOQ'PARM1) <= ONE) THEN                      24165000
      BEGIN                            << Exit with invalid func.   >>  24170000
      IOQ'STAT     := INVALID'REQUEST;                                  24175000
      IOQ'COUNT    := ZERO;                                             24180000
      DRIVER'STATE := REQUEST'COMPLETE;                                 24185000
                                                                        24190000
      RETURN;                                                           24195000
      END;                                                              24200000
                                                                        24205000
   CP'DIAG'CMD'TO'EXEC := WRT'TRANS'SEC;                                24210000
   CP'DIAG'CDB'LENGTH  := THREE;                                        24215000
   CP'DIAG'WAIT'5      := 0;           << Bypass Wait and DSJ inst. >>  24220000
   CP'DIAG'DSJ'PON := TWO;                                              24225000
   CP'DIAG'WAIT'6      := 6;                                            24230000
                                                                        24235000
   SIOP'BYTE(CDB'AREA'BYTE + 0, CDB'SET'UNIT);                          24240000
   SIOP'BYTE(CDB'AREA'BYTE + 1, CDB'PARITY'OP);                         24245000
                                                                        24250000
                                       << Enable or disable parity  >>  24255000
                                       << checking                  >>  24260000
   SIOP'BYTE(CDB'AREA'BYTE + 2, IF IOQ'PARM1 = ZERO THEN                24265000
                                   ZERO                                 24270000
                                ELSE                                    24275000
                                   ONE);                                24280000
                                                                        24285000
   CP'FIRST'BRANCH := ENTER'DIAG;                                       24290000
                                                                        24295000
   END; << Of case 27 >>                                                24300000
$PAGE                                                                   24305000
<<---------------------------------------------------->>                24310000
<<                                                    >>                24315000
<<   Generic diagnostic request [function code = 100] >>                24320000
<<                                                    >>                24325000
<<   TRANSFER'COUNT - execution message length        >>                24330000
<<            (Set to -1 if not used)                 >>                24335000
<<   BANK & BUFFADDR - buffer containing the execution>>                24340000
<<                     message and data bytes.        >>                24345000
<<   P1 - 0 no execution message                      >>                24350000
<<      - 1 send execution message to the device      >>                24355000
<<      - 2 total length of message (exec + data)     >>                24360000
<<   P2 - number of command bytes to be send          >>                24365000
<<                                                    >>                24370000
<<    If sending an execution msg, the command bytes  >>                24375000
<<    follow the data to be sent in the buffer.  In   >>                24380000
<<    this case, the cmd bytes must start on a word   >>                24385000
<<    boundtry - If they do not, we round to the      >>                24390000
<<    next even byte.                                 >>                24395000
<<---------------------------------------------------->>                24400000
                                                                        24405000
   BEGIN << Of case 28 >>                                               24410000
                                                                        24415000
   IF NOT IOQ'DIAG THEN                                                 24420000
      BEGIN                            << Exit with invalid func.   >>  24425000
      IOQ'STAT     := INVALID'REQUEST;                                  24430000
      IOQ'COUNT    := ZERO;                                             24435000
      DRIVER'STATE := REQUEST'COMPLETE;                                 24440000
                                                                        24445000
      RETURN;                                                           24450000
      END;                                                              24455000
                                                                        24460000
   CASE IOQ'PARM1 OF                                                    24465000
      BEGIN                                                             24470000
                                                                        24475000
      BEGIN << No exection msg >>                                       24480000
                                                                        24485000
      CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                               24490000
      CP'DIAG'CDB'LENGTH  := IOQ'PARM2; << CMD bytes length         >>  24495000
      CP'DIAG'DSJ'PON := TWO;                                           24500000
      CP'DIAG'CDB'BANK    := BANK;      << CMB byte location        >>  24505000
      CP'DIAG'CDB'OFFSET  := BUFFADDR;                                  24510000
      CP'FIRST'BRANCH     := ENTER'DIAG;                                24515000
                                                                        24520000
      END;  << No exection msg >>                                       24525000
                                                                        24530000
      BEGIN << Send exection msg >>                                     24535000
                                                                        24540000
                                       << Compute word offset to    >>  24545000
                                       << nearest word boundry      >>  24550000
      IF INTEGER(IOQ'COUNT) < ZERO THEN                                 24555000
         ADDRESS'OFFSET    := (ONE - INTEGER(IOQ'COUNT)) / TWO          24560000
      ELSE                                                              24565000
         ADDRESS'OFFSET    := INTEGER(IOQ'COUNT);                       24570000
                                                                        24575000
      CP'DXFER'WRITE'READ  := WRT'CMD'SEC;                              24580000
      CP'DXFER'CDB'LENGTH  := INTEGER(IOQ'PARM2) -                      24585000
                              INTEGER(TRANSFER'COUNT);                  24590000
      CP'DXFER'CDB'BANK    := BANK;                                     24595000
      CP'DXFER'CDB'OFFSET  := BUFFADDR + ADDRESS'OFFSET;                24600000
      CP'DXFER'WAIT'5      := WAIT'INSTR;                               24605000
      CP'DXFER'WAIT'6      := ZERO;                                     24610000
      CP'DXFER'12'WAIT     := WAIT'INSTR;                               24615000
      CP'DXFER'13'WAIT     := ZERO;                                     24620000
      CP'DXFER'CMD'TO'EXEC := WRT'EXEC'SEC;                             24625000
                                              << Exec msg length    >>  24630000
      CP'DXFER'DATA'SIZE   := INTEGER(TRANSFER'COUNT);                  24635000
      CP'DXFER'DATA'TYPE   := ZERO;                                     24640000
      CP'DXFER'DATA'BANK   := BANK;                                     24645000
      CP'DXFER'DATA'OFFSET := BUFFADDR;                                 24650000
      CP'FIRST'BRANCH      := ENTER'DATA'XFER;                          24655000
                                                                        24660000
      END;  << Send exection msg >>                                     24665000
                                                                        24670000
      BEGIN << Receive exection msg >>                                  24675000
                                                                        24680000
      CP'DXFER'WRITE'READ  := WRT'CMD'SEC;                              24685000
      CP'DXFER'CDB'LENGTH  := IOQ'PARM2;                                24690000
      CP'DXFER'CDB'BANK    := BANK;                                     24695000
      CP'DXFER'CDB'OFFSET  := BUFFADDR;                                 24700000
      CP'DXFER'WAIT'5      := WAIT'INSTR;                               24705000
      CP'DXFER'WAIT'6      := ZERO;                                     24710000
      CP'DXFER'12'WAIT     := WAIT'INSTR;                               24715000
      CP'DXFER'13'WAIT     := ZERO;                                     24720000
      CP'DXFER'CMD'TO'EXEC := READ'EXEC'SEC;                            24725000
                                              << Exec msg count     >>  24730000
      CP'DXFER'DATA'SIZE   := INTEGER(TRANSFER'COUNT);                  24735000
      CP'DXFER'DATA'TYPE   := ZERO;                                     24740000
      CP'DXFER'DATA'BANK   := BANK;                                     24745000
      CP'DXFER'DATA'OFFSET := BUFFADDR;                                 24750000
      CP'FIRST'BRANCH      := ENTER'DATA'XFER;                          24755000
                                                                        24760000
      END;  << Receive exection msg>>                                   24765000
      END; << Of case IOQ'PARM1 >>                                      24770000
                                                                        24775000
   END; << Of case 28 >>                                                24780000
                                                                        24785000
   END; << OF "case FCODE..." >>                                        24790000
$PAGE                                                                   24795000
<<---------------------------------------------------->>                24800000
<<                                                    >>                24805000
<<   Start channel program section                    >>                24810000
<<                                                    >>                24815000
<<---------------------------------------------------->>                24820000
                                                                        24825000
   DIT'RELEASE'GRANTED := FALSE;   << Normal CP will get us >> <<09421>>24830000
                                   << any pending DSJ of 2. >> <<09421>>24835000
   P'CPVA      := ZERO;                << Clear channel status words>>  24840000
   CPVA'STATUS := ZERO;                                                 24845000
                                                                        24850000
                                       << Clear the DIT status area >>  24855000
   IF IOQ'RETRY'COUNT = 0 THEN                                          24860000
     BEGIN                                                              24865000
     INDEX := DSTATUS;                                                  24870000
     DO                                                                 24875000
       P'DIT(INDEX) := ZERO                                             24880000
     UNTIL (INDEX := INDEX + 1) > DSTATUS + (DEV'STAT'WORD'SIZE-1)      24885000
   END;                                                                 24890000
                                                                        24895000
   START'HPIB(P'DIT,SIOP,TRUE);                                         24900000
   IF > THEN                                                            24905000
      BEGIN                            << Exit with a SIO error     >>  24910000
      LOG'STATUS;                                                       24915000
      IOQ'STAT     := CHAN'PGM'FAILURE;                                 24920000
      UPDATE'XFER'CNT;                                                  24925000
      DRIVER'STATE := REQUEST'COMPLETE;                                 24930000
                                                                        24935000
      RETURN;                                                           24940000
      END; << Of "if > then ..." >>                                     24945000
                                                                        24950000
   IOQ'WAITCODE    := CMPLTION'WAIT;                                    24955000
   DRIVER'STATE    := INTERRUPT'WAIT;                                   24960000
                                                                        24965000
   RETURN;                                                              24970000
   END;   << End of initiation section >>                               24975000
$PAGE "   BUFFALO'DRIVER - continuator section"                <<09421>>24980000
<<**********************************************************>> <<09421>>24985000
<<**********************************************************>> <<09421>>24990000
<<                                                          >> <<09421>>24995000
<<            HP9144 driver continuator section             >> <<09421>>25000000
<<                                                          >> <<09421>>25005000
<<**********************************************************>> <<09421>>25010000
<<**********************************************************>> <<09421>>25015000
                                                                        25020000
CONTINUATOR:                                                            25025000
                                                                        25030000
<<  If the CPVA <> 2 then we want to reset DIT'RELEASE'CMD>>            25035000
<< This is for the scenario whan we send a Release but do not >>        25040000
<< get a QSTAT = 2 (which is a rare case).   If that did happen>>       25045000
<< we need to reset this variable so that if the command>>              25050000
<< following the Release got a QSTAT of 2 we would not execute>>        25055000
<< the wrong code.  >>                                                  25060000
IF CPVA'STATUS <> 2 THEN                                                25065000
   DIT'RELEASE'CMD := 0;                                                25070000
                                                                        25075000
                                                                        25080000
IF DIT'SAVE'WORD = -1    OR            << System powerfail >>  <<J9456>>25085000
   IOQ'PFAIL = 1         OR                                    <<J9456>>25090000
   CPVA'STATUS = 2       OR                                    <<J9456>>25095000
   DIT'DEV'POWERFAIL = 1 and cpva'status = 1 then  <<Device>>  <<19502>>25100000
   BEGIN                                                                25105000
   DIT'SAVE'WORD := ZERO;                                               25110000
   IF DIT'IMMEDIATE'MODE = 1 AND DIT'LAST'WAS'WRITE = 1 THEN   <<J9456>>25115000
   BEGIN                                                       <<J9456>>25120000
                                                               <<f9521>>25125000
     UPDATE'XFER'CNT;                                          <<f9521>>25130000
     DRIVER'STATE := REQUEST'COMPLETE;                         <<J9456>>25135000
     CPVA'STATUS  := 0;                                        <<J9456>>25140000
     IOQ'STAT     := POWERFAIL'ABORT;                          <<J9456>>25145000
     RETURN;                                                   <<J9456>>25150000
   END;                                                        <<J9456>>25155000
   if cpva'status <> 2 then                                    <<19502>>25160000
   begin                                                       <<19502>>25165000
     IOQ'SYS'PFAIL := ONE;                                     <<19502>>25170000
<< fix infinite retries condition when IOQ'PFAIL=1 >>          <<09574>>25175000
   if ioq'pfail then                                           <<09574>>25180000
   begin                                                       <<09574>>25185000
     ioq'pfail := 0;                                           <<09574>>25190000
     ioq'abort := 0;                                           <<09574>>25195000
   end;                                                        <<09574>>25200000
     GOTO RETRY'REQUEST;                                       <<19502>>25205000
   end;                                                        <<19502>>25210000
   END; << Of "if DIT'SAVE'WORD = -ONE ..." >>                          25215000
$PAGE                                                                   25220000
<<---------------------------------------------------->>                25225000
<<   Reset the location of where command bytes can    >>                25230000
<<   be found for diagnostics commands.               >>                25235000
<<---------------------------------------------------->>                25240000
                                                                        25245000
IF FCODE = FC'GENERIC'DIAG THEN                                         25250000
   BEGIN                                                                25255000
   CP'DIAG'CDB'BANK    := ZERO;        << CMB byte location         >>  25260000
   CP'DIAG'CDB'OFFSET  := @SIOP + SYSDB + CDB'AREA'WRD;                 25265000
   CP'DXFER'CDB'BANK   := ZERO;                                         25270000
   CP'DXFER'CDB'OFFSET := @SIOP + SYSDB + CDB'AREA'WRD;                 25275000
   END; << Of "if FCODE = FC'GENERIC'DIAG ..." >>                       25280000
$PAGE                                                                   25285000
                                       << Abort current IOQ         >>  25290000
IF IOQ'ABORT    =  ONE             AND                                  25295000
   IOQ'WAITCODE <> ABORT'IOQ'WAIT  THEN                                 25300000
                                                                        25305000
   BEGIN                                                                25310000
                                       << Do a channel independent  >>  25315000
                                       << clear to abort the        >>  25320000
                                       << current IOQ.              >>  25325000
   CP'FIRST'BRANCH := ENTER'CHAN'CLEAR;                        <<09421>>25330000
   START'HPIB(P'DIT,SIOP,TRUE);                                         25335000
   IF > THEN                                                            25340000
      BEGIN                            << Exit with a SIO error     >>  25345000
      LOG'STATUS;                                                       25350000
      IOQ'STAT     := CHAN'PGM'FAILURE;                                 25355000
      UPDATE'XFER'CNT;                                                  25360000
      DRIVER'STATE := REQUEST'COMPLETE;                                 25365000
                                                                        25370000
      RETURN;                                                           25375000
      END; << Of "if > then ..." >>                                     25380000
                                                                        25385000
   DIT'IMMEDIATE'MODE := ONE;          << Immediate reporting will  >>  25390000
                                       << be enabled.               >>  25395000
   IOQ'WAITCODE       := ABORT'IOQ'WAIT;                                25400000
   DRIVER'STATE       := INTERRUPT'WAIT;                                25405000
                                                                        25410000
   RETURN;                                                              25415000
   END; << Of "if IOQ'ABORT = ONE ..." >>                               25420000
$PAGE                                                                   25425000
<<====================================================>>                25430000
<<                                                    >>                25435000
<<          Current I/O aborted due to the DMA        >>       <<09421>>25440000
<<                                                    >>                25445000
<<====================================================>>                25450000
                                                                        25455000
IF CPVA'ERRORCODE = DMA'ABORT THEN     << DMA abort                 >>  25460000
   IF IOQ'RETRY'COUNT = RETRY'LIMIT THEN                                25465000
      BEGIN                            << Exit with a channel errer >>  25470000
                                                                        25475000
      IF DIT'DEV'NOT'RDY = ONE THEN                                     25480000
         BEGIN                                                          25485000
                                       << Schedule idle wait CP     >>  25490000
         CP'FIRST'BRANCH := ENTER'IDLE'WAIT;                            25495000
         IOQ'WAITCODE    := NOT'RDY'WAIT;                               25500000
                                                                        25505000
         IF SYSTEM'UP THEN                                              25510000
            LDEVNOTRDY(P'DIT);         << Not rdy msg to console    >>  25515000
         START'HPIB(P'DIT,SIOP,TRUE);                                   25520000
         IF > THEN                                                      25525000
            BEGIN                      << Exit with a SIO error     >>  25530000
            LOG'STATUS;                                                 25535000
            IOQ'STAT      := CHAN'PGM'FAILURE;                          25540000
            UPDATE'XFER'CNT;                                            25545000
            DRIVER'STATE  := REQUEST'COMPLETE;                          25550000
                                                                        25555000
            RETURN;                                                     25560000
            END; << Of "if > then ..." >>                               25565000
                                                                        25570000
         DRIVER'STATE := NOT'READY;                                     25575000
                                                                        25580000
         RETURN;                                                        25585000
         END << Of "if DIT'DEV'NOT'RDY = ONE ..." >>                    25590000
      ELSE                                                              25595000
         BEGIN                         << Exit with a channel errer >>  25600000
                                       << If not diag req log error >>  25605000
         IF NOT IOQ'DIAG THEN                                           25610000
            BEGIN                                                       25615000
            DIT'ERROR'STATUS := [8/2,8/DLOGERROR];                      25620000
            DIT'LOG'ERROR    := P'CPVA;                                 25625000
            DIT'SIOP'STOP    := GETDRT(DRTN,0) - (@SIOP + SYSDB);       25630000
            END;                                                        25635000
         P'CPVA       := ZERO;                                          25640000
         IOQ'STAT     := CHAN'IO'FAILURE;                               25645000
         UPDATE'XFER'CNT;                                               25650000
         DRIVER'STATE := REQUEST'COMPLETE;                              25655000
                                                                        25660000
         RETURN;                                                        25665000
         END; << Of else "if DIT'DEV'NOT'RDY = ONE ..." >>              25670000
      END  << Of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>              25675000
   ELSE                                                                 25680000
      BEGIN                            << Retry 7 times             >>  25685000
                                                                        25690000
      IOQ'RETRY'COUNT  := IOQ'RETRY'COUNT + ONE;                        25695000
      DIT'ERROR'STATUS := [8/2,8/DLOGERROR];                            25700000
      DIT'LOG'ERROR    := P'CPVA;                                       25705000
      DIT'SIOP'STOP    := GETDRT(DRTN,0) - (@SIOP + SYSDB);             25710000
      P'CPVA           := ZERO;                                         25715000
      CP'FIRST'BRANCH  := ENTER'SYNC'DSJ;                               25720000
      START'HPIB(P'DIT,SIOP,TRUE);                                      25725000
      IF > THEN                                                         25730000
         BEGIN                         << Exit with a SIO error     >>  25735000
         LOG'STATUS;                                                    25740000
         IOQ'STAT      := CHAN'PGM'FAILURE;                             25745000
         UPDATE'XFER'CNT;                                               25750000
         DRIVER'STATE  := REQUEST'COMPLETE;                             25755000
                                                                        25760000
         RETURN;                                                        25765000
         END; << Of "if < then ..." >>                                  25770000
                                                                        25775000
      IOQ'WAITCODE := SYNC'WAIT;                                        25780000
      DRIVER'STATE := INTERRUPT'WAIT;                                   25785000
                                                                        25790000
      RETURN;                                                           25795000
      END; << Of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>         25800000
$PAGE                                                                   25805000
<<====================================================>>                25810000
<<                                                    >>                25815000
<<      Current I/O aborted due to the Channel        >>       <<09421>>25820000
<<                                                    >>                25825000
<<====================================================>>                25830000
                                                                        25835000
IF CPVA'ERRORCODE = CHANNEL'ABORT THEN << Channel abort             >>  25840000
   IF IOQ'RETRY'COUNT = RETRY'LIMIT THEN                                25845000
      BEGIN                                                             25850000
                                                                        25855000
      IF DIT'DEV'NOT'RDY = ONE          OR                              25860000
         P'CPVA          = CPVA'TIMEOUT THEN                            25865000
                                                                        25870000
         BEGIN                                                          25875000
         IF FCODE = FC'REQ'LAST'STAT THEN                               25880000
            BEGIN                                                       25885000
                                       << Make word count           >>  25890000
            TRANSFER'COUNT := (TRANSFER'COUNT + 1D) / 2D;               25895000
                                                                        25900000
            TOS := BANK'N'BUFF'ADDR;   << User's area               >>  25905000
            TOS := ZERO;               << Describe area             >>  25910000
            TOS := @P'DIT + SYSDB + DSTATUS;                            25915000
            TOS := INTEGER(TRANSFER'COUNT); << #words to move       >>  25920000
            ASSEMBLE (MABS);                                            25925000
                                                                        25930000
                                       << Exit with a good transfer >>  25935000
            IOQ'STAT     := TIMEOUT'ERROR;                     <<f9010>>25940000
            IOQ'COUNT    := INTEGER(TRANSFER'COUNT);                    25945000
            DRIVER'STATE := REQUEST'COMPLETE;                           25950000
            P'CPVA       := 0;                                 <<f9010>>25955000
            CPVA'STATUS  := 0;                                 <<f9010>>25960000
                                                                        25965000
            RETURN;                                                     25970000
            END << Of "if FCODE = FC'REQ'LAST'STAT ..." >>              25975000
         ELSE                                                           25980000
            BEGIN                       << Schedule idle wait CP     >> 25985000
            CP'FIRST'BRANCH := ENTER'IDLE'WAIT;                         25990000
            IOQ'WAITCODE    := NOT'RDY'WAIT;                            25995000
                                                                        26000000
            IF SYSTEM'UP THEN                                           26005000
               LDEVNOTRDY(P'DIT);      << Not rdy msg to console    >>  26010000
            START'HPIB(P'DIT,SIOP(FIRSTBRANCH),TRUE);          <<f9010>>26015000
            IF > THEN                                                   26020000
               BEGIN                   << Exit with a SIO error     >>  26025000
               LOG'STATUS;                                              26030000
               IOQ'STAT     := CHAN'PGM'FAILURE;                        26035000
               UPDATE'XFER'CNT;                                         26040000
               DRIVER'STATE := REQUEST'COMPLETE;                        26045000
                                                                        26050000
               RETURN;                                                  26055000
               END; << Of "if > then ..." >>                            26060000
                                                                        26065000
            DRIVER'STATE := NOT'READY;                                  26070000
                                                                        26075000
            RETURN;                                                     26080000
            END; << Of "if FCODE = FC'REQ'LAST'STAT ..." >>             26085000
         END << Of "if DIT'DEV'NOT'RDY = ONE ..." >>                    26090000
      ELSE                                                              26095000
         BEGIN                         << Exit with a channel errer >>  26100000
                                       << If not diag req log error >>  26105000
         IF NOT IOQ'DIAG THEN                                           26110000
            BEGIN                                                       26115000
            DIT'ERROR'STATUS := [8/2,8/DLOGERROR];                      26120000
            DIT'LOG'ERROR    := P'CPVA;                                 26125000
            DIT'SIOP'STOP    := GETDRT(DRTN,0) - (@SIOP + SYSDB);       26130000
            END;                                                        26135000
         P'CPVA       := ZERO;                                          26140000
         IOQ'STAT     := CHAN'IO'FAILURE;                               26145000
         UPDATE'XFER'CNT;                                               26150000
         DRIVER'STATE := REQUEST'COMPLETE;                              26155000
                                                                        26160000
         RETURN;                                                        26165000
         END; << Of else "if DIT'DEV'NOT'RDY = ONE ..." >>              26170000
      END << Of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>               26175000
   ELSE                                                                 26180000
      BEGIN                                                             26185000
                                       << Retry 7 times             >>  26190000
      IOQ'RETRY'COUNT  := IOQ'RETRY'COUNT + ONE;                        26195000
      DIT'ERROR'STATUS := [8/2,8/DLOGERROR];                            26200000
      DIT'LOG'ERROR    := P'CPVA;                                       26205000
      DIT'SIOP'STOP    := GETDRT(DRTN,0) - (@SIOP + SYSDB);             26210000
      P'CPVA           := ZERO;                                         26215000
      CP'FIRST'BRANCH  := ENTER'SYNC'DSJ;                               26220000
      START'HPIB(P'DIT,SIOP,TRUE);                                      26225000
      IF > THEN                                                         26230000
         BEGIN                         << Exit with a SIO error     >>  26235000
         LOG'STATUS;                                                    26240000
         IOQ'STAT     := CHAN'PGM'FAILURE;                              26245000
         UPDATE'XFER'CNT;                                               26250000
         DRIVER'STATE := REQUEST'COMPLETE;                              26255000
                                                                        26260000
         RETURN;                                                        26265000
         END; << Of "if < then ..." >>                                  26270000
                                                                        26275000
      IOQ'WAITCODE := SYNC'WAIT;                                        26280000
      DRIVER'STATE := INTERRUPT'WAIT;                                   26285000
                                                                        26290000
      RETURN;                                                           26295000
      END; << Of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>         26300000
$PAGE                                                                   26305000
IF IOQ'SFAIL THEN                      << Failure on delayed start  >>  26310000
                                       << I/O                       >>  26315000
   BEGIN                               << Exit with a SIO error     >>  26320000
   LOG'STATUS;                                                          26325000
   IOQ'STAT     := CHAN'PGM'FAILURE;                                    26330000
   UPDATE'XFER'CNT;                                                     26335000
   DRIVER'STATE := REQUEST'COMPLETE;                                    26340000
                                                                        26345000
   RETURN;                                                              26350000
   END; << Of "if IOQ'SFAIL then ..." >>                                26355000
$PAGE                                                                   26360000
<<====================================================>>                26365000
<<                                                    >>                26370000
<<   I/O status interrogation completion              >>                26375000
<<                                                    >>                26380000
<<====================================================>>                26385000
                                                                        26390000
IF CPVA'STATUS = ONE THEN              << Status diagnosis          >>  26395000
   BEGIN                                                                26400000
                                                                        26405000
   CPVA'STATUS := ZERO;                                                 26410000
                                                                        26415000
   IF DIT'DEV'POWERFAIL = ONE THEN                                      26420000
      BEGIN                                                             26425000
                                                                        26430000
      CP'FIRST'BRANCH := ENTER'CHAN'CLEAR;                     <<09421>>26435000
                                       << Do the clear. unqueued    >>  26440000
                                       << STARTSIO                  >>  26445000
      START'HPIB(P'DIT,SIOP,FALSE);                                     26450000
      IF > THEN                                                         26455000
         BEGIN                         << Exit with a SIO error     >>  26460000
         LOG'STATUS;                                                    26465000
         IOQ'STAT     := CHAN'PGM'FAILURE;                              26470000
         UPDATE'XFER'CNT;                                               26475000
         DRIVER'STATE := REQUEST'COMPLETE;                              26480000
                                                                        26485000
         RETURN;                                                        26490000
         END; << OF "if > then ..." >>                                  26495000
                                                                        26500000
      DIT'IMMEDIATE'MODE := ONE;       << Immediate reporting will  >>  26505000
                                       << be enabled.               >>  26510000
      IOQ'WAITCODE       := CMPLTION'WAIT;                              26515000
      DRIVER'STATE       := INTERRUPT'WAIT;                             26520000
                                                                        26525000
      RETURN;                                                           26530000
      END; << Of "if DIT'DEV'POWERFAIL = ONE ..." >>                    26535000
$PAGE                                                                   26540000
                                       << Update last status        >>  26545000
   IF FCODE = FC'REQ'LAST'STAT THEN                                     26550000
      BEGIN                                                             26555000
                                       << Make word count           >>  26560000
      TRANSFER'COUNT := (TRANSFER'COUNT + 1D) / 2D;                     26565000
                                                                        26570000
      TOS := BANK'N'BUFF'ADDR;         << User's area               >>  26575000
      TOS := ZERO;                     << Describe area             >>  26580000
      TOS := @P'DIT + SYSDB + DSTATUS;                                  26585000
      TOS := INTEGER(TRANSFER'COUNT);  << #words to move            >>  26590000
      ASSEMBLE (MABS);                                                  26595000
                                                                        26600000
      IOQ'STAT     := GOOD'IO;         << Exit with a good transfer >>  26605000
      IOQ'COUNT    := INTEGER(TRANSFER'COUNT);                          26610000
      DRIVER'STATE := REQUEST'COMPLETE;                                 26615000
                                                                        26620000
      RETURN;                                                           26625000
      END; << Of "if FCODE = FC'REQ'LAST'STAT ..." >>                   26630000
$PAGE                                                                   26635000
   IF IOQ'DIAG THEN                    << Diagnostic completion     >>  26640000
      BEGIN                            << Exit with a diag completio>>  26645000
      IOQ'STAT     := READ'LAST'STAT;                                   26650000
      UPDATE'XFER'CNT;                                                  26655000
      DRIVER'STATE := REQUEST'COMPLETE;                                 26660000
                                                                        26665000
      RETURN;                                                           26670000
      END; << OF "if IOQ'DIAG then ..." >>                              26675000
$PAGE                                                                   26680000
   IF DIT'UNINIT'MEDIA = ONE THEN                                       26685000
      BEGIN                            << Exit with un-init media   >>  26690000
      LOG'STATUS;                                                       26695000
      IOQ'STAT     := UNINIT'MEDIA'ERR;                                 26700000
      UPDATE'XFER'CNT;                                                  26705000
      DRIVER'STATE := REQUEST'COMPLETE;                                 26710000
                                                                        26715000
      RETURN;                                                           26720000
      END; << Of "if DIT'UNINIT'METIA = ONE ..." >>                     26725000
$PAGE                                                                   26730000
   IF DIT'UNIT'ATTENTION <> %377 AND                                    26735000
      DIT'UNIT'ATTENTION <> %17  AND                                    26740000
      DIT'UNIT'ATTENTION <> ZERO THEN                                   26745000
                                                                        26750000
      BEGIN                            << Exit with a unit error    >>  26755000
      LOG'STATUS;                                                       26760000
      IOQ'STAT     := UNIT'FAILURE;                                     26765000
      UPDATE'XFER'CNT;                                                  26770000
      DRIVER'STATE := REQUEST'COMPLETE;                                 26775000
                                                                        26780000
      RETURN;                                                           26785000
      END; << Of "if DIT'UNIT'ATTENTION <> %377 ..." >>                 26790000
$PAGE                                                                   26795000
   IF DIT'CHAN'PARITY'ERR  = ONE OR                                     26800000
      DIT'ILL'OPCODE       = ONE OR                                     26805000
      DIT'MODULE'ADDR'ONE  = ONE OR                                     26810000
      DIT'PARAMETER'BOUND  = ONE OR                                     26815000
      DIT'ILL'PARAMETER    = ONE OR                                     26820000
      DIT'ILL'MSG'SEQ      = ONE OR                                     26825000
      DIT'MSG'LENGTH'ERR   = ONE OR                                     26830000
                                                                        26835000
      DIT'COPY'ERR         = ONE OR                                     26840000
      DIT'CONTROLLER'FAULT = ONE OR                                     26845000
      DIT'UNIT'FAULT       = ONE OR                                     26850000
      DIT'DIAG'FAIL        = ONE OR                                     26855000
      DIT'OPR'REL'REQ      = ONE OR                                     26860000
      DIT'DIAG'REL'REQ     = ONE OR                                     26865000
                                                                        26870000
      DIT'ILL'OPERATION    = ONE OR                                     26875000
      DIT'NO'DATA'FOUND    = ONE OR                                     26880000
      DIT'END'OF'FILE      = ONE THEN                                   26885000
                                                                        26890000
      IF IOQ'RETRY'COUNT = RETRY'LIMIT THEN                             26895000
                                       << Reached the retry limit.  >>  26900000
         BEGIN                         << Exit with a unit error    >>  26905000
         LOG'STATUS;                                                    26910000
         IOQ'STAT     := UNIT'FAILURE;                                  26915000
         UPDATE'XFER'CNT;                                               26920000
         DRIVER'STATE := REQUEST'COMPLETE;                              26925000
                                                                        26930000
         RETURN;                                                        26935000
         END  << Of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>           26940000
      ELSE                                                              26945000
         BEGIN                                                          26950000
         IOQ'RETRY'COUNT := IOQ'RETRY'COUNT + ONE;                      26955000
         IF DIT'ILL'MSG'SEQ = ONE AND                                   26960000
            IOQ'SYS'PFAIL   = ONE THEN                                  26965000
                                                                        26970000
            GOTO RETRY'REQUEST                                          26975000
         ELSE                                                           26980000
            BEGIN                                                       26985000
            LOG'STATUS;                                                 26990000
            GOTO RETRY'REQUEST;        << Retry status              >>  26995000
            END; << Of else "if DIT'ILL'MSG'SEQ = ONE ..." >>           27000000
         END; << Of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>      27005000
$PAGE                                                                   27010000
<<------------------------------------------------>>                    27015000
<<     Drive was write protected                  >>                    27020000
<<------------------------------------------------>>                    27025000
                                                                        27030000
   IF DIT'WRITE'PROTECT = ONE AND FCODE=FC'WRITE THEN          <<09574>>27035000
      BEGIN                                                             27040000
      IOQ'UNLOAD'RING     := ONE;                                       27045000
      CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                               27050000
      CP'DIAG'CDB'LENGTH  := TWO;      << Byte count                >>  27055000
      CP'DIAG'DSJ'PON := TWO;                                           27060000
      SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'SET'UNIT);                      27065000
      SIOP'BYTE(CDB'AREA'BYTE + 1 , CDB'UNLOAD);                        27070000
      CP'FIRST'BRANCH     := ENTER'DIAG;                                27075000
                                                                        27080000
      IF NOT IOMESSAGE(1,NO'WRITE'RING'MSG,%10000,DIT'LDEV,             27085000
                           ,,,,CONSOLE) THEN                            27090000
         BEGIN                         << Exit with a sys error     >>  27095000
         LOG'STATUS;                                                    27100000
         IOQ'STAT     := SYSTEM'ERROR;                                  27105000
         UPDATE'XFER'CNT;                                               27110000
         DRIVER'STATE := REQUEST'COMPLETE;                              27115000
                                                                        27120000
         RETURN;                                                        27125000
         END; << Of "if NOT IOMESSAGE(1,NO'WRITE'RING'MSG, ..." >>      27130000
                                                                        27135000
      P'CPVA := ZERO;                  << Clear channel status word >>  27140000
      DIT'TRANSFERED'COUNT := 0D;                              <<f9546>>27145000
      START'HPIB(P'DIT,SIOP,TRUE);                                      27150000
      IF > THEN                                                         27155000
         BEGIN                         << Exit with a SIO error     >>  27160000
         LOG'STATUS;                                                    27165000
         IOQ'STAT     := CHAN'PGM'FAILURE;                              27170000
         UPDATE'XFER'CNT;                                               27175000
         DRIVER'STATE := REQUEST'COMPLETE;                              27180000
                                                                        27185000
         RETURN;                                                        27190000
         END; << Of "if > then ..." >>                                  27195000
                                                                        27200000
      IOQ'WAITCODE := CMPLTION'WAIT;                                    27205000
      DRIVER'STATE := INTERRUPT'WAIT;                                   27210000
                                                                        27215000
      RETURN;                                                           27220000
      END  << Of "if DIT'WRITE'PROTECT = ONE ..." >>           <<09574>>27225000
      else dit'write'protect := 0;                             <<09574>>27230000
$PAGE                                                                   27235000
   IF DIT'RETRANSMIT = ONE THEN                                         27240000
      IF IOQ'RETRY'COUNT = RETRY'LIMIT THEN                             27245000
                                       << Reach the retry limit.    >>  27250000
         BEGIN                         << Exit with a unit error    >>  27255000
         LOG'STATUS;                                                    27260000
         IOQ'STAT     := UNIT'FAILURE;                                  27265000
         UPDATE'XFER'CNT;                                               27270000
         DRIVER'STATE := REQUEST'COMPLETE;                              27275000
                                                                        27280000
         RETURN;                                                        27285000
         END << Of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>            27290000
      ELSE                                                              27295000
         BEGIN                                                          27300000
         IOQ'RETRY'COUNT := IOQ'RETRY'COUNT + ONE;                      27305000
         GOTO RETRY'REQUEST;                                            27310000
         END; << Of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>      27315000
$PAGE                                                                   27320000
   IF DIT'SPARE'UNAVAIL = ONE THEN                                      27325000
      BEGIN                            << Exit with a no spare err  >>  27330000
      LOG'STATUS;                                                       27335000
      IOQ'STAT     := NO'SPARE'ERR;                                     27340000
      UPDATE'XFER'CNT;                                                  27345000
      DRIVER'STATE := REQUEST'COMPLETE;                                 27350000
                                                                        27355000
      RETURN;                                                           27360000
      END; << Of "if DIT'SPARE'UNAVAIL = ONE ..." >>                    27365000
$PAGE                                                                   27370000
   IF DIT'ADDR'BOUNDS   = ONE OR                                        27375000
      DIT'END'OF'VOLUME = ONE THEN                                      27380000
                                                                        27385000
      BEGIN                            << Exit with a invalid addr  >>  27390000
      LOG'STATUS;                                                       27395000
      IOQ'STAT     := INVALID'ADDR;                                     27400000
      UPDATE'XFER'CNT;                                                  27405000
      DRIVER'STATE := REQUEST'COMPLETE;                                 27410000
                                                                        27415000
      RETURN;                                                           27420000
      END; << Of "if DIT'ADDR'BOUNDS = ONE ..." >>                      27425000
$PAGE                                                                   27430000
<<---------------------------------------------------->>                27435000
<<   Release request/required handling:               >>                27440000
<<---------------------------------------------------->>                27445000
                                                                        27450000
   IF DIT'INT'MAINT'REQ   = ONE OR                                      27455000
      DIT'I'OPR'REL'REQ   = ONE OR                                      27460000
      DIT'I'DIAG'REL'REQ  = ONE OR                                      27465000
      DIT'I'INT'MAINT'REQ = ONE THEN                                    27470000
                                                                        27475000
      BEGIN                                                             27480000
      IF FCODE            = FC'LOC'N'VERIFY AND                         27485000
         DIT'UNRECOV'DATA = ONE THEN                                    27490000
                                                                        27495000
         BEGIN                                                          27500000
                                       << Return the bad block addr >>  27505000
         TOS := BANK'N'BUFF'ADDR;                                       27510000
         TOS := DIT'PARM'FIELD1;       << Bad blk address           >>  27515000
         TOS := DIT'PARM'FIELD2;                                        27520000
         ASSEMBLE (SDEA);                                               27525000
                                                                        27530000
         DIT'BAD'TRANSFER := ZERO;                                      27535000
         IOQ'VERIFY'ERR   := ONE;                                       27540000
         END; << Of 'if FCODE = FC'LOC'N'VERIFY ..." >>                 27545000
                                                                        27550000
      CP'DIAG'CMD'TO'EXEC := WRT'CMD'SEC;                               27555000
      CP'DIAG'CDB'LENGTH  := TWO;      << CDB byte count            >>  27560000
      SIOP'BYTE(CDB'AREA'BYTE + 0 , CDB'SET'UNIT + CTRL'UNIT);          27565000
<< If we grant Release then we set DIT'RELEASE'CMD := 2.>>              27570000
<< This way we know the Release command came from the   >>              27575000
<< Continuator section of the driver.  We would return below to >>      27580000
<< Retry'Release2 to resend the Release command.  Also , >>             27585000
<< if we do grant Release we change the value of CP'DIAG'DSJ'PON>>      27590000
<< to 19.  This is so we skip over the Power-On Channel Clear >>        27595000
<< if we get a QSTAT of 2 on our Release.  >>                           27600000
<< Otherwise, if we Deny Release, we set DIT'RELEASE'CMD = 0>>          27605000
<< and we reset CP'DIAG'DSJ'PON to its default value of 2.  >>          27610000
                                                                        27615000
         IF DIT'INT'MAINT'REQ   =  ONE OR                               27620000
            DIT'I'INT'MAINT'REQ =  ONE OR                               27625000
            DIT'I'DIAG'REL'REQ  =  ONE OR                               27630000
                                                                        27635000
            DIT'I'OPR'REL'REQ   =  ONE AND                              27640000
            DIT'DEV'NOT'RDY     =  ONE OR                               27645000
            DIT'I'OPR'REL'REQ   =  ONE AND                              27650000
            DIT'LOCK'FLG        <> ONE THEN                             27655000
               dit'release'cmd := 2                                     27660000
         ELSE                                                           27665000
               dit'release'cmd := 0;                                    27670000
        IF DIT'RELEASE'CMD = 2 THEN                                     27675000
        BEGIN                                                           27680000
           CP'DIAG'DSJ'PON := NINETEEN;                                 27685000
           SIOP'BYTE(CDB'AREA'BYTE + 1,CDB'RELEASE);                    27690000
        END                                                             27695000
        ELSE                                                            27700000
        BEGIN                                                           27705000
           CP'DIAG'DSJ'PON := TWO;                                      27710000
           SIOP'BYTE(CDB'AREA'BYTE + 1, CDB'RELEASE'DENY);              27715000
        END;                                                            27720000
                                                                        27725000
      IF DIT'I'OPR'REL'REQ = ONE THEN                                   27730000
         IOQ'OPER'REQ := ONE;                                           27735000
                                                                        27740000
      IF DIT'I'INT'MAINT'REQ = ONE THEN                                 27745000
         IOQ'IM'FAULT := ONE;                                           27750000
                                                                        27755000
      IF DIT'DEV'NOT'RDY = ONE THEN                                     27760000
         IOQ'MEDIA'LOAD := ONE;                                         27765000
RETRY'RELEASE2:                                                         27770000
      CP'FIRST'BRANCH := ENTER'DIAG;   << Schedule release          >>  27775000
      START'HPIB(P'DIT,SIOP,TRUE);     << or release deny           >>  27780000
      IF > THEN                                                         27785000
         BEGIN                         << Exit with a SIO error     >>  27790000
         IOQ'STAT     := CHAN'PGM'FAILURE;                              27795000
         LOG'STATUS;                                                    27800000
         UPDATE'XFER'CNT;                                               27805000
         DRIVER'STATE := REQUEST'COMPLETE;                              27810000
                                                                        27815000
         RETURN;                                                        27820000
         END; << Of "if > then ..." >>                                  27825000
                                                                        27830000
      IOQ'WAITCODE := REL'WAIT;                                         27835000
      DRIVER'STATE := INTERRUPT'WAIT;                                   27840000
                                                                        27845000
      RETURN;                                                           27850000
      END; << Of "if DIT'INT'MAINT'REQ = ONE ..." >>                    27855000
$PAGE                                                                   27860000
<<---------------------------------------------------->>                27865000
<<   Drive not ready - schedule idle CP until ready   >>                27870000
<<---------------------------------------------------->>                27875000
                                                                        27880000
   IF DIT'DEV'NOT'RDY = ONE          OR                                 27885000
      P'CPVA          = CPVA'TIMEOUT THEN                               27890000
                                                                        27895000
                                       << Inform user-NOTRDY        >>  27900000
      IF FCODE = FC'REQ'LAST'STAT THEN                                  27905000
         BEGIN                                                          27910000
                                       << Make word count           >>  27915000
         TRANSFER'COUNT := (TRANSFER'COUNT + 1D) / 2D;                  27920000
                                                                        27925000
         TOS := BANK'N'BUFF'ADDR;      << User's area               >>  27930000
         TOS := ZERO;                  << Describe area             >>  27935000
         TOS := @P'DIT + SYSDB + DSTATUS;                               27940000
         TOS := INTEGER(TRANSFER'COUNT); << #words to move          >>  27945000
         ASSEMBLE (MABS);                                               27950000
                                                                        27955000
         IOQ'STAT     := TIMEOUT'ERROR;                        <<f9010>>27960000
         IOQ'COUNT    := INTEGER(TRANSFER'COUNT);                       27965000
         DRIVER'STATE := REQUEST'COMPLETE;                              27970000
         P'CPVA       := 0;                                    <<f9010>>27975000
         CPVA'STATUS  := 0;                                    <<f9010>>27980000
                                                                        27985000
         RETURN;                                                        27990000
         END  << Of "if FCODE = FC'REQ'LAST'STAT ..." >>                27995000
      ELSE                                                              28000000
         BEGIN                                                          28005000
         DIT'TRANSFERED'COUNT := 0D;                           <<f9546>>28010000
         IOQ'WAITCODE    := NOT'RDY'WAIT;                               28015000
                                       << Schedule idle wait CP     >>  28020000
         CP'FIRST'BRANCH := ENTER'IDLE'WAIT;                            28025000
                                                                        28030000
         IF SYSTEM'UP THEN                                              28035000
            LDEVNOTRDY(P'DIT);         << Not rdy msg to console    >>  28040000
                                                                        28045000
         START'HPIB(P'DIT,SIOP(FIRSTBRANCH),TRUE);             <<f9010>>28050000
         IF > THEN                                                      28055000
            BEGIN                      << Exit with a SIO error     >>  28060000
            LOG'STATUS;                                                 28065000
            IOQ'STAT     := CHAN'PGM'FAILURE;                           28070000
            UPDATE'XFER'CNT;                                            28075000
            DRIVER'STATE := REQUEST'COMPLETE;                           28080000
                                                                        28085000
            RETURN;                                                     28090000
            END; << Of "if > then ..." >>                               28095000
                                                                        28100000
         DRIVER'STATE := NOT'READY;                                     28105000
                                                                        28110000
         RETURN;                                                        28115000
         END; << Of else "if FCODE = FC'REQ'LAST'STAT ..." >>           28120000
$PAGE                                                                   28125000
<<---------------------------------------------------->>                28130000
<<   Data not recoverable                             >>                28135000
<<---------------------------------------------------->>                28140000
                                                                        28145000
   IF DIT'DATA'OVERFLOW = ONE OR                                        28150000
      DIT'UNRECOV'DATA  = ONE THEN                                      28155000
                                                                        28160000
      BEGIN                                                             28165000
      DIT'ADDR1'BAD'BLOCK := DIT'PARM'FIELD1; << Bad blk address    >>  28170000
      DIT'ADDR2'BAD'BLOCK := DIT'PARM'FIELD2;                           28175000
                                          << Xfer left             >>   28180000
      DIT'BAD'TRANSFER    := CP'DXFER'DATA'SIZE;                        28185000
                                                                        28190000
      IF FCODE = FC'LOC'N'VERIFY THEN  << Verify function           >>  28195000
         BEGIN                                                          28200000
                                       << Return bad sector addr    >>  28205000
         TOS := BANK'N'BUFF'ADDR;                                       28210000
         TOS := DP'DIT(DBADBLK1);                                       28215000
         ASSEMBLE (SDEA);                                               28220000
         END;                                                           28225000
                                       << Exit with a Trk Sct err   >>  28230000
      LOG'STATUS;                                                       28235000
      IOQ'STAT     := TRACK'SECT'ERROR;                                 28240000
      UPDATE'XFER'CNT;                                                  28245000
      DRIVER'STATE := REQUEST'COMPLETE;                                 28250000
                                                                        28255000
      RETURN;                                                           28260000
      END;                                                              28265000
$PAGE                                                                   28270000
<<---------------------------------------------------->>                28275000
<<   Log informational status                         >>                28280000
<<---------------------------------------------------->>                28285000
                                                                        28290000
   IF DIT'MEDIA'WEAR'OUT   = ONE OR                                     28295000
      DIT'DEFECT'BLK'SPARE = ONE OR                                     28300000
      DIT'MARGINAL'DATA    = ONE OR                                     28305000
      DIT'NO'DATA'OVERFLOW = ONE OR                                     28310000
      DIT'RECOV'DATA       = ONE OR                                     28315000
      DIT'MAINT'TRACK      = ONE THEN                                   28320000
                                                                        28325000
      LOG'STATUS;                                                       28330000
$PAGE                                                                   28335000
<<---------------------------------------------------->>                28340000
<<   Maintenance trk ov - schedule logging process    >>                28345000
<<---------------------------------------------------->>                28350000
                                                                        28355000
   IF DIT'MAINT'TRACK = ONE THEN                                        28360000
      MAINT'REQUEST(DIT'LDEV,TYPE'BUFFALO,LPDT'SUBTYPE);                28365000
                                                                        28370000
   END; << Of 'if CPVA'STATUS = ONE...' >>                              28375000
$PAGE                                                                   28380000
<<====================================================>>                28385000
<<                                                    >>                28390000
<<   Power on/channel clear completion OR Abort IOQ   >>       <<09421>>28395000
<<                                                    >>                28400000
<<====================================================>>                28405000
                                                                        28410000
IF CPVA'STATUS = TWO OR    << PON - ck pend. int., redo IOQ >> <<09421>>28415000
   CPVA'STATUS = FIVE THEN << CHAN CLEAR - just redo IOQ.   >> <<09421>>28420000
   BEGIN                                                                28425000
   I := CPVA'STATUS;   << Temp -- may need it again shortly >> <<09421>>28430000
   CPVA'STATUS := ZERO;                                                 28435000
   IF ABORTING THEN RETURN;                                    <<J9110>>28440000
   IF IOQ'DIAG THEN                    << Diag request              >>  28445000
      BEGIN                            << Exit with a power on statu>>  28450000
      IOQ'STAT     := DEV'POWER'ON;                                     28455000
      UPDATE'XFER'CNT;                                                  28460000
      DRIVER'STATE := REQUEST'COMPLETE;                                 28465000
                                                                        28470000
      RETURN;                                                           28475000
      END;   << Of "if IOQ'DIAG then ..." >>                   <<09421>>28480000
<<  This is the same as in the Initator section except fo one >>        28485000
<< thing.  If DIT'RELEASE'CMD = 3 then we would goto Retry'Request>>    28490000
<< from the Continuator.   In this case, we need to keep track>>        28495000
<< of the IOQ'RETRY'COUNT or we may execute the Release many >>         28500000
<< times.       >>                                                      28505000
      IF CPVA'STATUS = TWO THEN                                         28510000
         IF DIT'RELEASE'CMD <> 0 THEN                                   28515000
            IF DIT'RELEASE'COUNT = 0 THEN                               28520000
               BEGIN                                                    28525000
               CPVA'STATUS := 0;                                        28530000
               DIT'RELEASE'COUNT := 1;                                  28535000
               IF DIT'RELEASE'CMD = 1 THEN                              28540000
                  GOTO RETRY'RELEASE1                                   28545000
                  ELSE IF DIT'RELEASE'CMD = 2 THEN                      28550000
                       GOTO RETRY'RELEASE2                              28555000
                       ELSE BEGIN                                       28560000
                            IF IOQ'RETRY'COUNT <> RETRY'LIMIT THEN      28565000
                               BEGIN                                    28570000
                               IOQ'RETRY'COUNT := IOQ'RETRY'COUNT +1;   28575000
                               GOTO RETRY'REQUEST;                      28580000
                               END;                                     28585000
                            END;                                        28590000
              END;                                                      28595000
      DIT'RELEASE'CMD := 0;                                             28600000
      DIT'RELEASE'COUNT := 0;                                           28605000
                                                                        28610000
   IF I = TWO THEN                                             <<09421>>28615000
      BEGIN   << Completed IOQ with PON, check/set PI, NR.  >> <<09421>>28620000
      IF NOT LOGICAL (DIT'LOCK'FLG) THEN                       <<09421>>28625000
         DIT'PENDING'INTERRUPT := TRUE;                        <<09421>>28630000
      DIT'NOT'RDY'EARLIER := FALSE;                            <<09421>>28635000
      END;    << Completed IOQ with PON, check/set PI, NR.  >> <<09421>>28640000
   IF IOQ'RETRY'COUNT = RETRY'LIMIT THEN                       <<09421>>28645000
      BEGIN                            << Exit with a power on statu>>  28650000
      IOQ'STAT     := DEV'POWER'ON;                                     28655000
      UPDATE'XFER'CNT;                                                  28660000
      DRIVER'STATE := REQUEST'COMPLETE;                                 28665000
                                                                        28670000
      RETURN;                                                           28675000
      END << Of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>               28680000
   ELSE                                                                 28685000
      BEGIN                                                             28690000
      IOQ'RETRY'COUNT := IOQ'RETRY'COUNT + ONE;                         28695000
      GOTO RETRY'REQUEST;                                               28700000
      END; << Of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>         28705000
   END;                                                                 28710000
$PAGE                                                                   28715000
<<====================================================>>                28720000
<<                                                    >>                28725000
<<   Problem interrogating status                     >>                28730000
<<                                                    >>                28735000
<<====================================================>>                28740000
                                                                        28745000
IF CPVA'STATUS = THREE THEN            << Retry once                >>  28750000
   BEGIN                                                                28755000
   CPVA'STATUS := ZERO;                                                 28760000
   IF IOQ'RSTAT'FAIL = ONE THEN                                         28765000
                                       << Retry failed              >>  28770000
      BEGIN                            << Exit with a unit error    >>  28775000
      LOG'STATUS;                                                       28780000
      IOQ'STAT     := UNIT'FAILURE;                                     28785000
      UPDATE'XFER'CNT;                                                  28790000
      DRIVER'STATE := REQUEST'COMPLETE;                                 28795000
                                                                        28800000
      RETURN;                                                           28805000
      END; << Of "if IOQ'RSTAT'FAIL = ONE ..." >>                       28810000
                                                                        28815000
   IOQ'RSTAT'FAIL  := ONE;                                              28820000
   CP'FIRST'BRANCH := ENTER'STAT'REQ;  << Retry read status        >>   28825000
   START'HPIB(P'DIT,SIOP,TRUE);                                         28830000
   IF > THEN                                                            28835000
      BEGIN                            << Exit with a SIO error     >>  28840000
      LOG'STATUS;                                                       28845000
      IOQ'STAT     := CHAN'PGM'FAILURE;                                 28850000
      UPDATE'XFER'CNT;                                                  28855000
      DRIVER'STATE := REQUEST'COMPLETE;                                 28860000
                                                                        28865000
      RETURN;                                                           28870000
      END; << Of "if > then ..." >>                                     28875000
                                                                        28880000
   DRIVER'STATE := INTERRUPT'WAIT;                                      28885000
                                                                        28890000
   RETURN;                                                              28895000
   END; << Of "if CPVA'STATUS = THREE ..." >>                           28900000
$PAGE                                                                   28905000
<<====================================================>>                28910000
<<                                                    >>                28915000
<<   Power on during the idle channel program         >>                28920000
<<                                                    >>                28925000
<<====================================================>>                28930000
                                                                        28935000
IF CPVA'STATUS = FOUR THEN             << Issue dev clr             >>  28940000
   BEGIN                                                                28945000
   CPVA'STATUS     := ZERO;                                             28950000
   IF NOT LOGICAL (DIT'LOCK'FLG) THEN                          <<09421>>28955000
      BEGIN   << Came on line unlocked, set for AVR.        >> <<09421>>28960000
      DIT'PENDING'INTERRUPT := TRUE;                           <<09421>>28965000
      DIT'RELEASE'GRANTED := FALSE;   << Got on line w/o it >> <<09421>>28970000
      END;    << Came on line unlocked, set for AVR.        >> <<09421>>28975000
   DIT'NOT'RDY'EARLIER := FALSE;   << It's READY now.       >> <<09421>>28980000
   CP'FIRST'BRANCH := ENTER'CHAN'CLEAR;                        <<09421>>28985000
                                       << Do the clear. unqueued    >>  28990000
                                       << STARTSIO                  >>  28995000
   START'HPIB(P'DIT,SIOP,FALSE);                                        29000000
   IF > THEN                                                            29005000
      BEGIN                            << Exit with a SIO error     >>  29010000
      LOG'STATUS;                                                       29015000
      IOQ'STAT     := CHAN'PGM'FAILURE;                                 29020000
      UPDATE'XFER'CNT;                                                  29025000
      DRIVER'STATE := REQUEST'COMPLETE;                                 29030000
                                                                        29035000
      RETURN;                                                           29040000
      END; << Of "if > then ..." >>                                     29045000
                                                                        29050000
   DIT'IMMEDIATE'MODE := ONE;          << Immediate reporting will  >>  29055000
                                       << be enabled.               >>  29060000
   IOQ'WAITCODE       := CMPLTION'WAIT;                                 29065000
   DRIVER'STATE       := INTERRUPT'WAIT;                                29070000
                                                                        29075000
   RETURN;                                                              29080000
   END; << Of "if CPVA'STATUS = FOUR ..." >>                            29085000
$PAGE                                                                   29090000
<<====================================================>>                29100000
<<                                                    >>                29105000
<<       Clear due to IOQ abort completion            >>                29110000
<<                                                    >>                29115000
<<====================================================>>                29120000
                                                                        29125000
IF IOQ'WAITCODE = ABORT'IOQ'WAIT THEN                                   29130000
   BEGIN                               << Exit with a good transfer >>  29135000
   IOQ'STAT     := GOOD'IO;                                             29140000
   UPDATE'XFER'CNT;                                                     29145000
   DRIVER'STATE := REQUEST'COMPLETE;                                    29150000
                                                                        29155000
   RETURN;                                                              29160000
   END; << Of "if IOQ'WAITCODE = ABORT'IOQ'WAIT ..." >>                 29165000
$PAGE                                                                   29170000
<<====================================================>>                29175000
<<                                                    >>                29180000
<<   Not ready completion                             >>                29185000
<<                                                    >>                29190000
<<====================================================>>                29195000
                                                                        29200000
IF IOQ'WAITCODE = NOT'RDY'WAIT THEN                                     29205000
   GOTO RETRY'REQUEST;                                                  29210000
$PAGE                                                                   29215000
<<====================================================>>                29220000
<<                                                    >>                29225000
<<   Release/release denied completion                >>                29230000
<<                                                    >>                29235000
<<====================================================>>                29240000
                                                                        29245000
IF IOQ'WAITCODE = REL'WAIT THEN                                         29250000
   BEGIN                                                                29255000
   IF IOQ'OPER'REQ   =  ONE LAND                                        29260000
      IOQ'MEDIA'LOAD <> ONE LAND                                        29265000
      DIT'LOCK'FLG   =  ONE THEN                                        29270000
                                                                        29275000
      BEGIN                                                             29280000
      IF NOT IOMESSAGE(1,NSYS'DENY'MSG,%10000,                          29285000
         DIT'LDEV,,,,,CONSOLE) THEN                                     29290000
                                                                        29295000
         BEGIN                         << Exit with a sys error     >>  29300000
         LOG'STATUS;                                                    29305000
         IOQ'STAT     := SYSTEM'ERROR;                                  29310000
         UPDATE'XFER'CNT;                                               29315000
         DRIVER'STATE := REQUEST'COMPLETE;                              29320000
                                                                        29325000
         RETURN;                                                        29330000
         END;                                                           29335000
      END; << Of "if IOQ'OPER'REQ = ONE ..." >>                         29340000
                                                                        29345000
   IF (FCODE = FC'INIT'MEDIA    OR                                      29350000
       FCODE = FC'LOC'N'VERIFY) AND                                     29355000
      IOQ'IM'FAULT <> ONE       THEN                                    29360000
                                                                        29365000
      BEGIN                                                             29370000
      IF FCODE          = FC'LOC'N'VERIFY AND                           29375000
         IOQ'VERIFY'ERR = ONE             THEN                          29380000
                                                                        29385000
         BEGIN                         << Exit with a Trk Sct error >>  29390000
         LOG'STATUS;                                                    29395000
         IOQ'STAT     := TRACK'SECT'ERROR;                              29400000
         UPDATE'XFER'CNT;                                               29405000
         DRIVER'STATE := REQUEST'COMPLETE;                              29410000
                                                                        29415000
         RETURN;                                                        29420000
         END << OF "if FCODE = FC'LOC'N'VERIFY ..." >>                  29425000
      ELSE                                                              29430000
         BEGIN                         << Exit with a good transfer >>  29435000
         IOQ'STAT     := GOOD'IO;                                       29440000
         UPDATE'XFER'CNT;                                               29445000
         DRIVER'STATE := REQUEST'COMPLETE;                              29450000
                                                                        29455000
         RETURN;                                                        29460000
         END; << Of else "if FCODE = FC'LOC'N'VERIFY ..." >>            29465000
      END; << Of "if (FCODE = FC'INIT'MEDIA ..." >>                     29470000
                                                                        29475000
   GOTO RETRY'REQUEST;                                                  29480000
   END; << Of "if IOQ'WAITCODE = REL'WAIT ..." >>                       29485000
$PAGE                                                                   29490000
<<====================================================>>                29495000
<<                                                    >>                29500000
<<           No write ring completion                 >>                29505000
<<                                                    >>                29510000
<<====================================================>>                29515000
                                                                        29520000
                                                                        29525000
IF IOQ'UNLOAD'RING <> ZERO THEN                                         29530000
   BEGIN                                                                29535000
   DIT'TRANSFERED'COUNT := 0D;                                 <<f9546>>29540000
   IOQ'UNLOAD'RING := ZERO;                                             29545000
   IOQ'STAT        := WRITE'RING'WAIT;                                  29550000
   DRIVER'STATE    := INTERRUPT'WAIT;                          <<f9546>>29555000
                                                                        29560000
   RETURN                                                               29565000
   END; << Of "if IOQ'UNLOAD'RING <> ZERO ..." >>                       29570000
$PAGE                                                                   29575000
<<====================================================>>                29580000
<<                                                    >>                29585000
<<   Driver/firmware synchronization completion       >>                29590000
<<                                                    >>                29595000
<<====================================================>>                29600000
                                                                        29605000
IF IOQ'WAITCODE = SYNC'WAIT THEN                                        29610000
   GOTO RETRY'REQUEST;                                                  29615000
$PAGE                                                                   29620000
<<====================================================>>                29625000
<<                                                    >>                29630000
<<   Function dependencies completion                 >>                29635000
<<                                                    >>                29640000
<<====================================================>>                29645000
                                                                        29650000
<<---------------------------------------------------->>                29655000
<<   Return the device status.                        >>                29660000
<<---------------------------------------------------->>                29665000
                                                                        29670000
IF FCODE = FC'REQ'LAST'STAT THEN                                        29675000
   BEGIN                                                                29680000
                                       << Make word count           >>  29685000
   TRANSFER'COUNT := (TRANSFER'COUNT + 1D) / 2D;                        29690000
                                                                        29695000
   TOS := BANK'N'BUFF'ADDR;            << User's area               >>  29700000
   TOS := ZERO;                        << Describe area             >>  29705000
   TOS := @P'DIT + SYSDB + DSTATUS;                                     29710000
   TOS := INTEGER(TRANSFER'COUNT);     << #words to move            >>  29715000
   ASSEMBLE (MABS);                                                     29720000
                                                                        29725000
   IOQ'STAT     := GOOD'IO;            << Exit with a good transfer >>  29730000
   IOQ'COUNT    := INTEGER(TRANSFER'COUNT);                             29735000
   DRIVER'STATE := REQUEST'COMPLETE;                                    29740000
                                                                        29745000
   RETURN;                                                              29750000
   END; << Of "if FCODE = FC'REQ'LAST'STAT ..." >>                      29755000
$PAGE                                                                   29760000
<<---------------------------------------------------->>                29765000
<<   Return the volume limit or all describe bytes    >>       <<f9442>>29770000
<<---------------------------------------------------->>                29775000
                                                                        29780000
IF FCODE = FC'REQ'VOL'LIMIT THEN                                        29785000
   IF P'IOQ  <> 0 THEN                                         <<f9442>>29790000
   IF INTEGER(IOQ'FUNC) <> 78 THEN                             <<f9442>>29795000
   BEGIN                                                                29800000
                                       << Return the volume limit   >>  29805000
   TOS := BANK'N'BUFF'ADDR;                                             29810000
   TOS := SIOP(VOLUME'LIMIT + 1);      << Volume limit              >>  29815000
   TOS := SIOP(VOLUME'LIMIT + TWO);                                     29820000
   ASSEMBLE (SDEA);                    << Store dbl word            >>  29825000
                                                                        29830000
                                       << Exit with a good transfer >>  29835000
   IOQ'STAT     := GOOD'IO;                                             29840000
   IOQ'COUNT    := TWO;                                                 29845000
   DRIVER'STATE := REQUEST'COMPLETE;                                    29850000
                                                                        29855000
   RETURN;                                                              29860000
   END                                                         <<f9442>>29865000
                                                               <<f9442>>29870000
   ELSE                             << function code is 78 >>  <<f9442>>29875000
   BEGIN                                                       <<f9442>>29880000
                                    << make word count     >>  <<f9442>>29885000
$PAGE                                                                   29890000
   TRANSFER'COUNT := (TRANSFER'COUNT + 1D) /2D;                <<f9442>>29895000
   TOS := BANK'N'BUFF'ADDR;             << User's area     >>  <<f9442>>29900000
   TOS := ZERO;                                                <<f9442>>29905000
   TOS := @SIOP + SYSDB + DESC'AREA;    << Describe area   >>  <<f9442>>29910000
   TOS := INTEGER(TRANSFER'COUNT);      << #words to move  >>  <<f9442>>29915000
   ASSEMBLE (MABS);                     << Store desc.bytes>>  <<f9442>>29920000
                                                               <<f9442>>29925000
                                        <<Exit w/good trans>>  <<f9442>>29930000
   IOQ'STAT     := GOOD'IO;                                    <<f9442>>29935000
   IOQ'COUNT    := INTEGER(TRANSFER'COUNT);                    <<f9442>>29940000
   DRIVER'STATE := REQUEST'COMPLETE;                           <<f9442>>29945000
                                                               <<f9442>>29950000
   RETURN;                                                     <<f9442>>29955000
   END                                                         <<f9442>>29960000
                                                               <<f9442>>29965000
   ELSE                                                        <<f9442>>29970000
   BEGIN                                                       <<f9442>>29975000
                                                               <<f9442>>29980000
   IOQ'STAT       := INVALID'REQUEST;                          <<f9442>>29985000
   IOQ'COUNT      := ZERO;                                     <<f9442>>29990000
   DRIVER'STATE   := REQUEST'COMPLETE;                         <<f9442>>29995000
                                                               <<f9442>>30000000
   RETURN;                                                     <<f9442>>30005000
   END; << Of "if FCODE = FC'REQ'VOL'LIMIT . . ." >>           <<f9442>>30010000
$PAGE                                                          <<f9442>>30015000
<<---------------------------------------------------->>                30020000
<<   Return the HP-IB Identify code                   >>                30025000
<<---------------------------------------------------->>                30030000
                                                                        30035000
IF FCODE = FC'IDENTIFY THEN                                             30040000
   BEGIN                                                                30045000
                                       << Return the device's id    >>  30050000
   TOS := BANK'N'BUFF'ADDR;                                             30055000
   TOS := CP'IDENT'HPIB'ID;            << Device id                 >>  30060000
   ASSEMBLE(SSEA);                                                      30065000
                                                                        30070000
                                       << Exit with a good transfer >>  30075000
   IOQ'STAT     := GOOD'IO;                                             30080000
   IOQ'COUNT    := ONE;                                                 30085000
   DRIVER'STATE := REQUEST'COMPLETE;                                    30090000
                                                                        30095000
   RETURN;                                                              30100000
   END; << Of "if FCODE = FC'IDENTIFY ..." >>                           30105000
$PAGE                                                                   30110000
<<---------------------------------------------------->>                30115000
<<   Return good status that parity was set.          >>                30120000
<<---------------------------------------------------->>                30125000
                                                                        30130000
IF FCODE = FC'PARITY'CHECK THEN                                         30135000
   BEGIN                                                                30140000
                                                                        30145000
   CP'DIAG'WAIT'5 := WAIT'INSTR;       << Reset the wait instr.     >>  30150000
   CP'DIAG'WAIT'6 := ZERO;                                              30155000
                                                                        30160000
   IOQ'STAT       := GOOD'IO;          << Exit with a good transfer >>  30165000
   IOQ'COUNT      := ONE;                                               30170000
   DRIVER'STATE   := REQUEST'COMPLETE;                                  30175000
                                                                        30180000
   RETURN;                                                              30185000
   END; << Of "if FCODE = FC'IDENTIFY ..." >>                           30190000
$PAGE                                                                   30195000
IF FCODE = FC'UNLOAD'CART    OR                                         30200000
   FCODE = FC'INIT'SELFTEST  OR                                         30205000
   FCODE = FC'RELEASE        OR                                         30210000
   FCODE = FC'RELEASE'DENIED OR                                         30215000
   FCODE = FC'SET'RELEASE    OR                                         30220000
   FCODE = FC'SET'ADDRESS    OR                                         30225000
   FCODE = FC'SPARE'BLOCK    OR                                         30230000
   FCODE = FC'DEVICE'CLEAR   OR                                         30235000
   FCODE = FC'CANCEL'TRAN    THEN                                       30240000
                                                                        30245000
   BEGIN                                                                30250000
                                       << Exit with a good transfer >>  30255000
   IOQ'STAT     := GOOD'IO;                                             30260000
   IOQ'COUNT    := ZERO;                                                30265000
   DRIVER'STATE := REQUEST'COMPLETE;                                    30270000
                                                                        30275000
   RETURN;                                                              30280000
   END  << Of "if FCODE = FC'INIT'SELFTEST ..." >>                      30285000
ELSE                                                                    30290000
   BEGIN                                                                30295000
                                       << Exit with a good transfer >>  30300000
   IOQ'STAT     := GOOD'IO;                                             30305000
   UPDATE'XFER'CNT;                                                     30310000
   DRIVER'STATE := REQUEST'COMPLETE;                                    30315000
                                                                        30320000
   RETURN;                                                              30325000
   END; << Of else "if FCODE = FC'INIT'SELFTEST ..." >>                 30330000
                                                                        30335000
END; << Of the CS'80 disc driver >>                                     30340000
$PAGE "   HP9144 driver - outer block"                         <<09421>>30345000
ASSEMBLE(                                                               30350000
   PCAL SIODM;          << Monitor               >>                     30355000
   PCAL MERLIN'DRIVER; << Initiator             >>                      30360000
   PCAL MERLIN'DRIVER; << Completor             >>                      30365000
   CON  ZERO;           << No I/O process        >>                     30370000
   PCAL MERLIN'INIT;   << Initialization        >>                      30375000
   CON  ONE;            << One interrupt handler >>                     30380000
   PCAL GIP'HPIB);      << Interrupt handler     >>                     30385000
END.                                                                    30390000
