$CONTROL MAP,CODE,USLINIT                                               00010000
  <<   HIOLPRT0, MODULE 36 - HP2608 LP DRIVER HPIB   >>                 00015000
<< HP32002C MPE SOURCE C.00.00 >>                                       00020000
<< COPYRIGHT     "(C) COPYRIGHT HEWLETT-PACKARD CO. 1980.           >>  00025000
<<     THIS PROGRAM MAY BE USED WITH ONE COMPUTER SYSTEM AT A       >>  00030000
<<     TIME AND SHALL NOT OTHERWISE BE RECORDED, TRANSMITTED OR     >>  00035000
<<     STORED IN A RETRIEVAL SYSTEM.  COPYING OR OTHER REPRODUCTION >>  00040000
<<     OF THIS PROGRAM EXCEPT FOR ARCHIVAL PURPOSES IS PROHIBITED   >>  00045000
<<     WITHOUT THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY.>>  00050000
<< **** Note - Dollar Copyright cannot be used with this module *** >>  00055000
$CONTROL USLINIT,MAP,CODE                                               00060000
$TITLE "HP2608 LINE PRINTER DRIVER - HPIB"                              00065000
$CONTROL PRIVILEGED,UNCALLABLE                                          00070000
$TP                                                                     00075000
<< INITIAL MPEV INCL5 PROGRAM. DAVID SM CHANG   3-14-1983      <<06721>>00080000
COMMENT                                                        <<06721>>00085000
                                                                        00090000
        HP2608 [HP3000-HPIB] Line Printer Driver - HIOLPRT0             00095000
        ---------------------------------------------------             00100000
                                                                        00105000
                                                                        00110000
Structure of HIOLPRT0:                                                  00115000
                                                                        00120000
HIOLPRT0, together with the SIO Device Monitor (SIODM) constitute a     00125000
standard MPE Type 1 I/O Driver/Monitor.  This means that it does not    00130000
run in its own process, but executes on any stack and therefore must    00135000
run to completion.  During initialization it executes on PROGEN's       00140000
stack, during request initiation it executes on ATTACHIO's stack, and   00145000
during interrupt processing it executes on the Interrupt Control        00150000
Stack (ICS).                                                            00155000
                                                                        00160000
HIOLPRT0 consists of a global area, two procedures, and an "outer       00165000
block" which is really a linkage area for INITIAL.  The global area     00170000
contains an array called INITIAL which is comprised of three parts.     00175000
The first part specifies the size of the other two, the unit extract    00180000
instruction, and various parameters which are used by INITIAL.  This    00185000
section is deleted after INITIAL is through with it.  The other two     00190000
parts are the Device Information Table (DIT) and the Channel Program    00195000
area, which is part of the Interrupt Linkage Table (ILT).  INITIAL      00200000
will put each of these items in the area of memory where it belongs.    00205000
The linkage area specifies the procedure labels (P-labels) of the       00210000
associated monitor (SIODM), the request initiator (LPDRVR), the         00215000
request completor (LPDRVR), the initialization procedure (LPINIT,       00220000
called by PROGEN at system startup), and the interrupt handler (GIP).   00225000
                                                                        00230000
                                                                        00235000
Operation of HIOLPRT0:                                                  00240000
                                                                        00245000
The primary working code of HIOLPRT0 is a procedure LPDRVR.  LPDRVR is  00250000
called with five parameters.  Two of these parameters, BANK and         00255000
BUFFADDR, are the absolute buffer address of the data to be processed.  00260000
The other three, DITP, IOQP, and SIOP are pointers to three arrays.     00265000
DITP is a pointer to the Device Information Table which contains        00270000
information about its associated line printer.  There is one DIT for    00275000
unit on the controller and they contain information which must be       00280000
saved between I/O requests to the driver.  IOQP is a pointer to the     00285000
Input/Output Queue element.  IOQ elements contain information relevent  00290000
to the current request.  SIOP is a pointer to the first element of the  00295000
Channel Program which is actually part of the Interrupt Linkage Table.  00300000
These three elements are described in more detail elsewhere in this     00305000
listing.                                                                00310000
                                                                        00315000
LPDRVR is always called by the SIO device monitor (SIODM) and it        00320000
determines the reason for the call by examining the IOQ and the DIT.    00325000
When a new request is initiated, LPDRVR examines the function code      00330000
and parameter fields contained in the IOQ element to determine the      00335000
task that is desired.  The proper command codes and program branches    00340000
are then placed in the Channel Program and its execution is begun.      00345000
                                                                        00350000
Upon completion of the request, an interrupt is generated and LPDRVR    00355000
is again called.  The code checks for current activity in progress,     00360000
and this being the case, branches to the completion section of the      00365000
driver.  Here several status words are exaimed for errors or special    00370000
conditions which might have occurred during the execution of the        00375000
Channel Program, during the data transfer, or during the operation of   00380000
the line printer.  These conditions can cause error retries and/or      00385000
special notation back to the caller.  A list of the conditions and      00390000
the return codes is provided in this listing.                           00395000
$PAGE                                                                   00400000
                Device Information Table (DIT)                          00405000
                ------------------------------                          00410000
                                                                        00415000
                                                                        00420000
There is one DIT per physical device.  If a physical device represents  00425000
more than one logical device, the logical device number is obtained     00430000
from the IOQ element (however, there is only one device per 2608        00435000
controller.)  The following diagram shows the DIT used for the          00440000
2608 line printer driver.                                               00445000
                                                                        00450000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          00455000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    00460000
  0| 0| 0|AC|RQ| 0| 0| 0|IO|IA|NO|ST| 0|   STATE   |   DFLAG            00465000
   +--+--+--+--+--+--+--+--+--+--+--+--+-----------+                    00470000
  1| SYSDB relative pointer to the DIT for the next|   DLINK            00475000
   | device requesting this resource or service    |                    00480000
   +-----------------------------------------------+                    00485000
  2| SYSDB relative pointer to the first IOQ in    |   DIOQP            00490000
   | request list for this device                  |                    00495000
   +--------+--------------+-----------------------+                    00500000
  3|          Logical device number                |   DLDEV   <<06721>>00505000
   +--------+--------------+-----------------------+                    00510000
  4| SYSDB relative pointer to Device Linkage Table|   DDLTP            00515000
   +-----------------------------------------------+                    00520000
  5| SYSDB relative pntr to Interrupt Linkage Table|   DILTP            00525000
   +-----------------------------------------------+                    00530000
  6|VM|     |    TAB    |                 |PS|FL|TP|   DSAVE            00535000
   +-----------------------------------------------+                    00540000
  7| Hardware error pointer. Set when the driver   |   DSERR            00545000
   | detects an error.  Whenever <>0, the driver   |                    00550000
   | monitor logs an I/O error and clears this word|                    00555000
   +--+-----+-----------+-----------------+--+--+--+                    00560000
%10| Bit 0 is set at completion of timer           |   DTIME            00565000
   +--+-----+-----------+-----------------+--+--+--+                    00570000
%11| Interrupt status for this unit.  Set by the   |   DSTAT   <<06721>>00575000
   | driver each time it processes an interrupt.   |           <<06721>>00580000
   | a timer is active.                            |           <<06721>>00585000
   +-----------------------------------------------+                    00590000
%12|IOT  |    Physical device unit                 |   DUNIT   <<06721>>00595000
   +-----------------------------------------------+                    00600000
%13|          Hardware logged error status         | DLOGERROR <<06721>>00605000
   +-----------------------------------------------+           <<06721>>00610000
%14|          Hardware logged error status+1       |DLOGERROR+1<<06721>>00615000
   +-----------------------------------------------+           <<06721>>00620000
%15| Holds the time out request entry index while  |   DRQST   <<06721>>00625000
   | a time is active.                             |           <<06721>>00630000
   +-----------------------------------------------+           <<06721>>00635000
                                                                        00640000
                                                                        00645000
DFLAG - Flags and request state                                         00650000
  AC  ACTIVE  - A monitor is currently servicing this device.           00655000
  RQ  REQUEST - A service request is pending while the monitor is       00660000
                active.                                                 00665000
  IO  IOPROG  - An I/O Channel Program is running for this device.      00670000
  IA  IAK     - An interrupt or response has occurred for this device.  00675000
  NO  NOTRDY  - Go to state %10 after Idle Channel Program is started.  00680000
  ST  STWAIT  - The device monitor is starting an Idle Channel Program  00685000
                for this device.  There is no IOQ associated with this  00690000
                type of request.                                        00695000
  STATE       - State of the device monitor.  Specifies the next action 00700000
                to be taken in SIODM in servicing the request:          00705000
                  0 - start new request                                 00710000
                  1 - not used                                          00715000
                  2 - call driver initiator procedure                   00720000
                  3 - call driver completor procedure                   00725000
                  4 - not used                                          00730000
                  5 - process request completed                         00735000
                  6 - initiate device recognition sequence              00740000
                  7 - start operator intervention wait                  00745000
                %10 - wait for interrupt (operator intervention)        00750000
                      restart at state 0                                00755000
                %11 - wait for data segment freeze, then state 2        00760000
                %12 - wait for driver initiator to be frozen, then      00765000
                      allocate controller (state 2)                     00770000
                %13 - wait for I/O completion interrupt, then state 3   00775000
                %14 - wait for controller, then call driver initiator   00780000
                %15 - not used                                          00785000
                %16 - wait for initiator make present, then state 2     00790000
                %17 - wait for completor make present, then state 3     00795000
                                                                        00800000
DLDEV - I/O system type, unit and logical device number                 00805000
  IOT I/O TYPE- Type of I/O system                                      00810000
                0 - HP3000 Series II/III                                00815000
                1 - HP3000 Series 33 (HP-IB)                            00820000
                2 - unused                                              00825000
                3 - unsused                                             00830000
                                                                        00835000
DSAVE - Device processing flags                                         00840000
  VM   VFCMOD    - VFC has been modified.                               00845000
  TAB  TABDFAULT - System tab default.                                  00850000
  PS   PRESPACE  - Last request used prespacing.                        00855000
  FL   FULL      - Line printer buffer is full.                         00860000
  TP   TOP       - Printer is at top of form                            00865000
                                                                        00870000
                                                                        00875000
