$CONTROL USLINIT,MAP,CODE                                               00010000
<<  HIOCDRD0, MODULE 28 - HP2893A CARD READER DRIVER SERIES 33     >>   00015000
<<  HP32033C MPE SOURCE C.00.00 >>                                      00020000
<<  COPYRIGHT     (C) COPYRIGHT HEWLETT-PACKARD CO. 1981.,         >>   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 "CARD READER DRIVER  -  HIOCDRD0(28)"                            00060000
$CONTROL PRIVILEGED,UNCALLABLE,MAIN=HIOCDRD0                            00065000
$TP                                                                     00070000
                                                                        00075000
comment                                                                 00080000
                                                                        00085000
            3000 Series 33 Card Reader Driver   - HIOCDRD0              00090000
            ---------------------------------------------               00095000
                                                                        00100000
                                                                        00105000
Structure of HIOCDRD0:                                                  00110000
                                                                        00115000
HIOCDRD0, together with the SIO Device Monitor (SIODM) constitute a     00120000
standard MPE Type 1 I/O Driver/Monitor.  This means that it does not    00125000
run in its own process, but executes on any stack and therefore must    00130000
run to completion.  During initialization it executes on PROGEN's       00135000
stack, during request initiation it executes on the CALLER'S stack      00140000
or the ICS, and during interrupt processing it always executes          00145000
on the ICS (Interrupt Control Stack).                                   00150000
                                                                        00155000
HIOCDRD0 consists of a global area, two procedures, and an "outer       00160000
block" which is really a linkage area for INITIAL.  The global area     00165000
contains an array called INITIAL which is comprised of three parts.     00170000
The first part specifies the size of the other two, the unit extract    00175000
instruction, and various parameters which are used by INITIAL.  This    00180000
section is deleted after INITIAL is through with it.  The other two     00185000
parts are the Device Information Table (DIT) and the Channel Program    00190000
area, which is part of the Interrupt Linkage Table (ILT).  INITIAL      00195000
will put each of these items in the area of memory where it belongs.    00200000
The linkage area specifies the procedure labels (P-labels) of the       00205000
associated monitor (SIODM), the request initiator (CRDRVR), the         00210000
request completor (CRDRVR), the initialization procedure (CRINIT,       00215000
called by PROGEN at system startup), and the interrupt handler (GIP).   00220000
                                                                        00225000
$PAGE                                                                   00230000
Operation of HIOCDRD0:                                                  00235000
                                                                        00240000
The primary working code of HIOCDRD0 is a procedure CRDRVR.  CRDRVR is  00245000
called with five parameters.  Two of these parameters, BANK and         00250000
BUFFADDR, are the absolute buffer address of the data to be processed.  00255000
The other three, DITP, IOQP, and SIOP are pointers to three arrays.     00260000
DITP is a pointer to the Device Information Table which contains        00265000
information about its associated card reader unit.  There is one DIT for00270000
unit on the controller (For the card reader there is only one unit      00275000
per controller.) and they contain information which must be             00280000
saved between I/O requests to the driver.  IOQP is a pointer to the     00285000
Input/Output Queue element.  IOQ elements contain information relevent  00290000
to the current request.  SIOP is a pointer to the first element of the  00295000
Channel Program which is actually part of the Interrupt Linkage Table.  00300000
These three elements are described in more detail elsewhere in this     00305000
document.                                                               00310000
                                                                        00315000
CRDRVR is always called by the SIO device monitor (SIODM).  The driver  00320000
then determines the reason for the call by examining the MSTATE, which  00325000
contains the state of the monitor, the IOQ and the DIT.                 00330000
When a new request is initiated, CRDRVR examines the function code      00335000
and parameter fields contained in the IOQ element to determine the      00340000
task that is desired.  The proper command codes and program branches    00345000
are then placed in the Channel Program and its execution is begun.      00350000
                                                                        00355000
Upon completion of the channel program, an interrupt is                 00360000
generated and CRDRVR is again called.  The code checks for              00365000
a request in progress (an IOQP that is nonzero) and if this             00370000
is the case, branches to the completion section of the                  00375000
driver.  Here several status words are examined for errors or special   00380000
conditions which might have occurred during the execution of the        00385000
Channel Program, during the data transfer, or during the operation of   00390000
the card reader unit.  These condition can cause special status         00395000
returns to be returned to the caller.  A list of the conditions         00400000
and the return codes is provided in this document.                      00405000
If the Driver is called with an IOQP of zero then it will start         00410000
an IDLE channel program.                                                00415000
                                                                        00420000
The initialization procedure CRINIT starts an idle channel              00425000
program which consists of a wait, a DSJ (to clear the power             00430000
up interrupt from the device) and an interrupt halt.                    00435000
                                                                        00440000
                                                                        00445000
                                                                        00450000
                                                                        00455000
        Development and Fix History                                     00460000
        ---------------------------                                     00465000
                                                                        00470000
Development Engineer: Dave Cassafer                                     00475000
8-4-82 Dave Cassafer - fixed problem where bank portion of     <<04623>>00480000
       AUXBUFADDRD was being set to -1.  Solution is to convert<<04623>>00485000
       an expression to LOGICAL before converting it to DOUBLE.<<04623>>00490000
4-11-82 DAVID SM CHANG -MPEV INITIAL                           <<06720>>00495000
$PAGE                                                                   00500000
                Device Information Table (DIT)                          00505000
                ------------------------------                          00510000
                                                                        00515000
                                                                        00520000
There is one DIT per physical device.  If a physical device represents  00525000
more than one logical device, the logical device number is obtained     00530000
from the IOQ element.  The following diagram shows the DIT used for     00535000
the card reader driver.                                                 00540000
                                                                        00545000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          00550000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    00555000
  0| 0| 0|AC|RQ| 0|MU| 0|IO|IA|NO|ST| 0|   STATE   |   DFLAG            00560000
   +--+--+--+--+--+--+--+--+--+--+--+--+-----------+                    00565000
  1| SYSDB relative pointer to the DIT for the next|   DLINK            00570000
   | device requesting this resource or service    |                    00575000
   +-----------------------------------------------+                    00580000
  2| SYSDB relative pointer to the first IOQ in    |   DIOQP            00585000
   | request list for this device                  |                    00590000
   +--------+--------------+-----------------------+                    00595000
  3|           Logical device number               |   DLDEV   <<06720>>00600000
   +--------+--------------+-----------------------+                    00605000
  4| SYSDB relative pointer to Device Linkage Table|   DDLTP            00610000
   +-----------------------------------------------+                    00615000
  5| SYSDB relative pntr to Interrupt Linkage Table|   DILTP            00620000
   +-----------------------------------------------+                    00625000
  6|RD|AF|                                         |   DSAVE            00630000
   +-----------------------------------------------+                    00635000
  7| Hardware error status.  Set when the driver   |   DSERR            00640000
   | detects an error.  Whenever <>0, the driver   |                    00645000
   | monitor logs an I/O error and clears this word|                    00650000
   +--+--+--+--+--+--------------------------------+                    00655000
%10| Not Used                                      |   DTIME            00660000
   +--+--+--+--+--+--------------------------------+                    00665000
%11|           Request word count                  |   DWCNT            00670000
   +-----------------------------------------------+                    00675000
%12| IOT |     Physical unit number                |   DUNIT   <<06720>>00680000
   +--+--+-----------------------------------------+           <<06720>>00685000
%13| device status.  read from device during       |   DSTAT   <<06720>>00690000
   | each execution of the channel program.        |                    00695000
   +-----------------------------------------------+                    00700000
%14| Logging will be done from here.               |  DLOGERROR<<06720>>00705000
   +-----------------------------------------------+                    00710000
                                                                        00715000
$PAGE                                                                   00720000
DFLAG - Flags and request state                                         00725000
  AC  ACTIVE  - A monitor is currently servicing this device.           00730000
  RQ  REQUEST - A service request is pending while the monitor is       00735000
                active.                                                 00740000
  MU  MUNIT   - This device is on a multi-unit controller.              00745000
  IO  IOPROG  - An I/O Channel Program is running for this device.      00750000
  IA  IAK     - An interrupt or response has occurred for this device.  00755000
  NO  NOTRDY  - Go to state %10 after Idle Channel Program is started.  00760000
  ST  STWAIT  - The device monitor is starting an Idle Channel Program  00765000
                for this device.  There is no IOQ associated with this  00770000
                type of request.                                        00775000
  STATE       - State of the device monitor.  Specifies the next action 00780000
                to be taken in SIODM in servicing the request:          00785000
                  0 - start new request                                 00790000
                  1 - not used                                          00795000
                  2 - call driver initiator procedure                   00800000
                  3 - call driver completor procedure                   00805000
                  4 - not used                                          00810000
                  5 - process request completed                         00815000
                  6 - initiate device recognition sequence              00820000
                  7 - start operator intervention wait                  00825000
                %10 - wait for interrupt (operator intervention)        00830000
                      restart at state 0                                00835000
                %11 - wait for data segment freeze, then state 2        00840000
                %12 - wait for driver initiator to be frozen, then      00845000
                      allocate controller (state 2)                     00850000
                %13 - wait for I/O completion interrupt, then state 3   00855000
                %14 - wait for controller, then call driver initiator   00860000
                %15 - not used                                          00865000
                %16 - wait for initiator make present, then state 2     00870000
                %17 - wait for completor make present, then state 3     00875000
                                                                        00880000
DLDEV - Device logical device number                                    00885000
  IOT  I/O TYPE  -  I/O System type                                     00890000
                    0 = Series II / III  I/O system                     00895000
                    1 = HP-IB                                           00900000
                    2 = unused                                          00905000
                    3 = unused                                          00910000
                                                                        00915000
DSAVE - Device processing flags                                         00920000
  RD  READDONE    - A card has already been read.                       00925000
  AF  ABORTFLAG   - A device clear has already been sent for            00930000
                    this series of aborted IOQs                         00935000
                                                                        00940000
$PAGE                                                                   00945000
                Interrupt Linkage Table (ILT)                           00950000
                -----------------------------                           00955000
                                                                        00960000
                                                                        00965000
