$CONTROL MAP,CODE,USLINIT                                               00010000
  <<   HIOLPRT1, MODULE 38 - HP2631 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
$TITLE "HP2631 LINE PRINTER DRIVER - HPIB"                              00060000
$CONTROL PRIVILEGED,UNCALLABLE                                          00065000
$TP                                                                     00070000
                                                                        00075000
<<                                                                      00080000
                                                                        00085000
                                                                        00090000
        HP2631 [HP3000-HPIB] Line Printer Driver - HIOLPRT1             00095000
        ---------------------------------------------------             00100000
                                                                        00105000
                                                                        00110000
Structure of HIOLPRT1:                                                  00115000
                                                                        00120000
HIOLPRT1, 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
HIOLPRT1 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 HIOLPRT1:                                                  00240000
                                                                        00245000
The primary working code of HIOLPRT1 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 2631        00435000
controller.)  The following diagram shows the DIT used for the          00440000
2631 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            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|                                      |PS|FL|TP|   DSAVE            00535000
   +-----------------------------------------------+                    00540000
  7| Hardware error status.  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| Holds the time out request entry index while  |   DRQST            00575000
   | a timer is active.                            |                    00580000
   +-----------------------------------------------+                    00585000
%12|IOT  |/////////////| Phyical unit number       |   DUNIT            00590000
   +-----------------------------------------------+                    00595000
%13|         Hardware logged error status          |   DLOGEROR         00600000
   +-----------------------------------------------+                    00605000
                                                                        00610000
                                                                        00615000
DFLAG - Flags and request state                                         00620000
  AC  ACTIVE  - A monitor is currently servicing this device.           00625000
  RQ  REQUEST - A service request is pending while the monitor is       00630000
                active.                                                 00635000
  IO  IOPROG  - An I/O Channel Program is running for this device.      00640000
  IA  IAK     - An interrupt or response has occurred for this device.  00645000
  NO  NOTRDY  - Go to state %10 after Idle Channel Program is started.  00650000
  ST  STWAIT  - The device monitor is starting an Idle Channel Program  00655000
                for this device.  There is no IOQ associated with this  00660000
                type of request.                                        00665000
  STATE       - State of the device monitor.  Specifies the next action 00670000
                to be taken in SIODM in servicing the request:          00675000
                  0 - start new request                                 00680000
                  1 - not used                                          00685000
                  2 - call driver initiator procedure                   00690000
                  3 - call driver completor procedure                   00695000
                  4 - not used                                          00700000
                  5 - process request completed                         00705000
                  6 - initiate device recognition sequence              00710000
                  7 - start operator intervention wait                  00715000
                %10 - wait for interrupt (operator intervention)        00720000
                      restart at state 0                                00725000
                %11 - wait for data segment freeze, then state 2        00730000
                %12 - wait for driver initiator to be frozen, then      00735000
                      allocate controller (state 2)                     00740000
                %13 - wait for I/O completion interrupt, then state 3   00745000
                %14 - wait for controller, then call driver initiator   00750000
                %15 - not used                                          00755000
                %16 - wait for initiator make present, then state 2     00760000
                %17 - wait for completor make present, then state 3     00765000
                                                                        00770000
DLDEV - I/O system type, unit and logical device number                 00775000
  IOT I/O TYPE - Type of I/O system                                     00780000
             0 - HP3000 Series 2/3                                      00785000
             1 - HP3000 Series 33 (HPIB)                                00790000
             2 - Unused                                                 00795000
             3 - Unused                                                 00800000
                                                                        00805000
DSAVE - Device processing flags                                         00810000
  PS   PRESPACE  - Last request used prespacing.                        00815000
  FL   FULL      - Line printer buffer is full.                         00820000
  TP   TOP       - Printer is at top of form                            00825000
                                                                        00830000
$PAGE                                                                   00835000
                Interrupt Linkage Table (ILT)                           00840000
                -----------------------------                           00845000
                                                                        00850000
                                                                        00855000
There is one ILT for each device controller configured on the system.   00860000
A controller may support more than one unit, however the 2631           00865000
controller only supports one unit.                                      00870000
                                                                        00875000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          00880000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    00885000
  0|         Channel                               |   ICPVA0           00890000
  1|              Program                          |   ICPVA1           00895000
  2|                  Variable                     |   ICPVA2           00900000
  3|                       Area (ICPVA)            |   ICPVA3           00905000
   +-----------------------------------------------+                    00910000
  4|         DMA Abort                             |   ICPVA4           00915000
  5|              Address                          |   ICPVA5           00920000
   +-----------------------------------------------+                    00925000
  6|                      0                        |   ISRQL            00930000
   +--+-----------------+-----+-----------+--------+                    00935000
  7|LI|     CHANQUE     |     |   CHAN    |  DEV   |   ICNTRL           00940000
   +--+-----------------+-----+-----------+--------+                    00945000
%10| SYSDB relative pointer to Channel Program area|   ISIOP            00950000
   +-----------------------------------------------+                    00955000
%11| SYSDB relative pointer to Status Return area. |   ISTAP            00960000
   | (The 2631 driver does not use the Status      |                    00965000
   |  Return area so this entry is 0.)             |                    00970000
   +-----------------------------------------------+                    00975000
%12| single instruction that is executed to extract|   IUNIT            00980000
   | the device unit number from the status pointed|                    00985000
   | to by ISTAP.  (Since there is only one unit   |                    00990000
   | on the controller, this entry is not used.)   |                    00995000
   +-----------------------------------------------+                    01000000
%13| SYSDB relative DIT pointer of the device      |   ICDP             01005000
   | currently using the channel to perform a      |                    01010000
   | data operation.                               |                    01015000
   +-----------------------+-----------------------+                    01020000
%14|       SIOPSIZE        |        CQUEN          |   IQUEUE           01025000
   +--+--+--+--------------+-----------+-----------+                    01030000
%15|RW|WP|IG|                          |  HCUNIT   |   IFLAG            01035000
   +--+--+--+--------------------------+-----------+                    01040000
%16| SYSDB relative DIT pointer for unit 0         |   IDITP0           01045000
   +-----------------------------------------------+                    01050000
%17|             Line Printer                      |                    01055000
   .               Channel                         .                    01060000
   |                 Program                       |                    01065000
   +-----------------------------------------------+                    01070000
                                                                        01075000
                                                                        01080000
ICPVA0 - Channel Program Variable Area                                  01085000
                                                                        01090000
  The first word is used by the channel program processor to store      01095000
  status information after I/O channel aborts.  The next word is used   01100000
  by the driver to indicate if status should be examined for special    01105000
  conditions or errors.  The other two words are not used.              01110000
                                                                        01115000
                                                                        01120000
ICPVA4 - DMA abort address                                              01125000
                                                                        01130000
  If a DMA abort occurs, the absolute address where the abort occurred  01135000
  is stored in this area.                                               01140000
                                                                        01145000
                                                                        01150000
ICNTRL - Contains controller information                                01155000
                                                                        01160000
  LIM     - If this bit is set, the controller is sharing a software    01165000
            channel resource in order to limit bandwidth.               01170000
  CHANQUE - The software channel resource number.                       01175000
  CHAN    - Channel number (four most significant bits of DRTN).        01180000
  DEV     - Device number (three least significant bits of DRTN).       01185000
                                                                        01190000
                                                                        01195000
IQUEUE -                                                                01200000
                                                                        01205000
  SIOPSIZE - (number of words + 1)/2 in the channel program area.       01210000
  CQUEN    - For a multi-unit controller this field contains the        01215000
             software controller resource number.                       01220000
                                                                        01225000
                                                                        01230000
IFLAG - Controller and Channel Program state flags                      01235000
                                                                        01240000
  RUNWAIT  - An Idle Channel Program should be started when there       01245000
             are no active requests to process.  This flag is always    01250000
             0 for the 2631.                                            01255000
  WAITPROG - An Idle Channel Program has been started for this          01260000
             controller.  This bit is reset by an interrupt.            01265000
  IGNOREHI - An HIOP instruction has been issued against this	          01270000
             controller but the channel program was not in a wait       01275000
             statement.  Therefore ignore the interrupt generated by    01280000
             the channel code when this program halts.                  01285000
  HCUNIT   - Highest configured unit number for this controller.        01290000
                                                                        01295000
                                                                        01300000
                                                                        01305000
            Device Reference Table DRT                                  01310000
            --------------------------                                  01315000
                                                                        01320000
There is one DRT per device controller.  The the contents of this       01325000
table are used for processing interrupts.                               01330000
                                                                        01335000
     Word 0  SIOP   - Absolute address of the current I/O               01340000
                      instruction in execution.                         01345000
     Word 1  DBI    - Absolute address of the base of the ILT           01350000
                      for this controller.                              01355000
     Word 2  PLABLE - The external program label of the interrupt       01360000
                      service routine for this controller.              01365000
     Word 3  CHAN   - Contains channel program status information       01370000
                      which is used by the channel program interpreter. 01375000
