$CONTROL MAP,CODE,USLINIT                                               00010000
  <<    HIOLPRT2 [MODULE 21] -- HP2619A 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 "HP2619A LINE PRINTER DRIVER - HPIB"                             00060000
$CONTROL PRIVILEGED,UNCALLABLE                                          00065000
$TP                                                                     00070000
     <<*********************************************************>>      00075000
     <<                                                         >>      00080000
     <<  HIOLPRT2 [MODULE 21] -- HP2619A LP DRIVER [HPIB]       >>      00085000
     <<                                                         >>      00090000
     <<  COPYRIGHT (C) 1980, HEWLETT PACKARD CO.  THIS PROGRAM  >>      00095000
     <<  MAY BE USED WITH ONE COMPUTER SYSTEM AT AT TIME AND    >>      00100000
     <<  SHALL NOT OTHERWISE BE RECORDED, TRANSMITTED OR STORED >>      00105000
     <<  IN A RETRIEVAL SYSTEM.  COPYING OR OTHER REPRODUCTION  >>      00110000
     <<  OF THIS PROGRAM EXCEPT FOR ARCHIVAL PURPOSES IS PRO-   >>      00115000
     <<  HIBITED WITHOUT THE PRIOR WRITTEN CONSENT OF HEWLETT-  >>      00120000
     <<  PACKARD COMPANY.                                       >>      00125000
     <<                                                         >>      00130000
     <<*********************************************************>>      00135000
                                                                        00140000
COMMENT                                                        <<04744>>00145000
                                                                        00150000
                                                                        00155000
        HP2619A Line Printer Driver 3000 Series - HIOLPRT2              00160000
        ----------------------------------------------------            00165000
                                                                        00170000
                                                                        00175000
Structure of HIOLPRT2:                                                  00180000
                                                                        00185000
HIOLPRT2, together with the SIO Device Monitor (SIODM) constitute a     00190000
standard MPE Type 1 I/O Driver/Monitor.  This means that it does not    00195000
run in its own process, but executes on any stack and therefore must    00200000
run to completion.  During initialization it executes on PROGEN's       00205000
stack, during request initiation it executes on ATTACHIO's stack, and   00210000
during interrupt processing it executes on the Interrupt Control        00215000
Stack (ICS).                                                            00220000
                                                                        00225000
HIOLPRT2 consists of a global area, two procedures, and an "outer       00230000
block" which is really a linkage area for INITIAL.  The global area     00235000
contains an array called INITIAL which is comprised of three parts.     00240000
The first part specifies the size of the other two, the unit extract    00245000
instruction, and various parameters which are used by INITIAL.  This    00250000
section is deleted after INITIAL is through with it.  The other two     00255000
parts are the Device Information Table (DIT) and the Channel Program    00260000
area, which is part of the Interrupt Linkage Table (ILT).  INITIAL      00265000
will put each of these items in the area of memory where it belongs.    00270000
The linkage area specifies the procedure labels (P-labels) of the       00275000
associated monitor (SIODM), the request initiator (LPDRVR), the         00280000
request completor (LPDRVR), the initialization procedure (LPINIT,       00285000
called by PROGEN at system startup), and the interrupt handler (GIP).   00290000
                                                                        00295000
                                                                        00300000
Operation of HIOLPRT2:                                                  00305000
                                                                        00310000
The primary working code of HIOLPRT2 is a procedure LPDRVR.  LPDRVR     00315000
is called with six parameters.   Two of these parameters, BANK and      00320000
BUFFADDR, are the absolute buffer address of the data to be processed.  00325000
The other three, DITP, IOQP, and SIOP are pointers to three arrays.     00330000
DITP is a pointer to the Device Information Table which contains        00335000
information about its associated line printer.  There is one DIT for    00340000
each unit on the controller and they contain information which must     00345000
be saved between I/O requests to the driver.  IOQP is a pointer to the  00350000
Input/Output Table which contains information relevent to the current   00355000
request.  SIOP is a pointer to the first element of the channel pro-    00360000
gram which is actually part of the Interrupt Linkage Table.  The last   00365000
parameter DRTN is the Device Reference Table (DRT) number of the        00370000
device.  These three elements are described in more detail elsewhere    00375000
in this listing.                                                        00380000
                                                                        00385000
LPDRVR is always called by the SIO device monitor (SIODM) and it        00390000
determines the reason for the call by examining the IOQ and the DIT.    00395000
When a new request is initiated, LPDRVR examines the function code      00400000
and parameter fields contained in the IOQ element to determine the      00405000
task that is desired.  The proper command codes and program branches    00410000
are then placed in the Channel Program and its execution is begun.      00415000
                                                                        00420000
Upon completion of the request, an interrupt is generated and LPDRVR    00425000
is again called.  The code checks for current activity in progress,     00430000
and this being the case, branches to the completion section of the      00435000
driver.  Here several status words are examined for errors or special   00440000
conditions which might have occurred during the execution of the        00445000
Channel Program, during the data transfer, or during the operation of   00450000
the line printer.  These conditions can cause error retries and/or      00455000
special notation back to the caller.  A list of the conditions and      00460000
the return codes is provided in this listing.                           00465000
                                                               <<04744>>00470000
Fix History                                                    <<04744>>00475000
-----------                                                    <<04744>>00480000
                                                               <<04744>>00485000
8-4-82 Sotoji Watanabe (submitted by Dave Cassafer) -          <<04744>>00490000
       Selection of VFC channel 9-12 will be changed to        <<04744>>00495000
       single space if subtype = 3 (Katakana printer).         <<04744>>00500000
                                                               <<04744>>00505000
       Dave Cassafer - change timeout from 2 to 5 sec.         <<04744>>00510000
       because kanji printers need the extra time for          <<04744>>00515000
                                                               <<06718>>00520000
3-25-83 DAVID SM CHANG                                         <<06718>>00525000
        INITIAL MPEV INCL5 PROGRAM.                            <<06718>>00530000
                                                               << 8647>>00535000
5-2-84  Frank Weger                                            << 8647>>00540000
        Bug in PRE'TO'POST space fixed                         << 8647>>00545000
        at end of driver completor.                            << 8647>>00550000
                                                               << 8647>>00555000
                                                               << 8647>>00560000
                Device Information Table (DIT)                          00565000
                ------------------------------                          00570000
                                                                        00575000
                                                                        00580000
There is one DIT per physical device.  If a physical device represents  00585000
more than one logical device, the logical device number is obtained     00590000
from the IOQ element (however, there is only one device per HP2619A     00595000
controller.)  The following diagram shows the DIT used for the HP2619A  00600000
line printer driver.                                                    00605000
                                                                        00610000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          00615000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    00620000
  0| 0| 0|AC|RQ| 0| 0| 0|IO|IA|NO|ST| 0|   STATE   |   DFLAG            00625000
   +--+--+--+--+--+--+--+--+--+--+--+--+-----------+                    00630000
  1| SYSDB relative pointer to the DIT for the next|   DLINK            00635000
   | device requesting this resource or service    |                    00640000
   +-----------------------------------------------+                    00645000
  2| SYSDB relative pointer to the first IOQ in    |   DIOQP            00650000
   | request list for this device                  |                    00655000
   +-----+-----------------+-----------------------+                    00660000
  3| Logical device number                         |   DLDEV   <<06718>>00665000
   +-----+-----------------+-----------------------+                    00670000
  4| SYSDB relative pointer to Device Linkage Table|   DDLTP            00675000
   +-----------------------------------------------+                    00680000
  5| SYSDB relative pointer to Intrp Linkage Table |   DILTP            00685000
   +-----------------------------------------------+                    00690000
  6|                                |BJ|AB|PS|FL|TP|   DSAVE            00695000
   +-----------------------------------------------+                    00700000
  7| Hardware error status.  Set when the driver   |   DSERR            00705000
   | detects an error.  Whenever <>0, the driver   |                    00710000
   | monitor logs an I/O error and clears this word|                    00715000
   +-----------------------------------------------+                    00720000
%10| Bit 0 is set at completion of timer           |   DTIME            00725000
   +-----------------------------------------------+                    00730000
%11| Interrupt status for this unit. Set by the    |   DSTAT   <<06718>>00735000
   | driver each time it processes an interrupt.   |           <<06718>>00740000
   +-----------------------------------------------+           <<06718>>00745000
%12|IOT  |    Physical device unit.                |   DUNIT   <<06718>>00750000
   +-----------------------------------------------+           <<06718>>00755000
   |                                               |           <<06718>>00760000
%13|          Hardware logged error status         |DLOGERROR  <<06718>>00765000
   +-----------------------------------------------+           <<06718>>00770000
%14|          Hardware logged error status + 1     |DLOGERROR+1<<06718>>00775000
   +-----------------------------------------------+           <<06718>>00780000
%15| Holds the time out request entry index while  |   DRQST   <<06718>>00785000
   | a time is active.                             |           <<06718>>00790000
   +-----------------------------------------------+           <<06718>>00795000
DFLAG - Flags and request state                                         00800000
  AC  ACTIVE  - A monitor is currently servicing this device.           00805000
  RQ  REQUEST - A service request is pending while the monitor is       00810000
                active.                                                 00815000
  IO  IOPROG  - An I/O Channel Program is running for this device.      00820000
  IA  IAK     - An interrupt or response has occurred for this device.  00825000
  NO  NOTRDY  - Go to state %10 after Idle Channel Program is started.  00830000
  ST  STWAIT  - The device monitor is starting an Idle Channel Program  00835000
                for this device.  There is no IOQ associated with this  00840000
                type of request.                                        00845000
  STATE       - State of the device monitor.  Specifies the next action 00850000
                to be taken in SIODM in servicing the request:          00855000
                                                                        00860000
                  0 - start new request                                 00865000
                  1 - not used                                          00870000
                  2 - call driver initiator procedure                   00875000
                  3 - call driver completor procedure                   00880000
                  4 - not used                                          00885000
                  5 - process request completed                         00890000
                  6 - initiate device recognition sequence              00895000
                  7 - start operator intervention wait                  00900000
                %10 - wait for interrupt (operator intervention)        00905000
                      restart at state 0                                00910000
                %11 - wait for data segment freeze, then state 2        00915000
                %12 - wait for driver initiator to be frozen, then      00920000
                      allocate controller (state 2)                     00925000
                %13 - wait for I/O completion interrupt, then state 3   00930000
                %14 - wait for controller, then call driver initiator   00935000
                %15 - not used                                          00940000
                %16 - wait for initiator make present, then state 2     00945000
                %17 - wait for completor make present, then state 3     00950000
                                                                        00955000
DLDEV - I/O system type, unit and logical device number                 00960000
    0 - HP3000 Series 2/3                                               00965000
    1 - HP3000 Series 33 (HPIB)                                         00970000
    2 - Unused                                                          00975000
    3 - Unused                                                          00980000
                                                                        00985000
DSAVE - Device processing flags                                         00990000
  BJ   BETJOB    - Between jobs flg, if set suppress Powerfail msg.     00995000
  AB   ABORT     - Abort (caused by Pfail or Operator) has occurred.    01000000
  PS   PRESPACE  - Last request used prespacing.                        01005000
  FL   FULL      - Line printer buffer is full.                         01010000
  TP   TOP       - Printer is at top of form.                           01015000
                                                                        01020000
DSERR - Pointer to status to be logged.                                 01025000
        Bits(0:7)  - Number of words to be logged.                      01030000
        Bits(8:15) - Offset relative to DITP(0).                        01035000
                                                                        01040000
                                                                        01045000
HP2619A Line Printer Status                                             01050000
---------------------------                                             01055000
                                                                        01060000
  BITS         USE                                                      01065000
                                                                        01070000
    0     ON LINE          [MSB]                                        01075000
    1     I/O BUFFER READY                                              01080000
    2     (RESERVED)                                                    01085000
    3     PROTOCOL ERROR                                                01090000
    4     PARITY ERROR IN A COMMAND ON THE HPIB                         01095000
    5     (RESERVED)                                                    01100000
    6     PAPER OUT/PAPER JAM/GATE OPEN/PLATEN OPEN/ETC.                01105000
    7     POWER FAIL       [LSB]                                        01110000
                                                                        01115000
$PAGE                                                                   01120000
                Interrupt Linkage Table (ILT)                           01125000
                -----------------------------                           01130000
                                                                        01135000
                                                                        01140000
There is one ILT for each device controller configured on the system.   01145000
A controller may support more than one unit, however the HP2619A con-   01150000
troller currently only supports one unit.                               01155000
                                                                        01160000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01165000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01170000
  0|         Channel                               |   ICPVA0           01175000
  1|              Program                          |   ICPVA1           01180000
  2|                  Variable                     |   ICPVA2           01185000
  3|                       Area (ICPVA)            |   ICPVA3           01190000
   +-----------------------------------------------+                    01195000
  4|         DMA Abort                             |   ICPVA4           01200000
  5|              Address                          |   ICPVA5           01205000
   +-----------------------------------------------+                    01210000
  6|                      0                        |   ISRQL            01215000
   +--+-----------------+-----+-----------+--------+                    01220000
  7|LI|     CHANQUE     |     |   CHAN    |  DEV   |   ICNTRL           01225000
   +--+-----------------+-----+-----------+--------+                    01230000
%10| SYSDB relative pointer to Channel Program area|   ISIOP            01235000
   +-----------------------------------------------+                    01240000
%11| SYSDB relative pointer to Status Return area. |   ISTAP            01245000
   | (The HP2619A driver does not use the Status   |                    01250000
   |  Return area so this entry is 0.)             |                    01255000
   +-----------------------------------------------+                    01260000
%12| single instruction that is executed to extract|   IUNIT            01265000
   | the device unit number from the status pointed|                    01270000
   | to by ISTAP.  (Since there is only one unit   |                    01275000
   | on the controller, this entry is not used.)   |                    01280000
   +-----------------------------------------------+                    01285000
%13| SYSDB relative DIT pointer of the device      |   ICDP             01290000
   | currently using the channel to perform a      |                    01295000
   | data operation.                               |                    01300000
   +-----------------------+-----------------------+                    01305000