There is one ILT for each device controller configured on the system.   00970000
The card reader controller will support only one unit per controller.   00975000
                                                                        00980000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          00985000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    00990000
  0|         Channel                               |   ICPVA0           00995000
  1|              Program                          |   ICPVA1           01000000
  2|                  Variable                     |   ICPVA2           01005000
  3|                       Area (ICPVA)            |   ICPVA3           01010000
   +-----------------------------------------------+                    01015000
  4|         DMA Abort                             |   ICPVA4           01020000
  5|              Address                          |   ICPVA5           01025000
   +-----------------------------------------------+                    01030000
  6|                      0                        |   ISRQL            01035000
   +--+-----------------+-----+-----------+--------+                    01040000
  7|LI|     CHANQUE     |     |   CHAN    |  DEV   |   ICNTRL           01045000
   +--+-----------------+-----+-----------+--------+                    01050000
%10| SYSDB relative pointer to Channel Program area|   ISIOP            01055000
   +-----------------------------------------------+                    01060000
%11| SYSDB relative pointer to Status Return area. |   ISTAP            01065000
   +-----------------------------------------------+                    01070000
%12| single instruction that is executed to extract|   IUNIT            01075000
   | the device unit number from the status pointed|                    01080000
   | to by ISTAP.                                  |                    01085000
   +-----------------------------------------------+                    01090000
%13| SYSDB relative DIT pointer of the device      |   ICDP             01095000
   | currently using the channel to perform a      |                    01100000
   | data operation.                               |                    01105000
   +-----------------------+-----------------------+                    01110000
%14|       SIOPSIZE        |        CQUEN          |   IQUEUE           01115000
   +--+--+--+--------------+-----------+-----------+                    01120000
%15|RW|WP|IG|                          |  HCUNIT   |   IFLAG            01125000
   +--+--+--+--------------------------+-----------+                    01130000
%16| SYSDB relative DIT pointer for unit 0         |   IDITP0           01135000
   +-----------------------------------------------+                    01140000
%20|             Card Reader                       |                    01145000
   .               Channel                         .                    01150000
   |                 Program                       |                    01155000
   +-----------------------------------------------+                    01160000
                                                                        01165000
$PAGE                                                                   01170000
ICPVA0 - Channel Program Variable Area                                  01175000
                                                                        01180000
  The first word is used by the channel program processor to store      01185000
  status information after I/O channel aborts.  The next word is used   01190000
  by the driver to indicate if status should be examined for special    01195000
  conditions or errors.  The other two words are not used.              01200000
                                                                        01205000
                                                                        01210000
ICPVA4 - DMA abort address                                              01215000
                                                                        01220000
  If a DMA abort occurs, the absolute address where the abort occurred  01225000
  is stored in this area.                                               01230000
                                                                        01235000
                                                                        01240000
ICNTRL - Contains controller information                                01245000
                                                                        01250000
  LIM     - If this bit is set, the controller is sharing a software    01255000
            channel resource in order to limit bandwidth.               01260000
  CHANQUE - The software channel resource number.                       01265000
  CHAN    - Channel number (four most significant bits of DRTN).        01270000
  DEV     - Device number (three least significant bits of DRTN).       01275000
                                                                        01280000
                                                                        01285000
IQUEUE -                                                                01290000
                                                                        01295000
  SIOPSIZE - (number of words + 1)/2 in the channel program area.       01300000
  CQUEN    - For a multi-unit controller this field contains the        01305000
             software controller resource number.                       01310000
                                                                        01315000
                                                                        01320000
IFLAG - Controller and Channel Program state flags                      01325000
                                                                        01330000
  RUNWAIT  - An Idle Channel Program should be started when there       01335000
             are no active requests to process.                         01340000
  WAITPROG - An Idle Channel Program has been started for this          01345000
             controller.  This bit is reset by an interrupt.            01350000
  IGNOREHI - An HIOP instruction has been issued against this	          01355000
             controller but the channel program was not in a wait       01360000
             statement.  Therefore ignore the interrupt generated by    01365000
             the channel code when this program halts.                  01370000
  HCUNIT   - Highest configured unit number for this controller.        01375000
$PAGE                                                                   01380000
            I/O QUEUE ELEMENT (IOQ)                                     01385000
            -----------------------                                     01390000
                                                                        01395000
                                                                        01400000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   MNEMONIC          01405000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01410000
  0|      Request dependent flags (see below)      |   QFLAG            01415000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+                    01420000
  1| SYSDB relative pointer to next IOQ element.   |   QLINK            01425000
   | Points to first word of element.              |                    01430000
   +-----------------------+-----------------------+                    01435000
  2|                       | Logical device number |   QLDEV            01440000
   +--+--+--+--+--+-----+--+-----+--------+--------+                    01445000
  3|       Auxillary buffer flag.                  |   QMISC            01450000
   +--+--+--+--+--+-----+--------+--------+--------+                    01455000
  4| S| If QFLAG.(3:1) is clear then this is the   |   QDSTN            01460000
   |  | DST number of the target data segment.  If |                    01465000
   |  | S is set, QADDR is DB relative.            |                    01470000
   +--+--------------------------------------------+                    01475000
  5| Offset in the data segment or system buffer   |   QADDR            01480000
   | table to the target data buffer.              |                    01485000
   +-----------------------+-----------------------+                    01490000
  6|                       | Function code for     |   QFUNC            01495000
   |                       | this request.  (See   |                    01500000
   |                       | next section.)        |                    01505000
   +-----------------------+-----------------------+                    01510000
  7| On initiation, specifies the word count (>0)  |   QWBCT            01515000
   | or byte count (<0).  At completion of the     |                    01520000
   | request this location contains the actual     |                    01525000
   | transmission count in the same units (bytes   |                    01530000
   | or words) as in the request.                  |                    01535000
   +-----------------------------------------------+                    01540000
%10| Parameter 1.  Contains the EOF specification  |   QPAR1            01545000
   +-----------------------------------------------+                    01550000
%11| Parameter 2.  Contains the data mode          |   QPAR2            01555000
   | specification in bits (11:2). (See below card |                    01560000
   | reader request codes for detail information)  |                    01565000
   +-----------------------+--------------+--------+                    01570000
%12|         PCBN          |  QUALIFIER   | STATUS |   QSTAT            01575000
   +-----------------------+--------------+--------+                    01580000
                                                                        01585000
$PAGE                                                                   01590000
QFLAG - Request dependent flags                                         01595000
                                                                        01600000
  Bit 0  ABORT     - Abort this request and return an error indication  01605000
                     to the caller.                                     01610000
  Bit 1  SPECIAL   - Apply special handling to this request.  (Not used)01615000
  Bit 2  DIAG      - This is a request from the diagnostic subsystem.   01620000
  Bit 3  SYSBUFF   - Target is an index relative to the SBUF Table of   01625000
                     the data buffer.                                   01630000
  Bit 4  IOWAKE    - Wake caller on completion of request.              01635000
  Bit 5  BLOCKED   - Blocked I/O.  The caller is waited in ATTACHIO     01640000
                     until the request is completed.  Implies IOWAKE.   01645000
  Bit 6  COMPLETED - The request has been completed and the caller      01650000
                     awakened if he had requested (with IOWAKE).        01655000
  Bit 7  DATAFRZN  - Set by the memory management routines (MAM) when a 01660000
                     MAKEPRESENT request is successfully completed and  01665000
                     indicates the data segment is frozen in memory.    01670000
  Bit 8  MAMERRORD - An error has occurred while MAM was trying to      01675000
                     make the target data segment present and freeze    01680000
                     it in memory.                                      01685000
  Bit 9  PREQ      - (Not used)                                         01690000
  Bit 10 SFAIL     - Delayed failure of SIO instruction.  If a call to  01695000
                     STARTIO resulted in the request being added to     01700000
                     the channel queue, this bit indicates that the SIO 01705000
                     instruction failed when the request was selected   01710000
                     for execution.                                     01715000
  Bit 11 PFAIL     - The request was aborted because of a system power  01720000
                     failure.                                           01725000
                                                                        01730000
                                                                        01735000
QMISC - Auxillary buffer flag  used to indicated a read into the        01740000
        driver's buffer and not the user's buffer.                      01745000
                                                                        01750000
                                                                        01755000
QSTAT - PCB number and request completion status.                       01760000
                                                                        01765000
  PCBN    - The Process Control Block (PCB) number of the process       01770000
            which made this request.  If zero, the request is not       01775000
            associated with any process and the IOQ element is to       01780000
            be returned by the system when the request has completed.   01785000
  STATUS  - General status indicating the final state of the request.   01790000
            The following codes are used:                               01795000
              0 - Not started or awaiting completion.                   01800000
              1 - Successful completion.                                01805000
              2 - End-of-file detected.                                 01810000
              3 - Unusual, but recoverable, condition detected.         01815000
              4 - Irrecoverable error has occurred.                     01820000
  QUALIFIER - A code which further defines or qualifies the general     01825000
              status.  (See the section Driver Return Status Codes.)    01830000
                                                                        01835000
$PAGE                                                                   01840000
           CARD READER REQUEST CODES                                    01845000
           ----------------------                                       01850000
                                                                        01855000
                                                                        01860000
   0 - READ                                                             01865000
         P1       - END OF FILE SPECIFICATION                           01870000
         P2(11:2) - DATA MODE                                           01875000
                    0 =  PACKED ASCII. COUNT TRUNCATED TO 80 BYTES      01880000
                         MAXIMUM                                        01885000
                    1 =  COLUMN BINARY. COUNT TRUNCATED TO 160 BYTES    01890000
                         MAXIMUM                                        01895000
                    2 =  UNASSIGNED                                     01900000
                    3 =  UNASSIGNED                                     01905000
         ***NOTE: ODD BYTE COUNTS ARE ROUNDED UP AS THEY WERE           01910000
                  IN THE SERIES III DRIVER.                             01915000
   1 - UNUSED   (INVALID OPCODE FOR THIS DEVICE)                        01920000
   2 - OPEN FILE (NO OPERATION)                                         01925000
   3 - CLOSE FILE (NO OPERATION)                                        01930000
   4 - CLOSE DEVICE (CLEAR EOF STATUS IN LPDT)                          01935000
   5 - 14   - UNUSED  (INVALID OPCODE FOR THIS DEVICE)                  01940000
 %17 - READ STATUS                                                      01945000