2608 Line Printer Status                                                00880000
------------------------                                                00885000
                                                                        00890000
  BYTE 1 & BYTE 2:                                                      00895000
  BITS         USE                                                      00900000
                                                                        00905000
    0     ON LINE                                                       00910000
                                                                        00915000
    1     NOT READY                                                     00920000
    2     VFC CHANNEL 9 (BOTTOM OF FORM)                                00925000
    3     VFC CHANNEL 12 (TOP OF FORM)                                  00930000
                                                                        00935000
    4     VFC INITIALIZED                                               00940000
    5     6/8 LINES PER INCH                                            00945000
    6     (NOT USED)                                                    00950000
                                                                        00955000
    7     POWER RESTORED/UNIT RESET                                     00960000
    8     ON LINE                                                       00965000
    9     PRINT MECH ERROR                                              00970000
                                                                        00975000
   10     SELF TEST FAILURE                                             00980000
   11     PAPER ERROR                                                   00985000
   12     SELF TEST MODE                                                00990000
                                                                        00995000
   13     6/8 LPI                                                       01000000
   14     PLATEN/RIBBON ERROR                                           01005000
   15     (NOT USED)                                                    01010000
                                                                        01015000
  BYTE  3:  PRINT MODE                                                  01020000
            BITS 0-7  MODE NUMBER                                       01025000
  BYTE  4:  PRIMARY/SECONDARY                                           01030000
            BITS 0-3  SECONDARY CHARACTER SET CODE                      01035000
            BITS 4-7  PRIMARY CHARACTER SET CODE                        01040000
  BYTE  5:  SELF TEST                                                   01045000
            BITS 0    PASS FAIL                                         01050000
            BITS 1-7  SUBTEST NUMBER                                    01055000
  BYTE  6:  6 LPI DOT ROW COUNT                                         01060000
  BYTE  7:  6 LPI FORM LINE NUMBER                                      01065000
  BYTE  8:  6 LPI FORM LENGTH IN LINES                                  01070000
  BYTE  9:  8 LPI DOT ROW COUNT                                         01075000
  BYTE 10:  8 LPI FORM LINE NUMBER                                      01080000
  BYTE 11:  8 LPI FORM LENGTH IN LINES                                  01085000
  BYTE 12:  FIRMWARE IDENTIFICATION CODE                                01090000
  BYTE 20:  POWER-UP LANGUAGE                                           01095000
            BITS 0-3  SECONDARY CHARACTER SET CODE                      01100000
            BITS 4-7  PRIMARY CHARACTER SET CODE                        01105000
                                                                        01110000
$PAGE                                                                   01115000
                Interrupt Linkage Table (ILT)                           01120000
                -----------------------------                           01125000
                                                                        01130000
                                                                        01135000
There is one ILT for each device controller configured on the system.   01140000
A controller may support more than one unit, however the 2608 controller01145000
only supports one unit.                                                 01150000
                                                                        01155000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01160000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01165000
  0|         Channel                               |   ICPVA0           01170000
  1|              Program                          |   ICPVA1           01175000
  2|                  Variable                     |   ICPVA2           01180000
  3|                       Area (ICPVA)            |   ICPVA3           01185000
   +-----------------------------------------------+                    01190000
  4|         DMA Abort                             |   ICPVA4           01195000
  5|              Address                          |   ICPVA5           01200000
   +-----------------------------------------------+                    01205000
  6|                      0                        |   ISRQL            01210000
   +--+-----------------+-----+-----------+--------+                    01215000
  7|LI|     CHANQUE     |     |   CHAN    |  DEV   |   ICNTRL           01220000
   +--+-----------------+-----+-----------+--------+                    01225000
%10| SYSDB relative pointer to Channel Program area|   ISIOP            01230000
   +-----------------------------------------------+                    01235000
%11| SYSDB relative pointer to Status Return area. |   ISTAP            01240000
   | (The 2608 driver does not use the Status      |                    01245000
   |  Return area so this entry is 0.)             |                    01250000
   +-----------------------------------------------+                    01255000
%12| single instruction that is executed to extract|   IUNIT            01260000
   | the device unit number from the status pointed|                    01265000
   | to by ISTAP.  (Since there is only one unit   |                    01270000
   | on the controller, this entry is not used.)   |                    01275000
   +-----------------------------------------------+                    01280000
%13| SYSDB relative DIT pointer of the device      |   ICDP             01285000
   | currently using the channel to perform a      |                    01290000
   | data operation.                               |                    01295000
   +-----------------------+-----------------------+                    01300000
%14|       SIOPSIZE        |        CQUEN          |   IQUEUE           01305000
   +--+--+--+--------------+-----------+-----------+                    01310000
%15|RW|WP|IG|                          |  HCUNIT   |   IFLAG            01315000
   +--+--+--+--------------------------+-----------+                    01320000
%16| SYSDB relative DIT pointer for unit 0         |   IDITP0           01325000
   +-----------------------------------------------+                    01330000
%17|             Line Printer                      |                    01335000
   .               Channel                         .                    01340000
   |                 Program                       |                    01345000
   +-----------------------------------------------+                    01350000
                                                                        01355000
                                                                        01360000
ICPVA0 - Channel Program Variable Area                                  01365000
                                                                        01370000
  The first word is used by the channel program processor to store      01375000
  status information after I/O channel aborts.  The next word is used   01380000
  by the driver to indicate if status should be examined for special    01385000
  conditions or errors.  The other two words are not used.              01390000
                                                                        01395000
                                                                        01400000
ICPVA4 - DMA abort address                                              01405000
                                                                        01410000
  If a DMA abort occurs, the absolute address where the abort occurred  01415000
  is stored in this area.                                               01420000
                                                                        01425000
                                                                        01430000
ICNTRL - Contains controller information                                01435000
                                                                        01440000
  LIM     - If this bit is set, the controller is sharing a software    01445000
            channel resource in order to limit bandwidth.               01450000
  CHANQUE - The software channel resource number.                       01455000
  CHAN    - Channel number (four most significant bits of DRTN).        01460000
  DEV     - Device number (three least significant bits of DRTN).       01465000
                                                                        01470000
                                                                        01475000
IQUEUE -                                                                01480000
                                                                        01485000
  SIOPSIZE - (number of words + 1)/2 in the channel program area.       01490000
  CQUEN    - For a multi-unit controller this field contains the        01495000
             software controller resource number.                       01500000
                                                                        01505000
                                                                        01510000
IFLAG - Controller and Channel Program state flags                      01515000
                                                                        01520000
  RUNWAIT  - An Idle Channel Program should be started when there       01525000
             are no active requests to process.  This flag is always    01530000
             0 for the 2608.                                            01535000
  WAITPROG - An Idle Channel Program has been started for this          01540000
             controller.  This bit is reset by an interrupt.            01545000
  IGNOREHI - An HIOP instruction has been issued against this	          01550000
             controller but the channel program was not in a wait       01555000
             statement.  Therefore ignore the interrupt generated by    01560000
             the channel code when this program halts.                  01565000
  HCUNIT   - Highest configured unit number for this controller.        01570000
                                                                        01575000
                                                                        01580000
                                                                        01585000
            Device Reference Table DRT                                  01590000
            --------------------------                                  01595000
                                                                        01600000
There is one DRT per device controller.  The the contents of this table 01605000
are used for processing interrupts.                                     01610000
                                                                        01615000
     Word 0  SIOP   - Absolute address of the current I/O               01620000
                      instruction in execution.                         01625000
     Word 1  DBI    - Absolute address of the base of the ILT           01630000
                      for this controller.                              01635000
     Word 2  PLABLE - The external program label of the interrupt       01640000
                      service routine for this controller.              01645000
     Word 3  CHAN   - Contains channel program status information       01650000
                      which is used by the channel program interpreter. 01655000
$PAGE                                                                   01660000
            I/O QUEUE ELEMENT (IOQ)                                     01665000
            -----------------------                                     01670000
                                                                        01675000
                                                                        01680000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01685000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01690000
  0|      Request dependent flags (see below)      |   QFLAG            01695000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01700000
  1| SYSDB relative pointer to next IOQ element.   |   QLINK            01705000
   | Points to first word of element.              |                    01710000
   +-----------------------+-----------------------+                    01715000
  2|                       | Logical device number |   QLDEV            01720000
   +--+--+--+--------+-----+-----------+-----------+                    01725000
  3|PP|PE|MC|TOUTCNTR|                 | WAITCODE  |   QMISC            01730000
   +--+--+--+--------+-----------------+-----------+                    01735000
  4| S| If QFLAG.(3:1) is clear then this is the   |   QDSTN            01740000
   |  | DST number of the target data segment.  If |                    01745000
   |  | S is set, QADDR is DB relative.            |                    01750000
   +--+--------------------------------------------+                    01755000
  5| Offset in the data segment or system buffer   |   QADDR            01760000
   | table to the target data buffer.              |                    01765000
   +-----------------------+-----------------------+                    01770000
  6|                       | Function code for     |   QFUNC            01775000
   |                       | this request.  (See   |                    01780000
   |                       | next section.)        |                    01785000
   +-----------------------+-----------------------+                    01790000
  7| On initiation, specifies the word count (>0)  |   QWBCT            01795000
   | or byte count (<0).  At completion of the     |                    01800000
   | request this location contains the actual     |                    01805000
   | transmission count in the same units (bytes   |                    01810000
   | or words) as in the request.                  |                    01815000
   +-----------------------------------------------+                    01820000
%10| Parameter 1.  Vertical Format specification.  |   QPAR1            01825000
   | (See next section for detail.)                |                    01830000
   +-----------------------------------------------+                    01835000
%11| Parameter 2.  Space Mode Flags.  (See next    |   QPAR2            01840000
   | section for details.)                         |                    01845000
   +-----------------------+--------------+--------+                    01850000
%12|         PCBN          |  QUALIFIER   | STATUS |   QSTAT            01855000
   +-----------------------+--------------+--------+                    01860000
                                                                        01865000
                                                                        01870000