%14|       SIOPSIZE        |        CQUEN          |   IQUEUE           01310000
   +--+--+--+--------------+-----------+-----------+                    01315000
%15|RW|WP|IG|                          |  HCUNIT   |   IFLAG            01320000
   +--+--+--+--------------------------+-----------+                    01325000
%16| SYSDB relative DIT pointer for unit 0         |   IDITP0           01330000
   +-----------------------------------------------+                    01335000
%17|             Line Printer                      |                    01340000
   .               Channel                         .                    01345000
   |                 Program                       |                    01350000
   +-----------------------------------------------+                    01355000
                                                                        01360000
                                                                        01365000
ICPVA0 - Channel Program Variable Area                                  01370000
                                                                        01375000
  The first word is used by the channel program processor to store      01380000
  status information after I/O channel aborts.  The next word is used   01385000
  by the driver to indicate if status should be examined for special    01390000
  conditions or errors.  The other two words are not used.              01395000
                                                                        01400000
                                                                        01405000
ICPVA4 - DMA abort address                                              01410000
                                                                        01415000
  If a DMA abort occurs, the absolute address where the abort occurred  01420000
  is stored in this area.                                               01425000
                                                                        01430000
                                                                        01435000
ICNTRL - Contains controller information                                01440000
                                                                        01445000
  LIM     - If this bit is set, the controller is sharing a software    01450000
            channel resource in order to limit bandwidth.               01455000
  CHANQUE - The software channel resource number.                       01460000
  CHAN    - Channel number (four most significant bits of DRTN).        01465000
  DEV     - Device number (three least significant bits of DRTN).       01470000
                                                                        01475000
                                                                        01480000
IQUEUE -                                                                01485000
                                                                        01490000
  SIOPSIZE - (number of words + 1)/2 in the channel program area.       01495000
  CQUEN    - For a multi-unit controller this field contains the        01500000
             software controller resource number.                       01505000
                                                                        01510000
                                                                        01515000
IFLAG - Controller and Channel Program state flags                      01520000
                                                                        01525000
  RUNWAIT  - An Idle Channel Program should be started when there       01530000
             are no active requests to process.  This flag is always    01535000
             0 for the HP2619A.                                         01540000
  WAITPROG - An Idle Channel Program has been started for this          01545000
             controller.  This bit is reset by an interrupt.            01550000
  IGNOREHI - An HIOP instruction has been issued against this con-      01555000
             troller but the channel program was not in a wait          01560000
             statement.  Therefore ignore the interrupt generated by    01565000
             the channel code when this program halts.                  01570000
  HCUNIT   - Highest configured unit number for this controller.        01575000
                                                                        01580000
                                                                        01585000
                                                                        01590000
            Device Reference Table DRT                                  01595000
            --------------------------                                  01600000
                                                                        01605000
There is one DRT per device controller.  The the contents of this       01610000
table are used for processing interrupts.                               01615000
                                                                        01620000
     Word 0  SIOP   - Absolute address of the current I/O               01625000
                      instruction in execution.                         01630000
     Word 1  DBI    - Absolute address of the base of the ILT           01635000
                      for this controller.                              01640000
     Word 2  PLABLE - The external program label of the interrupt       01645000
                      service routine for this controller.              01650000
     Word 3  CHAN   - Contains channel program status information       01655000
                      which is used by the channel program interpreter. 01660000
$PAGE                                                                   01665000
            I/O QUEUE ELEMENT (IOQ)                                     01670000
            -----------------------                                     01675000
                                                                        01680000
                                                                        01685000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01690000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01695000
  0|      Request dependent flags (see below)      |   QFLAG            01700000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01705000
  1| SYSDB relative pointer to next IOQ element.   |   QLINK            01710000
   | Points to first word of element.              |                    01715000
   +-----------------------+-----------------------+                    01720000
  2|                       | Logical device number |   QLDEV            01725000
   +--+--+--+--+--+--------+-----------+-----------+                    01730000
  3|PP|PE|PO|TO|BF|                    | WAITCODE  |   QMISC            01735000
   +--+--+--+--+--+--------------------+-----------+                    01740000
  4| S| If QFLAG.(3:1) is clear then this is the   |   QDSTN            01745000
   |  | DST number of the target data segment.  If |                    01750000
   |  | S is set, QADDR is DB relative.            |                    01755000
   +--+--------------------------------------------+                    01760000
  5| Offset in the data segment or system buffer   |   QADDR            01765000
   | table to the target data buffer.              |                    01770000
   +-----------------------+-----------------------+                    01775000
  6|                       | Function code for     |   QFUNC            01780000
   |                       | this request.  (See   |                    01785000
   |                       | next section.)        |                    01790000
   +-----------------------+-----------------------+                    01795000
  7| On initiation, specifies the word count (>0)  |   QWBCT            01800000
   | or byte count (<0).  At completion of the     |                    01805000
   | request this location contains the actual     |                    01810000
   | transmission count in the same units (bytes   |                    01815000
   | or words) as in the request.                  |                    01820000
   +-----------------------------------------------+                    01825000
%10| Parameter 1.  Vertical Format specification.  |   QPAR1            01830000
   | (See next section for detail.)                |                    01835000
   +-----------------------------------------------+                    01840000
%11| Parameter 2.  Space Mode Flags.  (See next    |   QPAR2            01845000
   | section for details.)                         |                    01850000
   +-----------------------+--------------+--------+                    01855000
%12|         PCBN          |  QUALIFIER   | STATUS |   QSTAT            01860000
   +-----------------------+--------------+--------+                    01865000
                                                                        01870000
                                                                        01875000
QFLAG - Request dependent flags                                         01880000
                                                                        01885000
  Bit 0  ABORT     - Abort this request and return an error indication  01890000
                     to the caller.                                     01895000
  Bit 1  SPECIAL   - Apply special handling to this request.  (Not used)01900000
  Bit 2  DIAG      - This is a request from the diagnostic subsystem.   01905000
  Bit 3  SYSBUFF   - Target is an index relative to the SBUF Table of   01910000
                     the data buffer.                                   01915000
  Bit 4  IOWAKE    - Wake caller on completion of request.              01920000
  Bit 5  BLOCKED   - Blocked I/O.  The caller is waited in ATTACHIO     01925000
                     until the request is completed.  Implies IOWAKE.   01930000
  Bit 6  COMPLETED - The request has been completed and the caller      01935000
                     awakened if he had requested (with IOWAKE).        01940000
  Bit 7  DATAFRZN  - Set by the memory management routines (MAM) when a 01945000
                     MAKEPRESENT request is successfully completed and  01950000
                     indicates the data segment is frozen in memory.    01955000
  Bit 8  MAMERRORD - An error has occurred while MAM was trying to      01960000
                     make the target data segment present and freeze    01965000
                     it in memory.                                      01970000
  Bit 9  PREQ      - (Not used)                                         01975000
  Bit 10 SFAIL     - Delayed failure of SIO instruction.  If a call to  01980000
                     STARTIO resulted in the request being added to     01985000
                     the channel queue, this bit indicates that the SIO 01990000
                     instruction failed when the request was selected   01995000
                     for execution.                                     02000000
  Bit 11 PFAIL     - The request was aborted because of a system power  02005000
                     failure.                                           02010000
                                                                        02015000
                                                                        02020000
QMISC - Driver request dependent flags and counters.                    02025000
                                                                        02030000
  PRE'TO'POST - Pre to post spacing change flag.                        02035000
  PEJECT      - Last operation was a page eject.                        02040000
  POWER ON    - Power on in process.                                    02045000
  TOUT        - Channel timed out flag.                                 02050000
  BUF'FILL    - Buffer fill operation in process.                       02055000
  WAITCODE    - Indicates type of wait:                                 02060000
                                                                        02065000
                  0 - new request                                       02070000
                  1 - completion wait                                   02075000
                  2 - not ready wait                                    02080000
                  3 - initiation wait                                   02085000
                                                                        02090000
                                                                        02095000
QSTAT - PCB number and request completion status.                       02100000
                                                                        02105000
  PCBN    - The Process Control Block (PCB) number of the process       02110000
            which made this request.  If zero, the request is not       02115000
            associated with any process and the IOQ element is to       02120000
            be returned by the system when the request has completed.   02125000
  STATUS  - General status indicating the final state of the request.   02130000
            The following codes are used:                               02135000
                                                                        02140000
              0 - Not started or awaiting completion.                   02145000
              1 - Successful completion.                                02150000
              2 - End-of-file detected.                                 02155000
              3 - Unusual, but recoverable, condition detected.         02160000
              4 - Irrecoverable error has occurred.                     02165000
                                                                        02170000
  QUALIFIER - A code which further defines or qualifies the general     02175000
              status.  (See the section Driver Return Status Codes.)    02180000
                                                                        02185000
$PAGE                                                                   02190000
         2619 Line Printer Request Codes                                02195000
         -------------------------------                                02200000
                                                                        02205000
OPERATION  FUNCTION  PARAMETERS                                         02210000
---------  --------  ----------                                         02215000
                                                                        02220000
 WRITE          1    P1  [Vertical Format Specification]                02225000
                                                                        02230000
                       1 - use 1st Data Character as Format             02235000
                           Specification                                02240000
                                                                        02245000
                     %53 - "+", Print and Suppress Spacing              02250000
                     %55 - "-", Print and Triple Space                  02255000
                     %60 - "0", Print and Double Space                  02260000
                     %61 - "1", Print and Top of Form                   02265000
                                                                        02270000
                     %200-%277, Print and Space N-%200 Lines            02275000
                     %300-%312, Print with Channel N-%277               02280000
                                                                        02285000
                     %320 - Fill Line Printer Buffer Only               02290000
                                                                        02295000
                     All Others - Print and Single Space                02300000
                                                                        02305000
                                                                        02310000
                     P2  [Space Mode Flags]                             02315000
                                                                        02320000
                     (15:1)   - Prespace Flag                           02325000
                     If Set   - Print then Fill Buffer                  02330000
                     If Clear - Fill Buffer then Print                  02335000
                                                                        02340000
                     (14:1)    - No page stepover flag                  02345000
                     If Set    - Single and Double Space without        02350000
                                 Stepover (66 lines/page)               02355000
                     If Clear  - Single and Double Space with           02360000
                                 Stepover (60 lines/page)               02365000
                                                                        02370000
 FILE OPEN      2    Page Eject If Not at Top of Form                   02375000
                                                                        02380000
 FILE CLOSE     3    Page Eject If Not at Top of Form                   02385000
                                                                        02390000
 DEVICE CLOSE   4    Page Eject If Not at Top of Form                   02395000
                                                                        02400000
 READ STATUS  %17    Read I/O Status                                    02405000
                     Count - Buffer Size                                02410000
                                                                        02415000
                                                                        02420000
*IDENTIFY    %110    Return ID value in Bank & Buffaddr                 02425000
                                                                        02430000