%110 - GET IDENTITY                                                     01950000
%111 - INITIATE SELF TEST                                               01955000
%113 - WRITE LOOPBACK DATA                                              01960000
%114 - READ LOOPBACK DATA                                               01965000
%275 - DEVICE CLEAR                                                     01970000
                                                                        01975000
                       DRIVER RETURN STATUS CODES                       01980000
                       --------------------------                       01985000
                                                                        01990000
                                                                        01995000
 GENERAL STATUS (13:3)       QUALIFYING STATUS (8:5)      OVERALL (8:8) 02000000
  0 - PENDING               1 - WAITING FOR COMPLETION         %10      02005000
                            3 - NOT READY WAIT                 %30      02010000
                                                                        02015000
  1 - SUCCESSFUL            0 - NO ERRORS                        1      02020000
                                                                        02025000
  2 - END OF FILE           [NOT USED]                                  02030000
                                                                        02035000
  3 - UNUSUAL CONDITION     3 - REQUEST ABORTED                %33      02040000
                            6 - POWERFAIL ABORT                %63      02045000
                          %21 - DEVICE POWERED UP             %213      02050000
                                                                        02055000
  4 - IRRECOVERABLE ERROR   0 - INVALID REQUEST                  4      02060000
                            3 - TIMING ERROR                   %34      02065000
                            4 - SIO FAILURE                    %44      02070000
                            5 - UNIT FAILURE                   %54      02075000
                          %12 - SYSTEM ERROR                  %124      02080000
                          %14 - CHANNEL FAILURE               %144      02085000
                                                                        02090000
                                                                        02095000
endcomment;                                                             02100000
$PAGE                                                                   02105000
BEGIN                                                                   02110000
$INCLUDE INCLIOQ                                               <<06720>>02115000
$INCLUDE INCLLPDT                                              <<06720>>02120000
EQUATE                                                                  02125000
                                                                        02130000
               << FUNCTION CODES >>                                     02135000
                                                                        02140000
    DCLEAR          = %275,       <<DEVICE CLEAR>>                      02145000
    DCLOSE          = 4,          <<DEVICE CLOSE FUNCTION CODE>>        02150000
    FCLOSE          = 3,          <<FILE CLOSE FUNCTION CODE>>          02155000
    FOPEN           = 2,          <<FOPEN FUNCTION CODE>>               02160000
    IDENTITY        = %110,       <<"GET IDENTITY" FUNCTION CODE>>      02165000
    INITTEST        = %111,       <<INITIATE SELF TEST FUNCTION>>       02170000
    READ            = 0,                                                02175000
    READSTAT        = %17,        <<RETURN STATUS FUNCTION CODE>>       02180000
    READLOOP        = %114,       <<READ LOOPBACK DATA FUNCTION>>       02185000
    WRITELOOP       = %113,       <<WRITE LOOPBACK DATA FUNCTION>>      02190000
                                                                        02195000
               << CARD READER CHANNEL PROGRAM COMMANDS >>               02200000
                                                                        02205000
    CLEAR           = %4400,                                            02210000
    INIT'SELFTEST   = %4017,                                            02215000
    JUMP            = 0,                                                02220000
    PICKASCII       = %2001,                                            02225000
    PICKBINARY      = %2000,                                            02230000
    READCOMMAND     = %1400,                                            02235000
    READ'SELFTEST   = %3417,      <<READ SELFTEST RESULTS>>             02240000
    READSTATCOMMAND = %1401,                                            02245000
    WAIT            = %1000,                                            02250000
                                                                        02255000
               << QSTAT STATUS RETURNS >>                               02260000
                                                                        02265000
    ABORTED         = %33,        <<REQUEST ABORTED RETURN STATUS>>     02270000
    CHANFAIL        = %144,       <<CHANNEL FAILURE>>                   02275000
    GOODIO          = 1,          <<SUCCESSFUL I/O STATUS RETURN>>      02280000
    INVALIDOP       = 4,          <<INVALID OPERATION REQUESTED>>       02285000
    OFFLINESTAT     = %30,        <<DEVICE IS NOT READY OR OFFLINE>>    02290000
    PENDING         = %10,        <<PENDING/WAITING FOR COMPLETION>>    02295000
    PFABORT         = %63,        <<POWERFAIL ABORT>>                   02300000
    POWERUPSTAT     = %213,       <<DEVICE HAS BEEN POWERED UP>>        02305000
    SIOFAIL         = %44,        <<START SIO FAILURE>>                 02310000
    SYSERROR        = %124,       <<SYSTEM ERROR REQUEST STATUS CODE>>  02315000
    TIMING'ERROR    =  %34,       <<ERROR RETURNED AFTER READ CHECK>>   02320000
    XFER'ERROR      =  %14,       <<ERROR RETURNED AFTER BUS ERROR>>    02325000
$PAGE                                                                   02330000
               << CHANNEL PROGRAM ARRAY POINTERS >>                     02335000
                                                                        02340000
    DEVCLEAR        = 28,         <<CLEAR COMMAND>>                     02345000
    READBANK        = 16,         <<BANK WHERE DATA IS TO GO>>          02350000
    READADDR        = 17,         <<ADDRESS WHERE DATA IS TO GO>>       02355000
    DSJGOOD         = 11,         <<ADDRESS WHERE CONTROL TRANFERS      02360000
                                  IF PREVIOUS OPERATION SUCCESSFULL>>   02365000
    IDENTIFY        = 32,         <<ADDR OF IDENTIFY INSTR>>            02370000
    IDENTSTORE      = 33,         <<CHANNEL STORES IDENTITY HERE>>      02375000
    JMPADDR         = 1,          <<ADDRESS IN CHANNEL PROGRAM OF       02380000
                                    FUNCTION TO BE DONE>>               02385000
    JUMP'OR'WAIT    = 18,         <<JUMP OR WAIT GOES HERE>>            02390000
    JMPADDR2        = 19,         <<JMP ADDR IF JUMP'OR'WAIT=JUMP>>     02395000
    PICKCOUNT       = 43,         <<8/BYTES,8/BURST>>                   02400000
    READORDER       = 13,         <<READ ORDER IN SIO PROGRAM>>         02405000
    READBURST       = 15,         <<BURST LENGTH IN READ COMMAND>>      02410000
    READBYTES       = 14,         <<NUMBER OF BYTES TO READ>>           02415000
    RORDER2         = 20,                                               02420000
    RBYTES2         = 21,         <<NUMBER OF BYTES IN 2ND READ>>       02425000
    RBURST2         = 22,                                               02430000
    RBANK2          = 23,                                               02435000
    RADDR2          = 24,                                               02440000
    READSTATBYTE    = 26,         <<NUMBER OF STATUS BYTES TO READ>>    02445000
    READSTATDEST    = 29,         <<ADDR OF WHERE STATUS TO GO>>        02450000
    STARTIDLE       = 36,         <<START OF IDLE CHANNEL PROG>>        02455000
    TEMPSTORE       = 44, <<TYPE OF SELFTEST OR BYTE OF LOOPBACK DATA>> 02460000
    WRITEADDR       = 6,          <<ADDRESS IN WRITE COMMAND>>          02465000
    WRITEBANK       = 5,          <<BANK IN WRITE COMMAND>>             02470000
    WRITEBURST      = 4,          <<BURST LENGTH IN WRITE COMMAND>>     02475000
    WRITEBYTES      = 3,          <<NUMBER OF BYTES TO WRITE>>          02480000
    WRITEORDER      = 2,          <<COMMAND TO BE DONE>>                02485000
                                                                        02490000
               << PROGRAM CONSTANTS >>                                  02495000
                                                                        02500000
    CALL'COMPLETOR  = %13,                                              02505000
    CHANPROGSIZE    = 46,         <<DOES NOT INCLUDE AUX READ BUFFER>>  02510000
    CRDITSIZE       = 13,         <<CARD READER DIT SIZE>>     <<06720>>02515000
    CRSIOSIZE       = CHANPROGSIZE+40,<<INCLUDES AUXILLARY READ BUFFER>>02520000
    CRSIOSIZED2     = (CRSIOSIZE+1)/2,                                  02525000
                        <<ADDING 1 TO CRSIOSIZE BEFORE DIVIDING         02530000
                          BY 2 INSURES THAT SUFFICIENT SPACE            02535000
                          WILL BE ALLOCATED FOR A CHANNEL               02540000
                          PROGRAM OF ODD LENGTH>>                       02545000
    OPCONSOLE       = 0,          <<OUTPUT MESSAGE TO OPERATOR>>        02550000
    HOPPERMTMSG     = 384,        <<HOPPER EMPTY MESSAGE>>              02555000
    LOGTROUBLE      = %100000,    <<TROUBLE WORTH LOGGING>>             02560000
    MOTPICMSG       = 385,        <<MOTION OR PICK CHECK>>              02565000
    NOTRDYMSG       = 11,         <<NOT READY MESSAGE # TO MESS PROC>>  02570000
    NOTREADY        = 7,          <<NOT READY DRIVER RETURN CODE>>      02575000
    RDCHKMSG        = 17,         <<READ CHECK MESSAGE>>                02580000
    REQUESTDONE     = 5,          <<REQUEST COMPLETED DRIVER RETURN>>   02585000
    START'REQUEST   = 2,          <<SIODM STATE FOR NEW REQUEST>>       02590000
    STKFULLMSG      = 383,        <<STACKER FULL MESSAGE>>              02595000
    SUB             = %32,        <<ASCII SUB-INDICATES BAD HOLLERITH>> 02600000
    SYSDB           = %1000,                                            02605000
    SYSLPDT         = %10,        <<LOGICAL PHYSICAL DEVICE TABLE>>     02610000
    TROUBLEBITS     = %177000,    <<MASK FOR HARDWARE STATUS>>          02615000
    UFAILMSG        = 208,        <<UNIT FAILURE MSG. NO.>>             02620000
               << TABLE ARRAY POINTERS >>                               02625000
    DDLTP           = 4,          <<DIT DRIVER LINKAGE TABLE>> <<06720>>02630000
    DFLAG           = 0,          <<DIT FLAG WORD>>            <<06720>>02635000
    DILTP           = 5,          <<INTERRUPT LINKAGE TABLE PTR>>       02640000
    DIOQP           = 2,          <<DIT IOQ POINTER>>          <<06720>>02645000
    DLDEV           = 3,          <<LOGICAL DEVICE NUMBERS>>   <<06720>>02650000
    DLINK           = 1,          <<DIT NEXT DIT REQ SERVICE>> <<06720>>02655000
    DLOGERROR       = %14,        <<LOG BE DONE FROM HERE>>    <<06720>>02660000
    DSAVE           = 6,          <<DRIVER TEMP STORAGE>>               02665000
    DSTAT           = %13,        <<DEVICE STATUS READ>>       <<06720>>02670000
    DSERR           = 7,          <<HARDWARE I/O ERROR STATUS IN DIT>>  02675000
    DTIME           = %10,        <<TIMER REQUEST>>                     02680000
    DUNIT           = %12,        <<DIT UNIT # >>              <<06720>>02685000
    DWCNT           = 9,          <<HOLDS REQUESTED WORD COUNT>>        02690000
    ICNTRL          = %7,         <<DRT NUMBER>>               <<06720>>02695000
    ISIOP           = %10;        <<ILT POINTER TO SIOP>>      <<06720>>02700000
