$SET X8=ON                                                              00005000
<< hioctap1 - module 45        >>                                       00010000
<< hp32033c mpe source e.00.01 >>                                       00015000
<< COPYRIGHT     "(C) copyright HEWLETT-PACKARD co. 1980.           >>  00020000
<<     this program may be used with one computer system at a       >>  00025000
<<     time and shall not otherwise be recorded, transmitted or     >>  00030000
<<     stored in a retrieval system.  copying or other reproduction >>  00035000
<<     of this program except for archival purposes is prohibited   >>  00040000
<<     without the prior written consent of hewlett-packard company.>>  00045000
<< **** note - dollar copyright cannot be used with this module *** >>  00050000
                                                                        00055000
$control privileged, uncallable, map, code, list, uslinit               00060000
$title "CS'80 BUFFALO DRIVER - HPIB"                                    00065000
$tp                                                                     00070000
<<********************************************************************  00075000
                                                                        00080000
======================================================================  00085000
|                       change history                               |  00090000
| author           date              brief description               |  00095000
|--------------------------------------------------------------------|  00100000
|                                                                    |  00105000
|satish janardan  2/10/84  create the buffalo driver.                |  00110000
|                                                                    |  00115000
|frank weger      7/18/84  initialization and fcode 91 changes.      |  00120000
|                                                                    |  00125000
|                                                                    |  00130000
|                                                                    |  00135000
|                                                                    |  00140000
|                                                                    |  00145000
|                                                                    |  00150000
|                                                                    |  00155000
|                                                                    |  00160000
|                                                                    |  00165000
======================================================================  00170000
$page                                                                   00175000
                                                                        00180000
                               table of contents                        00185000
                                                                        00190000
1  product identification                                               00195000
   1.1  product name, mnemonic, and project number                      00200000
   1.2  project personnel                                               00205000
   1.3  project documents                                               00210000
                                                                        00215000
2  driver design                                                        00220000
   2.1  design approach                                                 00225000
   2.2  major modules                                                   00230000
   2.3  driver creation                                                 00235000
   2.4  procedure interface                                             00240000
        2.4.1  buffalo'init                                             00245000
        2.4.2  buffalo'driver                                           00250000
   2.5  procedure overview                                              00255000
        2.5.1  buffalo'init                                             00260000
        2.5.2  buffalo'driver                                           00265000
        5.5.3  external procedures                                      00270000
   2.6  procedure processing                                            00275000
        2.6.1  buffalo'init                                             00280000
        2.6.2  buffalo'driver                                           00285000
               2.6.2.1  driver initiator section                        00290000
               2.6.2.2  driver completor section                        00295000
               2.6.2.3  immediate report                                00300000
               2.6.2.4  individual command processing                   00305000
               2.6.2.5  buffalo'driver flow diagram                     00310000
               2.6.2.6  request processing                              00315000
               2.6.2.7  non-supported functions                         00320000
                                                                        00325000
3  major data structures                                                00330000
   3.1  device reference table (drt)                                    00335000
   3.2  device information table (dit)                                  00340000
   3.3  interrupt linkage table (ilt)                                   00345000
   3.4  i/o queue request table (ioq)                                   00350000
                                                                        00355000
4  ioq i/o status                                                       00360000
                                                                        00365000
5  generic status layout                                                00370000
                                                                        00375000
6  cs/80 device status                                                  00380000
                                                                        00385000
7  release considerations                                               00390000
                                                                        00395000
8  lock/unlock considerations                                           00400000
   8.1  private volumes                                                 00405000
   8.2  serial and foreign volumes                                      00410000
                                                                        00415000
9  logging considerations                                               00420000
                                                                        00425000
10 unexpected interrupts handling                                       00430000
                                                                        00435000
11 status considerations                                                00440000
                                                                        00445000
12 driver schedule                                                      00450000
                                                                        00455000
$page                                                                   00460000
1  product identification                                               00465000
                                                                        00470000
                                                                        00475000
 1.1  product name    :  hioctap1 - mpe i/o cartridge tape              00480000
                                            driver (hp-ib)              00485000
      product mnemonic:  buffalo                                        00490000
      project number  :  4083                                           00495000
                                                                        00500000
                                                                        00505000
 1.2  project personnel                                                 00510000
                                                                        00515000
      project manager - rich pearson                                    00520000
      product manager - kathyrn hoshor                                  00525000
      mts             - satish janardan                                 00530000
                                                                        00535000
                                                                        00540000
 1.3  project documents                                                 00545000
                                                                        00550000
      the buffalo book                - greeley division                00555000
      cs/80 instruction set           - hp part #5955-3442              00560000
      buffalo investigation report    - computer systems division       00565000
      buffalo external specifications - computer systems division       00570000
                                                                        00575000
                                                                        00580000
$page                                                                   00585000
2  driver design                                                        00590000
                                                                        00595000
                                                                        00600000
 2.1  design approach                                                   00605000
                                                                        00610000
      hioctap1 will be a modified version of the hioctap0  (linus)      00615000
      driver.  requirements of these drivers are basically the same.    00620000
      the difference is the addition of immediate report for buffalo.   00625000
      modifications will be to the extent of utilizing the maximum      00630000
      performance which the buffalo drive can provide.  these           00635000
      modifications will include changes to insure the driver is        00640000
      well structured and maintainable.                                 00645000
                                                                        00650000
 2.2  major modules                                                     00655000
                                                                        00660000
      The driver consists of a global area, a linkage area "outer       00665000
      block" for INITIAL, and two procedures (BUFFALO'INIT and          00670000
      buffalo'driver) which initialize and process requests for         00675000
      particular operations from the device.                            00680000
                                                                        00685000
                                                                        00690000
 2.3  driver creation                                                   00695000
                                                                        00700000
      at system start-up, the driver is created by progen.  after system00705000
      start-up, the input/output device monitor (siodm) is the creator  00710000
      of the driver.                                                    00715000
                                                                        00720000
      siodm is invoked through the attachio process.  during            00725000
      interrupt processing the driver is executed on the interrupt      00730000
      control stack (ics).  other processing is performed on the stack  00735000
      of the process which invoked the driver.                          00740000
                                                                        00745000
      for user processes, the driver is invoked through the             00750000
      following processes.  the file system creates the initial         00755000
      request and calls attachio.  attachio creates the appropriate     00760000
      request in the input/output queue table (ioq).  attachio then     00765000
      calls the serial disc interface (sdiscio) which fills in          00770000
      various elements of the ioq entry for the request.  sdiscio       00775000
      then calls attachio again which in turn calls the input/output    00780000
      device monitor (siodm).  siodm freezes the data segment (if any)  00785000
      up appropriate information in the ioq and creates a channel       00790000
      program to satisfy the request and sends it to the device.        00795000
                                                                        00800000
      when the device completes the request, an interrupt is generated  00805000
      which invokes the general interrupt processor (gip).  gip then    00810000
      calls attachio which in turn calls siodm.  siodm calls the driver.00815000
      the driver checks for success or failure, marks the appropriate   00820000
      status and returns to siodm.  siodm unfreezes the data segment and00825000
      returns to sdiscio, which returns to attachio, which returns to   00830000
      the file system.                                                  00835000
                                                                        00840000
      the file system processing can be bypassed by calling attachio    00845000
      directly.                                                         00850000
                                                                        00855000
$page                                                                   00860000
 2.4  procedure interface                                               00865000
                                                                        00870000
                                                                        00875000
  2.4.1  buffalo'init                                                   00880000
                                                                        00885000
         a single parameter is passed to buffalo'init when called.      00890000
         this is a pointer to the device information table (dit)  entry 00895000
         for this particular device.                                    00900000
                                                                        00905000
                                                                        00910000
  2.4.2  buffalo'driver                                                 00915000
                                                                        00920000
         there are six parameters passed to buffalo'driver.  the first  00925000
         parameter passed is the index to the input/output queue table  00930000
         (ioq) entry for the current request.  ioq elements contain     00935000
         information relevant to the current request.                   00940000
                                                                        00945000
         the second parameter is a pointer to the device information    00950000
         table (dit)  entry.  dit elements contain information about its00955000
         associated device.  this is information which must be saved    00960000
         between i/o requests to the driver.  there is one dit entry per00965000
         physical device on the controller.                             00970000
                                                                        00975000
         the third and fourth parameters make up the absolute memory    00980000
         location of the data segment associated with the request.  the 00985000
         third parameter is the memory bank where the data is to be     00990000
         written to or read from by the device.  the fourth parameter is00995000
         the offset within the memory bank (memory address) where the   01000000
         data is to be written to or read from.                         01005000
                                                                        01010000
         the fifth parameter passed is a pointer to the channel program.01015000
         the channel program is actually a part of the interrupt linkage01020000
         table (ilt)  entry for the device controller.  there is one ilt01025000
         entry per device controller.  this entry stores information    01030000
         concerning the device controller and the channel program or the01035000
         device.                                                        01040000
                                                                        01045000
         the last parameter passed is a pointer to the device reference 01050000
         table (drt)  entry.  this entry contains information for       01055000
         processing hardware interrupts.  there is one drt entry per    01060000
         device controller.                                             01065000
                                                                        01070000
                                                                        01075000
$page                                                                   01080000
 2.5  procedure overview                                                01085000
                                                                        01090000
                                                                        01095000
  2.5.1  buffalo'init                                                   01100000
                                                                        01105000
         buffalo'init is responsible for performing a device clear to   01110000
         reset the device to a known state if this has not been already 01115000
         done.  it places the device into the immediate report enabled  01120000
         state (default).  it also initializes portions of the channel  01125000
         program for later use by buffalo'driver.                       01130000
                                                                        01135000
                                                                        01140000
  2.5.2  buffalo'driver                                                 01145000
                                                                        01150000
         buffalo'driver is the main procedure for the driver.  this     01155000
         procedure is responsible for initiating and completing i/o     01160000
         requests against the device.  buffalo'driver is always called  01165000
         by the i/o device monitor siodm.                               01170000
                                                                        01175000
         buffalo'driver determines the reason for the call by examining 01180000
         the ioq entry for the request and the dit entry.  when a new   01185000
         request is initiated, buffalo'driver examines the function code01190000
         and parameter fields contained in the ioq to determine what    01195000
         operation is to be performed.  the proper command codes and    01200000
         program branches are then placed in the channel program and its01205000
         execution is begun with a call to the external procedure       01210000
         start'hpib.                                                    01215000
                                                                        01220000
         upon completion of the request, an interrupt is generated and  01225000
         buffalo'driver is again called.  the driver checks for current 01230000
         activity in progress, and this being the case, transfers to the01235000
         completion section of the driver.  the completion section      01240000
         examines the device status words returned by the channel       01245000
         program for errors or special conditions which might data      01250000
         transfer, or the operation of the device.  these conditions can01255000
         cause error retries and/or special notation back to the caller.01260000
                                                                        01265000
                                                                        01270000
$page                                                                   01275000
  2.5.3  external procedures                                            01280000
                                                                        01285000
         the following is a brief description of the external procedures01290000
         called by the driver.                                          01295000
                                                                        01300000
         gip'hpib is a procedure that handles all general interrupt     01305000
         processing.                                                    01310000
                                                                        01315000
         iomessage is a procedure used for sending messages to the      01320000
         console.                                                       01325000
                                                                        01330000
         siodm is the procedure known as the i/o device monitor process.01335000
         this procedure is the process by which an i/o driver is        01340000
         activated.                                                     01345000
                                                                        01350000
         start'hpib is the procedure that starts channel program        01355000
         processing.                                                    01360000
                                                                        01365000
         maint'request sends an inter-process communication message to  01370000
         iomessage to perform maintenance processing on the device.     01375000
                                                                        01380000
         ldevnotrdy calls a procedure to print a device not ready       01385000
         message on the console.                                        01390000
                                                                        01395000
         getdrt is a procedure that returns the value of a specified    01400000
         word in the device reference table entry for the device.       01405000
                                                                        01410000
                                                                        01415000
$page                                                                   01420000
 2.6  procedure processing                                              01425000
                                                                        01430000
                                                                        01435000
  2.6.1  buffalo'init                                                   01440000
                                                                        01445000
         external interrupts are disabled to allow buffalo'init to run  01450000
         to completion.                                                 01455000
                                                                        01460000
         buffalo'init next aquires the pointer to the ilt array from the01465000
         dit array.  from the ilt array, pointers to the channel program01470000
         and channel program status area are acquired.                  01475000
                                                                        01480000
         if the sysglob powerfail word is not zero, the initialized flag01485000
         is set to true, and the device is in the immediate report state01490000
         (driver default), no further processing is performed.          01495000
                                                                        01500000
         the lock flag is set to true if the device is not a private    01505000
         volume and a foreign or serial disc has not been logically and 01510000
         physically mounted.  if the lock flag is set to true, any      01515000
         operator request for release will not be processed without the 01520000
         device being properly unlocked.  buffalo'init then initializes 01525000
         various parts of the channel perform a device clear on the     01530000
         device and enable immediate report.  the initialized flag is   01535000
         then set to true to inhibit any further buffalo'init processing01540000
         except where it is appropriately desired.                      01545000
                                                                        01550000
                                                                        01555000
  2.6.2  buffalo'driver                                                 01560000
                                                                        01565000
                                                                        01570000
   2.6.2.1  driver initiator section                                    01575000
                                                                        01580000
            this section is responsible for validating a new request and01585000
            issuing the channel program for execution of the request.   01590000
                                                                        01595000
                                                                        01600000
   2.6.2.2  driver completor section                                    01605000
                                                                        01610000
            this section is responsible for checking the success or     01615000
            failure of a completed request, logging any device errors,  01620000
            and informing the calling process of the success or failure 01625000
            of the request (through the ioq).                           01630000
                                                                        01635000
                                                                        01640000
$page                                                                   01645000
   2.6.2.3  immediate report                                            01650000
                                                                        01655000
            immediate report allows one command to be actively          01660000
            processing while other commands are queued and readied for  01665000
            execution within the same controller.  the use of immediate 01670000
            report can significantly contribute to performance          01675000
            improvement since the time spent executing the first command01680000
            is overlapped with the setup of the next command.           01685000
                                                                        01690000
            immediate report is used only for write requests.  the      01695000
            device will respond with a success status immediately after 01700000
            the dma transfer from memory to the device's internal buffer01705000
            is complete.  this allows another dma transfer to be sent to01710000
            the device while the device is transfering the data from the01715000
            internal buffer to tape.                                    01720000
                                                                        01725000
            if immediate report is disabled, any failures of a request  01730000
            will be reported back to the user in the status area for    01735000
            that request.                                               01740000
                                                                        01745000
            if immediate report is enabled, any failure of a transfer of01750000
            data from the internal buffer to tape may not be reported   01755000
            immediately.  the user will be informed that the transfer   01760000
            was successful upon completion of the transfer from memory  01765000
            to the device's internal buffer.  if the device fails to    01770000
            write the data to tape, the failure may that is, since it is01775000
            possible to submit multiple dma transfers to the device's   01780000
            buffer successfully before a prior one has been completely  01785000
            transferred to the tape, the failure may be indicated in the01790000
            status of a request submitted after the original failure.   01795000
                                                                        01800000
            with immediate report enabled, the user must check status   01805000
            from the last rewind, close file, or close device.  this is 01810000
            necessary to ensure that the last write performed was       01815000
            successful when transferred from the internal buffer to the 01820000
            tape.  users who do not adhear to this run the risk of      01825000
            missing a failure status for the last record transferred to 01830000
            tape.                                                       01835000
                                                                        01840000
                                                                        01845000
$page                                                                   01850000
   2.6.2.4  individual command processing                               01855000
                                                                        01860000
            each request will be processed through the initiator section01865000
            and completor section of buffalo'driver.  the initiator     01870000
            section is responsible for validating new requests.  if the 01875000
            request is new and has not been initiated, this section     01880000
            creates the channel program necessary to initiate and       01885000
            execute the request and exits.  the channel program is      01890000
            started with a call to the external procedure start'hpib.   01895000
                                                                        01900000
            the completor section of buffalo'driver is responsible for  01905000
            determining the success or failure of the request.  success 01910000
            or failure is determined by checking the qstat returned from01915000
            the report phase of a request.  if qstat is zero the request01920000
            completed successfully.  the i/o status for the request is  01925000
            marked as such and buffalo'driver exits.  a qstat of one    01930000
            indicates failure of the request.  the completor section    01935000
            logs the device status values in the dit, interrogates the  01940000
            device status to determine the specific reason for the      01945000
            failure, places the appropriate error status in the i/o     01950000
            status for the error and exits.                             01955000
                                                                        01960000
            a qstat of two indicates a device power failure occured.    01965000
            any request which has been initiated but not completed will 01970000
            have a powerfail status placed in the i/o status for the    01975000
            request.                                                    01980000
                                                                        01985000
            with immediate report enabled, the errors may not be        01990000
            reported back in the same ioq that requested the write.     01995000
                                                                        02000000
                                                                        02005000
$page                                                                   02010000
   2.6.2.5  buffalo'driver flow diagram                                 02015000
                                                                        02020000
      initialize local variables.                                       02025000
        |                                                               02030000
        |                no                                             02035000
      device initialized ---> call buffalo'init                         02040000
        |yes                    |                                       02045000
        |<----------------------|                                       02050000
        |              no                                               02055000
      another request? ---> execute idle ---> set driver state.         02060000
        |yes                channel program.      exit.                 02065000
        |                                                               02070000
        |           yes                                                 02075000
      system abort? ---> execute device ---> set                        02080000
        |no              clear channel       driver                     02085000
        |                program.            state.                     02090000
        |                                    exit.                      02095000
        |                                                               02100000
        |               yes                                             02105000
      device powerfail? ---> go process'completor.                      02110000
        |no                                                             02115000
        |          no                                                   02120000
      new request? ---> go process'completor.                           02125000
        |yes                                                            02130000
        |            no                                                 02135000
      request valid? ---> go process'completor.                         02140000
        |yes                                                            02145000
        |                                                               02150000
      execute channel                                                   02155000
      program for                                                       02160000
      request processing.                                               02165000
        |                                                               02170000
        |                                                               02175000
      set driver state.                                                 02180000
      exit.                                                             02185000
                                                                        02190000
                                                                        02195000
      process'completor                                                 02200000
        |                                                               02205000
        |                                                               02210000
      log device status.                                                02215000
      set request status.                                               02220000
      set driver state.                                                 02225000
      exit.                                                             02230000
                                                                        02235000
                                                                        02240000
$page                                                                   02245000
   2.6.2.6  request processing                                          02250000
                                                                        02255000
            the following is a description of how the driver will       02260000
            process each individual function when requested.            02265000
                                                                        02270000
            the device recognizes byte transfers only, therefore, if the02275000
            ioq transfer count is in words, the driver will convert it  02280000
            to bytes when sent to the device.  a positive transfer count02285000
            indicates a word transfer.  a negative transfer count       02290000
            indicates a byte transfer.                                  02295000
                                                                        02300000
            any request that transfers more than 6144  bytes of data    02305000
            from or to the device will be processed in multiple         02310000
            transfers of 6144  bytes until the entire transfer count is 02315000
            satisfied.  if a failure occures prior to completion of the 02320000
            entire transfer, the request will be terminated.            02325000
                                                                        02330000
            all new requests will be sent to the device via a call to   02335000
            the external procedure start'hpib.  a channel program will  02340000
            be initialized and started to initiate and execute the      02345000
            request.                                                    02350000
                                                                        02355000
            if the request has been completed, the i/o status will be   02360000
            placed in the ioq entry for the request and the request     02365000
            marked complete.                                            02370000
                                                                        02375000
                                                                        02380000
          o locate and read (function code 0)                           02385000
                                                                        02390000
              this request transfers data from tape to the host's       02395000
              memory.                                                   02400000
                                                                        02405000
              the maximum transfer count is 32767  words.               02410000
                                                                        02415000
              if the transfer count is zero, the request will locate the02420000
              record on tape only.  there will be no transfer of data.  02425000
                                                                        02430000
                                                                        02435000
          o locate and write (function code 1)                          02440000
                                                                        02445000
              this command transfers one record from main memory to     02450000
              tape.                                                     02455000
                                                                        02460000
              the maximum transfer count is 32767 words.                02465000
                                                                        02470000
              a transfer count of zero requests a write ring presence   02475000
              check on the device.  if the device is write protected, a 02480000
              message will be sent to the console indicating the device 02485000
              is write protected.                                       02490000
                                                                        02495000
                                                                        02500000
$page                                                                   02505000
          o open file (function code 2)                                 02510000
                                                                        02515000
              this request generates a null operation with a good status02520000
              returned in the i/o status.  no channel program will be   02525000
              executed for this request.                                02530000
                                                                        02535000
                                                                        02540000
          o close file (function code 3)                                02545000
                                                                        02550000
              this request generates a null operation with a good status02555000
              returned in the i/o status.  no channel program will be   02560000
              executed for this request.                                02565000
                                                                        02570000
                                                                        02575000
          o close device (function code 4)                              02580000
                                                                        02585000
              a channel program will be executed to enable immediate    02590000
              report (driver default).                                  02595000
                                                                        02600000
                                                                        02605000
          o fill with zeros (function code 5)                           02610000
                                                                        02615000
              this request fills logical blocks on the tape with zeros  02620000
              (octal 60).                                               02625000
                                                                        02630000
              the maximum transfer count is 32767 words.  a transfer    02635000
              count of zero is invalid.                                 02640000
                                                                        02645000
                                                                        02650000
          o fill with blanks (function code 6)                          02655000
                                                                        02660000
              this request fills logical blocks on the tape with spaces 02665000
              (octal 40).                                               02670000
                                                                        02675000
              the maximum transfer count is 32767 words.  a transfer    02680000
              count of zero is invalid.                                 02685000
                                                                        02690000
                                                                        02695000
          o request device status (function code 7)                     02700000
                                                                        02705000
              this command will transfer the actual device status from  02710000
              the last completed operation.                             02715000
                                                                        02720000
              the transfer count must be greater than 1  byte and will  02725000
              be invalid if it isn't.  the maximum number of bytes      02730000
              returned is 20.  a transfer count in excess of 20 will not02735000
              be considered an error and the 20 bytes of status will be 02740000
              returned.  (refer to the cs/80 instruction set manual for 02745000
              definitions and layout of the status bytes).              02750000
                                                                        02755000
                                                                        02760000
          o initialize media (function code 8)                          02765000
                                                                        02770000
              this request initializes the media.                       02775000
                                                                        02780000
                                                                        02785000
$page                                                                   02790000
          o unload (function code 9)                                    02795000
                                                                        02800000
              this request rewinds and unloads the tape.  the tape will 02805000
              be unloaded regardless of the state of the lock bit.      02810000
                                                                        02815000
                                                                        02820000
          o write disc label (function code 11)                         02825000
                                                                        02830000
              this request will write a label to block zero on the      02835000
              tape.                                                     02840000
                                                                        02845000
              the maximum transfer count is 32767 words.  a transfer    02850000
              count of zero is invalid.                                 02855000
                                                                        02860000
                                                                        02865000
          o request volume limit (function code 13)                     02870000
                                                                        02875000
              this request returns the maximum volume address of the    02880000
              media in two words.                                       02885000
                                                                        02890000
              note:  buffalo supports only single vector addresses.     02895000
                                                                        02900000
              the transfer count must be a minimum of two words.  a     02905000
              transfer count greater than two words will not be         02910000
              considered an error and the two words of volume limit will02915000
              be returned.                                              02920000
                                                                        02925000
                                                                        02930000
          o locate and verify (function code 14)                        02935000
                                                                        02940000
              this request verifies the media and returns in two words  02945000
              the address of the first bad sector encountered.          02950000
                                                                        02955000
              upon making this request, the user's buffer must contain  02960000
              the double word value of the verify length.               02965000
                                                                        02970000
              the transfer count must be a minimum of two words.  a     02975000
              transfer count greater than two words will not be         02980000
              considered an error and the two words of volume limit will02985000
              be returned.                                              02990000
                                                                        02995000
                                                                        03000000
                                                                        03005000
$page                                                                   03010000
          o request generic status (function code 15)                   03015000
                                                                        03020000
              this request returns the generic status from the last     03025000
              completed operation performed by the device in one word.  03030000
              see the generic status layout later in this document.     03035000
                                                                        03040000
              the transfer count must be a minimum of one word.  a      03045000
              transfer count greater than one word will not be          03050000
              considered an error and the one word of generic status    03055000
              will be returned.                                         03060000
                                                                        03065000
                                                                        03070000
          o lock volume (function code 16)                              03075000
                                                                        03080000
              this request locks the volume, disabling the front panel  03085000
              unload function, and returns a good status.  the lock bit 03090000
              in the dit entry is turned on.  no channel program will be03095000
              executed for this request.                                03100000
                                                                        03105000
                                                                        03110000
          o unlock volume (function code 17)                            03115000
                                                                        03120000
              this request unlocks the volume, enabling the front panel 03125000
              unload function, and returns a good status.  the lock bit 03130000
              in the dit entry is turned off.  no channel program will  03135000
              be executed for this request.                             03140000
                                                                        03145000
                                                                        03150000
          o read lock bit (function code 18)                            03155000
                                                                        03160000
              this request returns the volume locked status in one word.03165000
                                                                        03170000
              the transfer count must be a minimum of one word.  a      03175000
              transfer count greater than one word will not be          03180000
              considered an error and the one word of locked status will03185000
              be returned.  no channel program will be executed for this03190000
              request.                                                  03195000
                                                                        03200000
                                                                        03205000
$page                                                                   03210000
          o immediate report (function code 29)                         03215000
                                                                        03220000
              this request enables or disables the immediate reporting  03225000
              feature of the device.                                    03230000
                                                                        03235000
              if qparm2 is zero, immediate report will be disabled.  if 03240000
              qparm2 is one, immediate report will be enabled.          03245000
                                                                        03250000
                                                                        03255000
          o identify (function code 72)                                 03260000
                                                                        03265000
              this request returns buffalo's identity code in two bytes.03270000
              buffalo's identity code is 0260 (hex).                    03275000
                                                                        03280000
              bit meaning                                               03285000
                                                                        03290000
              0-2      storage device, value 000                        03295000
              3-6      value 0001                                       03300000
              7        13037 protocol, value 0                          03305000
              8        value 0                                          03310000
              9        value 1                                          03315000
              10-15    device dependent                                 03320000
                                                                        03325000
              the transfer count must be a minimum of one word.  a      03330000
              transfer count greater than one word will not be          03335000
              considered an error and the one word identity code will be03340000
              returned.                                                 03345000
                                                                        03350000
                                                                        03355000
          o initiate diagnostic selftest (function code 73)             03360000
                                                                        03365000
              this request will cause buffalo to perform its power-on   03370000
              selftest.  the loop count must be between zero and 255.   03375000
              zero will be processed as a request for 255 loops (for    03380000
              linus compatibility).  any other value will be considered 03385000
              invalid.                                                  03390000
                                                                        03395000
                                                                        03400000
          o selftest results (function code 74)                         03405000
                                                                        03410000
              this request will return the status from the selftest.    03415000
              the processing of this request is the same as the request 03420000
              status function.                                          03425000
                                                                        03430000
                                                                        03435000
          o loopback write (function code 75)                           03440000
                                                                        03445000
              this request determines if the communication link is      03450000
              operating properly by writting a test pattern (located in 03455000
              the user's buffer) into the device's internal buffer.     03460000
                                                                        03465000
              the transfer count must be greater than zero and less than03470000
              or equal to 600 words.  any value outside this range is   03475000
              invalid.                                                  03480000
                                                                        03485000
                                                                        03490000
$page                                                                   03495000
          o loopback read (function code 76)                            03500000
                                                                        03505000
              this request reads the data written into the internal     03510000
              buffer from the loopback write function.                  03515000
                                                                        03520000
              the transfer count must be the same as that used for the  03525000
              loopback write request.                                   03530000
                                                                        03535000
                                                                        03540000
          o general purpose command (function code 77).                 03545000
                                                                        03550000
              this request allows the requestor to create their own     03555000
              command requests to be sent through the initiate and      03560000
              report phases.  it is up to the user to ensure that       03565000
              commands submitted through this request are valid and in  03570000
              the proper sequence.  no execution phase is available for 03575000
              this request.                                             03580000
                                                                        03585000
              the transfer count must be a positive number indicating   03590000
              the number of command bytes to be transferred to the      03595000
              device.                                                   03600000
                                                                        03605000
                                                                        03610000
          o release (function code 79)                                  03615000
                                                                        03620000
              this request releases the device for a period of time     03625000
              allowing it to service an internal requirement such as    03630000
              cartridge insertion (power on), unload sequence, or       03635000
              sparing.                                                  03640000
                                                                        03645000
                                                                        03650000
          o release denied (function code 80)                           03655000
                                                                        03660000
              this request prohibits the device from releasing itself.  03665000
                                                                        03670000
                                                                        03675000
          o set release (function code 81)                              03680000
                                                                        03685000
              this request enables or disables an automatic release by  03690000
              the device during idle time.  it also enables or disables 03695000
              the release timeout interval.  the default for this is a  03700000
              two second timeout interval with automatic release        03705000
              enabled.                                                  03710000
                                                                        03715000
                                                                        03720000
$page                                                                   03725000
          o set address (function code 82)                              03730000
                                                                        03735000
              this request will set the value of the target address.    03740000
              this address is then used by other commands in accessing  03745000
              data on the tape.  upon completion of a transaction which 03750000
              uses the target address, the target address will point to 03755000
              the block after the last block accessed during that       03760000
              transaction.                                              03765000
                                                                        03770000
              note:  buffalo supports only single vector addressing.    03775000
                                                                        03780000
                                                                        03785000
          o spare block (function code 88)                              03790000
                                                                        03795000
              this request allows the host to give the device permission03800000
              to become temporarily busy while sparing a block.         03805000
                                                                        03810000
                                                                        03815000
$page                                                                   03820000
          o initiate utility (function code 91)                         03825000
                                                                        03830000
              this request directs the device to perform one utility    03835000
              routine.  buffalo supports the following utilities:       03840000
                                                                        03845000
              1) pattern error rate test                                03850000
              2) read error rate test log                               03855000
              3) read error log                                         03860000
              4) read use log                                           03865000
              5) read drive tables (manufacturer's and spare block)     03870000
              6) recieve user pattern (for error rate test)             03875000
              7) clear logs                                             03880000
              8) read revision number                                   03885000
              9) preset drive                                           03890000
             10) read error summary                                     03895000
                                                                        03900000
              the maximum transfer count is 32767 words.  a transfer    03905000
              count of zero is invalid.                                 03910000
                                                                        03915000
                                                                        03920000
          o channel independent clear (function code 92)                03925000
                                                                        03930000
              this request places the device into a known reset state.  03935000
              if this request is sent to unit 15, all devices on a      03940000
              shared controller and the controller will be reset, the   03945000
              unit number being left at zero upon completion of this    03950000
              command.                                                  03955000
                                                                        03960000
                                                                        03965000
          o cancel (function code 93)                                   03970000
                                                                        03975000
              this function causes the device to gracefully terminate   03980000
              the current transaction, leaving it in the reporting      03985000
              phase.                                                    03990000
                                                                        03995000
                                                                        04000000
          o hp-ib parity checking (function code 94)                    04005000
                                                                        04010000
              this request enables or disables parity checking on the   04015000
              secondary command parameter.                              04020000
                                                                        04025000
              parity checking will always be on except for diagnostic   04030000
              purposes through this function.                           04035000
                                                                        04040000
          o last status request (function code 95)                      04045000
                                                                        04050000
              same as function code 7.                                  04055000
                                                                        04060000
                                                                        04065000
          o generic diag. request (function code 96)                    04070000
                                                                        04075000
                                                                        04080000
          o channel independent clear (function code 97)                04085000
                                                                        04090000
              same as function code 92.                                 04095000
                                                                        04100000
                                                                        04105000
   2.6.2.7  non-supported functions.                                    04110000
                                                                        04115000
            hioctap1 will not support the following individual          04120000
            requests.                                                   04125000
                                                                        04130000
            read with three vector address                              04135000
            write with three vector address                             04140000
            set return addressing mode                                  04145000
            set rotational position sensing                             04150000
            set unit                                                    04155000
            set length                                                  04160000
            set burst mode                                              04165000
            write file mark                                             04170000
            selected device clear                                       04175000
            copy data                                                   04180000
            no op                                                       04185000
                                                                        04190000
                                                                        04195000