*SELF TEST:                                                             02435000
  INITIATE   %111    Subtest number to execute in Bank & Buffaddr       02440000
                     (subtest# ranges from 0 to 7)                      02445000
  STATUS     %112    Subtest result returned in Bank & Buffaddr         02450000
                                                                        02455000
*LOOPBACK TEST:                                                         02460000
  WRT DATA   %113    Data to LP in Bank & Buffaddr [PING]               02465000
  READ DATA  %114    Data from LP read into Bank & Buffaddr [PONG]      02470000
                     Count - Buffer Size (256 bytes max)                02475000
                                                                        02480000
                                                                        02485000
                                                                        02490000
                                                                        02495000
                                                                        02500000
                                                                        02505000
*DIAGNOSTIC FUNCTION:  The Diagnostic Request Bit in the 1st word       02510000
                       (QFLAG) of the IOQ table must be set before      02515000
                       any diagnostic functions can be executed.        02520000
                                                                        02525000
                                                                        02530000
$PAGE                                                                   02535000
                  LOGGING CONSIDERATIONS                                02540000
                  ----------------------                                02545000
                                                                        02550000
 DMA Abort & Channel Program Abort - CPVA(0) is logged.                 02555000
 Parity Error - A value ot -1 is logged.                                02560000
 Protocol Error - Status is logged to denote a unit failure.            02565000
                                                                        02570000
 [In the case of a channel program abort due to a channel hard-         02575000
 ware timeout, status is checked to determine if this was caused        02580000
 by parity error. If so, the parity error value -1 is logged            02585000
 instead of CPVA(0)]                                                    02590000
                                                                        02595000
                                                                        02600000
                  PARALLEL POLL CONSIDERATIONS                          02605000
                  ----------------------------                          02610000
                                                                        02615000
    On Power On (PON) Condition, the controller (driver) will get an    02620000
 Affirmative Response to Parallel Poll (ARPP) the first time due to     02625000
 the PON condition.  Afterwards, the controller (driver) will not get   02630000
 an ARPP unless there is a buffer available to accept data, the prin-   02635000
 ter is online and no problems exist.                                   02640000
                                                                        02645000
  For PON with Offline Condition:                                       02650000
                                                                        02655000
     The first ARPP cause status to be read, afterward the idle chan-   02660000
  nel program is run until the second ARPP is received.                 02665000
                                                                        02670000
  For PON with Online Conditon:                                         02675000
                                                                        02680000
     The first ARPP cause status to be read, afterward the idle chan-   02685000
  nel program is ran through one pass to assure synchronization bet-    02690000
  ween the firmware and the driver.                                     02695000
                                                                        02700000
  For Power Off When IOQ is Issued:                                     02705000
                                                                        02710000
     The driver will time out and the idle channel program is run.      02715000
  When power finally gets turned on, the condition specified above      02720000
  will occur in respect to PON being online or offline.                 02725000
                                                                        02730000
  For Regular Offline Condition:                                        02735000
                                                                        02740000
     The driver will not get an ARPP unless there is a buffer avail-    02745000
  able to accept data, the printer is online, and no error conditions   02750000
  exist (ie. paper out, paper jam, platen open, etc).                   02755000
                                                                        02760000
                                                                        02765000
                  ABORT/POWERFAIL CONSIDERATIONS                        02770000
                  ------------------------------                        02775000
                                                                        02780000
    On an abort caused either by a powerfail or an operator abort, a    02785000
Device Clear must be sent to the line printer to clear out the last     02790000
request and reset the firmware to a known state. This is necessary,     02795000
since an abort has high priority and can interrupt the channel pro-     02800000
gram prior to it completing.                                            02805000
$PAGE                                                                   02810000
                                                                        02815000
                  EXTRA HANDSHAKE REQUIREMENT                           02820000
                  ---------------------------                           02825000
                                                                        02830000
    At any point in the driver when a "2" is returned from a DSJ        02835000
 denoting I/O status should be interrogated, an extra wait [WAIT,       02840000
 DSJ] for an ARPP (denoting that a buffer is available to receive       02845000
 the next secondary) is required. This assures that the firmware        02850000
 will not get out of synchronization with the driver. Omission of       02855000
 this extra handshake can result in the protocol error bit being        02860000
 set in the status word. Under the driver completion section, this      02865000
 extra handshake is done under the following conditions:                02870000
                                                                        02875000
    - PON condition (flagged with DSJ 2)                                02880000
    - Alarm condition which cleared up showing a clean status           02885000
      but retained the DSJ 2 condition (ie. user opens and              02890000
      closes the yoke between jobs)                                     02895000
    - Buffer ready bit not set in the status word possibly due          02900000
      to noise on the bus                                               02905000
                                                                        02910000
                                                                        02915000
$PAGE                                                                   02920000
                       DRIVER RETURN STATUS CODES                       02925000
                       --------------------------                       02930000
                                                                        02935000
                                                                        02940000
 General Status (13:3)       Qualifying Status (8:5)      Overall (8:8) 02945000
                                                                        02950000
 0 - Pending                1 - Waiting For Completion         %10      02955000
                            3 - Not Ready Wait                 %30      02960000
                                                                        02965000
 1 - Successful             0 - No Errors                       %1      02970000
                                                                        02975000
 2 - End of File            (Not Used)                                  02980000
                                                                        02985000
 3 - Unusual Condition      3 - Request Aborted                %33      02990000
                            6 - Powerfail Abort                %63      02995000
                          %21 - Device Powered Up             %213      03000000
                                                                        03005000
 4 - Irrecoverable Error    0 - Invalid Request                 %4      03010000
                            2 - I/O Timed Out Before Complete  %24      03015000
                            4 - SIO Failure                    %44      03020000
                            5 - Unit Failure                   %54      03025000
                          %12 - System Error                  %124      03030000
                          %14 - Channel Failure               %144      03035000
                          %21 - Parity Error                  %214      03040000
                                                                        03045000
                                                                        03050000
ENDCOMMENT;                                                    <<04744>>03055000
$PAGE                                                                   03060000
BEGIN                                                                   03065000
$INCLUDE INCLIOQ                                               <<06718>>03070000
$INCLUDE INCLLPDT                                              <<06718>>03075000
  EQUATE                                                                03080000
                                                                        03085000
       << DITP PARAMETERS >>                                            03090000
                                                                        03095000
    DILTP     =  5,  << INTERRUPT LINKAGE TABLE POINTER >>              03100000
    DLDEV     =  3,  << LOGICAL DEVICE AND UNIT NUMBERS >>              03105000
    DLOGERROR =%13,  << DIT HARDWARE LOGGED ERROR STATUS >>    <<06718>>03110000
    DLOGERROR2= DLOGERROR+1,<< =%14 DIT H/W LOG STATUS+1 >>    <<06718>>03115000
    DRQST     =%15,  << DRIVER REQUEST FLAGS >>                <<06718>>03120000
    DSAVE     =  6,  << DRIVER FLAGS >>                                 03125000
    DSERR     =  7,  << DIT HARDWARE COUNT & INDEX >>                   03130000
    DTIME     =  8,  << TIME-OUT REQUEST ENTRY INDEX >>                 03135000
    DFLAG     =  0,  << DEVICE FLAG INDEX >>                   <<06718>>03140000
    DLINK     =  1,  << DIT LINK POINTER INDEX >>              <<06718>>03145000
    DIOQP     =  2,  << IOQ POINTER INDEX >>                   <<06718>>03150000
    DDLTP     =  4,  << DLT POINTER INDEX >>                   <<06718>>03155000
    DSTAT     =%11,  << INTERRUPT STATUS INDEX >>              <<06718>>03160000
    DUNIT     =%12,  << PHYSICAL DEVICE UNIT INDEX >>          <<06718>>03165000
                                                                        03170000
       << IOQP PARAMETERS >>                                            03175000
    << SPECIFY BY INCLUDE-5 FILE >>                            <<06718>>03180000
                                                                        03185000
                                                               <<06718>>03190000
                                                               <<06718>>03195000
                                                               <<06718>>03200000
                                                               <<06718>>03205000
                                                               <<06718>>03210000
                                                               <<06718>>03215000
                                                               <<06718>>03220000
                                                                        03225000
       << CHANNEL PROGRAM ADDRESSES RELATIVE TO SIOP >>                 03230000
                                                                        03235000
    BADDR      =  47,  << WRITE INSTRUCTION BUFFER ADDRESS >>           03240000
    BCOUNT     =  44,  << WRITE INSTRUCTION BYTE COUNT >>               03245000
    BUFFJMP    =  42,  << SWITCH FOR BUFFER FILL >>                     03250000
    DIAGJMP    = 116,  << DIAGNOSTIC COMPLETE JMP >>                    03255000
    DSBANK     = 113,  << DIAG/STATUS BANK ADDR  >>                     03260000
    DSCOUNT    = 111,  << DIAG/STATUS BYTE COUNT >>                     03265000
    DSTATADR   = 114,  << DIAG/STATUS BUFFER ADDR >>                    03270000
    DSB'ESC    = 127,  << DISABLE ESC SEQ BYTE >>                       03275000
    ENB'ESC    = 126,  << ENABLE ESC SEQ BYTE >>                        03280000
    ESC'ADR    = 121,  << ESC SEQ ADDRESS >>                            03285000
    ESC'ALPHA  = 124,  << ESC SEQ ALPHA TERMINATOR >>                   03290000
    ESC'PARM   = 123,  << ESC SEQ PARAMETER >>                          03295000
    INIT       = 117,  << START OF INITIALIZATION ROUTINE >>            03300000
    MEMX       =  46,  << WRITE INSTRUCTION BANK NUMBER >>              03305000
    POST'CNT   =  76,  << POSTSPACE COUNT >>                            03310000
    POST'DADR  =  91,  << POSTSPACE DISABLE ESC SEQ ADR >>              03315000
    POST'DCNT  =  89,  << POSTSPACE DISABLE ESC SEQ CNT >>              03320000
    POST'ESC   =  79,  << POSTSPACE ESC SEQ ADDRESS >>                  03325000
    POSTJMP    =  61,  << SWITCH FOR POST SPACING >>                    03330000
    PRE'CNT    =  16,  << PRESPACE COUNT >>                             03335000
    PRE'DADR   =  31,  << PRESPACE DISABLE ESC SEQ ADR >>               03340000
    PRE'DCNT   =  29,  << PRESPACE DISABLE ESC SEQ CNT >>               03345000
    PRE'ESC    =  19,  << PRESPACE ESC SEQ ADDRESS >>                   03350000
    PREJMP     =   1,  << SWITCH FOR PRESPACING >>                      03355000
    RWCTL      = 110,  << DIAG/STATUS READ/WRT CTRL >>                  03360000
    STATUS     = 125,  << I/O STATUS BUFFER >>                          03365000
                                                                        03370000
       << CHANNEL PROGRAM ENTRIES RELATIVE TO SIOP >>                   03375000
                                                                        03380000
    BRANCHPT      =   1,  << BRANCH POINT TO CP ENTRY POINTS >>         03385000
    DSTATSIOP     = 108,  << DIAG/STATUS ENTRY POINT >>                 03390000
    FILLSIOP      =  41,  << OFFLINE RESTART ENTRY POINT >>             03395000
    IDLESIOP      =  91,  << IDLE CP ENTRY POINT >>                     03400000
    IDSIOP        = 111,  << IDENTIFY ENTRY POINT >>                    03405000
    INITSIOP      = 115,  << INITIATION ENTRY POINT >>                  03410000
    PRE'DSBSIOP   =  26,  << PRESPACE DISABLE ESC SEQ ENTRY >>          03415000
    POST'DSBSIOP  =  86,  << POSTSPACE DISABLE ESC SEQ ENTRY >>         03420000
    POST'ENBSIOP  =  60,  << POSTSPACE ENABLE ESC SEQ ENTRY >>          03425000
    STATSIOP      = 101,  << STATUS INTERROGATION ENTRY POINT >>        03430000
                                                                        03435000
       << COMPLETION STATUSES >>                                        03440000
                                                                        03445000
    ABORTED   =  %33,  << REQUEST ABORTED >>                            03450000
    CHANFAIL  = %144,  << I/O CHANNEL ERROR >>                          03455000
    GOODIO    =    1,  << SUCCESSFUL I/O COMPLETION >>                  03460000
    INVALIDOP =    4,  << INVALID OPERATION REQUESTED >>                03465000
    PARITY    = %214,  << PARITY ERROR >>                               03470000
    PFABORT   =  %63,  << REQUEST ABORTED DUE TO POWER FAILURE >>       03475000
    POWERUP   = %213,  << UNIT RESET DUE TO POWER FAIL OR RESET >>      03480000
    SIOFAIL   =  %44,  << SIO FAILURE >>                                03485000
    SYSERROR  = %124,  << SYSTEM ERROR >>                               03490000
    TIMOUTERR =  %24,  << TIMED OUT ERROR >>                            03495000
    UNITERR   =  %54,  << UNIT FAILURE >>                               03500000
$PAGE                                                                   03505000
                                                                        03510000
       << DRIVER STATES >>                                              03515000
                                                                        03520000
    CMPLTIONWAIT  = 1,  << WAITING FOR I/O COMPLETION INTERRUPT >>      03525000
    NOTRDYWAIT    = 2,  << NOT READY WAIT IN PROGRESS >>                03530000
    INITIOWAIT    = 3,  << INIT UNIT VIA DEV CLEAR IN PROGRESS >>       03535000
                                                                        03540000
       << SIODM STATES >>                                               03545000
                                                                        03550000
    INTRPTWAIT  = %13,  << WAIT FOR I/O COMPLETION >>                   03555000
    NOTREADY    =   7,  << UNIT NOT READY >>                            03560000
    REQUESTDONE =   5,  << REQUEST DONE >>                              03565000
                                                                        03570000
       << IOMESSAGE PARAMETERS >>                                       03575000
                                                                        03580000
    NOTRDYMSG    = 11,  << NOT READY MESSAGE >>                         03585000
    OPCONSOLE    =  0,  << OUTPUT MESSAGE TO SYSTEM CONSOLE >>          03590000
    POWERUPMSG   = 13,  << POWER RESTORED/UNIT RESET MESSAGE >>         03595000
                                                                        03600000
       << MISCELLANEOUS EQUATES >>                                      03605000
                                                                        03610000
    DCLOSE      =     4,  << DEVICE CLOSE FUNCTION >>                   03615000
    FOPEN       =     2,  << FILE OPEN FUNCTION >>                      03620000
    FCLOSE      =     3,  << FILE CLOSE FUNCTION >>                     03625000
    FULL'       =    14,  << LINE PRINTER BUFFER FULL >>                03630000
    HP2617J     =     3,  << Device subtype for HP2613/17J>>   <<04744>>03635000
    IOTIMER     =   %20,  << IO TIMER PARAMETER >>                      03640000
    ISIOP       =     8,  << ILT CHANNEL PROGRAM AREA POINTER >>        03645000
    PARITYERR   =    -1,  << PARITY ERROR LOGGING VALUE >>              03650000
    PRESPACE'   =    13,  << LAST REQUEST USED PRESPACING >>            03655000
    SYSDB       = %1000,  << ADDRESS OF SYSDB AREA >>                   03660000
    SYSLPDT     =   %10,  << DB relative base of LPDT >>       <<04744>>03665000
  ENDEQ         =     0;                                                03670000
                                                               <<04744>>03675000
    << Useful declarations >>                                  <<04744>>03680000
                                                               <<06718>>03685000
$PAGE                                                                   03690000
                                                                        03695000
       << I/O STATUS BIT DEFINITIONS >>                                 03700000
                                                                        03705000
     DEFINE                                                             03710000
       ONLINE     = ( 0:1)#, << ONLINE BIT >>                           03715000
       PROTOBIT   = ( 3:1)#, << PROTOCOL ERROR BIT >>                   03720000
       PARITYBIT  = ( 4:1)#, << PARITY ERROR BIT >>                     03725000
       PAPERBIT   = ( 6:1)#, << PAPER ERROR BIT >>                      03730000
       PON        = ( 7:1)#, << UNIT POWERED UP OR WAS RESET >>         03735000
                                                                        03740000
       << QMISC BIT DEFINITIONS >>                                      03745000
                                                                        03750000
       BUF'FILL   = ( 5:1)#, << BUFF FILL OPERATION IN PROCESS >>       03755000
       PRE'TO'POST= ( 0:1)#, << PRE TO POST SPACING CHANGE FLAG >>      03760000
       PEJECT     = ( 1:1)#, << LAST OPERATION WAS A PAGE EJECT >>      03765000
       PONBIT     = ( 2:1)#, << POWER ON IN PROGRESS >>                 03770000
       TOUT       = ( 3:1)#, << CHANNEL TIMED OUT ONCE FLAG >>          03775000
       WAITCODE   = (12:4)#, << INDICATES TYPE OF WAIT >>               03780000
                             <<   0 - NEW REQUEST      >>               03785000
                             <<   1 - COMPLETION WAIT  >>               03790000
                             <<   2 - NOT READY WAIT   >>               03795000
                             <<   3 - INITIATION WAIT  >>               03800000
                                                                        03805000
       << DSAVE BIT DEFINITIONS >>                                      03810000
                                                                        03815000
       BETJOB     = (11:1)#, << BETWEEN PRINTING A JOB >>               03820000
       ABORTBIT   = (12:1)#, << PFAIL/OPER ABORT OCCURRED >>            03825000
       PRESPACE   = (13:1)#, << LAST REQUEST USED PRESPACING >>         03830000
       FULL       = (14:1)#, << LINE PRINTER BUFFER IS FULL >>          03835000
       TOP        = (15:1)#, << PRINTER IS AT TOP-OF-FORM (TOF) >>      03840000
                                                                        03845000
       << MISCELLANEOUS BIT DEFINITIONS >>                              03850000
                                                                        03855000
        ABS        = ABSOLUTE#, << ABSOLUTE COMMAND >>         <<06718>>03860000
       CMD        = (12:4)#, << SECONDARY COMMAND >>                    03865000
       DCODE      = ( 0:8)#, << COMMAND CODE >>                         03870000
       DIAG       = ( 2:1)#, << QFLAG, DIAGNOSTIC BIT >>                03875000
       DLDEVN     = ( 8:8)#, << LOGICAL DEVICE NUMBER OF DIT >>         03880000
       ERRORCODE  = ( 0:3)#, << CPVAP, ERROR CODE >>                    03885000
       FUNC       = ( 8:8)#, << QFUNC, FUNCTION CODE >>                 03890000
       IOSTAT     = ( 8:8)#, << QSTAT, REQUEST STATUS RETURNED >>       03895000
       LRBIT      = ( 1:1)#, << WRT INSTRUCTION LEFT/RIGHT BYTE BIT >>  03900000
       PFAIL      = (11:1)#, << QFLAG, ABORT SET DUE TO POWER FAIL >>   03905000
       SFAIL      = (10:1)#, << QFLAG, FAILURE ON DELAYED START SIO >>  03910000
       STEPOVER   = (14:1)#, << IF SET THEN NO PAGE STEPOVER >>         03915000
       TIMEDOUT   = (13:1)#, << CPVAP, TRANSFER ABORTED-TIMED OUT >>    03920000
       LOADMEMORY = ASSEMBLE(LSEA)#,                                    03925000
       STOREMEMORY= ASSEMBLE(SSEA)#,                                    03930000
     ENDDEF       = 0#;                                                 03935000
                                                                        03940000
                                                                        03945000
$PAGE                                                                   03950000
<<                                                                      03955000
        *********************************                               03960000
        *                               *                               03965000
        *   DRIVER DB AREA DEFINITION   *                               03970000
        *                               *                               03975000
        *********************************                               03980000
>>                                                                      03985000
                                                                        03990000
        ARRAY INITIAL(0:145) = DB :=                           <<06718>>03995000
        [8/14,8/1],   << LP DIT SIZE, NOT CORE RESIDENT >>     <<06718>>04000000
                      << NO IDLE CHANNEL PROGRAM, DRIVER TYPE >>        04005000
                 0,   << NOT USED >>                                    04010000
                 0,   << UNIT EXTRACT INSTRUCTION - NOT USED >>         04015000
        [8/64,8/1],   << CHANNEL PROG SIZE/2, RET STAT SIZE >> <<06718>>04020000
                                                                        04025000
        << LP DIT >>                                                    04030000
                 0,   << DFLAG >>                                       04035000
                 0,   << DLINK >>                                       04040000
                 0,   << DIOQP >>                                       04045000
                 0,   << DLDEV >>                              <<06718>>04050000
                 0,   << DDLTP >>                                       04055000
                 0,   << DILTP >>                                       04060000
                 0,   << DSAVE >>                                       04065000
                 0,   << DSERR >>                                       04070000
                 0,   << DTIME >>                                       04075000
                 0,   << DSTAT >>                              <<06718>>04080000
            %40000,   << DUNIT >>                              <<06718>>04085000
                 0,   << DLOGERROR >>                                   04090000
                 0,   << DLOGERR+1 >>                          <<06718>>04095000
                 0,   << DRQST >>                              <<06718>>04100000
                                                                        04105000
                                                                        04110000
        << CHANNEL PROGRAM >>                                           04115000
                                                                        04120000
                                                                        04125000
<< 0>>  << JUMP >>              0,  << BRANCH POINT TO CP SECTION >>    04130000
<< 1>>                          0,  << JMP *+0 PRE, JMP *+26 POST >>    04135000
                                                                        04140000
                                                                        04145000
        << PRESPACE MODE SECTION >>                                     04150000
                                                                        04155000
                                                                        04160000
<< 2>>  << WRITE CTRL >>    %2002,  << ENABLE ALL ESCAPE SEQUENCES >>   04165000
<< 3>>                          1,                                      04170000
<< 4>>                          0,                                      04175000
<< 5>>                     %42000,                                      04180000
<< 6>>                          0,                                      04185000
                                                                        04190000
<< 7>>  << WAIT >>          %1000,  << MAKE SURE UNIT IS RESPONDING >>  04195000
<< 8>>                          0,                                      04200000
                                                                        04205000
<< 9>>  << DSJ >>           %2403,  << CHECK PRINTER'S CONDITION >>     04210000
<<10>>                          0,  << RETURN BYTE >>                   04215000
<<11>>                          0,  << PRINTER RDY TO ACCEPT DATA >>    04220000
<<12>>                         88,  << INVALID BYTE-READ STATUS >>      04225000
<<13>>                         88,  << READ STATUS REQUIRED >>          04230000
<<14>>                         88,  << INVALID BYTE-READ STATUS >>      04235000
                                                                        04240000
<<15>>  << WRITE DATA >>    %2000,  << WRITE OUT ESCAPE SEQUENCE >>     04245000
<<16>>                          0,                                      04250000
<<17>>                          0,                                      04255000
<<18>>                          0,                                      04260000
<<19>>                          0,                                      04265000
                                                                        04270000
<<20>>  << WAIT >>          %1000,  << MAKE SURE UNIT IS RESPONDING >>  04275000
<<21>>                          0,                                      04280000
                                                                        04285000
<<22>>  << DSJ >>           %2403,  << CHECK PRINTER'S CONDITION >>     04290000
<<23>>                          0,  << RETURN BYTE >>                   04295000
<<24>>                          0,  << PRINTER RDY TO ACCEPT DATA >>    04300000
<<25>>                         75,  << INVALID BYTE-READ STATUS >>      04305000
<<26>>                         75,  << READ STATUS REQUIRED >>          04310000
<<27>>                         75,  << INVALID BYTE-READ STATUS >>      04315000
                                                                        04320000
<<28>>  << WRITE CTRL >>    %2002,  << DISABLE ALL ESCAPE SEQUENCE >>   04325000
<<29>>                          1,                                      04330000
<<30>>                          0,                                      04335000
<<31>>                     %44000,                                      04340000
<<32>>                          0,                                      04345000
                                                                        04350000
<<33>>  << WAIT >>          %1000,  << WAIT FOR UNIT TO // POLL >>      04355000
<<34>>                          0,                                      04360000
                                                                        04365000
<<35>>  << DSJ >>           %2403,  << CHECK PRINTER'S CONDITION >>     04370000
<<36>>                          0,  << RETURN BYTE >>                   04375000
<<37>>                          0,  << PRINTER RDY TO ACCEPT DATA >>    04380000
<<38>>                         62,  << INVALID BYTE-READ STATUS >>      04385000
<<39>>                         62,  << READ STATUS REQUIRED >>          04390000
<<40>>                         62,  << INVALID BYTE-READ STATUS >>      04395000
                                                                        04400000
                                                                        04405000
        << WRITE OUT DATA SECTION >>                                    04410000
                                                                        04415000
                                                                        04420000
<<41>>  << JUMP >>              0,  << JMP *+0 TO FILL BUFFER >>        04425000
<<42>>                          0,  << JMP *+17 OTHERWISE >>            04430000
                                                                        04435000
<<43>>  << WRITE DATA >>    %2000,  << WRITE OUT DATA BUFFER >>         04440000
<<44>>                          0,                                      04445000
<<45>>                        128,                                      04450000
<<46>>                    %100000,                                      04455000
<<47>>                          0,                                      04460000
                                                                        04465000
<<48>>  << JUMP >>              0,                                      04470000
<<49>>                          2,  << JMP *+2, END OF TRANSFER >>      04475000
                                                                        04480000
<<50>>  << JUMP >>              0,                                      04485000
<<51>>                    %177755,  << JMP *-19, END OF BURST >>        04490000
                                                                        04495000
<<52>>  << WAIT >>          %1000,  << WAIT FOR UNIT TO // POLL >>      04500000
<<53>>                          0,                                      04505000
                                                                        04510000
<<54>>  << DSJ >>           %2403,  << CHECK PRINTER'S CONDITION >>     04515000
<<55>>                          0,  << RETURN BYTE >>                   04520000
<<56>>                          0,  << PRINTER RDY TO ACCEPT DATA >>    04525000
<<57>>                         43,  << INVALID BYTE-READ STATUS >>      04530000
<<58>>                         43,  << READ STATUS REQUIRED >>          04535000
<<59>>                         43,  << INVALID BYTE-READ STATUS >>      04540000
                                                                        04545000
                                                                        04550000
        << POSTSPACE MODE SECTION >>                                    04555000
                                                                        04560000
                                                                        04565000
<<60>>  << JUMP >>              0,  << JMP *+0 FOR POSTSPACE REQ >>     04570000
<<61>>                          0,  << JMP *+39 OTHERWISE >>            04575000
                                                                        04580000
<<62>>  << WRITE CTRL >>    %2002,  << ENABLE ALL ESCAPE SEQUENCES >>   04585000
<<63>>                          1,                                      04590000
<<64>>                          0,                                      04595000
<<65>>                     %42000,                                      04600000
<<66>>                          0,                                      04605000
                                                                        04610000
<<67>>  << WAIT >>          %1000,  << MAKE SURE UNIT IS RESPONDING >>  04615000
<<68>>                          0,                                      04620000
                                                                        04625000
<<69>>  << DSJ >>           %2403,  << CHECK PRINTER'S CONDITION >>     04630000
<<70>>                          0,  << RETURN BYTE >>                   04635000
<<71>>                          0,  << PRINTER RDY TO ACCEPT DATA >>    04640000
<<72>>                         28,  << INVALID BYTE-READ STATUS >>      04645000
<<73>>                         28,  << READ STATUS REQUIRED >>          04650000
<<74>>                         28,  << INVALID BYTE-READ STATUS >>      04655000
                                                                        04660000
<<75>>  << WRITE DATA >>    %2000,  << WRITE OUT ESCAPE SEQUENCE >>     04665000
<<76>>                          0,                                      04670000
<<77>>                          0,                                      04675000
<<78>>                          0,                                      04680000
<<79>>                          0,                                      04685000
                                                                        04690000
<<80>>  << WAIT >>          %1000,  << MAKE SURE UNIT IS RESPONDING >>  04695000
<<81>>                          0,                                      04700000
                                                                        04705000
<<82>>  << DSJ >>           %2403,  << CHECK PRINTER'S CONDITION >>     04710000
<<83>>                          0,  << RETURN BYTE >>                   04715000
<<84>>                          0,  << PRINTER RDY TO ACCEPT DATA >>    04720000
<<85>>                         15,  << INVALID BYTE-READ STATUS >>      04725000
<<86>>                         15,  << READ STATUS REQUIRED >>          04730000
<<87>>                         15,  << INVALID BYTE-READ STATUS >>      04735000
                                                                        04740000
<<88>>  << WRITE CTRL >>    %2002,  << DISABLE ALL ESCAPE SEQUENCE >>   04745000
<<89>>                          1,                                      04750000
<<90>>                          0,                                      04755000
<<91>>                     %44000,                                      04760000
<<92>>                          0,                                      04765000
                                                                        04770000
                                                                        04775000
        << IDLE CHANNEL PROGRAM SECTION >>                              04780000
                                                                        04785000
                                                                        04790000
<<93>>  << WAIT >>          %1000,  << WAIT FOR UNIT TO // POLL >>      04795000
<<94>>                          0,                                      04800000
                                                                        04805000
<<95>>  << DSJ >>           %2403,  << CHECK PRINTER'S STATE >>         04810000
<<96>>                          0,  << RETURN BYTE >>                   04815000
<<97>>                          0,  << PRINTER RDY TO ACCEPT DATA >>    04820000
<<98>>                          2,  << INVALID BYTE-READ STATUS >>      04825000
<<99>>                          2,  << READ STATUS REQUIRED >>          04830000
<<100>>                         2,  << INVALID BYTE-READ STATUS >>      04835000
                                                                        04840000
<<101>> << INT/HLT >>        %601,  << INTERRUPT/HALT >>                04845000
<<102>>                         1,  << CODE OF 1 IN CPVA(1) >>          04850000
                                                                        04855000
                                                                        04860000
        << I/O STATUS INTERROGATION SECTION >>                          04865000
                                                                        04870000
                                                                        04875000
<<103>> << READ STATUS >>   %1416,  << READ STATUS BYTES >>             04880000
<<104>>                         1,  << #BYTES >>                        04885000
<<105>>                         0,                                      04890000
<<106>>                     %2000,                                      04895000
<<107>>                         0,                                      04900000
                                                                        04905000
<<108>> << INT/HALT >>       %601,  << INTERRUPT/HALT >>                04910000
<<109>>                         2,  << CODE OF 2 IN CPVA(1) >>          04915000
                                                                        04920000
                                                                        04925000
         << DIAGNOSTICS AND READ STATUS SECTION >>                      04930000
                                                                        04935000
                                                                        04940000
<<110>> << RD/WRT CTRL >>   %2002,  << SEND DIAG/STATUS CMD BYTE >>     04945000
<<111>>                         0,                                      04950000
<<112>>                         0,                                      04955000
<<113>> << IDENTIFY >>          0,                                      04960000
<<114>>                         0,                                      04965000
                                                                        04970000
<<115>> << JUMP >>              0,                                      04975000
<<116>>                         0,  << JUMP * - 16/24 >>                04980000
                                                                        04985000
                                                                        04990000
        << INITIALIZATION SECTION >>                                    04995000
                                                                        05000000
                                                                        05005000
<<117>> << CLEAR >>         %4401,  << CLEAR DEV W/PARITY CHECK >>      05010000
<<118>>                         0,                                      05015000
                                                                        05020000
<<119>> << INT/HLT >>        %601,  << INTERRUPT/HALT >>                05025000
<<120>>                         0,  << CODE OF 0 IN CPVA(1) >>          05030000
                                                                        05035000
                                                                        05040000
        << CONTROL CODES, ESCAPE SEQUENCES, & MISC. STORAGES >>         05045000
                                                                        05050000
                                                                        05055000
<<121>> << ESC'ADR >>     %015446,  << ESC & >>                         05060000
<<122>>                   %066040,  << l [space] >>                     05065000
<<123>> << ESC'PARM >>    %020040,  << #SLEW, VFC CHAN# >>              05070000
<<124>> << ESC'ALPHA >>   %020040,  << "U", "V" >>                      05075000
<<125>> << STATUS >>            0,  << STATUS BUFFER >>                 05080000
<<126>> << ENB'ESC >>        %200,  << ENABLE ESC SEQ BYTE >>           05085000
<<127>> << DSB'ESC >>        %202;  << DISABLE ESC SEQ BYTE >>          05090000
$PAGE                                                                   05095000
<<                                                                      05100000
         ***************************************                        05105000
         *                                     *                        05110000
         *   EXTERNAL PROCEDURE DECLARATIONS   *                        05115000
         *                                     *                        05120000
         ***************************************                        05125000
>>                                                                      05130000
                                                                        05135000
   PROCEDURE ABORTTIMEREQ(TRLX);                                        05140000
     VALUE TRLX;   INTEGER TRLX;                                        05145000
     OPTION EXTERNAL;                                                   05150000
                                                                        05155000
   PROCEDURE GIP'HPIB;                                                  05160000
     OPTION EXTERNAL;                                                   05165000
                                                                        05170000
   PROCEDURE HELP;                                                      05175000
     OPTION EXTERNAL;                                                   05180000
                                                                        05185000
   LOGICAL PROCEDURE IOMESSAGE(SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,         05190000
                               DEST,REPLY,OFFSET,DITP,IOTYPE);          05195000
     VALUE SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,           05200000
           DITP,IOTYPE;                                                 05205000
     INTEGER SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET;         05210000
     INTEGER IOTYPE;                                                    05215000
     INTEGER POINTER DITP;                                              05220000
     OPTION VARIABLE, EXTERNAL;                                         05225000
                                                                        05230000
   PROCEDURE SIODM(DITP,FLAGS);                                         05235000
     VALUE DITP,FLAGS;   LOGICAL FLAGS;                                 05240000
     POINTER DITP;   OPTION EXTERNAL;                                   05245000
                                                                        05250000
   PROCEDURE MASTERCLEARHPIB(DITP);                                     05255000
     ARRAY DITP;   OPTION EXTERNAL;                                     05260000
                                                                        05265000
   PROCEDURE START'HPIB(DITP,SIOP,QFLAG);                               05270000
     VALUE DITP,SIOP,QFLAG;   LOGICAL QFLAG;                            05275000
     POINTER DITP,SIOP;   OPTION EXTERNAL;                              05280000
                                                                        05285000
   INTEGER PROCEDURE TIMEREQ(CODE,REQ,TIME);                            05290000
     VALUE CODE,REQ,TIME;                                               05295000
     INTEGER CODE,REQ;   DOUBLE TIME;                                   05300000
     OPTION EXTERNAL;                                                   05305000
$PAGE                                                                   05310000
   DOUBLE PROCEDURE INT2ASC(NUMBER,COUNT);                              05315000
                                                                        05320000
<<---------------------------------------------------->>                05325000
<<                                                    >>                05330000
<<   THIS PROCEDURE CONVERTS AN INTEGER NUMBER TO     >>                05335000
<<   ITS ASCII EQUIVALENT.                            >>                05340000
<<                                                    >>                05345000
<<     NUMBER = DECIMAL NUMBER                        >>                05350000
<<     COUNT  = NUMBER OF ASCII CHAR TO RETURN        >>                05355000
<<                                                    >>                05360000
<<   FUNCTION RET: 2 ASCII WORDS FOR INTEGER VALUE    >>                05365000
<<                                                    >>                05370000
<<---------------------------------------------------->>                05375000
                                                                        05380000
     VALUE NUMBER,COUNT;                                                05385000
     INTEGER NUMBER,COUNT;                                              05390000
                                                                        05395000
     BEGIN                                                              05400000
                                                                        05405000
     DOUBLE ASCBUF = Q + 1;                                             05410000
                                                                        05415000
     BYTE ARRAY                                                         05420000
       BSCBUF(*) = ASCBUF;                                              05425000
                                                                        05430000
     INTEGER XREG = X;                                                  05435000
                                                                        05440000
     TOS := %20040;  << INIT RET BUFFER AREA >>                         05445000
     TOS := %20040;                                                     05450000
                                                                        05455000
     TOS := NUMBER;  << GET INTEGER NUMBER >>                           05460000
     XREG := COUNT;  << NUMBER OF ASCII CHAR >>                         05465000
                                                                        05470000
     DO BEGIN                                                           05475000
       TOS := 10;  << BASE 10 >>                                        05480000
       ASSEMBLE(DIV,DECX);  << NUMBER/10 >>                             05485000
       BSCBUF(XREG) := TOS + %60;                                       05490000
       ASSEMBLE (TEST);                                                 05495000
       END                                                              05500000
     UNTIL = ;                                                          05505000
                                                                        05510000
     INT2ASC := ASCBUF;  << RET. ASCII VALUES >>                        05515000
                                                                        05520000
     END;                                                               05525000
                                                                        05530000
$PAGE                                                                   05535000
<<       ******************************************                     05540000
         *                                        *                     05545000
         *   LP DRIVER INITIALIZATION PROCEDURE   *                     05550000
         *                                        *                     05555000
         ******************************************                     05560000
>>                                                                      05565000
                                                                        05570000
                                                                        05575000
   PROCEDURE LPINIT(DITP);                                              05580000
     INTEGER ARRAY DITP;                                                05585000
                                                                        05590000
<<---------------------------------------------------->>                05595000
<<                                                    >>                05600000
<<   THIS PROCEDURE INITIALIZES THE RESTRICTED MODE   >>                05605000
<<   ADDRESSES AND THE STATUS BUFFER ADDRESSES IN     >>                05610000
<<   THE CHANNEL PROGRAM.                             >>                05615000
<<                                                    >>                05620000
<<---------------------------------------------------->>                05625000
                                                                        05630000
     BEGIN                                                              05635000
       INTEGER POINTER ILTP   = Q+1;                                    05640000
       INTEGER POINTER SIOP   = Q+2;                                    05645000
       INTEGER SIOBASE        = Q+3;                                    05650000
       INTEGER POINTER INITCP = Q+4;                                    05655000
                                                                        05660000
       TOS := DITP(DILTP);      << ILTP    >>                           05665000
       TOS := ILTP(ISIOP);      << SIOP    >>                           05670000
       TOS := @SIOP + SYSDB;    << SIOBASE >>                           05675000
       TOS := @SIOP + INIT;     << INITCP >>                            05680000
                                                                        05685000
       SIOP(6) := SIOP(66) := SIOBASE + ENB'ESC;                        05690000
       SIOP(32) := SIOP(92) := SIOBASE + DSB'ESC;                       05695000
       SIOP(107) := SIOBASE + STATUS;                                   05700000
                                                                        05705000
     END;                                                               05710000
$PAGE                                                                   05715000
<<       ************************************************               05720000
         *                                              *               05725000
         *   LINE PRINTER DRIVER PROCEDURE  -  LPDRVR   *               05730000
         *                                              *               05735000
         ************************************************               05740000
>>                                                                      05745000
                                                                        05750000
   INTEGER PROCEDURE LPDRVR                                    <<06718>>05755000
           (IOQ'ENTRY'INDEX,DITP,BANK,BUFFADDR,SIOP,DRTN);     <<06718>>05760000
                                                                        05765000
<<--------------------------------------------------------->>           05770000
<<                                                         >>           05775000
<<   THIS PROCEDURE INITIATES AND COMPLETES I/O REQUESTS   >>           05780000
<<   FOR THE HP2619A LINE PRINTER CONNECTED TO THE HP-IB   >>           05785000
<<   AND CONTROLLED BY THE GIC.                            >>           05790000
<<                                                         >>           05795000
<<   MODE RETURNS IN LPDRVR -                              >>           05800000
<<     5 - REQUEST COMPLETED                               >>           05805000
<<     7 - NOT READY WAIT                                  >>           05810000
<<   %13 - WAIT FOR COMPLETION                             >>           05815000
<<                                                         >>           05820000
<<--------------------------------------------------------->>           05825000
                                                                        05830000
   VALUE DITP,IOQ'ENTRY'INDEX,BANK,BUFFADDR,SIOP,DRTN;         <<06718>>05835000
   INTEGER BANK,BUFFADDR,DRTN;                                          05840000
   INTEGER POINTER DITP,SIOP;                                  <<06718>>05845000
   INTEGER IOQ'ENTRY'INDEX;                                    <<06718>>05850000
   OPTION PRIVILEGED,UNCALLABLE;                                        05855000
                                                                        05860000
   BEGIN                                                                05865000
     LOGICAL ARRAY                                                      05870000
       DITPL(*) = DITP;                                        <<06718>>05875000
                                                                        05880000
     DOUBLE                                                             05885000
       BUFFADDRD = Q- 7,   << BANK AND BUFFER ADDRESS >>                05890000
       ASCIIAREA;          << ASCII CTRL BYTE AREA >>          <<06718>>05895000
                                                                        05900000
     INTEGER POINTER                                                    05905000
       CPVAP;             << HOLDS CHANNEL I/O STATUS >>       <<06718>>05910000
                                                                        05915000
     INTEGER                                                            05920000
       COUNT,             << BUFFER BYTE COUNT >>              <<06718>>05925000
       PARAM,             << CONTROL PARAMETER >>              <<06718>>05930000
       PRINTCTL,          << PRINT CONTROL BYTE >>             <<06718>>05935000
       FCODE,             << FUNCTION CODE >>                  <<06718>>05940000
       S0       = S-0;                                                  05945000
                                                               <<04744>>05950000
     INTEGER                                                   <<04744>>05955000
       SUBTYPE;           << PRINTER SUBTYPE >>                <<06718>>05960000
                                                                        05965000
    INTEGER ARRAY                                                       05970000
      TEMP(*)   = ASCIIAREA;                                            05975000
                                                                        05980000
    BYTE ARRAY                                                          05985000
      BTEMP(*)  = TEMP;                                                 05990000
                                                                        05995000
    INTEGER LPDT'INDEX;                                        <<06718>>06000000
                                                                        06005000
$PAGE                                                                   06010000
<<---------------------------------------------------->>                06015000
<<                                                    >>                06020000
<<   INITIALIZE LOCAL POINTERS AND VARIABLES          >>                06025000
<<                                                    >>                06030000
<<---------------------------------------------------->>                06035000
                                                                        06040000
     @CPVAP := DITP(DILTP);    << CPVAP >>                     <<06718>>06045000
     COUNT := IOQ'COUNT;       << COUNT >>                     <<06718>>06050000
     PARAM := 0;               << PARAM >>                     <<06718>>06055000
     PRINTCTL := 0;            << PRINTCTL >>                  <<06718>>06060000
     FCODE := IOQ'FUNC;        << FCODE >>                     <<06718>>06065000
     TEMP(0) := %20040;        << TEMP(0) >>                   <<06718>>06070000
     TEMP(1) := %20040;        << TEMP(1) >>                   <<06718>>06075000
                                                               <<06718>>06080000
     LPDT'INDEX := DITP(DLDEV) * INTEGER(LPDT'ENTRY'SIZE);     <<06718>>06085000
     SUBTYPE := LPDT'SUBTYPE;   << LPDT.SUBTYPE >>             <<06718>>06090000
                                                                        06095000
     IF IOQ'ENTRY'INDEX=0 THEN GO TO EXIT;<<NOTHING TO DO >>   <<06718>>06100000
                                                                        06105000
     IF IOQ'QMISC.WAITCODE = CMPLTIONWAIT THEN                 <<06718>>06110000
       ABORTTIMEREQ(DITP(DRQST));                                       06115000
                                                                        06120000
     IF IOQ'ABORT THEN  << ABORT PROCESS >>                    <<06718>>06125000
       BEGIN                                                            06130000
         IF DITP(DSAVE).ABORTBIT <> 0 THEN   << ABORT OCCURRED >>       06135000
           BEGIN   << CLEAN UP EXCESS IOQ'S RETURNING ABORT STATUS >>   06140000
             DITP(DSAVE).(13:3) := 0;   << CLEAR DRIVER FLAGS >>        06145000
             TOS := IF IOQ'PFAIL THEN PFABORT ELSE ABORTED;    <<06718>>06150000
             GOTO IODONE;                                               06155000
           END;                                                         06160000
         DITP(DSAVE).ABORTBIT := 1;  << SET ABORT FLG >>                06165000
         GOTO INITDEV;   << DO INITIALIZATION >>                        06170000
         HELP;   << LINK FOR DEBUGGER HELP >>                           06175000
       END                                                              06180000
                                                                        06185000
     ELSE DITP(DSAVE).ABORTBIT := 0;   << RESET ABORT FLG >>            06190000
                                                                        06195000
<<---------------------------------------------------->>                06200000
<<                                                    >>                06205000
<<   CHECK FOR RETURN FROM NOTREADY CONDITION         >>                06210000
<<                                                    >>                06215000
<<---------------------------------------------------->>                06220000
                                                                        06225000
     IF IOQ'QMISC.WAITCODE = NOTRDYWAIT THEN                   <<06718>>06230000
       BEGIN                                                            06235000
         IF SIOP(STATUS).PON = 1 THEN   << PON JUST OCCUR >>            06240000
           BEGIN                                                        06245000
           IOQ'QMISC.PONBIT := 1;                              <<06718>>06250000
           DITP(DSAVE).BETJOB := 0;   << IN BETWEEN JOB >>              06255000
           GOTO IDLECP;   << CHECK FOR ONLINE OR OFFLINE >>             06260000
           END;                                                         06265000
         IOQ'QMISC.PONBIT :=0;                                 <<06718>>06270000
         IF IOQ'QMISC.PONBIT=1 THEN <<PON OCCURED PREVIOUSLY>> <<06718>>06275000
           BEGIN                                                        06280000
             IOQ'QMISC.PONBIT := 1;   << SET PON FLG >>        <<06718>>06285000
             GOTO INITDEV;   << DO INITIALIZATION >>                    06290000
           END;                                                         06295000
         GOTO RESTART;                                                  06300000
       END;                                                             06305000
                                                                        06310000
     IF IOQ'QMISC.WAITCODE = CMPLTIONWAIT THEN                 <<06718>>06315000
       GOTO LPCONT;   << COMPLETION INTERRUPT >>                        06320000
                                                                        06325000
     IF IOQ'QMISC.WAITCODE = INITIOWAIT THEN                   <<06718>>06330000
       BEGIN                                                            06335000
         IOQ'QMISC.PONBIT := 0;                                <<06718>>06340000
         IF IOQ'QMISC.PONBIT=1 THEN <<POWERUP/RESET PERFORMED>><<06718>>06345000
           BEGIN                                                        06350000
             IF IOQ'DIAG THEN     << DIAGNOSTIC COMPLETION >>  <<06718>>06355000
               BEGIN                                                    06360000
                 TOS := POWERUP;                                        06365000
                 GOTO IODONE;                                           06370000
               END ELSE                                                 06375000
                                                                        06380000
             IF IOMESSAGE(1,POWERUPMSG,%10000,DITP(DLDEV),     <<06718>>06385000
                          ,,,,OPCONSOLE) THEN                           06390000
               BEGIN                                                    06395000
                 IF DITP(DSAVE).BETJOB = 1 THEN                         06400000
                   GOTO LPINIT   << SUPPRESS POWER FAIL MSG >>          06405000
                 ELSE                                                   06410000
                   BEGIN   << REPORT POWER FAIL STATUS >>               06415000
                     TOS := POWERUP;                                    06420000
                     GOTO IODONE;                                       06425000
                   END;                                                 06430000
               END;                                                     06435000
                                                                        06440000
             TOS := SYSERROR;   << INDICATE FAILURE AS THERE >>         06445000
             GOTO IODONE;       << ARE NO MESSAGE LINK BUFFS >>         06450000
           END                                                          06455000
                                                                        06460000
         ELSE                                                           06465000
           BEGIN   << BADIO COMPLETION >>                               06470000
             LPDRVR := REQUESTDONE;                                     06475000
             RETURN;                                                    06480000
           END;                                                         06485000
       END;                                                             06490000
                                                                        06495000
     GOTO LPINIT;                                                       06500000
                                                                        06505000
<<---------------------------------------------------->>                06510000
<<                                                    >>                06515000
<<   PRINTER INITIALIZATION - DEVICE CLEAR TO CLEAR   >>                06520000
<<      BUFFERS AND RESET FIRMWIRE TO A KNOWN STATE   >>                06525000
<<                                                    >>                06530000
<<---------------------------------------------------->>                06535000
                                                                        06540000
  INITDEV:                                                              06545000
     SIOP(BRANCHPT) := INITSIOP;   << INIT CP ENTRY >>                  06550000
     START'HPIB(DITP,SIOP,TRUE);                                        06555000
     IF < THEN                                                          06560000
       BEGIN                                                            06565000
         TOS := SIOFAIL;                                                06570000
         GOTO IODONE;                                                   06575000
       END;                                                             06580000
     IOQ'QMISC.WAITCODE := INITIOWAIT;                         <<06718>>06585000
     LPDRVR := INTRPTWAIT;                                              06590000
     RETURN;                                                            06595000
$PAGE                                                                   06600000
<<****************************************************>>                06605000
<<                                                    >>                06610000
<<   LINE PRINTER INITIALIZATION SECTION              >>                06615000
<<                                                    >>                06620000
<<****************************************************>>                06625000
                                                                        06630000
  LPINIT:                                                               06635000
     SIOP(PREJMP) := 26;   << INIT W/PRESPACE BYPASSED IN CP >>         06640000
     SIOP(POSTJMP) := 39;   << INIT W/POSTSPACE BYPASSED IN CP >>       06645000
     SIOP(BUFFJMP) := 17;   << INIT W/BUFFER WRT BYPASSED IN CP >>      06650000
                                                                        06655000
     SIOP(PRE'DCNT) := 1;   << INIT PRESPACE DSB ESC SEQ CNT >>         06660000
     SIOP(PRE'DADR).LRBIT := 1;   << INIT TO START W/RT BYTE >>         06665000
     SIOP(POST'DCNT) := 1;   << INIT POSTSPACE DSB ESC SEQ CNT >>       06670000
     SIOP(POST'DADR).LRBIT := 1;   << INIT TO START W/RT BYTE >>        06675000
                                                                        06680000
     SIOP(PRE'ESC) := SIOP(POST'ESC) := @SIOP+SYSDB+ESC'ADR;            06685000
     SIOP(PRE'CNT) := SIOP(POST'CNT) := 8;   << #ESC BYTES >>           06690000
     SIOP(ESC'PARM) := SIOP(ESC'ALPHA) := %20040;   << INIT AREA >>     06695000
                                                                        06700000
<<---------------------------------------------------->>                06705000
<<                                                    >>                06710000
<<   FILE OPEN [FOPEN WITH FCODE = 2]                 >>                06715000
<<   FILE CLOSE [FCLOSE WITH FCODE = 3]               >>                06720000
<<   DEVICE CLOSE [DCLOSE WITH FCODE = 4]             >>                06725000
<<                                                    >>                06730000
<<---------------------------------------------------->>                06735000
                                                                        06740000
     IF FCODE=DCLOSE OR FCODE=FOPEN OR FCODE=FCLOSE THEN                06745000
                                                                        06750000
       BEGIN                                                            06755000
         IF DITP(DSAVE).(FULL':2) = 1 THEN                     <<02697>>06760000
           GO TO PRINTDONE; << EMPTY BUFFER & ALREADY AT TOP >><<02697>>06765000
         SIOP(PREJMP) := 0;                                             06770000
         SIOP(ESC'PARM) := %20061;   << TOF-SELECT CHAN 1 >>            06775000
         SIOP(ESC'ALPHA) := %20126;   << ESC CODE V >>                  06780000
         SIOP(PRE'CNT) := 8;   << ESC SEQ COUNT >>                      06785000
         DITP(DSAVE).FULL := 0;  << SET BUFFER EMPTY >>        <<02697>>06790000
         IF FCODE=DCLOSE THEN                                           06795000
           DITP(DSAVE).(13:3) := 1;   << SET TOF FLAG >>                06800000
         IOQ'QMISC.PEJECT := 1;                                <<06718>>06805000
         GOTO STARTPRINT;                                               06810000
       END                                                              06815000
                                                                        06820000
<<---------------------------------------------------->>                06825000
<<                                                    >>                06830000
<<   FILE WRITE [FWRITE WITH FCODE = 1]               >>                06835000
<<                                                    >>                06840000
<<---------------------------------------------------->>                06845000
                                                                        06850000
   ELSE IF FCODE = 1 THEN                                               06855000
                                                                        06860000
     BEGIN                                                              06865000
     IF DITP(DSAVE).(PRESPACE':2)=3 AND NOT IOQ'PARM2 THEN     <<06718>>06870000
       BEGIN                                                            06875000
         SIOP(PREJMP) := 0;                                             06880000
         IF IOQ'PARM2.STEPOVER THEN                            <<06718>>06885000
           BEGIN  << NO AUTO PAGE EJECT >>                     <<02697>>06890000
             SIOP(ESC'PARM) := %20061;  << SINGLE SPACE SLEW >><<02697>>06895000
             SIOP(ESC'ALPHA) := %20125;  << ESC CODE U >>      <<02697>>06900000
           END                                                 <<02697>>06905000
         ELSE                                                  <<02697>>06910000
           BEGIN  << AUTO PAGE EJECT >>                        <<02697>>06915000
         SIOP(ESC'PARM) := %20063;   << SINGLE SPACE CHAN 3 >>          06920000
         SIOP(ESC'ALPHA) := %20126;   << ESC CODE V >>                  06925000
           END;                                                <<02697>>06930000
         SIOP(PRE'CNT) := 8;   << ESC SEQ COUNT >>                      06935000
         DITP(DSAVE).FULL := 0;   << SET BUFFER EMPTY >>                06940000
        IOQ'QMISC.PRE'TO'POST := 1;                            <<06718>>06945000
         GOTO STARTPRINT;                                               06950000
       END;                                                             06955000
                                                                        06960000
     TOS := IOQ'COUNT;                                         <<06718>>06965000
     IF < THEN   << BYTE COUNT >>                                       06970000
       COUNT := -TOS   << MAKE POSITIVE >>                              06975000
     ELSE   << WORD COUNT >>                                            06980000
       COUNT := TOS&ASL(1);   << CHANGE TO BYTE COUNT >>                06985000
                                                                        06990000
     IF IOQ'PARM1 = 1 THEN     << IMBEDDED CONTROL >>          <<06718>>06995000
       BEGIN                                                            07000000
         IF COUNT = 0 THEN   << INVALID OPERATION >>                    07005000
           BEGIN                                                        07010000
             TOS := INVALIDOP;                                          07015000
             GOTO IODONE;                                               07020000
           END;                                                         07025000
         TOS := BUFFADDRD;   << LOAD BANK AND BUFF ADDRESS >>           07030000
         LOADMEMORY;   << LOAD FIRST WORD >>                            07035000
         PARAM := TOS&LSR(8);   << ISOLATE AND SAVE CONTROL PARAM >>    07040000
         COUNT := COUNT - 1;   << DECREMENT BYTE COUNT >>               07045000
       END                                                              07050000
     ELSE                                                               07055000
       PARAM := IOQ'PARM1;     << CONTROL IN PARAM WORD >>     <<06718>>07060000
                                                                        07065000
     DITP(DSAVE).PRESPACE := IF IOQ'PARM2                      <<06718>>07070000
       THEN 1 ELSE 0;   << SET PRESPACE FLAG >>                         07075000
                                                                        07080000
<<---------------------------------------------------->>                07085000
<<                                                    >>                07090000
<<   INITALIZE PRINT CONTROL BYTE                     >>                07095000
<<                                                    >>                07100000
<<---------------------------------------------------->>                07105000
                                                                        07110000
     IF IOQ'PARM2.STEPOVER THEN                                <<06718>>07115000
       PRINTCTL := 1   << SINGLE SPACE WITHOUT STEPOVER >>              07120000
     ELSE                                                               07125000
       PRINTCTL := %102;   << SINGLE SPACE WITH STEPOVER >>             07130000
                                                                        07135000
     << SETUP PRINT CONTROL BYTE >>                                     07140000
                                                                        07145000
     IF PARAM = "+" THEN   << SUPPRESS SPACING >>                       07150000
       PRINTCTL := 0                                                    07155000
                                                                        07160000
     ELSE IF PARAM = "0" THEN   << DOUBLE SPACE >>                      07165000
       PRINTCTL := PRINTCTL + 1                                         07170000
                                                                        07175000
     ELSE IF PARAM = "-" THEN   << TRIPLE SPACE >>                      07180000
       PRINTCTL := PRINTCTL + 2                                         07185000
                                                                        07190000
     ELSE IF PARAM = "1" THEN   << TOP OF FORM >>                       07195000
       BEGIN                                                            07200000
         IF COUNT=0 AND DITP(DSAVE).(FULL':2)=1 THEN                    07205000
           GOTO PRINTDONE;   << EMPTY BUFFER AND ALREADY AT TOP >>      07210000
         PRINTCTL := %100;                                              07215000
         IOQ'QMISC.PEJECT := 1;  << SET PAGE EJECT FLAG >>     <<06718>>07220000
       END                                                              07225000
                                                                        07230000
     ELSE IF %200 <= PARAM <= %277 THEN   << SLEW N LINES >>            07235000
       PRINTCTL := PARAM - %200                                         07240000
                                                                        07245000
     ELSE IF %300 <= PARAM <= %313 THEN   << SELECT CHANNEL N >>        07250000
      IF SUBTYPE <> HP2617J OR PARAM <= %307 THEN              <<04744>>07255000
       PRINTCTL := PARAM - %200                                         07260000
      ELSE  << This ELSE is just a place keeper to keep the  >><<04744>>07265000
            << original structure of this section of code    >><<04744>>07270000
            << intact.  If (subtype = HP2617J) and           >><<04744>>07275000
            << (%310 <= PARAM <= %313) then PRINTCTL will be >><<04744>>07280000
            << unchanged from its earlier initialization to  >><<04744>>07285000
            << single space and control goes to PRINTSETUP:  >><<04744>>07290000
                                                                        07295000
     ELSE IF PARAM = %320 THEN   << BUFFER FILL ONLY >>                 07300000
       BEGIN                                                            07305000
         PRINTCTL := -1;                                                07310000
         IF COUNT=0 THEN GOTO PRINTDONE;                                07315000
         IOQ'QMISC.BUF'FILL := 1; << SET BUF FILL FLAG >>      <<06718>>07320000
       END;                                                             07325000
                                                                        07330000
$PAGE                                                                   07335000
<<---------------------------------------------------->>                07340000
<<                                                    >>                07345000
<<   SET CHAN PROG FOR BUFFER FILL & PRINT CONTROL    >>                07350000
<<                                                    >>                07355000
<<---------------------------------------------------->>                07360000
                                                                        07365000
  PRINTSETUP:                                                           07370000
     IF PRINTCTL >= 0 THEN   << SETUP PRINT CONTROL >>                  07375000
       BEGIN                                                            07380000
         DITP(DSAVE).FULL := 0;                                         07385000
         IF PRINTCTL >= %100 THEN                                       07390000
                                                                        07395000
           BEGIN   << SET ESC CODE FOR VFC CHAN SELECT >>               07400000
           SIOP(ESC'ALPHA) := %20126;   << V >>                         07405000
           PRINTCTL := PRINTCTL - %77;                                  07410000
           END                                                          07415000
                                                                        07420000
         ELSE   << SET ESC CODE FOR SLEWING >>                          07425000
           SIOP(ESC'ALPHA) := %20125;   << U >>                         07430000
                                                                        07435000
         ASCIIAREA := INT2ASC(PRINTCTL,2);                              07440000
         SIOP(ESC'PARM) := TEMP;   << ASCII PARAMETER >>                07445000
                                                                        07450000
         IF DITP(DSAVE).PRESPACE=1 THEN   << PRESPACE >>                07455000
           SIOP(PREJMP) := 0                                            07460000
                                                                        07465000
         ELSE                             << POSTSPACE >>               07470000
           SIOP(POSTJMP) := 0;                                          07475000
       END;                                                             07480000
                                                                        07485000
                                                                        07490000
     IF COUNT <> 0 THEN   << SETUP BUFFER FILL >>                       07495000
       BEGIN                                                            07500000
         SIOP(BUFFJMP) := 0;                                            07505000
         SIOP(BCOUNT) := COUNT;                                         07510000
         SIOP(MEMX).(8:8) := BANK;                                      07515000
         SIOP(MEMX).LRBIT := IF IOQ'PARM1=1 <<IMBEDDED CONTRL>><<06718>>07520000
           THEN 1 ELSE 0;   << START WITH RIGHT BYTE >>                 07525000
         SIOP(BADDR) := BUFFADDR;                                       07530000
         DITP(DSAVE).FULL := IF DITPL(DSAVE).PRESPACE                   07535000
           THEN 1 ELSE 0;   << IF PRESPACING INDICATE BUFF IS FULL >>   07540000
       END;                                                             07545000
                                                                        07550000
<<---------------------------------------------------->>                07555000
<<                                                    >>                07560000
<<   START CHANNEL PROGRAM                            >>                07565000
<<                                                    >>                07570000
<<---------------------------------------------------->>                07575000
                                                                        07580000
  STARTPRINT:                                                           07585000
     CPVAP := 0;           << CLEAR CHANNEL STATUS WORD >>              07590000
     SIOP(STATUS) := 0;    << CLEAR CP STATUS WORD >>                   07595000
                                                                        07600000
     START'HPIB(DITP,SIOP,TRUE);   << START CHANNEL PROGRAM >>          07605000
                                                                        07610000
PRINTCONT:                                                              07615000
     IF < THEN   << SIO FAILURE >>                                      07620000
       BEGIN                                                            07625000
         TOS := SIOFAIL;                                                07630000
         GOTO BADIO;                                                    07635000
       END;                                                             07640000
                                                                        07645000
     IOQ'QMISC.WAITCODE := CMPLTIONWAIT;<<SET REQUEST STATE>>  <<06718>>07650000
     DITP(DTIME) := 0;                                                  07655000
     IF IOQ'DIAG THEN  << LENGTHEN TIMER FOR DIAGNOSTICS >>    <<06718>>07660000
       DITP(DRQST) := TIMEREQ(IOTIMER,@DITP,50000D)                     07665000
     ELSE                                                               07670000
       DITP(DRQST) := TIMEREQ(IOTIMER,@DITP,5000D);            <<04744>>07675000
       <<Timer was changed from 2 to 5 sec for KANJI printers>><<04744>>07680000
     LPDRVR := INTRPTWAIT;                                              07685000
     RETURN;                                                            07690000
                                                                        07695000
     END   << OF WRITE LOGIC (FUNCTION CODE = 1) >>                     07700000
                                                                        07705000
$PAGE                                                                   07710000
<<---------------------------------------------------->>                07715000
<<                                                    >>                07720000
<<   READ STATUS [FCODE = %17]                        >>                07725000
<<                                                    >>                07730000
<<---------------------------------------------------->>                07735000
                                                                        07740000
  ELSE  IF FCODE = %17 THEN                                             07745000
                                                                        07750000
    BEGIN   << READ STATUS PROCESSING >>                                07755000
      TOS := IOQ'COUNT;     << GET COUNT >>                    <<06718>>07760000
      IF < THEN   << NEGATIVE BYTE COUNT >>                             07765000
        COUNT := -TOS   << MAKE POSITIVE >>                             07770000
      ELSE   << POSITIVE WORD COUNT >>                                  07775000
        COUNT := TOS & ASL(1);   << CHANGE TO BYTE >>                   07780000
                                                                        07785000
      IF COUNT < 1 THEN   << INVALID REQUEST >>                         07790000
        BEGIN                                                           07795000
          TOS := INVALIDOP;                                             07800000
          GOTO BADIO;                                                   07805000
        END;                                                            07810000
                                                                        07815000
      IF COUNT > 1 THEN   << EXCEED MAX STATUS >>                       07820000
        COUNT := 1;   << SET MAX STATUS AVAIL >>                        07825000
                                                                        07830000
      SIOP(RWCTL).DCODE := 3;   << READ CODE >>                         07835000
      SIOP(RWCTL).CMD := %16;   << READ STATUS SECONDARY >>             07840000
      SIOP(DSCOUNT) := COUNT;                                           07845000
      SIOP(DSBANK).(0:8) := 0;   << NO SPECIAL OPTIONS >>               07850000
      SIOP(DSBANK).(8:8) := BANK;   << SET BANK >>                      07855000
      SIOP(DSTATADR) := BUFFADDR;   << SET ABS ADR >>                   07860000
                                                                        07865000
      CPVAP := 0;                                                       07870000
      SIOP(STATUS) := 0;                                                07875000
      SIOP(BRANCHPT) := DSTATSIOP;   << READ STATUS ENTRY >>            07880000
      SIOP(DIAGJMP) := -16;  << COMPLETE W/INTRP HLT >>                 07885000
      START'HPIB(DITP,SIOP,TRUE);   << START CHAN PROG >>               07890000
      GOTO PRINTCONT;   << FOR WRAP-UP >>                               07895000
                                                                        07900000
    END   << OF READ STATUS PROCESSING >>                               07905000
                                                                        07910000
$PAGE                                                                   07915000
<<---------------------------------------------------->>                07920000
<<                                                    >>                07925000
<<   IDENTIFY [FCODE=%110]                            >>                07930000
<<                                                    >>                07935000
                                                                        07940000
<<---------------------------------------------------->>                07945000
                                                                        07950000
   ELSE IF FCODE = %110 AND IOQ'DIAG THEN                      <<06718>>07955000
                                                                        07960000
     BEGIN                                                              07965000
       SIOP(DSBANK) := %3000;   << IDENTIFY CMD CODE >>                 07970000
       SIOP(DSTATADR) := 0;   << INITIALIZE RETURN ID >>                07975000
                                                                        07980000
       CPVAP := 0;                                                      07985000
       SIOP(STATUS) := 0;                                               07990000
       SIOP(BRANCHPT) := IDSIOP;   << BRANCH-IDENTIFY SECTION >>        07995000
       SIOP(DIAGJMP) := -16;  << COMPLETE W/INTRP HLT >>                08000000
       START'HPIB(DITP,SIOP,TRUE);   << START CHAN PROG >>              08005000
       GOTO PRINTCONT;                                                  08010000
                                                                        08015000
     END   << OF IDENTIFY >>                                            08020000
                                                                        08025000
$PAGE                                                                   08030000
<<---------------------------------------------------->>                08035000
<<                                                    >>                08040000
<<   SELF TEST INITIATE [FCODE = %111]                >>                08045000
<<   SELF TEST RESULT   [FCODE = %112]                >>                08050000
<<                                                    >>                08055000
<<---------------------------------------------------->>                08060000
                                                                        08065000
   ELSE IF (FCODE = %111 OR FCODE = %112) AND IOQ'DIAG THEN    <<06718>>08070000
                                                                        08075000
     BEGIN                                                              08080000
       IF FCODE=%111 THEN                                               08085000
         BEGIN                                                          08090000
         SIOP(RWCTL).DCODE := %10;  << WRITE CTRL CODE >>               08095000
         SIOP(DIAGJMP) := -24;  << WAIT, DSJ W/INTRP HLT >>             08100000
         END                                                            08105000
       ELSE                                                             08110000
         BEGIN                                                          08115000
         SIOP(RWCTL).DCODE := 7;   << READ CTRL CODE >>                 08120000
         SIOP(DIAGJMP) := -16;  << COMPLETE W/INTRP HLT >>              08125000
         END;                                                           08130000
                                                                        08135000
       SIOP(RWCTL).CMD := %17;   << SELF TEST SECONDARY >>              08140000
       SIOP(DSCOUNT) := 1;   << 1 BYTE WITH SUBTEST# >>                 08145000
       SIOP(DSBANK).(0:8) := %100;   << START W/RIGHT BYTE >>           08150000
                                                                        08155000
       IF FCODE=%111 THEN   << CHECK SUBTEST# FOR INITIATE >>           08160000
         BEGIN                                                          08165000
           TOS := BUFFADDRD;  << LOAD BANK & BUFFER ADDR >>             08170000
           LOADMEMORY;  << LOAD FIRST WORD >>                           08175000
           PARAM := TOS;  << SUBTEST# >>                                08180000
           IF PARAM < 0 OR PARAM > 7 THEN  << NOT IN RANGE >>           08185000
             BEGIN                                                      08190000
               TOS := INVALIDOP;                                        08195000
               GOTO IODONE;                                             08200000
             END;                                                       08205000
         END;                                                           08210000
                                                                        08215000
       SIOP(DSBANK).(8:8) := BANK;                                      08220000
       SIOP(DSTATADR) := BUFFADDR;                                      08225000
                                                                        08230000
       CPVAP := 0;                                                      08235000
       SIOP(STATUS) := 0;                                               08240000
       SIOP(BRANCHPT) := DSTATSIOP;   << DIAGNOSTIC ENTRY >>            08245000
       START'HPIB(DITP,SIOP,TRUE);                                      08250000
       GOTO PRINTCONT;                                                  08255000
                                                                        08260000
     END   << OF SELF TEST LOGIC >>                                     08265000
                                                                        08270000
$PAGE                                                                   08275000
<<---------------------------------------------------->>                08280000
<<                                                    >>                08285000
<<   LOOPBACK TEST:                                   >>                08290000
<<   WRITE DATA - PING [FCODE = %113]                 >>                08295000
<<   READ DATA  - PONG [FCODE = %114]                 >>                08300000
<<                                                    >>                08305000
<<---------------------------------------------------->>                08310000
                                                                        08315000
   ELSE IF (FCODE = %113 OR FCODE = %114) AND IOQ'DIAG THEN    <<06718>>08320000
                                                                        08325000
     BEGIN                                                              08330000
       IF FCODE=%113 THEN                                               08335000
         BEGIN                                                          08340000
         SIOP(RWCTL).DCODE := %10;  << WRITE CTRL CODE >>               08345000
         SIOP(DIAGJMP) := -24;  << WAIT, DSJ W/INTRP HLT >>             08350000
         END                                                            08355000
       ELSE                                                             08360000
         BEGIN                                                          08365000
         SIOP(RWCTL).DCODE := 7;   << READ CTRL CODE >>                 08370000
         SIOP(DIAGJMP) := -16;  << COMPLETE W/INTRP HLT >>              08375000
         END;                                                           08380000
                                                                        08385000
      TOS := IOQ'COUNT;                                        <<06718>>08390000
       IF < THEN   << BYTE COUNT >>                                     08395000
         COUNT := -TOS   << MAKE POSITIVE >>                            08400000
       ELSE   << WORD COUNT >>                                          08405000
         COUNT := TOS&ASL(1);   << CHANGE TO BYTE COUNT >>              08410000
                                                                        08415000
       IF COUNT<1 OR COUNT>256 THEN   << INVALID REQ >>                 08420000
         BEGIN                                                          08425000
         TOS := INVALIDOP;                                              08430000
         GOTO IODONE;                                                   08435000
         END;                                                           08440000
                                                                        08445000
       SIOP(RWCTL).CMD := %16;   << PING/PONG SECONDARY >>              08450000
       SIOP(DSCOUNT) := COUNT;   << LOOPBACK DATA COUNT >>              08455000
       SIOP(DSBANK).(0:8) := 0;   << NO SPECIAL OPTIONS >>              08460000
       SIOP(DSBANK).(8:8) := BANK;                                      08465000
       SIOP(DSTATADR) := BUFFADDR;                                      08470000
                                                                        08475000
       CPVAP := 0;                                                      08480000
       SIOP(STATUS) := 0;                                               08485000
       SIOP(BRANCHPT) := DSTATSIOP;   << DIAGNOSTIC ENTRY >>            08490000
       START'HPIB(DITP,SIOP,TRUE);                                      08495000
       GOTO PRINTCONT;                                                  08500000
                                                                        08505000
     END   << OF LOOPBACK TEST LOGIC >>                                 08510000
                                                                        08515000
                                                                        08520000
   ELSE   << FALL THROUGH >>                                            08525000
                                                                        08530000
                                                                        08535000
$PAGE                                                                   08540000
                                                                        08545000
  PRINTDONE:                                                            08550000
     TOS := GOODIO;                                                     08555000
                                                                        08560000
  IODONE:                                                               08565000
     IOQ'STAT := TOS;  << STORE RETURN STATUS >>               <<06718>>08570000
                                                               <<02697>>08575000
  EXIT:                                                        <<02697>>08580000
     LPDRVR := REQUESTDONE;                                             08585000
     RETURN;                                                            08590000
                                                                        08595000
  CHANERROR:                                                            08600000
     TOS := CHANFAIL;                                                   08605000
     DITP(DSERR) := [8/1,8/DLOGERROR];                                  08610000
     DITP(DLOGERROR) := CPVAP;   << LOG ERROR STATUS >>                 08615000
                                                                        08620000
  BADIO:                                                                08625000
     DITP(DSAVE).(13:3) := 0;   << CLEAR DRIVER FLAGS >>                08630000
     IOQ'STAT := TOS;                                          <<06718>>08635000
     GOTO INITDEV;                                                      08640000
                                                                        08645000
  PARITYERROR:                                                          08650000
     TOS := PARITY;                                                     08655000
     DITP(DSERR) := [8/1,8/DLOGERROR];                                  08660000
     DITP(DLOGERROR) := PARITYERR;                                      08665000
     GOTO BADIO;                                                        08670000
                                                                        08675000
  TIMEOUT:                                                              08680000
     TOS := TIMOUTERR;                                                  08685000
     IF IOQ'DIAG THEN GOTO BADIO;                              <<06718>>08690000
     DITP(DSERR) := [8/1,8/DLOGERROR];                                  08695000
     DITP(DLOGERROR) := CPVAP;                                          08700000
     GOTO BADIO;                                                        08705000
                                                                        08710000
  UNITERROR:                                                            08715000
     TOS := UNITERR;                                                    08720000
     DITP(DSERR) := [8/1,8/DLOGERROR];                                  08725000
     DITP(DLOGERROR) := SIOP(STATUS);                                   08730000
     GOTO BADIO;                                                        08735000
                                                                        08740000
$PAGE                                                                   08745000
<<****************************************************>>                08750000
<<                                                    >>                08755000
<<   LINE PRINTER CONTINUATOR SECTION                 >>                08760000
<<                                                    >>                08765000
<<****************************************************>>                08770000
                                                                        08775000
  LPCONT:                                                               08780000
     IF CPVAP.ERRORCODE = 6 THEN   << DMA ABORT >>                      08785000
       GOTO CHANERROR;                                                  08790000
                                                                        08795000
     IF CPVAP.ERRORCODE = 7 THEN   << CHANNEL ABORT >>                  08800000
       BEGIN                                                            08805000
         IF CPVAP.TIMEDOUT = 1 THEN   << GIC TIMEOUT >>                 08810000
           BEGIN                                                        08815000
            IOQ'QMISC.TOUT := 0;                               <<06718>>08820000
            IF IOQ'QMISC.TOUT=1 THEN <<2ND TIMEOUT REPORTED>>  <<06718>>08825000
               GOTO TIMEOUT;                                            08830000
            IOQ'QMISC.TOUT := 1;   << 1ST TIME OUT >>          <<06718>>08835000
             CPVAP := 0;                                                08840000
             SIOP(STATUS) := 0;                                         08845000
             SIOP(BRANCHPT) := STATSIOP;   << READ STATUS >>            08850000
             START'HPIB(DITP,SIOP,TRUE);   << MAYBE PARITY >>           08855000
             GOTO PRINTCONT;                                            08860000
           END ELSE GOTO CHANERROR;                                     08865000
       END;                                                             08870000
                                                                        08875000
    IF IOQ'SFAIL THEN   << FAILURE ON DELAYED START I/O >>     <<06718>>08880000
       BEGIN                                                            08885000
         TOS := SIOFAIL;                                                08890000
         GOTO BADIO;                                                    08895000
       END;                                                             08900000
                                                                        08905000
<<---------------------------------------------------->>                08910000
<<                                                    >>                08915000
<<   LP NOT READY COMPLETION                          >>                08920000
<<                                                    >>                08925000
<<---------------------------------------------------->>                08930000
                                                                        08935000
     DITP(DTIME).(0:1) := 0;                                            08940000
     IF <> THEN   << TIMER POPPED >>                                    08945000
       BEGIN                                                            08950000
                                                                        08955000
   LPNOTREADY:                                                          08960000
        IF IOQ'DIAG THEN    << DIAGNOSTIC COMPLETION >>        <<06718>>08965000
           GOTO TIMEOUT                                                 08970000
         ELSE                                                           08975000
                                                                        08980000
        IF IOMESSAGE(1,NOTRDYMSG,%10000,DITP(DLDEV),           <<06718>>08985000
                      ,,,,OPCONSOLE) THEN                               08990000
   IDLECP:                                                              08995000
           BEGIN                                                        09000000
             CPVAP := 0;                                                09005000
             SIOP(STATUS) := 0;                                         09010000
             SIOP(BRANCHPT) := IDLESIOP;   << IDLE CP ENTRY >>          09015000
             START'HPIB(DITP,SIOP,FALSE);                               09020000
             IF < THEN                                                  09025000
               BEGIN                                                    09030000
                 TOS := SIOFAIL;                                        09035000
                 GOTO BADIO;                                            09040000
               END;                                                     09045000
             IOQ'QMISC.WAITCODE := NOTRDYWAIT;<<SET REQ STATE>><<06718>>09050000
             LPDRVR := NOTREADY;                                        09055000
             RETURN;                                                    09060000
           END;                                                         09065000
                                                                        09070000
         TOS := SYSERROR;   << INDICATE FAILURE BECAUSE THERE >>        09075000
         GOTO BADIO;        << ARE NO MESSAGE LINK BUFFERS >>           09080000
       END;                                                             09085000
                                                                        09090000
<<---------------------------------------------------->>                09095000
<<                                                    >>                09100000
<<   I/O STATUS INTERROGATION COMPLETION              >>                09105000
<<                                                    >>                09110000
<<---------------------------------------------------->>                09115000
                                                                        09120000
     IF CPVAP(1).(14:2) = 2 THEN   << STATUS DIAGNOSIS IS REQUIRED >>   09125000
                                                                        09130000
       BEGIN                                                            09135000
         IF SIOP(STATUS).PON = 1 THEN   << PON OCCURRED >>              09140000
           BEGIN                                                        09145000
             IOQ'QMISC.PONBIT := 1;  << SET PON FLAG >>        <<06718>>09150000
             DITP(DSAVE).BETJOB := 1;   << BETWEEN JOB >>               09155000
           END;                                                         09160000
                                                                        09165000
         IF SIOP(STATUS).ONLINE <> 1 THEN   << UNIT NOTREADY >>         09170000
           GOTO LPNOTREADY;                                             09175000
                                                                        09180000
         IF SIOP(STATUS).PAPERBIT = 1 THEN   << PAPER ERROR >>          09185000
           GOTO LPNOTREADY;                                             09190000
                                                                        09195000
         IF SIOP(STATUS).PARITYBIT = 1 THEN                             09200000
           GOTO PARITYERROR;   << PARITY ERROR >>                       09205000
                                                                        09210000
         IF SIOP(STATUS).PROTOBIT = 1 THEN                              09215000
           GOTO UNITERROR;   << PROTOCOL ERROR >>                       09220000
                                                                        09225000
                                                                        09230000
     <<                                            >>                   09235000
     <<  AT THIS POINT, AN EXTRA PASS OF THE IDLE  >>                   09240000
     <<  CP MUST BE MADE TO ASSURE THAT A BUFFER   >>                   09245000
     <<  IS READY FOR THE NEXT SECONDARY COMMAND,  >>                   09250000
     <<  SO THE DRIVER WILL NOT GET OUT OF SYNCH   >>                   09255000
     <<  WITH THE FIRMWARE.  THIS WILL BE DONE     >>                   09260000
     <<  UNDER THE FOLLOWING CONDITIONS:           >>                   09265000
     <<                                            >>                   09270000
     <<    - PON CONDITION (FLAGGED BY DSJ 2)      >>                   09275000
     <<    - ALARM CONDITION WHICH CLEARED UP      >>                   09280000
     <<      SHOWING A CLEAN STATUS BUT RETAINED   >>                   09285000
     <<      THE DSJ 2 CONDITION.                  >>                   09290000
     <<    - BUFFER READY BIT NOT SET IN THE       >>                   09295000
     <<      STATUS WORD POSSIBLY DUE TO NOISE     >>                   09300000
     <<      ON THE BUS.                           >>                   09305000
     <<                                            >>                   09310000
                                                                        09315000
                                                                        09320000
         GOTO IDLECP;                                                   09325000
                                                                        09330000
   RESTART:                                                             09335000
         IF FCODE = 1 THEN   << RESTART INCOMPLETE WRT OPERATION >>     09340000
           BEGIN                                                        09345000
                                                                        09350000
             IF IOQ'QMISC.BUF'FILL <> 0 THEN                   <<06718>>09355000
               BEGIN   << FILL BUFFER RESTART >>                        09360000
                 IF SIOP(BCOUNT) = 0 THEN   << OPER DONE >>             09365000
                   GOTO PRINTDONE;                                      09370000
                 SIOP(BRANCHPT) := FILLSIOP;                            09375000
                 GOTO CONTD;                                            09380000
               END;                                                     09385000
                                                                        09390000
             IF DITP(DSAVE).PRESPACE = 1 THEN                           09395000
               BEGIN   << RESTART PRESPACE OPERATION >>                 09400000
                 IF SIOP(BCOUNT) <> 0 THEN                              09405000
                   SIOP(BRANCHPT) := FILLSIOP                           09410000
                 ELSE GOTO PRINTDONE;                                   09415000
                 IF SIOP(PRE'DCNT) <> 0 THEN                            09420000
                   SIOP(BRANCHPT) := PRE'DSBSIOP;                       09425000
                 IF SIOP(PRE'CNT) <> 0 THEN                             09430000
                   SIOP(BRANCHPT) := 0;                                 09435000
               END;                                                     09440000
                                                                        09445000
             IF DITP(DSAVE).PRESPACE = 0 THEN                           09450000
               BEGIN   << RESTART POSTSPACE OPERATION >>                09455000
                 IF SIOP(POST'DCNT) <> 0 THEN                           09460000
                   SIOP(BRANCHPT) := POST'DSBSIOP                       09465000
                 ELSE GOTO PRINTDONE;                                   09470000
                 IF SIOP(POST'CNT) <> 0 THEN                            09475000
                   SIOP(BRANCHPT) := POST'ENBSIOP;                      09480000
                 IF SIOP(BCOUNT) <> 0 THEN                              09485000
                   SIOP(BRANCHPT) := FILLSIOP;                          09490000
                 IF SIOP(PRE'DCNT) <> 0 THEN                            09495000
                   SIOP(BRANCHPT) := PRE'DSBSIOP;                       09500000
               END;                                                     09505000
                                                                        09510000
   CONTD:                                                               09515000
             IF SIOP(BCOUNT) <> 0 THEN                                  09520000
               BEGIN   << RECALCULATE BUFFER WRITE >>                   09525000
                 TOS := IOQ'COUNT;  << GET TOTAL COUNT >>      <<06718>>09530000
                 IF < THEN                                              09535000
                   COUNT := -TOS                                        09540000
                 ELSE                                                   09545000
                   COUNT := TOS & ASL(1);   << CHANGE TO BYTE >>        09550000
                 SIOP(MEMX).(8:8) := BANK;   << RESET BANK >>           09555000
                 SIOP(BADDR) := BUFFADDR +                              09560000
                 (COUNT - SIOP(BCOUNT))/2;   << RESET ADR W/OFFSET >>   09565000
               END;                                                     09570000
                                                                        09575000
             START'HPIB(DITP,SIOP,TRUE);                                09580000
             GOTO PRINTCONT;                                            09585000
           END;                                                         09590000
                                                                        09595000
       END;                                                             09600000
                                                                        09605000
<<---------------------------------------------------->>                09610000
<<                                                    >>                09615000
<<   FUNCTION DEPENDENCIES COMPLETION                 >>                09620000
<<                                                    >>                09625000
<<---------------------------------------------------->>                09630000
                                                                        09635000
     IF FCODE = %17 THEN   << READ STATUS COMPLETION >>                 09640000
       GOTO PRINTDONE;                                                  09645000
                                                                        09650000
     IF FCODE = %110 THEN   << IDENTIFY COMPLETION >>                   09655000
       BEGIN                                                            09660000
       TOS := BUFFADDRD;                                                09665000
       TOS := SIOP(DSTATADR);   << DEVICE ID >>                         09670000
       STOREMEMORY;                                                     09675000
       GOTO PRINTDONE;                                                  09680000
       END;                                                             09685000
                                                                        09690000
                                                                        09695000
    IF IOQ'QMISC.PRE'TO'POST THEN                              << 8647>>09700000
      BEGIN                                                    << 8647>>09705000
        IOQ'QMISC.PRE'TO'POST:=0;                              << 8647>>09710000
        GOTO LPINIT;                                           << 8647>>09715000
      END;                                                     << 8647>>09720000
                   << DO POST FOR PRE-TO-POST >>               <<06718>>09725000
    DITP(DSAVE).TOP := IOQ'QMISC.PEJECT;                       <<06718>>09730000
     GOTO PRINTDONE;     << GOT HERE - REQUEST COMPLETED >>             09735000
                                                                        09740000
                                                                        09745000
   END;                                                                 09750000
$PAGE                                                                   09755000
   ASSEMBLE(                                                            09760000
     PCAL SIODM;     << MONITOR >>                                      09765000
     PCAL LPDRVR;    << INITIATOR >>                                    09770000
     PCAL LPDRVR;    << COMPLETOR >>                                    09775000
     CON  0;         << NO IO PROCESS >>                                09780000
     PCAL LPINIT;    << INITIALIZATION >>                               09785000
     CON  1;         << ONE INTERRUPT HANDLER >>                        09790000
     PCAL GIP'HPIB); << INTERRUPT HANDLER >>                            09795000
   END.                                                                 09800000