<<  IOQ SPECIFY BY INCL5   >>                                  <<06720>>02705000
                                                               <<06720>>02710000
                                                               <<06720>>02715000
                                                               <<06720>>02720000
                                                               <<06720>>02725000
                                                               <<06720>>02730000
                                                               <<06720>>02735000
$PAGE                                                                   02740000
DEFINE                                                                  02745000
                                                                        02750000
             <<DSTAT BIT DEFINITIONS>>                                  02755000
                                                                        02760000
    BADHOLLERITH = (3:1)#,     <<INVAILD HOLLERITH STATUS>>             02765000
    BUSERROR     = (0:1)#,     <<BUSS ERROR>>                           02770000
    RDCHK        = (2:1)#,     <<READ CHECK>>                           02775000
    EOFBIT       = (10:1)#,    <<END OF FILE STATUS BIT>>               02780000
    HOPPERMT     = (5:1)#,     <<HOPPER EMPTY>>                         02785000
    MPCHK        = (7:1)#,     <<MOTION OR PICK CHECK>>                 02790000
    NRDY         = (1:1)#,     <<NOT READY OR OFFLINE>>                 02795000
    OFFLINE      = (6:1)#,                                              02800000
    POWERUP      = (11:1)#,                                             02805000
    STACKERFULL  = (4:1)#,     <<STACKER FULL>>                         02810000
                                                                        02815000
               << DSAVE BIT DEFINITIONS >>                              02820000
                                                                        02825000
    READDONE     = (0:1)#,     <<AUX BUF FOR CARD AFTER EOF RETURNED>>  02830000
    ABORTFLAG    = (1:1)#,     <<DEVICE CLEAR ALREADY SENT>>            02835000
                                                                        02840000
               << MISCELLANEOUS BIT DEFINITIONS >>                      02845000
                                                                        02850000
    ASCII        = NOT LOGICAL(DATAMODE)#, <<ASCII READ MODE REQUESTED>>02855000
    BINARY       = LOGICAL(DATAMODE)#,  <<BINARY READ MODE REQUESTED>>  02860000
    DIAG         = (2:1)#,     <<THIS BIT SIGNIFIES DIAGNOSTIC>>        02865000
    DRTNUMBER     = (7:9)#,       << DRT DEFINE >>             <<06720>>02870000
    DLDEVN       = (8:8)#,     <<LOGICAL DEVICE NUMBER OF DIT>>         02875000
    EOF          = (7:3)#,     <<EOF STATE IN LPDT>>                    02880000
    ERRORCODE    = (0:3)#,     <<CPVAP, ERROR CODE>>                    02885000
    FUNC         = (8:8)#,     <<QFUNC, FUNCTION CODE>>                 02890000
    IOSTAT       = (8:8)#,     <<TOTAL REQUEST STATUS RETURNED>>        02895000
    PFAIL        = (11:1)#,    <<ABORT SET BECAUSE OF POWER FAIL>>      02900000
    SFAIL        = (10:1)#,    <<FAILURE ON DELAYED START SIO>>         02905000
    STATUS       = DITPL(DSTAT)#,  <<STATUS WORD IN DIT>>               02910000
    SUBTYPE      = (12:4)#;       <<TYPE OF SELFTEST>>                  02915000
$PAGE                                                                   02920000
LOGICAL LS0 = S-0,                                                      02925000
        LX  = X;                                                        02930000
                                                                        02935000
INTEGER S0 = S-0,                                                       02940000
        S1 = S-1,                                                       02945000
        X  = X;                                                         02950000
                                                                        02955000
                                                               <<06720>>02960000
                                                                        02965000
                                                                        02970000
                                                                        02975000
                                                                        02980000
     << DIT DEFINITION AND DRIVER LINKAGE AREA  >>                      02985000
                                                                        02990000
ARRAY  INITIAL(0:3) = DB :=                                             02995000
   [8/CRDITSIZE, 8/%21],   <<DITSIZE/RUN IDLE CHANP,MONITOR TYPE>>      03000000
   0,                      <<NOT USED>>                                 03005000
   0,                      <<UNIT EXTRACT INSTRUCTION>>                 03010000
   [8/CRSIOSIZE, 8/1];     <<CHANPROGSIZE/2, STATUS LENGTH >>  <<06720>>03015000
                                                                        03020000
ARRAY DIT(1:CRDITSIZE) = DB :=                                          03025000
  0,    <<DFLAG>>                                                       03030000
  0,    <<DLINK>>                                                       03035000
  0,    <<DIOQP>>                                                       03040000
  0,    <<DLDEV - HPIB DEVICE>>                                <<06720>>03045000
  0,    <<DDLTP>>                                                       03050000
  0,    <<DILTP>>                                                       03055000
  0,    <<DRQST>>                                                       03060000
  0,    <<DSERR>>                                                       03065000
  0,    <<DSAVE>>                                                       03070000
  0,    <<DWCNT>>                                                       03075000
%40000, <<DUNIT>>                                              <<06720>>03080000
  0,    <<DSTAT>>                                                       03085000
  0;    <<DLOGERROR>>                                                   03090000
$PAGE                                                                   03095000
ARRAY SIOA(1:CRSIOSIZE) = DB :=                                         03100000
<< CHANNEL PROGRAM>>                                                    03105000
<< 0>>                    0, <<JUMP TO APPROPRIATE STARTING POINT>>     03110000
<< 1>><<JMPADDR>>         0, <<FILL IN ADDRESS>>                        03115000
                                                                        03120000
<< 2>><<WRITEORDER>>      0, <<FILL IN COMMAND>>                        03125000
<< 3>><<WRITEBYTES>>      0, <<BYTE COUNT>>                             03130000
<< 4>>                    0, <<BURST LENGTH>>                           03135000
<< 5>><<WRITEBANK>>       0, <<BANK>>                                   03140000
<< 6>><<WRITEADDR>>       0, <<ADDRESS>>                                03145000
                                                                        03150000
<< 7>>                %1000, <<WAIT>>                                   03155000
<< 8>>                    0,                                            03160000
                                                                        03165000
<< 9>>                %2401, <<DSJ>>                                    03170000
<<10>>                    0, <<DSJ BYTE>>                               03175000
<<11>><<DSJGOOD   >>      0, <<FILL IN ADDRESS>>                        03180000
<<12>>                   12, <<GOTO READ STATUS>>                       03185000
                                                                        03190000
<<THIS IS THE READ COMMAND>>                                            03195000
                                                                        03200000
<<13>><<READORDER>>       0, <<FILL IN COMMAND>>                        03205000
<<14>><<READBYTES>>       0, <<BYTE COUNT>>                             03210000
<<15>>                    0, <<BURST LENGTH>>                           03215000
<<16>><<READBANK>>        0, <<BANK >>                                  03220000
<<17>><<READADDR>>        0, <<ADDRESS>>                                03225000
                                                                        03230000
<<18>><<JUMP'OR'WAIT>> %1000,<<JUMP OR WAIT>>                           03235000
<<19>>                    0,                                            03240000
                                                                        03245000
<<THIS IS THE SECOND READ IF BINARY CARD>>                              03250000
  <<OR READSTATUS DIRECT TO USERS BUFFER>>                              03255000
                                                                        03260000
<<20>><<RORDER2>>     %1400,                                            03265000
<<21>><<RBYTES2>>         0,                                            03270000
<<22>>                    0, <<BURST LENGTH>>                           03275000
<<23>><<RBANK2>>          0, <<BANK>>                                   03280000
<<24>><<RADDR2 >>         0,                                            03285000
                                                                        03290000
<<THIS IS A STATUS READ FOR THE DRIVER, OR THE CLEAR COMMAND>>          03295000
                                                                        03300000
<<25>><<READSTATUS>>  %1401,                                            03305000
<<26>>                    2, <<BYTE COUNT>>                             03310000
<<27>>                    0, <<BURST>>                                  03315000
<<28>><<DEVCLEAR>>    %2000,<<BANK 0,BIT 5 MEANS DONT UPDATE >>         03320000
<<29>><<READSTATDEST>>    0, <<ADDRESS>>          <<THE COUNT>>         03325000
                                                                        03330000
                                                                        03335000
<<30>>                 %601, <<INTERRUPT/HALT>>                         03340000
<<31>>                    1, <<CODE OF 1 IN CPVA(1)>>                   03345000
                                                                        03350000
<<32>><<IDENTIFY>>    %3000, <<GET IDENTITY>>                           03355000
<<33>><<IDENTSTORE>>      0, <<IDENTITY WILL BE PUT HERE>>              03360000
                                                                        03365000
<<34>>                    0, <<JUMP TO READ STATUS>>                    03370000
<<35>>                  -11,                                            03375000
$PAGE                                                                   03380000
<<36>><<STARTIDLE>>   %1000, <<WAIT>>                                   03385000
<<37>>                    0,                                            03390000
                                                                        03395000
<<38>>                %2400, <<DSJ TO CLEAR POWERUP INTERRUPT>>         03400000
<<39>>                    0,                                            03405000
<<40>>                    0, <<VECTOR ADDR FOR DSJ= 0>>                 03410000
                             <<FALL THRU IF DSJ=1 OR 2>>                03415000
<<41>>                 %601, <<INTERRUPT/HALT>>                         03420000
<<42>>                    2, <<CODE OF 2 IN CPVA(1)>>                   03425000
                                                                        03430000