3  major data structures                                                04200000
                                                                        04205000
   there are four mpe tables used by the driver.  these are the device  04210000
   reference table (drt), device information table (dit), interrupt     04215000
   linkage table (ilt), and input/output queue (ioq) table.             04220000
                                                                        04225000
                                                                        04230000
$page                                                                   04235000
 3.1  device reference table (drt)                                      04240000
                                                                        04245000
      there is one drt for each device controller configured on the     04250000
      system.  the contents of the table are used for processing        04255000
      interrupts.                                                       04260000
                                                                        04265000
      word 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   mnemonic    04270000
             ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---          04275000
        0    |        channel program pointer (siop)         |  drt0    04280000
             |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|          04285000
        1    | channel program variable area pointer (cpva)  |  drt1    04290000
             |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|          04295000
        2    |        interrupt handler program label |  drt2           04300000
             |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|          04305000
        3    |st|sh|pf|          status |ws|gf|dt|wt|  drt3             04310000
             ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---          04315000
                                                                        04320000
      drt0 - channel program pointer.                                   04325000
             absolute address of the current i/o instruction in         04330000
             execution for this device.                                 04335000
                                                                        04340000
      drt1 - channel program variable area pointer.                     04345000
             absolute address of the base of the interrupt linkage table04350000
             (ilt) points to first word of the channel program variable 04355000
             area of the ilt for controller.                            04360000
                                                                        04365000
      drt2 - interrupt handler program label.                           04370000
             the external program label of the interrupt service routine04375000
             for the controller.                                        04380000
                                                                        04385000
      drt3 - channel program status.                                    04390000
             contains channel program status information which is used  04395000
             by the channel program interpreter.                        04400000
               st - channel program is running.                         04405000
               sh - siop or hiop instruction pending.                   04410000
               pf - powerfail recovery in progress.                     04415000
               ws - waiting for device status request.                  04420000
               gf - gic fifo buffer not empty.                          04425000
               dt - dma transfer active.                                04430000
               wt - channel program in wait state.                      04435000
                                                                        04440000
                                                                        04445000
$page                                                                   04450000
 3.2  device information table (dit)                                    04455000
                                                                        04460000
      there is one dit per physical device.  if a physical device       04465000
      represents more than one logical device, the logical device number04470000
      is obtained from the ioq array.                                   04475000
                                                                        04480000
    word    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   mnemonic   04485000
          ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---             04490000
     0    |tm|ds|ac|rq| 0| 0| 0|io|ia|no|st| 0|   state   |  dflag      04495000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04500000
     1    | sysdb relative pointer to the dit for the next|  dlink      04505000
          | device requesting this resource or service    |             04510000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04515000
     2    |          pointer to the current ioq           |  dioqp      04520000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04525000
     3    |             logical device number             |  dldev      04530000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04535000
     4    | sysdb relative pointer to device linkage table|  ddltp      04540000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04545000
     5    | sysdb relative pntr to interrupt linkage table|  diltp      04550000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04555000
     6    | set to -1 when system powerfail occurs.       |  dstat      04560000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04565000
     7    | hardware error status.  set when the driver   |  dserr      04570000
          | detects an error.  whenever <> 0, the driver  |             04575000
          | monitor logs an i/o error and clears this word|             04580000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04585000
     8    |       index of first request in the queue     |  dqhead     04590000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04595000
     9    |       index of last request in the queue      |  dqtail     04600000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04605000
    10    | iot |                 | physical unit #       |  dunit      04610000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04615000
    11    |lk|ig|im|                          | substate  |  dmisc      04620000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04625000
    12    | high order logical sector address of bad block|  dbadblk1   04630000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04635000
    13    | low order logical sector address of bad block.|  dbadblk2   04640000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04645000
    14    | byte transfer left when bad block occured     |  dbadxfer   04650000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04655000
    15    | hardware logged error status - cpva (0).      |  dlogerror  04660000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04665000
    16    | relative offset of channel program abort.     |  csiopstop  04670000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04675000
    17    | accum byte count of transfer > 6144 bytes.    |  dbytecnt   04680000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04685000
    18    |                                               |             04690000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04695000
    19    | device status (20 bytes), errors logged       |  dstatus    04700000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04705000
     .    |                     .                         |             04710000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04715000
     .    |                     .                         |             04720000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04725000
    25    |                     .                         |             04730000
          |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|             04735000
                                                                        04740000
$page                                                                   04745000
      dflag - device flags and request state.                           04750000
              tm    - set if device is a terminal                       04755000
              ds    - if tm = 0 and this bit is set then device is      04760000
                      a disc, otherwise device dependent.               04765000
              ac    - a monitor is currently servicing this device.     04770000
              rq    - a service request is pending while the monitor    04775000
                      is active.                                        04780000
              io    - an i/o channel program is running for this        04785000
                      device.                                           04790000
              ia    - an interrupt or response has occurred for this    04795000
                      device.                                           04800000
              no    - not ready, start idle channel program then go to  04805000
                      state %10.                                        04810000
              st    - the device monitor is starting an idle channel    04815000
                      program for this device.  there is no ioq         04820000
                      associated with this state.                       04825000
              state - state of the device monitor.  specifies the next  04830000
                      action to be taken by siodm in servicing the      04835000
                      request:                                          04840000
                      0   - start a new request.                        04845000
                      1   - not used.                                   04850000
                      2   - call driver initiator procedure.            04855000
                      3   - call driver completor procedure.            04860000
                      4   - not used.                                   04865000
                      5   - request complete.                           04870000
                      6   - initiate device recognition sequence.       04875000
                      7   - start operator intervention wait.           04880000
                      %10 - wait for interrupt (operator intervention), 04885000
                            restart at state 0.                         04890000
                      %11 - wait for data segment freeze, then state 2. 04895000
                      %12 - wait for driver initiator to be frozen,     04900000
                            then allocate controller (state 2).         04905000
                      %13 - wait for i/o completion interrupt, then     04910000
                            state 3.                                    04915000
                      %14 - wait for controller, then call driver       04920000
                            initiator.                                  04925000
                      %15 - not used.                                   04930000
                      %16 - wait for initiator make present, then       04935000
                            state 2.                                    04940000
                      %17 - wait for completor make present, then       04945000
                            state 3.                                    04950000
                                                                        04955000
      dlink,                                                            04960000
      dqhead,                                                           04965000
      dqtail,                                                           04970000
      dunit - not used.                                                 04975000
                                                                        04980000
      dmisc - miscellaneous device information.                         04985000
              lk       - lock flag denoting unload status of the        04990000
                         device.                                        04995000
                         0 - allow operator unload of the volume.       05000000
                         1 - deny operator unload of the volume.        05005000
              ig       - ignore unexpected interrupt flag.              05010000
              im       - immediate report.                              05015000
                         0 - disabled.                                  05020000
                         1 - enabled.                                   05025000
              substate - idle channel program state.                    05030000
                         0 - normal idle channel program wait.          05035000
                         1 - idle request being serviced wait.          05040000
                                                                        05045000
      dbadblk1 - high order logical sector address of bad block         05050000
                 encountered.                                           05055000
                                                                        05060000
      dbadblk2 - low order logical sector address of bad block          05065000
                 encountered.                                           05070000
                                                                        05075000
      dbadxfer - byte transfer left when bad block occured.             05080000
                                                                        05085000
      dlogerror - cpva (0) logged on hardware error status.             05090000
                                                                        05095000
      dsiopstop - relative offset location of channel program when      05100000
                  error in cpva (0) occured.                            05105000
                                                                        05110000
      dbytecnt - accummulative transfer count for transfers greater     05115000
                 than 6144 bytes.                                       05120000
                                                                        05125000
      dstatus - 20  bytes of status logged when a status error occurs.  05130000
                (refer to cs/80 instruction set manual for description.)05135000
                                                                        05140000
                                                                        05145000
$page                                                                   05150000
 3.3  interrupt linkage table (ilt)                                     05155000
                                                                        05160000
      there is one ilt for each device controller configured on the     05165000
      system.                                                           05170000
                                                                        05175000
      word    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   mnemonic 05180000
            ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---           05185000
        0   |                    channel                    |  icpva0   05190000
        1   |                    program                    |  icpva1   05195000
        2   |                    variable                   |  icpva2   05200000
        3   |                  area (icpva)                 |  icpva3   05205000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05210000
        4   |                   dma abort                   |  icpva4   05215000
        5   |                    address                    |  icpva5   05220000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05225000
        6   |                       0                       |  isrql    05230000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05235000
        7   |li|     chanque     |     |   chan    |  dev   |  icntrl   05240000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05245000
        8   | sysdb relative pointer to channel program area|  isiop    05250000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05255000
        9   | sysdb relative pointer to idle status area.   |  istap    05260000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05265000
       10   | single instruction that is executed to extract|  iunit    05270000
            | the device unit number from the status pointed|           05275000
            | to by istap.                                  |           05280000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05285000
       11   | sysdb  relative  dit  pointer  of  the  device|  icdp     05290000
            | currently using the  channel to perform a data|           05295000
            | operation.                                    |           05300000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05305000
       12   |       siopsize        |         cquen         |  iqueue   05310000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05315000
       13   |rw|wp|ig|                          |  hcunit   |  iflag    05320000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05325000
       14   | sysdb relative dit pointer for unit 0  *      |  iditp0   05330000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05335000
       15   | 20 bytes of idle channel program status area. |  istat    05340000
        .   |                     .                         |           05345000
        .   |                     .                         |           05350000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05355000
       25   |           channel program area.               |           05360000
        .   |                     .                         |           05365000
        .   |                     .                         |           05370000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05375000
                                                                        05380000
      * this driver does not support more than one unit.                05385000
                                                                        05390000
$page                                                                   05395000
      icpva0 - channel program variable area                            05400000
               icpva0 is used by the channel program processor to store 05405000
               status information after i/o  channel aborts.            05410000
      icpva1 - used by the driver to indicate if status should be       05415000
               examined for special conditions or errors.               05420000
      icpva2 - not used.                                                05425000
      icpva3 - not used.                                                05430000
      icpva4 & icpva5 - absolute address where a dma abort occurred.    05435000
      icntrl - controller information                                   05440000
               li      - if this bit is set, the controller is sharing  05445000
                         a software channel resource in order to limit  05450000
                         bandwidth.                                     05455000
               chanque - the software channel resource number.          05460000
               chan    - channel number (four most significant bits of  05465000
                         drtn).                                         05470000
               dev     - device number (three least significant bits of 05475000
                         drtn).                                         05480000
                                                                        05485000
      iqueue -                                                          05490000
               siopsize - channel program area size,                    05495000
                          (number of words + 1) / 2.                    05500000
               cquen    - for a multi-unit controller this field        05505000
                          contains the software controller resource     05510000
                          number.                                       05515000
                                                                        05520000
      iflag - controller and channel program state flags.               05525000
              rw     - runwait, an idle channel program should be       05530000
                       started when there are no active requests to     05535000
                       process.                                         05540000
              wp     - waitprog, an idle channel program has been       05545000
                       started for this controller.  this bit is reset  05550000
                       by an interrupt.                                 05555000
              ig     - ignorehi, an hiop  instruction has been issued   05560000
                       against this statement.  therefore ignore the    05565000
                       interrupt generated by the channel code when this05570000
                       program halts.                                   05575000
              hcunit - highest configured unit number for this          05580000
                       controller.                                      05585000
                                                                        05590000
      istat - 20  bytes resevered for status.                           05595000
$page                                                                   05600000
 3.4  i/o queue request table (ioq)                                     05605000
                                                                        05610000
      word    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   mnemonic 05615000
       (%)  ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---           05620000
        0   |            request dependent flags            |  qflag    05625000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05630000
        1   | sysdb relative pointer to next ioq element.   |  qlink    05635000
            | points to first word of element.              |           05640000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05645000
        2   |     logical device number                     |  qldev    05650000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05655000
        3   |rs|op|im|lf|sp|ve|ur|   rc   |     |    wc     |  qmisc    05660000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05665000
        4   | s| if qflag.(3:1) is clear then this is the   |  qdstn    05670000
            |    dst number of the target data segment.  if |           05675000
            |    s is set, qaddr is db relative.            |           05680000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05685000
        5   | offset in the data segment or system buffer   |  qaddr    05690000
            | table to the target data buffer.              |           05695000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05700000
        6   |                       | function code.        |  qfunc    05705000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05710000
        7   | on initiation, specifies the word count (> 0) |  qcount   05715000
            | or byte count (< 0).  at completion of the    |           05720000
            | request this location contains the actual     |           05725000
            | transmission count in the same units (bytes   |           05730000
            | or words) as in the request.                  |           05735000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05740000
        8   | high order address of location on tape.       |  qparm1   05745000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05750000
        9   | low order address of location on tape.        |  qparm2   05755000
            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|           05760000
       10   |                       |  qualifier   | status |  qstat    05765000
            ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---           05770000
       11   |         process control block number          |  qpcb     05775000
            ---+--+--+--+--+--+--+--+--+--+--+--+--+--+--+---           05780000
                                                                        05785000
                                                                        05790000
$page                                                                   05795000
      qflag - request dependent flags.                                  05800000
              bit  0 - abort, abort this request and return an error    05805000
                       indication to the caller.                        05810000
                   1 - special, apply special handling to this request  05815000
                       (not used).                                      05820000
                   2 - diag, this is a request from the diagnostic      05825000
                       subsystem.                                       05830000
                   3 - sysbuff, target is an index relative to the sbuf 05835000
                       table of the data buffer.                        05840000
                   4 - iowake, wake caller on completion of request.    05845000
                   5 - blocked, blocked i/o.  the caller is waited in   05850000
                       attachio until the request is completed.  implies05855000
                       iowake.                                          05860000
                   6 - completed, the request has been completed and    05865000
                       the caller awakened if he had requested (with    05870000
                       iowake).                                         05875000
                   7 - datafrzn, set by the memory management routines  05880000
                       (mam) when a makepresent request is successfully 05885000
                       completed and indicates the data segment is      05890000
                       frozen in memory.                                05895000
                   8 - mamerrord, an error has occurred while mam was   05900000
                       trying to make the target data segment present   05905000
                       and freeze it in memory.                         05910000
                   9 - preq, (not used).                                05915000
                  10 - sfail, delayed failure of sio instruction.  if a 05920000
                       call to start'hpib resulted in the request being 05925000
                       added to the the channel queue, this bit         05930000
                       indicates that the sio instruction failed when   05935000
                       the request was selected for execution.          05940000
                  11 - pfail, the request was aborted because of a      05945000
                       system power failure.                            05950000
                                                                        05955000
      qmisc - driver request dependent flags.                           05960000
              rs - request status failed.                               05965000
              op - operator requested release.                          05970000
              im - internal maintenance fault.                          05975000
              lf - media loaded.                                        05980000
              sp - system powerfail.                                    05985000
              ve - verify error.                                        05990000
              ur - unload due to no write ring.                         05995000
              rc - retry count field.                                   06000000
              wc - wait code.                                           06005000
                   0 - new request.                                     06010000
                   1 - completion wait.                                 06015000
                   2 - not ready wait.                                  06020000
                   3 - release/release deny wait.                       06025000
                   4 - ioq defer wait.                                  06030000
                   7 - synchronization wait.                            06035000
                                                                        06040000
$page                                                                   06045000
      qstat - status    - general status indicating the final state of  06050000
                          the request.  the following codes are used:   06055000
                          0 - not started or awaiting completion.       06060000
                          1 - successful completion.                    06065000
                          2 - end-of-file detected.                     06070000
                          3 - unusual, but recoverable, condition detect06075000
                          4 - irrecoverable error has occurred.         06080000
              qualifier - a code which further defines or qualifies the 06085000
                          general status.  (see driver return status    06090000
                          codes.)                                       06095000
                                                                        06100000
      qpcb  - the process control block (pcb) number of the process     06105000
              which made this request.  if zero, the request is not     06110000
              associated with any process and the ioq element is to be  06115000
              returned by the system when the request has completed.    06120000
$page                                                                   06125000
4  ioq i/o status                                                       06130000
                                                                        06135000
   the following status values are returned by the buckhorn driver.     06140000
                                                                        06145000
   general status (13:3)     qualifying status (8:5)        overall     06150000
                                                            value       06155000
                                                                        06160000
   0 - pending               1 - completion wait            %10         06165000
                             3 - not ready wait             %30         06170000
                                                                        06175000
   1 - successful            0 - no errors                    1         06180000
                             2 - retry was necessary        %21         06185000
                                                                        06190000
   3 - unusual condition     1 - status interrogation       %13*        06195000
                                 required                               06200000
                             3 - request aborted            %33         06205000
                             4 - prior error abort          %43         06210000
                             6 - powerfail abort            %63         06215000
                           %21 - device powered up         %213*        06220000
                                                                        06225000
   4 - irrecoverable error   0 - invalid request              4         06230000
                             1 - track/sector error         %14         06235000
                             2 - i/o timed out before       %24         06240000
                                 complete                               06245000
                             4 - sio failure                %44         06250000
                             5 - unit failure               %54         06255000
                             6 - invalid address            %64         06260000
                           %12 - system error              %124         06265000
                           %14 - channel failure           %144         06270000
                           %15 - unitialized media         %154         06275000
                           %16 - no spares available       %164         06280000
                                                                        06285000
   * these status are used for diagnostic reporting only.               06290000
                                                                        06295000
                                                                        06300000
$page                                                                   06305000
5  generic status layout                                                06310000
                                                                        06315000
   bit    meaning                                                       06320000
                                                                        06325000
   15     immediate report                                              06330000
          0 = disabled                                                  06335000
          1 = enabled                                                   06340000
                                                                        06345000
   12-14  reject errors                                                 06350000
          000 = no fatal error                                          06355000
          001 = channel parity error                                    06360000
          010 = illegal opcode                                          06365000
          011 = illegal module address                                  06370000
          100 = address bounds violation                                06375000
          101 = illegal parameter length                                06380000
          110 = illegal message sequence                                06385000
          111 = illegal message length                                  06390000
                                                                        06395000
    8-11  fault errors                                                  06400000
          0000 = no fault errors                                        06405000
          0001 = cross unit fault                                       06410000
          0010 = controller fault                                       06415000
          0011 = unit fault                                             06420000
          0100 = diagnostic failure                                     06425000
          0101 = release required                                       06430000
          0110 = powerfail                                              06435000
          0111 = retransmit data                                        06440000
                                                                        06445000
    4-7   access errors                                                 06450000
          0000 = no access errors                                       06455000
          0001 = illegal parallel operation                             06460000
          0010 = unitialized media                                      06465000
          0011 = no spares available                                    06470000
          0100 = unit not ready                                         06475000
          0101 = write protected                                        06480000
          0110 = no data found                                          06485000
          0111 = unrecoverable data overflow                            06490000
          1000 = unrecoverable data                                     06495000
          1001 = end-of-file                                            06500000
          1010 = end-of-volume                                          06505000
                                                                        06510000
    0-3   information fields                                            06515000
          0000 = no information                                         06520000
          0001 = operator release request                               06525000
          0010 = diagnostic release request                             06530000
          0011 = internal maintenance release request                   06535000
          0100 = media wear                                             06540000
          0101 = auto sparing invoked                                   06545000
          0110 = recoverable data overflow                              06550000
          0111 = marginal data                                          06555000
          1000 = recoverable data                                       06560000
          1001 = maintenance track overflow                             06565000
                                                                        06570000
   refer to the cs/80 instruction set manual for definition of          06575000
   these items.                                                         06580000
                                                                        06585000
                                                                        06590000
$page                                                                   06595000
6.1  cs/80 device status                                                06600000
                                                                        06605000
   byte      structure       field                                      06610000
   ----      ---------       -----                                      06615000
                                                                        06620000
   0         vvvvuuuu        id, vvvv - volume, uuuu - unit             06625000
   1         ssssssss        id, s - value of the lowest numbered unit  06630000
                                     with status pending.  all ones     06635000
                                     indicate no units have status      06640000
                                     pending.                           06645000
   2-3       rrrrrrrr        reject error                               06650000
   4-5       ffffffff        fault error                                06655000
   6-7       aaaaaaaa        access error                               06660000
   8-9       iiiiiiii        information error                          06665000
                                                                        06670000
   p1-p10    pppppppp        ten parameter associated bytes             06675000
                                                                        06680000
   reject errors field       bits  0-15   00a00bcd efg0h000             06685000
   fault errors field        bits 16-31   0a0b00c0 d0efg0hi             06690000
   access errors field       bits 32-47   abcdef00 gh0ij000             06695000
   information errors field  bits 48-63   abcde00f 0ghi0j00             06700000
                                                                        06705000
   bit pos.  bit no.  usage   [reject errors field]                     06710000
                                                                        06715000
      a           2   channel parity error                              06720000
      b           5   illegal opcode                                    06725000
      c           6   module addressing error                           06730000
      d           7   address bounds error                              06735000
      e           8   parameter bounds error                            06740000
      f           9   illegal parameter                                 06745000
      g          10   message sequence violation                        06750000
      h          12   message length difference                         06755000
                                                                        06760000
   bit pos.  bit no.  usage   [fault errors field]                      06765000
                                                                        06770000
      a          17   cross-unit (linus)                                06775000
      b          19   controller fault                                  06780000
      c          22   unit fault                                        06785000
      d          24   diagnostic result failed                          06790000
                      (p1-p6 = 6 bytes result)                          06795000
      e          26   release required for operator request             06800000
                      (load/unload)                                     06805000
      f          27   release required for diagnostic request           06810000
                      (hio, selftest)                                   06815000
      g          28   release required for internal maintenance         06820000
                      (head alignment, error log)                       06825000
      h          30   power fail                                        06830000
      i          31   retransmit/release completed                      06835000
                                                                        06840000
$page                                                                   06845000
   bit pos.  bit no.  usage   [access errors field]                     06850000
                                                                        06855000
      a          32   illegal parallel operation (not implemented)      06860000
      b          33   uninitialized media                               06865000
      c          34   no spares available                               06870000
      d          35   not ready                                         06875000
      e          36   write protect (linus)                             06880000
      f          37   no data found (linus)                             06885000
      g          40   unrecoverable data overflow                       06890000
      h          41   unrecoverable data                                06895000
                      (p1-p6  = 6 bytes of bad block address)           06900000
      i          43   end of file (linus)                               06905000
      j          44   end of volume                                     06910000
                                                                        06915000
   bit pos.  bit no.  usage   [information errors field]                06920000
                                                                        06925000
      a          48   release request for operator request              06930000
                      (load/unload)                                     06935000
      b          49   release request for diagnostic request            06940000
                      (hio, selftest)                                   06945000
      c          50   release request for internal maintenance          06950000
                      (head alignment, error log)                       06955000
      d          51   media wearing                                     06960000
      e          52   data overrun                                      06965000
      f          55   auto-sparing invoked (linus)                      06970000
      g          57   recoverable data overflow                         06975000
      h          58   marginal data                                     06980000
                      (p1-p6  = 6 bytes of marginal block address)      06985000
      i          59   recoverable data                                  06990000
                      (p1-p6  = 6 bytes of recoverable block address)   06995000
      j          61   maintenance track overflow                        07000000
                                                                        07005000
   parameter usage:                                                     07010000
                                                                        07015000
   byte -->              |  1  2  3  4  5  6       7   8   9   10     | 07020000
                                                                        07025000
   no error              | new target address |                       | 07030000
   diagnostic result (24)| diagnostic results |  device fault log --  | 07035000
   unrecoverable data(41)| address of block   |  except after a spare | 07040000
   marginal data     (58)| address of block   |  indicate length of   | 07045000
   recoverable data  (59)| address of block   |  unrecoverable field  | 07050000
                                                                        07055000
   * special note:  drive status are not pertinent unless a qstat 1     07060000
                    occurred prior to taking status.  driver will often 07065000
                    do a LOC & WRT with zero length to force the "Not   07070000
                    Ready" condition to appear in status.               07075000
                                                                        07080000
$page                                                                   07085000
6.2   generic status layout                                             07090000
                                                                        07095000
        bit     meaning                                                 07100000
                                                                        07105000
        0-3     fatal errors                                            07110000
                0000 = no fatal error.                                  07115000
                0001 = tape runaway.                                    07120000
                0010 = multiple tracks in error (mte).                  07125000
                0011 = timing error.                                    07130000
                0100 = command reject.                                  07135000
                0101 = unit failure.                                    07140000
                0110 = data parity error.                               07145000
                0111 = command parity error.                            07150000
                                                                        07155000
        4-6     density                                                 07160000
                000 = unrecognized density.                             07165000
                001 = 800 bpi (nrzi).                                   07170000
                010 = 1600 bpi (pe).                                    07175000
                011 = 6250 bpi (gcr).                                   07180000
                                                                        07185000
        7-8     unit number                                             07190000
                00 = unit 0                                             07195000
                01 = unit 1                                             07200000
                10 = unit 2                                             07205000
                11 = unit 3                                             07210000
                                                                        07215000
        9       end-of-file (eof).                                      07220000
        10      beginning-of-tape (bot)/load point.                     07225000
        11      end-of-tape (eot).                                      07230000
        12      immediate report enabled.                               07235000
        13      single track in error (ste).                            07240000
        14      unit online.                                            07245000
        15      file protect (no write ring).                           07250000
                                                                        07255000
                                                                        07260000
$page                                                                   07265000
7  release considerations                                               07270000
                                                                        07275000
   release will always be granted for internal maintenance requests (   07280000
   head alignment, error log).                                          07285000
                                                                        07290000
   release will always be denied for diagnostic requests                07295000
   (hio, selftest).  release will be denied for operator (load/unload)  07300000
   request when the disc is in a locked state and granted when the disc 07305000
   is in an unlocked state.                                             07310000
                                                                        07315000
   on a status return, under the fault error field, the internal        07320000
   maintenance status should be the only status generating a release    07325000
   required.  operator and diagnostic requests generating a release     07330000
   required should never occur and such occurrences will be flagged as  07335000
   errors.                                                              07340000
                                                                        07345000
                                                                        07350000
8  lock/unlock considerations                                           07355000
                                                                        07360000
   the driver maintains a lock/unlock bit in the dit which is set or    07365000
   cleared when various mpe modules call the driver lock and unlock     07370000
   function code.  operator request to unload the volume mounted will be07375000
   denied when the lock bit is set and allowed only when the lock bit is07380000
   cleared.                                                             07385000
                                                                        07390000
                                                                        07395000
 8.1  private volumes                                                   07400000
                                                                        07405000
      these are locked by the pvsys module at the first logical mount   07410000
      and are unlocked at the last logical dismount.                    07415000
                                                                        07420000
                                                                        07425000
 8.2  serial and foreign volumes                                        07430000
                                                                        07435000
      these are locked for each fopen to the file and unlocked after    07440000
      each dclose to the file.                                          07445000
                                                                        07450000
      note:  pvproc will lock all non-system volumes while processing   07455000
             any unexpected interrupts passed to it by devrec.          07460000
                                                                        07465000
                                                                        07470000
$page                                                                   07475000
9  logging considerations                                               07480000
                                                                        07485000
   cpva(0) along with the channel program aborted relative offset is    07490000
   logged for the following reasons:                                    07495000
                                                                        07500000
   1) dma abort -  dma transfer aborted by memory errors.               07505000
   2) channel program execution error -  an error is detected by        07510000
      the cpp while servicing the channel program.                      07515000
                                                                        07520000
   20 bytes of disc status are logged for any errors occurring in the   07525000
   status fields.  (see cs/80 device status)                            07530000
                                                                        07535000
   logging will not occur for the status data overrun since this can    07540000
   occur even under normal operating conditions when there are several  07545000
   high speed devices on more than one gic.                             07550000
                                                                        07555000
   logging is exempted when the driver is in diagnostics mode.          07560000
                                                                        07565000
                                                                        07570000
10  unexpected interrupts handling                                      07575000
                                                                        07580000
    to avoid processing unexpected interrupts from the cs/80 device due 07585000
    to internal maintenance (ie.  error logging and head alignments),   07590000
    devrec will always issue a request status to the driver with ioq    07595000
    word qpar1 = 8 and qpar2 = 9 once an unexpected interrupt has       07600000
    occurred.  the driver will then return to devrec the pattern %10101007605000
    for interrupts it wishes devrec to ignore or return the first word  07610000
    of status for interrupts it wishes devrec to process.               07615000
                                                                        07620000
    note:  the driver will set the ignore interrupt flag in the dit     07625000
           for all unexpected interrupts except operator request release07630000
           and power on condition.  the ignore interrupt flag will be   07635000
           cleared after returning the ignore pattern to devrec's status07640000
           request.                                                     07645000
                                                                        07650000
                                                                        07655000
11  status considerations                                               07660000
                                                                        07665000
    while the idle channel program is running, status will be read into 07670000
    the ilt table pointed to by ilt(istap).  while an ioq is being      07675000
    processed by the driver, status will be read into the dit table.    07680000
    the driver will always reset the read status pointer back to the ilt07685000
    after processing an ioq request.  this is neccesary since siodm will07690000
    not call the driver to reschedule the idle when the idle has not    07695000
    been aborted.  this will occur for the driver functions which do not07700000
    execute a start'hpib (ie. lock, unlock, fopen, etc.)                07705000
                                                                        07710000
                                                                        07715000
$page                                                                   07720000
              parameters for cs'80 buffalo driver requests              07725000
              --------------------------------------------              07730000
                                                                        07735000