QFLAG - Request dependent flags                                         01875000
                                                                        01880000
  Bit 0  ABORT     - Abort this request and return an error indication  01885000
                     to the caller.                                     01890000
  Bit 1  SPECIAL   - Apply special handling to this request.  (Not used)01895000
  Bit 2  DIAG      - This is a request from the diagnostic subsystem.   01900000
                     (Not used)                                         01905000
  Bit 3  SYSBUFF   - Target is an index relative to the SBUF Table of   01910000
                     the data buffer.                                   01915000
  Bit 4  IOWAKE    - Wake caller on completion of request.              01920000
  Bit 5  BLOCKED   - Blocked I/O.  The caller is waited in ATTACHIO     01925000
                     until the request is completed.  Implies IOWAKE.   01930000
  Bit 6  COMPLETED - The request has been completed and the caller      01935000
                     awakened if he had requested (with IOWAKE).        01940000
  Bit 7  DATAFRZN  - Set by the memory management routines (MAM) when a 01945000
                     MAKEPRESENT request is successfully completed and  01950000
                     indicates the data segment is frozen in memory.    01955000
  Bit 8  MAMERRORD - An error has occurred while MAM was trying to      01960000
                     make the target data segment present and freeze    01965000
                     it in memory.                                      01970000
  Bit 9  PREQ      - (Not used)                                         01975000
  Bit 10 SFAIL     - Delayed failure of SIO instruction.  If a call to  01980000
                     STARTIO resulted in the request being added to     01985000
                     the channel queue, this bit indicates that the SIO 01990000
                     instruction failed when the request was selected   01995000
                     for execution.                                     02000000
  Bit 11 PFAIL     - The request was aborted because of a system power  02005000
                     failure.                                           02010000
                                                                        02015000
                                                                        02020000
QMISC - Driver request dependent flags and counters.                    02025000
                                                                        02030000
  PRE'TO'POST - Pre to post spacing change flag.                        02035000
  PEJECT      - Last operation was a page eject.                        02040000
  MASTERCLR   - Master clear done to clear powerfail bit in status.     02045000
                Master clear needs to be done from not ready conditon.  02050000
  TOUTCNTR    - Channel time-out retry counter.                         02055000
  WAITCODE    - Indicates type of wait:                                 02060000
                  0 - new request                                       02065000
                  1 - completion wait                                   02070000
                  2 - not ready wait                                    02075000
                                                                        02080000
                                                                        02085000
QSTAT - PCB number and request completion status.                       02090000
                                                                        02095000
  PCBN    - The Process Control Block (PCB) number of the process       02100000
            which made this request.  If zero, the request is not       02105000
            associated with any process and the IOQ element is to       02110000
            be returned by the system when the request has completed.   02115000
  STATUS  - General status indicating the final state of the request.   02120000
            The following codes are used:                               02125000
              0 - Not started or awaiting completion.                   02130000
              1 - Successful completion.                                02135000
              2 - End-of-file detected.                                 02140000
              3 - Unusual, but recoverable, condition detected.         02145000
              4 - Irrecoverable error has occurred.                     02150000
  QUALIFIER - A code which further defines or qualifies the general     02155000
              status.  (See the section Driver Return Status Codes.)    02160000
                                                                        02165000
$PAGE                                                                   02170000
         2608 Line Printer Request Codes                                02175000
         -------------------------------                                02180000
                                                                        02185000
Operation     Function               Parameters                         02190000
                                                                        02195000
  WRITE          1      P1 - Vertical Format Specification              02200000
                                1 - use 1st data char as format spec    02205000
                                                                        02210000
                              %53 - "+", print and suppress spacing     02215000
                              %55 - "-", print and triple space         02220000
                              %60 - "0", print and double space         02225000
                              %61 - "1", print and top of form          02230000
                                                                        02235000
                              %200-%277, print and space N-%200 lines   02240000
                              %300-%317, print with channel N-%277      02245000
                                                                        02250000
                              %320 - fill line printer buffer only      02255000
                                                                        02260000
                              All others, print and single space.       02265000
                                                                        02270000
                        P2 - Space Mode Flags                           02275000
                             (15:1) - Prespace flag                     02280000
                                if set, print then fill buffer          02285000
                                if clear, fill buffer then print        02290000
                             (14:1) - No page stepover flag             02295000
                                if set, single and double space         02300000
                                  without stepover (66 lines/page)      02305000
                                if clear, single and double space       02310000
                                  with stepover (60 lines/page)         02315000
                                                                        02320000
  FILE OPEN      2      Page eject if not at top of form                02325000
                                                                        02330000
  FILE CLOSE     3      Page eject if not at top of form                02335000
                                                                        02340000
  DEVICE CLOSE   4      Page eject if not at top of form                02345000
                                                                        02350000
  READ STATUS  %17      Read I/O status                                 02355000
                          Count - buffer must be at least 2 bytes       02360000
                                                                        02365000
  VFC SET     %100      Load VFC RAM                                    02370000
                          Count - form length in words                  02375000
                                  (0 loads RAM from internal ROM)       02380000
                          P1 - 6 for 6 LPI or 8 for 8 LPI               02385000
                               any other value defaults to 6 LPI        02390000
                                                                        02395000
  TAB SET     %101      Sets logical column definition                  02400000
                          P1 - 0 to 15, any other value defaults to 15  02405000
                                                                        02410000
$PAGE                                                                   02415000
                       DRIVER RETURN STATUS CODES                       02420000
                       --------------------------                       02425000
                                                                        02430000
                                                                        02435000
 GENERAL STATUS (13:3)       QUALIFYING STATUS (8:5)      OVERALL (8:8) 02440000
  0 - PENDING               1 - WAITING FOR COMPLETION         %10      02445000
                            3 - NOT READY WAIT                 %30      02450000
                                                                        02455000
  1 - SUCCESSFUL            0 - NO ERRORS                        1      02460000
                                                                        02465000
  2 - END OF FILE           (NOT USED)                                  02470000
                                                                        02475000
 3 - UNUSUAL CONDITION      3 - REQUEST ABORTED                %33      02480000
                            6 - POWERFAIL ABORT                %63      02485000
                          %21 - DEVICE POWERED UP             %213      02490000
                          %27 - VFC EXTERNALLY RESET          %273      02495000
                                                                        02500000
 4 - IRRECOVERABLE ERROR    0 - INVALID REQUEST                  4      02505000
                            2 - I/O TIMED OUT BEFORE COMPLETION%24      02510000
                            4 - SIO FAILURE                    %44      02515000
                            5 - UNIT FAILURE                   %54      02520000
                          %12 - SYSTEM ERROR                  %124      02525000
                          %14 - CHANNEL FAILURE               %144      02530000
                                                                        02535000
                                                                        02540000
;                                                              <<06721>>02545000
$PAGE                                                                   02550000
BEGIN                                                                   02555000
$INCLUDE INCLIOQ                                               <<06721>>02560000
  EQUATE                                                                02565000
                 << DITP PARAMETERS >>                                  02570000
                                                                        02575000
    DILTP     =  5,  << INTERRUPT LINKAGE TABLE POINTER >>              02580000
    DLDEV     =  3,  << LOGICAL DEVICE AND UNIT NUMBERS >>              02585000
    DLOGERROR = %13, << DIT HARDWARE LOGGED ERROR STATUS >>    <<06721>>02590000
    DLOGERROR2=  DLOGERROR + 1, << =%14 DIT HW LOGERR STAS+1>> <<06721>>02595000
    DRQST     = %15, << DRIVER REQUEST FLAGS >>                <<06721>>02600000
    DSAVE     =  6,  << DRIVER FLAGS >>                        <<01301>>02605000
    DSERR     =  7,  << DIT HARDWARE ERROR COUNT & INDEX >>    <<01346>>02610000
    DTIME     =  8,  << TIME-OUT REQUEST ENTRY INDEX >>        <<01301>>02615000
                                                                        02620000
    DFLAG     =  0,  << DEVICE FLAGS >>                        <<06721>>02625000
    DLINK     =  1,  << DIT POINTER  >>                        <<06721>>02630000
    DIOQP     =  2,  << IOQ POINTER >>                         <<06721>>02635000
    DDLTP     =  4,  << DLT POINTER >>                         <<06721>>02640000
    DSTAT     = %11, << INTERRUPT STATUS >>                    <<06721>>02645000
    DUNIT     = %12, << PHYSICAL DEVICE UNIT >>                <<06721>>02650000
                                                                        02655000
                 << IOQP PARAMETERS >>                                  02660000
                                                                        02665000
    << SPECIFY BY INCLUDE-5 >>                                 <<06721>>02670000
                                                               <<06721>>02675000
                                                               <<06721>>02680000
                                                               <<06721>>02685000
                                                               <<06721>>02690000
                                                               <<06721>>02695000
                                                               <<06721>>02700000
                                                                        02705000
                                                                        02710000
          << CHANNEL PROGRAM ADDRESSES RELATIVE TO SIOP >>              02715000
                                                                        02720000
    BADDR     = 23,  << WRITE INSTRUCTION BUFFER ADDRESS >>             02725000
    BCOUNT    = 20,  << WRITE INSTRUCTION BYTE COUNT >>                 02730000
    BUFFJMP   = 18,  << SWITCH FOR BUFFER FILL >>                       02735000
    DSJ'RB1   =  3,  << FIRST DSJ RETURN BYTE >>                        02740000
    DSJ'RB2   = 36,  << SECOND DSJ RETURN BYTE >>                       02745000
    MEMX      = 22,  << WRITE INSTRUCTION BANK NUMBER >>                02750000
    POST'CTL  = 72,  << POST-SPACE CONTROL >>                  <<01201>>02755000
    POSTJMP   = 27,  << SWITCH FOR POST SPACING >>                      02760000
    PRE'CTL   = 71,  << PRESPACE CONTROL >>                    <<01201>>02765000
    PREJMP    =  9,  << SWITCH FOR PRESPACING >>                        02770000
    RSTATCMD  = 73,  << READ STATUS COMMAND WORD >>            <<01201>>02775000
    SBANK     = 67,  << STATUS READ BANK >>                    <<01201>>02780000
    SBCOUNT   = 65,  << # STATUS BYTES >>                      <<01201>>02785000
    STATADR   = 68,  << STATUS READ ADDR >>                    <<01201>>02790000
    STATCODE  = 75,  << STATUS BYTE CODE >>                    <<01201>>02795000
    STATUS    = 74,  << I/O STATUS BUFFER >>                   <<01201>>02800000
    WRTCTL1   = 10,  << PRESPACE WRITE CONTROL INSTRUCTION >>           02805000
    WRTCTL2   = 28,  << POST-SPACE WRITE CONTROL INSTRUCTION >>         02810000
                                                                        02815000
                                                                        02820000
               << COMPLETION STATUSES >>                                02825000
                                                                        02830000
    ABORTED   =  %33,  << REQUEST ABORTED >>                            02835000
    CHANFAIL  = %144,  << I/O CHANNEL ERROR >>                          02840000
    GOODIO    =    1,  << SUCCESSFUL I/O COMPLETION >>                  02845000
    INVALIDOP =    4,  << INVALID OPERATION REQUESTED >>                02850000
    PFABORT   =  %63,  << REQUEST ABORTED DUE TO POWER FAILURE >>       02855000
    POWERUP   = %213,  << UNIT RESET DUE TO POWER FAIL OR RESET >>      02860000
    SIOFAIL   =  %44,  << SIO FAILURE >>                                02865000
    SYSERROR  = %124,  << SYSTEM ERROR >>                               02870000
    VFCRESET  = %273,  << VFC HAS BEEN MANUALLY RESET >>                02875000