<<43>><<PICKCOUNT>>       0, <<8/BYTES,8/BURST>>                        03435000
<<44>><<TEMPSTORE>>       0; <<SUBTEST FOR SELF TEST OR LOOPBACK DATA>> 03440000
                                                                        03445000
                                                                        03450000
<<*** 40 WORDS FOR AUXILLARY BUFFER ***>>                               03455000
$PAGE                                                                   03460000
    <<------------ EXTERNAL PROCEDURE DECLARATIONS -------------->>     03465000
                                                                        03470000
PROCEDURE DEBUG;                                                        03475000
   OPTION EXTERNAL;                                                     03480000
                                                                        03485000
                                                                        03490000
PROCEDURE EOFCHECK (IOQ'ENTRY'INDEX,BUFR,COUNT,BLANK);         <<06720>>03495000
   VALUE IOQ'ENTRY'INDEX,BUFR,COUNT,BLANK;                     <<06720>>03500000
   INTEGER IOQ'ENTRY'INDEX;                                    <<06720>>03505000
   INTEGER COUNT;                                                       03510000
   LOGICAL BLANK;                                                       03515000
   DOUBLE  BUFR;                                                        03520000
   OPTION EXTERNAL;                                                     03525000
                                                                        03530000
PROCEDURE  GIP;                                                         03535000
   OPTION EXTERNAL;                                                     03540000
                                                                        03545000
PROCEDURE HELP;                                                         03550000
   OPTION EXTERNAL;                                                     03555000
                                                                        03560000
LOGICAL PROCEDURE IOMESSAGE (SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,           03565000
                               DEST,REPLY,OFFSET,DITP,IOTYPE);          03570000
   VALUE SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,DITP,        03575000
         IOTYPE;                                                        03580000
   INTEGER SETNO,MSGNO,MASK,P1,P2,P3,P4,P5,DEST,REPLY,OFFSET,           03585000
           IOTYPE;                                                      03590000
   INTEGER POINTER DITP;                                                03595000
   OPTION VARIABLE,EXTERNAL;                                            03600000
                                                                        03605000
PROCEDURE MASTERCLEAR (DITP);                                           03610000
   ARRAY DITP;                                                          03615000
   OPTION EXTERNAL;                                                     03620000
                                                                        03625000
PROCEDURE SIODM (DITP,FLAGS);                                           03630000
   VALUE DITP, FLAGS;                                                   03635000
   LOGICAL FLAGS;                                                       03640000
   POINTER DITP;                                                        03645000
   OPTION EXTERNAL;                                                     03650000
                                                                        03655000
PROCEDURE STARTIO (DITP,SIOP,QFLAG);                                    03660000
   VALUE  DITP, SIOP, QFLAG;                                            03665000
   LOGICAL QFLAG;                                                       03670000
   POINTER DITP, SIOP;                                                  03675000
   OPTION EXTERNAL;                                                     03680000
                                                                        03685000
PROCEDURE PUTDRT(DRT,OFFSET,NUM);                              <<06720>>03690000
   VALUE DRT,OFFSET,NUM;                                       <<06720>>03695000
   INTEGER DRT,OFFSET,NUM;                                     <<06720>>03700000
   OPTION EXTERNAL;                                            <<06720>>03705000
$PAGE  "CARD READER INITIALIZATION PROCEDURE - CRINIT"                  03710000
<<******************************************************                03715000
  **    CARD READER INITIALIZATION PROCEDURE          **                03720000
  ******************************************************>>              03725000
                                                                        03730000
<<THIS PROCEDURE STARTS AN IDLE CHANNEL PROGRAM WHEN CALLED>>           03735000
                                                                        03740000
PROCEDURE CRINIT(DITP);                                                 03745000
  INTEGER ARRAY DITP;                                                   03750000
  OPTION PRIVILEGED, UNCALLABLE;                                        03755000
                                                                        03760000
  BEGIN                                                                 03765000
    INTEGER POINTER ILTP;                                               03770000
    INTEGER POINTER SIOP;                                               03775000
                                                                        03780000
    @ILTP:=DITP(DILTP);                                                 03785000
    @SIOP:=ILTP(ISIOP);                                                 03790000
                                                                        03795000
    SIOP(JMPADDR):=STARTIDLE-2;                                         03800000
    STARTIO(DITP,SIOP,FALSE);                                           03805000
                                                                        03810000
  PUTDRT(ILTP(ICNTRL).DRTNUMBER,3,0);                          <<06720>>03815000
  END;                                                                  03820000
$PAGE  "CARD READER DRIVER PROCEDURE - CRDRVR"                          03825000
INTEGER PROCEDURE CRDRVR                                       <<06720>>03830000
       (IOQ'ENTRY'INDEX,DITP,BANK,BUFADDR,SIOP,DRTNUMB);       <<06720>>03835000
   VALUE IOQ'ENTRY'INDEX,BANK,BUFADDR,DRTNUMB;                 <<06720>>03840000
   INTEGER IOQ'ENTRY'INDEX;                                    <<06720>>03845000
   INTEGER  BANK, BUFADDR, DRTNUMB;                                     03850000
   INTEGER ARRAY DITP,SIOP;                                    <<06720>>03855000
   OPTION PRIVILEGED, UNCALLABLE;                                       03860000
BEGIN                                                                   03865000
                                                                        03870000
  <<                                                                    03875000
     THIS PROCEDURE INITIATES AND COMPLETES I/O FOR CARD READERS        03880000
                                                                        03885000
    MODE RETURNS IN CRDRVR -                                            03890000
                                                                        03895000
        5  - REQUEST COMPLETED                                          03900000
        7  - NOT READY WAIT                                             03905000
      %13  - INTERRUPT WAIT OR WAIT FOR COMPLETION                      03910000
  >>                                                                    03915000
                                                                        03920000
                                                                        03925000
INTEGER LDEV           ;           <<LOGICAL DEVICE NUMBER>>   <<06720>>03930000
INTEGER DATAMODE;          <<HOLDS DATA READ MODE>>            <<06720>>03935000
DOUBLE  AUXBUFADDRD;       <<CARD SAVING BUFFER ADDRESS>>      <<06720>>03940000
INTEGER WCNT;              <<WORD COUNT FOR CONVERT>>          <<06720>>03945000
INTEGER MSGTYPE;           <<TYPE OF ERROR MESSAGE>>           <<06720>>03950000
INTEGER POINTER CPVAP;     <<HOLDS CHANNEL I/O STATUS>>        <<06720>>03955000
INTEGER BADCOLUMN;         <<COLUMN WHERE BAD HOLLERITH FOUND>><<06720>>03960000
INTEGER SUBTEST;           <<THIS WILL BE SET TO TEST TYPE>>   <<06720>>03965000
INTEGER MSTATE    = CRDRVR;        <<CURRENT REQUEST STATE>>            03970000
INTEGER LPDT'INDEX;   <<LOGICAL PHYSICAL DEVICE TABLE INDEX>>  <<06720>>03975000
LOGICAL ARRAY   DITPL(*)  =  DITP;                             <<06720>>03980000
                                                               <<06720>>03985000
                                                                        03990000
DOUBLE BUFADDRD  =  Q-7;              <<BANK AND OFFSET>>               03995000
                                                                        04000000
ARRAY MAXCOUNT(0:1) = PB := 40,80;    <<MAX TRANSFER ALLOWED>>          04005000
$PAGE                                                                   04010000
INTEGER ARRAY KARDIN(0:255)= PB :=    <<KARD TO JIS8 CONVERSION TABLE>> 04015000
      %000,%001,%002,%003,%004,%005,%006,%007,                          04020000
      %010,%011,%012,%013,%014,%015,%016,%017,                          04025000
      %020,%021,%022,%023,%024,%025,%026,%027,                          04030000
      %030,%031,%032,%033,%034,%035,%036,%037,                          04035000
      %040,%041,%042,%043,%044,%045,%046,%047,                          04040000
      %050,%051,%052,%053,%054,%055,%056,%057,                          04045000
      %060,%061,%062,%063,%064,%065,%066,%067,                          04050000
      %070,%071,%072,%073,%074,%075,%076,%077,                          04055000
      %100,%101,%102,%103,%104,%105,%106,%107,                          04060000
      %110,%111,%112,%113,%114,%115,%116,%117,                          04065000
      %120,%121,%122,%123,%124,%125,%126,%127,                          04070000
      %130,%131,%132,%133,%134,%135,%136,%137,                          04075000
      %140,%261,%262,%263,%264,%265,%266,%267,                          04080000
      %270,%271,%300,%301,%302,%303,%304,%305,                          04085000
      %306,%307,%310,%315,%316,%317,%320,%321,                          04090000
      %322,%323,%324,%173,%174,%175,%176,%177,                          04095000
      %200,%201,%202,%203,%204,%205,%206,%207,                          04100000
      %210,%211,%212,%213,%214,%215,%216,%217,                          04105000
      %220,%221,%222,%223,%224,%225,%226,%227,                          04110000
      %230,%231,%232,%233,%234,%235,%236,%237,                          04115000
      %241,%242,%243,%244,%245,%246,%247,%250,                          04120000
      %251,%252,%253,%254,%255,%256,%257,%240,                          04125000
      %260,%141,%142,%143,%144,%145,%146,%147,                          04130000
      %150,%151,%156,%160,%161,%162,%165,%164,                          04135000
      %152,%153,%154,%155,%272,%157,%273,%274,                          04140000
      %275,%276,%277,%311,%166,%163,%312,%313,                          04145000
      %314,%167,%325,%171,%326,%327,%330,%331,                          04150000
      %172,%170,%342,%343,%344,%345,%346,%347,                          04155000
      %340,%341,%332,%333,%334,%335,%336,%337,                          04160000
      %350,%351,%352,%353,%354,%355,%356,%357,                          04165000
      %360,%361,%362,%363,%364,%365,%366,%367,                          04170000
      %370,%371,%372,%373,%374,%375,%376,%377;                          04175000
                                                                        04180000
                                                                        04185000
                                                                        04190000
$PAGE                                                                   04195000
SUBROUTINE FORM'KATAKANA;                                               04200000
                                                                        04205000
<<  CONVERTS FROM ASCII TO KATAKANA CHARACTER SET FOR JIS8  >>          04210000
                                                                        04215000