$PAGE                                                                   01380000
            I/O QUEUE ELEMENT (IOQ)                                     01385000
            -----------------------                                     01390000
                                                                        01395000
                                                                        01400000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01405000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01410000
  0|      Request dependent flags (see below)      |   QFLAG            01415000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01420000
  1| SYSDB relative pointer to next IOQ element.   |   QLINK            01425000
   | Points to first word of element.              |                    01430000
   +-----------------------+-----------------------+                    01435000
  2|                       | Logical device number |   QLDEV            01440000
   +--+--+--+--------+-----+-----------+-----------+                    01445000
  3|PP|PE|PF|TOUTCNTR|                 | WAITCODE  |   QMISC            01450000
   +--+--+--+--------+-----------------+-----------+                    01455000
  4| S| If QFLAG.(3:1) is clear then this is the   |   QDSTN            01460000
   |  | DST number of the target data segment.  If |                    01465000
   |  | S is set, QADDR is DB relative.            |                    01470000
   +--+--------------------------------------------+                    01475000
  5| Offset in the data segment or system buffer   |   QADDR            01480000
   | table to the target data buffer.              |                    01485000
   +-----------------------+-----------------------+                    01490000
  6|                       | Function code for     |   QFUNC            01495000
   |                       | this request.  (See   |                    01500000
   |                       | next section.)        |                    01505000
   +-----------------------+-----------------------+                    01510000
  7| On initiation, specifies the word count (>0)  |   QWBCT            01515000
   | or byte count (<0).  At completion of the     |                    01520000
   | request this location contains the actual     |                    01525000
   | transmission count in the same units (bytes   |                    01530000
   | or words) as in the request.                  |                    01535000
   +-----------------------------------------------+                    01540000
%10| Parameter 1.  Vertical Format specification.  |   QPAR1            01545000
   | (See next section for detail.)                |                    01550000
   +-----------------------------------------------+                    01555000
%11| Parameter 2.  Space Mode Flags.  (See next    |   QPAR2            01560000
   | section for details.)                         |                    01565000
   +-----------------------+--------------+--------+                    01570000
%12|         PCBN          |  QUALIFIER   | STATUS |   QSTAT            01575000
   +-----------------------+--------------+--------+                    01580000
                                                                        01585000
                                                                        01590000
QFLAG - Request dependent flags                                         01595000
                                                                        01600000
  Bit 0  ABORT     - Abort this request and return an error indication  01605000
                     to the caller.                                     01610000
  Bit 1  SPECIAL   - Apply special handling to this request.  (Not used)01615000
  Bit 2  DIAG      - This is a request from the diagnostic subsystem.   01620000
                     (Not used)                                         01625000
  Bit 3  SYSBUFF   - Target is an index relative to the SBUF Table of   01630000
                     the data buffer.                                   01635000
  Bit 4  IOWAKE    - Wake caller on completion of request.              01640000
  Bit 5  BLOCKED   - Blocked I/O.  The caller is waited in ATTACHIO     01645000
                     until the request is completed.  Implies IOWAKE.   01650000
  Bit 6  COMPLETED - The request has been completed and the caller      01655000
                     awakened if he had requested (with IOWAKE).        01660000
  Bit 7  DATAFRZN  - Set by the memory management routines (MAM) when a 01665000
                     MAKEPRESENT request is successfully completed and  01670000
                     indicates the data segment is frozen in memory.    01675000
  Bit 8  MAMERRORD - An error has occurred while MAM was trying to      01680000
                     make the target data segment present and freeze    01685000
                     it in memory.                                      01690000
  Bit 9  PREQ      - (Not used)                                         01695000
  Bit 10 SFAIL     - Delayed failure of SIO instruction.  If a call to  01700000
                     STARTIO resulted in the request being added to     01705000
                     the channel queue, this bit indicates that the SIO 01710000
                     instruction failed when the request was selected   01715000
                     for execution.                                     01720000
  Bit 11 PFAIL     - The request was aborted because of a system power  01725000
                     failure.                                           01730000
                                                                        01735000
                                                                        01740000
QMISC - Driver request dependent flags and counters.                    01745000
                                                                        01750000
  PRE'TO'POST - Pre to post spacing change flag.                        01755000
  PEJECT      - Last operation was a page eject.                        01760000
  TOUTCNTR    - Channel time-out retry counter.                         01765000
  POWERFAIL   - Power fail flag indicates power fail occurred.          01770000
  WAITCODE    - Indicates type of wait:                                 01775000
                  0 - new request                                       01780000
                  1 - completion wait                                   01785000
                  2 - not ready wait                                    01790000
                                                                        01795000
                                                                        01800000
QSTAT - PCB number and request completion status.                       01805000
                                                                        01810000
  PCBN    - The Process Control Block (PCB) number of the process       01815000
            which made this request.  If zero, the request is not       01820000
            associated with any process and the IOQ element is to       01825000
            be returned by the system when the request has completed.   01830000
  STATUS  - General status indicating the final state of the request.   01835000
            The following codes are used:                               01840000
              0 - Not started or awaiting completion.                   01845000
              1 - Successful completion.                                01850000
              2 - End-of-file detected.                                 01855000
              3 - Unusual, but recoverable, condition detected.         01860000
              4 - Irrecoverable error has occurred.                     01865000
  QUALIFIER - A code which further defines or qualifies the general     01870000
              status.  (See the section Driver Return Status Codes.)    01875000
                                                                        01880000
$PAGE                                                                   01885000
                                                                        01890000
     LINE PRINTER REQUEST CODES -                                       01895000
                                                                        01900000
  OPERATION     FUNCTION          PARAMETERS                            01905000
                                                                        01910000
    WRITE          1      P1 - VERTICAL FORMAT SPECIFICATION            01915000
                                  1 - USE 1ST DATA CHAR AS FORMAT SPEC  01920000
                                                                        01925000
                                %53 - "+", PRINT AND SUPPRESS SPACING   01930000
                                %55 - "-", PRINT AND TRIPLE SPACE       01935000
                                %60 - "0", PRINT AND DOUBLE SPACE       01940000
                                %61 - "1", PRINT AND TOP OF FORM        01945000
                                                                        01950000
                                %200-%277, PRINT AND SPACE N-%200 LINES 01955000
                                %300-%307, PRINT WITH CHANNEL N-%277    01960000
                                                                        01965000
                                %320- FILL LINE PRINTER BUFFER ONLY     01970000
                                                                        01975000
                                ALL OTHERS, PRINT AND SINGLE SPACE      01980000
                                                                        01985000
                           P2 - SPACE MODE FLAGS                        01990000
                                (15:1) = PRESPACE FLAG                  01995000
                                   IF SET, PRINT THEN FILL BUFFER       02000000
                                   IF CLEAR, FILL BUFFER THEN PRINT     02005000
                                (14:1) = NO PAGE STEPOVER FLAG          02010000
                                   IF SET, SINGLE AND DOUBLE SPACE      02015000
                                     WITHOUT STEPOVER (66 LINES/PAGE)   02020000
                                   IF CLEAR, SINGLE AND DOUBLE SPACE    02025000
                                     WITH STEPOVER (60 LINES/PAGE)      02030000
                                                                        02035000
                                                                        02040000
    FILE OPEN      2      PAGE EJECT IF NOT AT TOP OF FORM              02045000
                                                                        02050000
    FILE CLOSE     3      PAGE EJECT IF NOT AT TOP OF FORM              02055000
                                                                        02060000
    DEVICE CLOSE   4      PAGE EJECT IF NOT AT TOP OF FORM              02065000
                                                                        02070000
    READ STATUS  %17      READ I/O STATUS                               02075000
                           COUNT - 1 BYTE MINIMUM REQUIRED              02080000
                                                                        02085000
    VFC SET     %100      LOADS VFC RAM                                 02090000
                           P1 -  1 - 1 LPI (LINES PER INCH)             02095000
                                 2 - 2 LPI                              02100000
                                 3 - 3 LPI                              02105000
                                 4 - 4 LPI                              02110000
                                 6 - 6 LPI                              02115000
                                 8 - 8 LPI                              02120000
                                12 - 12 LPI                             02125000
                                ANY OTHER VALUE DEFAULTS TO 6 LPI       02130000
$PAGE                                                                   02135000
                                                                        02140000
     STATUS RETURNS -                                                   02145000
                                                                        02150000
         1 - NORMAL COMPLETION                                          02155000
                                                                        02160000
        33 - REQUEST ABORTED EXTERNALLY                                 02165000
        63 - REQUEST ABORTED DUE TO POWER FAILURE                       02170000
       213 - DEVICE POWERED UP (RESTORE ENVIRONMENT)                    02175000
                                                                        02180000
         4 - INVALID REQUEST (FUNCTION OR PARAMETER)                    02185000
        24 - I/O TIMED OUT BEFORE COMPLETION                            02190000
        44 - SIO FAILURE                                                02195000
        54 - UNIT FAILURE                                               02200000
       124 - NO MESSAGE LINK BUFFERS AVAILABLE                          02205000
       144 - I/O CHANNEL FAILURE                                        02210000
                                                                        02215000
   NOTE:  WHEN POSTSPACE MODE FOLLOWS A PRESPACE OPERATION WHICH LEFT   02220000
          DATA IN THE PRINTER BUFFER, A SINGLE SPACE WITH PAGE STEPOVER 02225000
          IS EXECUTED TO CLEAR THE BUFFER BEFORE THE NEXT OPERATION IS  02230000
          PERFORMED.                                                    02235000
                                                                        02240000
          PAGE EJECTS ARE SUPPRESSED WHEN THE PREVIOUS OPERATION WAS    02245000
          A PAGE EJECT.                                                 02250000
                                                                        02255000
          IF THE NUMBER OF PRINTABLE CHARACTERS EXCEEDS THE CARRIAGE    02260000
          WIDTH, THE LINE WILL BE CONTINUED ON THE NEXT LINE AS THE     02265000
          2631 DOES NOT PERFORM LINE TRUNCATION.                        02270000
                                                                        02275000
                                                                        02280000
        2631 I/O STATUS BITS                                            02285000
                                                                        02290000
     0 - ON LINE                                                        02295000
                                                                        02300000
     1 - READY                                                          02305000
     2 - (NOT USED)                                                     02310000
     3 - (NOT USED)                                                     02315000
                                                                        02320000
     4 - PARITY ERROR                                                   02325000
     5 - (NOT USED)                                                     02330000
     6 - PAPER OUT                                                      02335000
                                                                        02340000
     7 - POWER RESTORED/UNIT RESET                                      02345000
                                                                        02350000