[ note:  count = (+) denotes #words ]                                   07740000
[              = (-) denotes #bytes ]                                   07745000
[                                   ]                                   07750000
                                                                        07755000
operation            function    parameters                             07760000
---------            --------    ----------                             07765000
                                                                        07770000
 read                     0      count - transfer count                 07775000
                                                                        07780000
                                 bank & buffaddr contains               07785000
                                 data read.                             07790000
                                                                        07795000
                                 p1,p2 - dbl wrd logical                07800000
                                         block address                  07805000
                                                                        07810000
 write                    1      count - transfer count                 07815000
                                                                        07820000
                                 bank & buffaddr contains               07825000
                                 data for write.                        07830000
                                                                        07835000
                                 p1,p2 - dbl wrd logical                07840000
                                         block address                  07845000
                                                                        07850000
 file open                2      no parameters                          07855000
                                                                        07860000
 file close               3      no parameters                          07865000
                                                                        07870000
 device close             4      no parameters                          07875000
                                                                        07880000
 fill with zeros          5      count - transfer count                 07885000
                                                                        07890000
                                 p1,p2 - dbl wrd logical                07895000
                                         block address                  07900000
                                                                        07905000
 fill with blanks         6      count - transfer count                 07910000
                                                                        07915000
                                 p1,p2 - dbl wrd logical                07920000
                                         block address                  07925000
                                                                        07930000
 request status           7      count - transfer count                 07935000
                                         (max status size 20 bytes)     07940000
                                                                        07945000
                                 bank & buffaddr for the return         07950000
                                 of the status.                         07955000
                                                                        07960000
 initialize media         8      p1 - initialize options                07965000
                                      [0=retain factory,                07970000
                                         field spares]                  07975000
                                      [1=retain factory                 07980000
                                         spares only]                   07985000
                                      [0=retain]                        07990000
                                      [2=]                              07995000
                                                                        08000000
                            ???  p2 - block interleave                  08005000
                                      byte (binary number)              08010000
                                                                        08015000
 unload cartridge         9      no parameters                          08020000
                                                                        08025000
                                                                        08030000
 write disc label        11      count - label count                    08035000
                                                                        08040000
                                 bank & buffaddr contains               08045000
                                 label info. to be written.             08050000
                                                                        08055000
                                 p1,p2 - dbl wrd logical                08060000
                                         block address.                 08065000
                                                                        08070000
 request volume limit    13      bank & buffaddr returns                08075000
                                 dbl wrd of size of tape                08080000
                                 mounted on the drive.                  08085000
                                                                        08090000
 verify                  14      count - verify length                  08095000
                                         [0=verify entire disc]         08100000
                                                                        08105000
                                 bank & buffaddr returns                08110000
                                 dbl wrd logical block                  08115000
                                 address of 1st bad block               08120000
                                 encountered with a error.              08125000
                                                                        08130000
                                 p1,p2 - dbl wrd logical block address  08135000
                                         to begin doing verification.   08140000
                                                                        08145000
generic status           15      no parameters                          08150000
                                                                        08155000
lock                     16      no parameters                          08160000
                                                                        08165000
unlock                   17      no parameters                          08170000
                                                                        08175000
read lock bit            18      bank & buffaddr returns                08180000
                                 the state of the dits                  08185000
                                 lock flag.                             08190000
                                                                        08195000
identify                 72      bank & buffaddr contains               08200000
                                 device id returned.                    08205000
                                                                        08210000
initiate diag selftest   73      p1 - 2 bytes loop count                08215000
                                      (#times to do diag)               08220000
                                 p2 - selftest section                  08225000
                                      number to execute                 08230000
                                                                        08235000
read selftest results    74      bank & buffaddr contains               08240000
                                 selftest results.                      08245000
                                                                        08250000
loopback write           75      count - transfer count                 08255000
                                                                        08260000
                                 bank & bankaddr contains               08265000
                                 loopback data for write.               08270000
                                 [data sequence must begin              08275000
                                 with a hex ff and each                 08280000
                                 byte which follows must                08285000
                                 equals its predecessor+1]              08290000
                                                                        08295000
loopback read            76      count - transfer count                 08300000
                                                                        08305000
                                 bank & buffaddr contains               08310000
                                 loopback data read.                    08315000
                                                                        08320000
general purpose command  77      count - #command bytes                 08325000
                                                                        08330000
                                 bank & buffaddr contains               08335000
                                 the command data bytes to              08340000
                                 be sent thru the command               08345000
                                 and reporting msg phase.               08350000
                                                                        08355000
release                  79      no parameters                          08360000
                                                                        08365000
release denied           80      no parameters                          08370000
                                                                        08375000
set release              81      p1 - 1 suppress release                08380000
                                        timeout [t bit=1]               08385000
                                 p2 - 1 release automatically           08390000
                                        during idle time                08395000
                                        [z bit=1]                       08400000
                                                                        08405000
set address              82      bank & buffaddr contains               08410000
                                 dbl wrd of logical block               08415000
                                 address.                               08420000
                                                                        08425000
spare block              88      bank & buffaddr contains               08430000
                                 dbl wrd of logical block               08435000
                                 address of the block to be             08440000
                                 spared.                                08445000
                                                                        08450000
                                 p2 - 0 spare retaining                 08455000
                                        data without                    08460000
                                        target block                    08465000
                                    - 1 spare without                   08470000
                                        retaining data                  08475000
                                    - 4 spare retaining                 08480000
                                        data with target                08485000
                                        block                           08490000
                                                                        08495000
initiate utility         91     ----------------------------            08500000
                                |case 1: no exec message   |            08505000
                                |                          |            08510000
                                |count - not applicable    |            08515000
                                |bank & buffaddr contains: |            08520000
                                |                          |            08525000
                                |word   0: util byte cnt[n]|            08530000
                                |word 1-n: util parm bytes |            08535000
                                |          if byte cnt <> 0|            08540000
                                |                          |            08545000
                                |p1 - 0 no exec message    |            08550000
                                ----------------------------            08555000
                                                                        08560000
                                ----------------------------            08565000
                                |case 2: send exec message |            08570000
                                |                          |            08575000
                                |count - exec msg length   |            08580000
                                |bank & buffaddr contains: |            08585000
                                |                          |            08590000
                                |word 0-count: utility data|            08595000
                                |       bytes to be sent to|            08600000
                                |       the device.        |            08605000
                                |                          |            08610000
                                |p1 - 1 send exec message  |            08615000
                                ----------------------------            08620000
                                                                        08625000
                                ----------------------------            08630000
                                |case 3: rcv exec message  |            08635000
                                |                          |            08640000
                                |count - exec msg length   |            08645000
                                |bank & buffaddr contains: |            08650000
                                |                          |            08655000
                                |word   0: util byte cnt[n]|            08660000
                                |word 1-n: util parm bytes |            08665000
                                |          if byte cnt <> 0|            08670000
                                |                          |            08675000
                                |bank & buffaddr+10 return:|            08680000
                                |                          |            08685000
                                |word 0-n: util data infor.|            08690000
                                |          (optional)      |            08695000
                                |                          |            08700000
                                |p1 - 2 rcv exec message   |            08705000
                                ----------------------------            08710000
                                                                        08715000
                                ----------------------------            08720000
                                |for all cases]            |            08725000
                                |                          |            08730000
                                |p1 - exec msg qualifier   |            08735000
                                |p2 - utility number       |            08740000
                                ----------------------------            08745000
                                                                        08750000
device clear             92      no parameters                          08755000
                                                                        08760000
cancel                   93      no parameters                          08765000
                                                                        08770000
parity checking          94      p1 - 0 disables checking               08775000
                                    - 1 enables checking                08780000
                                                                        08785000
                                                                        08790000
diagnostic functions:  will primarily be used by the mpe online         08795000
                       diagnostic package.  the diagnostic request      08800000
                       bit in the first word (qflag) of the disc        08805000
                       request queue should be set to allow the         08810000
                       diagnostic caller to handle its own status.      08815000
                       otherwise the driver will assume that it had     08820000
                       been called by an mpe os module and will         08825000
                       provide status and error logging will take       08830000
                       place.                                           08835000
                                                                        08840000
>>                                                                      08845000
                                                                        08850000
begin                                                                   08855000
$include incllpdt                                                       08860000
$page                                                                   08865000
$include inclsbh                                                        08870000
<<=================================================================>>   08875000
<<                                                                 >>   08880000
<<                         end inclsbh                             >>   08885000
<<                                                                 >>   08890000
<<=================================================================>>   08895000
$page                                                                   08900000
$include inclioq                                                        08905000
<<=================================================================>>   08910000
<<                                                                 >>   08915000
<<                          end inclioq                            >>   08920000
<<                                                                 >>   08925000
<<=================================================================>>   08930000
$page                                                                   08935000
define                                                                  08940000
   << qmisc bit definitions >>                                          08945000
                                                                        08950000
   ioq'rstat'fail = ioq'qmisc.( 0:1)#, << request status failed flag >> 08955000
   ioq'oper'req   = ioq'qmisc.( 1:1)#, << operator req release flg   >> 08960000
   ioq'im'fault   = ioq'qmisc.( 2:1)#, << inter maintenance fault flg>> 08965000
   ioq'media'load = ioq'qmisc.( 3:1)#, << media load flag            >> 08970000
   ioq'sys'pfail  = ioq'qmisc.( 4:1)#, << system powerfail flag      >> 08975000
   ioq'verify'err = ioq'qmisc.( 5:1)#, << verify error flag          >> 08980000
   ioq'unload'ring= ioq'qmisc.( 6:1)#, << no write ring              >> 08985000
   ioq'retry'count= ioq'qmisc.( 7:3)#, << retry count in qmisc       >> 08990000
                                                                        08995000
   ioq'waitcode   = ioq'qmisc.(12:4)#; << indicates type of wait     >> 09000000
                                       <<                            >> 09005000
                                       << 0 - new request            >> 09010000
                                       << 1 - completion             >> 09015000
                                       << 2 - not ready              >> 09020000
                                       << 3 - release/release deny   >> 09025000
                                       << 4 - ioq defer              >> 09030000
                                       << 5 - sync. with device      >> 09035000
                                       << 6 - no write ring          >> 09040000
                                       << 7 - abort ioq              >> 09045000
$page                                                                   09050000
  << **************************************** >>                        09055000
  << device information table (dit) elements. >>                        09060000
  << **************************************** >>                        09065000
                                                                        09070000
equate                                                                  09075000
                                                                        09080000
   << ********** >>                                                     09085000
   << dit words. >>                                                     09090000
   << ********** >>                                                     09095000
                                                                        09100000
   dit'size  = 29,  << size of dit                          >>          09105000
   dldev     =  3,  << logical device                       >>          09110000
   diltp     =  5,  << interrupt linkage table pointer      >>          09115000
   dstat     =  6,  << device powerfail status              >>          09120000
   dserr     =  7,  << dit error log lenght/offset          >>          09125000
   dunit     = 10,                                                      09130000
   dmisc     = 11,  << device dependent word                >>          09135000
   dbadblk1  = 12,  << high order addr of bad block         >>          09140000
   dbadblk2  = 13,  << low order addr of bad block          >>          09145000
   dbadxfer  = 14,  << byte xfer left after bad block       >>          09150000
   dlogerror = 15,  << dit hardware error logged status     >>          09155000
   dsiopstop = 16,  << dit cp stopped relative offset       >>          09160000
   dbytecnt  = 17,  << accum byte count > 6144 bytes        >>          09165000
   dstatus   = 19,  << buffalo status                       >>          09170000
                                                                        09175000
   << dit status offset >>                                              09180000
                                                                        09185000
   id'field      = dstatus,    << identification field      >>          09190000
   reject'field  = dstatus+1,  << reject errors field       >>          09195000
   fault'field   = dstatus+2,  << fault errors field        >>          09200000
   access'field  = dstatus+3,  << access errors field       >>          09205000
   infor'field   = dstatus+4,  << information field         >>          09210000
   parm'field    = dstatus+5;  << parameter fields          >>          09215000
$page                                                                   09220000
define                                                                  09225000
                                                                        09230000
   << ********* >>                                                      09235000
   << dit bits. >>                                                      09240000
   << ********* >>                                                      09245000
                                                                        09250000
   dldev'ld'bits          = (0:16)#,                                    09255000
   dmisc'lk'bit           = ( 0:1)#,                                    09260000
   dmisc'ig'bit           = ( 1:1)#,                                    09265000
   dmisc'im'bit           = ( 2:1)#,                                    09270000
   dmisc'ss'bits          = (12:4)#, << substate of the driver   >>     09275000
                                                                        09280000
   id'field'ua'bits       = ( 8:8)#, << unit attention bits      >>     09285000
                                                                        09290000
   reject'field'cp'bit    = ( 2:1)#, << channel parity bit       >>     09295000
   reject'field'io'bit    = ( 5:1)#, << illegal opcode bit       >>     09300000
   reject'field'md'bit    = ( 6:1)#, << module addr error bit    >>     09305000
   reject'field'ab'bit    = ( 7:1)#, << addr bounds bit          >>     09310000
   reject'field'pb'bit    = ( 8:1)#, << parameter bounds bit     >>     09315000
   reject'field'ip'bit    = ( 9:1)#, << illegal parameter bit    >>     09320000
   reject'field'ms'bit    = (10:1)#, << msg seq violation bit    >>     09325000
   reject'field'ml'bit    = (12:1)#, << msg length differ bit    >>     09330000
                                                                        09335000
   fault'field'cu'bit     = ( 1:1)#, << error during copy oper   >>     09340000
   fault'field'cf'bit     = ( 3:1)#, << controller fault bit     >>     09345000
   fault'field'uf'bit     = ( 6:1)#, << unit fault bit           >>     09350000
   fault'field'df'bit     = ( 8:1)#, << diag failed bit          >>     09355000
   fault'field'or'bit     = (10:1)#, << oper rel required bit    >>     09360000
   fault'field'dr'bit     = (11:1)#, << diag rel required bit    >>     09365000
   fault'field'im'bit     = (12:1)#, << int maint required bit   >>     09370000
   fault'field'pf'bit     = (14:1)#, << power fail bit           >>     09375000
   fault'field're'bit     = (15:1)#, << rrtransmit/rel cmplt bit >>     09380000
                                                                        09385000
   access'field'ip'bit    = ( 0:1)#, << illegal /  operation bit >>     09390000
   access'field'um'bit    = ( 1:1)#, << uninitialized media bit  >>     09395000
   access'field'ns'bit    = ( 2:1)#, << no spare available bit   >>     09400000
   access'field'dn'bit    = ( 3:1)#, << device not ready bit     >>     09405000
   access'field'wp'bit    = ( 4:1)#, << write protect bit        >>     09410000
   access'field'nd'bit    = ( 5:1)#, << no data found bit        >>     09415000
   access'field'uo'bit    = ( 8:1)#, << unrecov data overflow bit>>     09420000
   access'field'ud'bit    = ( 9:1)#, << unrecov data bit         >>     09425000
   access'field'ef'bit    = (11:1)#, << end of file bit          >>     09430000
   access'field'ev'bit    = (12:1)#, << end of volume bit        >>     09435000
                                                                        09440000
   infor'field'or'bit     = ( 0:1)#, << operator rel request bit >>     09445000
   infor'field'dr'bit     = ( 1:1)#, << diag rel request bit     >>     09450000
   infor'field'im'bit     = ( 2:1)#, << int maint request bit    >>     09455000
   infor'field'mw'bit     = ( 3:1)#, << media wearing out bit    >>     09460000
   infor'field'do'bit     = ( 4:1)#, << data overrun bit         >>     09465000
   infor'field'db'bit     = ( 7:1)#, << defective blk auto spared>>     09470000
   infor'field'ro'bit     = ( 9:1)#, << recov data overflow bit  >>     09475000
   infor'field'md'bit     = (10:1)#, << marginal data bit        >>     09480000
   infor'field'rd'bit     = (11:1)#, << recov data bit           >>     09485000
   infor'field'mt'bit     = (13:1)#, << maint track overflow bit >>     09490000
$page                                                                   09495000
   << ************* >>                                                  09500000
   << dit elements. >>                                                  09505000
   << ************* >>                                                  09510000
                                                                        09515000
   dit'addr1'bad'block  =  p'dit (dbadblk1    )                     #,  09520000
   dit'addr2'bad'block  =  p'dit (dbadblk2    )                     #,  09525000
   dit'bad'transfer     =  p'dit (dbadxfer    )                     #,  09530000
   dit'ilt'ptr          =  p'dit (diltp       )                     #,  09535000
   dit'ldev             =  p'dit (dldev       )                     #,  09540000
   dit'log'error        =  p'dit (dlogerror   )                     #,  09545000
   dit'save'word        =  p'dit (dstat       )                     #,  09550000
   dit'siop'stop        =  p'dit (dsiopstop   )                     #,  09555000
   dit'error'status     =  p'dit (dserr       )                     #,  09560000
   dit'lock'flg         =  p'dit (dmisc       ).dmisc'lk'bit        #,  09565000
   dit'ignore'int       =  p'dit (dmisc       ).dmisc'ig'bit        #,  09570000
   dit'immediate'mode   =  p'dit (dmisc       ).dmisc'im'bit        #,  09575000
   dit'substate         =  p'dit (dmisc       ).dmisc'ss'bits       #,  09580000
$page                                                                   09585000
   dit'first'stat'word  =  p'dit (id'field    )                     #,  09590000
   dit'unit'attention   =  p'dit (id'field    ).id'field'ua'bits    #,  09595000
                                                                        09600000
   dit'chan'parity'err  =  p'dit (reject'field).reject'field'cp'bit #,  09605000
   dit'ill'opcode       =  p'dit (reject'field).reject'field'io'bit #,  09610000
   dit'module'addr'err  =  p'dit (reject'field).reject'field'md'bit #,  09615000
   dit'addr'bounds      =  p'dit (reject'field).reject'field'ab'bit #,  09620000
   dit'parameter'bound  =  p'dit (reject'field).reject'field'pb'bit #,  09625000
   dit'ill'parameter    =  p'dit (reject'field).reject'field'ip'bit #,  09630000
   dit'ill'msg'seq      =  p'dit (reject'field).reject'field'ms'bit #,  09635000
   dit'msg'length'err   =  p'dit (reject'field).reject'field'ml'bit #,  09640000
                                                                        09645000
   dit'copy'err         =  p'dit (fault'field ).fault'field'cu'bit #,   09650000
   dit'controller'fault =  p'dit (fault'field ).fault'field'cf'bit #,   09655000
   dit'unit'fault       =  p'dit (fault'field ).fault'field'uf'bit #,   09660000
   dit'diag'fail        =  p'dit (fault'field ).fault'field'df'bit #,   09665000
   dit'opr'rel'req      =  p'dit (fault'field ).fault'field'or'bit #,   09670000
   dit'diag'rel'req     =  p'dit (fault'field ).fault'field'dr'bit #,   09675000
   dit'int'maint'req    =  p'dit (fault'field ).fault'field'im'bit #,   09680000
   dit'dev'powerfail    =  p'dit (fault'field ).fault'field'pf'bit #,   09685000
   dit'retransmit       =  p'dit (fault'field ).fault'field're'bit #,   09690000
                                                                        09695000
   dit'ill'operation    =  p'dit (access'field).access'field'ip'bit #,  09700000
   dit'uninit'media     =  p'dit (access'field).access'field'um'bit #,  09705000
   dit'spare'unavail    =  p'dit (access'field).access'field'ns'bit #,  09710000
   dit'dev'not'rdy      =  p'dit (access'field).access'field'dn'bit #,  09715000
   dit'write'protect    =  p'dit (access'field).access'field'wp'bit #,  09720000
   dit'no'data'found    =  p'dit (access'field).access'field'nd'bit #,  09725000
   dit'data'overflow    =  p'dit (access'field).access'field'uo'bit #,  09730000
   dit'unrecov'data     =  p'dit (access'field).access'field'ud'bit #,  09735000
   dit'end'of'file      =  p'dit (access'field).access'field'ef'bit #,  09740000
   dit'end'of'volume    =  p'dit (access'field).access'field'ev'bit #,  09745000
                                                                        09750000
   dit'i'opr'rel'req    =  p'dit (infor'field ).infor'field'or'bit #,   09755000
   dit'i'diag'rel'req   =  p'dit (infor'field ).infor'field'dr'bit #,   09760000
   dit'i'int'maint'req  =  p'dit (infor'field ).infor'field'im'bit #,   09765000
   dit'media'wear'out   =  p'dit (infor'field ).infor'field'mw'bit #,   09770000
   dit'data'overrun     =  p'dit (infor'field ).infor'field'do'bit #,   09775000
   dit'defect'blk'spare =  p'dit (infor'field ).infor'field'db'bit #,   09780000
   dit'no'data'overflow =  p'dit (infor'field ).infor'field'ro'bit #,   09785000
   dit'marginal'data    =  p'dit (infor'field ).infor'field'md'bit #,   09790000
   dit'recov'data       =  p'dit (infor'field ).infor'field'rd'bit #,   09795000
   dit'maint'track      =  p'dit (infor'field ).infor'field'mt'bit #,   09800000
                                                                        09805000
   dit'parm'field1      =  p'dit (parm'field+1)                     #,  09810000
   dit'parm'field2      =  p'dit (parm'field+2)                     #;  09815000
$page                                                                   09820000
equate                                                                  09825000
                                                                        09830000
  << *************** >>                                                 09835000
  << function codes. >>                                                 09840000
  << *************** >>                                                 09845000
                                                                        09850000
  fc'read           = 0 ,                                               09855000
  fc'write          = 1 ,                                               09860000
  fc'open'file      = 2 ,                                               09865000
  fc'close'file     = 3 ,                                               09870000
  fc'close'device   = 4 ,                                               09875000
  fc'req'last'stat  = 5 , << request status from last i/o. >>           09880000
  fc'init'media     = 6 , << initialize the media.         >>           09885000
  fc'unload'cart    = 7 ,                                               09890000
  fc'req'vol'limit  = 8 , << request the size of volume.   >>           09895000
  fc'loc'n'verify   = 9 , << locate and verify the media.  >>           09900000
  fc'req'generic    = 10, << request generic status.       >>           09905000
  fc'lock           = 11, << lock the volume from release. >>           09910000
  fc'unlock         = 12,                                               09915000
  fc'read'lock'bit  = 13,                                               09920000
  fc'immediate'mode = 14,                                               09925000
  fc'identify       = 15,                                               09930000
  fc'init'selftest  = 16, << perform diagnostic selftest.  >>           09935000
  fc'loopback'write = 17,                                               09940000
  fc'loopback'read  = 18,                                               09945000
  fc'release        = 19,                                               09950000
  fc'release'denied = 20,                                               09955000
  fc'set'release    = 21,                                               09960000
  fc'set'address    = 22,                                               09965000
  fc'spare'block    = 23, << allow drive to do sparing.    >>           09970000
  fc'initiate'util  = 24,                                               09975000
  fc'device'clear   = 25,                                               09980000
  fc'cancel'tran    = 26,                                               09985000
  fc'parity'check   = 27, << enable/disable parity on cmds.>>           09990000
  fc'generic'diag   = 28, << generic diagnostic commands.  >>           09995000
$page                                                                   10000000
  << ************************ >>                                        10005000
  << io status return values. >>                                        10010000
  << ************************ >>                                        10015000
                                                                        10020000
  write'ring'wait  =  %40,                                              10025000
                                                                        10030000
  good'io          =    1,                                              10035000
  good'retry       =  %21,                                              10040000
                                                                        10045000
  read'last'stat   =  %13, << status interrog required       >>         10050000
  system'abort     =  %33,                                              10055000
  prior'err'abort  =  %43,                                              10060000
  powerfail'abort  =  %63,                                              10065000
  backspace'bot    =  %73, << bot and backspace requested.   >>         10070000
  dev'power'on     = %213, << device powered on              >>         10075000
                                                                        10080000
  invalid'request  =    4,                                              10085000
  track'sect'error =  %14, << unrecov track/sector error     >>         10090000
  timeout'error    =  %24, << timed out error                >>         10095000
  chan'pgm'failure =  %44,                                              10100000
  unit'failure     =  %54,                                              10105000
  invalid'addr     =  %64, << invalid address                >>         10110000
  system'error     = %124,                                              10115000
  chan'io'failure  = %144,                                              10120000
  uninit'media'err = %154, << uninitialized media            >>         10125000
  no'spare'err     = %164; << no spare abailable             >>         10130000
$page                                                                   10135000
equate                                                                  10140000
   << ********* >>                                                      10145000
   << ilt words >>                                                      10150000
   << ********* >>                                                      10155000
                                                                        10160000
   << idle cp status offset >>                                          10165000
                                                                        10170000
   ilt'fault'field  = 2,       << idle fault errors field         >>    10175000
   ilt'access'field = 3,       << idle access errors field        >>    10180000
   ilt'infor'field  = 4;       << idle information field          >>    10185000
                                                                        10190000
define                                                                  10195000
   << ********* >>                                                      10200000
   << ilt bits  >>                                                      10205000
   << ********* >>                                                      10210000
                                                                        10215000
   ilt'dn'bits      = ( 7:9)#, << drt extract from ilt(ilt'cntrl) >>    10220000
                                                                        10225000
   cpva'ec'bits     = ( 0:3)#, << cpvap, error code               >>    10230000
   cpva'st'bits     = (12:4)#, << cpvap, status from the cp       >>    10235000
                                                                        10240000
   << ************ >>                                                   10245000
   << ilt elements >>                                                   10250000
   << ************ >>                                                   10255000
                                                                        10260000
   ilt'drt'number       = p'ilt(ilt'cntrl).ilt'dn'bits#,                10265000
                                                                        10270000
   cpva'errorcode       = p'cpva(0).cpva'ec'bits#,                      10275000
   cpva'status          = p'cpva(1).cpva'st'bits#;                      10280000
$page                                                                   10285000
define                                                                  10290000
  << ************************ >>                                        10295000
  << generic status elements. >>                                        10300000
  << ************************ >>                                        10305000
                                                                        10310000
  gs'fatal'error      = generic'status.( 0:4)#,                         10315000
  gs'density          = generic'status.( 4:3)#,                         10320000
  gs'unit'number      = generic'status.( 7:2)#,                         10325000
  gs'end'of'file      = generic'status.( 9:1)#,                         10330000
  gs'load'point       = generic'status.(10:1)#,                         10335000
  gs'end'of'tape      = generic'status.(11:1)#,                         10340000
  gs'immed'rpt'enable = generic'status.(12:1)#,                         10345000
  gs'recovered'err    = generic'status.(13:1)#,                         10350000
  gs'unit'online      = generic'status.(14:1)#,                         10355000
  gs'file'protect     = generic'status.(15:1)#;                         10360000
$page                                                                   10365000
equate                                                                  10370000
                                                                        10375000
   << cs'80 buffalo drive type and subtype >>                           10380000
                                                                        10385000
   type'buffalo      = 3,                                               10390000
   subtype'buffalo   = 3,                                               10395000
                                                                        10400000
   << iltp parameters >>                                                10405000
                                                                        10410000
   ilt'cntrl =  7,  << drt word                             >>          10415000
   ilt'siop  =  8,  << channel program area pointer         >>          10420000
   ilt'stap  =  9,  << status area pointer                  >>          10425000
                                                                        10430000
   << cs'80 secondaries commands >>                                     10435000
                                                                        10440000
   wrt'cmd'sec      =   %2005,  << wrt w/cmd msg sec        >>          10445000
   read'trans'sec   =   %3402,  << read w/trans msg sec     >>          10450000
   wrt'trans'sec    =   %4002,  << wrt w/trans msg sec      >>          10455000
   read'exec'sec    =   %1416,  << read w/exec msg sec      >>          10460000
   wrt'exec'sec     =   %2016,  << wrt w/exec msg sec       >>          10465000
                                                                        10470000
   << cs'80 buffalo driver command data bytes >>                        10475000
   << list is in alphabete order              >>                        10480000
                                                                        10485000
   cdb'cancel         =  %11,  << cancel command            >>          10490000
   cdb'ci'clear       =  %10,  << channel independent clear >>          10495000
   cdb'describe       =  %65,  << describe command          >>          10500000
   cdb'init'diag      =  %63,  << init diagnostic command   >>          10505000
   cdb'init'media     =  %67,  << initialize media command  >>          10510000
   cdb'init'util      =  %60,  << no executing message      >>          10515000
   cdb'jump'spare     =    4,  << jump spare parameter      >>          10520000
   cdb'nop            =  %64,  << no operation command      >>          10525000
   cdb'parity'op      =    1,  << parity opcode command     >>          10530000
   cdb'read           =    0,  << locate & read command     >>          10535000
   cdb'read'loopbk    =   %2,  << read loopback command     >>          10540000
   cdb'release        =  %16,  << release command           >>          10545000
   cdb'release'deny   =  %17,  << release denied command    >>          10550000
   cdb'req'status     =  %15,  << request status command    >>          10555000
   cdb'set'length     =  %30,  << set length command        >>          10560000
   cdb'set'options    =  %70,  << set options command       >>          10565000
   cdb'set'mask       =  %76,  << set status mask cmd       >>          10570000
   cdb'set'release    =  %73,  << set release command       >>          10575000
   cdb'set'retadr     = %110,  << set return addr mode cmd  >>          10580000
   cdb'set'retry      =  %72,  << set retry time command    >>          10585000
   cdb'set'sngl'vec   =  %20,  << set single vec addr cmd   >>          10590000
   cdb'set'unit       =  %40,  << set unit number command   >>          10595000
   cdb'set'vol        = %100,  << set volume number command >>          10600000
   cdb'skip'spare     =    6,  << skip spare parameter      >>          10605000
   cdb'spare'blk      =   %6,  << spare block command       >>          10610000
   cdb'unload         = %112,  << unload command            >>          10615000
   cdb'verify         =   %4,  << verify command            >>          10620000
   cdb'write          =   %2,  << locate & write command    >>          10625000
   cdb'wrt'loopbk     =   %3,  << write loopback command    >>          10630000
$page                                                                   10635000
   << channel program offsets relative to siop >>                       10640000
                                                                        10645000
   first'id      = 0,             << initialization offset  >> <<f9010>>10650000
   firstbranch   = first'id+4,                                 <<f9010>>10655000
   branchpt      = firstbranch+1, << branch offset          >>          10660000
   idle          = branchpt+1,   << idle cp offset          >>          10665000
   idle'wait     = idle+5,       << idle when dev not ready >>          10670000
   syncdsj       = idle'wait+14, << get insync w. cs80 cmds >>          10675000
   ident         = syncdsj+9,    << identify section offset >>          10680000
   dxfer         = ident+4,      << data xfer sec. offset   >>          10685000
   rstat         = dxfer+21,     << read status offset      >>          10690000
   diag          = rstat+23,     << read status offset      >>          10695000
   pon           = diag+14,      << power on offset         >>          10700000
   stat'cdb      = pon+19,       << identify section offset?>>          10705000
   loc'wrt'cdb   = stat'cdb+1,   << loc & write cdb offset  >>          10710000
   pon'cdb'1     = loc'wrt'cdb+4,<< ci clear and parity on  >>          10715000
   pon'cdb'2     = pon'cdb'1+1,  << enable immediate rpt mod>>          10720000
   initflg       = pon'cdb'2+1,  << init flag offset        >>          10725000
   fill'wrd      = initflg+1,    << fill word offset        >>          10730000
   desc'area     = fill'wrd+1,   << describe area offset    >>          10735000
   cdb'area'wrd  = desc'area+10, << cdb storage area offset >>          10740000
   cpgm'size     = cdb'area'wrd+10, << length of cp          >>         10745000
   cpgm'sized2   = (cpgm'size+2)/2, << length of cp / 2      >>         10750000
   init'ary'size = 4+dit'size+cpgm'size,<< len of init array>>          10755000
                                                                        10760000
   desc'area'byte = desc'area*2,    << desc area byte offset>>          10765000
   cdb'area'byte  = cdb'area'wrd*2, << cdb area byte offset >>          10770000
                                    << valid only for single>>          10775000
                                    << vector addresses.    >>          10780000
   volume'limit   = (desc'area'byte + 30) / 2,                          10785000