BEGIN                                                                   04220000
WCNT:= 0;                      <<WCNT INITIALIZE>>                      04225000
WHILE WCNT < INTEGER (DITP(DWCNT)) DO                                   04230000
    BEGIN                      <<START CONVERT AND MOVE>>               04235000
    TOS:= BUFADDRD;            <<LOAD BUFADDRD>>                        04240000
    TOS:= TOS+WCNT;            <<ADDRRESS OF CONVERT DATA>>             04245000
    ASSEMBLE(LSEA);            <<LOAD DATA>>                            04250000
    ASSEMBLE(DELB,DELB);       <<CLEAR ADDRRESS ON STACK>>              04255000
    ASSEMBLE(DUP);                                                      04260000
    ASSEMBLE(ANDI 255);        <<RIGHT BYTE>>                           04265000
    X:= TOS;                                                            04270000
    TOS:= KARDIN(X);           <<CONVERT TO JIS8>>                      04275000
    ASSEMBLE(XCH);             <<NEXT BYTE>>                            04280000
    TOS:= TOS & LSR(8);        <<LEFT BYTE>>                            04285000
    X:= TOS;                                                            04290000
    TOS:= KARDIN(X);           <<CONVERT TO JIS8>>                      04295000
    TOS:= TOS & LSL(8);        <<SHIFT TO LEFT>>                        04300000
    ASSEMBLE(OR);              <<MERGE RIGHT AND LEFT BYTE>>            04305000
    TOS:= BUFADDRD;                                                     04310000
    TOS:= TOS+WCNT;            <<CONVERTED DATA ADRRESS>>               04315000
    ASSEMBLE(CAB;SSEA;DDEL);   <<MOVE AND CLEAR ADDRRESS>>              04320000
    WCNT:= WCNT+1;             <<UPDATE WORD COUNTER>>                  04325000
    END;                                                                04330000
END;                                                                    04335000
$PAGE  "DRIVER INITIATOR AND COMPLETOR COMMON AREA"                     04340000
   <<------------ BEGIN CARD READER DRIVER -------------->>             04345000
   <<---- DRIVER INITIATOR AND COMPLETOR COMMON AREA ---->>             04350000
                                                                        04355000
LDEV := DITP(DLDEV);                      <<SET LDEV>>         <<06720>>04360000
LPDT'INDEX := LDEV * INTEGER(LPDT'ENTRY'SIZE);                 <<06720>>04365000
DATAMODE := IOQ'PARM2.(11:2);             <<SET DATA MODE>>    <<06720>>04370000
AUXBUFADDRD := DOUBLE(LOGICAL(@SIOP(CHANPROGSIZE)+SYSDB));     <<06720>>04375000
      <<AUXBUFADDRD is now initialized with the bank word set>><<04623>>04380000
      <<to zero and the offset word set to the address of the>><<04623>>04385000
      <<first location following the channel program         >><<04623>>04390000
WCNT := 0;                                <<SET WORD COUNT>>   <<06720>>04395000
MSGTYPE := 0;       <<SAVE PLACE FOR MSGTYPE>>                 <<06720>>04400000
@CPVAP := DITP(DILTP);                    <<CPVAP>>            <<06720>>04405000
BADCOLUMN := 0;     <<SAVE PLACE FOR BADCOLUMN>>               <<06720>>04410000
SUBTEST := 0;       <<SAVE PLACE FOR SUBTEST>>                 <<06720>>04415000
                                                                        04420000
IF IOQ'ENTRY'INDEX=0 THEN   <<START IDLE CHANNEL PROG>>        <<06720>>04425000
BEGIN                                                                   04430000
  SIOP(JMPADDR):=STARTIDLE-2;             <<DISPLACEMENT=ADDR-2>>       04435000
  STARTIO(DITP,SIOP,FALSE);                                             04440000
  CPVAP:=0;                                                             04445000
  CRDRVR:=REQUESTDONE;                                                  04450000
  RETURN;                                                               04455000
END;                                                                    04460000
                                                                        04465000
                                                               <<06720>>04470000
IF IOQ'ABORT THEN                         <<REQUEST ABORTED>>  <<06720>>04475000
BEGIN                                                                   04480000
   MASTERCLEAR (DITP);                                                  04485000
   IOQ'COUNT := 0;                        <<CLEAR WORD COUNT>> <<06720>>04490000
   <<If I/O is aborted we will do a CLEAR to put the device>>           04495000
   <<in a known state.  We will keep a flag(ABORTFLAG) so  >>           04500000
   <<that we will only do 1 clear for each series of       >>           04505000
   <<aborted IOQs.  This flag will be reset after the first>>           04510000
   <<IOQ which does not have the abort bit set.            >>           04515000
                                                                        04520000
   IF DITP(DSAVE).ABORTFLAG=1 THEN                                      04525000
   BEGIN                                                                04530000
       TOS := IF IOQ'PFAIL THEN PFABORT ELSE ABORTED;          <<06720>>04535000
       GOTO SETSTATUS;                                                  04540000
     END                                                                04545000
   ELSE                                                                 04550000
     BEGIN                                                              04555000
       DITPL(DSAVE).ABORTFLAG:=1;                                       04560000
       GOTO DEVICECLEAR;                                                04565000
     END                                                                04570000
END                                                                     04575000
ELSE DITP(DSAVE).ABORTFLAG:=0;                                          04580000
$PAGE "DRIVER INITIATOR"                                                04585000
IF MSTATE = START'REQUEST  THEN                                         04590000
BEGIN   <<THIS BEGIN END PAIR ENCLOSES THE INITIATOR>>                  04595000
   SIOP(DEVCLEAR):=%2000; <<RESTORE PART OF READSTATUS>>                04600000
                       <<ALSO USED FOR CLEAR COMMAND>>                  04605000
   IF IOQ'FUNC = READ THEN GOTO READREQ                        <<06720>>04610000
      ELSE IF IOQ'FUNC = FOPEN THEN GOTO CONVERTDONE           <<06720>>04615000
      ELSE IF IOQ'FUNC = FCLOSE THEN GOTO CONVERTDONE          <<06720>>04620000
      ELSE IF IOQ'FUNC = DCLOSE THEN GOTO DEVICECLOSE          <<06720>>04625000
      ELSE IF IOQ'FUNC = READSTAT THEN GOTO READSTATUS         <<06720>>04630000
      ELSE IF IOQ'FUNC = IDENTITY THEN GOTO GET'IDENTITY       <<06720>>04635000
      ELSE IF IOQ'FUNC = WRITELOOP THEN GOTO WRTLOOPBACK       <<06720>>04640000
      ELSE IF IOQ'FUNC = READLOOP THEN GOTO READLOOPBACK       <<06720>>04645000
      ELSE IF IOQ'FUNC = INITTEST THEN GOTO INITSELFTEST       <<06720>>04650000
      ELSE IF IOQ'FUNC = DCLEAR THEN GOTO CLEARCOMMAND         <<06720>>04655000
      ELSE GO TO BADCALL;                                               04660000
   HELP;                                  <<FOR LINKAGE>>               04665000
                                                                        04670000
DEVICECLOSE:                                                            04675000
                                                               <<06720>>04680000
      LPDT'EOF'TYPE := 0;                                      <<06720>>04685000
                           <<CLEAR EOF STATE IN LPDT>>         <<06720>>04690000
      GO TO CONVERTDONE;                                                04695000
                                                                        04700000
CLEARCOMMAND:                                                           04705000
      IF IOQ'DIAG = 0 THEN GOTO BADCALL;                       <<06720>>04710000
DEVICECLEAR:                                                            04715000
      SIOP(DEVCLEAR):=CLEAR;       <<CLEAR COMMAND>>                    04720000
      SIOP(DEVCLEAR+1):=0;                                              04725000
      SIOP(JMPADDR):=DEVCLEAR-2;                                        04730000
      GOTO BEGINIO;                                                     04735000
                                                                        04740000
INITSELFTEST:                                                           04745000
      IF IOQ'DIAG = 0 THEN GOTO BADCALL;<<NOT DIAG REQ>>       <<06720>>04750000
      TOS:=BUFADDRD;                      <<USER BANK&ADDR>>            04755000
      ASSEMBLE (LSEA;DELB,DELB);          <<GET CONTENTS OF BANK&ADDR>> 04760000
      SUBTEST:=TOS;                                                     04765000
      IF SUBTEST<0 OR SUBTEST>5 THEN GOTO BADCALL;  <<INVALID TEST>>    04770000
      SIOP(JMPADDR):=0;                                                 04775000
      SIOP(WRITEORDER):=INIT'SELFTEST;    <<INITIATE SELF TEST>>        04780000
      SIOP(WRITEBYTES):=1;                                              04785000
      SIOP(WRITEBANK):=0;                                               04790000
      SIOP(WRITEADDR):=@SIOP(TEMPSTORE)+SYSDB;                          04795000
      SIOP(TEMPSTORE):=SUBTEST&LSL(8);                                  04800000
      SIOP(DSJGOOD):=0;                   <<GO ON TO READ RESULTS>>     04805000
      SIOP(READORDER):=READ'SELFTEST;     <<SEND RESULTS>>              04810000
      SIOP(READBYTES):=1;                                               04815000
      SIOP(READBANK):=BANK;                                             04820000
      SIOP(READBANK).(1:1):=1;  <<BIT 1 MEANS READ INTO THE             04825000
                                  RIGHT, NOT LEFT BYTE OF THE           04830000
                                  DESTINATION ADDRESS>>                 04835000
      SIOP(READADDR):=BUFADDR;                                          04840000
      SIOP(JUMP'OR'WAIT):=JUMP;                                         04845000
      SIOP(JMPADDR2):=5;                  <<JUMP AROUND READ2>>         04850000
      GOTO BEGINIO;                                                     04855000