>>                                                                      02355000
$PAGE                                                                   02360000
   BEGIN                                                                02365000
$INCLUDE INCLIOQ                                               <<06723>>02370000
$PAGE                                                          <<06723>>02375000
     EQUATE                                                             02380000
                                                                        02385000
            << CHANNEL PROGRAM ARRAY POINTERS >>                        02390000
                                                                        02395000
       BADDR       =   29,  << WRITE DATA BUFFER ADDRESS >>             02400000
       BCOUNT      =   26,  << WRITE DATA BYTE COUNT >>                 02405000
       BUFFJMP     =   18,  << ON/OFF SWITCH FOR BUFF FILL >>           02410000
       DSJ'RB1     =    3,  << FIRST DSJ RETURN BYTE >>        <<01367>>02415000
       ESC'CTL     =   97,  << ONLINE ESC CODE BUFFER >>       <<01482>>02420000
       IDLE        =   49,  << START OF IDLE CHAN PROG >>               02425000
       MEMX        =   28,  << WRITE DATA BANK ADDRESS >>               02430000
       MODECMD     =   96,  << RESTRICTED MODE CMD BUFFER >>   <<01482>>02435000
       PBANK       =   47,  << POSTSPACE CTL BANK ADR >>       <<01367>>02440000
       PCOUNT      =   45,  << POSTSPACE BYTE COUNT >>         <<01367>>02445000
       POLLMASK    =   95,  << POLL MASK BUFFER >>             <<01482>>02450000
       PONCP       =   71,  << POWER ON INIT ROUTINE >>        <<01482>>02455000
       POST'CTL    =   93,  << POST-SPACE CONTROL BUFFER >>    <<01482>>02460000
       POSTJMP     =   43,  << ON/OFF SWITCH FOR POST-SPACING >>        02465000
       PRE'CTL     =   92,  << PRESPACE CONTROL BUFFER >>      <<01482>>02470000
       PREJMP      =    9,  << ON/OFF SWITCH FOR PRESPACING >>          02475000
       SCOUNT      =   58,  << READ STATUS BYTE COUNT >>       <<01201>>02480000
       SBANK       =   60,  << READ STATUS BANK ADDR >>        <<01201>>02485000
       STATADR     =   61,  << READ STATUS BUFFER ADDR >>      <<01201>>02490000
       STATUS      =   94,  << I/O STATUS BUFFER >>            <<01482>>02495000
       WRTCTL1     =   10,  << WRITE CONTROL INSTRUCTION >>             02500000
       WRTCTL2     =   44,  << WRITE CONTROL INSTRUCTION >>             02505000
                                                                        02510000
                                                                        02515000
       ABORTED     =  %33,  << REQUEST ABORTED RETURN STATUS >>         02520000
       CHANFAIL    = %144,  << I/O CHANNEL ERROR >>                     02525000
       CMPLTIONWAIT=    1,  << WAITING FOR I/O COMPLETION INTERRUPT >>  02530000
       DCLOSE      =    4,  << DEVICE CLOSE FUNCTION >>                 02535000
       DILTP       =    5,  << INTERRUPT LINKAGE TABLE POINTER >>       02540000
       DLDEV       =    3,  << LOGICAL DEVICE AND UNIT NUMBERS >>       02545000
       DLOGERROR   =   11,  << HARDWARE LOGGED ERROR STATUS>>  <<06723>>02550000
       DRQST       =    9,  << DRIVER REQUEST FLAGS >>         <<01301>>02555000
       DSAVE       =    6,  << DRIVER FLAGS >>                 <<01301>>02560000
       DSERR       =    7,  <<DIT HARDWARE COUNT & INDEX>>     <<01348>>02565000
       DTIME       =    8,  << TIME-OUT REQUEST ENTRY INDEX >> <<01301>>02570000
       FOPEN       =    2,  << FILE OPEN FUNCTION >>                    02575000
       FCLOSE      =    3,  << FILE CLOSE FUNCTION >>                   02580000
       FULL'       =   14,  << LINE PRINTER BUFFER FULL >>              02585000
       GOODIO      =    1,  << SUCCESSFUL I/O STATUS RETURN >>          02590000
       INITIOWAIT  =    3,  << INITIALIZE UNIT WAIT IN PROGRESS >>      02595000
       INTRPTWAIT  =  %13,  << WAIT FOR COMPLETION DRIVER RETURN >>     02600000
       INVALIDOP   =    4,  << INVALID OPERATION REQUESTED >>           02605000
       IOTIMER     =  %20,  << WAIT FOR CHANNEL PROG TO FINISH >>       02610000
       ISIOP       =    8,  << CHANNEL PROGRAM AREA POINTER >>          02615000
       NOTRDYMSG   =   11,  << NOT READY MESSAGE # TO MESS PROCESSOR >> 02620000
       NOTRDYWAIT  =    2,  << NOT READY WAIT IN PROGRESS >>            02625000
       NOTREADY    =    7,  << NOT READY DRIVER RETURN >>               02630000
       OPCONSOLE   =    0,  << OUTPUT MESSAGE TO OPERATOR >>            02635000
       PAPEROUTMSG =   14,  << PAPER OUT MESSAGE # TO MESS PROCESSOR >> 02640000
       PARITYERROR =   -1,  << PARITY ERROR LOGGING VALUE >>            02645000
       PFABORT     =  %63,  << REQUEST ABORTED DUE TO POWER FAIL >>     02650000
       POWERUP     = %213,  << UNIT RESET DUE TO POWER FAILURE >>       02655000
       PRESPACE'   =   13,  << LAST REQUEST USED PRESPACING >>          02660000
       QFUNC       =    6,  << FUNCTION CODE >>                         02665000
       QLINK       =    1,  << IOQ POINTER TO NEXT REQUEST >>           02670000
       QMISC       =    3,  << REQUEST STATE >>                         02675000
       QPAR1       =    8,  << CARRIAGE CONTROL SPECIFICATION >>        02680000
       QPAR2       =    9,  << PRESPACE AND STEPOVER REQUEST FLAGS >>   02685000
       QSTAT       =   10,  << REQUEST STATUS AND PCB NUMBER >>         02690000
       QWBCT       =    7,  << WORD/BYTE COUNT >>                       02695000
       REQUESTDONE =    5,  << REQUEST COMPLETED DRIVER RETURN >>       02700000
       SIOFAIL     =  %44,  << SIO FAILURE REQUEST STATUS >>            02705000
       SYSDB       =%1000,  << SET START OF SYSDB AREA >>               02710000
       SYSERROR    = %124,  << SYSTEM ERROR REQUEST STATUS >>           02715000
     ENDEQ         =    0;                                              02720000
                                                                        02725000
                                                                        02730000
                                                                        02735000
             << I/O STATUS BIT DEFINITIONS >>                           02740000
                                                                        02745000
     DEFINE                                                             02750000
       RDYBIT     = ( 1:1)#, << UNIT READY FOR DATA/COMMAND BIT >>      02755000
       PAPEROUT   = ( 6:1)#, << PAPER OUT INDICATOR >>                  02760000
       PARITYERR  = ( 4:1)#, << PARITY ERROR OCCURRED BIT >>            02765000
       PON        = ( 7:1)#, << UNIT POWERED UP OR WAS RESET >>         02770000
                                                                        02775000
                                                                        02780000
               << QMISC BIT DEFINITIONS >>                              02785000
                                                                        02790000
       PRE'TO'POST= ( 0:1)#, << PRE TO POST SPACING CHANGE FLAG >>      02795000
       PEJECT     = ( 1:1)#, << LAST OPERATION WAS A PAGE EJECT >>      02800000
       TOUTCNTR   = ( 3:3)#, << CHANNEL TIME-OUT RETRY COUNTER >>       02805000
       PONDONE    = ( 2:1)#, << POWER FAIL OCCURRED FLAG >>    <<01493>>02810000
       WAITCODE   = (12:4)#, << INDICATES TYPE OF WAIT >>               02815000
                             <<   0 - NEW REQUEST      >>               02820000
                             <<   1 - COMPLETION WAIT  >>               02825000
                             <<   2 - NOT READY WAIT   >>               02830000
                             <<   3 - INITIALIZE UNIT WAIT >>           02835000
                                                                        02840000
                                                                        02845000
            << DSAVE BIT DEFINITIONS >>                                 02850000
                                                                        02855000
       PRESPACE   = (13:1)#, << LAST REQUEST USED PRESPACING >>         02860000
       FULL       = (14:1)#, << LINE PRINTER BUFFER IS FULL >>          02865000
       TOP        = (15:1)#, << PRINTER IS AT TOP-OF-FORM (TOF) >>      02870000
                                                                        02875000
                                                                        02880000
             << MISCELLANEOUS BIT DEFINITIONS >>                        02885000
                                                                        02890000
       CMD        = (12:4)#, << SECONDARY COMMAND >>                    02895000
                                                               <<06723>>02900000
       ERRORCODE  = ( 0:3)#, << CPVAP, ERROR CODE >>                    02905000
       FUNC       = ( 8:8)#, << QFUNC, FUNCTION CODE >>                 02910000
       IOSTAT     = ( 8:8)#, << QSTAT, REQUEST STATUS RETURNED >>       02915000
       LRBIT      = ( 1:1)#, << WRITE INSTRUCTION LEFT/RIGHT BYTE BIT >>02920000
       PFAIL      = (11:1)#, << QFLAG, ABORT SET DUE TO POWER FAIL >>   02925000
       SFAIL      = (10:1)#, << QFLAG, FAILURE ON DELAYED START SIO >>  02930000
       STEPOVER   = (14:1)#, << IF SET THEN NO PAGE STEPOVER >>         02935000
       TIMEDOUT   = (13:1)#, << CPVAP, TRANSFER ABORTED DUE TO TO >>    02940000
       ASMB       = ASSEMBLE#,                                 <<01367>>02945000
       HIOP       = CON %20302; CON 1#,                        <<01367>>02950000
       LOADMEMORY = ASSEMBLE(LSEA)#,                                    02955000
     ENDDEF       = 0#;                                                 02960000
                                                                        02965000
                                                                        02970000
                                                                        02975000