$PAGE                                                                   02880000
                                                                        02885000
                << DRIVER STATES >>                                     02890000
                                                                        02895000
    CMPLTIONWAIT  = 1,  << WAITING FOR I/O COMPLETION INTERRUPT >>      02900000
    NOTRDYWAIT    = 2,  << NOT READY WAIT IN PROGRESS >>                02905000
                                                                        02910000
                                                                        02915000
                << SIODM STATES >>                                      02920000
                                                                        02925000
    INTRPTWAIT  = %13,  << WAIT FOR I/O COMPLETION >>                   02930000
    NOTREADY    =   7,  << UNIT NOT READY >>                            02935000
    REQUESTDONE =   5,  << REQUEST DONE >>                              02940000
                                                                        02945000
                                                                        02950000
            << IOMESSAGE PARAMETERS >>                                  02955000
                                                                        02960000
     DOWNLOADMSG  = 22,  << VFC DOWNLOADED MESSAGE >>          <<00761>>02965000
     NOTRDYMSG    = 11,  << NOT READY MESSAGE >>                        02970000
     OPCONSOLE    =  0,  << OUTPUT MESSAGE TO SYSTEM CONSOLE >>         02975000
     POWERUPMSG   = 13,  << POWER RESTORED/UNIT RESET MESSAGE>><<00761>>02980000
     VFCRESETMSG  = 15,  << VFC RESET MESSAGE >>               <<00761>>02985000
                                                                        02990000
                                                                        02995000
            << MISCELLANEOUS EQUATES >>                                 03000000
                                                                        03005000
    DCLOSE     =     4,  << DEVICE CLOSE FUNCTION >>                    03010000
    FOPEN      =     2,  << FILE OPEN FUNCTION >>                       03015000
    FCLOSE     =     3,  << FILE CLOSE FUNCTION >>                      03020000
    FULL'      =    14,  << LINE PRINTER BUFFER FULL >>                 03025000
    IOTIMER    =   %20,  << IO TIMER PARAMETER >>                       03030000
    ISIOP      =     8,  << ILT CHANNEL PROGRAM AREA POINTER >>         03035000
    PARITYERROR=    -1,  << PARITY ERROR LOGGING VALUE >>               03040000
    PRESPACE'  =    13,  << LAST REQUEST USED PRESPACING >>             03045000
    SYSDB      = %1000,  << ADDRESS OF SYSDB AREA >>                    03050000
  ENDEQ        =     0;                                                 03055000
$PAGE                                                                   03060000
                                                                        03065000
             << I/O STATUS BIT DEFINITIONS >>                           03070000
                                                                        03075000
     DEFINE                                                             03080000
       RDYBITS    = ( 0:2)#, << ONLINE/NOT READY BITS >>                03085000
       VFCRSET    = ( 4:1)#, << VFC RESET BIT >>                        03090000
       PON        = ( 7:1)#, << UNIT POWERED UP OR WAS RESET >>         03095000
                                                                        03100000
                                                                        03105000
               << QMISC BIT DEFINITIONS >>                              03110000
                                                                        03115000
       PRE'TO'POST= ( 0:1)#, << PRE TO POST SPACING CHANGE FLAG >>      03120000
       PEJECT     = ( 1:1)#, << LAST OPERATION WAS A PAGE EJECT >>      03125000
       MASTERCLR  = ( 2:1)#, << MASTER CLEAR IN PROGRESS >>    <<00761>>03130000
       TOUTCNTR   = ( 3:3)#, << CHANNEL TIME-OUT RETRY COUNTER >>       03135000
       WAITCODE   = (12:4)#, << INDICATES TYPE OF WAIT >>               03140000
                             <<   0 - NEW REQUEST      >>               03145000
                             <<   1 - COMPLETION WAIT  >>               03150000
                             <<   2 - NOT READY WAIT   >>               03155000
                                                                        03160000
                                                                        03165000
            << DSAVE BIT DEFINITIONS >>                                 03170000
                                                                        03175000
       VFCMOD     = ( 0:1)#, << VFC HAS BEEN MODIFIED >>                03180000
       TABDFAULT  = ( 3:4)#, << SYSTEM TAB DEFAULT >>                   03185000
       PRESPACE   = (13:1)#, << LAST REQUEST USED PRESPACING >>         03190000
       FULL       = (14:1)#, << LINE PRINTER BUFFER IS FULL >>          03195000
       TOP        = (15:1)#, << PRINTER IS AT TOP-OF-FORM (TOF) >>      03200000
                                                                        03205000
                                                                        03210000
             << MISCELLANEOUS BIT DEFINITIONS >>                        03215000
                                                                        03220000
       ABS        = ABSOLUTE#, << ABSOLUTE COMMAND >>          <<06721>>03225000
       CMD        = (12:4)#, << SECONDARY COMMAND >>                    03230000
       DLDEVN     = ( 8:8)#, << LOGICAL DEVICE NUMBER OF DIT >>         03235000
       ERRORCODE  = ( 0:3)#, << CPVAP, ERROR CODE >>                    03240000
       FUNC       = ( 8:8)#, << QFUNC, FUNCTION CODE >>                 03245000
       IAK        = ( 8:1)#, << DFLAG, TIMER REQUEST POPPED >>          03250000
       IOSTAT     = ( 8:8)#, << QSTAT, REQUEST STATUS RETURNED >>       03255000
       LRBIT      = ( 1:1)#, << WRITE INSTRUCTION LEFT/RIGHT BYTE BIT >>03260000
       PFAIL      = (11:1)#, << QFLAG, ABORT SET DUE TO POWER FAIL >>   03265000
       SFAIL      = (10:1)#, << QFLAG, FAILURE ON DELAYED START SIO >>  03270000
       STEPOVER   = (14:1)#, << IF SET THEN NO PAGE STEPOVER >>         03275000
       TIMEDOUT   = (13:1)#, << CPVAP, TRANSFER ABORTED DUE TO TO >>    03280000
       LOADMEMORY = ASSEMBLE(LSEA)#,                                    03285000
       STOREMEMORY= ASSEMBLE(SSEA)#,                           <<00761>>03290000
     ENDDEF       = 0#;                                                 03295000
                                                                        03300000
                                                                        03305000
                                                                        03310000
$PAGE                                                                   03315000
<<      *********************************                               03320000
        *                               *                               03325000
        *   DRIVER DB AREA DEFINITION   *                               03330000
        *                               *                               03335000
        *********************************       >>                      03340000
                                                                        03345000
                                                                        03350000
     ARRAY INITIAL(0:102) = DB :=                              <<06721>>03355000
       [8/14,8/1],<<DIT SIZE,NOT CORE RES/NO IDLE CP/DVR TYPE>><<06721>>03360000
                0,   << NOT USED >>                                     03365000
                0,   << UNIT EXTRACT INSTRUCTION - NOT USED >>          03370000
       [8/38,8/1],   << CHANNEL PROG SIZE, STATUS RETURN SIZE>><<06721>>03375000
                                                                        03380000
       << LP DIT >>                                                     03385000
                0,   << DFLAG >>                                        03390000
                0,   << DLINK >>                                        03395000
                0,   << DIOQP >>                                        03400000
                0,   << DLDEV >>                               <<06721>>03405000
                0,   << DDLTP >>                                        03410000
                0,   << DILTP >>                                        03415000
                0,   << DSAVE >>                               <<01301>>03420000
                0,   << DSERR >>                                        03425000
                0,   << DTIME >>                               <<01301>>03430000
                0,   << DSTAT >>                               <<06721>>03435000
           %40000,   << DUNIT >>                               <<06721>>03440000
                0,   << DLOGERROR >>                           <<01346>>03445000
                0,   << DLOGERROR+1 >>                         <<06721>>03450000
                0,   << DRQST >>                               <<06721>>03455000
                                                                        03460000
                                                                        03465000
       << CHANNEL PROGRAM >>                                            03470000
                                                                        03475000
<< 0>> << WAIT >>           %1000,  << MAKE SURE UNIT IS RESPONDING >>  03480000
<< 1>>                          0,                                      03485000
                                                                        03490000
<< 2>> << DSJ >>            %2403,  << CHECK PRINTER'S CONDITION >>     03495000
<< 3>>                          0,     << RETURN BYTE >>                03500000
<< 4>>                          0,     << JUMP *+0, READY FOR COMMAND >>03505000
<< 5>>                         35,     << JUMP *+35, READ STATUS >>     03510000
<< 6>>                          0,     << JUMP *+0, PARITY ERROR SEEN >>03515000
<< 7>>                         35,     << JUMP *+35, READ STATUS & PE >>03520000
                                                                        03525000
<< 8>> << JUMP >>               0,  << JUMP *+0 FOR PRESPACE REQUEST >> 03530000
<< 9>>                          0,  << JUMP *+7 OTHERWISE >>            03535000
                                                                        03540000
<<10>> << WRITE CONTROL >>  %2010,  << PRESPACE WRITE CONTROL/SET VFC >>03545000
<<11>>                          1,                                      03550000
<<12>>                          0,                                      03555000
<<13>>                     %42000,                                      03560000
<<14>>                          0,                                      03565000
                                                                        03570000
<<15>> << WAIT >>           %1000,  << WAIT FOR UNIT TO PARALLEL POLL >>03575000
<<16>>                          0,                                      03580000
                                                                        03585000
<<17>> << JUMP >>               0,  << JUMP *+0 FOR BUFFER FILL >>      03590000
<<18>>                          0,  << JUMP *+7 OTHERWISE >>            03595000
                                                                        03600000
<<19>> << WRITE DATA >>     %2000,  << WRITE OUT DATA BUFFER >>         03605000
<<20>>                          0,                                      03610000
<<21>>                          0,                                      03615000
<<22>>                          0,                                      03620000
<<23>>                          0,                                      03625000
                                                                        03630000
<<24>> << WAIT >>           %1000,  << WAIT FOR UNIT TO PARALLEL POLL >>03635000
<<25>>                          0,                                      03640000
                                                                        03645000
<<26>> << JUMP >>               0,  << JUMP *+0 FOR POSTSPACE REQUEST >>03650000
<<27>>                          0,  << JUMP *+7 OTHERWISE >>            03655000
                                                                        03660000