$page                                                                   10790000
   << entries points to the channel program sections.>>                 10795000
                                                                        10800000
   cp'base         = firstbranch+2,    << cp base              >>       10805000
   enter'idle      = idle-cp'base,     << idle cp entry        >>       10810000
   enter'idle'wait = idle'wait-cp'base,<< idle wait cp entry   >>       10815000
   enter'sync'dsj  = syncdsj-cp'base,  << offset from 1st jump >>       10820000
   enter'data'xfer = dxfer-cp'base,    << data xfer entry      >>       10825000
   enter'stat'req  = rstat-cp'base,    << request status entry >>       10830000
   enter'diag      = diag-cp'base,     << diag function entry  >>       10835000
   enter'power'on  = pon-cp'base,      << power on (up) entry  >>       10840000
   enter'identify  = ident-cp'base;    << identify entry       >>       10845000
$page                                                                   10850000
define                                                                  10855000
   << channel program sections offsets >>                               10860000
                                                                        10865000
   cp'first'branch         = siop(branchpt   )        #,                10870000
   cp'idle'cdb'offset      = siop(idle   + 16)        #,                10875000
   cp'ident'hpib'id        = siop(ident  +  1)        #,                10880000
   cp'dxfer'write'read     = siop(dxfer  +  0)        #,                10885000
   cp'dxfer'cdb'length     = siop(dxfer  +  1)        #,                10890000
   cp'dxfer'cdb'bank       = siop(dxfer  +  3).( 8: 8)#,                10895000
   cp'dxfer'cdb'offset     = siop(dxfer  +  4)        #,                10900000
   cp'dxfer'wait'5         = siop(dxfer  +  5)        #,                10905000
   cp'dxfer'wait'6         = siop(dxfer  +  6)        #,                10910000
   cp'dxfer'cmd'to'exec    = siop(dxfer  +  7)        #,                10915000
   cp'dxfer'data'size      = siop(dxfer  +  8)        #,                10920000
   cp'dxfer'data'type      = siop(dxfer  + 10).( 0: 8)#,                10925000
   cp'dxfer'dont'c'addr    = siop(dxfer  + 10).( 4: 1)#,                10930000
   cp'dxfer'data'bank      = siop(dxfer  + 10).( 8: 8)#,                10935000
   cp'dxfer'data'offset    = siop(dxfer  + 11)        #,                10940000
   cp'dxfer'12'wait        = siop(dxfer  + 12)        #,                10945000
   cp'dxfer'13'wait        = siop(dxfer  + 13)        #,                10950000
   cp'rstat'cdb'offset     = siop(rstat  +  4)        #,                10955000
   cp'rstat'stat'area      = siop(rstat  + 11)        #,                10960000
   cp'diag'cmd'to'exec     = siop(diag   +  0)        #,                10965000
   cp'diag'cdb'length      = siop(diag   +  1)        #,                10970000
   cp'diag'cdb'bank        = siop(diag   +  3).( 8: 8)#,                10975000
   cp'diag'cdb'offset      = siop(diag   +  4)        #,                10980000
   cp'diag'wait'5          = siop(diag   +  5)        #,                10985000
   cp'diag'wait'6          = siop(diag   +  6)        #,                10990000
   cp'pon'cdb'offset       = siop(pon    +  4)        #,                10995000
   cp'pon'cdb'2'offset     = siop(pon    + 16)        #,                11000000
   cp'init'dvr'flag        = siop(initflg    )        #,                11005000
   cp'fill'word            = siop(fill'wrd   )        #;                11010000
$page                                                                   11015000
equate                                                                  11020000
   << buffalo driver states kept in ioq'qmisc >>               <<f9010>>11025000
                                                                        11030000
   cmpltion'wait  = 1,  << waiting for i/o completion intrpt>>          11035000
   not'rdy'wait   = 2,  << not ready wait in progress       >>          11040000
   rel'wait       = 3,  << rel/rel denied completion wait   >>          11045000
   ioq'defer'wait = 4,  << ioq being deferred wait          >>          11050000
   sync'wait      = 5,  << driver/firmware sync wait        >>          11055000
   opintrvnwait   = 6,  << unit not ready wait for operator >>          11060000
   abort'ioq'wait = 7,  << abort current i/o wait           >>          11065000
                                                                        11070000
   << buffalo driver state kept in dit'dmisc >>                <<f9010>>11075000
   normal'idle    = 0,                                         <<f9010>>11080000
   idle'req'wait  = 1,  << idle request completion wait     >>          11085000
                                                                        11090000
   << siodm monitor states kept in dit'dflag >>                <<f9010>>11095000
                                                                        11100000
   initiator'state  =   2,                                              11105000
   completor'state  =   3,                                              11110000
   request'complete =   5,  << request done                 >>          11115000
   not'ready        =   7,  << unit not ready               >>          11120000
   interrupt'wait   = %13,  << waiting for i/o completion   >>          11125000
                                                                        11130000
   << i/o message parameters >>                                         11135000
                                                                        11140000
   console           =   0, << output msg to system console >>          11145000
   nsys'deny'msg     =  26, << non-sysdisc unload denied msg>>          11150000
   not'ready'msg     =  11, << not ready message index.     >>          11155000
   no'write'ring'msg = 220, << no write ring message index. >>          11160000
                                                                        11165000
$page                                                                   11170000
   << ***********************************. >>                           11175000
   << misc pointers and program constants. >>                           11180000
   << ************************************ >>                           11185000
                                                                        11190000
   cpva'timeout       = %160004,<< cpva returned if gic timeout>>       11195000
   ctrl'unit          = %17,    << controller unit             >>       11200000
   max'desc'byte      = 37,     << max# descrive bytes         >>       11205000
   six'k'bytes        = 6144,   << 6k bytes                    >>       11210000
   sysdb              = %1000,  << address of sysdb area       >>       11215000
   dev'stat'word'size = 10,                                             11220000
   dma'abort          = 6,                                              11225000
   channel'abort      = 7,                                              11230000
   retry'limit        = 7,                                              11235000
   wait'instr         = %1000,   << hpib wait instruction      >>       11240000
   blanks             = %20040,  << word filled with spaces    >>       11245000
   ignore'interrupt   = %101010, << ignore the interrupt       >>       11250000
   zero               = 0,                                              11255000
   one                = 1,                                              11260000
   two                = 2,                                              11265000
   three              = 3,                                              11270000
   four               = 4;                                              11275000
$page                                                                   11280000
define                                                                  11285000
   hell'froze'over = 1 > 2#,                                            11290000
                                                                        11295000
   << statement defines >>                                              11300000
                                                                        11305000
   disable    = assemble (sed 0)#,                                      11310000
   setdb'sys  = begin                                                   11315000
                tos := %1000d;                                          11320000
                assemble ( xchd; ddel );                                11325000
                end#,                                                   11330000
   setdb'siop = begin                                                   11335000
                tos := abs'siop'addr;                                   11340000
                assemble ( xchd; ddel );                                11345000
                end#,                                                   11350000
   log'status = dit'error'status := [8/10,8/dstatus]#;                  11355000
                                                                        11360000
logical                                                                 11365000
   spu'powerfail = db + %72,  << sysdb rel powerfail word   >>          11370000
   system'up     = db + %73;  << sysdb rel system up word   >>          11375000
                                                                        11380000
byte array                                                              11385000
   siodb'byte'array(*) = db + 0;  << when db = abs'siop >>              11390000
$page                                                                   11395000
<<                                                                      11400000
        ******************************************                      11405000
        *                                        *                      11410000
        *   buffalo driver db area definitions   *                      11415000
        *                                        *                      11420000
        ******************************************                      11425000
>>                                                                      11430000
                                                                        11435000
   array initial(0:init'ary'size) = db :=                               11440000
   [8/dit'size,8/%21], << disc dit size, core resident        >>        11445000
                       << idle channel program, driver type 1 >>        11450000
                 zero, << not used                            >>        11455000
                    0, << unit extract instruction - nop >>    <<f9010>>11460000
   [8/cpgm'sized2,8/10],<<cp size/2,10 words of status        >>        11465000
                                                                        11470000
   <<--------------->>                                                  11475000
   << buffalo's dit >>                                                  11480000
   <<--------------->>                                                  11485000
                                                                        11490000
   << 0  >>    zero,   << dflag                >>                       11495000
   << 1  >>    zero,   << dlink                >>                       11500000
   << 2  >>    zero,   << dioqp                >>                       11505000
   << 3  >>    zero,   << dldev                >>                       11510000
   << 4  >>    zero,   << ddltp                >>                       11515000
   << 5  >>    zero,   << diltp                >>                       11520000
   << 6  >>    zero,   << dstat                >>                       11525000
   << 7  >>    zero,   << dserr                >>                       11530000
   << 8  >>    zero,   << dqhead               >>                       11535000
   << 9  >>    zero,   << dqtail               >>                       11540000
   << 10 >>    zero,   << dunit                >>                       11545000
   << 11 >>  %20000,   << dmisc(immediate mode)>>                       11550000
   << 12 >>    zero,   << dbadblk1             >>                       11555000
   << 13 >>    zero,   << dbadblk2             >>                       11560000
   << 14 >>    zero,   << dbadxfer             >>                       11565000
   << 15 >>    zero,   << dlogerror            >>                       11570000
   << 16 >>    zero,   << dsiopstop            >>                       11575000
   << 17 >> zero,zero, << dbytecnt             >>                       11580000
          0,0,0,0,0,   << dstatus              >>                       11585000
          0,0,0,0,0,                                                    11590000
$page                                                                   11595000
   <<--------------------------------------------------->>              11600000
   << buffalo channel program (cp)                      >>              11605000
   <<--------------------------------------------------->>              11610000
                                                                        11615000
<< 0>>  << jump >>         0, << initialization entry>>        <<f9010>>11620000
<< 1>>                     0,                                  <<f9010>>11625000
                                                               <<f9010>>11630000
<< 0>>  << identify >> %3000, << check for device present>>    <<f9010>>11635000
<< 1>>                     0,                                  <<f9010>>11640000
                                                               <<f9010>>11645000
<< 0>>  << jump >>         0, << branch point to cp sect>>              11650000
<< 1>>                     0,                                           11655000
                                                                        11660000
   <<-------------------------------------------------->>               11665000
   << idle cp - on hard error, requests status and on  >>               11670000
   <<           power on returns an idle pon status    >>               11675000
   <<-------------------------------------------------->>               11680000
                                                                        11685000
<< 0>>  << dsj  >>     %2402, << dsj to check power on >>               11690000
<< 1>>                     0, << return byte           >>               11695000
<< 2>>                     0, << normal return         >>               11700000
<< 3>>                     7, << hard error /req status>>               11705000
<< 4>>                    21, << idle power on occured >>               11710000
                                                                        11715000
<< 0>>  << wait >>     %1000, << wait for ppoll        >>               11720000
<< 1>>                     0,                                           11725000
                                                                        11730000
<< 2>>  << dsj >>      %2402, << reporting msg secondary>>              11735000
<< 3>>                     0, << return byte           >>               11740000
<< 4>>                    12, << normal completion     >>               11745000
<< 5>>                     0, << hard error /req status>>               11750000
<< 6>>                    14, << idle power on occurred>>               11755000
                                                                        11760000
<< 7>>  << loc & wrt >>%2005, << command msg secondary >>               11765000
<< 8>>                     7, << cmd buffer length     >>               11770000
<< 9>>                     0, << no burst              >>               11775000
<<10>>                %42000, << cmd buffer bank       >>               11780000
<<11>>                     0, << cmd buffer abs addr   >>               11785000
                                                                        11790000
<<12>>  << wait >>     %1000, << wait for ppoll        >>               11795000
<<13>>                     0,                                           11800000
                                                                        11805000
<<14>>  << dsj >>      %2402, << reporting msg secondary>>              11810000
<<15>>                     0, << return byte           >>               11815000
<<16>>                     0, << normal completion     >>               11820000
<<17>>                    29, << hard error /req status>>               11825000
<<18>>                     2, << power on occurred     >>               11830000
                                                                        11835000
<<19>>  << int/hlt0 >>  %601, << interrupt/halt        >>               11840000
<<20>>                     0, << code of 0 in cpva(1)  >>               11845000
                                                                        11850000
<<21>>  << int/hlt4 >>  %601, << interrupt/halt        >>               11855000
<<22>>                     4, << code of 4 in cpva(1)  >>               11860000
$page                                                                   11865000
   <<-------------------------------------------------->>               11870000
   <<         identify instruction                     >>               11875000
   <<-------------------------------------------------->>               11880000
                                                                        11885000
<< 0>>  << identify >> %3000,                                           11890000
<< 1>>                     0, << id return byte        >>               11895000
                                                                        11900000
<< 2>>                  %601, << interrupt/halt        >>               11905000
<< 3>>                     0, << code of 0 in cpva(1)  >>               11910000
$page                                                                   11915000
   <<-------------------------------------------------->>               11920000
   << [dxfer] real-time & some general purpose cmds    >>               11925000
   << command - execution - reporting message sections >>               11930000
   <<-------------------------------------------------->>               11935000
                                                                        11940000
<< 0>>  << write ctrl>>%2005, << command msg secondary >>               11945000
<< 1>>                     0, << cmd buffer length     >>               11950000
<< 2>>                     0, << no burst              >>               11955000
<< 3>>                 %2000, << cmd buffer bank       >>               11960000
<< 4>>                     0, << cmd buffer abs addr   >>               11965000
                                                                        11970000
<< 5>>  << wait >>     %1000, << wait for ppoll        >>               11975000
<< 6>>                     0,                                           11980000
                                                                        11985000
<< 7>>  <<rd/wrt ctrl>>%1416, << execution msg secondary>>              11990000
<< 8>>                     0, << #bytes to read/write  >>               11995000
<< 9>>                     0, << no burst              >>               12000000
<<10>>                     0, << data bank             >>               12005000
<<11>>                     0, << data buffer abs addr  >>               12010000
                                                                        12015000
<<12>>  << wait >>     %1000, << wait for ppoll        >>               12020000
<<13>>                     0,                                           12025000
                                                                        12030000
<<14>>  << dsj >>      %2402, << reporting msg secondary>>              12035000
<<15>>                     0, << return byte           >>               12040000
<<16>>                     0, << normal completion     >>               12045000
<<17>>                     2, << hard error /req status>>               12050000
<<18>>                    39, << power on occurred     >>               12055000
                                                                        12060000
<<19>>  << int/hlt0 >>  %601, << interrupt/halt        >>               12065000
<<20>>                     0, << code of 0 in cpva(1)  >>               12070000
$page                                                                   12075000
   <<-------------------------------------------------->>               12080000
   << [rstat] status interrogation section             >>               12085000
   << command - execution - reporting message sections >>               12090000
   <<-------------------------------------------------->>               12095000
                                                                        12100000
<< 0>>  << write ctrl>>%2005, << command msg secondary >>               12105000
<< 1>>                     1, << cmd buffer length     >>               12110000
<< 2>>                     0, << no burst              >>               12115000
<< 3>>                %42000, << cmd buffer bank       >>               12120000
<< 4>>  << stat cdb >>     0, << cmd buffer abs addr   >>               12125000
                                                                        12130000
<< 5>>  << wait >>     %1000, << wait for ppoll        >>               12135000
<< 6>>                     0,                                           12140000
                                                                        12145000
<< 7>>  << read ctrl >>%1416, << execution msg secondary>>              12150000
<< 8>>                    20, << #status bytes to read >>               12155000
<< 9>>                     0, << no burst              >>               12160000
<<10>>                 %2000, << data bank             >>               12165000
<<11>>  << stat area >>    0, << data buffer abs addr  >>               12170000
                                                                        12175000
<<12>>  << wait >>     %1000, << wait for ppoll        >>               12180000
<<13>>                     0,                                           12185000
                                                                        12190000
<<14>>  << dsj >>      %2402, << reporting msg secondary>>              12195000
<<15>>                     0, << return byte           >>               12200000
<<16>>                     0, << normal completion     >>               12205000
<<17>>                     2, << hard error /req status>>               12210000
<<18>>                    18, << power on occurred     >>               12215000
                                                                        12220000
<<19>>  << int/hlt1 >>  %601, << interrupt/halt        >>               12225000
<<20>>                     1, << code of 1 in cpva(1)  >>               12230000
                                                                        12235000
<<21>>  << int/hlt3 >>  %601, << interrupt/halt        >>               12240000
<<22>>                     3, << code of 3 in cpva(1)  >>               12245000
$page                                                                   12250000
   <<-------------------------------------------------->>               12255000
   << [diag] complementary, gp, diag, trans commands   >>               12260000
   << command/trans - reporting message sections       >>               12265000
   <<-------------------------------------------------->>               12270000
                                                                        12275000
<< 0>>  << write ctrl>>%2005, << cmd/trans msg secondary>>              12280000
<< 1>>                     0, << cmd buffer length     >>               12285000
<< 2>>                     0, << no burst              >>               12290000
<< 3>>                 %2000, << cmd buffer bank       >>               12295000
<< 4>>                     0, << cmd buffer abs addr   >>               12300000
                                                                        12305000
<< 5>>  << wait >>     %1000, << wait for ppoll        >>               12310000
<< 6>>                     0,                                           12315000
                                                                        12320000
<< 7>>  << dsj >>      %2402, << reporting msg secondary>>              12325000
<< 8>>                     0, << return byte           >>               12330000
<< 9>>                     0, << normal completion     >>               12335000
<<10>>                   -35, << hard error /req status>>               12340000
<<11>>                     2, << power on occurred     >>               12345000
                                                                        12350000
<<12>>  << int/hlt0 >>  %601, << interrupt/halt        >>               12355000
<<13>>                     0, << code of 0 in cpva(1)  >>               12360000
$page                                                                   12365000
   <<-------------------------------------------------->>               12370000
   << [pon] channel independent clear on the device    >>               12375000
   << should be done, and parity on.                   >>               12380000
   <<-------------------------------------------------->>               12385000
                                                                        12390000
<< 0>>  << write tran>>%4002, << trans msg secondary   >>               12395000
<< 1>>                     2, << cmd buffer length     >>               12400000
<< 2>>                     0, << no burst              >>               12405000
<< 3>>  <<ci clear >>  %2000, << cmd buffer bank       >>               12410000
<< 4>>                     0, << cmd buffer abs addr   >>               12415000
                                                                        12420000
<< 5>>  << wait >>     %1000, << wait for ppoll        >>               12425000
<< 6>>                     0,                                           12430000
                                                                        12435000
<< 7>>  << dsj >>      %2402, << reporting msg secondary>>              12440000
<< 8>>                     0, << return byte           >>               12445000
<< 9>>                     0, << normal completion     >>               12450000
<<10>>                   -49, << hard error /req status>>               12455000
<<11>>                   -12, << power on occurred     >>               12460000
                                                                        12465000
<<12>>  << write tran>>%4002, << trans msg secondary   >>               12470000
<<13>>                     2, << cmd buffer length     >>               12475000
<<14>>                     0, << no burst              >>               12480000
<<15>>                 %2000, << cmd buffer bank       >>               12485000
<<16>>                     0, << cmd buffer abs addr   >>               12490000
                                                                        12495000
<<17>>  << int/hlt0 >>  %601, << interrupt/halt        >>               12500000
<<18>>                     2, << code of 2 in cpva(1)  >>               12505000
$page                                                                   12510000
   <<-------------------------------------------------->>               12515000
   <<  miscellaneous storage and constants area        >>               12520000
   <<-------------------------------------------------->>               12525000
                                                                        12530000
<< =============================================== >>                   12535000
<<               stat'cdb area                     >>                   12540000
<< =============================================== >>                   12545000
                                                                        12550000
<<  0>> << status'cdb >> %15, << cdb for request status>>               12555000
                                                                        12560000
<< =============================================== >>                   12565000
<<              loc'wrt'cdb area                   >>                   12570000
<< =============================================== >>                   12575000
                                                                        12580000
<<  0>> <<loc & wrt cdb>>%40, << set unit              >>               12585000
<<  1>>               %14000, << set length zero       >>               12590000
<<  2>>                    0,                                           12595000
<<  3>>                    2, << locate & write        >>               12600000
                                                                        12605000
<< =============================================== >>                   12610000
<<                pon'cdb'1 area                   >>                   12615000
<< =============================================== >>                   12620000
                                                                        12625000
<<  0>> <<pon cdb>>   %20010, << ci clear              >>               12630000
                                                                        12635000
<< =============================================== >>                   12640000
<<                pon'cdb'2 area                   >>                   12645000
<< =============================================== >>                   12650000
                                                                        12655000
<<  0>>                 %401, << set parity on commands>>               12660000
                                                                        12665000
<<  0>> << initflg >>      0, << initialization flag   >>               12670000
                                                                        12675000
<<  0>> << fill word >>    0, << fill w/zeros, blanks  >>               12680000
                                                                        12685000
<< =============================================== >>                   12690000
<<                 desc'area area                  >>                   12695000
<< =============================================== >>                   12700000
                                                                        12705000
<<  0>> << desc >> 0,0,0,0,0, << describe area         >>               12710000
<<  5>> << area >> 0,0,0,0,0,                                           12715000
                                                                        12720000
<< =============================================== >>                   12725000
<<                cdb'area'wrd area                >>                   12730000
<< =============================================== >>                   12735000
                                                                        12740000
<<  0>> << cdb  >> 0,0,0,0,0, << cdb area/desc area    >>               12745000
<<  5>> << area >> 0,0,0,0,0;                                           12750000
                                                                        12755000
$page                                                                   12760000
<<                                                                      12765000
         ***************************************                        12770000
         *                                     *                        12775000
         *   external procedure declarations   *                        12780000
         *                                     *                        12785000
         ***************************************                        12790000
>>                                                                      12795000
                                                                        12800000
integer procedure getdrt(drtn,offset);                                  12805000
   value drtn,offset;                                                   12810000
   integer drtn,offset;                                                 12815000
   option external;                                                     12820000
                                                                        12825000
procedure gip'hpib;                                                     12830000
   option external;                                                     12835000
                                                                        12840000
logical procedure iomessage(setno,msgno,mask,p1,p2,p3,p4,p5,            12845000
                            dest,reply,offset,p'dit,iotype);            12850000
   value setno,msgno,mask,p1,p2,p3,p4,p5,dest,reply,offset,             12855000
         p'dit,iotype;                                                  12860000
   integer setno,msgno,mask,p1,p2,p3,p4,p5,dest,reply,offset;           12865000
   integer iotype;                                                      12870000
   integer pointer p'dit;                                               12875000
   option variable, external;                                           12880000
                                                                        12885000
procedure ldevnotrdy(p'dit);                                            12890000
   value p'dit;                                                         12895000
   pointer p'dit;                                                       12900000
   option external;                                                     12905000
                                                                        12910000
procedure maint'request(ldev,type,subtype);                             12915000
   value ldev,type,subtype;                                             12920000
   integer ldev,type,subtype;                                           12925000
   option external;                                                     12930000
                                                                        12935000
procedure siodm(p'dit,flags);                                           12940000
   value p'dit,flags;                                                   12945000
   logical flags;                                                       12950000
   pointer p'dit;                                                       12955000
   option external;                                                     12960000
                                                                        12965000
procedure start'hpib(p'dit,siop,qflag);                                 12970000
   value p'dit,siop,qflag;                                              12975000
   logical qflag;                                                       12980000
   pointer p'dit,siop;                                                  12985000
   option external;                                                     12990000
                                                                        12995000
procedure putdrt(drt,offset,num);                                       13000000
   value drt,offset,num;                                                13005000
   integer drt,offset,num;                                              13010000
   option external;                                                     13015000
$page                                                                   13020000
<<                                                                      13025000
         *********************************************                  13030000
         *                                           *                  13035000
         *   cs'80 driver initialization procedure   *                  13040000
         *                                           *                  13045000
         *********************************************                  13050000
>>                                                                      13055000
                                                                        13060000
<<---------------------------------------------------->>                13065000
<<                                                    >>                13070000
<<   this procedure initializes the cs'80 channel     >>                13075000
<<   program area and sends out a device clear to     >>                13080000
<<   reset the drive to a known state.                >>                13085000
<<                                                    >>                13090000
<<---------------------------------------------------->>                13095000
                                                                        13100000
procedure buffalo'init(p'dit);                                          13105000
   value p'dit;                                                         13110000
   integer pointer p'dit;                                               13115000
                                                                        13120000
begin                                                                   13125000
                                                                        13130000
integer pointer                                                         13135000
   p'ilt,                              << ilt pointer               >>  13140000
   siop;                               << channel program pointer   >>  13145000
                                                                        13150000
logical                                                                 13155000
   lpdt'index;                                                          13160000
                                                                        13165000
disable;                               << on entry-want buffalo'init>>  13170000
                                       << to complete               >>  13175000
                                                                        13180000
@p'ilt := p'dit(diltp);                << pointer to the ilt        >>  13185000
@siop  := p'ilt(ilt'siop);             << pointer to the siop       >>  13190000
                                                                        13195000
if spu'powerfail <> zero then          << bypass init on spu        >>  13200000
   return;                             << powerfail                 >>  13205000
                                                                        13210000
lpdt'index   := dit'ldev * size'of'lpdt'entry;                          13215000
dit'lock'flg := if lpdt'non'sys'domain    = zero        and             13220000
                   lpdt'rdy'ser'frn'disc  = zero        and             13225000
                   lpdt'serial'or'foreign = lpdt'serial then            13230000
                                                                        13235000
                   one                                                  13240000
                else                                                    13245000
                   zero;                                                13250000
                                                                        13255000
cp'idle'cdb'offset   := @siop  + sysdb + loc'wrt'cdb;                   13260000
cp'dxfer'cdb'offset  := @siop  + sysdb + cdb'area'wrd;                  13265000
cp'rstat'cdb'offset  := @siop  + sysdb + stat'cdb;                      13270000
cp'rstat'stat'area   := @p'dit + sysdb + dstatus;                       13275000
cp'diag'cdb'offset   := @siop  + sysdb + cdb'area'wrd;                  13280000
cp'pon'cdb'offset    := @siop  + sysdb + pon'cdb'1;                     13285000
cp'pon'cdb'2'offset  := @siop  + sysdb + pon'cdb'2;                     13290000
cp'first'branch      := enter'power'on;                                 13295000
                                       << for series 33 and 64      >>  13300000
                                       << microcode bug             >>  13305000
putdrt(ilt'drt'number,three,zero);                                      13310000
start'hpib(p'dit,siop,false);                                           13315000
dit'substate     := idle'req'wait;                                      13320000
                                                                        13325000
cp'init'dvr'flag := true;                                               13330000
                                                                        13335000
end;                                                                    13340000
$page                                                                   13345000
<<                                                                      13350000
         **************************************************             13355000
         *                                                *             13360000
         * cs'80 disc driver procedure  -  buffalo'driver *             13365000
         *                                                *             13370000
         **************************************************             13375000
>>                                                                      13380000
                                                                        13385000
<<--------------------------------------------------------->>           13390000
<<                                                         >>           13395000
<<   this procedure initiates and completes i/o requests   >>           13400000
<<   for the cs'80 discs connected to the hp-ib and con-   >>           13405000
<<   trolled by the general i/o channel (gic).             >>           13410000
<<                                                         >>           13415000
<<   mode returns in buffalo'driver -                      >>           13420000
<<     5 - request completed                               >>           13425000
<<     7 - not ready wait                                  >>           13430000
<<   %13 - wait for completion                             >>           13435000
<<                                                         >>           13440000
<<--------------------------------------------------------->>           13445000
                                                                        13450000
integer procedure buffalo'driver(p'ioq,p'dit,bank,buffaddr,siop,drtn);  13455000
   value p'dit,p'ioq,bank,buffaddr,drtn;                                13460000
   integer bank,buffaddr,drtn,p'ioq;                                    13465000
   integer pointer p'dit;                                               13470000
   integer array siop;                                                  13475000
   option privileged,uncallable;                                        13480000
                                                                        13485000
begin                                                                   13490000
                                                                        13495000
logical pointer                                                         13500000
   siop'base;                                                           13505000
                                                                        13510000
integer pointer                                                         13515000
   p'ilt,                              << ilt pointer               >>  13520000
   p'cpva = p'ilt;                     << cp variable area ptr      >>  13525000
                                                                        13530000
double                                                                  13535000
   transfer'count,                     << buffer transfer count     >>  13540000
   bytes'left,                                                          13545000
   abs'siop'addr,                                                       13550000
   ver'len,                            << byte length of a verify   >>  13555000
   bank'n'buff'addr = q - 7;           << bank and buffer address   >>  13560000
                                                                        13565000
double pointer                                                          13570000
   dit'transfered'count,                                                13575000
   dp'dit = p'dit;                                                      13580000
                                                                        13585000
integer                                                                 13590000
   driver'state = buffalo'driver,      << driver return state       >>  13595000
   fcode,                              << function code             >>  13600000
   index,                                                               13605000
   i,                                                                   13610000
   address'offset;                                                      13615000
                                                                        13620000
logical                                                                 13625000
   generic'status,                                                      13630000
   ioq'entry'index,                                                     13635000
   lpdt'index,                                                          13640000
   l'transfer'count = transfer'count + one,                             13645000
   l'bytes'left = bytes'left + one,                                     13650000
   parm,                                                                13655000
   l1'ver'len = ver'len,               << first word of ver. len.   >>  13660000
   l2'ver'len = ver'len + one;         << 2'nd  word of ver. len.   >>  13665000
$page                                                                   13670000
<<****************************************************>>                13675000
<<                                                    >>                13680000
<<   cs'80 disc driver subroutines                    >>                13685000
<<                                                    >>                13690000
<<****************************************************>>                13695000
                                                                        13700000
<<---------------------------------------------------->>                13705000
<<   siop'byte -- subroutine to store the cs'80       >>                13710000
<<       command bytes into the channel program area. >>                13715000
<<---------------------------------------------------->>                13720000
                                                                        13725000
subroutine siop'byte(byte'offset,abyte);                                13730000
   value byte'offset,abyte;                                             13735000
   logical byte'offset,abyte;                                           13740000
                                                                        13745000
begin << of "subroutine SIOP'BYTE" >>                                   13750000
                                                                        13755000
setdb'siop;                                                             13760000
siodb'byte'array(byte'offset) := abyte;                                 13765000
setdb'sys;                                                              13770000
                                                                        13775000
end; << of "subroutine SIOP'BYTE" >>                                    13780000
                                                                        13785000
<<---------------------------------------------------->>                13790000
<<   update'xfer'cnt -- update transfer count         >>                13795000
<<---------------------------------------------------->>                13800000
                                                                        13805000
subroutine update'xfer'cnt;                                             13810000
                                                                        13815000
begin << of "subroutine UPDATE'XFER'CNT" >>                             13820000
                                                                        13825000
if dit'transfered'count = 0d then                                       13830000
   if integer(ioq'count) < zero then                                    13835000
                                       << return byte count         >>  13840000
      ioq'count := -integer(transfer'count -                            13845000
                      double(cp'dxfer'data'size))                       13850000
   else                                                                 13855000
                                       << return word count         >>  13860000
      ioq'count := integer((transfer'count -                            13865000
                      double(cp'dxfer'data'size) + 1d) / 2d)            13870000
else                                                                    13875000
   begin                                                                13880000
   if integer(ioq'count) < zero then                                    13885000
                                       << return byte count         >>  13890000
      ioq'count := -integer(dit'transfered'count -                      13895000
                      double(cp'dxfer'data'size))                       13900000
   else                                                                 13905000
                                       << return word count         >>  13910000
      ioq'count := integer((dit'transfered'count -                      13915000
                      double(cp'dxfer'data'size) + 1d) / 2d);           13920000
                                                                        13925000
   dit'transfered'count := 0d;         << reset the count to zero.  >>  13930000
   end; << of else "if DIT'TRANSFERED'COUNT = 0D ..." >>                13935000
                                                                        13940000
cp'dxfer'data'size  := zero;           << reset the transfer count >>   13945000
                                                                        13950000
end; << of "subroutine UPDATE'XFER'CNT" >>                              13955000
$page                                                                   13960000
<<****************************************************>>                13965000
<<****************************************************>>                13970000
<<                                                    >>                13975000
<<   cs'80 disc driver initiator section              >>                13980000
<<                                                    >>                13985000
<<****************************************************>>                13990000
<<****************************************************>>                13995000
                                                                        14000000
@siop'base            := @siop;                                         14005000
abs'siop'addr         := double(logical(@siop + sysdb));                14010000
ioq'entry'index       := p'ioq;        << ioq offset                >>  14015000
@p'ilt                := dit'ilt'ptr;  << ilt pointer               >>  14020000
lpdt'index            := dit'ldev * size'of'lpdt'entry;                 14025000
@dit'transfered'count := @p'dit + dbytecnt;                             14030000
$page                                                                   14035000
<<---------------------------------------------------->>                14040000
<<  assure that the initialization section was called.>>                14045000
<<---------------------------------------------------->>                14050000
                                                                        14055000
if not logical( cp'init'dvr'flag ) then                                 14060000
   begin                                                                14065000
   buffalo'init(p'dit);                                                 14070000
   if ioq'entry'index <> zero then                                      14075000
      begin                                                             14080000
      ioq'waitcode := ioq'defer'wait;                                   14085000
      driver'state := interrupt'wait;                                   14090000
      end; << of "if IOQ'ENTRY'INDEX <> ZERO ..." >>                    14095000
   return;                                                              14100000
   end; << of "if NOT LOGICAL(SIOP..." >>                               14105000
$page                                                                   14110000
<<---------------------------------------------------->>                14115000
<<   no ioq - service special conditions asssociated  >>                14120000
<<            with the idle cp or schedule an         >>                14125000
<<            idle channel program.                   >>                14130000
<<---------------------------------------------------->>                14135000
                                                                        14140000
if driver'state    = initiator'state and                                14145000
   ioq'entry'index = zero            then                               14150000
                                                                        14155000
   begin                                                                14160000
                                                                        14165000
   <<---------------------------------------------------->>             14170000
   << must not reference ioq before return               >>             14175000
   <<---------------------------------------------------->>             14180000
                                                                        14185000
                                       << the idle cp aborted.      >>  14190000
   if cpva'errorcode = dma'abort     or   << dma abort              >>  14195000
      cpva'errorcode = channel'abort then << channel abort          >>  14200000
                                                                        14205000
      begin                                                             14210000
                                       << not rdy msg to console    >>  14215000
      if system'up then ldevnotrdy(p'dit);                              14220000
                                                                        14225000
                                       << schedule idle wait cp     >>  14230000
      cp'first'branch := enter'idle'wait;                               14235000
      start'hpib(p'dit,siop(firstbranch),false);               <<f9010>>14240000
      driver'state    := request'complete;                              14245000
      dit'substate    := normal'idle;                          <<f9010>>14250000
      p'cpva          := 0;                                    <<f9010>>14255000
                                                                        14260000
      return;                                                           14265000
      end; << of "if CPVA'ERRORCODE = DMA'ABORT OR ..." >>              14270000
$page                                                                   14275000
                                       << status received by the    >>  14280000
                                       << idle cp should be         >>  14285000
                                       << diagnosticed              >>  14290000
   if cpva'status = one then                                            14295000
      begin                                                             14300000
      cpva'status := zero;                                              14305000
                                                                        14310000
      if dit'dev'powerfail = one then                                   14315000
         begin                         << clear the device          >>  14320000
         cp'first'branch    := enter'power'on;                          14325000
         start'hpib(p'dit,siop,true);                                   14330000
                                                                        14335000
         dit'immediate'mode := one;    << immediate reporting will  >>  14340000
                                       << be enabled.               >>  14345000
                                                                        14350000
         dit'ignore'int     := zero;                                    14355000
         dit'substate       := idle'req'wait;                           14360000
         driver'state       := request'complete;                        14365000
                                                                        14370000
         return;                                                        14375000
         end; << of "if DIT'DEV'POWERFAIL = ONE..." >>                  14380000
                                                                        14385000
      if dit'int'maint'req   = one or                                   14390000
         dit'i'opr'rel'req   = one or                                   14395000
         dit'i'diag'rel'req  = one or                                   14400000
         dit'i'int'maint'req = one then                                 14405000
                                                                        14410000
         begin                         << release/release deny      >>  14415000
                                       << request                   >>  14420000
         cp'diag'cmd'to'exec := wrt'cmd'sec;                            14425000
         cp'diag'cdb'length  := two;                                    14430000
                                                                        14435000
         siop'byte(cdb'area'byte + 0 , cdb'set'unit + ctrl'unit);       14440000
         siop'byte(cdb'area'byte + 1 ,                                  14445000
            if dit'int'maint'req   =  one or                            14450000
               dit'i'int'maint'req =  one or                            14455000
               dit'i'opr'rel'req   =  one and                           14460000
               dit'dev'not'rdy     =  one or                            14465000
               dit'i'opr'rel'req   =  one and                           14470000
               dit'lock'flg        <> one then                          14475000
                  cdb'release                                           14480000
            else                                                        14485000
                  cdb'release'deny);                                    14490000
                                                                        14495000
                                       << send message to console  >>   14500000
                                       << that the device will not >>   14505000
                                       << be released.             >>   14510000
         if dit'i'opr'rel'req = one  and                                14515000
            dit'lock'flg      = one  and                                14520000
            dit'dev'not'rdy   = zero then                               14525000
                                                                        14530000
            iomessage(1,nsys'deny'msg,%10000,dit'ldev,,,,,console);     14535000
                                                                        14540000
         if dit'i'opr'rel'req = one or                                  14545000
            dit'dev'not'rdy   = one then                                14550000
                                                                        14555000
            dit'ignore'int := zero                                      14560000
         else                                                           14565000
            dit'ignore'int := one;                                      14570000
                                                                        14575000
         cp'first'branch := enter'diag;                                 14580000
         start'hpib(p'dit,siop,true);                                   14585000
         dit'substate    := idle'req'wait;                              14590000
         driver'state    := request'complete;                           14595000
                                                                        14600000
         return;                                                        14605000
         end; << of "if DIT'INT'MAINT'REQ = ONE..." >>                  14610000
                                                                        14615000
      if dit'maint'track = one then                                     14620000
         begin                                                          14625000
         maint'request(dit'ldev,type'buffalo,lpdt'subtype);             14630000
                                                                        14635000
         if dit'substate = idle'req'wait then                           14640000
            dit'substate   := zero     << idle wait done           >>   14645000
         else                                                           14650000
            dit'ignore'int := one;                                      14655000
                                                                        14660000
         cp'first'branch := enter'idle;                                 14665000
         start'hpib(p'dit,siop,false);                                  14670000
         dit'substate    := idle'req'wait;                              14675000
         driver'state    := request'complete;                           14680000
                                                                        14685000
         return;                                                        14690000
         end; << of "if DIT'MAINT'TRACK = ONE..." >>                    14695000
      end; << of "if CPVA'STATUS = ONE..." >>                           14700000
$page                                                                   14705000
   if cpva'status = four then          << idle pon occurred         >>  14710000
      begin                            << do a device clear         >>  14715000
      cpva'status        := zero;                                       14720000
      cp'first'branch    := enter'power'on;                             14725000
      start'hpib(p'dit,siop,true);                                      14730000
                                                                        14735000
      dit'immediate'mode := one;       << immediate reporting will  >>  14740000
                                       << be enabled.               >>  14745000
      dit'ignore'int     := zero;                                       14750000
      dit'substate       := idle'req'wait;                              14755000
      driver'state       := request'complete;                           14760000
                                                                        14765000
      return;                                                           14770000
      end; << of "if CPVA'STATUS = FOUR ..." >>                         14775000