$PAGE                                                                   02980000
<<      *********************************                               02985000
        *                               *                               02990000
        *   DRIVER DB AREA DEFINITION   *                               02995000
        *                               *                               03000000
        *********************************       >>                      03005000
                                                                        03010000
                                                                        03015000
ARRAY INITIAL(0:113)= DB:=                                     <<06723>>03020000
       [8/12,8/1],<<DIT SIZE,NOT CORE RES/NO IDLE CP/DVR TYPE>><<06723>>03025000
                0,   << NOT USED >>                                     03030000
                0,   << UNIT EXTRACT INSTRUCTION - NOT USED >>          03035000
       [8/49,8/1],   << CP SIZE/2, STATUS RETURN SIZE >>       <<06723>>03040000
                                                                        03045000
       << LP DIT >>                                                     03050000
                0,   << DFLAG >>                                        03055000
                0,   << DLINK >>                                        03060000
                0,   << DIOQP >>                                        03065000
                0,   << DLDEV >>                               <<06723>>03070000
                0,   << DDLTP >>                                        03075000
                0,   << DILTP >>                                        03080000
                0,   << DSAVE >>                               <<01301>>03085000
                0,   << DSERR >>                                        03090000
                0,   << DTIME >>                               <<01301>>03095000
                0,   << DRQST >>                               <<01301>>03100000
          %040000,   << HP-IB DEVICE - DUNIT >>                <<06723>>03105000
                0,   << DLOGERROR >>                           <<01348>>03110000
                                                                        03115000
                                                                        03120000
       << CHANNEL PROGRAM >>                                            03125000
                                                                        03130000
<< 0>> << WAIT >>           %1000,  << MAKE SURE UNIT IS RESPONDING >>  03135000
<< 1>>                          0,                                      03140000
                                                                        03145000
<< 2>> << DSJ >>            %2403,  << CHECK PRINTER'S CONDITION >>     03150000
<< 3>>                          0,     << RETURN BYTE >>                03155000
<< 4>>                          0,     << JMP *+0, READY FOR COMMAND >> 03160000
<< 5>>                         56,     << JMP *+56, ERROR, READ STAT >> 03165000
<< 6>>                         56,     << JMP *+56, STAT READ REQUIRED>>03170000
<< 7>>                         56,     << JMP *+56, PARITY ERROR >>     03175000
                                                                        03180000
<< 8>> << JUMP >>               0,  << JUMP *+0 FOR PRESPACE REQUEST >> 03185000
<< 9>>                          0,  << JUMP *+7 OTHERWISE >>            03190000
                                                                        03195000
<<10>> << WRITE CONTROL >>  %2010,  << PRESPACE WRITE CONTROL/SET VFC >>03200000
<<11>>                          1,                                      03205000
<<12>>                          0,                                      03210000
<<13>>                     %42000,                                      03215000
<<14>>                          0,                                      03220000
                                                                        03225000
<<15>> << WAIT >>           %1000,  << WAIT FOR UNIT TO PARALLEL POLL >>03230000
<<16>>                          0,                                      03235000
                                                                        03240000
<<17>> << JUMP >>               0,  << JUMP *+0 FOR BUFFER FILL >>      03245000
<<18>>                          0,  << JUMP *+23 OTHERWISE >>           03250000
                                                                        03255000
<<19>> << DSJ >>            %2403,  << CHECK PRINTER'S CONDITION >>     03260000
<<20>>                          0,     << RETURN BYTE >>                03265000
<<21>>                          0,     << JMP*+0, READY FOR NEXT BURST>>03270000
<<22>>                         39,     << JMP*+39, ERROR, READ STATUS >>03275000
<<23>>                         39,     << JMP*+39, STAT READ REQUIRED >>03280000
<<24>>                          0,     << JMP*+0, N/A IN BURST LOOP >>  03285000
                                                                        03290000
<<25>> << WRITE DATA >>     %2000,  << WRITE OUT DATA BUFFER >>         03295000
<<26>>                          0,                                      03300000
<<27>>                          7,     << BURST OF 7 BYTES >>           03305000
<<28>>                    %100000,                                      03310000
<<29>>                          0,                                      03315000
                                                                        03320000
<<30>> << JUMP >>               0,  << JUMP *+2, END OF TRANSFER >>     03325000
<<31>>                          2,                                      03330000
                                                                        03335000
<<32>> << JUMP >>               0,  << JUMP *-19, END OF BURST >>       03340000
<<33>>                        -19,                                      03345000
                                                                        03350000
<<34>> << WAIT >>           %1000,  << WAIT FOR UNIT TO PARALLEL POLL >>03355000
<<35>>                          0,                                      03360000
                                                                        03365000
<<36>> << DSJ >>            %2403,  << CHECK PRINTER'S STATE >>         03370000
<<37>>                          0,     << RETURN BYTE >>                03375000
<<38>>                          0,     << JMP *+0, READY FOR COMMAND >> 03380000
<<39>>                         22,     << JMP *+22, ERROR - READ STAT >>03385000
<<40>>                         22,     << JMP *+22, STAT READ REQUIRED>>03390000
<<41>>                          0,     << JMP *+0, PARITY ERROR >>      03395000
                                                                        03400000
<<42>> << JUMP >>               0,  << JUMP *+0 FOR POSTSPACE REQUEST >>03405000
<<43>>                          0,  << JUMP *+7 OTHERWISE >>            03410000
                                                                        03415000
<<44>> << WRITE CONTROL >>  %2010,  << POSTSPACE WRITE CONTROL >>       03420000
<<45>>                          1,                                      03425000
<<46>>                          0,                                      03430000
<<47>>                     %44000,                             <<01367>>03435000
<<48>>                          0,                                      03440000
                                                                        03445000
<<49>> << WAIT >>           %1000,  << WAIT FOR UNIT TO PARALLEL POLL >>03450000
<<50>>                          0,                                      03455000
                                                                        03460000
<<51>> << DSJ >>            %2403,  << CHECK PRINTER'S STATE >>         03465000
<<52>>                          0,     << RETURN BYTE >>                03470000
<<53>>                          0,     << JMP *+0, READY FOR COMMAND >> 03475000
<<54>>                          7,     << JMP *+7, ERROR - READ STAT >> 03480000
<<55>>                          7,     << JMP *+7, STAT READ REQUIRED >>03485000
<<56>>                          0,     << JMP *+0, PARITY ERROR >>      03490000
                                                                        03495000
<<57>> << READ STATUS >>    %1416,  << READ STATUS BYTE >>              03500000
<<58>>                          1,                                      03505000
<<59>>                          0,                                      03510000
<<60>>                      %2000,                                      03515000
<<61>>                          0,                                      03520000
                                                                        03525000
<<62>> << INT/HLT >>         %601,  << INTERRUPT/HALT AND PUT HALT >>   03530000
<<63>>                          1,     <<CODE OF 1 IN CPVA WORD 1 >>    03535000
                                                                        03540000
<<64>> << READ STATUS >>    %1416,  << READ STATUS BYTE >>              03545000
<<65>>                          1,                                      03550000
<<66>>                          0,                                      03555000
<<67>>                      %2000,                                      03560000
<<68>>                          0,                                      03565000
                                                                        03570000