$PAGE                                                                   04860000
WRTLOOPBACK:                                                            04865000
      IF IOQ'DIAG = 0 THEN GOTO BADCALL;                       <<06720>>04870000
      TOS:=BUFADDRD;                                                    04875000
      ASSEMBLE (LSEA;DELB,DELB);          <<GET BYTE FOR LOOPBACK>>     04880000
      SIOP(TEMPSTORE):=TOS;                                             04885000
      IF SIOP(TEMPSTORE).(0:8)<>0 THEN GOTO BADCALL;                    04890000
                                          <<VALUE MUST BE < 256 >>      04895000
      SIOP(TEMPSTORE).(0:8):=6;   <<6 IN HIGH BYTE IS CODE TO DEVICE    04900000
                                    TO ACCEPT BYTE OF LOOPBACK DATA>>   04905000
      SIOP(JMPADDR):=0;                                                 04910000
      SIOP(WRITEORDER):=INIT'SELFTEST;                                  04915000
      SIOP(WRITEBYTES):=2;                                              04920000
      SIOP(WRITEBANK):=0;                                               04925000
      SIOP(WRITEADDR):=@SIOP(TEMPSTORE)+SYSDB;                          04930000
      SIOP(DSJGOOD):=12;                  <<GO TO READ STATUS >>        04935000
      GOTO BEGINIO;                                                     04940000
                                                                        04945000
READLOOPBACK:                                                           04950000
      IF IOQ'DIAG =0 THEN GOTO BADCALL;                        <<06720>>04955000
      SIOP(JMPADDR):=READORDER-2;                                       04960000
      SIOP(READORDER):=READ'SELFTEST;     <<SEND RESULTS>>              04965000
      SIOP(READBYTES):=1;                                               04970000
      SIOP(READBANK):=BANK;                                             04975000
      SIOP(READBANK).(1:1):=1;  <<BIT 1 MEANS READ INTO THE             04980000
                                  RIGHT, NOT LEFT BYTE OF THE           04985000
                                  DESTINATION ADDRESS>>                 04990000
      SIOP(READADDR):=BUFADDR;                                          04995000
      SIOP(JUMP'OR'WAIT):=JUMP;                                         05000000
      SIOP(JMPADDR2):=5;                  <<JUMP AROUND READ2>>         05005000
      GOTO BEGINIO;                                                     05010000
                                                                        05015000
GET'IDENTITY:                                                           05020000
      IF IOQ'DIAG = 0 THEN GOTO BADCALL;<<NOT DIAG REQ>>       <<06720>>05025000
      SIOP(JMPADDR):=IDENTIFY-2;          <<JUMP TO GET IDENTITY>>      05030000
      SIOP(IDENTSTORE):=0;                <<INITIALIZE STORAGE>>        05035000
      GOTO BEGINIO;                                                     05040000
                                                                        05045000
                                                                        05050000
READSTATUS:                                                             05055000
      SIOP(JMPADDR):=RORDER2-2;           <<JUMP TO COMMAND>>           05060000
      SIOP(RORDER2):=READSTATCOMMAND;     <<READSTATUS COMMAND>>        05065000
      SIOP(RADDR2):=BUFADDR;                                            05070000
      SIOP(RBANK2):=BANK;          <<BANK & ADDR PASSED TO US>>         05075000
      SIOP(RBYTES2):=2;                                                 05080000
      GOTO BEGINIO;                                                     05085000
$PAGE                                                                   05090000
READREQ:                                                                05095000
      EOFCHECK (IOQ'ENTRY'INDEX,0D,0,0);                       <<06720>>05100000
      IF <> THEN  GO TO IODONE;           <<END OF FILE>>               05105000
                                                                        05110000
      IF DATAMODE>1 OR DATAMODE<0 THEN                                  05115000
      BEGIN                               <<INVALID MODE SPECIFICATION>>05120000