$page                                                                   14780000
   if dit'substate = idle'req'wait then                                 14785000
      dit'substate   := zero           << idle wait done            >>  14790000
   else                                                                 14795000
      dit'ignore'int := one;                                            14800000
                                                                        14805000
   cpva'status     := zero;                                             14810000
   cp'first'branch := enter'idle;                                       14815000
   start'hpib(p'dit,siop,false);                                        14820000
   driver'state    := request'complete;                                 14825000
                                                                        14830000
   return;                                                              14835000
   end; << of "if IOQ'ENTRY'INDEX = ZERO ..." >>                        14840000
$page                                                                   14845000
<<---------------------------------------------------->>                14850000
<<   idle request currently being serviced, defer     >>                14855000
<<   current request until idle request completed     >>                14860000
<<---------------------------------------------------->>                14865000
                                                                        14870000
if driver'state = initiator'state and                                   14875000
   dit'substate = idle'req'wait then                                    14880000
   begin                                                                14885000
   ioq'waitcode := ioq'defer'wait;                                      14890000
   driver'state := interrupt'wait;                                      14895000
                                                                        14900000
   return;                                                              14905000
   end; << of "if DRIVER'STATE = INITIATOR'STATE ..." >>                14910000
$page                                                                   14915000
<<---------------------------------------------------->>                14920000
<<   convert the transfer count to bytes.             >>                14925000
<<---------------------------------------------------->>                14930000
                                                                        14935000
if integer(ioq'count) < zero then                                       14940000
   transfer'count := - double(ioq'count)                                14945000
else                                                                    14950000
   transfer'count := double(ioq'count) * 2d;                            14955000
$page                                                                   14960000
<<---------------------------------------------------->>                14965000
<<   map from external to internal function code      >>                14970000
<<                                                    >>                14975000
<<   function code 0 -4  --> internal code 0 -4       >>                14980000
<<   function code 5     --> internal code 1          >>                14985000
<<   function code 6     --> internal code 1          >>                14990000
<<   function code 7 -9  --> internal code 5 -7       >>                14995000
<<   function code 11    --> internal code 1          >>                15000000
<<   function code 13-18 --> internal code 8 -13      >>                15005000
<<   function code 29    --> internal code 14         >>                15010000
<<   function code 72-73 --> internal code 15-16      >>                15015000
<<   function code 74    --> internal code 5          >>                15020000
<<   function code 75-76 --> internal code 17-18      >>                15025000
<<   function code 79-82 --> internal code 19-22      >>                15030000
<<   function code 88    --> internal code 23         >>                15035000
<<   function code 91-94 --> internal code 24-27      >>                15040000
<<   function code 95    --> internal code 5          >>                15045000
<<   function code 100   --> internal code 28         >>                15050000
<<   function code 101   --> internal code 25         >>                15055000
<<---------------------------------------------------->>                15060000
                                                                        15065000