<<28>> << WRITE CONTROL >>  %2010,  << POSTSPACE WRITE CONTROL >>       03665000
<<29>>                          1,                                      03670000
<<30>>                          0,                                      03675000
<<31>>                     %42000,                                      03680000
<<32>>                          0,                                      03685000
                                                                        03690000
<<33>> << WAIT >>           %1000,  << WAIT FOR UNIT TO PARALLEL POLL >>03695000
<<34>>                          0,                                      03700000
                                                                        03705000
<<35>> << DSJ >>            %2403,  << CHECK PRINTER'S STATE >>         03710000
<<36>>                          0,     << RETURN BYTE >>                03715000
<<37>>                          0,     << JUMP *+0, READY FOR COMMAND >>03720000
<<38>>                          2,     << JUMP *+2, READ STATUS >>      03725000
<<39>>                          0,     << JUMP *+0, PARITY ERROR SEEN >>03730000
<<40>>                          2,     << JUMP *+2, READ STATUS & PE >> 03735000
                                                                        03740000
<<41>> << INT/HLT >>         %601,  << INTERRUPT/HALT AND PUT HALT >>   03745000
<<42>>                          1,     <<CODE OF 1 IN CPVA WORD 1 >>    03750000
                                                                        03755000
<<43>> << WRITE COMMAND >>  %2012,  << READ STATUS COMMAND >>           03760000
<<44>>                          1,                                      03765000
<<45>>                          0,                                      03770000
<<46>>                     %42000,                                      03775000
<<47>>                          0,                                      03780000
                                                                        03785000
<<48>> << WAIT >>           %1000,  << WAIT FOR PARALLEL POLL>><<00761>>03790000
<<49>>                          0,                             <<00761>>03795000
                                                                        03800000
<<50>> << READ STATUS >>    %1412,  << READ STATUS BYTE >>              03805000
<<51>>                          2,                                      03810000
<<52>>                          0,                                      03815000
<<53>>                      %2000,                                      03820000
<<54>>                          0,                                      03825000
                                                                        03830000
<<55>> << INT/HLT >>         %601,  << INTERRUPT/HALT AND PUT HALT >>   03835000
<<56>>                          2,  <<   CODE OF 2 IN CPVA WORD 1  >>   03840000
                                                               <<01201>>03845000
<<57>> << WRITE CONTROL >>  %2012,  << STATUS READ COMMAND >>  <<01201>>03850000
<<58>>                          1,                             <<01201>>03855000
<<59>>                          0,                             <<01201>>03860000
<<60>>                     %42000,                             <<01201>>03865000
<<61>>                          0,  << STATUS BYTE CODE ADR >> <<01201>>03870000
                                                               <<01201>>03875000
<<62>> << WAIT >>           %1000,  << WAIT FOR // POLL >>     <<01201>>03880000
<<63>>                          0,                             <<01201>>03885000
                                                               <<01201>>03890000
<<64>> << READ STATUS >>    %1412,  << READ STATUS BYTES >>    <<01201>>03895000
<<65>>                          0,  << #BYTES >>               <<01201>>03900000
<<66>>                          0,                             <<01201>>03905000
<<67>>                          0,  << BANK >>                 <<01201>>03910000
<<68>>                          0,  << ADDRESS >>              <<01201>>03915000
                                                               <<01201>>03920000
<<69>> << JUMP >>               0,  << JMP *-38, DSJ CHECK >>  <<01201>>03925000
<<70>>                    %177732,                             <<01201>>03930000
                                                               <<01201>>03935000
<<71>> << BUFFERS >>            0,  << PRESPACE CONTROL >>     <<01201>>03940000
<<72>>                          0,  << POSTSPACE CONTROL >>    <<01201>>03945000
<<73>>                          2,  << READ 2 STATUS BYTES >>  <<01201>>03950000
<<74>>                          0,  << STATUS >>               <<01201>>03955000
<<75>>                          0;  << STATUS BYTE CODE >>     <<01201>>03960000
$PAGE                                                                   03965000
<<       ***************************************                        03970000
         *                                     *                        03975000
         *   EXTERNAL PROCEDURE DECLARATIONS   *                        03980000
         *                                     *                        03985000
         ***************************************     >>                 03990000
                                                                        03995000
                                                                        04000000
   PROCEDURE ABORTTIMEREQ(TRLX);                                        04005000
     VALUE TRLX;   INTEGER TRLX;                                        04010000
     OPTION EXTERNAL;                                                   04015000
                                                                        04020000
   PROCEDURE GIP'HPIB;                                         <<01301>>04025000
     OPTION EXTERNAL;                                                   04030000
                                                                        04035000
   PROCEDURE HELP;                                                      04040000
     OPTION EXTERNAL;                                                   04045000
                                                                        04050000
   LOGICAL PROCEDURE IOMESSAGE(SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,    04055000
                               REPLY,OFFSET,DITP,IOTYPE);               04060000
     VALUE  SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,          04065000
            DITP,IOTYPE;                                                04070000
     INTEGER  SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,IOTYPE; 04075000
     INTEGER POINTER  DITP;                                             04080000
     OPTION VARIABLE, EXTERNAL;                                         04085000
                                                                        04090000
   PROCEDURE SIODM(DITP,FLAGS);                                         04095000
     VALUE DITP,FLAGS;   LOGICAL FLAGS;                                 04100000
     POINTER DITP;   OPTION EXTERNAL;                                   04105000
                                                                        04110000
   PROCEDURE MASTERCLEARHPIB(DITP);                            <<01301>>04115000
     ARRAY DITP;   OPTION EXTERNAL;                                     04120000
                                                                        04125000
   PROCEDURE START'HPIB(DITP,SIOP,QFLAG);                      <<01301>>04130000
     VALUE DITP,SIOP,QFLAG;   LOGICAL QFLAG;                            04135000
     POINTER DITP,SIOP;   OPTION EXTERNAL;                              04140000
                                                                        04145000
   INTEGER PROCEDURE TIMEREQ(CODE,REQ,TIME);                            04150000
     VALUE CODE,REQ,TIME;                                               04155000
     INTEGER CODE,REQ;   DOUBLE TIME;                                   04160000
     OPTION EXTERNAL;                                                   04165000
$PAGE                                                                   04170000
<<       ******************************************                     04175000
         *                                        *                     04180000
         *   LP DRIVER INITIALIZATION PROCEDURE   *                     04185000
         *                                        *                     04190000
         ******************************************     >>              04195000
                                                                        04200000
                                                                        04205000
   PROCEDURE LPINIT(DITP);                                              04210000
     INTEGER ARRAY DITP;                                                04215000
                                                                        04220000
<<                                                                      04225000
       THIS PROCEDURE INITIALIZES THE PRESPACING, POST-SPACING, AND     04230000
       STATUS BUFFER ADDRESSES IN THE CHANNEL PROGRAM.                  04235000
>>                                                                      04240000
     BEGIN                                                              04245000
       INTEGER POINTER ILTP = Q+1;                                      04250000
       INTEGER POINTER SIOP = Q+2;                                      04255000
       INTEGER SIOBASE = Q+3;                                           04260000
                                                                        04265000
                                                                        04270000
       TOS := DITP(DILTP);      << ILTP    >>                           04275000
       TOS := ILTP(ISIOP);      << SIOP    >>                           04280000
       TOS := @SIOP + SYSDB;    << SIOBASE >>                           04285000
                                                                        04290000
       SIOP(14) := SIOBASE + PRE'CTL;                                   04295000
       SIOP(32) := SIOBASE + POST'CTL;                                  04300000
       SIOP(47) := SIOBASE + RSTATCMD;                                  04305000
       SIOP(54) := SIOBASE + STATUS;                           <<00761>>04310000
       SIOP(61) := SIOBASE + STATCODE;                         <<01201>>04315000
     END;                                                               04320000
$PAGE                                                                   04325000
<<       ************************************************               04330000
         *                                              *               04335000
         *   LINE PRINTER DRIVER PROCEDURE  -  LPDRVR   *               04340000
         *                                              *               04345000
         ************************************************     >>        04350000
                                                                        04355000
                                                                        04360000
                                                                        04365000
   INTEGER PROCEDURE LPDRVR                                    <<06721>>04370000
           (IOQ'ENTRY'INDEX,DITP,BANK,BUFFADDR,SIOP,DRTN);     <<06721>>04375000
<<                                                                      04380000
       THIS PROCEDURE INITIATES AND COMPLETES I/O REQUESTS              04385000
       FOR THE HP 2608 LINE PRINTER CONNECTED TO THE HP-IB              04390000
       AND CONTROLLED BY THE GIC.                                       04395000
                                                                        04400000
       MODE RETURNS IN LPDRVR -                                         04405000
           5 - REQUEST COMPLETED                                        04410000
           7 - NOT READY WAIT                                           04415000
         %13 - WAIT FOR COMPLETION                              >>      04420000
                                                                        04425000
   VALUE DITP,IOQ'ENTRY'INDEX,BANK,BUFFADDR,SIOP,DRTN;         <<06721>>04430000
   INTEGER  BANK,BUFFADDR,DRTN;                                <<01301>>04435000
   INTEGER POINTER DITP,SIOP;                                  <<06721>>04440000
   INTEGER IOQ'ENTRY'INDEX;                                    <<06721>>04445000
   OPTION  PRIVILEGED,UNCALLABLE;                                       04450000
                                                                        04455000
   BEGIN                                                                04460000
     LOGICAL ARRAY                                                      04465000
       DITPL(*) = DITP;                                        <<06721>>04470000
                                                                        04475000
     DOUBLE                                                             04480000
       BUFFADDRD = Q-7;    << BANK AND BUFFER ADDRESS >>       <<01301>>04485000
                                                                        04490000
     INTEGER POINTER                                                    04495000
       CPVAP,          << HOLDS CHANNEL I/O STATUS >>          <<06721>>04500000
       IDLESIOP,          << POINTER TO START IDLE CHANN PGM >><<06721>>04505000
       STATSIOP,          << POINTER TO STATUS READ LOGIC >>   <<06721>>04510000
       FILLSIOP;          << POINTER TO FILL BUFFER >>         <<06721>>04515000
                                                                        04520000
     INTEGER                                                            04525000
       COUNT,             << BUFFER BYTE COUNT >>              <<06721>>04530000
       PARAM,             << CONTROL PARAMETER >>              <<06721>>04535000
       PRINTCTL,          << PRINT CONTROL BYTE >>             <<06721>>04540000
       FCODE,             << FUNCTION CODE >>                  <<06721>>04545000
       S0       = S-0;                                                  04550000
                                                                        04555000