<<69>> << INT/HLT >>         %601,  << INTERRUPT/HALT AND PUT HALT >>   03575000
<<70>>                          2,     << CODE OF 2 IN CPVA WORD 1 >>   03580000
                                                               <<01482>>03585000
       << POWER ON INITIATION ROUTINE >>                       <<01482>>03590000
                                                               <<01482>>03595000
<<71>> << WRITE COMMAND >>  %2000,  << SET LP ONLINE >>        <<01482>>03600000
<<72>>                          2,                             <<01482>>03605000
<<73>>                          0,                             <<01482>>03610000
<<74>>                      %2000,                             <<01482>>03615000
<<75>>                          0,  << ESC (ONLINE) ADR >>     <<01482>>03620000
                                                               <<01482>>03625000
<<76>> << WAIT >>           %1000,                             <<01482>>03630000
<<77>>                          0,                             <<01482>>03635000
                                                               <<01482>>03640000
       << INITIALIZATION ROUTINE >>                            <<01482>>03645000
                                                               <<01482>>03650000
<<78>> << CLEAR >>          %4401,  << CLR W/PARITY CHECK >>   <<01482>>03655000
<<79>>                          0,                             <<01482>>03660000
                                                               <<01482>>03665000
<<80>> << WRITE COMMAND >>  %2001,  << SET POLL MASK CMD >>    <<01482>>03670000
<<81>>                          1,                             <<01482>>03675000
<<82>>                          0,                             <<01482>>03680000
<<83>>                     %42000,                             <<01482>>03685000
<<84>>                          0,                             <<01482>>03690000
                                                               <<01482>>03695000
<<85>> << WRITE COMMAND >>  %2002,  << RESTRICTED MODE CMD >>  <<01482>>03700000
<<86>>                          1,                             <<01482>>03705000
<<87>>                          0,                             <<01482>>03710000
<<88>>                     %42000,                             <<01482>>03715000
<<89>>                          0,                             <<01482>>03720000
                                                               <<01482>>03725000
<<90>> << INT/HLT >>         %601,  << INT/HLT & PUT HALT >>   <<01482>>03730000
<<91>>                          0,  << CODE 0 IN CPVAP(1) >>   <<01482>>03735000
                                                               <<01482>>03740000
<<92>> << BUFFERS >>            0,  << PRESPACE CONTROL >>     <<01482>>03745000
<<93>>                          0,  << POSTSPACE CONTROL >>    <<01482>>03750000
<<94>>                          0,  << STATUS BUFFER >>        <<01482>>03755000
<<95>>                       %330,  << POLL MASK >>            <<01482>>03760000
<<96>>                       %202,  << RESTRICTED MODE CODE >> <<01482>>03765000
<<97>>                    %015556;  << ONLINE ESC SEQ >>       <<01482>>03770000
$PAGE                                                                   03775000
<<       ***************************************                        03780000
         *                                     *                        03785000
         *   EXTERNAL PROCEDURE DECLARATIONS   *                        03790000
         *                                     *                        03795000
         ***************************************     >>                 03800000
                                                                        03805000
                                                                        03810000
   PROCEDURE ABORTTIMEREQ(TRLX);                                        03815000
     VALUE TRLX;   INTEGER TRLX;                                        03820000
     OPTION EXTERNAL;                                                   03825000
                                                                        03830000
   PROCEDURE GIP'HPIB;                                         <<01301>>03835000
     OPTION EXTERNAL;                                                   03840000
                                                                        03845000
   PROCEDURE HELP;                                                      03850000
     OPTION EXTERNAL;                                                   03855000
                                                                        03860000
   LOGICAL PROCEDURE IOMESSAGE(SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,    03865000
                               REPLY,OFFSET,DITP,IOTYPE);               03870000
     VALUE  SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,          03875000
            DITP,IOTYPE;                                                03880000
     INTEGER  SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,IOTYPE; 03885000
     INTEGER POINTER  DITP;                                             03890000
     OPTION VARIABLE, EXTERNAL;                                         03895000
                                                                        03900000
   PROCEDURE SIODM(DITP,FLAGS);                                         03905000
     VALUE DITP,FLAGS;   LOGICAL FLAGS;                                 03910000
     POINTER DITP;   OPTION EXTERNAL;                                   03915000
                                                                        03920000
   PROCEDURE MASTERCLEARHPIB(DITP);                            <<01301>>03925000
     ARRAY DITP;   OPTION EXTERNAL;                                     03930000
                                                                        03935000
   PROCEDURE START'HPIB(DITP,SIOP,QFLAG);                      <<01301>>03940000
     VALUE DITP,SIOP,QFLAG;   LOGICAL QFLAG;                            03945000
     POINTER DITP,SIOP;   OPTION EXTERNAL;                              03950000
                                                                        03955000
   INTEGER PROCEDURE TIMEREQ(CODE,REQ,TIME);                            03960000
     VALUE CODE,REQ,TIME;                                               03965000
     INTEGER CODE,REQ;   DOUBLE TIME;                                   03970000
     OPTION EXTERNAL;                                                   03975000
$PAGE                                                                   03980000
<<       ******************************************                     03985000
         *                                        *                     03990000
         *   LP DRIVER INITIALIZATION PROCEDURE   *                     03995000
         *                                        *                     04000000
         ******************************************     >>              04005000
                                                                        04010000
                                                                        04015000
   PROCEDURE LPINIT(DITP);                                              04020000
     INTEGER ARRAY DITP;                                                04025000
                                                                        04030000
<<                                                                      04035000
       THIS PROCEDURE INITIALIZES THE PRESPACING, POST-SPACING, AND     04040000
       STATUS BUFFER ADDRESSES IN THE CHANNEL PROGRAM.                  04045000
>>                                                                      04050000
     BEGIN                                                              04055000
       INTEGER POINTER   ILTP = Q+1;                                    04060000
       INTEGER POINTER   SIOP = Q+2;                                    04065000
       INTEGER        SIOBASE = Q+3;                                    04070000
                                                                        04075000
                                                                        04080000
       TOS := DITP(DILTP);      << ILTP    >>                           04085000
       TOS := ILTP(ISIOP);      << SIOP    >>                           04090000
       TOS := @SIOP + SYSDB;    << SIOBASE >>                           04095000
                                                                        04100000
       SIOP(14) := SIOBASE + PRE'CTL;                                   04105000
       SIOP(48) := SIOBASE + POST'CTL;                                  04110000
       SIOP(75) := SIOBASE + ESC'CTL;                          <<01482>>04115000
       SIOP(68) := SIOBASE + STATUS;                                    04120000
       SIOP(84) := SIOBASE + POLLMASK;                         <<01482>>04125000
       SIOP(89) := SIOBASE + MODECMD;                          <<01482>>04130000
                                                                        04135000
     END;                                                               04140000
$PAGE                                                                   04145000
<<       ************************************************               04150000
         *                                              *               04155000
         *   LINE PRINTER DRIVER PROCEDURE  -  LPDRVR   *               04160000
         *                                              *               04165000
         ************************************************     >>        04170000
                                                                        04175000
                                                                        04180000
                                                                        04185000
   INTEGER PROCEDURE LPDRVR(IOQP,DITP,BANK,BUFFADDR,SIOP,DRTN);<<01301>>04190000
<<                                                                      04195000
       THIS PROCEDURE INITIATES AND COMPLETES I/O REQUESTS              04200000
       FOR THE HP 2631 LINE PRINTER CONNECTED TO THE HP-IB              04205000
       AND CONTROLLED BY THE GIC.                                       04210000
                                                                        04215000
       MODE RETURNS IN LPDRVR -                                         04220000
           5 - REQUEST COMPLETED                                        04225000
           7 - NOT READY WAIT                                           04230000
         %13 - WAIT FOR COMPLETION                              >>      04235000
                                                                        04240000
   VALUE  DITP,IOQP,BANK,BUFFADDR,SIOP,DRTN;                   <<01301>>04245000
   INTEGER BANK, BUFFADDR, DRTN, IOQP;                         <<06723>>04250000
   INTEGER POINTER DITP, SIOP;                                 <<06723>>04255000
   OPTION  PRIVILEGED,UNCALLABLE;                                       04260000
                                                                        04265000
   BEGIN                                                                04270000
     LOGICAL ARRAY                                                      04275000
       DITPL(*) = DITP, SIOPL(*) = SIOP;                       <<06723>>04280000
                                                                        04285000
     DOUBLE                                                             04290000
       BUFFADDRD = Q-7;    << BANK AND BUFFER ADDRESS >>       <<01301>>04295000
                                                                        04300000
     INTEGER POINTER                                                    04305000
       CPVAP    = Q+1,    << HOLDS CHANNEL I/O STATUS >>                04310000
       IDLESIOP = Q+2,    << POINTS TO START OF IDLE CHAN PROG >>       04315000
       INITSIOP = Q+3,    << POINTS TO START OF INIT CP >>     <<01367>>04320000
       STATSIOP = Q+8,    << POINTS TO CP STATUS READ >>       <<01367>>04325000
       FILLSIOP = Q+9,    << POINTS TO FILL BUFFER >>          <<01367>>04330000
       POSTSIOP = Q+10;   << POINTS TO POSTSPACE PRT >>        <<01367>>04335000
                                                                        04340000
     INTEGER                                                            04345000
       COUNT    = Q+4,    << BUFFER BYTE COUNT >>                       04350000
       PARAM    = Q+5,    << CONTROL PARAMETER >>                       04355000
       PRINTCTL = Q+6,    << PRINT CONTROL BYTE >>                      04360000
       FCODE    = Q+7,    << FUNCTION CODE >>                           04365000
       S0       = S-0;                                                  04370000
                                                                        04375000
     LOGICAL                                                   <<06723>>04380000
       IOQ'ENTRY'INDEX = Q+11;                                 <<06723>>04385000