if 0  <= integer(ioq'func) <= 4  then                                   15070000
   fcode := integer(ioq'func)                                           15075000
else if integer(ioq'func) = 5  then                                     15080000
   fcode := 1                                                           15085000
else if integer(ioq'func) = 6  then                                     15090000
   fcode := 1                                                           15095000
else if 7  <= integer(ioq'func) <= 9  then                              15100000
   fcode := integer(ioq'func) - 7 + 5                                   15105000
else if integer(ioq'func) = 11 then                                     15110000
   fcode := 1                                                           15115000
else if 13 <= integer(ioq'func) <= 18 then                              15120000
   fcode := integer(ioq'func) - 13 + 8                                  15125000
else if integer(ioq'func) = 29 then                                     15130000
   fcode := 14                                                          15135000
else if 72 <= integer(ioq'func) <= 73 then                              15140000
   fcode := integer(ioq'func) - 72 + 15                                 15145000
else if integer(ioq'func) = 74 then                                     15150000
   fcode := 5                                                           15155000
else if 75 <= integer(ioq'func) <= 76 then                              15160000
   fcode := integer(ioq'func) - 75 + 17                                 15165000
else if 79 <= integer(ioq'func) <= 82 then                              15170000
   fcode := integer(ioq'func) - 79 + 19                                 15175000
else if integer(ioq'func) = 88 then                                     15180000
   fcode := 23                                                          15185000
else if 91 <= integer(ioq'func) <= 94 then                              15190000
   fcode := integer(ioq'func) - 91 + 24                                 15195000
else if integer(ioq'func) = 95 then                                     15200000
   fcode := 5                                                           15205000
else if integer(ioq'func) = 100 then                                    15210000
   fcode := 28                                                          15215000
else if integer(ioq'func) = 101 then                                    15220000
   fcode := 25                                                          15225000
else                                                                    15230000
   begin                               << exit with invalid func.   >>  15235000
   ioq'stat     := invalid'request;                                     15240000
   ioq'count    := zero;                                                15245000
   driver'state := request'complete;                                    15250000
                                                                        15255000
   return;                                                              15260000
   end; << of the long if (case) statement >>                           15265000
$page                                                                   15270000
<<---------------------------------------------------->>                15275000
<<   ioq deferred request completion - redo request   >>                15280000
<<---------------------------------------------------->>                15285000
                                                                        15290000
if ioq'waitcode = ioq'defer'wait then                                   15295000
   begin                                                                15300000
   dit'substate := zero;               << reset substate            >>  15305000
   if dit'maint'track = one then                                        15310000
      maint'request(dit'ldev,type'buffalo,lpdt'subtype);                15315000
   goto retry'request;                                                  15320000
   end; << of "if IOQ'WAITCODE = IOQ'DEFER'WAIT..." >>                  15325000
                                                                        15330000
<<---------------------------------------------------->>                15335000
<<   not ready completion - go to completor section   >>                15340000
<<---------------------------------------------------->>                15345000
                                                                        15350000
if ioq'waitcode = not'rdy'wait then                                     15355000
   goto continuator;                                                    15360000
                                                                        15365000
$page                                                                   15370000
<<---------------------------------------------------->>                15375000
<<   initiator call - initialize or reset variables   >>                15380000
<<                    possibly changed in last req.   >>                15385000
<<                  - case to a driver function code  >>                15390000
<<---------------------------------------------------->>                15395000
                                                                        15400000
if (driver'state   = initiator'state) lor                               15405000
                                       << more data to process for  >>  15410000
                                       << the read function.        >>  15415000
   ((cpva'status   = zero)                 land                         15420000
   (transfer'count > dit'transfered'count) land                         15425000
   (fcode          = fc'read))        lor                               15430000
                                       << more data to process for  >>  15435000
                                       << the write function.       >>  15440000
   ((cpva'status   = zero)                 land                         15445000
   (transfer'count > dit'transfered'count) land                         15450000
   (fcode          = fc'write))       then                              15455000
                                                                        15460000
   begin                                                                15465000
                                                                        15470000
                                       << perform only on a retry.  >>  15475000
   if hell'froze'over then                                              15480000
      begin                                                             15485000
retry'request:                                                          15490000
                                                                        15495000
                                       << do the whole read/write   >>  15500000
                                       << process over again.       >>  15505000
      if fcode = fc'read  or                                            15510000
         fcode = fc'write then                                          15515000
                                                                        15520000
         dit'transfered'count := 0d;                                    15525000
                                                                        15530000
      end; << of "if HELL'FROZE'OVER ..." >>                            15535000
                                                                        15540000
$page                                                                   15545000
case fcode of                                                           15550000
   begin << of "case FCODE..." >>                                       15555000
                                                                        15560000
<<--------------------------------------------------------->>           15565000
<<                                                         >>           15570000
<<    code   function                    internal fcode    >>           15575000
<<    ----   --------                    --------------    >>           15580000
<<                                                         >>           15585000
<<      0    read                              0           >>           15590000
<<      1    write                             1           >>           15595000
<<      2    file open                         2           >>           15600000
<<      3    file close                        3           >>           15605000
<<      4    device close                      4           >>           15610000
<<      5    fill with zero                    1           >>           15615000
<<      6    file with blanks                  1           >>           15620000
<<      7    request last status               5           >>           15625000
<<      8    initialize media                  6           >>           15630000
<<      9    unload                            7           >>           15635000
<<     11    write disc label                  1           >>           15640000
<<     13    request volume limit              8           >>           15645000
<<     14    locate and verify                 9           >>           15650000
<<     15    request generic status           10           >>           15655000
<<     16    lock                             11           >>           15660000
<<     17    unlock                           12           >>           15665000
<<     18    read lock bit                    13           >>           15670000
<<     29    immediate mode                   14           >>           15675000
<<     72    identify                         15           >>           15680000
<<     73    initiate diagnostic selftest     16           >>           15685000
<<     74    selftest result                   5           >>           15690000
<<     75    loopback write                   17           >>           15695000
<<     76    loopback read                    18           >>           15700000
<<     79    release                          19           >>           15705000
<<     80    release denied                   20           >>           15710000
<<     81    set release                      21           >>           15715000
<<     82    set address                      22           >>           15720000
<<     88    spare block                      23           >>           15725000
<<     91    initiate utility                 24           >>           15730000
<<     92    device clear                     25           >>           15735000
<<     93    cancel transaction               26           >>           15740000
<<     94    parity checking                  27           >>           15745000
<<     95    last status request               5           >>           15750000
<<    100    generic diagnostic request       28           >>           15755000
<<    101    channel independent clear        25           >>           15760000
<<                                                         >>           15765000
<<--------------------------------------------------------->>           15770000
$page                                                                   15775000
<<---------------------------------------------------->>                15780000
<<                                                    >>                15785000
<<   read [function code = 0]                         >>                15790000
<<                                                    >>                15795000
<<   transfer'count - transfer count                  >>                15800000
<<   bank & buffaddr - contains data read             >>                15805000
<<   p1 - high order dbl word logical sector address  >>                15810000
<<   p2 - low order dbl word logical sector address   >>                15815000
<<                                                    >>                15820000
<<---------------------------------------------------->>                15825000
                                                                        15830000
   begin << of case 0 >>                                                15835000
                                                                        15840000
   cp'dxfer'write'read  := wrt'cmd'sec;                                 15845000
   cp'dxfer'wait'5      := wait'instr;                                  15850000
   cp'dxfer'wait'6      := zero;                                        15855000
   cp'dxfer'12'wait     := wait'instr;                                  15860000
   cp'dxfer'13'wait     := zero;                                        15865000
   cp'dxfer'cmd'to'exec := read'exec'sec;                               15870000
                                                                        15875000
   <<---------------------------------------------------->>             15880000
   << on the first read operation, set the address of    >>             15885000
   << where to read the data from on the tape, and the   >>             15890000
   << unit number.                                       >>             15895000
   <<---------------------------------------------------->>             15900000
                                                                        15905000
   if dit'transfered'count = 0d then                                    15910000
      begin                            << first read operation      >>  15915000
      setdb'siop;                                                       15920000
      siodb'byte'array(cdb'area'byte + 0 ) := cdb'set'unit;             15925000
                                                                        15930000
      siodb'byte'array(cdb'area'byte + 1 ) := cdb'set'sngl'vec;         15935000
      siodb'byte'array(cdb'area'byte + 2 ) := zero;                     15940000
      siodb'byte'array(cdb'area'byte + 3 ) := zero;                     15945000
      siodb'byte'array(cdb'area'byte + 4 ) := ioq'parm1.(0:8);          15950000
      siodb'byte'array(cdb'area'byte + 5 ) := ioq'parm1.(8:8);          15955000
      siodb'byte'array(cdb'area'byte + 6 ) := ioq'parm2.(0:8);          15960000
      siodb'byte'array(cdb'area'byte + 7 ) := ioq'parm2.(8:8);          15965000
                                                                        15970000
      siodb'byte'array(cdb'area'byte + 15) := cdb'read;                 15975000
      setdb'sys;                                                        15980000
      i := 8;                                                           15985000
                                                                        15990000
      cp'dxfer'cdb'length  := 16;      << cdb byte count            >>  15995000
      cp'dxfer'data'type   := zero;                                     16000000
      cp'dxfer'data'bank   := bank;    << data bank                 >>  16005000
      cp'dxfer'data'offset := buffaddr; << data buffer abs adr      >>  16010000
      end << of 'if dit'transfered'count = 0d ...' >>                   16015000
   else                                                                 16020000
      begin                                                             16025000
      setdb'siop;                                                       16030000
      siodb'byte'array(cdb'area'byte + 7 ) := cdb'read;                 16035000
      setdb'sys;                                                        16040000
      i := 0;                                                           16045000
      cp'dxfer'cdb'length  := 8;       << cdb byte count            >>  16050000
      end; << of else "if DIT'TRANSFERED'COUNT = 0D ..." >>             16055000
                                                                        16060000
   <<---------------------------------------------------->>             16065000
   << set auto jump sparing method, and set              >>             16070000
   << immediate report mode.                             >>             16075000
   <<---------------------------------------------------->>             16080000
                                                                        16085000
   siop'byte(cdb'area'byte + i + 0 , cdb'set'options);                  16090000
   parm := cdb'jump'spare;                                              16095000
                                                                        16100000
   if dit'immediate'mode = one then                                     16105000
      parm.(12:1) := one;                                               16110000
   siop'byte(cdb'area'byte + i + 1 , parm);                             16115000
                                                                        16120000
   <<---------------------------------------------------->>             16125000
   << determine the amount of data to read.  maximum read>>             16130000
   << at a time is 6k bytes.                             >>             16135000
   <<---------------------------------------------------->>             16140000
                                                                        16145000
   bytes'left := transfer'count - dit'transfered'count;                 16150000
   if bytes'left < double(six'k'bytes) then                             16155000
      begin                                                             16160000
      setdb'siop;                                                       16165000
      siodb'byte'array(cdb'area'byte + i + 2) := cdb'set'length;        16170000
      siodb'byte'array(cdb'area'byte + i + 3) := zero;                  16175000
      siodb'byte'array(cdb'area'byte + i + 4) := zero;                  16180000
      siodb'byte'array(cdb'area'byte + i + 5) := l'bytes'left.(0:8);    16185000
      siodb'byte'array(cdb'area'byte + i + 6) := l'bytes'left.(8:8);    16190000
      setdb'sys;                                                        16195000
                                                                        16200000
      if bytes'left = 0d then          << no data to read           >>  16205000
         begin                                                          16210000
         cp'dxfer'wait'5      := zero; << bypass exec msg           >>  16215000
         cp'dxfer'wait'6      := 5;    << jump *+5                  >>  16220000
         end << of "if BYTES'LEFT = 0D..." >>                           16225000
                                                                        16230000
      else                                                              16235000
         begin                                                          16240000
         cp'dxfer'data'size := l'bytes'left; << set up read count   >>  16245000
         end; << else of "if BYTES'LEFT = 0D..." >>                     16250000
      dit'transfered'count := transfer'count;                           16255000
      end << of "if BYTES'LEFT < DOUBLE(SIX'K'BYTES) ..." >>            16260000
   else                                                                 16265000
      begin                                                             16270000
      setdb'siop;                                                       16275000
      siodb'byte'array(cdb'area'byte + i + 2) := cdb'set'length;        16280000
      siodb'byte'array(cdb'area'byte + i + 3) := zero;                  16285000
      siodb'byte'array(cdb'area'byte + i + 4) := zero;                  16290000
      siodb'byte'array(cdb'area'byte + i + 5) := six'k'bytes.(0:8);     16295000
      siodb'byte'array(cdb'area'byte + i + 6) := six'k'bytes.(8:8);     16300000
      setdb'sys;                                                        16305000
                                                                        16310000
      cp'dxfer'data'size   := six'k'bytes; << set up read count     >>  16315000
      dit'transfered'count := dit'transfered'count +                    16320000
                              double(six'k'bytes);                      16325000
      end; << of else "if BYTES'LEFT < DOUBLE(SIX'K'BYTES) ..." >>      16330000
                                                                        16335000
   cp'first'branch := enter'data'xfer;                                  16340000
                                                                        16345000
   end; << of case 0 >>                                                 16350000
$page                                                                   16355000
<<---------------------------------------------------->>                16360000
<<                                                    >>                16365000
<<   write [function code = 1] and                    >>                16370000
<<   fill with zeros [function code = 5] and          >>                16375000
<<   fill with blanks [function code = 6] and         >>                16380000
<<   write disc label [function code = 11]            >>                16385000
<<                                                    >>                16390000
<<   transfer'count - transfer count                  >>                16395000
<<   bank & buffaddr - contains data for write        >>                16400000
<<   p1 - high order dbl word logical sector address  >>                16405000
<<   p2 - low order dbl word logical sector address   >>                16410000
<<                                                    >>                16415000
<<---------------------------------------------------->>                16420000
                                                                        16425000
   begin << of case 1 >>                                                16430000
                                                                        16435000
                                       << transfer count should not >>  16440000
                                       << be zero for fill with zero>>  16445000
                                       << fill with space, or       >>  16450000
                                       << write disc label.         >>  16455000
   if (ioq'func       = 5 or                                            16460000
       ioq'func       = 6 or                                            16465000
       ioq'func       = 11) and                                         16470000
      transfer'count  = 0d  then                                        16475000
      begin                            << exit with invalid func.   >>  16480000
      ioq'stat      := invalid'request;                                 16485000
      ioq'count     := zero;                                            16490000
      driver'state  := request'complete;                                16495000
      return;                                                           16500000
      end; << of "if IOQ'FUNC = 5 ..." >>                               16505000
                                                                        16510000
   cp'dxfer'write'read  := wrt'cmd'sec;                                 16515000
   cp'dxfer'wait'5      := wait'instr;                                  16520000
   cp'dxfer'wait'6      := zero;                                        16525000
   cp'dxfer'12'wait     := wait'instr;                                  16530000
   cp'dxfer'13'wait     := zero;                                        16535000
   cp'dxfer'cmd'to'exec := wrt'exec'sec;                                16540000
                                                                        16545000
   <<---------------------------------------------------->>             16550000
   << on the first write operation, set the address of   >>             16555000
   << where to write the data on the tape, and the unit  >>             16560000
   << number.                                            >>             16565000
   <<---------------------------------------------------->>             16570000
                                                                        16575000
   if dit'transfered'count = 0d then                                    16580000
      begin                            << first write operation     >>  16585000
      setdb'siop;                                                       16590000
      siodb'byte'array(cdb'area'byte + 0 )  := cdb'set'unit;            16595000
                                                                        16600000
      siodb'byte'array(cdb'area'byte + 1 )  := cdb'set'sngl'vec;        16605000
      siodb'byte'array(cdb'area'byte + 2 )  := zero;                    16610000
      siodb'byte'array(cdb'area'byte + 3 )  := zero;                    16615000
      siodb'byte'array(cdb'area'byte + 4 )  := ioq'parm1.(1:8);         16620000
      siodb'byte'array(cdb'area'byte + 5 )  := ioq'parm1.(8:8);         16625000
      siodb'byte'array(cdb'area'byte + 6 )  := ioq'parm2.(0:8);         16630000
      siodb'byte'array(cdb'area'byte + 7 )  := ioq'parm2.(8:8);         16635000
                                                                        16640000
      siodb'byte'array(cdb'area'byte + 15)  := cdb'write;               16645000
      setdb'sys;                                                        16650000
      i := 8;                                                           16655000
                                                                        16660000
      cp'dxfer'cdb'length  := 16;      << cdb byte count            >>  16665000
                                       << for the write function    >>  16670000
                                       << send out the user's data  >>  16675000
                                       << else send zeros or spaces >>  16680000
      if ioq'func = one or                                              16685000
         ioq'func = 11  then                                            16690000
         begin                                                          16695000
         cp'dxfer'data'type   := zero;                                  16700000
         cp'dxfer'data'bank   := bank; << data bank                 >>  16705000
         cp'dxfer'data'offset := buffaddr; << data buffer abs adr   >>  16710000
         end << of "if IOQ'FUNC = ONE ..." >>                           16715000
      else                                                              16720000
         begin                                                          16725000
         cp'dxfer'data'type   := zero;                                  16730000
         cp'dxfer'dont'c'addr := one;   << wrt from single addr     >>  16735000
         cp'dxfer'data'bank   := zero;                                  16740000
         cp'dxfer'data'offset := @siop + sysdb + fill'wrd;              16745000
         cp'fill'word         := if ioq'func = 5 then                   16750000
                                    zero << fill word of zeros      >>  16755000
                                 else                                   16760000
                                    blanks; << fill word of blanks  >>  16765000
         end; << of else "if IOQ'FUNC = ONE ..." >>                     16770000
      end << of "if DIT'TRANSFERED'COUNT = 0D ..." >>                   16775000
   else                                                                 16780000
      begin                                                             16785000
      setdb'siop;                                                       16790000
      siodb'byte'array(cdb'area'byte + 7 )  := cdb'write;               16795000
      setdb'sys;                                                        16800000
      i := 0;                                                           16805000
      cp'dxfer'cdb'length  :=  8;      << cdb byte count            >>  16810000
      end; << of else "if DIT'TRANSFERED'COUNT = 0D ..." >>             16815000
                                                                        16820000
   <<---------------------------------------------------->>             16825000
   << set the sparing method given by the user, and set  >>             16830000
   << immediate report mode.                             >>             16835000
   <<---------------------------------------------------->>             16840000
                                                                        16845000
   siop'byte(cdb'area'byte + i + 0 , cdb'set'options);                  16850000
   parm := zero;                                                        16855000
   if ioq'parm1.(0:1) = one then                                        16860000
      parm.(13:3) := cdb'skip'spare                                     16865000
   else                                                                 16870000
      parm.(13:3) := cdb'jump'spare;                                    16875000
                                                                        16880000
   if dit'immediate'mode = one then                                     16885000
      parm.(12:1) := one;                                               16890000
   siop'byte(cdb'area'byte + i + 1 , parm);                             16895000
                                                                        16900000
   <<---------------------------------------------------->>             16905000
   << determine the amount of data to write.  maximum on >>             16910000
   << a single write operation is 6k bytes.              >>             16915000
   <<---------------------------------------------------->>             16920000
                                                                        16925000
   bytes'left := transfer'count - dit'transfered'count;                 16930000
   if bytes'left < double(six'k'bytes) then                             16935000
      begin                                                             16940000
      setdb'siop;                                                       16945000
      siodb'byte'array(cdb'area'byte + i + 2) := cdb'set'length;        16950000
      siodb'byte'array(cdb'area'byte + i + 3) := zero;                  16955000
      siodb'byte'array(cdb'area'byte + i + 4) := zero;                  16960000
      siodb'byte'array(cdb'area'byte + i + 5) := l'bytes'left.(0:8);    16965000
      siodb'byte'array(cdb'area'byte + i + 6) := l'bytes'left.(8:8);    16970000
      setdb'sys;                                                        16975000
                                                                        16980000
      if bytes'left = 0d then          << no data to write          >>  16985000
         begin                                                          16990000
         cp'dxfer'wait'5      := zero; << bypass exec msg           >>  16995000
         cp'dxfer'wait'6      := 5;    << jump *+5                  >>  17000000
         end << of "if BYTES'LEFT = 0D..." >>                           17005000
      else                                                              17010000
         begin                                                          17015000
         cp'dxfer'data'size := l'bytes'left; << set up write count  >>  17020000
         end; << of else "if BYTES'LEFT = 0D ..." >>                    17025000
                                                                        17030000
      dit'transfered'count := transfer'count;                           17035000
      end << of "if BYTES'LEFT < DOUBLE(SIX'K'BYTES) ..." >>            17040000
   else                                                                 17045000
      begin                                                             17050000
      setdb'siop;                                                       17055000
      siodb'byte'array(cdb'area'byte + i + 2) := cdb'set'length;        17060000
      siodb'byte'array(cdb'area'byte + i + 3) := zero;                  17065000
      siodb'byte'array(cdb'area'byte + i + 4) := zero;                  17070000
      siodb'byte'array(cdb'area'byte + i + 5) := six'k'bytes.(0:8);     17075000
      siodb'byte'array(cdb'area'byte + i + 6) := six'k'bytes.(8:8);     17080000
      setdb'sys;                                                        17085000
                                                                        17090000
      cp'dxfer'data'size   := six'k'bytes; << set up write count    >>  17095000
      dit'transfered'count := dit'transfered'count +                    17100000
                              double(six'k'bytes);                      17105000
      end; << of else "if BYTES'LEFT < DOUBLE(SIX'K'BYTES) ..." >>      17110000
                                                                        17115000
   cp'first'branch := enter'data'xfer;                                  17120000
                                                                        17125000
   end; << of case 1 >>                                                 17130000
$page                                                                   17135000
<<---------------------------------------------------->>                17140000
<<                                                    >>                17145000
<<   file open [function code = 2]                    >>                17150000
<<                                                    >>                17155000
<<---------------------------------------------------->>                17160000
                                                                        17165000
                                                                        17170000
   begin << of case 2 >>                                                17175000
                                       << exit with a good transfer >>  17180000
   ioq'stat      := good'io;                                            17185000
   ioq'count     := zero;                                               17190000
   driver'state  := request'complete;                                   17195000
                                                                        17200000
   return;                                                              17205000
   end; << of case 2 >>                                                 17210000
$page                                                                   17215000
<<---------------------------------------------------->>                17220000
<<                                                    >>                17225000
<<   file close [function code = 3]                   >>                17230000
<<                                                    >>                17235000
<<---------------------------------------------------->>                17240000
                                                                        17245000
                                                                        17250000
   begin << of case 3 >>                                                17255000
                                       << exit with a good transfer >>  17260000
   ioq'stat      := good'io;                                            17265000
   ioq'count     := zero;                                               17270000
   driver'state  := request'complete;                                   17275000
                                                                        17280000
   return;                                                              17285000
   end; << of case 3 >>                                                 17290000
$page                                                                   17295000
<<---------------------------------------------------->>                17300000
<<                                                    >>                17305000
<<   device close [function code = 4]                 >>                17310000
<<                                                    >>                17315000
<<   immediate report mode default.                   >>                17320000
<<                                                    >>                17325000
<<---------------------------------------------------->>                17330000
                                                                        17335000
                                                                        17340000
   begin << of case 4 >>                                                17345000
                                                                        17350000
   dit'immediate'mode := one;          << enable immediate reporting>>  17355000
                                                                        17360000
   ioq'stat           := good'io;      << exit with a good transfer >>  17365000
   ioq'count          := zero;                                          17370000
   driver'state       := request'complete;                              17375000
                                                                        17380000
   return;                                                              17385000
   end; << of case 4 >>                                                 17390000
$page                                                                   17395000
<<---------------------------------------------------->>                17400000
<<                                                    >>                17405000
<<   request status [function code = 7] and           >>                17410000
<<   selftest result [function code = 74] and         >>                17415000
<<   request last status [function code = 95]         >>                17420000
<<                                                    >>                17425000
<<   transfer'count - status length (max 20 bytes)    >>                17430000
<<   bank & buffaddr - return the status              >>                17435000
<<                                                    >>                17440000
<<   for special request from pvproc, (indicated by   >>                17445000
<<   p1 = 8, p2 = 9, and function = 7) handle this    >>                17450000
<<   request in a special way.                        >>                17455000
<<                                                    >>                17460000
<<---------------------------------------------------->>                17465000
                                                                        17470000
   begin << of case 5 >>                                                17475000
                                                                        17480000
   if transfer'count = 0d then                                          17485000
      begin                            << exit with invalid func.   >>  17490000
      ioq'stat      := invalid'request;                                 17495000
      ioq'count     := zero;                                            17500000
      driver'state  := request'complete;                                17505000
                                                                        17510000
      return;                                                           17515000
      end;                                                              17520000
                                                                        17525000
                                       << special request from      >>  17530000
                                       << pvproc.                   >>  17535000
   if ioq'func  = 7 and                                                 17540000
      ioq'parm1 = 8 and                                                 17545000
      ioq'parm2 = 9 then                                                17550000
                                                                        17555000
      if dit'ignore'int = one then                                      17560000
         begin                                                          17565000
                                       << return special val %101010>>  17570000
         dit'ignore'int := zero;                                        17575000
         tos            := bank'n'buff'addr;                            17580000
         tos            := ignore'interrupt;                            17585000
         assemble (ssea);                                               17590000
                                       << exit with a good transfer >>  17595000
         ioq'stat     := good'io;                                       17600000
         ioq'count    := one;                                           17605000
         driver'state := request'complete;                              17610000
                                                                        17615000
         return;                                                        17620000
         end  << of "if DIT'IGNORE'INT = ONE ..." >>                    17625000
      else                                                              17630000
         begin                                                          17635000
                                       << return first word of stat >>  17640000
         tos := bank'n'buff'addr;                                       17645000
         tos := dit'first'stat'word;                                    17650000
         assemble (ssea);                                               17655000
                                       << exit with a good transfer >>  17660000
         ioq'stat     := good'io;                                       17665000
         ioq'count    := one;                                           17670000
         driver'state := request'complete;                              17675000
                                                                        17680000
         return;                                                        17685000
         end; << of else "if DIT'IGNORE'INT = ONE ..." >>               17690000
                                                                        17695000
                                       << max 10 wrds               >>  17700000
   if transfer'count > double(dev'stat'word'size) then                  17705000
      ioq'count        := dev'stat'word'size;                           17710000
                                                                        17715000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  17720000
   cp'diag'cdb'length  := 7;           << do seek to force status   >>  17725000
                                                                        17730000
   setdb'siop;                                                          17735000
   siodb'byte'array(cdb'area'byte + 0 ) := cdb'set'unit;                17740000
                                                                        17745000
   siodb'byte'array(cdb'area'byte + 1 ) := cdb'set'length;              17750000
   siodb'byte'array(cdb'area'byte + 2 ) := zero;                        17755000
   siodb'byte'array(cdb'area'byte + 3 ) := zero;                        17760000
   siodb'byte'array(cdb'area'byte + 4 ) := zero;                        17765000
   siodb'byte'array(cdb'area'byte + 5 ) := zero;                        17770000
                                                                        17775000
   siodb'byte'array(cdb'area'byte + 6 ) := cdb'write;                   17780000
   setdb'sys;                                                           17785000
                                                                        17790000
   cp'first'branch := enter'diag;                                       17795000
                                                                        17800000
   end; << of case 5 >>                                                 17805000
$page                                                                   17810000
<<---------------------------------------------------->>                17815000
<<                                                    >>                17820000
<<   initialize media [function code = 8]             >>                17825000
<<                                                    >>                17830000
<<   p1 - 00000cwz                                    >>                17835000
<<      c = 1 - run certification utility on tape     >>                17840000
<<      w = 1 - every 512 block is allocated as spare >>                17845000
<<      z = 1 - reset sparing table to initial spares >>                17850000
<<                 as defined by w bit.               >>                17855000
<<   p2 - block interleave byte (binary number)       >>                17860000
<<                                                    >>                17865000
<<---------------------------------------------------->>                17870000
                                                                        17875000
   begin << of case 6 >>                                                17880000
                                                                        17885000
   if not (zero <= integer(ioq'parm1) <= four) then                     17890000
      begin                            << exit with invalid func.   >>  17895000
      ioq'stat      := invalid'request;                                 17900000
      ioq'count     := zero;                                            17905000
      driver'state  := request'complete;                                17910000
                                                                        17915000
      return;                                                           17920000
      end;                                                              17925000
                                                                        17930000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  17935000
   cp'diag'cdb'length  := four;                                         17940000
                                                                        17945000
   setdb'siop;                                                          17950000
   siodb'byte'array(cdb'area'byte + 0 ) := cdb'set'unit;                17955000
                                                                        17960000
   siodb'byte'array(cdb'area'byte + 1 ) := cdb'init'media;              17965000
   siodb'byte'array(cdb'area'byte + 2 ) := ioq'parm1.(8:8);             17970000
   siodb'byte'array(cdb'area'byte + 3 ) := ioq'parm2.(8:8);             17975000
   setdb'sys;                                                           17980000
                                                                        17985000
   cp'first'branch := enter'diag;                                       17990000
                                                                        17995000
   end; << of case 6 >>                                                 18000000
$page                                                                   18005000
<<---------------------------------------------------->>                18010000
<<                                                    >>                18015000
<<       unload [function code = 9]                   >>                18020000
<<                                                    >>                18025000
<<---------------------------------------------------->>                18030000
                                                                        18035000
   begin << of case 7 >>                                                18040000
                                                                        18045000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  18050000
   cp'diag'cdb'length  := 2;                                            18055000
                                                                        18060000
   siop'byte(cdb'area'byte + 0 , cdb'set'unit);                         18065000
   siop'byte(cdb'area'byte + 1 , cdb'unload);                           18070000
                                                                        18075000
   cp'first'branch := enter'diag;                                       18080000
                                                                        18085000
   end; << of case 7 >>                                                 18090000
$page                                                                   18095000
<<---------------------------------------------------->>                18100000
<<                                                    >>                18105000
<<   request volume limit [function code = 13]        >>                18110000
<<                                                    >>                18115000
<<   bank & buffaddr - returns a dbl wrd address of   >>                18120000
<<                     the maximum volume limit       >>                18125000
<<                                                    >>                18130000
<<---------------------------------------------------->>                18135000
                                                                        18140000
   begin << of case 8 >>                                                18145000
                                                                        18150000
   cp'diag'cmd'to'exec  := wrt'cmd'sec;                                 18155000
   cp'dxfer'cdb'length  := two;        << cdb byte count            >>  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
   cp'dxfer'data'size   := max'desc'byte; << max# desc bytes        >>  18190000
   cp'dxfer'data'type   := zero;                                        18195000
   cp'dxfer'data'bank   := zero;       << describe area             >>  18200000
   cp'dxfer'data'offset := @siop + sysdb + desc'area;                   18205000
                                                                        18210000
   siop'byte(cdb'area'byte + 0 , cdb'set'unit);                         18215000
   siop'byte(cdb'area'byte + 1 , cdb'describe);                         18220000
                                                                        18225000
   cp'first'branch     := enter'data'xfer;                              18230000
                                                                        18235000
   end; << of case 8 >>                                                 18240000
$page                                                                   18245000
<<---------------------------------------------------->>                18250000
<<                                                    >>                18255000
<<   locate and verify [function code = 14]           >>                18260000
<<                                                    >>                18265000
<<   bank & buffaddr - entry   a dbl wrd address of   >>                18270000
<<                     verify length                  >>                18275000
<<   bank & buffaddr - returns a dbl wrd address of   >>                18280000
<<                     1st bad sector encountered     >>                18285000
<<   p1 - high order dbl word logical sector address  >>                18290000
<<   p2 - low order dbl word logical sector address   >>                18295000
<<                                                    >>                18300000
<<---------------------------------------------------->>                18305000
                                                                        18310000
   begin << of case 9 >>                                                18315000
                                                                        18320000
   setdb'siop;                                                          18325000
   siodb'byte'array(cdb'area'byte + 0)  := cdb'set'unit;                18330000
                                                                        18335000
   siodb'byte'array(cdb'area'byte + 1)  := cdb'set'sngl'vec;            18340000
   siodb'byte'array(cdb'area'byte + 2)  := zero;                        18345000
   siodb'byte'array(cdb'area'byte + 3)  := zero;                        18350000
   siodb'byte'array(cdb'area'byte + 4)  := ioq'parm1.(0:8);             18355000
   siodb'byte'array(cdb'area'byte + 5)  := ioq'parm1.(8:8);             18360000
   siodb'byte'array(cdb'area'byte + 6)  := ioq'parm2.(0:8);             18365000
   siodb'byte'array(cdb'area'byte + 7)  := ioq'parm2.(8:8);             18370000
                                                                        18375000
   siodb'byte'array(cdb'area'byte + 8)  := cdb'set'length;              18380000
   setdb'sys;                                                           18385000
                                                                        18390000
   tos     := bank'n'buff'addr;        << get bank &offset of buffer>>  18395000
   assemble(ldea;dxch,ddel);           << get frst 2 words of buffer>>  18400000
   ver'len := tos;                     << store verify byte length  >>  18405000
                                                                        18410000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  18415000
   cp'diag'cdb'length  := 14;          << cdb byte count            >>  18420000
                                                                        18425000
                                       << put len in cmnd seq.      >>  18430000
   siop'byte(cdb'area'byte +  9, l1'ver'len.(0:8));                     18435000
   siop'byte(cdb'area'byte + 10, l1'ver'len.(8:8));                     18440000
   siop'byte(cdb'area'byte + 11, l2'ver'len.(0:8));                     18445000
   siop'byte(cdb'area'byte + 12, l2'ver'len.(8:8));                     18450000
   siop'byte(cdb'area'byte + 13, cdb'verify);                           18455000
                                                                        18460000
   cp'first'branch := enter'diag;                                       18465000
                                                                        18470000
   end; << of case 9 >>                                                 18475000
$page                                                                   18480000
<<---------------------------------------------------->>                18485000
<<                                                    >>                18490000
<<   request generic status [function = 15]           >>                18495000
<<                                                    >>                18500000
<< this request returns generic status of the prior   >>                18505000
<< request.                                           >>                18510000
<<---------------------------------------------------->>                18515000
                                                                        18520000
   begin << of case 10 >>                                               18525000
                                                                        18530000
   if transfer'count < 2d then         << exit with invalid func.   >>  18535000
      begin                                                             18540000
      ioq'stat     := invalid'request;                                  18545000
      ioq'count    := zero;                                             18550000
      driver'state := request'complete;                                 18555000
                                                                        18560000
      return;                                                           18565000
      end;                                                              18570000
                                                                        18575000
   generic'status := zero;                                              18580000
                                                                        18585000
   << ************ >>                                                   18590000
   << fatal error. >>                                                   18595000
   << ************ >>                                                   18600000
                                                                        18605000
   if     dit'controller'fault = one then                               18610000
      gs'fatal'error := two                                             18615000
                                                                        18620000
   else if dit'ill'opcode      = one and                                18625000
           dit'ill'operation   = one and                                18630000
           dit'ill'parameter   = one and                                18635000
           dit'msg'length'err  = one and                                18640000
           dit'ill'msg'seq     = one and                                18645000
           dit'parameter'bound = one and                                18650000
           dit'addr'bounds     = one and                                18655000
           dit'module'addr'err = one then                               18660000
      gs'fatal'error := four                                            18665000
                                                                        18670000
   else if dit'unit'fault      = one then                               18675000
      gs'fatal'error := 5                                               18680000
                                                                        18685000
   else if dit'no'data'found   = one then                               18690000
      gs'fatal'error := 6                                               18695000
                                                                        18700000
   else if dit'chan'parity'err = one then                               18705000
      gs'fatal'error := 7;                                              18710000
                                                                        18715000
   << ************ >>                                                   18720000
   << unit number. >>                                                   18725000
   << ************ >>                                                   18730000
                                                                        18735000
   gs'unit'number := zero;                                              18740000
                                                                        18745000
   << ************ >>                                                   18750000
   << end of file. >>                                                   18755000
   << ************ >>                                                   18760000
                                                                        18765000
   gs'end'of'file := false;                                             18770000
                                                                        18775000
   << *********** >>                                                    18780000
   << load point. >>                                                    18785000
   << *********** >>                                                    18790000
                                                                        18795000
   gs'load'point := false;                                              18800000
                                                                        18805000
   << ************ >>                                                   18810000
   << end of tape. >>                                                   18815000
   << ************ >>                                                   18820000
                                                                        18825000
   if dit'end'of'volume = one then                                      18830000
      gs'end'of'tape := true;                                           18835000
                                                                        18840000
   << ***************** >>                                              18845000
   << immediate report. >>                                              18850000
   << ***************** >>                                              18855000
                                                                        18860000
   if dit'immediate'mode = one then                                     18865000
      gs'immed'rpt'enable := true;                                      18870000
                                                                        18875000
   << **************** >>                                               18880000
   << recovered error. >>                                               18885000
   << **************** >>                                               18890000
                                                                        18895000
   if dit'recov'data       = one and                                    18900000
      dit'marginal'data    = one and                                    18905000
      dit'no'data'overflow = one then                                   18910000
      gs'recovered'error := true;                                       18915000
                                                                        18920000
   << ************ >>                                                   18925000
   << unit online. >>                                                   18930000
   << ************ >>                                                   18935000
                                                                        18940000
   if dit'dev'not'rdy = zero then                                       18945000
      gs'unit'online := true;                                           18950000
                                                                        18955000
   << ************* >>                                                  18960000
   << file protect. >>                                                  18965000
   << ************* >>                                                  18970000
                                                                        18975000
   if dit'write'protect = one then                                      18980000
      gs'file'protect := false;                                         18985000
                                                                        18990000
   << ************************************** >>                         18995000
   << put generic status into user's buffer. >>                         19000000
   << ************************************** >>                         19005000
                                                                        19010000
                                       << return the generic status >>  19015000
   tos := bank'n'buff'addr;            << user's buffer address     >>  19020000
   tos := generic'status;              << generic status            >>  19025000
   assemble (ssea);                                                     19030000
                                                                        19035000
   ioq'stat     := good'io;                                             19040000
   ioq'count    := one;                                                 19045000
   driver'state := request'complete;                                    19050000
                                                                        19055000
   return;                                                              19060000
   end; << of case 10 >>                                                19065000
$page                                                                   19070000
<<---------------------------------------------------->>                19075000
<<                                                    >>                19080000
<<   lock [function code = 16]                        >>                19085000
<<                                                    >>                19090000
<<---------------------------------------------------->>                19095000
                                                                        19100000
   begin << of case 11 >>                                               19105000
                                                                        19110000
   dit'lock'flg := one;                                                 19115000
                                                                        19120000
                                       << exit with a good transfer >>  19125000
   ioq'stat     := good'io;                                             19130000
   ioq'count    := zero;                                                19135000
   driver'state := request'complete;                                    19140000
                                                                        19145000
   return;                                                              19150000
   end; << of case 11 >>                                                19155000
$page                                                                   19160000
<<---------------------------------------------------->>                19165000
<<                                                    >>                19170000
<<   unlock [function code = 17]                      >>                19175000
<<                                                    >>                19180000
<<---------------------------------------------------->>                19185000
                                                                        19190000
   begin << of case 12 >>                                               19195000
                                                                        19200000
   dit'lock'flg := zero;                                                19205000
                                                                        19210000
                                       << exit with a good transfer >>  19215000
   ioq'stat     := good'io;                                             19220000
   ioq'count    := zero;                                                19225000
   driver'state := request'complete;                                    19230000
                                                                        19235000
   return;                                                              19240000
   end; << of case 12 >>                                                19245000
$page                                                                   19250000
<<---------------------------------------------------->>                19255000
<<                                                    >>                19260000
<<   read lock bit [function code = 18]               >>                19265000
<<                                                    >>                19270000
<<       bank & buffaddr - contain lock bit state     >>                19275000
<<                                                    >>                19280000
<<---------------------------------------------------->>                19285000
                                                                        19290000
   begin << of case 13 >>                                               19295000
                                                                        19300000
                                       << return the lock bit value >>  19305000
   tos := bank'n'buff'addr;                                             19310000
   tos := dit'lock'flg;                                                 19315000
   assemble(ssea);                                                      19320000
                                                                        19325000
                                       << exit with a good transfer >>  19330000
   ioq'stat     := good'io;                                             19335000
   ioq'count    := one;                                                 19340000
   driver'state := request'complete;                                    19345000
                                                                        19350000
   return;                                                              19355000
   end; << of case 13 >>                                                19360000
$page                                                                   19365000
<<---------------------------------------------------->>                19370000
<<                                                    >>                19375000
<<   immediate report mode [function code = 29]       >>                19380000
<<                                                    >>                19385000
<<   p2 - 1 enable immediate report mode              >>                19390000
<<      - 0 disable immediate report mode             >>                19395000
<<                                                    >>                19400000
<<---------------------------------------------------->>                19405000
                                                                        19410000
   begin << of case 14 >>                                               19415000
                                                                        19420000
   if not (zero <= integer(ioq'parm2) <= one) then                      19425000
      begin                            << exit with invalid func.   >>  19430000
      ioq'stat     := invalid'request;                                  19435000
      ioq'count    := zero;                                             19440000
      driver'state := request'complete;                                 19445000
                                                                        19450000
      return;                                                           19455000
      end;                                                              19460000
                                                                        19465000
   dit'immediate'mode := ioq'parm2;                                     19470000
                                       << exit with a good transfer >>  19475000
   ioq'stat           := good'io;                                       19480000
   ioq'count          := zero;                                          19485000
   driver'state       := request'complete;                              19490000
                                                                        19495000
   return;                                                              19500000
   end; << of case 14 >>                                                19505000
$page                                                                   19510000
<<---------------------------------------------------->>                19515000
<<                                                    >>                19520000
<<   identify [function code = 72]                    >>                19525000
<<                                                    >>                19530000
<<---------------------------------------------------->>                19535000
                                                                        19540000
   begin << of case 15 >>                                               19545000
                                                                        19550000
   if transfer'count < 2d then         << invalid transfer count    >>  19555000
      begin                                                             19560000
      ioq'stat     := invalid'request;                                  19565000
      ioq'count    := zero;                                             19570000
      driver'state := request'complete;                                 19575000
                                                                        19580000
      return;                                                           19585000
      end;                                                              19590000
                                                                        19595000
   cp'first'branch := enter'identify;                                   19600000
                                                                        19605000
   end; << of case 15 >>                                                19610000
$page                                                                   19615000
<<---------------------------------------------------->>                19620000
<<                                                    >>                19625000
<<   initiate diag. selftest [function code = 73]     >>                19630000
<<                                                    >>                19635000
<<   p1 - 2 bytes loop count (execution count)        >>                19640000
<<   p2 - diagnostic section number                   >>                19645000
<<                                                    >>                19650000
<<---------------------------------------------------->>                19655000
                                                                        19660000
   begin << of case 16 >>                                               19665000
                                                                        19670000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  19675000
   cp'diag'cdb'length  := 5;                                            19680000
                                                                        19685000
   setdb'siop;                                                          19690000
   siodb'byte'array(cdb'area'byte + 0 ) := cdb'set'unit + ctrl'unit;    19695000
                                                                        19700000
   siodb'byte'array(cdb'area'byte + 1 ) := cdb'init'diag;               19705000
   siodb'byte'array(cdb'area'byte + 2 ) := ioq'parm1.(0:8);             19710000
   siodb'byte'array(cdb'area'byte + 3 ) := ioq'parm1.(8:8);             19715000
   siodb'byte'array(cdb'area'byte + 4 ) := ioq'parm2.(8:8);             19720000
   setdb'sys;                                                           19725000
                                                                        19730000
   cp'first'branch := enter'diag;                                       19735000
                                                                        19740000
   end; << of case 16 >>                                                19745000
$page                                                                   19750000
<<---------------------------------------------------->>                19755000
<<                                                    >>                19760000
<<   loopback write [function code = 75]              >>                19765000
<<                                                    >>                19770000
<<   transfer'count - transfer count                  >>                19775000
<<   bank & buffaddr - contains loopbk data for wrt.  >>                19780000
<<                     must begin w/hex ff followed   >>                19785000
<<                     by bytes equal to its prede-   >>                19790000
<<                     cessor plus one                >>                19795000
<<                                                    >>                19800000
<<---------------------------------------------------->>                19805000
                                                                        19810000
   begin << of case 17 >>                                               19815000
                                                                        19820000
   if transfer'count = 0d    or                                         19825000
      transfer'count > 1200d then                                       19830000
      begin                            << exit with invalid func.   >>  19835000
      ioq'stat      := invalid'request;                                 19840000
      ioq'count     := zero;                                            19845000
      driver'state  := request'complete;                                19850000
                                                                        19855000
      return;                                                           19860000
      end;                                                              19865000
                                                                        19870000
   cp'dxfer'write'read  := wrt'trans'sec;                               19875000
   cp'dxfer'cdb'length  := 5;          << cdb byte count            >>  19880000
   cp'dxfer'wait'5      := zero;                                        19885000
   cp'dxfer'wait'6      := zero;                                        19890000
   cp'dxfer'12'wait     := zero;                                        19895000
   cp'dxfer'13'wait     := zero;                                        19900000
   cp'dxfer'cmd'to'exec := wrt'trans'sec;                               19905000
   cp'dxfer'data'size   := l'transfer'count;                            19910000
   cp'dxfer'data'type   := zero;                                        19915000
   cp'dxfer'data'bank   := bank;                                        19920000
   cp'dxfer'data'offset := buffaddr;   << data buffer abs adr       >>  19925000
                                                                        19930000
   siop'byte(cdb'area'byte + 0 , cdb'wrt'loopbk);                       19935000
   siop'byte(cdb'area'byte + 1 , zero);                                 19940000
   siop'byte(cdb'area'byte + 2 , zero);                                 19945000
   siop'byte(cdb'area'byte + 3 , l'transfer'count.(0:8));               19950000
   siop'byte(cdb'area'byte + 4 , l'transfer'count.(8:8));               19955000
                                                                        19960000
   cp'first'branch     := enter'data'xfer;                              19965000
                                                                        19970000
   end; << of case 17 >>                                                19975000
$page                                                                   19980000
<<---------------------------------------------------->>                19985000
<<                                                    >>                19990000
<<   loopback read [function code = 76]               >>                19995000
<<                                                    >>                20000000
<<   transfer'count - transfer count                  >>                20005000
<<   bank & buffaddr - contains loopback data read    >>                20010000
<<                                                    >>                20015000
<<---------------------------------------------------->>                20020000
                                                                        20025000
   begin << of case 18 >>                                               20030000
                                                                        20035000
   if transfer'count = 0d    or                                         20040000
      transfer'count > 1200d then                                       20045000
      begin                            << exit with invalid func.   >>  20050000
      ioq'stat     := invalid'request;                                  20055000
      ioq'count    := zero;                                             20060000
      driver'state := request'complete;                                 20065000
                                                                        20070000
      return;                                                           20075000
      end;                                                              20080000
                                                                        20085000
   cp'dxfer'write'read  := wrt'trans'sec;                               20090000
   cp'dxfer'cdb'length  := 5;          << cdb byte count            >>  20095000
   cp'dxfer'wait'5      := zero;                                        20100000
   cp'dxfer'wait'6      := zero;                                        20105000
   cp'dxfer'12'wait     := zero;                                        20110000
   cp'dxfer'13'wait     := zero;                                        20115000
   cp'dxfer'cmd'to'exec := read'trans'sec;                              20120000
   cp'dxfer'data'size   := l'transfer'count;                            20125000
   cp'dxfer'data'type   := zero;                                        20130000
   cp'dxfer'data'bank   := bank;                                        20135000
   cp'dxfer'data'offset := buffaddr;   << data buffer abs adr       >>  20140000
                                                                        20145000
   siop'byte(cdb'area'byte + 0 , cdb'read'loopbk);                      20150000
   siop'byte(cdb'area'byte + 1 , zero);                                 20155000
   siop'byte(cdb'area'byte + 2 , zero);                                 20160000
   siop'byte(cdb'area'byte + 3 , l'transfer'count.(0:8));               20165000
   siop'byte(cdb'area'byte + 4 , l'transfer'count.(8:8));               20170000
                                                                        20175000
   cp'first'branch     := enter'data'xfer;                              20180000
                                                                        20185000
   end; << of case 18 >>                                                20190000
$page                                                                   20195000
<<---------------------------------------------------->>                20200000
<<                                                    >>                20205000
<<   release [function code = 79]                     >>                20210000
<<                                                    >>                20215000
<<---------------------------------------------------->>                20220000
                                                                        20225000
   begin << of case 19 >>                                               20230000
                                                                        20235000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  20240000
   cp'diag'cdb'length  := two;                                          20245000
                                                                        20250000
   siop'byte(cdb'area'byte + 0 , cdb'set'unit + ctrl'unit);             20255000
   siop'byte(cdb'area'byte + 1 , cdb'release);                          20260000
                                                                        20265000
   cp'first'branch := enter'diag;                                       20270000
                                                                        20275000
   end; << of case 19 >>                                                20280000
$page                                                                   20285000
<<---------------------------------------------------->>                20290000
<<                                                    >>                20295000
<<   release denied [function code = 80]              >>                20300000
<<                                                    >>                20305000
<<---------------------------------------------------->>                20310000
                                                                        20315000
   begin << of case 20 >>                                               20320000
                                                                        20325000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  20330000
   cp'diag'cdb'length  := two;                                          20335000
                                                                        20340000
   siop'byte(cdb'area'byte + 0 , cdb'set'unit + ctrl'unit);             20345000
   siop'byte(cdb'area'byte + 1 , cdb'release'deny);                     20350000
                                                                        20355000
   cp'first'branch := enter'diag;                                       20360000
                                                                        20365000
   end; << of case 20 >>                                                20370000
$page                                                                   20375000
<<---------------------------------------------------->>                20380000
<<                                                    >>                20385000
<<   set release [function code = 81]                 >>                20390000
<<                                                    >>                20395000
<<   p1 - 0 enable release timeout [t=0]              >>                20400000
<<        1 suppress release timeout [t=1]            >>                20405000
<<   p2 - 0 auto release during idle time [z=0]       >>                20410000
<<        1 no auto release during idle time [z=1]    >>                20415000
<<                                                    >>                20420000
<<---------------------------------------------------->>                20425000
                                                                        20430000
   begin << of case 21 >>                                               20435000
                                                                        20440000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  20445000
   cp'diag'cdb'length  := three;                                        20450000
                                                                        20455000
   parm          := zero;                                               20460000
   if ioq'parm1 = one then                                              20465000
      parm.(0:1) := one;               << suppress release timeout  >>  20470000
   if ioq'parm2 = one then                                              20475000
      parm.(1:1) := one;               << dont release during idle  >>  20480000
                                       << timeout                   >>  20485000
                                                                        20490000
   siop'byte(cdb'area'byte + 0 , cdb'set'unit + ctrl'unit);             20495000
   siop'byte(cdb'area'byte + 1 , cdb'set'release);                      20500000
   siop'byte(cdb'area'byte + 2 , parm.(0:8));                           20505000
                                                                        20510000
   cp'first'branch := enter'diag;                                       20515000
                                                                        20520000
   end; << of case 21 >>                                                20525000
$page                                                                   20530000
<<---------------------------------------------------->>                20535000
<<                                                    >>                20540000
<<   set address [function code = 82]                 >>                20545000
<<                                                    >>                20550000
<<   bank & buffaddr - contains a dbl wrd address     >>                20555000
<<                     of the block to be addressed.  >>                20560000
<<                                                    >>                20565000
<<---------------------------------------------------->>                20570000
                                                                        20575000
   begin << of case 22 >>                                               20580000
                                                                        20585000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  20590000
   cp'diag'cdb'length  := 8;                                            20595000
                                                                        20600000
                                       << get the block address.    >>  20605000
   tos            := bank'n'buff'addr; << get bank &offset of buffer>>  20610000
   assemble(ldea;dxch,ddel);           << get frst 2 words of buffer>>  20615000
   address'offset := tos;                                               20620000
   parm           := tos;                                               20625000
                                                                        20630000
   setdb'siop;                                                          20635000
   siodb'byte'array(cdb'area'byte + 0 ) := cdb'set'unit;                20640000
                                                                        20645000
   siodb'byte'array(cdb'area'byte + 1 ) := cdb'set'sngl'vec;            20650000
   siodb'byte'array(cdb'area'byte + 2 ) := zero;                        20655000
   siodb'byte'array(cdb'area'byte + 3 ) := zero;                        20660000
   siodb'byte'array(cdb'area'byte + 4 ) := parm.(0:8);                  20665000
   siodb'byte'array(cdb'area'byte + 5 ) := parm.(8:8);                  20670000
   siodb'byte'array(cdb'area'byte + 6 ) := address'offset.(0:8);        20675000
   siodb'byte'array(cdb'area'byte + 7 ) := address'offset.(8:8);        20680000
   setdb'sys;                                                           20685000
                                                                        20690000
   cp'first'branch := enter'diag;                                       20695000
                                                                        20700000
   end; << of case 22 >>                                                20705000
$page                                                                   20710000
<<---------------------------------------------------->>                20715000
<<                                                    >>                20720000
<<   spare block [function code = 88]                 >>                20725000
<<                                                    >>                20730000
<<   bank & buffaddr - contains dbl wrd address of    >>                20735000
<<                     the block to be spared         >>                20740000
<<   p2 - 0 spare retaining data (no target sector)   >>                20745000
<<        1 spare without retaining data              >>                20750000
<<        4 spare retaining data (target included)    >>                20755000
<<                                                    >>                20760000
<<---------------------------------------------------->>                20765000
                                                                        20770000
   begin << of case 23 >>                                               20775000
                                                                        20780000
   if not (zero <= integer(ioq'parm2) <= four) then                     20785000
      begin                            << exit with invalid func.   >>  20790000
      ioq'stat     := invalid'request;                                  20795000
      ioq'count    := zero;                                             20800000
      driver'state := request'complete;                                 20805000
                                                                        20810000
      return;                                                           20815000
      end;                                                              20820000
                                                                        20825000
                                       << get the block address.    >>  20830000
   tos            := bank'n'buff'addr; << get bank &offset of buffer>>  20835000
   assemble(ldea;dxch,ddel);           << get frst 2 words of buffer>>  20840000
   address'offset := tos;                                               20845000
   parm           := tos;                                               20850000
                                                                        20855000
   cp'diag'cmd'to'exec := wrt'cmd'sec;                                  20860000
   cp'diag'cdb'length  := 10;                                           20865000
                                                                        20870000
   setdb'siop;                                                          20875000
   siodb'byte'array(cdb'area'byte + 0 ) := cdb'set'unit;                20880000
                                                                        20885000
   siodb'byte'array(cdb'area'byte + 1 ) := cdb'set'sngl'vec;            20890000
   siodb'byte'array(cdb'area'byte + 2 ) := zero;                        20895000
   siodb'byte'array(cdb'area'byte + 3 ) := zero;                        20900000
   siodb'byte'array(cdb'area'byte + 4 ) := parm.(0:8);                  20905000
   siodb'byte'array(cdb'area'byte + 5 ) := parm.(8:8);                  20910000
   siodb'byte'array(cdb'area'byte + 6 ) := address'offset.(0:8);        20915000
   siodb'byte'array(cdb'area'byte + 7 ) := address'offset.(8:8);        20920000
                                                                        20925000
   siodb'byte'array(cdb'area'byte + 8 ) := cdb'spare'blk;               20930000
   siodb'byte'array(cdb'area'byte + 9 ) := ioq'parm2.(8:8);             20935000
   setdb'sys;                                                           20940000
                                                                        20945000
   cp'first'branch := enter'diag;                                       20950000
                                                                        20955000
   end; << of case 23 >>                                                20960000
$page                                                                   20965000
<<---------------------------------------------------->>                20970000
<<                                                    >>                20975000
<<   initiate utility [function code = 91]            >>                20980000
<<                                                    >>                20985000
<<   transfer'count - executing message length        >>                20990000
<<   bank & buffaddr - contains utility byte count    >>                20995000
<<                     with utility parameter bytes   >>                21000000
<<                     to follow (optional).          >>                21005000
<<   bank & buffaddr+10 - returns utility data        >>                21010000
<<                        information (optional).     >>                21015000
<<   p1 - 0 no executing message                      >>                21020000
<<      - 1 send executing message to the device      >>                21025000
<<      - 2 receive executing message from device     >>                21030000
<<   p2 - utility number                              >>                21035000
<<                                                    >>                21040000
<<  *note:  see buffalo driver ers documentation      >>                21045000
<<          for a more thorough description           >>                21050000
<<                                                    >>                21055000
<<---------------------------------------------------->>                21060000
                                                                        21065000
   begin << of case 24 >>                                               21070000
                                                                        21075000
                                       << exit with invalid func.  >>   21080000
   if not (zero <= integer(ioq'parm1) <= two) then                      21085000
      begin                                                             21090000
      ioq'stat     := invalid'request;                                  21095000
      ioq'count    := zero;                                             21100000
      driver'state := request'complete;                                 21105000
                                                                        21110000
      return;                                                           21115000
      end;                                                              21120000
                                                                        21125000
                                       << invalid transfer count    >>  21130000
   if transfer'count = 0d then                                          21135000
      begin                                                             21140000
      ioq'stat     := invalid'request;                                  21145000
      ioq'count    := zero;                                             21150000
      driver'state := request'complete;                                 21155000
                                                                        21160000
      return;                                                           21165000
      end;                                                              21170000
                                                                        21175000
   siop'byte(cdb'area'byte + 0 , cdb'set'unit);                         21180000
   siop'byte(cdb'area'byte + 1 , cdb'nop);                              21185000
   siop'byte(cdb'area'byte + 2 , cdb'init'util + ioq'parm1.(8:8));      21190000
   siop'byte(cdb'area'byte + 3 , ioq'parm2.(8:8));                      21195000
                                                                        21200000
   if ioq'parm1 <> one then            << fetch util parm bytes     >>  21205000
      begin                                                             21210000
      tos := bank'n'buff'addr;                                          21215000
      assemble (lsea);                                                  21220000
      index := tos;                    << #util parm bytes          >>  21225000
      assemble (del;del);                                               21230000
      if index <> zero then                                             21235000
         begin                                                          21240000
         if index > 18 then            << exceed max bytes allow    >>  21245000
            begin                                                       21250000
            ioq'stat     := invalid'request;                            21255000
            ioq'count    := zero;                                       21260000
            driver'state := request'complete;                           21265000
                                                                        21270000
            return;                                                     21275000
            end;                                                        21280000
         parm := (index + one) / two;  << convert byte cnt to words >>  21285000
                                       << destination of cdb area   >>  21290000
         tos := 0;                                             <<f9010>>21295000
         tos := @siop + sysdb + cdb'area'wrd + two;                     21300000
         tos := bank'n'buff'addr + %1d;<< source                    >>  21305000
         tos := parm;                  << #words to move            >>  21310000
         assemble (mabs);              << move using abs addr       >>  21315000
         end; << of "if <> THEN ..." >>                                 21320000
      end; << of "if IOQ'PARM1 <> ONE ..." >>                           21325000
                                                                        21330000
   case ioq'parm1 of                                                    21335000
                                                                        21340000
      begin                                                             21345000
      begin << no exec msg >>                                           21350000
                                                                        21355000
      cp'diag'cmd'to'exec := wrt'cmd'sec;                               21360000
      cp'diag'cdb'length  := four + index;                              21365000
      cp'first'branch     := enter'diag;                                21370000
                                                                        21375000
      end; << no exec msg >>                                            21380000
                                                                        21385000
      begin << send exec msg to device >>                               21390000
                                                                        21395000
      cp'dxfer'write'read  := wrt'cmd'sec;                              21400000
      cp'dxfer'cdb'length  := four;                                     21405000
      cp'dxfer'wait'5      := wait'instr;                               21410000
      cp'dxfer'wait'6      := zero;                                     21415000
      cp'dxfer'12'wait     := wait'instr;                               21420000
      cp'dxfer'13'wait     := zero;                                     21425000
      cp'dxfer'cmd'to'exec := wrt'exec'sec;                             21430000
                                              << exec msg count     >>  21435000
      cp'dxfer'data'size   := integer(transfer'count);                  21440000
      cp'dxfer'data'type   := zero;                                     21445000
      cp'dxfer'data'bank   := bank;                                     21450000
      cp'dxfer'data'offset := buffaddr;                                 21455000
      cp'first'branch      := enter'data'xfer;                          21460000
                                                                        21465000
      end; << send exec msg to device >>                                21470000
                                                                        21475000
      begin << receive exec msg from device >>                          21480000
                                                                        21485000
      cp'dxfer'write'read  := wrt'cmd'sec;                              21490000
      cp'dxfer'cdb'length  := four + index;                             21495000
      cp'dxfer'wait'5      := wait'instr;                               21500000
      cp'dxfer'wait'6      := zero;                                     21505000
      cp'dxfer'12'wait     := wait'instr;                               21510000
      cp'dxfer'13'wait     := zero;                                     21515000
      cp'dxfer'cmd'to'exec := read'exec'sec;                            21520000
                                              << exec msg count     >>  21525000
      cp'dxfer'data'size   := integer(transfer'count);                  21530000
      cp'dxfer'data'type   := zero;                                     21535000
      cp'dxfer'data'bank   := bank;                                     21540000
      cp'dxfer'data'offset := buffaddr+10;                              21545000
      cp'first'branch      := enter'data'xfer;                          21550000
                                                                        21555000
      end; << send exec msg to device >>                                21560000
      end; << of "case IOQ'PARM1 of ..." >>                             21565000
                                                                        21570000
   end; << of case 24 >>                                                21575000
$page                                                                   21580000
<<---------------------------------------------------->>                21585000
<<                                                    >>                21590000
<<   clear device [function code = 92] and            >>                21595000
<<   channel independant clear [function code = 101]  >>                21600000
<<                                                    >>                21605000
<<  p1 = -ioq'func - add set unit command             >>                21610000
<<  p2 - the unit number between 0 and 15.            >>                21615000
<<---------------------------------------------------->>                21620000
                                                                        21625000
   begin << of case 25 >>                                               21630000
                                                                        21635000
   cp'diag'cmd'to'exec := wrt'trans'sec;                                21640000
   cp'diag'cdb'length  := two;         << just cancel cmd           >>  21645000
                                                                        21650000
   siop'byte(cdb'area'byte + 0, cdb'set'unit);                          21655000
   siop'byte(cdb'area'byte + 1, cdb'ci'clear);                          21660000
                                                                        21665000
   if ioq'parm1 = -ioq'func then       << change unit number?       >>  21670000
                                       << valid unit ?              >>  21675000
      if zero <= integer(ioq'parm2) <= 15 then                          21680000
         siop'byte(cdb'area'byte, cdb'set'unit + ioq'parm2)             21685000
      else                             << bad unit #                >>  21690000
         begin                         << exit with invalid func.   >>  21695000
         ioq'stat      := invalid'request;                              21700000
         ioq'count     := zero;                                         21705000
         driver'state  := request'complete;                             21710000
                                                                        21715000
         return;                                                        21720000
         end; << of else "if ZERO <= INTEGER(IOQ'PARM2) ..." >>         21725000
                                                                        21730000
   cp'first'branch := enter'diag;                                       21735000
                                                                        21740000
   end; << of case 25 >>                                                21745000
$page                                                                   21750000
<<---------------------------------------------------->>                21755000
<<                                                    >>                21760000
<<   cancel transaction [function code = 93]          >>                21765000
<<                                                    >>                21770000
<<                                                    >>                21775000
<<  p1 = -ioq'func - add set unit command             >>                21780000
<<  p2 - the unit number between 0 and 15             >>                21785000
<<---------------------------------------------------->>                21790000
                                                                        21795000
   begin << of case 26 >>                                               21800000
                                                                        21805000
   cp'diag'cmd'to'exec := wrt'trans'sec;                                21810000
   cp'diag'cdb'length  := two;         << 2 cmd bytes               >>  21815000
                                                                        21820000
   siop'byte(cdb'area'byte + 0, cdb'set'unit);                          21825000
   siop'byte(cdb'area'byte + 1, cdb'cancel);                            21830000
                                                                        21835000
   if ioq'parm1 = -ioq'func then       << change unit number?       >>  21840000
                                       << valid unit ?              >>  21845000
      if zero <= integer(ioq'parm2) <= 15 then                          21850000
         siop'byte(cdb'area'byte, cdb'set'unit + ioq'parm2)             21855000
      else                             << bad unit #                >>  21860000
         begin                         << exit with invalid func.   >>  21865000
         ioq'stat      := invalid'request;                              21870000
         ioq'count     := zero;                                         21875000
         driver'state  := request'complete;                             21880000
                                                                        21885000
         return;                                                        21890000
         end; << of else "if ZERO <= INTEGER(IOQ'PARM2) ..." >>         21895000
                                                                        21900000
   cp'first'branch := enter'diag;                                       21905000
                                                                        21910000
   end; << of case 26 >>                                                21915000
$page                                                                   21920000
<<---------------------------------------------------->>                21925000
<<                                                    >>                21930000
<<   parity checking [function code = 94]             >>                21935000
<<                                                    >>                21940000
<<   p1 - 0 disable parity checking                   >>                21945000
<<      - 1 enable parity checking                    >>                21950000
<<                                                    >>                21955000
<<---------------------------------------------------->>                21960000
                                                                        21965000
   begin << of case 27 >>                                               21970000
                                                                        21975000
   if not (zero <= integer(ioq'parm1) <= one) then                      21980000
      begin                            << exit with invalid func.   >>  21985000
      ioq'stat     := invalid'request;                                  21990000
      ioq'count    := zero;                                             21995000
      driver'state := request'complete;                                 22000000
                                                                        22005000
      return;                                                           22010000
      end;                                                              22015000
                                                                        22020000
   cp'diag'cmd'to'exec := wrt'trans'sec;                                22025000
   cp'diag'cdb'length  := three;                                        22030000
   cp'diag'wait'5      := 0;           << bypass wait and dsj inst. >>  22035000
   cp'diag'wait'6      := 6;                                            22040000
                                                                        22045000
   siop'byte(cdb'area'byte + 0, cdb'set'unit);                          22050000
   siop'byte(cdb'area'byte + 1, cdb'parity'op);                         22055000
                                                                        22060000
                                       << enable or disable parity  >>  22065000
                                       << checking                  >>  22070000
   siop'byte(cdb'area'byte + 2, if ioq'parm1 = zero then                22075000
                                   zero                                 22080000
                                else                                    22085000
                                   one);                                22090000
                                                                        22095000
   cp'first'branch := enter'diag;                                       22100000
                                                                        22105000
   end; << of case 27 >>                                                22110000
$page                                                                   22115000
<<---------------------------------------------------->>                22120000
<<                                                    >>                22125000
<<   generic diagnostic request [function code = 100] >>                22130000
<<                                                    >>                22135000
<<   transfer'count - execution message length        >>                22140000
<<            (set to -1 if not used)                 >>                22145000
<<   bank & buffaddr - buffer containing the execution>>                22150000
<<                     message and data bytes.        >>                22155000
<<   p1 - 0 no execution message                      >>                22160000
<<      - 1 send execution message to the device      >>                22165000
<<      - 2 total length of message (exec + data)     >>                22170000
<<   p2 - number of command bytes to be send          >>                22175000
<<                                                    >>                22180000
<<    if sending an execution msg, the command bytes  >>                22185000
<<    follow the data to be sent in the buffer.  in   >>                22190000
<<    this case, the cmd bytes must start on a word   >>                22195000
<<    boundtry - if they do not, we round to the      >>                22200000
<<    next even byte.                                 >>                22205000
<<---------------------------------------------------->>                22210000
                                                                        22215000
   begin << of case 28 >>                                               22220000
                                                                        22225000
   if not ioq'diag then                                                 22230000
      begin                            << exit with invalid func.   >>  22235000
      ioq'stat     := invalid'request;                                  22240000
      ioq'count    := zero;                                             22245000
      driver'state := request'complete;                                 22250000
                                                                        22255000
      return;                                                           22260000
      end;                                                              22265000
                                                                        22270000
   case ioq'parm1 of                                                    22275000
      begin                                                             22280000
                                                                        22285000
      begin << no exection msg >>                                       22290000
                                                                        22295000
      cp'diag'cmd'to'exec := wrt'cmd'sec;                               22300000
      cp'diag'cdb'length  := ioq'parm2; << cmd bytes length         >>  22305000
      cp'diag'cdb'bank    := bank;      << cmb byte location        >>  22310000
      cp'diag'cdb'offset  := buffaddr;                                  22315000
      cp'first'branch     := enter'diag;                                22320000
                                                                        22325000
      end;  << no exection msg >>                                       22330000
                                                                        22335000
      begin << send exection msg >>                                     22340000
                                                                        22345000
                                       << compute word offset to    >>  22350000
                                       << nearest word boundry      >>  22355000
      if integer(ioq'count) < zero then                                 22360000
         address'offset    := (one - integer(ioq'count)) / two          22365000
      else                                                              22370000
         address'offset    := integer(ioq'count);                       22375000
                                                                        22380000
      cp'dxfer'write'read  := wrt'cmd'sec;                              22385000
      cp'dxfer'cdb'length  := integer(ioq'parm2) -                      22390000
                              integer(transfer'count);                  22395000
      cp'dxfer'cdb'bank    := bank;                                     22400000
      cp'dxfer'cdb'offset  := buffaddr + address'offset;                22405000
      cp'dxfer'wait'5      := wait'instr;                               22410000
      cp'dxfer'wait'6      := zero;                                     22415000
      cp'dxfer'12'wait     := wait'instr;                               22420000
      cp'dxfer'13'wait     := zero;                                     22425000
      cp'dxfer'cmd'to'exec := wrt'exec'sec;                             22430000
                                              << exec msg length    >>  22435000
      cp'dxfer'data'size   := integer(transfer'count);                  22440000
      cp'dxfer'data'type   := zero;                                     22445000
      cp'dxfer'data'bank   := bank;                                     22450000
      cp'dxfer'data'offset := buffaddr;                                 22455000
      cp'first'branch      := enter'data'xfer;                          22460000
                                                                        22465000
      end;  << send exection msg >>                                     22470000
                                                                        22475000
      begin << receive exection msg >>                                  22480000
                                                                        22485000
      cp'dxfer'write'read  := wrt'cmd'sec;                              22490000
      cp'dxfer'cdb'length  := ioq'parm2;                                22495000
      cp'dxfer'cdb'bank    := bank;                                     22500000
      cp'dxfer'cdb'offset  := buffaddr;                                 22505000
      cp'dxfer'wait'5      := wait'instr;                               22510000
      cp'dxfer'wait'6      := zero;                                     22515000
      cp'dxfer'12'wait     := wait'instr;                               22520000
      cp'dxfer'13'wait     := zero;                                     22525000
      cp'dxfer'cmd'to'exec := read'exec'sec;                            22530000
                                              << exec msg count     >>  22535000
      cp'dxfer'data'size   := integer(transfer'count);                  22540000
      cp'dxfer'data'type   := zero;                                     22545000
      cp'dxfer'data'bank   := bank;                                     22550000
      cp'dxfer'data'offset := buffaddr;                                 22555000
      cp'first'branch      := enter'data'xfer;                          22560000
                                                                        22565000
      end;  << receive exection msg>>                                   22570000
      end; << of case ioq'parm1 >>                                      22575000
                                                                        22580000
   end; << of case 28 >>                                                22585000
                                                                        22590000
   end; << of "case FCODE..." >>                                        22595000
$page                                                                   22600000
<<---------------------------------------------------->>                22605000
<<                                                    >>                22610000
<<   start channel program section                    >>                22615000
<<                                                    >>                22620000
<<---------------------------------------------------->>                22625000
                                                                        22630000
   p'cpva      := zero;                << clear channel status words>>  22635000
   cpva'status := zero;                                                 22640000
                                                                        22645000
                                       << clear the dit status area >>  22650000
   index := dstatus;                                                    22655000
   do                                                                   22660000
     p'dit(index) := zero                                               22665000
   until (index := index + 1) > dstatus + (dev'stat'word'size-1);       22670000
                                                                        22675000
   start'hpib(p'dit,siop,true);                                         22680000
   if > then                                                            22685000
      begin                            << exit with a sio error     >>  22690000
      log'status;                                                       22695000
      ioq'stat     := chan'pgm'failure;                                 22700000
      update'xfer'cnt;                                                  22705000
      driver'state := request'complete;                                 22710000
                                                                        22715000
      return;                                                           22720000
      end; << of "if > then ..." >>                                     22725000
                                                                        22730000
   ioq'waitcode    := cmpltion'wait;                                    22735000
   driver'state    := interrupt'wait;                                   22740000
                                                                        22745000
   return;                                                              22750000
   end;   << end of initiation section >>                               22755000
$page                                                                   22760000
<<*******************************************************************>> 22765000
<<*******************************************************************>> 22770000
<<                                                                   >> 22775000
<<                  cs'80 driver continuator section                 >> 22780000
<<                                                                   >> 22785000
<<*******************************************************************>> 22790000
<<*******************************************************************>> 22795000
                                                                        22800000
continuator:                                                            22805000
                                                                        22810000
if dit'save'word = -one then           << system powerfail          >>  22815000
   begin                                                                22820000
   dit'save'word := zero;                                               22825000
   ioq'sys'pfail := one;                                                22830000
   goto retry'request;                                                  22835000
   end; << of "if DIT'SAVE'WORD = -ONE ..." >>                          22840000
$page                                                                   22845000
<<---------------------------------------------------->>                22850000
<<   reset the location of where command bytes can    >>                22855000
<<   be found for diagnostics commands.               >>                22860000
<<---------------------------------------------------->>                22865000
                                                                        22870000
if fcode = fc'generic'diag then                                         22875000
   begin                                                                22880000
   cp'diag'cdb'bank    := zero;        << cmb byte location         >>  22885000
   cp'diag'cdb'offset  := @siop + sysdb + cdb'area'wrd;                 22890000
   cp'dxfer'cdb'bank   := zero;                                         22895000
   cp'dxfer'cdb'offset := @siop + sysdb + cdb'area'wrd;                 22900000
   end; << of "if FCODE = FC'GENERIC'DIAG ..." >>                       22905000
$page                                                                   22910000
                                       << abort current ioq         >>  22915000
if ioq'abort    =  one             and                                  22920000
   ioq'waitcode <> abort'ioq'wait  then                                 22925000
                                                                        22930000
   begin                                                                22935000
                                       << do a channel independent  >>  22940000
                                       << clear to abort the        >>  22945000
                                       << current ioq.              >>  22950000
   cp'first'branch := enter'power'on;                                   22955000
   start'hpib(p'dit,siop,true);                                         22960000
   if > then                                                            22965000
      begin                            << exit with a sio error     >>  22970000
      log'status;                                                       22975000
      ioq'stat     := chan'pgm'failure;                                 22980000
      update'xfer'cnt;                                                  22985000
      driver'state := request'complete;                                 22990000
                                                                        22995000
      return;                                                           23000000
      end; << of "if > then ..." >>                                     23005000
                                                                        23010000
   dit'immediate'mode := one;          << immediate reporting will  >>  23015000
                                       << be enabled.               >>  23020000
   ioq'waitcode       := abort'ioq'wait;                                23025000
   driver'state       := interrupt'wait;                                23030000
                                                                        23035000
   return;                                                              23040000
   end; << of "if IOQ'ABORT = ONE ..." >>                               23045000
$page                                                                   23050000
<<====================================================>>                23055000
<<                                                    >>                23060000
<<          current i/o aborted do to the dma         >>                23065000
<<                                                    >>                23070000
<<====================================================>>                23075000
                                                                        23080000
if cpva'errorcode = dma'abort then     << dma abort                 >>  23085000
   if ioq'retry'count = retry'limit then                                23090000
      begin                            << exit with a channel errer >>  23095000
                                                                        23100000
      if dit'dev'not'rdy = one then                                     23105000
         begin                                                          23110000
                                       << schedule idle wait cp     >>  23115000
         cp'first'branch := enter'idle'wait;                            23120000
         ioq'waitcode    := not'rdy'wait;                               23125000
                                                                        23130000
         if system'up then                                              23135000
            ldevnotrdy(p'dit);         << not rdy msg to console    >>  23140000
         start'hpib(p'dit,siop,true);                                   23145000
         if > then                                                      23150000
            begin                      << exit with a sio error     >>  23155000
            log'status;                                                 23160000
            ioq'stat      := chan'pgm'failure;                          23165000
            update'xfer'cnt;                                            23170000
            driver'state  := request'complete;                          23175000
                                                                        23180000
            return;                                                     23185000
            end; << of "if > then ..." >>                               23190000
                                                                        23195000
         driver'state := not'ready;                                     23200000
                                                                        23205000
         return;                                                        23210000
         end << of "if DIT'DEV'NOT'RDY = ONE ..." >>                    23215000
      else                                                              23220000
         begin                         << exit with a channel errer >>  23225000
                                       << if not diag req log error >>  23230000
         if not ioq'diag then                                           23235000
            begin                                                       23240000
            dit'error'status := [8/2,8/dlogerror];                      23245000
            dit'log'error    := p'cpva;                                 23250000
            dit'siop'stop    := getdrt(drtn,0) - (@siop + sysdb);       23255000
            end;                                                        23260000
         p'cpva       := zero;                                          23265000
         ioq'stat     := chan'io'failure;                               23270000
         update'xfer'cnt;                                               23275000
         driver'state := request'complete;                              23280000
                                                                        23285000
         return;                                                        23290000
         end; << of else "if DIT'DEV'NOT'RDY = ONE ..." >>              23295000
      end  << of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>              23300000
   else                                                                 23305000
      begin                            << retry 7 times             >>  23310000
                                                                        23315000
      ioq'retry'count  := ioq'retry'count + one;                        23320000
      dit'error'status := [8/2,8/dlogerror];                            23325000
      dit'log'error    := p'cpva;                                       23330000
      dit'siop'stop    := getdrt(drtn,0) - (@siop + sysdb);             23335000
      p'cpva           := zero;                                         23340000
      cp'first'branch  := enter'sync'dsj;                               23345000
      start'hpib(p'dit,siop,true);                                      23350000
      if > then                                                         23355000
         begin                         << exit with a sio error     >>  23360000
         log'status;                                                    23365000
         ioq'stat      := chan'pgm'failure;                             23370000
         update'xfer'cnt;                                               23375000
         driver'state  := request'complete;                             23380000
                                                                        23385000
         return;                                                        23390000
         end; << of "if < then ..." >>                                  23395000
                                                                        23400000
      ioq'waitcode := sync'wait;                                        23405000
      driver'state := interrupt'wait;                                   23410000
                                                                        23415000
      return;                                                           23420000
      end; << of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>         23425000
$page                                                                   23430000
<<====================================================>>                23435000
<<                                                    >>                23440000
<<      current i/o aborted do to the channel         >>                23445000
<<                                                    >>                23450000
<<====================================================>>                23455000
                                                                        23460000
if cpva'errorcode = channel'abort then << channel abort             >>  23465000
   if ioq'retry'count = retry'limit then                                23470000
      begin                                                             23475000
                                                                        23480000
      if dit'dev'not'rdy = one          or                              23485000
         p'cpva          = cpva'timeout then                            23490000
                                                                        23495000
         begin                                                          23500000
         if fcode = fc'req'last'stat then                               23505000
            begin                                                       23510000
                                       << make word count           >>  23515000
            transfer'count := (transfer'count + 1d) / 2d;               23520000
                                                                        23525000
            tos := bank'n'buff'addr;   << user's area               >>  23530000
            tos := zero;               << describe area             >>  23535000
            tos := @p'dit + sysdb + dstatus;                            23540000
            tos := integer(transfer'count); << #words to move       >>  23545000
            assemble (mabs);                                            23550000
                                                                        23555000
                                       << exit with a good transfer >>  23560000
            ioq'stat     := timeout'error;                     <<f9010>>23565000
            ioq'count    := integer(transfer'count);                    23570000
            driver'state := request'complete;                           23575000
            p'cpva       := 0;                                 <<f9010>>23580000
            cpva'status  := 0;                                 <<f9010>>23585000
                                                                        23590000
            return;                                                     23595000
            end << of "if FCODE = FC'REQ'LAST'STAT ..." >>              23600000
         else                                                           23605000
            begin                       << schedule idle wait cp     >> 23610000
            cp'first'branch := enter'idle'wait;                         23615000
            ioq'waitcode    := not'rdy'wait;                            23620000
                                                                        23625000
            if system'up then                                           23630000
               ldevnotrdy(p'dit);      << not rdy msg to console    >>  23635000
            start'hpib(p'dit,siop(firstbranch),true);          <<f9010>>23640000
            if > then                                                   23645000
               begin                   << exit with a sio error     >>  23650000
               log'status;                                              23655000
               ioq'stat     := chan'pgm'failure;                        23660000
               update'xfer'cnt;                                         23665000
               driver'state := request'complete;                        23670000
                                                                        23675000
               return;                                                  23680000
               end; << of "if > then ..." >>                            23685000
                                                                        23690000
            driver'state := not'ready;                                  23695000
                                                                        23700000
            return;                                                     23705000
            end; << of "if FCODE = FC'REQ'LAST'STAT ..." >>             23710000
         end << of "if DIT'DEV'NOT'RDY = ONE ..." >>                    23715000
      else                                                              23720000
         begin                         << exit with a channel errer >>  23725000
                                       << if not diag req log error >>  23730000
         if not ioq'diag then                                           23735000
            begin                                                       23740000
            dit'error'status := [8/2,8/dlogerror];                      23745000
            dit'log'error    := p'cpva;                                 23750000
            dit'siop'stop    := getdrt(drtn,0) - (@siop + sysdb);       23755000
            end;                                                        23760000
         p'cpva       := zero;                                          23765000
         ioq'stat     := chan'io'failure;                               23770000
         update'xfer'cnt;                                               23775000
         driver'state := request'complete;                              23780000
                                                                        23785000
         return;                                                        23790000
         end; << of else "if DIT'DEV'NOT'RDY = ONE ..." >>              23795000
      end << of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>               23800000
   else                                                                 23805000
      begin                                                             23810000
                                       << retry 7 times             >>  23815000
      ioq'retry'count  := ioq'retry'count + one;                        23820000
      dit'error'status := [8/2,8/dlogerror];                            23825000
      dit'log'error    := p'cpva;                                       23830000
      dit'siop'stop    := getdrt(drtn,0) - (@siop + sysdb);             23835000
      p'cpva           := zero;                                         23840000
      cp'first'branch  := enter'sync'dsj;                               23845000
      start'hpib(p'dit,siop,true);                                      23850000
      if > then                                                         23855000
         begin                         << exit with a sio error     >>  23860000
         log'status;                                                    23865000
         ioq'stat     := chan'pgm'failure;                              23870000
         update'xfer'cnt;                                               23875000
         driver'state := request'complete;                              23880000
                                                                        23885000
         return;                                                        23890000
         end; << of "if < then ..." >>                                  23895000
                                                                        23900000
      ioq'waitcode := sync'wait;                                        23905000
      driver'state := interrupt'wait;                                   23910000
                                                                        23915000
      return;                                                           23920000
      end; << of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>         23925000
$page                                                                   23930000
if ioq'sfail then                      << failure on delayed start  >>  23935000
                                       << i/o                       >>  23940000
   begin                               << exit with a sio error     >>  23945000
   log'status;                                                          23950000
   ioq'stat     := chan'pgm'failure;                                    23955000
   update'xfer'cnt;                                                     23960000
   driver'state := request'complete;                                    23965000
                                                                        23970000
   return;                                                              23975000
   end; << of "if IOQ'SFAIL then ..." >>                                23980000
$page                                                                   23985000
<<====================================================>>                23990000
<<                                                    >>                23995000
<<   i/o status interrogation completion              >>                24000000
<<                                                    >>                24005000
<<====================================================>>                24010000
                                                                        24015000
if cpva'status = one then              << status diagnosis          >>  24020000
   begin                                                                24025000
                                                                        24030000
   cpva'status := zero;                                                 24035000
                                                                        24040000
   if dit'dev'powerfail = one then                                      24045000
      begin                                                             24050000
                                                                        24055000
      cp'first'branch := enter'power'on;                                24060000
                                       << do the clear. unqueued    >>  24065000
                                       << startsio                  >>  24070000
      start'hpib(p'dit,siop,false);                                     24075000
      if > then                                                         24080000
         begin                         << exit with a sio error     >>  24085000
         log'status;                                                    24090000
         ioq'stat     := chan'pgm'failure;                              24095000
         update'xfer'cnt;                                               24100000
         driver'state := request'complete;                              24105000
                                                                        24110000
         return;                                                        24115000
         end; << of "if > then ..." >>                                  24120000
                                                                        24125000
      dit'immediate'mode := one;       << immediate reporting will  >>  24130000
                                       << be enabled.               >>  24135000
      ioq'waitcode       := cmpltion'wait;                              24140000
      driver'state       := interrupt'wait;                             24145000
                                                                        24150000
      return;                                                           24155000
      end; << of "if DIT'DEV'POWERFAIL = ONE ..." >>                    24160000
$page                                                                   24165000
                                       << update last status        >>  24170000
   if fcode = fc'req'last'stat then                                     24175000
      begin                                                             24180000
                                       << make word count           >>  24185000
      transfer'count := (transfer'count + 1d) / 2d;                     24190000
                                                                        24195000
      tos := bank'n'buff'addr;         << user's area               >>  24200000
      tos := zero;                     << describe area             >>  24205000
      tos := @p'dit + sysdb + dstatus;                                  24210000
      tos := integer(transfer'count);  << #words to move            >>  24215000
      assemble (mabs);                                                  24220000
                                                                        24225000
      ioq'stat     := good'io;         << exit with a good transfer >>  24230000
      ioq'count    := integer(transfer'count);                          24235000
      driver'state := request'complete;                                 24240000
                                                                        24245000
      return;                                                           24250000
      end; << of "if FCODE = FC'REQ'LAST'STAT ..." >>                   24255000
$page                                                                   24260000
   if ioq'diag then                    << diagnostic completion     >>  24265000
      begin                            << exit with a diag completio>>  24270000
      ioq'stat     := read'last'stat;                                   24275000
      update'xfer'cnt;                                                  24280000
      driver'state := request'complete;                                 24285000
                                                                        24290000
      return;                                                           24295000
      end; << of "if IOQ'DIAG then ..." >>                              24300000
$page                                                                   24305000
   if dit'uninit'media = one then                                       24310000
      begin                            << exit with un-init media   >>  24315000
      log'status;                                                       24320000
      ioq'stat     := uninit'media'err;                                 24325000
      update'xfer'cnt;                                                  24330000
      driver'state := request'complete;                                 24335000
                                                                        24340000
      return;                                                           24345000
      end; << of "if DIT'UNINIT'METIA = ONE ..." >>                     24350000
$page                                                                   24355000
   if dit'unit'attention <> %377 and                                    24360000
      dit'unit'attention <> %17  and                                    24365000
      dit'unit'attention <> zero then                                   24370000
                                                                        24375000
      begin                            << exit with a unit error    >>  24380000
      log'status;                                                       24385000
      ioq'stat     := unit'failure;                                     24390000
      update'xfer'cnt;                                                  24395000
      driver'state := request'complete;                                 24400000
                                                                        24405000
      return;                                                           24410000
      end; << of "if DIT'UNIT'ATTENTION <> %377 ..." >>                 24415000
$page                                                                   24420000
   if dit'chan'parity'err  = one or                                     24425000
      dit'ill'opcode       = one or                                     24430000
      dit'module'addr'one  = one or                                     24435000
      dit'parameter'bound  = one or                                     24440000
      dit'ill'parameter    = one or                                     24445000
      dit'ill'msg'seq      = one or                                     24450000
      dit'msg'length'err   = one or                                     24455000
                                                                        24460000
      dit'copy'err         = one or                                     24465000
      dit'controller'fault = one or                                     24470000
      dit'unit'fault       = one or                                     24475000
      dit'diag'fail        = one or                                     24480000
      dit'opr'rel'req      = one or                                     24485000
      dit'diag'rel'req     = one or                                     24490000
                                                                        24495000
      dit'ill'operation    = one or                                     24500000
      dit'no'data'found    = one or                                     24505000
      dit'end'of'file      = one then                                   24510000
                                                                        24515000
      if ioq'retry'count = retry'limit then                             24520000
                                       << reached the retry limit.  >>  24525000
         begin                         << exit with a unit error    >>  24530000
         log'status;                                                    24535000
         ioq'stat     := unit'failure;                                  24540000
         update'xfer'cnt;                                               24545000
         driver'state := request'complete;                              24550000
                                                                        24555000
         return;                                                        24560000
         end  << of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>           24565000
      else                                                              24570000
         begin                                                          24575000
         ioq'retry'count := ioq'retry'count + one;                      24580000
         if dit'ill'msg'seq = one and                                   24585000
            ioq'sys'pfail   = one then                                  24590000
                                                                        24595000
            goto retry'request                                          24600000
         else                                                           24605000
            begin                                                       24610000
            log'status;                                                 24615000
            goto retry'request;        << retry status              >>  24620000
            end; << of else "if DIT'ILL'MSG'SEQ = ONE ..." >>           24625000
         end; << of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>      24630000
$page                                                                   24635000
<<------------------------------------------------>>                    24640000
<<     drive was write protected                  >>                    24645000
<<------------------------------------------------>>                    24650000
                                                                        24655000
   if dit'write'protect = one then                                      24660000
      begin                                                             24665000
      ioq'unload'ring     := one;                                       24670000
      cp'diag'cmd'to'exec := wrt'cmd'sec;                               24675000
      cp'diag'cdb'length  := two;      << byte count                >>  24680000
      siop'byte(cdb'area'byte + 0 , cdb'set'unit);                      24685000
      siop'byte(cdb'area'byte + 1 , cdb'unload);                        24690000
      cp'first'branch     := enter'diag;                                24695000
                                                                        24700000
      if not iomessage(1,no'write'ring'msg,%10000,dit'ldev,             24705000
                           ,,,,console) then                            24710000
         begin                         << exit with a sys error     >>  24715000
         log'status;                                                    24720000
         ioq'stat     := system'error;                                  24725000
         update'xfer'cnt;                                               24730000
         driver'state := request'complete;                              24735000
                                                                        24740000
         return;                                                        24745000
         end; << of "if NOT IOMESSAGE(1,NO'WRITE'RING'MSG, ..." >>      24750000
                                                                        24755000
      p'cpva := zero;                  << clear channel status word >>  24760000
      start'hpib(p'dit,siop,true);                                      24765000
      if > then                                                         24770000
         begin                         << exit with a sio error     >>  24775000
         log'status;                                                    24780000
         ioq'stat     := chan'pgm'failure;                              24785000
         update'xfer'cnt;                                               24790000
         driver'state := request'complete;                              24795000
                                                                        24800000
         return;                                                        24805000
         end; << of "if > then ..." >>                                  24810000
                                                                        24815000
      ioq'waitcode := cmpltion'wait;                                    24820000
      driver'state := interrupt'wait;                                   24825000
                                                                        24830000
      return;                                                           24835000
      end; << of "if DIT'WRITE'PROTECT = ONE ..." >>                    24840000
$page                                                                   24845000
   if dit'retransmit = one then                                         24850000
      if ioq'retry'count = retry'limit then                             24855000
                                       << reach the retry limit.    >>  24860000
         begin                         << exit with a unit error    >>  24865000
         log'status;                                                    24870000
         ioq'stat     := unit'failure;                                  24875000
         update'xfer'cnt;                                               24880000
         driver'state := request'complete;                              24885000
                                                                        24890000
         return;                                                        24895000
         end << of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>            24900000
      else                                                              24905000
         begin                                                          24910000
         ioq'retry'count := ioq'retry'count + one;                      24915000
         goto retry'request;                                            24920000
         end; << of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>      24925000
$page                                                                   24930000
   if dit'spare'unavail = one then                                      24935000
      begin                            << exit with a no spare err  >>  24940000
      log'status;                                                       24945000
      ioq'stat     := no'spare'err;                                     24950000
      update'xfer'cnt;                                                  24955000
      driver'state := request'complete;                                 24960000
                                                                        24965000
      return;                                                           24970000
      end; << of "if DIT'SPARE'UNAVAIL = ONE ..." >>                    24975000
$page                                                                   24980000
   if dit'addr'bounds   = one or                                        24985000
      dit'end'of'volume = one then                                      24990000
                                                                        24995000
      begin                            << exit with a invalid addr  >>  25000000
      log'status;                                                       25005000
      ioq'stat     := invalid'addr;                                     25010000
      update'xfer'cnt;                                                  25015000
      driver'state := request'complete;                                 25020000
                                                                        25025000
      return;                                                           25030000
      end; << of "if DIT'ADDR'BOUNDS = ONE ..." >>                      25035000
$page                                                                   25040000
<<---------------------------------------------------->>                25045000
<<   release request/required handling:               >>                25050000
<<---------------------------------------------------->>                25055000
                                                                        25060000
   if dit'int'maint'req   = one or                                      25065000
      dit'i'opr'rel'req   = one or                                      25070000
      dit'i'diag'rel'req  = one or                                      25075000
      dit'i'int'maint'req = one then                                    25080000
                                                                        25085000
      begin                                                             25090000
      if fcode            = fc'loc'n'verify and                         25095000
         dit'unrecov'data = one then                                    25100000
                                                                        25105000
         begin                                                          25110000
                                       << return the bad block addr >>  25115000
         tos := bank'n'buff'addr;                                       25120000
         tos := dit'parm'field1;       << bad blk address           >>  25125000
         tos := dit'parm'field2;                                        25130000
         assemble (sdea);                                               25135000
                                                                        25140000
         dit'bad'transfer := zero;                                      25145000
         ioq'verify'err   := one;                                       25150000
         END; << Of 'if FCODE = FC'LOC'N'VERIFY ..." >>                 25155000
                                                                        25160000
      cp'diag'cmd'to'exec := wrt'cmd'sec;                               25165000
      cp'diag'cdb'length  := two;      << cdb byte count            >>  25170000
      siop'byte(cdb'area'byte + 0 , cdb'set'unit + ctrl'unit);          25175000
                                                                        25180000
      siop'byte(cdb'area'byte + 1 ,                                     25185000
         if dit'int'maint'req   =  one or                               25190000
            dit'i'int'maint'req =  one or                               25195000
            dit'i'opr'rel'req   =  one and                              25200000
            dit'dev'not'rdy     =  one or                               25205000
            dit'i'opr'rel'req   =  one and                              25210000
            dit'lock'flg        <> one then                             25215000
               cdb'release                                              25220000
         else                                                           25225000
               cdb'release'deny);                                       25230000
                                                                        25235000
      if dit'i'opr'rel'req = one then                                   25240000
         ioq'oper'req := one;                                           25245000
                                                                        25250000
      if dit'i'int'maint'req = one then                                 25255000
         ioq'im'fault := one;                                           25260000
                                                                        25265000
      if dit'dev'not'rdy = one then                                     25270000
         ioq'media'load := one;                                         25275000
                                                                        25280000
      cp'first'branch := enter'diag;   << schedule release          >>  25285000
      start'hpib(p'dit,siop,true);     << or release deny           >>  25290000
      if > then                                                         25295000
         begin                         << exit with a sio error     >>  25300000
         ioq'stat     := chan'pgm'failure;                              25305000
         log'status;                                                    25310000
         update'xfer'cnt;                                               25315000
         driver'state := request'complete;                              25320000
                                                                        25325000
         return;                                                        25330000
         end; << of "if > then ..." >>                                  25335000
                                                                        25340000
      ioq'waitcode := rel'wait;                                         25345000
      driver'state := interrupt'wait;                                   25350000
                                                                        25355000
      return;                                                           25360000
      end; << of "if DIT'INT'MAINT'REQ = ONE ..." >>                    25365000
$page                                                                   25370000
<<---------------------------------------------------->>                25375000
<<   drive not ready - schedule idle cp until ready   >>                25380000
<<---------------------------------------------------->>                25385000
                                                                        25390000
   if dit'dev'not'rdy = one          or                                 25395000
      p'cpva          = cpva'timeout then                               25400000
                                                                        25405000
                                       << inform user-notrdy        >>  25410000
      if fcode = fc'req'last'stat then                                  25415000
         begin                                                          25420000
                                       << make word count           >>  25425000
         transfer'count := (transfer'count + 1d) / 2d;                  25430000
                                                                        25435000
         tos := bank'n'buff'addr;      << user's area               >>  25440000
         tos := zero;                  << describe area             >>  25445000
         tos := @p'dit + sysdb + dstatus;                               25450000
         tos := integer(transfer'count); << #words to move          >>  25455000
         assemble (mabs);                                               25460000
                                                                        25465000
         ioq'stat     := timeout'error;                        <<f9010>>25470000
         ioq'count    := integer(transfer'count);                       25475000
         driver'state := request'complete;                              25480000
         p'cpva       := 0;                                    <<f9010>>25485000
         cpva'status  := 0;                                    <<f9010>>25490000
                                                                        25495000
         return;                                                        25500000
         end  << of "if FCODE = FC'REQ'LAST'STAT ..." >>                25505000
      else                                                              25510000
         begin                                                          25515000
         ioq'waitcode    := not'rdy'wait;                               25520000
                                       << schedule idle wait cp     >>  25525000
         cp'first'branch := enter'idle'wait;                            25530000
                                                                        25535000
         if system'up then                                              25540000
            ldevnotrdy(p'dit);         << not rdy msg to console    >>  25545000
                                                                        25550000
         start'hpib(p'dit,siop(firstbranch),true);             <<f9010>>25555000
         if > then                                                      25560000
            begin                      << exit with a sio error     >>  25565000
            log'status;                                                 25570000
            ioq'stat     := chan'pgm'failure;                           25575000
            update'xfer'cnt;                                            25580000
            driver'state := request'complete;                           25585000
                                                                        25590000
            return;                                                     25595000
            end; << of "if > then ..." >>                               25600000
                                                                        25605000
         driver'state := not'ready;                                     25610000
                                                                        25615000
         return;                                                        25620000
         end; << of else "if FCODE = FC'REQ'LAST'STAT ..." >>           25625000
$page                                                                   25630000
<<---------------------------------------------------->>                25635000
<<   data not recoverable                             >>                25640000
<<---------------------------------------------------->>                25645000
                                                                        25650000
   if dit'data'overflow = one or                                        25655000
      dit'unrecov'data  = one then                                      25660000
                                                                        25665000
      begin                                                             25670000
      dit'addr1'bad'block := dit'parm'field1; << bad blk address    >>  25675000
      dit'addr2'bad'block := dit'parm'field2;                           25680000
                                          << xfer left             >>   25685000
      dit'bad'transfer    := cp'dxfer'data'size;                        25690000
                                                                        25695000
      if fcode = fc'loc'n'verify then  << verify function           >>  25700000
         begin                                                          25705000
                                       << return bad sector addr    >>  25710000
         tos := bank'n'buff'addr;                                       25715000
         tos := dp'dit(dbadblk1);                                       25720000
         assemble (sdea);                                               25725000
         end;                                                           25730000
                                       << exit with a trk sct err   >>  25735000
      log'status;                                                       25740000
      ioq'stat     := track'sect'error;                                 25745000
      update'xfer'cnt;                                                  25750000
      driver'state := request'complete;                                 25755000
                                                                        25760000
      return;                                                           25765000
      end;                                                              25770000
$page                                                                   25775000
<<---------------------------------------------------->>                25780000
<<   log informational status                         >>                25785000
<<---------------------------------------------------->>                25790000
                                                                        25795000
   if dit'media'wear'out   = one or                                     25800000
      dit'defect'blk'spare = one or                                     25805000
      dit'marginal'data    = one or                                     25810000
      dit'no'data'overflow = one or                                     25815000
      dit'recov'data       = one or                                     25820000
      dit'maint'track      = one then                                   25825000
                                                                        25830000
      log'status;                                                       25835000
$page                                                                   25840000
<<---------------------------------------------------->>                25845000
<<   maintenance trk ov - schedule logging process    >>                25850000
<<---------------------------------------------------->>                25855000
                                                                        25860000
   if dit'maint'track = one then                                        25865000
      maint'request(dit'ldev,type'buffalo,lpdt'subtype);                25870000
                                                                        25875000
   end; << of 'if cpva'status = one...' >>                              25880000
$page                                                                   25885000
<<====================================================>>                25890000
<<                                                    >>                25895000
<<   power on completion                              >>                25900000
<<                                                    >>                25905000
<<====================================================>>                25910000
                                                                        25915000
if cpva'status = two then              << pon - redo ioq            >>  25920000
   begin                                                                25925000
   cpva'status := zero;                                                 25930000
   if ioq'diag then                    << diag request              >>  25935000
      begin                            << exit with a power on statu>>  25940000
      ioq'stat     := dev'power'on;                                     25945000
      update'xfer'cnt;                                                  25950000
      driver'state := request'complete;                                 25955000
                                                                        25960000
      return;                                                           25965000
      end << of "if IOQ'DIAG then ..." >>                               25970000
   else if ioq'retry'count = retry'limit then                           25975000
      begin                            << exit with a power on statu>>  25980000
      ioq'stat     := dev'power'on;                                     25985000
      update'xfer'cnt;                                                  25990000
      driver'state := request'complete;                                 25995000
                                                                        26000000
      return;                                                           26005000
      end << of "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>               26010000
   else                                                                 26015000
      begin                                                             26020000
      ioq'retry'count := ioq'retry'count + one;                         26025000
      goto retry'request;                                               26030000
      end; << of else "if IOQ'RETRY'COUNT = RETRY'LIMIT ..." >>         26035000
   end;                                                                 26040000
$page                                                                   26045000
<<====================================================>>                26050000
<<                                                    >>                26055000
<<   problem interrogating status                     >>                26060000
<<                                                    >>                26065000
<<====================================================>>                26070000
                                                                        26075000
if cpva'status = three then            << retry once                >>  26080000
   begin                                                                26085000
   cpva'status := zero;                                                 26090000
   if ioq'rstat'fail = one then                                         26095000
                                       << retry failed              >>  26100000
      begin                            << exit with a unit error    >>  26105000
      log'status;                                                       26110000
      ioq'stat     := unit'failure;                                     26115000
      update'xfer'cnt;                                                  26120000
      driver'state := request'complete;                                 26125000
                                                                        26130000
      return;                                                           26135000
      end; << of "if IOQ'RSTAT'FAIL = ONE ..." >>                       26140000
                                                                        26145000
   ioq'rstat'fail  := one;                                              26150000
   cp'first'branch := enter'stat'req;  << retry read status        >>   26155000
   start'hpib(p'dit,siop,true);                                         26160000
   if > then                                                            26165000
      begin                            << exit with a sio error     >>  26170000
      log'status;                                                       26175000
      ioq'stat     := chan'pgm'failure;                                 26180000
      update'xfer'cnt;                                                  26185000
      driver'state := request'complete;                                 26190000
                                                                        26195000
      return;                                                           26200000
      end; << of "if > then ..." >>                                     26205000
                                                                        26210000
   driver'state := interrupt'wait;                                      26215000
                                                                        26220000
   return;                                                              26225000
   end; << of "if CPVA'STATUS = THREE ..." >>                           26230000
$page                                                                   26235000
<<====================================================>>                26240000
<<                                                    >>                26245000
<<   power on during the idle channel program         >>                26250000
<<                                                    >>                26255000
<<====================================================>>                26260000
                                                                        26265000
if cpva'status = four then             << issue dev clr             >>  26270000
   begin                                                                26275000
   cpva'status     := zero;                                             26280000
   cp'first'branch := enter'power'on;                                   26285000
                                       << do the clear. unqueued    >>  26290000
                                       << startsio                  >>  26295000
   start'hpib(p'dit,siop,false);                                        26300000
   if > then                                                            26305000
      begin                            << exit with a sio error     >>  26310000
      log'status;                                                       26315000
      ioq'stat     := chan'pgm'failure;                                 26320000
      update'xfer'cnt;                                                  26325000
      driver'state := request'complete;                                 26330000
                                                                        26335000
      return;                                                           26340000
      end; << of "if > then ..." >>                                     26345000
                                                                        26350000
   dit'immediate'mode := one;          << immediate reporting will  >>  26355000
                                       << be enabled.               >>  26360000
   ioq'waitcode       := cmpltion'wait;                                 26365000
   driver'state       := interrupt'wait;                                26370000
                                                                        26375000
   return;                                                              26380000
   end; << of "if CPVA'STATUS = FOUR ..." >>                            26385000
$page                                                                   26390000
<<====================================================>>                26395000
<<                                                    >>                26400000
<<       clear due to ioq abort completion            >>                26405000
<<                                                    >>                26410000
<<====================================================>>                26415000
                                                                        26420000
if ioq'waitcode = abort'ioq'wait then                                   26425000
   begin                               << exit with a good transfer >>  26430000
   ioq'stat     := good'io;                                             26435000
   update'xfer'cnt;                                                     26440000
   driver'state := request'complete;                                    26445000
                                                                        26450000
   return;                                                              26455000
   end; << of "if IOQ'WAITCODE = ABORT'IOQ'WAIT ..." >>                 26460000
$page                                                                   26465000
<<====================================================>>                26470000
<<                                                    >>                26475000
<<   not ready completion                             >>                26480000
<<                                                    >>                26485000
<<====================================================>>                26490000
                                                                        26495000
if ioq'waitcode = not'rdy'wait then                                     26500000
   goto retry'request;                                                  26505000
$page                                                                   26510000
<<====================================================>>                26515000
<<                                                    >>                26520000
<<   release/release denied completion                >>                26525000
<<                                                    >>                26530000
<<====================================================>>                26535000
                                                                        26540000
if ioq'waitcode = rel'wait then                                         26545000
   begin                                                                26550000
   if ioq'oper'req   =  one land                                        26555000
      ioq'media'load <> one land                                        26560000
      dit'lock'flg   =  one then                                        26565000
                                                                        26570000
      begin                                                             26575000
      if not iomessage(1,nsys'deny'msg,%10000,                          26580000
         dit'ldev,,,,,console) then                                     26585000
                                                                        26590000
         begin                         << exit with a sys error     >>  26595000
         log'status;                                                    26600000
         ioq'stat     := system'error;                                  26605000
         update'xfer'cnt;                                               26610000
         driver'state := request'complete;                              26615000
                                                                        26620000
         return;                                                        26625000
         end;                                                           26630000
      end; << of "if IOQ'OPER'REQ = ONE ..." >>                         26635000
                                                                        26640000
   if (fcode = fc'init'media    or                                      26645000
       fcode = fc'loc'n'verify) and                                     26650000
      ioq'im'fault <> one       then                                    26655000
                                                                        26660000
      begin                                                             26665000
      if fcode          = fc'loc'n'verify and                           26670000
         ioq'verify'err = one             then                          26675000
                                                                        26680000
         begin                         << exit with a trk sct error >>  26685000
         log'status;                                                    26690000
         ioq'stat     := track'sect'error;                              26695000
         update'xfer'cnt;                                               26700000
         driver'state := request'complete;                              26705000
                                                                        26710000
         return;                                                        26715000
         end << of "if FCODE = FC'LOC'N'VERIFY ..." >>                  26720000
      else                                                              26725000
         begin                         << exit with a good transfer >>  26730000
         ioq'stat     := good'io;                                       26735000
         update'xfer'cnt;                                               26740000
         driver'state := request'complete;                              26745000
                                                                        26750000
         return;                                                        26755000
         end; << of else "if FCODE = FC'LOC'N'VERIFY ..." >>            26760000
      end; << of "if (FCODE = FC'INIT'MEDIA ..." >>                     26765000
                                                                        26770000
   goto retry'request;                                                  26775000
   end; << of "if IOQ'WAITCODE = REL'WAIT ..." >>                       26780000
$page                                                                   26785000
<<====================================================>>                26790000
<<                                                    >>                26795000
<<           no write ring completion                 >>                26800000
<<                                                    >>                26805000
<<====================================================>>                26810000
                                                                        26815000
                                                                        26820000
if ioq'unload'ring <> zero then                                         26825000
   begin                                                                26830000
   ioq'unload'ring := zero;                                             26835000
   ioq'stat        := write'ring'wait;                                  26840000
   driver'state    := opintrvnwait;                                     26845000
                                                                        26850000
   return                                                               26855000
   end; << of "if IOQ'UNLOAD'RING <> ZERO ..." >>                       26860000
$page                                                                   26865000
<<====================================================>>                26870000
<<                                                    >>                26875000
<<   driver/firmware synchronization completion       >>                26880000
<<                                                    >>                26885000
<<====================================================>>                26890000
                                                                        26895000
if ioq'waitcode = sync'wait then                                        26900000
   goto retry'request;                                                  26905000
$page                                                                   26910000
<<====================================================>>                26915000
<<                                                    >>                26920000
<<   function dependencies completion                 >>                26925000
<<                                                    >>                26930000
<<====================================================>>                26935000
                                                                        26940000
<<---------------------------------------------------->>                26945000
<<   return the device status.                        >>                26950000
<<---------------------------------------------------->>                26955000
                                                                        26960000
if fcode = fc'req'last'stat then                                        26965000
   begin                                                                26970000
                                       << make word count           >>  26975000
   transfer'count := (transfer'count + 1d) / 2d;                        26980000
                                                                        26985000
   tos := bank'n'buff'addr;            << user's area               >>  26990000
   tos := zero;                        << describe area             >>  26995000
   tos := @p'dit + sysdb + dstatus;                                     27000000
   tos := integer(transfer'count);     << #words to move            >>  27005000
   assemble (mabs);                                                     27010000
                                                                        27015000
   ioq'stat     := good'io;            << exit with a good transfer >>  27020000
   ioq'count    := integer(transfer'count);                             27025000
   driver'state := request'complete;                                    27030000
                                                                        27035000
   return;                                                              27040000
   end; << of "if FCODE = FC'REQ'LAST'STAT ..." >>                      27045000
$page                                                                   27050000
<<---------------------------------------------------->>                27055000
<<   return the volume limit.                         >>                27060000
<<---------------------------------------------------->>                27065000
                                                                        27070000
if fcode = fc'req'vol'limit then                                        27075000
   begin                                                                27080000
                                       << return the volume limit   >>  27085000
   tos := bank'n'buff'addr;                                             27090000
   tos := siop(volume'limit + 1);      << volume limit              >>  27095000
   tos := siop(volume'limit + two);                                     27100000
   assemble (sdea);                    << store dbl word            >>  27105000
                                                                        27110000
                                       << exit with a good transfer >>  27115000
   ioq'stat     := good'io;                                             27120000
   ioq'count    := two;                                                 27125000
   driver'state := request'complete;                                    27130000
                                                                        27135000
   return;                                                              27140000
   end; << of "if FCODE = FC'REQ'VOL'LIMIT ..." >>                      27145000
$page                                                                   27150000
<<---------------------------------------------------->>                27155000
<<   return the hp-ib identify code                   >>                27160000
<<---------------------------------------------------->>                27165000
                                                                        27170000
if fcode = fc'identify then                                             27175000
   begin                                                                27180000
                                       << return the device's id    >>  27185000
   tos := bank'n'buff'addr;                                             27190000
   tos := cp'ident'hpib'id;            << device id                 >>  27195000
   assemble(ssea);                                                      27200000
                                                                        27205000
                                       << exit with a good transfer >>  27210000
   ioq'stat     := good'io;                                             27215000
   ioq'count    := one;                                                 27220000
   driver'state := request'complete;                                    27225000
                                                                        27230000
   return;                                                              27235000
   end; << of "if FCODE = FC'IDENTIFY ..." >>                           27240000
$page                                                                   27245000
<<---------------------------------------------------->>                27250000
<<   return good status that parity was set.          >>                27255000
<<---------------------------------------------------->>                27260000
                                                                        27265000
if fcode = fc'parity'check then                                         27270000
   begin                                                                27275000
                                                                        27280000
   cp'diag'wait'5 := wait'instr;       << reset the wait instr.     >>  27285000
   cp'diag'wait'6 := zero;                                              27290000
                                                                        27295000
   ioq'stat       := good'io;          << exit with a good transfer >>  27300000
   ioq'count      := one;                                               27305000
   driver'state   := request'complete;                                  27310000
                                                                        27315000
   return;                                                              27320000
   end; << of "if FCODE = FC'IDENTIFY ..." >>                           27325000
$page                                                                   27330000
if fcode = fc'unload'cart    or                                         27335000
   fcode = fc'init'selftest  or                                         27340000
   fcode = fc'release        or                                         27345000
   fcode = fc'release'denied or                                         27350000
   fcode = fc'set'release    or                                         27355000
   fcode = fc'set'address    or                                         27360000
   fcode = fc'spare'block    or                                         27365000
   fcode = fc'device'clear   or                                         27370000
   fcode = fc'cancel'tran    then                                       27375000
                                                                        27380000
   begin                                                                27385000
                                       << exit with a good transfer >>  27390000
   ioq'stat     := good'io;                                             27395000
   ioq'count    := zero;                                                27400000
   driver'state := request'complete;                                    27405000
                                                                        27410000
   return;                                                              27415000
   end  << of "if FCODE = FC'INIT'SELFTEST ..." >>                      27420000
else                                                                    27425000
   begin                                                                27430000
                                       << exit with a good transfer >>  27435000
   ioq'stat     := good'io;                                             27440000
   update'xfer'cnt;                                                     27445000
   driver'state := request'complete;                                    27450000
                                                                        27455000
   return;                                                              27460000
   end; << of else "if FCODE = FC'INIT'SELFTEST ..." >>                 27465000
                                                                        27470000
end; << of the cs'80 disc driver >>                                     27475000
$page                                                                   27480000
assemble(                                                               27485000
   pcal siodm;          << monitor               >>                     27490000
   pcal buffalo'driver; << initiator             >>                     27495000
   pcal buffalo'driver; << completor             >>                     27500000
   con  zero;           << no i/o process        >>                     27505000
   pcal buffalo'init;   << initialization        >>                     27510000
   con  one;            << one interrupt handler >>                     27515000
   pcal gip'hpib);      << interrupt handler     >>                     27520000
end.                                                                    27525000