BADCALL:                                                                05125000
            IOQ'COUNT := 0;               <<CLEAR WORD COUNT>> <<06720>>05130000
            TOS:=INVALIDOP;                                             05135000
            GO TO SETSTATUS;                                            05140000
      END;                                                              05145000
                                                                        05150000
      TOS := IOQ'COUNT;                                        <<06720>>05155000
      IF < THEN BEGIN                                                   05160000
                  TOS:=  -(TOS & ASR(1)); <<CONVERT TO WORDS, IF>>      05165000
                END;                      <<BYTE COUNT IS ODD ROUND UP>>05170000
      IF LS0 > MAXCOUNT(DATAMODE) THEN    <<REQUESTED > MAXIMUM >>      05175000
      BEGIN                                                             05180000
            DEL;                                                        05185000
            TOS:= MAXCOUNT(DATAMODE);     <<TRUNCATE TO MAXCOUNT>>      05190000
            IOQ'COUNT :=                                       <<06720>>05195000
             IF INTEGER(IOQ'COUNT)<0  THEN (-(S0*2)) ELSE S0;  <<06720>>05200000
              <<QWBCT MUST REMAIN A BYTE COUNT OR WORD COUNT            05205000
                DEPENDING ON ITS ORIGINAL VALUE>>                       05210000
      END;                                                              05215000
      DITP(DWCNT):= S0;                   <<SAVE REQUESTED WORD COUNT>> 05220000
                                                                        05225000
      DITP(DSAVE).READDONE:= 0;                                         05230000
      IF <> THEN                <<CARD ALREADY READ & ASCII REQUESTED>> 05235000
      BEGIN                                                             05240000
            IF BINARY THEN      <<BINARY & CARD READ IN ASCII>>         05245000
                  GOTO BADCALL;                                         05250000
            TOS:= 1;            <<TO INDICATE AUX BUFFER READ>>         05255000
            GOTO CHECKDATA;     <<MOVE DATA TO USER FROM AUX. BUFFER>>  05260000
      END;                                                              05265000
                                                                        05270000
      IF S0< 40 THEN                                                    05275000
      BEGIN                     <<READ 40 WORDS INTO AUX. FOR BACKUP>>  05280000
           DEL;                           <<DELETE WORD COUNT>>         05285000
           IOQ'QMISC := 1;      <<SET AUXILLARY BUFFER FLAG>>  <<06720>>05290000
           TOS:= 40;                      <<NEW WORD COUNT >>           05295000
           TOS:= AUXBUFADDRD;             <<AUXILLARY BANK AND ADDRESS>>05300000
      END                                                               05305000
      ELSE TOS:= BUFADDRD;                <<USER BANK AND ADDRESS>>     05310000
                                                                        05315000
      SIOP(READADDR):= TOS;               <<BUFFER ADDRESS>>            05320000
      SIOP(READBANK):=TOS;                                              05325000
      TOS:=TOS*2;               <<CHANGE WORDCOUNT TO BYTE COUNT>>      05330000
      SIOP(READBYTES):=TOS;                                             05335000
      SIOP(READORDER):=READCOMMAND;                                     05340000
                                                                        05345000
<<NOW FORM PICK COMMAND>>                                               05350000
                                                                        05355000
      SIOP(WRITEORDER):=IF ASCII THEN PICKASCII ELSE PICKBINARY;        05360000
                                <<PICK ASCII OR BINARY>>                05365000
      SIOP(WRITEBYTES):=2;                                              05370000
      SIOP(WRITEBANK):=0;                                               05375000
      SIOP(WRITEADDR):=@SIOP(PICKCOUNT)+SYSDB;                          05380000
                                                                        05385000
      TOS:=80;                                                          05390000
      TOS:=TOS CAT SIOP(READBYTES)(0:8:8);                              05395000
      SIOP(PICKCOUNT):=TOS; <<HIGH BYTE=BYTE COUNT,LOW BYTE=BURST OF80>>05400000
      SIOP(JMPADDR):=0;         <<START CHANNEL PROG WITH PICK COMMAND>>05405000
      SIOP(DSJGOOD):=0;         <<IF PICK WAS GOOD THEN READ BUFFER>>   05410000
                                                                        05415000
<< IF BYTECOUNT IS GREATER THAN 80, AS IN A BINARY READ THEN            05420000
   THE READ MUST BE DONE IN TWO STEPS>>                                 05425000
                                                                        05430000
      IF SIOP(READBYTES)>80 THEN BEGIN                                  05435000
        SIOP(RORDER2):=READCOMMAND;                                     05440000
        SIOP(RBYTES2):=SIOP(READBYTES)-80;                              05445000
        SIOP(READBYTES):=80;                                            05450000
        SIOP(RBANK2):=SIOP(READBANK);                                   05455000
        SIOP(RADDR2):=SIOP(READADDR)+40;                                05460000
        SIOP(JUMP'OR'WAIT):=WAIT;                                       05465000
        SIOP(JMPADDR2):=0;                                              05470000
      END ELSE BEGIN                                                    05475000
        SIOP(JUMP'OR'WAIT):=JUMP;                                       05480000
        SIOP(JMPADDR2):=5;                                              05485000
      END;                                                              05490000
                                                                        05495000
BEGINIO:                                                                05500000
      SIOP(READSTATDEST):=@DITP(DSTAT)+SYSDB;                           05505000
      CPVAP:=0;                                                         05510000
      STARTIO (DITP,SIOP,TRUE);                                         05515000
      IF < THEN                                                         05520000
SIOFAILURE:                                                             05525000
      BEGIN                               <<SIO FAILURE>>               05530000
         DITP(DLOGERROR):=CPVAP;                                        05535000
         DITP(DSERR):=[8/1,8/DLOGERROR];                                05540000
         TOS:= SIOFAIL;                                                 05545000
         GOTO BADIO;                                                    05550000
      END;                                                              05555000
      IOQ'STAT := PENDING;                                     <<06720>>05560000
      CRDRVR:= CALL'COMPLETOR;                                          05565000
      RETURN;                                                           05570000
END;   <<END OF INITIATOR>>                                             05575000
$PAGE  "DRIVER COMPLETOR"                                               05580000
COMPLETOR:                                                              05585000
    IF TOS.SFAIL THEN GOTO SIOFAILURE;    <<SIO FAILURE BIT IN IOQ>>    05590000
    IF (CPVAP.ERRORCODE=6) LOR            <<DMA ABORT>>                 05595000
       (CPVAP.ERRORCODE=7) THEN  GOTO CHANERROR;<<CHANNEL ERROR>>       05600000
                                                                        05605000
    IF STATUS.POWERUP THEN                                              05610000
    BEGIN                                                               05615000
       TOS:=POWERUPSTAT;                                                05620000
       GOTO SETSTATUS;                                                  05625000
    END;                                                                05630000
                                                                        05635000
    IF IOQ'FUNC = IDENTITY THEN                                <<06720>>05640000
    BEGIN                                                               05645000
      TOS:=BUFADDRD;                                                    05650000
      TOS:=SIOP(IDENTSTORE);                                            05655000
      ASSEMBLE(SSEA;DDEL);<<STORE IDENTITY IN USER BUFFER,DELETE ADDR>> 05660000
      GOTO CONVERTDONE;                                                 05665000
    END;                                                                05670000
                                                                        05675000
    IF IOQ'FUNC <> 0 THEN GOTO CONVERTDONE;                    <<06720>>05680000
<<FOLLOWING CODE ONLY APPLIES WHEN READING A CARD, NOT FOR              05685000
  READING STATUS,SELFTEST,WRITE&READLOOPBACK,GETIDENTITY,               05690000
  OR DEVICE OPEN>>                                                      05695000
    IF (STATUS LAND LOGTROUBLE) <> 0 THEN                               05700000
    BEGIN      <<LOG THE ERROR>>                                        05705000
      DITP(DLOGERROR):=DITP(DSTAT);  <<MOVE DATA TO LOGGING BUFFER>>    05710000
      DITP(DSERR):= [8/1,8/DLOGERROR];    <<LOG ERROR>>                 05715000
    END;                                                                05720000
                                                                        05725000
    IF (STATUS LAND TROUBLEBITS) <> 0 THEN                              05730000
    BEGIN                                                               05735000
      IF STATUS.BUSERROR=1 THEN                                         05740000
      BEGIN                                                             05745000
        TOS:=XFER'ERROR;     <<The most probable cause of this          05750000
                      is an unrecognized secondary address>>            05755000
        GOTO SETSTATUS;                                                 05760000
      END;                                                              05765000
      IF STATUS.BADHOLLERITH THEN                                       05770000
      BEGIN                                                             05775000
            TOS:=IF IOQ'QMISC=1 THEN AUXBUFADDRD ELSE BUFADDRD;<<06720>>05780000
            <<BANK&ADDR OF DATA>>                                       05785000
            X:= 0;                                                      05790000
            BADCOLUMN:=81;                                              05795000
            <<If message INVALID HOLLERITH IN COLUMN 81 is              05800000
              ever sent to console this means that hardware             05805000
              status indicated an invalid hollerith, but                05810000
              the hardware failed to replace that char with             05815000
              an ascii SUB (%32)>>                                      05820000
            WHILE (X:=X+1)<=80 DO                                       05825000
            BEGIN                                                       05830000
              ASSEMBLE( LSEA );                  <<LOADMEMORY>>         05835000
              IF LX THEN TOS:= TOS&LSR(8)        <<GET LEFT BYTE>>      05840000
                    ELSE ASSEMBLE( INCB );       <<BUMP WORD ADDRESS>>  05845000
              IF TOS.(8:8)=SUB THEN BADCOLUMN:=X;<<INVALID CODE FOUND>> 05850000
            END;                                                        05855000
            IF IOMESSAGE (1,12,%11000,LDEV,BADCOLUMN,,,,OPCONSOLE)      05860000
               THEN GOTO NRWAIT  <<INVALID HOLLERITH MESS SENT>>        05865000
               ELSE GOTO SYSERR;                                        05870000
      END;                                                              05875000
$PAGE                                                                   05880000
                                                                        05885000
      <<THE NEXT STATEMENT CHECKS FOR HARDWARE EOF BY CHECKING          05890000
        IF THE EOF LAMP IS ON AND THE HOPPER IS EMPTY.                  05895000
        HOWEVER IF THERE WAS A MOTION CHECK ON THE LAST                 05900000
        CARD, WE MUST NOT RETURN EOF BECAUSE THE CARD                   05905000
        MUST BE RE-READ.>>                                              05910000
                                                                        05915000
      IF (STATUS.EOFBIT) LAND (STATUS.HOPPERMT) LAND                    05920000
         (NOT(STATUS.MPCHK)) THEN                                       05925000
      BEGIN                               <<HARDWARE EOF>>              05930000
            LPDT'EOF'TYPE := 1;                                <<06720>>05935000
                                                               <<06720>>05940000
                                                               <<06720>>05945000
            EOFCHECK (IOQ'ENTRY'INDEX,0D,0,0);                 <<06720>>05950000
            IF <> THEN  GO TO IODONE;     <<END OF FILE>>               05955000
      END;                                                              05960000
                                                                        05965000
      IF STATUS.MPCHK=1 THEN MSGTYPE:=MOTPICMSG                         05970000
      ELSE IF STATUS.RDCHK=1 THEN MSGTYPE:=RDCHKMSG                     05975000
      ELSE IF STATUS.STACKERFULL=1 THEN MSGTYPE:=STKFULLMSG             05980000
      ELSE IF STATUS.HOPPERMT=1 THEN MSGTYPE:=HOPPERMTMSG               05985000
      ELSE                                                              05990000
NOTRDY:    MSGTYPE:= NOTRDYMSG;                                         05995000
                                                                        06000000
           IF IOMESSAGE (1,MSGTYPE,%10000,LDEV,,,,,OPCONSOLE)           06005000
           THEN  BEGIN                                                  06010000
NRWAIT:             SIOP(JMPADDR):=STARTIDLE-2;                         06015000
                    CPVAP:=0;                                           06020000
                    STARTIO(DITP,SIOP,FALSE);                           06025000
                    IF < THEN                                           06030000
                    BEGIN                                               06035000
                      TOS:=SIOFAIL;                                     06040000
                      GOTO BADIO;                                       06045000
                    END;                                                06050000
                    IOQ'STAT := OFFLINESTAT;                   <<06720>>06055000
                    TOS:= NOTREADY;                                     06060000
                    GOTO OUT;                                           06065000
                 END;                                                   06070000
                                                                        06075000
SYSERR:    TOS:= SYSERROR;                <<NO MESSAGE LINK BUFFERS>>   06080000
           GOTO BADIO;                                                  06085000
                                                                        06090000
CHANERROR:                                                              06095000
           DITP(DLOGERROR):=CPVAP;                                      06100000
           DITP(DSERR):=[8/1,8/DLOGERROR];                              06105000
           TOS:=CHANFAIL;                                               06110000
$PAGE                                                                   06115000
BADIO:     MASTERCLEAR (DITP);            <<CLEAR WORD COUNT>>          06120000
           IOQ'COUNT := 0;                                     <<06720>>06125000
           GOTO SETSTATUS;                                              06130000
    END; <<OF "IF STATUS LAND TROUBLEBITS"  STATMENT>>                  06135000
$PAGE                                                                   06140000
    TOS := IOQ'QMISC;            <<AUXILLARY BUFFER FLAG>>     <<06720>>06145000
                                                                        06150000
CHECKDATA:                                                              06155000
    EOFCHECK(IOQ'ENTRY'INDEX, IF LS0 THEN AUXBUFADDRD          <<06720>>06160000
             ELSE BUFADDRD,40,                                 <<06720>>06165000
                  IF ASCII THEN 1 ELSE -1);                             06170000
                                                                        06175000
    IF TOS THEN                 <<READ INTO AUXILLARY BUFFER>>          06180000
    BEGIN                                                               06185000
         IF = THEN BEGIN        <<NO EOF, MOVE DATA TO USER BUFFER>>    06190000
                   TOS:= BUFADDRD;                                      06195000
                   TOS:= AUXBUFADDRD;                                   06200000
                   TOS:= DITP(DWCNT);     <<WORD COUNT TO MOVE>>        06205000
                   ASSEMBLE( MABS );                                    06210000
                   GOTO GOODDONE;                                       06215000
                   END;                                                 06220000
         IF < THEN GOTO SETREADDONE;      <<BACK UP CARD>>              06225000
    END                                                                 06230000
                                                                        06235000
    ELSE IF < THEN              <<DATA WAS READ INTO USER BUFFER AND>>  06240000
         BEGIN                  <<MUST BE MOVED TO AUX BUFFER>>         06245000
              TOS:= AUXBUFADDRD;                                        06250000
              TOS:= BUFADDRD;                                           06255000
              TOS:= 40;                                                 06260000
              ASSEMBLE( MABS 1 );     <<LEAVE SOURCE ADDRESS ON TOS>>   06265000
              X:= DITP(DWCNT);                                          06270000
              DO BEGIN                <<BLANK USER'S BUFFER>>           06275000
                 TOS:= TOS-1;   TOS:= 0;                                06280000
                 ASSEMBLE( SSEA );                                      06285000
                 END                                                    06290000
              UNTIL DXBZ;                                               06295000
SETREADDONE:  IF ASCII THEN DITP(DSAVE).READDONE:= 1;                   06300000
         END                                                            06305000
                                                                        06310000
         ELSE IF = THEN         <<READ INTO USER BUFFER AND NO BACK UP>>06315000
              BEGIN             <<NO EOF>>                              06320000
GOODDONE:          X := IOQ'FUNC;    <<I/O REQUEST TYPE>>      <<06720>>06325000
                   IF <> THEN GOTO CONVERTDONE;   <<NOT READ REQUEST>>  06330000
                                                               <<06720>>06335000
                                                               <<06720>>06340000
                  IF LPDT'SUBTYPE=1 AND ASCII                  <<06720>>06345000
                   THEN FORM'KATAKANA;    <<KATAKANA CHARACTER SET>>    06350000
                                                                        06355000
CONVERTDONE:       TOS:= GOODIO;                                        06360000
                                                                        06365000
SETSTATUS:         IOQ'STAT := TOS;                            <<06720>>06370000
              END;                                                      06375000
                                                                        06380000
IODONE:                                                                 06385000
    TOS:= REQUESTDONE;                                                  06390000
                                                                        06395000
OUT:                                                                    06400000
    CRDRVR:= TOS;                                                       06405000
                                                                        06410000
                                                                        06415000
    END;      <<----  C R D R V R ------->>                             06420000
$PAGE                                                                   06425000
  <<*************** DRIVER LINKAGE AREA ******************>>            06430000
                                                                        06435000
ASSEMBLE(                                                               06440000
    PCAL SIODM;    << MONITOR >>                                        06445000
    PCAL CRDRVR;   << INITIATOR >>                                      06450000
    PCAL CRDRVR;   << COMPLETOR >>                                      06455000
    CON  0;        << NO I/O PROCESS >>                                 06460000
    PCAL CRINIT;   << INITIALIZATION >>                                 06465000
    CON  1;        << ONE INTERRUPT HANDLER >>                          06470000
    PCAL GIP);     << INTERRUPT HANDLER >>                              06475000
                                                                        06480000
END.   << CARD READER DRIVER - HIOCDRD0 >>                              06485000