$PAGE                                                                   04390000
   << INITIALIZE LOCAL POINTERS AND VARIABLES >>                        04395000
                                                                        04400000
     TOS := DITP(DILTP);     << CPVAP >>                                04405000
     TOS := @SIOP+IDLE;      << IDLESIOP >>                             04410000
     TOS := @SIOP+PONCP;     << PONSIOP  >>                    <<01482>>04415000
     TOS:= 0;                << STACK DUMMY COUNT >>           <<06723>>04420000
     TOS := 0;               << PARAM >>                                04425000
     TOS := 0;               << PRINTCTL >>                             04430000
     TOS:= 0;                << STACK DUMMY FCODE >>           <<06723>>04435000
     TOS := @SIOP+57;        << STATSIOP >>                    <<01201>>04440000
     TOS := @SIOP+15;        << FILLSIOP >>                    <<01367>>04445000
     TOS := @SIOP+34;        << POSTSIOP >>                    <<01367>>04450000
     TOS:= IOQP;             << IOQ'ENTRY'INDEX:= IOQP >>      <<06723>>04455000
     COUNT:= IOQ'COUNT;                                        <<06723>>04460000
     FCODE:= IOQ'FUNC;                                         <<06723>>04465000
                                                                        04470000
     IF IOQ'ENTRY'INDEX = 0 THEN GOTO EXIT; << NOTHING TO DO >><<06723>>04475000
                                                                        04480000
     IF IOQ'QMISC.WAITCODE = CMPLTIONWAIT THEN                 <<06723>>04485000
       ABORTTIMEREQ(DITP(DRQST));                              <<01301>>04490000
                                                                        04495000
     TOS:= IOQ'FLAGS;                                          <<06723>>04500000
     IF < THEN      << ABORT PROCESS >>                                 04505000
       BEGIN                                                            04510000
         TOS:= IF IOQ'PFAIL THEN PFABORT ELSE ABORTED;         <<06723>>04515000
         GOTO BADIO;                                                    04520000
         HELP;     << LINK >>                                           04525000
       END;                                                             04530000
     DEL;                                                      <<01367>>04535000
                                                                        04540000
     IF IOQ'QMISC.WAITCODE = NOTRDYWAIT THEN                   <<06723>>04545000
       BEGIN   << RETURN FROM NOT READY COND >>                <<01493>>04550000
         IOQ'QMISC.PONDONE:= 0;                                <<06723>>04555000
         IF <> OR SIOP(STATUS).PON = 1 THEN  << PON OCCURRED >><<01493>>04560000
           GOTO PONINIT;                                       <<01493>>04565000
         IF SIOP(DSJ'RB1) <> 7 THEN                            <<01493>>04570000
           BEGIN                                               <<01493>>04575000
           TOS := DRTN;                                        <<01493>>04580000
           ASMB( HIOP );  << HALT ANY INCOMPLETE CHAN PROG >>  <<01493>>04585000
           GO TO RESTART;                                      <<01493>>04590000
           END;                                                <<01493>>04595000
       END;                                                    <<01493>>04600000
                                                               <<01493>>04605000
                                                                        04610000
     IF IOQ'QMISC.WAITCODE = CMPLTIONWAIT THEN                 <<06723>>04615000
       GOTO LPCONT;                                                     04620000
                                                                        04625000
     IF IOQ'QMISC.WAITCODE = INITIOWAIT THEN                   <<06723>>04630000
       BEGIN                                                            04635000
         TOS := POWERUP;                                                04640000
         GOTO IODONE;                                                   04645000
       END;                                                             04650000
                                                                        04655000
     SIOP(BUFFJMP) := 23;                                               04660000
     SIOP(PREJMP) := SIOP(POSTJMP) := 7;  << INIT CP >>                 04665000
     SIOP(WRTCTL1).CMD := %10;  << INIT WRITE CTL TO PRINT COMMAND >>   04670000
     SIOP(WRTCTL2).CMD := %10;  << INIT WRITE CTL TO PRINT COMMAND >>   04675000
     SIOP(SCOUNT) := 1;  << READ SINGLE STATUS >>              <<01201>>04680000
     SIOP(SBANK).(8:8) := 0;                                   <<01201>>04685000
     SIOP(STATADR) := @SIOP+SYSDB+STATUS;  << CP STAT ADR >>   <<01482>>04690000
     SIOP(PCOUNT) := 1;  << RESET POSTSP CTRL CNT >>           <<01367>>04695000
     SIOP(PBANK).LRBIT := 1;  << RESET RT BYTE BIT >>          <<01367>>04700000
                                                                        04705000
                                                                        04710000
          << CHECK FOR FOPEN, FCLOSE, AND DCLOSE  (FCODE = 2,3, OR 4) >>04715000
                                                                        04720000
     IF FCODE = DCLOSE THEN                                             04725000
       BEGIN                                                            04730000
         IF DITP(DSAVE).(FULL':2) <> 1 THEN  << EJECT A PAGE >><<02695>>04735000
           BEGIN                                                        04740000
             SIOP(PREJMP) := 0;                                         04745000
             SIOP(PRE'CTL) := %100;                                     04750000
           END;                                                         04755000
         DITP(DSAVE) := 1;   << SET TOF FLAG >>                         04760000
                                                               <<02694>>04765000
                                                               <<02694>>04770000
                                                               <<02694>>04775000
       IOQ'QMISC.PEJECT:= 1;                                   <<06723>>04780000
         GOTO STARTPRINT;                                               04785000
       END                                                              04790000
                                                                        04795000
                                                                        04800000
     ELSE  IF FCODE=FOPEN OR FCODE=FCLOSE THEN                          04805000
       BEGIN                                                            04810000
         IF DITP(DSAVE).(FULL':2) = 1 THEN                     <<02695>>04815000
           GOTO PRINTDONE;  << EMPTY BUFFER & ALREADY AT TOP >><<02695>>04820000
         DITP(DSAVE).FULL := 0;  << SET BUFFER EMPTY >>        <<02695>>04825000
       IOQ'QMISC.PEJECT:= 1;   <<SET PAGE EJECT FLAG >>        <<06723>>04830000
         SIOP(POSTJMP) := 0;                                   <<01367>>04835000
         SIOP(POST'CTL) := %100;  << SKIP TO TOP OF PAGE >>    <<01367>>04840000
         GOTO STARTPRINT;                                      <<01367>>04845000
       END                                                              04850000
                                                                        04855000
          << CHECK FOR FWRITE  (FCODE = 1) >>                           04860000
   ELSE IF FCODE = 1 THEN                                               04865000
     BEGIN                                                              04870000
                                                                        04875000
                                                                        04880000
     IF DITP(DSAVE).(PRESPACE':2)= 3 AND NOT IOQ'PARM2 THEN    <<06723>>04885000
       BEGIN                                                            04890000
         SIOP(PREJMP) := 0;                                             04895000
         IF IOQ'PARM2.STEPOVER THEN  << NO AUTO EJECT >>       <<06723>>04900000
           SIOP(PRE'CTL) := 1  << SINGLE SPACE W/O STEPOVER >> <<02695>>04905000
         ELSE  << AUTO PAGE EJECT >>                           <<02695>>04910000
         SIOP(PRE'CTL) := %102;         << ISSUE SINGLE SPACE WITH >>   04915000
         IOQ'QMISC.PRE'TO'POST:= 1; << STEPOVER TO CLR BUFF >> <<06723>>04920000
       END;                                                             04925000
                                                                        04930000
     TOS:= IOQ'COUNT;                                          <<06723>>04935000
     IF < THEN             << BYTE COUNT >>                             04940000
       COUNT := -TOS         << MAKE POSITIVE >>                        04945000
     ELSE                  << WORD COUNT >>                             04950000
       COUNT := TOS&ASL(1);  << CHANGE TO BYTE COUNT >>                 04955000
                                                                        04960000
     IF IOQ'PARM1= 1 THEN  << IMBEDDED CONTROL >>              <<06723>>04965000
       BEGIN                                                            04970000
         IF COUNT = 0 THEN    << INVALID OPERATION >>                   04975000
           BEGIN                                                        04980000
             TOS := INVALIDOP;                                          04985000
             GOTO IODONE;                                               04990000
           END;                                                         04995000
         TOS := BUFFADDRD;    << LOAD BANK AND BUFF ADDRESS >>          05000000
         LOADMEMORY;             << LOAD FIRST WORD >>                  05005000
         PARAM := TOS&LSR(8);    << ISOLATE AND SAVE CONTROL PARAM >>   05010000
         COUNT := COUNT - 1;     << DECREMENT BYTE COUNT >>             05015000
       END                                                              05020000
     ELSE                      << CONTROL IN PARAM WORD >>              05025000
       PARAM:= IOQ'PARM1;                                      <<06723>>05030000
                                                                        05035000
     DITP(DSAVE).PRESPACE:= IF IOQ'PARM2                       <<06723>>05040000
       THEN 1 ELSE 0;                 << SET PRESPACE FLAG >>           05045000
                                                                        05050000
                                                                        05055000
        << INITIALIZE PRINT CONTROL BYTE >>                             05060000
                                                                        05065000
     IF IOQ'PARM2.STEPOVER THEN << SINGLE SPACE NO STEPOVER >> <<06723>>05070000
       PRINTCTL := 1                                                    05075000
     ELSE                           << SINGLE SPACE WITH STEPOVER >>    05080000
       PRINTCTL := %102;                                                05085000
                                                                        05090000
                                                                        05095000
        << SETUP PRINT CONTROL BYTE >>                                  05100000
                                                                        05105000
     IF PARAM = "+" THEN            << SUPPRESS SPACING >>              05110000
       PRINTCTL := 0                                                    05115000
                                                                        05120000
     ELSE IF PARAM = "0" THEN       << DOUBLE SPACE >>                  05125000
       PRINTCTL := PRINTCTL + 1                                         05130000
                                                                        05135000
     ELSE IF PARAM = "-" THEN       << TRIPLE SPACE >>                  05140000
       PRINTCTL := PRINTCTL + 2                                         05145000
                                                                        05150000
     ELSE IF PARAM = "1" THEN       << TOP OF FORM >>                   05155000
       BEGIN                                                            05160000
         IF COUNT=0 AND DITP(DSAVE).(FULL':2)=1 THEN                    05165000
           GOTO PRINTDONE;  << EMPTY BUFFER AND ALREADY AT TOP >>       05170000
         PRINTCTL := %100;                                              05175000
         IOQ'QMISC.PEJECT:= 1;  << SET PAGE EJECT FLAG >>      <<06723>>05180000
       END                                                              05185000
                                                                        05190000
     ELSE IF %200 <= PARAM <= %277 THEN  << SLEW N LINES >>             05195000
       PRINTCTL := PARAM - %200                                         05200000
                                                                        05205000
     ELSE IF %300 <= PARAM <= %307 THEN  << SELECT CHANNEL N >>         05210000
       PRINTCTL := PARAM - %200                                         05215000
                                                                        05220000
     ELSE IF PARAM = %320 THEN      << BUFFER FILL ONLY >>              05225000
       BEGIN                                                            05230000
         PRINTCTL := -1;                                                05235000
         IF IOQ'QMISC.PRE'TO'POST= 0 AND COUNT= 0 THEN         <<06723>>05240000
           GOTO PRINTDONE;                                              05245000
       END;                                                             05250000
                                                                        05255000
                                                                        05260000
<<  SETUP CHANNEL PROGRAM FOR BUFFER FILL AND PRINT CONTROL  >>         05265000
                                                                        05270000
  PRINTSETUP:                                                           05275000
     IF PRINTCTL >= 0 THEN    << SETUP PRINT CONTROL >>                 05280000
       BEGIN                                                            05285000
         DITP(DSAVE).FULL := 0;                                         05290000
         IF DITP(DSAVE).PRESPACE=1 THEN    << PRESPACE >>               05295000
           BEGIN                                                        05300000
             SIOP(PREJMP) := 0;                                         05305000
             SIOP(PRE'CTL) := PRINTCTL;                                 05310000
           END                                                          05315000
         ELSE                              << POST-SPACE >>             05320000
           BEGIN                                                        05325000
             SIOP(POSTJMP) := 0;                                        05330000
             SIOP(POST'CTL) := PRINTCTL;                                05335000
           END;                                                         05340000
       END;                                                             05345000
                                                                        05350000
                                                                        05355000
     IF COUNT <> 0 THEN        << SETUP BUFFER FILL >>                  05360000
       BEGIN                                                            05365000
         SIOP(BUFFJMP) := 0;                                            05370000
         SIOP(BCOUNT) := COUNT;                                         05375000
         SIOP(MEMX).(8:8) := BANK;                                      05380000
         SIOP(MEMX).LRBIT:= IF IOQ'PARM1= 1 << IMBED CONTROL >><<06723>>05385000
           THEN 1 ELSE 0;               << START WITH RIGHT BYTE >>     05390000
         SIOP(BADDR) := BUFFADDR;                                       05395000
         DITP(DSAVE).FULL := IF DITPL(DSAVE).PRESPACE                   05400000
           THEN 1 ELSE 0;    << IF PRESPACING INDICATE BUFF IS FULL >>  05405000
       END;                                                             05410000
                                                                        05415000
                                                                        05420000
                                                                        05425000
<<  START CHANNEL PROGRAM  >>                                           05430000
                                                                        05435000
  STARTPRINT:                                                           05440000
     CPVAP := 0;                << CLEAR CHANNEL STATUS WORD >>         05445000
     SIOP(DSJ'RB1) := 7;        << INIT 1ST DSJ RETURN BYTE >> <<01367>>05450000
     SIOP(STATUS) := 0;         << CLEAR CP STATUS WORD >>              05455000
                                                                        05460000
     START'HPIB(DITP,SIOP,TRUE);   << START CHANNEL PROGRAM >> <<01301>>05465000
PRINTCONT:                                                     <<01201>>05470000
     IF < THEN      << SIO FAILURE >>                                   05475000
       BEGIN                                                            05480000
         TOS := SIOFAIL;                                                05485000
         GOTO BADIO;                                                    05490000
       END;                                                             05495000
                                                                        05500000
     IOQ'QMISC.WAITCODE:= CMPLTIONWAIT; << SET REQUEST STATE >><<06723>>05505000
     DITP(DTIME) := 0;                                         <<01301>>05510000
     DITP(DRQST) := TIMEREQ(IOTIMER,@DITP,4000D);              <<01301>>05515000
     LPDRVR := INTRPTWAIT;                                              05520000
     RETURN;                                                            05525000
                                                                        05530000
                                                                        05535000
     END      << OF WRITE LOGIC (FUNCTION CODE = 1) >>                  05540000
                                                                        05545000
                                                                        05550000
                                                                        05555000
   ELSE IF FCODE = %17 THEN                                    <<01201>>05560000
     BEGIN   << PERFORM READ STATUS >>                         <<01201>>05565000
       IF COUNT = 0 THEN << SINGLE STATUS MINIMUM >>           <<01201>>05570000
         BEGIN   << INVALID REQUEST >>                         <<01201>>05575000
           TOS := INVALIDOP;                                   <<01201>>05580000
           GO TO BADIO;                                        <<01201>>05585000
         END;                                                  <<01201>>05590000
       TOS:= IOQ'COUNT;                                        <<06723>>05595000
       IF < THEN  << BYTE COUNT >>                             <<01201>>05600000
         COUNT := -TOS  << MAKE POSITIVE >>                    <<01201>>05605000
       ELSE                                                    <<01201>>05610000
         COUNT := TOS&ASL(1); << CHANGE TO BYTE CNT >>         <<01201>>05615000
       IF COUNT > 1 THEN COUNT := 1;  << MAX AVAIL >>          <<01201>>05620000
                                                               <<01201>>05625000
       SIOP(SCOUNT) := COUNT;  << STATUS BYTE COUNT >>         <<01201>>05630000
       SIOP(SBANK).(8:8) := BANK;                              <<01201>>05635000
       SIOP(STATADR) := BUFFADDR;                              <<01201>>05640000
       START'HPIB(DITP,STATSIOP,FALSE);  << START CP >>        <<01367>>05645000
       GO TO PRINTCONT;                                        <<01201>>05650000
                                                               <<01201>>05655000
                                                               <<01201>>05660000
     END  << OF READ STATUS (FUNCTION CODE = %17) >>           <<01201>>05665000
                                                               <<01201>>05670000
                                                               <<01201>>05675000
                                                               <<01201>>05680000
   ELSE  IF FCODE = %100 THEN                                           05685000
     BEGIN   << SET VFC PROCESSING >>                                   05690000
       TOS:= IOQ'PARM1;                                        <<06723>>05695000
       IF 0<S0 AND S0<5 THEN TOS := TOS + %24                           05700000
       ELSE IF S0=8 THEN TOS := TOS + %22                               05705000
       ELSE IF TOS=12 THEN TOS := %24                                   05710000
       ELSE TOS := %31;                                                 05715000
                                                                        05720000
       SIOP(PRE'CTL) := TOS;    << SET REQUEST INTO CONTROL BUFF >>     05725000
       SIOP(PREJMP) := 0;                                               05730000
       SIOP(WRTCTL1).CMD := 2;  << SET WRITE CONTROL TO VFC COMMAND>>   05735000
       GOTO STARTPRINT;                                                 05740000
                                                                        05745000
                                                                        05750000
     END  << OF SET VFC LOGIC (FUNCTION CODE = %100) >>                 05755000
   ELSE       << FALL THROUGH  >>                                       05760000
                                                                        05765000
                                                                        05770000
$PAGE                                                                   05775000
                                                                        05780000
  PRINTDONE:                                                            05785000
     TOS := GOODIO;                                                     05790000
                                                                        05795000
  IODONE:                                                               05800000
     IOQ'STAT:= TOS;  << STORE RETURN STATUS >>                <<06723>>05805000
                                                               <<02695>>05810000
  EXIT:                                                        <<02695>>05815000
     LPDRVR := REQUESTDONE;                                             05820000
     RETURN;                                                            05825000
                                                                        05830000
  CHANERROR:                                                            05835000
     TOS := CHANFAIL;                                                   05840000
     DITP(DSERR):= [8/1,8/DLOGERROR];                          <<01348>>05845000
     DITP(DLOGERROR) := CPVAP;    <<LOG ERROR STATUS>>         <<01348>>05850000
                                                                        05855000
  BADIO:                                                                05860000
     DITP(DSAVE) := 0;    << CLEAR DRIVER FLAGS >>                      05865000
     MASTERCLEARHPIB(DITP);                                    <<01301>>05870000
     GOTO IODONE;                                                       05875000
                                                                        05880000
                                                                        05885000
                                                                        05890000
<<  LINE PRINTER CONTINUATOR SECTION  >>                                05895000
                                                                        05900000
  LPCONT:                                                               05905000
     IF CPVAP.ERRORCODE = 6 THEN   << DMA ABORT >>                      05910000
       GOTO CHANERROR;                                                  05915000
                                                                        05920000
     IF CPVAP.ERRORCODE = 7 THEN   << CHANNEL ABORT >>                  05925000
       BEGIN                                                            05930000
         IF CPVAP.TIMEDOUT = 0 THEN   << BAD CHANNEL >>                 05935000
           GOTO CHANERROR;                                              05940000
                                                                        05945000
         TOS:= IOQ'QMISC.TOUTCNTR+1;  << TIMED-OUT COUNTER >>  <<06723>>05950000
         IF S0 > 3 THEN      << CHANNEL FAILURE >>                      05955000
           GOTO CHANERROR                                               05960000
         ELSE                                                           05965000
         IOQ'QMISC.TOUTCNTR:= TOS;    << UPDATE COUNTER >>     <<06723>>05970000
         GOTO STARTPRINT;                                               05975000
       END;                                                             05980000
                                                                        05985000
     IF IOQ'SFAIL THEN  << FAILURE ON DELAYED START I/O >>     <<06723>>05990000
       BEGIN                                                            05995000
         TOS := SIOFAIL;                                                06000000
         GOTO BADIO;                                                    06005000
       END;                                                             06010000
                                                                        06015000
     DITP(DTIME).(0:1) := 0;                                   <<01301>>06020000
     IF <> THEN   << TIMER POPPED >>                                    06025000
       BEGIN                                                            06030000
                                                                        06035000
   LPNOTREADY:                                                          06040000
         IF IOMESSAGE(1,IF SIOPL(STATUS).PAPEROUT THEN PAPEROUTMSG ELSE 06045000
               NOTRDYMSG,%10000,DITP(DLDEV),,,,,OPCONSOLE) THEN<<06723>>06050000
           BEGIN                                                        06055000
             START'HPIB(DITP,IDLESIOP,FALSE);                  <<01301>>06060000
             IF < THEN                                                  06065000
               BEGIN                                                    06070000
                 TOS := SIOFAIL;                                        06075000
                 GOTO BADIO;                                            06080000
               END;                                                     06085000
             IOQ'QMISC.WAITCODE:= NOTRDYWAIT;<< SET REQ STATE>><<06723>>06090000
             LPDRVR := NOTREADY;                                        06095000
             RETURN;                                                    06100000
           END;                                                         06105000
                                                                        06110000
         TOS := SYSERROR;   << INDICATE FAILURE BECAUSE THERE >>        06115000
         GOTO BADIO;        << ARE NO MESSAGE LINK BUFFERS >>           06120000
       END;                                                             06125000
                                                                        06130000
     IF FCODE=%17 THEN  << IF STATUS READ - DONE >>            <<01201>>06135000
       GO TO PRINTDONE;                                        <<01201>>06140000
                                                               <<01201>>06145000
     IF CPVAP(1).(14:2) = 2 THEN   << STATUS DIAGNOSIS IS REQUIRED >>   06150000
       BEGIN                                                            06155000
         IF SIOP(STATUS).RDYBIT = 0 THEN  << UNIT NOTREADY >>           06160000
           BEGIN                                               <<01493>>06165000
             IF SIOP(STATUS).PON = 1 THEN                      <<01493>>06170000
             IOQ'QMISC.PONDONE:= 1;  << PON OCCURED >>         <<06723>>06175000
             GOTO LPNOTREADY;                                  <<01493>>06180000
           END;                                                <<01493>>06185000
                                                                        06190000
         IF SIOPL(STATUS).PAPEROUT THEN  << UNIT OUT OF PAPER >>        06195000
           BEGIN                                               <<01493>>06200000
             IF SIOP(STATUS).PON = 1 THEN                      <<01493>>06205000
             IOQ'QMISC.PONDONE:= 1;  << PON OCCURED >>         <<06723>>06210000
             GOTO LPNOTREADY;                                  <<01493>>06215000
           END;                                                <<01493>>06220000
                                                                        06225000
         IF SIOP(STATUS).PON = 1 THEN  << UNIT HAS JUST POWERED UP >>   06230000
 PONINIT:                                                      <<01493>>06235000
           BEGIN                                                        06240000
             START'HPIB(DITP,INITSIOP,TRUE);                   <<01301>>06245000
             IF < THEN                                                  06250000
               BEGIN                                                    06255000
                 TOS := SIOFAIL;                                        06260000
                 GOTO BADIO;                                            06265000
               END;                                                     06270000
             IOQ'QMISC.WAITCODE:= INITIOWAIT;                  <<06723>>06275000
             LPDRVR := INTRPTWAIT;                                      06280000
             RETURN;                                                    06285000
           END;                                                         06290000
                                                                        06295000
         IF SIOP(STATUS).PARITYERR = 1 THEN                             06300000
           BEGIN                                                        06305000
             DITP(DSERR):= [8/1,8/DLOGERROR];                  <<01348>>06310000
             DITP(DLOGERROR) := PARITYERROR;   <<LOG ERROR>>   <<01348>>06315000
             GOTO STARTPRINT;                                           06320000
           END;                                                         06325000
                                                               <<01367>>06330000
  RESTART:                                                     <<01367>>06335000
         IF FCODE=1 THEN  << RESTART INCOMPLETE OPERATION >>   <<01367>>06340000
           BEGIN                                               <<01367>>06345000
           IF SIOP(BCOUNT)<>0 THEN  << BURST CNT EXPIRED >>    <<01367>>06350000
             BEGIN  << RESTART FILL BUF FOR PRE & POST SPACE >><<01367>>06355000
             TOS:= IOQ'COUNT;  << GET TOTAL COUNT >>           <<06723>>06360000
             IF < THEN  << BYTE COUNT >>                       <<01367>>06365000
               COUNT := -TOS  << MAKE POSITIVE >>              <<01367>>06370000
             ELSE  << WORD COUNT >>                            <<01367>>06375000
               COUNT := TOS&ASL(1);  << CHANGE TO BYTE COUNT >><<01367>>06380000
             SIOP(MEMX).(8:8) := BANK;  << RESET BANK & ADR >> <<01367>>06385000
             SIOP(BADDR) := BUFFADDR+  << ADD OFFSET TO ADR >> <<01367>>06390000
               (COUNT-SIOP(BCOUNT))/2;  << MAKE WRD CNT >>     <<01367>>06395000
             START'HPIB(DITP,FILLSIOP,FALSE);                  <<01367>>06400000
             GO TO PRINTCONT;                                  <<01367>>06405000
             END;                                              <<01367>>06410000
                                                               <<01367>>06415000
           IF SIOP(PCOUNT)<>0 THEN  << POSTSPACE PRT DONE? >>  <<01367>>06420000
             BEGIN  << RESTART POSTSPACE OPERATION >>          <<01367>>06425000
             START'HPIB(DITP,POSTSIOP,FALSE);                  <<01367>>06430000
             GO TO PRINTCONT;                                  <<01367>>06435000
             END;                                              <<01367>>06440000
           END;                                                <<01367>>06445000
       END;                                                             06450000
                                                                        06455000
     DITP(DSAVE).TOP:= IOQ'QMISC.PEJECT;<<SET TOP IF PE DONE>> <<06723>>06460000
                                                                        06465000
                                                                        06470000
     GO TO PRINTDONE;    << GOT HERE - REQUEST COMPLETED >>    <<01367>>06475000
                                                                        06480000
   END;                                                                 06485000
$PAGE                                                                   06490000
   ASSEMBLE(                                                            06495000
     PCAL SIODM;     << MONITOR >>                                      06500000
     PCAL LPDRVR;    << INITIATOR >>                                    06505000
     PCAL LPDRVR;    << COMPLETOR >>                                    06510000
     CON  0;         << NO IO PROCESS >>                                06515000
     PCAL LPINIT;    << INITIALIZATION >>                               06520000
     CON  1;         << ONE INTERRUPT HANDLER >>                        06525000
     PCAL GIP'HPIB); << INTERRUPT HANDLER >>                   <<01301>>06530000
   END.                                                                 06535000