$PAGE                                                                   04560000
   << INITIALIZE LOCAL POINTERS AND VARIABLES >>                        04565000
                                                                        04570000
     @CPVAP := DITP(DILTP);  << CPVAP >>                       <<06721>>04575000
     @IDLESIOP := @SIOP + 33; << IDLE SIOP >>                  <<06721>>04580000
     COUNT := IOQ'COUNT;     << COUNT >>                       <<06721>>04585000
     PARAM := 0;             << PARAM >>                       <<06721>>04590000
     PRINTCTL := 0;          << PRINTCTL >>                    <<06721>>04595000
     FCODE := IOQ'FUNC;      << FCODE >>                       <<06721>>04600000
     @STATSIOP := @SIOP + 57;<< STAT SIOP >>                   <<06721>>04605000
     @FILLSIOP := @SIOP + 15;<< FILLSIOP >>                    <<06721>>04610000
                                                                        04615000
     IF IOQ'ENTRY'INDEX = 0 THEN GOTO EXIT;<< NOTHING TO DO>>  <<06721>>04620000
                                                                        04625000
     IF IOQ'QMISC.WAITCODE = CMPLTIONWAIT THEN                 <<06721>>04630000
       ABORTTIMEREQ(DITP(DRQST));                              <<01301>>04635000
                                                                        04640000
                                                               <<06721>>04645000
     IF IOQ'ABORT THEN   << ABORT PROCESS >>                   <<06721>>04650000
       BEGIN                                                            04655000
         TOS := IF IOQ'PFAIL THEN PFABORT ELSE ABORTED;        <<06721>>04660000
         GOTO BADIO;                                                    04665000
         HELP;     << LINK >>                                           04670000
       END;                                                             04675000
                                                                        04680000
                                                               <<01513>>04685000
                                                               <<01513>>04690000
          << CHECK FOR RETURN FROM NOT READY CONDITION >>      <<01513>>04695000
                                                               <<01513>>04700000
                                                               <<01513>>04705000
     IF IOQ'QMISC.WAITCODE = NOTRDYWAIT THEN                   <<06721>>04710000
                                                               <<01513>>04715000
       BEGIN                                                   <<01513>>04720000
         IOQ'QMISC.MASTERCLR := 0;     << PON OCCURRED? >>     <<06721>>04725000
         IF <> OR SIOP(STATUS).PON = 1 THEN                    <<01513>>04730000
           GOTO PONINIT;   << YES - DO PON INITIATION >>       <<01513>>04735000
         IF SIOP(DSJ'RB1) <> 7 THEN                            <<01513>>04740000
                                                               <<01513>>04745000
           BEGIN   << LINE PARTIALLY PRINTED >>                <<01513>>04750000
             IF DITP(DSAVE).(PRESPACE':2)=3 OR                 <<01513>>04755000
             IOQ'QMISC.PRE'TO'POST = 1 THEN                    <<06721>>04760000
                                                               <<01513>>04765000
               BEGIN   << RESTART FILL BUFFER >>               <<01513>>04770000
                 IF SIOP(BCOUNT)=0 THEN   << COUNT EXPIRED >>  <<01513>>04775000
                   GO TO PRINTDONE;   << DON'T RESTART >>      <<01513>>04780000
                 SIOP(MEMX).(8:8) := BANK;                     <<01513>>04785000
                 SIOP(BADDR) := BUFFADDR;                      <<01513>>04790000
                 IOQ'QMISC.PRE'TO'POST := 0;                   <<06721>>04795000
                 START'HPIB(DITP,FILLSIOP,FALSE);              <<01513>>04800000
                 GO TO PRINTCONT;                              <<01513>>04805000
               END                                             <<01513>>04810000
                                                               <<01513>>04815000
             ELSE GOTO PRINTDONE;   << REQ DONE OTHERWISE >>   <<01513>>04820000
           END;                                                <<01513>>04825000
       END;                                                    <<01513>>04830000
                                                               <<01513>>04835000
                                                               <<01513>>04840000
  IF IOQ'QMISC.WAITCODE=CMPLTIONWAIT THEN <<PROCESS INTRUPT>>  <<06721>>04845000
       GOTO LPCONT;                                                     04850000
                                                                        04855000
                                                                        04860000
     SIOP(PREJMP) := SIOP(BUFFJMP) := SIOP(POSTJMP) := 7;  << INIT CP >>04865000
     SIOP(WRTCTL1).CMD := %10;  << INIT WRITE CTL TO PRINT COMMAND >>   04870000
     SIOP(WRTCTL2).CMD := %10;  << INIT WRITE CTL TO PRINT COMMAND >>   04875000
                                                                        04880000
                                                                        04885000
                                                                        04890000
          << CHECK FOR FOPEN, FCLOSE, AND DCLOSE  (FCODE = 2,3, OR 4) >>04895000
                                                                        04900000
     IF FCODE = DCLOSE THEN                                             04905000
       BEGIN                                                            04910000
         IF DITP(DSAVE).(FULL':2) <> 1 THEN  << EJECT A PAGE >><<02696>>04915000
           BEGIN                                                        04920000
             SIOP(PREJMP) := 0;                                         04925000
             SIOP(PRE'CTL) := %200;                                     04930000
           END;                                                         04935000
         DITP(DSAVE).(13:3) := 1;   << SET TOF FLAG >>                  04940000
         IOQ'QMISC.PEJECT := 1;                                <<06721>>04945000
         GOTO STARTPRINT;                                               04950000
       END                                                              04955000
                                                                        04960000
                                                                        04965000
     ELSE  IF FCODE=FCLOSE THEN                                         04970000
       BEGIN                                                            04975000
         IF DITP(DSAVE).(FULL':2) = 1 THEN                     <<02696>>04980000
           GOTO PRINTDONE;  << EMPTY BUFFER & ALREADY AT TOP >><<02696>>04985000
         IOQ'QMISC.PEJECT := 1; << SET PAGE EJECT FLAG >>      <<06721>>04990000
         PRINTCTL := %200;                                              04995000
         GOTO PRINTSETUP;   << TO ISSUE PAGE EJECT >>                   05000000
       END                                                              05005000
                                                                        05010000
                                                                        05015000
     ELSE IF FCODE=FOPEN THEN                                           05020000
       BEGIN                                                            05025000
         IF DITP(DSAVE).(FULL':2) <> 1 THEN                    <<02696>>05030000
           BEGIN                                                        05035000
             DITP(DSAVE).FULL := 0;  << SET BUFFER EMPTY >>    <<02696>>05040000
             IOQ'QMISC.PEJECT := 1;                            <<06721>>05045000
             SIOP(POST'CTL) := %200;                                    05050000
             SIOP(POSTJMP) := 0;                                        05055000
             GOTO STARTPRINT;                                           05060000
           END ELSE                                            <<01513>>05065000
             GOTO PRINTDONE;                                   <<01513>>05070000
       END                                                              05075000
                                                                        05080000
                                                                        05085000
          << CHECK FOR FWRITE  (FCODE = 1) >>                           05090000
   ELSE IF FCODE = 1 THEN                                               05095000
     BEGIN                                                              05100000
                                                                        05105000
                                                                        05110000
     IF DITP(DSAVE).(PRESPACE':2)=3 AND NOT IOQ'PARM2 THEN     <<06721>>05115000
       BEGIN                                                            05120000
         SIOP(PREJMP) := 0;                                             05125000
         IF IOQ'PARM2.STEPOVER THEN  << NO AUTO EJECT >>       <<06721>>05130000
           SIOP(PRE'CTL) := 1  << SINGLE SPACE W/O STEPOVER >> <<02696>>05135000
         ELSE  << AUTO PAGE EJECT >>                           <<02696>>05140000
         SIOP(PRE'CTL) := %202;         << ISSUE SINGLE SPACE WITH >>   05145000
         IOQ'QMISC.PRE'TO'POST := 1;<<STEPOVER CLEAR LP BUF>>  <<06721>>05150000
       END;                                                             05155000
                                                                        05160000
     TOS := IOQ'COUNT;                                         <<06721>>05165000
     IF < THEN             << BYTE COUNT >>                             05170000
       COUNT := -TOS         << MAKE POSITIVE >>                        05175000
     ELSE                  << WORD COUNT >>                             05180000
       COUNT := TOS&ASL(1);  << CHANGE TO BYTE COUNT >>                 05185000
                                                                        05190000
     IF IOQ'PARM1 = 1 THEN  << IMBEDDED CONTROL >>             <<06721>>05195000
       BEGIN                                                            05200000
         IF COUNT = 0 THEN    << INVALID OPERATION >>                   05205000
           BEGIN                                                        05210000
             TOS := INVALIDOP;                                          05215000
             GOTO IODONE;                                               05220000
           END;                                                         05225000
         TOS := BUFFADDRD;    << LOAD BANK AND BUFF ADDRESS >>          05230000
         LOADMEMORY;             << LOAD FIRST WORD >>                  05235000
         PARAM := TOS&LSR(8);    << ISOLATE AND SAVE CONTROL PARAM >>   05240000
         COUNT := COUNT - 1;     << DECREMENT BYTE COUNT >>             05245000
       END                                                              05250000
     ELSE                      << CONTROL IN PARAM WORD >>              05255000
       PARAM := IOQ'PARM1;                                     <<06721>>05260000
                                                                        05265000
     DITP(DSAVE).PRESPACE := IF IOQ'PARM2                      <<06721>>05270000
       THEN 1 ELSE 0;                 << SET PRESPACE FLAG >>           05275000
                                                                        05280000
                                                                        05285000
                                                                        05290000
        << INITIALIZE PRINT CONTROL BYTE >>                             05295000
                                                                        05300000
     IF IOQ'PARM2.STEPOVER THEN <<SINGLE SPACE W/OUT STEPOVER>><<06721>>05305000
       PRINTCTL := 1                                                    05310000
     ELSE                           << SINGLE SPACE WITH STEPOVER >>    05315000
       PRINTCTL := %202;                                                05320000
                                                                        05325000
                                                                        05330000
        << SETUP PRINT CONTROL BYTE >>                                  05335000
                                                                        05340000
     IF PARAM = "+" THEN            << SUPPRESS SPACING >>              05345000
       PRINTCTL := 0                                                    05350000
                                                                        05355000
     ELSE IF PARAM = "0" THEN       << DOUBLE SPACE >>                  05360000
       PRINTCTL := PRINTCTL + 1                                         05365000
                                                                        05370000
     ELSE IF PARAM = "-" THEN       << TRIPLE SPACE >>                  05375000
       PRINTCTL := PRINTCTL + 2                                         05380000
                                                                        05385000
     ELSE IF PARAM = "1" THEN       << TOP OF FORM >>                   05390000
       BEGIN                                                            05395000
         IF COUNT=0 AND DITP(DSAVE).(FULL':2)=1 THEN                    05400000
           GOTO PRINTDONE;  << EMPTY BUFFER AND ALREADY AT TOP >>       05405000
         PRINTCTL := %200;                                              05410000
         IOQ'QMISC.PEJECT := 1;<<SET PAGE EJECT FLAG>>         <<06721>>05415000
       END                                                              05420000
                                                                        05425000
     ELSE IF %200 <= PARAM <= %277 THEN  << SLEW N LINES >>             05430000
       PRINTCTL := PARAM - %200                                         05435000
                                                                        05440000
     ELSE IF %300 <= PARAM <= %317 THEN  << SELECT CHANNEL N >>         05445000
       PRINTCTL := PARAM - %100                                         05450000
                                                                        05455000
     ELSE IF PARAM = %320 THEN      << BUFFER FILL ONLY >>              05460000
       BEGIN                                                            05465000
         PRINTCTL := -1;                                                05470000
         IF IOQ'QMISC.PRE'TO'POST = 0 AND COUNT = 0 THEN       <<06721>>05475000
           GOTO PRINTDONE;                                              05480000
       END;                                                             05485000
                                                                        05490000
$PAGE                                                                   05495000
<<  SETUP CHANNEL PROGRAM FOR BUFFER FILL AND PRINT CONTROL  >>         05500000
                                                                        05505000
  PRINTSETUP:                                                           05510000
     IF PRINTCTL >= 0 THEN    << SETUP PRINT CONTROL >>                 05515000
       BEGIN                                                            05520000
         DITP(DSAVE).FULL := 0;                                         05525000
         IF DITP(DSAVE).PRESPACE=1 THEN    << PRESPACE >>               05530000
           BEGIN                                                        05535000
             SIOP(PREJMP) := 0;                                         05540000
             SIOP(PRE'CTL) := PRINTCTL;                                 05545000
           END                                                          05550000
         ELSE                              << POST-SPACE >>             05555000
           BEGIN                                                        05560000
             SIOP(POSTJMP) := 0;                                        05565000
             SIOP(POST'CTL) := PRINTCTL;                                05570000
           END;                                                         05575000
       END;                                                             05580000
                                                                        05585000
                                                                        05590000
     IF COUNT <> 0 THEN        << SETUP BUFFER FILL >>                  05595000
       BEGIN                                                            05600000
         SIOP(BUFFJMP) := 0;                                            05605000
         SIOP(BCOUNT) := COUNT;                                         05610000
         SIOP(MEMX).(8:8) := BANK;                                      05615000
         SIOP(MEMX).LRBIT:= IF IOQ'PARM1=1 <<IMBEDDED CONTRL>> <<06721>>05620000
           THEN 1 ELSE 0;               << START WITH RIGHT BYTE >>     05625000
         SIOP(BADDR) := BUFFADDR;                                       05630000
         DITP(DSAVE).FULL := IF DITPL(DSAVE).PRESPACE                   05635000
           THEN 1 ELSE 0;    << IF PRESPACING INDICATE BUFF IS FULL >>  05640000
       END;                                                             05645000
                                                                        05650000
                                                                        05655000
                                                                        05660000
<<  START CHANNEL PROGRAM  >>                                           05665000
                                                                        05670000
  STARTPRINT:                                                           05675000
     CPVAP := 0;                << CLEAR CHANNEL STATUS WORD >>         05680000
     SIOP(DSJ'RB1) := 7;        << INITIALIZE DSJ RTN BYTES >> <<00761>>05685000
     SIOP(DSJ'RB2) := 0;                                                05690000
     SIOP(STATUS) := 0;         << CLEAR CP STATUS WORD >>              05695000
                                                                        05700000
     START'HPIB(DITP,SIOP,TRUE);   << START CHANNEL PROGRAM >> <<01301>>05705000
PRINTCONT:                                                     <<00761>>05710000
     IF < THEN      << SIO FAILURE >>                                   05715000
       BEGIN                                                            05720000
         TOS := SIOFAIL;                                                05725000
         GOTO BADIO;                                                    05730000
       END;                                                             05735000
                                                                        05740000
     IOQ'QMISC.WAITCODE:=CMPLTIONWAIT;<<SET REQUEST STATE>>    <<06721>>05745000
     DITP(DTIME) := 0;                                         <<01301>>05750000
     DITP(DRQST) := TIMEREQ(IOTIMER,@DITP,2000D);              <<01301>>05755000
     LPDRVR := INTRPTWAIT;                                              05760000
     RETURN;                                                            05765000
                                                                        05770000
                                                                        05775000
     END      << OF WRITE LOGIC (FUNCTION CODE = 1) >>                  05780000
                                                               <<01201>>05785000
                                                               <<01201>>05790000
       << READ STATUS (FUNCTION CODE = %17) >>                 <<01201>>05795000
                                                               <<01201>>05800000
  ELSE  IF FCODE = %17 THEN                                    <<01201>>05805000
    BEGIN   << READ STATUS PROCESSING >>                       <<01201>>05810000
      TOS := IOQ'COUNT;    << GET COUNT >>                     <<06721>>05815000
      IF < THEN  << NEGATIVE BYTE COUNT >>                     <<01201>>05820000
        COUNT := -TOS   << MAKE POSITIVE >>                    <<01201>>05825000
      ELSE  << POSITIVE WORD COUNT >>                          <<01201>>05830000
        COUNT := TOS & ASL(1);  << CHANGE TO BYTE >>           <<01201>>05835000
                                                               <<01201>>05840000
      IF COUNT < 1 THEN  << INVALID REQUEST >>                 <<01201>>05845000
        BEGIN                                                  <<01201>>05850000
          TOS := INVALIDOP;                                    <<01201>>05855000
          GOTO BADIO;                                          <<01201>>05860000
        END;                                                   <<01201>>05865000
      IF COUNT > 16 THEN  << EXCEED MAX STATUS >>              <<01201>>05870000
        COUNT := 16;  << SET MAX STATUS AVAIL >>               <<01201>>05875000
                                                               <<01201>>05880000
      SIOP(STATCODE) := SIOP(SBCOUNT) := COUNT;                <<01201>>05885000
      SIOP(SBANK).LRBIT := 0;  << START W/LEFT BYTE >>         <<01201>>05890000
      SIOP(SBANK).(8:8) := BANK;  << SET BANK >>               <<01201>>05895000
      SIOP(STATADR) := BUFFADDR;  << SET ABS ADR >>            <<01201>>05900000
                                                               <<01201>>05905000
      SIOP(STATUS) := 0;                                       <<01201>>05910000
      START'HPIB(DITP,STATSIOP,FALSE);  << START CHAN PROG >>  <<01368>>05915000
      GOTO PRINTCONT;   << FOR WRAP-UP >>                      <<01201>>05920000
                                                               <<01201>>05925000
    END   << OF READ STATUS PROCESSING >>                      <<01201>>05930000
                                                               <<01201>>05935000
                                                               <<01201>>05940000
       << SET VFC (FUNCTION CODE = %100) >>                             05945000
                                                                        05950000
                                                                        05955000
   ELSE  IF FCODE = %100 THEN                                           05960000
     BEGIN   << SET VFC PROCESSING >>                                   05965000
       COUNT := IOQ'COUNT&ASL(1); << CHANGE TO BYTE COUNT >>   <<06721>>05970000
       IF COUNT<0 OR COUNT>254 THEN                                     05975000
         BEGIN                                                          05980000
           TOS := INVALIDOP;                                            05985000
           GOTO IODONE;                                                 05990000
         END;                                                           05995000
                                                                        06000000
       SIOP(PRE'CTL):=IOQ'COUNT;<< DATA BYTE = BUFFER LENGTH >><<06721>>06005000
       IF IOQ'PARM1=8 THEN <<SET 8LPI INDICATOR IN DATA BYTE>> <<06721>>06010000
         SIOP(PRE'CTL) := SIOP(PRE'CTL) + %200;                         06015000
       SIOP(PREJMP) := 0;                                               06020000
       SIOP(WRTCTL1).CMD := 2;  << SET WRITE CONTROL TO VFC COMMAND>>   06025000
      DITP(DSAVE).VFCMOD := 0;                                 <<00761>>06030000
                                                                        06035000
       IF COUNT <> 0 THEN    << SETUP BUFFER TRANSFER >>                06040000
         BEGIN                                                          06045000
           SIOP(BUFFJMP) := 0;                                          06050000
           SIOP(BCOUNT) := COUNT;                                       06055000
           SIOP(MEMX) := BANK;                                          06060000
           SIOP(BADDR) := BUFFADDR;                                     06065000
          DITP(DSAVE).VFCMOD := 1;   << VFC MODIFIED >>        <<00761>>06070000
         END;                                                           06075000
       GOTO STARTPRINT;                                                 06080000
                                                                        06085000
    END  << OF SET VFC LOGIC >>                                         06090000
$PAGE                                                                   06095000
                                                                        06100000
       << TAB SET (FUNCTION CODE = %101) >>                             06105000
                                                                        06110000
   ELSE  IF FCODE = %101 THEN                                           06115000
     BEGIN    << TAB SET PROCESSING >>                                  06120000
       IF IOQ'PARM1 > 15 THEN TOS := 15                        <<06721>>06125000
         ELSE TOS := IOQ'PARM1;                                <<06721>>06130000
       SIOP(PRE'CTL) := TOS;                                            06135000
       SIOP(PREJMP) := 0;                                               06140000
       SIOP(WRTCTL1).CMD := 7;   << SET UP CLEAR COMMAND >>             06145000
       DITP(DSAVE).TABDFAULT := SIOP(PRE'CTL);                 <<01513>>06150000
       GOTO STARTPRINT;                                                 06155000
                                                                        06160000
    END  << OF TAB SET LOGIC >>                                         06165000
                                                                        06170000
   ELSE   << FALL THROUGH >>                                            06175000
                                                                        06180000
                                                                        06185000
                                                                        06190000
  PRINTDONE:                                                            06195000
     TOS := GOODIO;                                                     06200000
                                                                        06205000
  IODONE:                                                               06210000
     IOQ'STAT := TOS;         << STORE RETURN STATUS >>        <<06721>>06215000
                                                               <<02696>>06220000
  EXIT:                                                        <<02696>>06225000
     LPDRVR := REQUESTDONE;                                             06230000
     RETURN;                                                            06235000
                                                                        06240000
  CHANERROR:                                                            06245000
     TOS := CHANFAIL;                                                   06250000
     DITP(DSERR):= [8/1,8/DLOGERROR];                          <<01346>>06255000
     DITP(DLOGERROR) := CPVAP;    << LOG ERROR STATUS >>       <<01346>>06260000
                                                                        06265000
  BADIO:                                                                06270000
     DITP(DSAVE).(13:3) := 0;    << CLEAR DRIVER FLAGS >>               06275000
     MASTERCLEARHPIB(DITP);                                    <<01301>>06280000
     GOTO IODONE;                                                       06285000
                                                                        06290000
$PAGE                                                                   06295000
<<  LINE PRINTER CONTINUATOR SECTION  >>                                06300000
                                                                        06305000
  LPCONT:                                                               06310000
     IF CPVAP.ERRORCODE = 6 THEN   << DMA ABORT >>                      06315000
       GOTO CHANERROR;                                                  06320000
                                                                        06325000
     IF CPVAP.ERRORCODE = 7 THEN   << CHANNEL ABORT >>                  06330000
       BEGIN                                                            06335000
         IF CPVAP.TIMEDOUT = 0 THEN   << BAD CHANNEL >>                 06340000
           GOTO CHANERROR;                                              06345000
                                                                        06350000
         TOS := IOQ'QMISC.TOUTCNTR+1;<< TIME OUT COUNTER >>    <<06721>>06355000
         IF S0 > 3 THEN      << CHANNEL FAILURE >>                      06360000
           GOTO CHANERROR                                               06365000
         ELSE                                                           06370000
           IOQ'QMISC.TOUTCNTR := TOS;  << UPDATE COUNTER >>    <<06721>>06375000
         GOTO STARTPRINT;                                               06380000
       END;                                                             06385000
                                                                        06390000
     IF IOQ'SFAIL THEN  << FAILURE ON DELAYED START I/O >>     <<06721>>06395000
       BEGIN                                                            06400000
         TOS := SIOFAIL;                                                06405000
         GOTO BADIO;                                                    06410000
       END;                                                             06415000
                                                                        06420000
     DITP(DTIME).(0:1) := 0;                                   <<01301>>06425000
     IF <> THEN   << TIMER POPPED >>                                    06430000
       BEGIN                                                            06435000
                                                                        06440000
   LPNOTREADY:                                                          06445000
         IF IOMESSAGE(1,NOTRDYMSG,%10000,DITP(DLDEV),          <<06721>>06450000
                      ,,,,OPCONSOLE) THEN                               06455000
           BEGIN                                                        06460000
             START'HPIB(DITP,IDLESIOP,FALSE);                  <<01301>>06465000
             IF < THEN                                                  06470000
               BEGIN                                                    06475000
                 TOS := SIOFAIL;                                        06480000
                 GOTO BADIO;                                            06485000
               END;                                                     06490000
             IOQ'QMISC.WAITCODE:=NOTRDYWAIT;<<SET REQST STATE>><<06721>>06495000
             LPDRVR := NOTREADY;                                        06500000
             RETURN;                                                    06505000
           END;                                                         06510000
                                                                        06515000
         TOS := SYSERROR;   << INDICATE FAILURE BECAUSE THERE >>        06520000
         GOTO BADIO;        << ARE NO MESSAGE LINK BUFFERS >>           06525000
       END;                                                             06530000
     IF SIOP(DSJ'RB1) > 1  OR                                           06535000
        SIOP(DSJ'RB2) > 1  THEN    << PARITY ERROR WAS DETECTED >>      06540000
        BEGIN                                                  <<01346>>06545000
        DITP(DSERR):= [8/1,8/DLOGERROR];                       <<01346>>06550000
        DITP(DLOGERROR):=  PARITYERROR;  <<LOG PARITY ERROR>>  <<01346>>06555000
        END;                                                   <<01346>>06560000
$PAGE                                                                   06565000
                                                                        06570000
      << CHECK FOR READ STATUS REQUEST >>                               06575000
                                                                        06580000
     IF FCODE = %17 THEN                                       <<00761>>06585000
       GOTO PRINTDONE;                                         <<01201>>06590000
                                                               <<01201>>06595000
                                                                        06600000
        << CHECK FOR MASTER CLEAR COMPLETION >>                         06605000
                                                                        06610000
     IOQ'QMISC.MASTERCLR := 0;                                 <<06721>>06615000
     IF <> THEN   << MASTER CLEAR WAS PERFORMED >>             <<00761>>06620000
       BEGIN                                                   <<00761>>06625000
         IF IOMESSAGE(1,POWERUPMSG,%10000,DITP(DLDEV),         <<06721>>06630000
                      ,,,,OPCONSOLE) THEN                      <<00761>>06635000
           BEGIN                                               <<00761>>06640000
             DITP(DSAVE).VFCMOD := 0; << NO LONGER CUSTOM>>    <<00761>>06645000
             TOS := POWERUP;                                   <<00761>>06650000
             GOTO IODONE;                                      <<00761>>06655000
           END;                                                <<00761>>06660000
         TOS := SYSERROR;  << INDICATE FAILURE AS THERE >>     <<00761>>06665000
         GOTO BADIO;       << ARE NO MESSAGE LINK BUFFS >>     <<00761>>06670000
       END;                                                    <<00761>>06675000
                                                                        06680000
                                                                        06685000
                                                                        06690000
           << CHECK I/O STATUS IF REQUIRED >>                           06695000
                                                                        06700000
     IF CPVAP(1).(14:2) = 2 THEN   << STATUS DIAGNOSIS IS REQUIRED >>   06705000
       BEGIN                                                            06710000
         IF SIOP(STATUS).RDYBITS <> 2 THEN  << UNIT NOTREADY >>         06715000
           BEGIN                                               <<01513>>06720000
           IF SIOP(STATUS).PON = 1 THEN  << PON OCCURRED >>    <<01513>>06725000
             IOQ'QMISC.MASTERCLR := 1;    << SET MC FLG >>     <<06721>>06730000
           GOTO LPNOTREADY;                                    <<01513>>06735000
           END;                                                <<01513>>06740000
                                                                        06745000
                                                                        06750000
         IF SIOP(STATUS).PON = 1 THEN  << UNIT HAS JUST POWERED UP >>   06755000
  PONINIT:                                                     <<01513>>06760000
           BEGIN                                                        06765000
             SIOP(WRTCTL1).CMD := 5;   << ISSUE MASTER CLEAR >><<00761>>06770000
             SIOP(PRE'CTL)     := 0;                           <<00761>>06775000
             SIOP(WRTCTL2).CMD := 7;   << ISSUE TABSET >>      <<00761>>06780000
             SIOP(POST'CTL)    := DITP(DSAVE).TABDFAULT;       <<00761>>06785000
             SIOP(PREJMP)      := 0;     << SET UP SWITCHES >> <<00761>>06790000
             SIOP(BUFFJMP)     := 7;                           <<00761>>06795000
             SIOP(POSTJMP)      := 0;                          <<00761>>06800000
             IOQ'QMISC.MASTERCLR := 1;    << SET MC FLG >>     <<06721>>06805000
             GOTO STARTPRINT;                                  <<00761>>06810000
           END;                                                         06815000
                                                                        06820000
         IF SIOP(STATUS).VFCRSET = 1 AND FCODE <> %100         <<01513>>06825000
           AND DITP(DSAVE).VFCMOD = 1 THEN   << VFC RESET >>   <<01513>>06830000
           BEGIN   << NOTIFY USER >>                           <<01513>>06835000
             IF IOMESSAGE(1,VFCRESETMSG,%10000,                <<01513>>06840000
             DITP(DLDEV),,,,,OPCONSOLE) THEN                   <<06721>>06845000
               BEGIN   << VFC NO LONGER CUSTOM >>              <<01513>>06850000
                 DITP(DSAVE).VFCMOD := 0;                      <<01513>>06855000
                 TOS := VFCRESET;                              <<01513>>06860000
                 GOTO IODONE;                                  <<01513>>06865000
               END;                                            <<01513>>06870000
             TOS := SYSERROR;   << FAILURE OCCURRED >>         <<01513>>06875000
             GOTO BADIO;        << NO MESSAGE LINK BUFFERS >>  <<01513>>06880000
           END;                                                <<01513>>06885000
                                                                        06890000
         IF SIOP(DSJ'RB1).(11:5)=1 THEN GOTO STARTPRINT;                06895000
       END;                                                             06900000
                                                                        06905000
     DITP(DSAVE).TOP:=IOQ'QMISC.PEJECT;<<SET TOP IF PE WAS DONE<<06721>>06910000
                                                                        06915000
     IF FCODE=%100 OR FCODE=%101 THEN  << OUTPT DOWNLOAD MSG >><<01513>>06920000
       BEGIN                                                   <<00761>>06925000
         IF NOT IOMESSAGE(1,DOWNLOADMSG,%10000,                <<00761>>06930000
           DITP(DLDEV),,,,,OPCONSOLE) THEN                     <<06721>>06935000
           BEGIN                                               <<00761>>06940000
             TOS := SYSERROR;                                  <<00761>>06945000
             GOTO BADIO;                                       <<00761>>06950000
           END;                                                <<00761>>06955000
       END;                                                    <<00761>>06960000
                                                                        06965000
                                                                        06970000
                                                               <<01226>>06975000
     GOTO PRINTDONE;     << GOT HERE - REQUEST COMPLETED >>    <<01226>>06980000
                                                               <<01226>>06985000
   END;                                                                 06990000
$PAGE                                                                   06995000
   ASSEMBLE(                                                            07000000
     PCAL SIODM;     << MONITOR >>                                      07005000
     PCAL LPDRVR;    << INITIATOR >>                                    07010000
     PCAL LPDRVR;    << COMPLETOR >>                                    07015000
     CON  0;         << NO IO PROCESS >>                                07020000
     PCAL LPINIT;    << INITIALIZATION >>                               07025000
     CON  1;         << ONE INTERRUPT HANDLER >>                        07030000
     PCAL GIP'HPIB); << INTERRUPT HANDLER >>                   <<01301>>07035000
   END.                                                                 07040000
