$CONTROL MAP,CODE,USLINIT                                               00010000
<<ioprpn0 - module 24>>                                                 00015000
<< hp32002c mpe source c.00.00 >>                                       00020000
<< COPYRIGHT     "(C) COPYRIGHT HEWLETT-PACKARD CO. 1980.           >>  00025000
<<     this program may be used with one computer system at a       >>  00030000
<<     time and shall not otherwise be recorded, transmitted or     >>  00035000
<<     stored in a retrieval system.  copying or other reproduction >>  00040000
<<     of this program except for archival purposes is prohibited   >>  00045000
<<     without the prior written consent of hewlett-packard company.>>  00050000
<< **** note - dollar copyright cannot be used with this module *** >>  00055000
                                                                        00060000
                                                                        00065000
                                                                        00070000
                                                                        00075000
                                                                        00080000
$control privileged,uncallable                                          00085000
$thirty                                                                 00090000
$control main=ioprpn0                                          <<02698>>00095000
$title "2894A PRINTING READER PUNCH DRIVER"                             00100000
$page                                                          <<02698>>00105000
comment                                                        <<02698>>00110000
            hp 3000 printing reader punch driver - ioprpn0     <<02698>>00115000
            ----------------------------------------------     <<02698>>00120000
                                                               <<02698>>00125000
                                                               <<02698>>00130000
operation of ioprpn0:                                          <<02698>>00135000
                                                               <<02698>>00140000
ioprpn0, together with the i/o  device  monitor  (siodm)       <<02698>>00145000
constitute a standard mpe type 1 i/o driver/monitor.           <<02698>>00150000
this means that it does not run in its own process, but        <<02698>>00155000
executes on any stack (including the interrupt control stack)  <<02698>>00160000
and therefore must run to completion.  during initialization   <<02698>>00165000
it executes on progen's stack, during request initiation it    <<02698>>00170000
executes on attachio's (user's) stack, and during interrupt    <<02698>>00175000
processing it executes on the interrupt control stack (ics).   <<02698>>00180000
                                                               <<02698>>00185000
ioprpn0 consists of a global area, two procedure, and an       <<02698>>00190000
"outer block" which is really a linkage area for initial.  the <<02698>>00195000
global area contains an array called initial which is comprised<<02698>>00200000
of three parts. the first part specifies the size of the other <<02698>>00205000
two, the unit extract instruction, and various parameters which<<02698>>00210000
are used by initial.  this section  is  deleted after initial  <<02698>>00215000
is through with it.  the other two parts are the device        <<02698>>00220000
information table (dit) and the sio program area (siop),  which<<02698>>00225000
is part of the interrupt linkage table (ilt).  initial will put<<02698>>00230000
each of these items in the area of memory where it belongs. the<<02698>>00235000
linkage area specifies the procedure labels (p-labels) of the  <<02698>>00240000
associated monitor (siodm), the request initiator (prpchdvr),  <<02698>>00245000
the  request completor (prpchdvr), and the interrupt handler   <<02698>>00250000
(gip).                                                         <<02698>>00255000
                                                               <<02698>>00260000
the primary working code of ioprpn0 is a procedure prpchdvr.   <<02698>>00265000
prpchdvr is called with six parameters. two of these           <<02698>>00270000
parameters, bank and bufadr, are the absolute buffer address of<<02698>>00275000
the data to be processed. drtn is the hardware address and     <<02698>>00280000
interrupt information area for the device. the other three,    <<02698>>00285000
ditp, ioqp, and siop are pointers to three tables. ditp is a   <<02698>>00290000
pointer to the device information table which contains         <<02698>>00295000
information about its associated printing reader punch unit.   <<02698>>00300000
there is one dit for unit on the controller and they contain   <<02698>>00305000
information which must be saved between i/o requests to the    <<02698>>00310000
driver. ioqp is a pointer to the input/output queue element.   <<02698>>00315000
ioq elements contain information relevant to the current       <<02698>>00320000
request. siop is a pointer to the first element of the sio     <<02698>>00325000
program which is actually part of the interrupt linkage table. <<02698>>00330000
prpchdvr utilizes the sio program area as an auxiliary buffer  <<02698>>00335000
for read operation.                                            <<02698>>00340000
                                                               <<02698>>00345000
prpchdvr is always called by the i/o device monitor (siodm)    <<02698>>00350000
and it determines the reason for the call by examining the ioq <<02698>>00355000
and the dit.  there are three basic parts of the driver, the   <<02698>>00360000
common area, the initiator and the completor.                  <<02698>>00365000
the operation of each is discussed below.                      <<02698>>00370000
$page                                                          <<02698>>00375000
ioprpn0 commom area:                                           <<02698>>00380000
                                                               <<02698>>00385000
this code is at the beginning of the driver and is executed any<<02698>>00390000
time the driver is "called." it performs housekeeping functions<<02698>>00395000
(sets up local variables, checks for abort or timeout          <<02698>>00400000
conditions).                                                   <<02698>>00405000
                                                               <<02698>>00410000
                                                               <<02698>>00415000
ioprpn0 initiator:                                             <<02698>>00420000
                                                               <<02698>>00425000
execution begins here for either a new request or a retry/     <<02698>>00430000
continuation of the last request. if the request is a new one  <<02698>>00435000
counts and buffer offsets are initialized.  the main purpose of<<02698>>00440000
the initiator is to initiate a card feed for read, or,         <<02698>>00445000
to output print/punch data then feed a card for write.         <<02698>>00450000
                                                               <<02698>>00455000
                                                               <<02698>>00460000
ioprpn0 completor:                                             <<02698>>00465000
                                                               <<02698>>00470000
the completor section of the driver is entered as a result of  <<02698>>00475000
an external interrupt. the status condition of the last        <<02698>>00480000
interrupt is taken and then an analysis of this status is      <<02698>>00485000
performed and appropriate actions are taken. finally either the<<02698>>00490000
request is completed and special notation is sent back to the  <<02698>>00495000
user or execution is resumed back at the initiator to retry or <<02698>>00500000
complete the request. actual data input will be done by this   <<02698>>00505000
section on read.                                               <<02698>>00510000
                                                               <<02698>>00515000
                                                               <<02698>>00520000
default settings:                                              <<02698>>00525000
                                                               <<02698>>00530000
  read:  hopper#1 --> stacker#1 --> full                       <<02698>>00535000
                                                               <<02698>>00540000
  write: hopper#2 --> stacker#2 --> full                       <<02698>>00545000
                                                               <<02698>>00550000
  spooler header/trailer write                                 <<02698>>00555000
        hopper#2 --> stacker#2 -->                             <<02698>>00560000
                                                               <<02698>>00565000
  close (eject card)                                           <<02698>>00570000
         waiting station --> stacker#1                         <<02698>>00575000
                                                               <<02698>>00580000
                                                               <<02698>>00585000
                                                       /-------<<02698>>00590000
                                                       |hopper|<<02698>>00595000
                                                       | #1   |<<02698>>00600000
                                                       --------<<02698>>00605000
                      ---------  --------- ---------       v   <<02698>>00610000
    ------------------|print  |--|punch  | |waiting|--------   <<02698>>00615000
    v          v      |station|  |station| |station|       ^   <<02698>>00620000
/--------  /--------  ---------  --------- ---------   /-------<<02698>>00625000
|stacker|  |stacker|                                   |hopper|<<02698>>00630000
| #2    |  | #1    |                                   | #2   |<<02698>>00635000
---------  ---------                                   --------<<02698>>00640000
$page                                                          <<02698>>00645000
                                                               <<02698>>00650000
the following information is pertinent to configuring the      <<02698>>00655000
device into an hp3000 computer system.                         <<02698>>00660000
                                                               <<02698>>00665000
device type    = 22                                            <<02698>>00670000
device subtype = 0 (80 column card)                            <<02698>>00675000
                 1 (96 column card - not supported!)           <<02698>>00680000
record width   = 40 words (80 column card)                     <<02698>>00685000
                 48 words (96 column card - not supported!)    <<02698>>00690000
                                                                        00695000
                                                                        00700000
                                                                        00705000
driver request codes:                                                   00710000
                                                                        00715000
    0 - read                                                            00720000
      this function reads the "count" data requested by the    <<02698>>00725000
      user from 2894a. p1/p2 parameters are used to specify the<<02698>>00730000
      eof check level and data mode respectively.              <<02698>>00735000
        p1(13:3) - end of file specification                            00740000
                   0 - reset eof and read                               00745000
                   1 - check for hardware eof                           00750000
                   2 - check for supercolon eof                         00755000
                   3 - check for colon eof                              00760000
       p2.(11:2) - ascii/binary mode                           <<00597>>00765000
                   0 - ascii                                   <<00597>>00770000
                   1 - column binary                           <<00597>>00775000
                                                               <<02698>>00780000
    1 - write                                                           00785000
      this function writes the "count" data requested by the   <<02698>>00790000
      user to 2894a. p2 parameter is used to specify the data  <<02698>>00795000
      mode.                                                    <<02698>>00800000
       p2.(10:1) - system write                                <<00597>>00805000
                   0 - user initiated write                    <<00597>>00810000
                   1 - system initiated write  (header card)   <<00597>>00815000
          (11:2) - ascii/binary mode                           <<00597>>00820000
                   0 - ascii                                            00825000
                   1 - column binary                                    00830000
                                                               <<02698>>00835000
    2 - open file                                                       00840000
      this function sets up the initial condition for          <<02698>>00845000
      successive read/write. p2 parameter is used to designate <<02698>>00850000
      the type of access. driver first initializes             <<02698>>00855000
      the 2894a then selects the default hopper/stacker        <<02698>>00860000
      (hopper #1 & stacker #1).                                <<02698>>00865000
        p2(13:3) - type of access                                       00870000
                   0 - open for read only                               00875000
                   1 - open for write only                              00880000
                   2 - open for read and write                          00885000
                                                               <<02698>>00890000
    3 - close file                                                      00895000
      p1/p2 parameters are not used by this function.          <<02698>>00900000
                                                               <<02698>>00905000
    4 - close device                                                    00910000
      p1/p2 parameters are not used by this function.          <<02698>>00915000
      this function resets the eof condition then selects the  <<02698>>00920000
      default hopper/stacker (hopper #1 & stacker #1).         <<02698>>00925000
                                                               <<02698>>00930000
  %34 - control                                                <<02698>>00935000
        p1(6:1)    0 - select no inhibit feed on write                  00940000
                   1 - select inhibit feed on write                     00945000
          (7:1)    0 - select punch on write                            00950000
                   1 - select no punch on write                         00955000
          (8:1)    0 - select print on write                            00960000
                   1 - select no print on write                         00965000
          (9:1)    0 - select print and punch same data                 00970000
                   1 - select print and punch separate data             00975000
          (10:1)   0 - select primary stacker                           00980000
                   1 - select secondary stacker                         00985000
          (11:1)   0 - select primary hopper                            00990000
                   1 - select secondary hopper                          00995000
$page                                                          <<02698>>01000000
status  returns -                                              <<02698>>01005000
                                                               <<02698>>01010000
pending (waiting).                                             <<02698>>01015000
 % 10  - waiting for completion interrupt.                     <<02698>>01020000
   30  - not ready wait.                                       <<02698>>01025000
                                                               <<02698>>01030000
successful (completion).                                       <<02698>>01035000
   01  - normal completion.                                    <<02698>>01040000
                                                               <<02698>>01045000
end of file                                                    <<02698>>01050000
 % 12  - physical end of file.                                 <<02698>>01055000
   22  - data                                                  <<02698>>01060000
   32  - end of data                                           <<02698>>01065000
   42  - hello                                                 <<02698>>01070000
   52  - bye                                                   <<02698>>01075000
   62  - job                                                   <<02698>>01080000
   72  - end of job                                            <<02698>>01085000
                                                               <<02698>>01090000
unusual completion (data may not transferred to/from device).  <<02698>>01095000
 % 33  - request aborted externally.                           <<02698>>01100000
   63  - system power fail.(but not necessarily 2894a pfail!)  <<02698>>01105000
                                                               <<02698>>01110000
irrecoverable (catastrophic termination).                      <<02698>>01115000
 % 04  - invalid request, function or parameter.               <<02698>>01120000
   14  - transfer error.                                       <<02698>>01125000
   24  - i/o timed out before completion.                      <<02698>>01130000
   54  - 2894a unit failure.                                   <<02698>>01135000
  124  - no message link buffers available.                    <<02698>>01140000
                                                               <<02698>>01145000
$page                                                          <<02698>>01150000
                                                               <<02698>>01155000
                     device reference table (drt)              <<02698>>01160000
                     ----------------------------              <<02698>>01165000
                                                               <<02698>>01170000
                                                               <<02698>>01175000
there is one drt for each device controller configured on the  <<02698>>01180000
system.                                                        <<02698>>01185000
                                                               <<02698>>01190000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   mnemonic <<02698>>01195000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+           <<02698>>01200000
  0|      sio program pointer      (siop)          |   drt0    <<02698>>01205000
   |-----------------------------------------------|           <<02698>>01210000
  1|      interrupt handler program label          |   drt1    <<02698>>01215000
   |-----------------------------------------------|           <<02698>>01220000
  2|    interrupt linkage table pointer (iltp)     |   drt2    <<02698>>01225000
   |-----------------------------------------------|           <<02698>>01230000
  3|               reserved                        |   drt3    <<02698>>01235000
   +-----------------------------------------------+           <<02698>>01240000
$page                                                          <<02698>>01245000
                                                               <<02698>>01250000
                interrupt linkage table (ilt)                  <<02698>>01255000
                -----------------------------                  <<02698>>01260000
                                                               <<02698>>01265000
                                                               <<02698>>01270000
there is one ilt for each device controller configured on the  <<02698>>01275000
system.                                                        <<02698>>01280000
                                                               <<02698>>01285000
     0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15   mnemonic <<02698>>01290000
   +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+           <<02698>>01295000
  0|                       0                       |   icpva0  <<02698>>01300000
   .                       .                       .           <<02698>>01305000
  5|                       0                       |   icpva5  <<02698>>01310000
   |-----------------------------------------------|           <<02698>>01315000
  6|                       0                       |   isrql   <<02698>>01320000
   |--+-----------------+--------+-----------------|           <<02698>>01325000
  7|m |     chanque     |        |   drt number    |   idrtn   <<02698>>01330000
   |--+-----------------+--------+-----------------|           <<02698>>01335000
%10|   sysdb relative pointer to sio program area  |   isiop   <<02698>>01340000
   |-----------------------------------------------|           <<02698>>01345000
%11|                       0                       |   istap   <<02698>>01350000
   |-----------------------------------------------|           <<02698>>01355000
%12| single instruction that is executed to extract|   iunit   <<02698>>01360000
   | the device unit number from the status.       |           <<02698>>01365000
   |-----------------------------------------------|           <<02698>>01370000
%13|                       0                       |   icdp    <<02698>>01375000
   |-----------------------+-----------------------|           <<02698>>01380000
%14|       siopsize        |        cquen          |   iqueue  <<02698>>01385000
   |-----------------------+-----------------------|           <<02698>>01390000
%15|                       0                       |   iflag   <<02698>>01395000
   |-----------------------------------------------|           <<02698>>01400000
%16|        sysdb relative dit pointer             |   iditp0  <<02698>>01405000
   |-----------------------------------------------|           <<02698>>01410000
%17| printing reader punch sio program area        |           <<02698>>01415000
   . used as a buffer for read operation.          .           <<02698>>01420000
   | 48 words: buffer / 5 words: 96 col eof check  |           <<02698>>01425000
   +-----------------------------------------------+           <<02698>>01430000
                                                               <<02698>>01435000
                                                               <<02698>>01440000
                                                               <<02698>>01445000
idrtn - contains controller information                        <<02698>>01450000
                                                               <<02698>>01455000
  m       - if this bit is set, the controller is sharing a    <<02698>>01460000
            software channel resource in order to limit        <<02698>>01465000
            bandwidth.                                         <<02698>>01470000
  chanque - the software channel resource number.              <<02698>>01475000
  drtn    - the drt number for a printing reader punch.        <<02698>>01480000
                                                               <<02698>>01485000
                                                               <<02698>>01490000
iqueue - resource queuing information.                         <<02698>>01495000
                                                               <<02698>>01500000
  siopsize - (number of words + 1)/2 in the sio program area.  <<02698>>01505000
  cquen    - for a multi-unit controller this field contains   <<02698>>01510000
             the software controller resource number.          <<02698>>01515000
$page                                                          <<02698>>01520000
  2894a dit -                                                  <<02698>>01525000
                                                               <<02698>>01530000
    0   1   2   3   4  5  6  7  8   9   10 11 12 13 14 15      <<02698>>01535000
  +---+---+---+---+--+--+--+--+---+---+---+--+-----------+     <<02698>>01540000
 0| 0 | 0 |act|req|0 |0 |sp|0 |iak| 0 | 0 |  |  mstate   |dflag<<02698>>01545000
  |---+---+---+---+--+--+--+--+---+---+---+--+-----------|     <<02698>>01550000
 1|               pointer to next dit                    |dlink<<02698>>01555000
  |------------------------------------------------------|     <<02698>>01560000
 2|             pointer to active ioq or zero            |dioqp<<02698>>01565000
  |-------+-------------------+--------------------------|     <<02698>>01570000
 3|   0   |         0         |  logical device number   |dldev<<02698>>01575000
  |-------+-------------------+--------------------------|     <<02698>>01580000
 4|             driver linkage table pointer             |ddltp<<02698>>01585000
  |------------------------------------------------------|     <<02698>>01590000
 5|             interrupt linkage table pointer          |diltp<<02698>>01595000
  |------------------------------------------------------|     <<02698>>01600000
 6|             controller interrupt status              |dstat<<02698>>01605000
  |------------------------------------------------------|     <<02698>>01610000
 7|                 error logging information            |dserr<<02698>>01615000
  |---+--------------------------------------------------|     <<02698>>01620000
 8| t |         timeout indication in bit 0              |dtime<<02698>>01625000
  |---+---+---+---+--+--+--+--+---+---+---+--+-----+--+--|     <<02698>>01630000
 9|cbf|sc |ss |hs |if|eo|ib|pr|pn |spd|ec |sm|mode |co|tr|daccp<<02698>>01635000
  |---+---+---+---+--+--+--+--+---+---+---+--+-----+--+--|     <<02698>>01640000
10|               timer request list index               |dtrlx<<02698>>01645000
  +------------------------------------------------------+     <<02698>>01650000
                                                               <<02698>>01655000
   dflag - device relative flags.                              <<02698>>01660000
         act   active bit. 1 implies a monitor currently       <<02698>>01665000
               servicing this device.                          <<02698>>01670000
         req   request bit. 1 implies service requested        <<02698>>01675000
               while monitor is active.                        <<02698>>01680000
         sp    sio preemption. if set then a preemptive        <<02698>>01685000
               request has been queued for this device.        <<02698>>01690000
               preempt code is set in ioq element.             <<02698>>01695000
         iak   if set, an interrupt or response has occured.   <<02698>>01700000
$page                                                          <<02698>>01705000
         mstate  current driver state as defined by the monitor<<02698>>01710000
                 allowable states are:                         <<02698>>01715000
              0 - start new request                            <<02698>>01720000
              1 - not used(but reserved)                       <<02698>>01725000
              2 - call driver initiator                        <<02698>>01730000
              3 - call driver completor                        <<02698>>01735000
              4 - unused(but reserved)                         <<02698>>01740000
              5 - complete request..perhaps return to user.    <<02698>>01745000
              6 - unexpected interrupt occurred. (devrec)      <<02698>>01750000
              7 - start operator intervention wait. then %10.  <<02698>>01755000
            %10 - waiting (on operator). restart at 0.         <<02698>>01760000
             11 - waiting (data makepresent/freezing) then 2.  <<02698>>01765000
             12 - waiting (initiator code makepresent/freeze)  <<02698>>01770000
             13 - waiting (for completion interrupt)           <<02698>>01775000
             14 - waiting (for device controller availability) <<02698>>01780000
             15 - unused(but reserved)                         <<02698>>01785000
             16 - waiting (initiator code makepresent)         <<02698>>01790000
             17 - waiting (completor code makepresent)         <<02698>>01795000
                                                               <<02698>>01800000
   dldev - logical device number.                              <<02698>>01805000
                                                               <<02698>>01810000
   daccp - access control parameter.                           <<02698>>01815000
                                                               <<02698>>01820000
    .cbf - clear buffer full. (currently not used)             <<02698>>01825000
           0 - the next card leaving the hopper will be read   <<02698>>01830000
               by the device.                                  <<02698>>01835000
           1 - the read buffer will be cleared when next card  <<02698>>01840000
               leaves the hopper.                              <<02698>>01845000
                                                               <<02698>>01850000
    .sc  - stacker control.                                    <<02698>>01855000
           0 - all cards are stacked in right stacker(#1) until<<02698>>01860000
               device goes not ready.                          <<02698>>01865000
           1 - cards are stacked per ss.                       <<02698>>01870000
                                                               <<02698>>01875000
    .ss  - stacker select.                                     <<02698>>01880000
           0 - right stacker (stacker #1)                      <<02698>>01885000
           1 - left stacker (stacker #2)                       <<02698>>01890000
                                                               <<02698>>01895000
    .hs  - hopper select.                                      <<02698>>01900000
           0 - pick from rear hopper (primary hopper)          <<02698>>01905000
           1 - pick from front hopper(secondary hopper)        <<02698>>01910000
                                                               <<02698>>01915000
    .if  - inhibit input feed. (currently not used)            <<02698>>01920000
           1 - inhibit picking a card when card currently      <<02698>>01925000
               in wait station is eject to a stacker.          <<02698>>01930000
                                                               <<02698>>01935000
    .eo  - end of file has been detected on a read operation.  <<02698>>01940000
                                                               <<02698>>01945000
    .ib  - internal buffer flag.                               <<02698>>01950000
           1 - an internal buffer is being used. the buffer    <<02698>>01955000
               is the sio program area in the ilt.             <<02698>>01960000
                                                               <<02698>>01965000
    .pr  - no print on the next card to pass the print station <<02698>>01970000
                                                               <<02698>>01975000
    .pn  - no punch on the next card to pass the punch station.<<02698>>01980000
                                                               <<02698>>01985000
    .spd - separate print data.                                <<02698>>01990000
           print data other than that being punched on the     <<02698>>01995000
           next card to pass the punch and print station.      <<02698>>02000000
                                                               <<02698>>02005000
    .ec  - eject card - eject on a write after read. (not used)<<02698>>02010000
           used when reading one card then punching one card   <<02698>>02015000
           (last card was read).                               <<02698>>02020000
                                                               <<02698>>02025000
    .sm  - stacker mode:saved stacker mode on last read.       <<02698>>02030000
           (currently not used)                                <<02698>>02035000
                                                               <<02698>>02040000
    .mode- access mode (currently not used)                    <<02698>>02045000
           0 - file opened for read only                       <<02698>>02050000
           1 - file opened for write only                      <<02698>>02055000
           2 - file opened for read write                      <<02698>>02060000
                                                               <<02698>>02065000
    .co  - control.                                            <<02698>>02070000
           0 - no control has occured for this devide          <<02698>>02075000
               (use default settings)                          <<02698>>02080000
           1 - control is in effect                            <<02698>>02085000
               (use settings in this dit word)                 <<02698>>02090000
                                                               <<02698>>02095000
    .tr  - timer request.                                      <<02698>>02100000
           timer request is pending. index is in dtrlx.        <<02698>>02105000
                                                               <<00597>>02110000
definition of dit word 9(dacess and daccp)                              02115000
      bits (0:5) are hopper/stacker related. their meaning follows      02120000
                                                                        02125000
           (0:1) =0 80 cols of data from next card leaving the          02130000
                    hopper will be stored in the memory of device       02135000
                 =1 data in memory of device is cleared when the        02140000
                    next card passes the read station.                  02145000
           (1:1) =0 stacker control. cards are discharged to the        02150000
                    stacker #1(right hand-stacker).                     02155000
                 =1 stacker control. cards are discharged to the        02160000
                    stacker as specified by bit (2:1) below.            02165000
           (2:1)    select stacker bit.  this bit is effective for      02170000
                    stacking when bit (1:1) is a 1.  the stacker        02175000
                    selected is as follows:                             02180000
                 =0 select stacker #1(right hand-stacker).              02185000
                 =1 select stacker #2(left hand-stacker).               02190000
           (3:1) =0 hopper select.  when 0, select from primary hopper  02195000
                    (hopper#1, also known as the rear hopper).          02200000
                 =1 hopper select. when 1, select from secondary        02205000
                    hopper.(hopper#2, or front hopper).                 02210000
           (4:1) =0 inhibit input feed. when 0, allows a card to be     02215000
                    fed from the hopper to the wait station when the    02220000
                    current card in wait station is sent to stacker     02225000
                 =1 inhibit input feed. when 1, no card can be fed      02230000
                    from either hopper to the wait station. however,    02235000
                    a card currently in the wait station may be fed     02240000
                    to a stacker.                                       02245000
            (5:1)=0 driver internal flag. when 0,no eof has been        02250000
                    detected.                                           02255000
                 =1 an eof has been detected on a read operation.       02260000
            (6:1)=0 internal buffer flag.  when 0, no internal          02265000
                    buffer is being used.                               02270000
                 =1 an internal auxillary buffer(at end of sio area     02275000
                    is being used.                                      02280000
            (7:3)   see print/punch options in driver request codes     02285000
                    under (5-control, p1.(7:3)).                        02290000
           (10:4) - unused.                                    <<00597>>02295000
           (14:1)=0 no fcontrol has occured for this file. use          02300000
                    default settings.                                   02305000
                 =1 fcontrol has occurred. use settings in this         02310000
                    dit word to indicate how to operate device.         02315000
           (15:1)=0 no timer request is pending(see dit word %12).      02320000
                 =1 a timer request index is in word %12 of dit and     02325000
                    is current(an aborttimereq must be done on intrpt)  02330000
$page                                                          <<02698>>02335000
                                                               <<02698>>02340000
     the driver is concerned with the i/o status.              <<02698>>02345000
the i/o status contains info about the actual 2894a hardware   <<02698>>02350000
and its current state.  the driver reads i/o status into the   <<02698>>02355000
dit status area.                                               <<02698>>02360000
the format of the status is shown below.                       <<02698>>02365000
each word and bit in the table is defined as follows:          <<02698>>02370000
                                                               <<02698>>02375000
                                                               <<02698>>02380000
i/o status words                                               <<02698>>02385000
                                                               <<02698>>02390000
interrupt status word                                          <<02698>>02395000
                                                               <<02698>>02400000
  0   1   2   3 4   5   6   7   8   9   10  11  12  13  14  15 <<02698>>02405000
+---+---+---+-----+---+---+---+---+---+---+---+---+---+---+---+<<02698>>02410000
| 1 |rwk|inp| seq |dfs|ids| 0 |rci|rin|nri|dti|ibi|isi|   |toi|<<02698>>02415000
+---+---+---+-----+---+---+---+---+---+---+---+---+---+---+---+<<02698>>02420000
                                                               <<02698>>02425000
     rwk - rio or wio ok.                                      <<02698>>02430000
                                                               <<02698>>02435000
     inp - interrupt pending.                                  <<02698>>02440000
                                                               <<02698>>02445000
     seq - sequence counter.                                   <<02698>>02450000
                                                               <<02698>>02455000
           bits  counter  meaning                              <<02698>>02460000
           3  4  state                                         <<02698>>02465000
           ----  -------  -------------------                  <<02698>>02470000
           0  0     0     no data transfer in progress         <<02698>>02475000
           1  0     1     dev cmd sent to initiate data xfer   <<02698>>02480000
           1  1     2     dev flag received and xfer completed <<02698>>02485000
           0  1     3     never attained except passing state  <<02698>>02490000
                                                               <<02698>>02495000
     dfs - device flag status                                  <<02698>>02500000
                                                               <<02698>>02505000
     ids - interrupt status = 0.                               <<02698>>02510000
                                                               <<02698>>02515000
     rci - ready for command interrupt.                        <<02698>>02520000
                                                               <<02698>>02525000
     rin - ready interrupt.                                    <<02698>>02530000
                                                               <<02698>>02535000
     nri - not ready interrupt.                                <<02698>>02540000
                                                               <<02698>>02545000
     dti - data transfer interrupt.                            <<02698>>02550000
                                                               <<02698>>02555000
     ibi - input buffer full interrupt.                        <<02698>>02560000
                                                               <<02698>>02565000
     isi - i/o system interrupt.                               <<02698>>02570000
                                                               <<02698>>02575000
     toi - time out interrupt.                                 <<02698>>02580000
$page                                                          <<02698>>02585000
device status word                                             <<02698>>02590000
                                                               <<02698>>02595000
     0   1   2   3   4   5   6   7   8   9   10  11  12    15  <<02698>>02600000
   +---+---+---+-------+---+---+---+---+-------+---+---+-----+ <<02698>>02605000
   | 1 |rwk|inp|  seq  |dfs|ids| 0 |rfc|  rea  |cws|she|     | <<02698>>02610000
   +---+---+---+-------+---+---+---+---+-------+---+---+-----+ <<02698>>02615000
                                                               <<02698>>02620000
     ids - device status = 1.                                  <<02698>>02625000
                                                               <<02698>>02630000
     rfc - ready for command.                                  <<02698>>02635000
                                                               <<02698>>02640000
     rea - ready.                                              <<02698>>02645000
           both bits are on  - ready and on-line               <<02698>>02650000
           bothe bits are off - not ready or off-line          <<02698>>02655000
                                                               <<02698>>02660000
     cws - card in wait station.                               <<02698>>02665000
                                                               <<02698>>02670000
     she - secondary hopper empty.                             <<02698>>02675000
                                                               <<02698>>02680000
                                                               <<02698>>02685000
6-bit status word (not stored in dit)                          <<02698>>02690000
                                                               <<02698>>02695000
       0   1   2   3   4   5   6   7   8                    15 <<02698>>02700000
     +---+-------+---+---+---+---+---+------------------------+<<02698>>02705000
     |ibf|       |rch|ich|och|phe|stf|                        |<<02698>>02710000
     +---+-------+---+---+---+---+---+------------------------+<<02698>>02715000
                                                               <<02698>>02720000
     ibf - input buffer full.                                  <<02698>>02725000
                                                               <<02698>>02730000
     rch - read check.                                         <<02698>>02735000
                                                               <<02698>>02740000
     ich - input check.                                        <<02698>>02745000
                                                               <<02698>>02750000
     och - output check.                                       <<02698>>02755000
                                                               <<02698>>02760000
     phe - primary hopper empty.                               <<02698>>02765000
                                                               <<02698>>02770000
     stf - stacker full.                                       <<02698>>02775000
$page                                                          <<02698>>02780000
    2894a ioq -                                                <<02698>>02785000
                                                               <<02698>>02790000
                                                               <<02698>>02795000
         0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15       <<02698>>02800000
        +--+-----+--+--+--+--+--+--+--+--+--+-----+--+--+      <<02698>>02805000
   ioq0 |ab|     |sb|wa|bl|c |fr|me|pr|sf|pf|prmpt|  |md| qflag<<02698>>02810000
        |--+-----+--+--+--+--+--+--+--+--+--+-----+--+--|      <<02698>>02815000
   ioq1 |       ioq pointer to next new request         | qlink<<02698>>02820000
        |-----------------------+-----------------------|      <<02698>>02825000
   ioq2 |                       | logical device number | qldev<<02698>>02830000
        |-----------------------+-----------------------|      <<02698>>02835000
   ioq3 |          miscellaneous parameter              | qmisc<<02698>>02840000
        |--+--------------------------------------------|      <<02698>>02845000
   ioq4 |s |               dst number                   | qdstn<<02698>>02850000
        |--+--------------------------------------------|      <<02698>>02855000
   ioq5 |        target data buffer address             | qaddr<<02698>>02860000
        |-----------------------+-----------------------|      <<02698>>02865000
   ioq6 |                       |     function code     | qfunc<<02698>>02870000
        |-----------------------+-----------------------|      <<02698>>02875000
   ioq7 |      word (+) or byte (-) count               | qwbct<<02698>>02880000
        |-----------------------------------------------|      <<02698>>02885000
   i0q8 |              parameter 1                      | qpar1<<02698>>02890000
        |-----------------------------------------------|      <<02698>>02895000
   i0q9 |              parameter 2                      | qpar2<<02698>>02900000
        |-----------------------+--------------+--------|      <<02698>>02905000
   ioq1 |     pcb number        |   qualifier  |rstatus | qstat<<02698>>02910000
        +-----------------------+--------------+--------+      <<02698>>02915000
                                                               <<02698>>02920000
   qflag -                                                     <<02698>>02925000
        * ab      request aborted externally.                  <<02698>>02930000
          di      diagnostic function requested.               <<02698>>02935000
          sb      request is using system buffers.             <<02698>>02940000
          wa      wake caller on completion of request.        <<02698>>02945000
          bl      blocked io. caller is waiting completion.    <<02698>>02950000
          c       request has been completed & user awakened.  <<02698>>02955000
          fr      data seg. is present in core and frozen.     <<02698>>02960000
          me      mam error on data segment make present.      <<02698>>02965000
          pr      this request started-but preempted by mam.   <<02698>>02970000
          sf      sio failure in gip.                          <<02698>>02975000
        * pf      the io is being aborted due to power fail.   <<02698>>02980000
          prmpt   preemptive type code: 1 - soft, 2 - hard.    <<02698>>02985000
          md      a message request reply has completed.       <<02698>>02990000
                                                               <<02698>>02995000
        * denotes the information which 2894a driver uses.     <<02698>>03000000
$page                                                          <<02698>>03005000
   qmisc -                                                     <<02698>>03010000
                                                               <<02698>>03015000
         0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15       <<02698>>03020000
        +-----------+-----------------------------------+      <<02698>>03025000
   ioq3 |  wstate   |           unused                  | qmisc<<02698>>03030000
        +-----------+-----------------------------------+      <<02698>>03035000
                                                               <<02698>>03040000
   wstate - waiting state                                      <<02698>>03045000
                                                               <<02698>>03050000
                                                                        03055000
ioq(qmisc) word definition follows next:                                03060000
           (0:1) =0 null. no function                                   03065000
                 =1 i/o initiated,waiting for completion interrupt      03070000
           (1:1) =0 null. no function                                   03075000
                 =1 waiting on a "NOT READY" interrupt to bring         03080000
                    device back online.                                 03085000
           (2:1) =0 current operation is not a write operation.         03090000
                 =1 current operation is a write operation.             03095000
           (3:1) =0 normal.                                    <<00597>>03100000
                 =1 waiting for the operator to clear the      <<00597>>03105000
                    card path after a read check or invalid    <<00597>>03110000
                    code.                                      <<00597>>03115000
           (4:12)   not used at present.                       <<00597>>03120000
$page                                                          <<02698>>03125000
special situations.                                            <<02698>>03130000
                                                               <<02698>>03135000
auxilialy buffer.                                              <<02698>>03140000
                                                               <<02698>>03145000
  we have to read 80/96 columns data even if there is only less<<02698>>03150000
80/96 columns data required. for this reason, there is an      <<02698>>03155000
auxiliary buffer to hold the original contents of card columns <<02698>>03160000
in which at first the card contents will be read.              <<02698>>03165000
however, if the user's buffer is large enough to hold 80/96    <<02698>>03170000
columns data, the auxilialy buffer will not be used. the       <<02698>>03175000
exception is that when a :eof: was read, we have to return eof <<02698>>03180000
condition right away, therefore, the last card                 <<02698>>03185000
(which caused eof condition) will be saved in auxiliary buffer.<<02698>>03190000
                                                               <<02698>>03195000
buffer length.                                                 <<02698>>03200000
                                                               <<02698>>03205000
  if the buffer length is specified by negative number the     <<02698>>03210000
  following condition will occur if it was an odd number.      <<02698>>03215000
  ascii mode : "count" columns will be read but will be        <<02698>>03220000
               truncated if auxiliary buffer in use.           <<02698>>03225000
  binary mode: truncated "count" columns will be read.         <<02698>>03230000
                                                               <<02698>>03235000
column binary.                                                 <<02698>>03240000
                                                               <<02698>>03245000
  only read first 40/48 columns.                               <<02698>>03250000
                                                               <<02698>>03255000
                                                               <<02698>>03260000
                                                               <<02698>>03265000
card jams.                                                     <<02698>>03270000
                                                               <<02698>>03275000
  if the last card in hopper causes a card jam, it will be     <<02698>>03280000
  damaged and will not be re-produced.                         <<02698>>03285000
                                                               <<02698>>03290000
                                                               <<02698>>03295000
                                                               <<02698>>03300000
                                                               <<02698>>03305000
                                                               <<02698>>03310000
;  << end of comments >>                                       <<02698>>03315000
$page                                                          <<02698>>03320000
                                                                        03325000
                                                                        03330000
                                                                        03335000
begin                                                                   03340000
    equate                                                              03345000
         ascii        = 0,       <<mode>>                               03350000
         colbin       = 1,       <<mode>>                               03355000
         qdstn        = 4,       <<index into ioq-dst#>>                03360000
         qfunc        = 6,       <<index into ioq-funct code>>          03365000
         qpar1        = 8,       <<index into ioq-param #1>>            03370000
         qpar2        = 9,       <<index into ioq-param #2>>            03375000
         qmisc        = 3,       <<index into ioq-internal flags>>      03380000
         qwbcnt       = 7,       <<index into ioq-word/byte cnt>>       03385000
         qflag        = 0,       <<index into ioq-flags>>               03390000
         qldev        = 2,       <<index into ioq-log dev#>>            03395000
         qstat        =10,       <<index into ioq-status>>              03400000
         dflag        = 0,       <<index into dit-flags>>               03405000
         dldev        = 3,       <<index into dit-log dev#>>            03410000
         dstat        = 6,       <<index into dit-status>>              03415000
         daccess      = 9,       <<index into dit-access type>>         03420000
         dtrlx        = 10,      <<index into dit-timer>>               03425000
         dtimer       = 8,       <<index into dit-tick>>                03430000
         icntrl       = 7,       <<index in ilt of drt>>       <<01300>>03435000
         read         = 0,       <<function-read>>                      03440000
         write        = 1,       <<function-write>>                     03445000
         open         = 2,       <<function-file open>>                 03450000
         close        = 3,       <<function-file close>>                03455000
         devclose     = 4,       <<function-device close>>              03460000
         control      = 28,      <<function-control>>                   03465000
         completion   = 3,       <<monitor state-completion>>           03470000
         endio        = 5,       <<monitor state-end of request>>       03475000
         reinit       = %7,      <<monitor state-reinit on intrp>>      03480000
         unitfail     = %54,     <<status return=unit failure>>         03485000
         invalid      = %40,     <<status return-invalid func>>         03490000
         puncherr     = %203,     <<status return-wr no card in wait>>  03495000
         macc         = %123,    <<status return-multiple access>>      03500000
         aborted      = %33,     <<status return-i/0 aborted>>          03505000
         pfabort      = %63,     <<status return-pwr fail abort>>       03510000
         clear        = %040000, <<clear all interrupts>>               03515000
         mstrclear    = %100000, <<master clear>>                       03520000
         sysdb        = %1000,   <<system db>>                          03525000
         wnew         = %7,      <<reinitiate on interrupt>>            03530000
         callcmplt    = %13,     <<call cmpltr on intrpt>>              03535000
         badcntrl     = %3,      <<invalid control function>>           03540000
         badfunc      = %5,      <<invalid function code>>              03545000
         xfererr      = %14,     <<transferr error-status>>             03550000
         syslpdt      = %10,     <<lpdt pointer index>>                 03555000
         crpditsz     = 11,       <<dit size for cd/rdr/pch>>           03560000
         siosize      = 54,      <<sio pgm size-used as buffer>>        03565000
         siosized2    = siosize/2,  <<siosize/2 for initial>>  <<01300>>03570000
         ciofeed      = %040010; <<cio-feed card>>                      03575000
                                                                        03580000
                                                                        03585000
  define                                                                03590000
       disable        = assemble(sed 0)#,                               03595000
       enable         = assemble(sed 1)#,                               03600000
       pfailb         = (11:1)#,                                        03605000
       iak            = (8:1)#,                                         03610000
       eof            = (8:2)#,   <<eof field in lpdt>>                 03615000
       drt            = (8:8)#,   <<drt field in ilt >>        <<01300>>03620000
       deof           =ditp(daccess).(12:1)#,                  <<00597>>03625000
       status         =ioqp(qstat).(8:8)#,                              03630000
       daccp          =ditp(daccess)#,                                  03635000
       axbflg         =ditp(daccess).(6:1)#,                            03640000
       sbuf           =ioqp(qflag).(3:1)#,                              03645000
       qmiscp         =ioqp(qmisc)#;                                    03650000
                                                                        03655000
                                                                        03660000
                                                                        03665000
                                                                        03670000
<< dit definition and driver linkage area >>                            03675000
                                                                        03680000
byte array config(0:7)=db:=                                             03685000
crpditsz,1,0,0,0,0,siosized2,0;                                <<01300>>03690000
                                                                        03695000
array ditab(1:crpditsz)=db:=                                            03700000
0,0,0,0,0,0,0,0,0,%40000,0;                                    <<01.02>>03705000
                                                                        03710000
array sioa(1:siosize)=db:=0;                                            03715000
                                                                        03720000
                                                                        03725000
procedure delay(time);                                                  03730000
  value time;                                                           03735000
  double time;                                                          03740000
  option external;                                                      03745000
                                                                        03750000
                                                                        03755000
procedure eofcheck(ioqp,bufr,cnt,hardchk);                              03760000
  value ioqp,bufr,cnt,hardchk;                                          03765000
  double bufr;                                                          03770000
  pointer ioqp;                                                         03775000
  integer cnt,hardchk;                                                  03780000
  option external;                                                      03785000
                                                                        03790000
procedure gip;                                                          03795000
  option external;                                                      03800000
                                                                        03805000
procedure help;                                                         03810000
  option external;                                                      03815000
                                                                        03820000
logical procedure iomessage(setno,msgno,mask,p1,p2,p3,p4,p5,   <<0u.eb>>03825000
   dest,reply,offset,ditp,iotype);                             <<0u.eb>>03830000
value setno,msgno,mask,p1,p2,p3,p4,p5,dest,reply,offset,ditp,  <<0u.eb>>03835000
   iotype;                                                     <<0u.eb>>03840000
integer setno,msgno,mask,p1,p2,p3,p4,p5,dest,reply,offset,     <<0u.eb>>03845000
   iotype;                                                     <<0u.eb>>03850000
integer pointer ditp;                                          <<0u.eb>>03855000
option variable,external;                                      <<0u.eb>>03860000
                                                                        03865000
                                                                        03870000
procedure siodm(ditp,flags);                                            03875000
  value ditp,flags;                                                     03880000
  logical flags;                                                        03885000
  pointer ditp;                                                         03890000
  option external;                                                      03895000
                                                                        03900000
                                                                        03905000
procedure masterclear(ditp);                                            03910000
  array ditp;                                                           03915000
  option external;                                                      03920000
                                                                        03925000
                                                                        03930000
procedure iofailure(drtn,ditp);                                         03935000
  value drtn;                                                           03940000
  integer drtn;                                                         03945000
  array ditp;                                                           03950000
  option external;                                                      03955000
                                                                        03960000
                                                                        03965000
                                                                        03970000
integer procedure timereq(code,req,time);                               03975000
  value code,req,time;                                                  03980000
  integer code,req;                                                     03985000
  double time;                                                          03990000
  option external;                                                      03995000
                                                                        04000000
                                                                        04005000
procedure aborttimereq(trlx);                                           04010000
  value trlx;                                                           04015000
  integer trlx;                                                         04020000
     option external;                                                   04025000
                                                                        04030000
                                                                        04035000
procedure initz(iditp);                                                 04040000
   integer array iditp;                                                 04045000
   begin                                                                04050000
     pointer ps0=s-0;                                                   04055000
     masterclear(iditp);                                                04060000
     tos:=iditp(5);     <<get drt nimber>>                              04065000
     tos:=ps0(icntrl).drt;                                     <<01300>>04070000
     tos:=2;          <<enable interrupts>>                             04075000
     assemble (cio 1);                                                  04080000
     if <> then assemble(del);                                          04085000
   end;                                                                 04090000
$page                                                          <<02698>>04095000
integer procedure prpchdvr(ioqp,ditp,bank,bufadr,siop,drtn);            04100000
  value ioqp,ditp,bank,bufadr,siop,drtn;                                04105000
  integer bank,bufadr,drtn;                                             04110000
  integer pointer ioqp,ditp,siop;                                       04115000
                                                                        04120000
                                                                        04125000
                                                                        04130000
  begin                                                                 04135000
                                                                        04140000
    double ubuf=bank;                                                   04145000
    double abuf;                                                        04150000
    integer mstate=prpchdvr,                                            04155000
            s0=s-0,                                                     04160000
            s1=s-1,                                                     04165000
            s2=s-2,                                                     04170000
            s3=s-3,                                                     04175000
            s4=s-4,                                                     04180000
            s5=s-5,                                                     04185000
            x=x,                                                        04190000
            func,                                                       04195000
            p1,                                                         04200000
            p2,                                                         04205000
            mode,                                                       04210000
            i,j,k,l,m,n,                                                04215000
            index,                                                      04220000
            maxbufsize,                                                 04225000
            bnkno,                                                      04230000
            temp,                                                       04235000
            fcnt,                                                       04240000
            hcnt,                                                       04245000
            wbcnt;                                                      04250000
    define ldev   = ioqp(qldev).(8:8)#;                                 04255000
    define siopbase=@siop+sysdb#;                                       04260000
                                                                        04265000
                                                                        04270000
                                                                        04275000
$page "ASCII TO HOLLERITH CONVERSION TABLE"                    <<02698>>04280000
    integer array aholl(0:255)=pb:=                                     04285000
<<         0     1     2     3     4     5     6     7  >>              04290000
<<00>> %5403,%4401,%4201,%4101,%0005,%1023,%1013,%1007,                 04295000
<<01>> %2011,%4021,%1021,%4103,%4043,%4023,%4013,%4007,                 04300000
<<02>> %6403,%2401,%2201,%2101,%0043,%0023,%0201,%1011,                 04305000
<<03>> %2003,%2403,%0007,%1005,%2043,%2023,%2013,%2007,                 04310000
<<04>> %0000,%4006,%0006,%0102,%2102,%1042,%4000,%0022,                 04315000
<<05>> %4022,%2022,%2042,%4012,%1102,%2000,%4102,%1400,                 04320000
<<06>> %1000,%0400,%0200,%0100,%0040,%0020,%0010,%0004,                 04325000
<<07>> %0002,%0001,%0202,%2012,%4042,%0012,%1012,%1006,                 04330000
<<10>> %0042,%4400,%4200,%4100,%4040,%4020,%4010,%4004,                 04335000
<<11>> %4002,%4001,%2400,%2200,%2100,%2040,%2020,%2010,                 04340000
<<12>> %2004,%2002,%2001,%1200,%1100,%1040,%1020,%1010,                 04345000
<<13>> %1004,%1002,%1001,%4202,%1202,%2202,%2006,%1022,                 04350000
<<14>> %0402,%5400,%5200,%5100,%5040,%5020,%5010,%5004,                 04355000
<<15>> %5002,%5001,%6400,%6200,%6100,%6040,%6020,%6010,                 04360000
<<16>> %6004,%6002,%6001,%3200,%3100,%3040,%3020,%3010,                 04365000
<<17>> %3004,%3002,%3001,%5000,%6000,%3000,%3400,%4005,                 04370000
<<20>> %3403,%1401,%1201,%1101,%1041,%2021,%4011,%2005,                 04375000
<<21>> %1003,%1403,%1203,%1103,%1043,%4403,%4203,%2103,                 04380000
<<22>> %7403,%0401,%2203,%0101,%0041,%0021,%0011,%4003,                 04385000
<<23>> %0003,%0403,%0203,%0103,%4041,%2041,%0013,%3401,                 04390000
<<24>> %5401,%5201,%5101,%5041,%5021,%5011,%5005,%5003,                 04395000
<<25>> %4402,%6401,%6201,%6101,%6041,%6021,%6011,%6005,                 04400000
<<26>> %6003,%2402,%3201,%3101,%3041,%3021,%3011,%3005,                 04405000
<<27>> %3003,%1402,%7000,%7401,%7201,%7101,%7041,%7021,                 04410000
<<30>> %7011,%7005,%7003,%5402,%5202,%5102,%5042,%5022,                 04415000
<<31>> %5012,%5006,%6402,%6202,%6102,%6042,%6022,%6012,                 04420000
<<32>> %6006,%3402,%3202,%3102,%3042,%3022,%3012,%3006,                 04425000
<<33>> %7402,%7400,%7200,%7100,%7040,%7020,%7010,%7004,                 04430000
<<34>> %7002,%7001,%7202,%7102,%7042,%7022,%7012,%7006,                 04435000
<<35>> %5203,%5103,%5043,%5023,%5013,%5007,%6203,%6103,                 04440000
<<36>> %6043,%6023,%6013,%6007,%3203,%3103,%3043,%3023,                 04445000
<<37>> %3013,%3007,%7203,%7103,%7043,%7023,%7013,%7007;                 04450000
                                                                        04455000
$page "HOLLERITH TO ASCII CONVERSION TABLE"                    <<02698>>04460000
integer array hollass(0:255)=pb :=                                      04465000
   %040, %061, %062, %063, %064, %065, %066, %067,                      04470000
   %070, %140, %072, %043, %100, %047, %075, %042,                      04475000
   %071, %221, %026, %223, %224, %225, %226, %004,                      04480000
   %230, %231, %232, %233, %024, %025, %236, %032,                      04485000
   %060, %057, %123, %124, %125, %126, %127, %130,                      04490000
   %131, %271, %134, %054, %045, %137, %076, %077,                      04495000
   %132, %201, %202, %203, %204, %012, %027, %033,                      04500000
   %210, %211, %212, %213, %214, %005, %006, %007,                      04505000
   %055, %112, %113, %114, %115, %116, %117, %120,                      04510000
   %121, %261, %135, %044, %052, %051, %073, %136,                      04515000
   %122, %021, %022, %023, %235, %205, %010, %207,                      04520000
   %030, %031, %222, %217, %034, %035, %036, %037,                      04525000
   %175, %176, %163, %164, %165, %166, %167, %170,                      04530000
   %171, %321, %322, %323, %324, %325, %326, %327,                      04535000
   %172, %237, %262, %263, %264, %265, %266, %267,                      04540000
   %270, %200, %364, %365, %366, %367, %370, %371,                      04545000
   %046, %101, %102, %103, %104, %105, %106, %107,                      04550000
   %110, %250, %133, %056, %074, %050, %053, %041,                      04555000
   %111, %001, %002, %003, %234, %011, %206, %177,                      04560000
   %227, %215, %216, %013, %014, %015, %016, %017,                      04565000
   %173, %141, %142, %143, %144, %145, %146, %147,                      04570000
   %150, %303, %304, %305, %306, %307, %310, %311,                      04575000
   %151, %240, %241, %242, %243, %244, %245, %246,                      04580000
   %247, %000, %350, %351, %352, %353, %354, %355,                      04585000
   %174, %152, %153, %154, %155, %156, %157, %160,                      04590000
   %161, %312, %313, %314, %315, %316, %317, %320,                      04595000
   %162, %251, %252, %253, %254, %255, %256, %257,                      04600000
   %260, %020, %356, %357, %360, %361, %362, %363,                      04605000
   %272, %331, %332, %333, %334, %335, %336, %337,                      04610000
   %340, %330, %342, %343, %344, %345, %346, %347,                      04615000
   %341, %273, %274, %275, %276, %277, %300, %301,                      04620000
   %302, %220, %372, %373, %374, %375, %376, %377;                      04625000
comment                                                        <<02698>>04630000
above table is indexed by the pattern of hollerith code as     <<02698>>04635000
follows:                                                       <<02698>>04640000
                                                               <<02698>>04645000
    8   9   10  11  12  13  14  15                             <<02698>>04650000
  +---+---+---+---+---+-----------+                            <<02698>>04655000
  |r12|r11|r0 |r9 |r8 | row#(1-7) |                            <<02698>>04660000
  +---+---+---+---+---+-----------+                            <<02698>>04665000
                                                               <<02698>>04670000
  r12,r11,r0,r9,r8 : status of each row.                       <<02698>>04675000
                                                               <<02698>>04680000
  row#             : value between 1 to 7 corresponds to row # <<02698>>04685000
                     which has a hole.                         <<02698>>04690000
                                                               <<02698>>04695000
  for example: "A" has holes on r11 and r1 and resulting index <<02698>>04700000
               is 10000001(%201).                              <<02698>>04705000
  ;                                                            <<02698>>04710000
                                                                        04715000
$page "6 BIT CODE TO/FROM ASCII CONVERSION TABLE FOR 96 COLUMN"<<02698>>04720000
integer array sixa(%40:%141)=pb:=                                       04725000
<<%40>> %00,%52,%17,%13,%53,%34,%32,%15,                                04730000
<<%50>> %75,%55,%54,%76,%33,%40,%73,%21,                                04735000
<<%60>> %20,%01,%02,%03,%04,%05,%06,%07,                                04740000
<<%70>> %10,%11,%12,%56,%74,%16,%36,%37,                                04745000
<<%100>>%14,%61,%62,%63,%64,%65,%66,%67,                                04750000
<<%110>>%70,%71,%41,%42,%43,%44,%45,%46,                                04755000
<<%120>>%47,%50,%51,%22,%23,%24,%25,%26,                                04760000
<<%130>>%27,%30,%31,%00,%00,%57,%72,%35,                                04765000
<<%140>>%77,%60;                                                        04770000
                                                                        04775000
integer array a6(%0:%77)=pb:=                                           04780000
<<%00>> %40,%61,%62,%63,%64,%65,%66,%67,                                04785000
<<%10>> %70,%71,%72,%43,%100,%47,%75,%42,                               04790000
<<%20>> %60,%57,%123,%124,%125,%126,%127,%130,                          04795000
<<%30>> %131,%132,%46,%54,%45,%137,%76,%77,                             04800000
<<%40>> %55,%112,%113,%114,%115,%116,%117,%120,                         04805000
<<%50>> %121,%122,%41,%44,%52,%51,%73,%135,                             04810000
<<%60>> %175,%101,%102,%103,%104,%105,%106,%107,                        04815000
<<%70>> %110,%111,%136,%56,%74,%50,%53,%174;                            04820000
$page "2894A PRINTING READER PUNCH DRIVER"                     <<02698>>04825000
logical inhibit:=false,                                                 04830000
        nopunch:=false,                                                 04835000
        noprint:=false,                                                 04840000
        ppsepar:=false,                                                 04845000
        secstack:=false,                                                04850000
        sechopp:=false,                                                 04855000
        stackcont:=false,                                               04860000
        writeword:=%040000,                                             04865000
        scratch,                                                        04870000
        bfill;                                                          04875000
        integer pointer buf;                                            04880000
        integer pointer ctab;                                           04885000
        double pointer lpdtd = db+syslpdt;                              04890000
                                                                        04895000
$page                                                          <<02698>>04900000
subroutine setflags;                                                    04905000
  begin                                                                 04910000
    tos:=0;                                                             04915000
    tos:=siopbase;  <<set up aux buffer>>                               04920000
    abuf:=tos;                                                          04925000
    tos:=lpdtd(ldev);                                                   04930000
    if tos.(12:4)=1 then  <<96 col>>                                    04935000
    begin                                                               04940000
      fcnt:=96;                                                         04945000
      hcnt:=48;                                                         04950000
    end                                                                 04955000
    else                                                                04960000
    begin                                                               04965000
      fcnt:=80;                                                         04970000
      hcnt:=40;                                                         04975000
    end;                                                                04980000
    del;                                                                04985000
    func:=ioqp(qfunc);     <<get function code>>                        04990000
    p1:=ioqp(qpar1);       <<get parameter 1>>                          04995000
    p2:=ioqp(qpar2);       <<get parameter 2>>                          05000000
    if func <> control  then mode := p2.(11:2);                <<00597>>05005000
    if daccp.(14:1)=0 then   <<if no fcontrol set defaults>>   <<00597>>05010000
      if func = write                                          <<00597>>05015000
        then daccp.(0:5):=%16   <<scm, hopr 2, stkr 2>>        <<00597>>05020000
        else daccp.(0:5):=%10;  <<scm, hopr1, stkr1>>          <<00597>>05025000
    writeword.(0:5):=daccp.(0:5);                                       05030000
    nopunch:=daccp.(7:1);     <<no punch option>>                       05035000
    noprint:=daccp.(8:1);     <<noprint option>>                        05040000
    ppsepar:=daccp.(9:1);     <<separate print option>>                 05045000
    if func=write and p2.(10:1)=1  then   <<if system write>>  <<00597>>05050000
    begin    <<set defaults for header/trailer>>               <<00597>>05055000
      writeword.(1:4):=%17;   <<hopr2 -> stkr 2, iif>>         <<00597>>05060000
      nopunch:=false;   <<punch>>                              <<00597>>05065000
      noprint:=false;   <<print>>                              <<00597>>05070000
    end;                                                       <<00597>>05075000
    sechopp:=writeword.(3:1);   <<hopper select flag>>         <<00597>>05080000
    secstack:=writeword.(2:1);  <<stacker select flag>>        <<00597>>05085000
  end;     <<set flags>>                                                05090000
                                                                        05095000
$page                                                          <<02698>>05100000
subroutine feedcard;                                                    05105000
  begin                                                                 05110000
    qmiscp:=0;                                                          05115000
    tos:=drtn;                                                          05120000
    assemble(tio 0);                                                    05125000
    if < then go ufail;                                                 05130000
    if s0.(9:1) <> 1 then                                               05135000
    begin     <<device not ready>>                                      05140000
      ditp(dstat):=tos;  <<save status>>                                05145000
      iomessage(1,11,%10000,ldev,,,,,0);                       <<00597>>05150000
      qmiscp := %40000;   <<waiting for ready>>                <<00597>>05155000
      tos := %30;                                              <<00597>>05160000
      tos := reinit;   <<call initiator on irpt>>              <<00597>>05165000
      go bend;                                                 <<00597>>05170000
    end;                                                                05175000
    ditp(dstat):=tos;  <<drtn now on tos>>                              05180000
    tos := mstrclear;                                          <<00597>>05185000
    assemble(cio 1);    <<masterclear>>                        <<00597>>05190000
    if <> then go ufail;                                       <<00597>>05195000
    tos:=writeword land %73777;      <<turn off iff>>                   05200000
    assemble(wio 1);                                                    05205000
    if < then go ufail;                                                 05210000
    if > then go notrdy;                                                05215000
    tos:= %1000;     <<set dev end>>                                    05220000
    assemble(cio 1);                                                    05225000
    if <> then go ufail;                                                05230000
    disable;                                                   <<00597>>05235000
    tos:=%40;     <<frq>>                                               05240000
    assemble(cio 1);                                                    05245000
    if <> then go ufail;                                                05250000
    tos:=%3;      <<eir,stt>>                                           05255000
    assemble(cio 1);                                                    05260000
    if  <> then go ufail;                                               05265000
    assemble(del);  <<clean off stack>>                                 05270000
    if func=write then                                                  05275000
    qmiscp:=%20000;                                                     05280000
    tos:=1;                                                             05285000
    tos:=callcmplt;                                                     05290000
    go bend;                                                            05295000
  <<**note--we are not returning to caller**>>                 <<00597>>05300000
  end;     <<feedcard>>                                                 05305000
                                                                        05310000
                                                                        05315000
$page                                                          <<02698>>05320000
subroutine setwbcount;                                                  05325000
<<figure out actual w/b count and set maxsize>>                         05330000
  begin                                                                 05335000
    tos:=ioqp(qwbcnt);                                                  05340000
    if mode = ascii then                                                05345000
    begin                                                               05350000
      if s0.(0:1) =0 then                                               05355000
      tos:=-(tos&asl(1));     <<set to byte count>>                     05360000
      wbcnt:=tos;                                                       05365000
      if wbcnt< -fcnt then wbcnt:=-fcnt;                                05370000
      if ppsepar then wbcnt:=-fcnt;  <<full card on sep print>>         05375000
      if ioqp(qwbcnt) <0 then ioqp(qwbcnt):=wbcnt                       05380000
      else ioqp(qwbcnt) := -(wbcnt&asr(1));                    <<01.03>>05385000
    end     <<ascii count>>                                             05390000
    else                                                                05395000
    begin     <<col bin count>>                                         05400000
      if s0.(0:1)=1 then                                                05405000
      tos:=-(tos&asr(1));     <<set to word count>>                     05410000
      wbcnt:=tos;                                                       05415000
      if wbcnt>fcnt then wbcnt:=fcnt;                                   05420000
      if ioqp(qwbcnt) < 0 then ioqp(qwbcnt) := -(wbcnt&asl(1)) <<01.03>>05425000
      else ioqp(qwbcnt):=wbcnt;                                         05430000
    end;                                                                05435000
  end;     <<set word byte count>>                                      05440000
                                                                        05445000
                                                                        05450000
$page                                                          <<02698>>05455000
subroutine writecard;                                                   05460000
<<  j= # writes neccessary(#columns to be punched)  >>                  05465000
<<  i= write counter(0 to j-1)                      >>                  05470000
<<  k= index of buffer word currently being referenced >>               05475000
<<  bfill= true means write blanks(to fill out card)  >>                05480000
  begin                                                                 05485000
    i:=-1;                                                              05490000
    k:=0;                                                               05495000
    tos:=drtn;                                                          05500000
    tos:=bank;                                                          05505000
    tos:=bufadr;                                                        05510000
    tos:=tos-1;                                                         05515000
    while (i:=i+1)  <j do                                               05520000
    begin     <<write loop>>                                            05525000
      if bfill then tos:=0 else                                         05530000
      begin     <<data>>                                                05535000
        if i.(15:1)=0 or mode=colbin then                      <<00140>>05540000
        tos:=tos+1;                                                     05545000
        assemble(lsea);                                                 05550000
        if mode = ascii then                                            05555000
        begin  <<ascii>>                                                05560000
          if logical(i) then                                            05565000
          k:=k+1 else     <<r.h. byte>>                                 05570000
          tos:=tos&lsr(8);     <<l.h. byte>>                            05575000
          x:=tos land %377;     <<ascii code>>                          05580000
          if fcnt=96 then                                               05585000
          begin     <<set up 6 bit char>>                               05590000
            if x>%40 then if x<%140 then go outa;                       05595000
            if x=%174 then                                              05600000
            begin                                                       05605000
              x:=%140;                                                  05610000
              go outa;                                                  05615000
            end;                                                        05620000
            if x= %175 then x:=%141                                     05625000
            else x:=%133;                                               05630000
outa:                                                                   05635000
            tos:=sixa(x);                                               05640000
          end     <<6 bit set up>>                                      05645000
          else                                                          05650000
          tos:=aholl(x);     <<hollerith code>>                         05655000
        end;                                                            05660000
      end;  <<data>>                                                    05665000
      l := 1;      <<timeout counter>>                         <<00597>>05670000
      do   <<loop until wio allowed>>                          <<00597>>05675000
      begin                                                    <<00597>>05680000
        assemble(tio 3);                                       <<00597>>05685000
        if < then go ufail;                                    <<00597>>05690000
        if (l:=l+1)=0 then go fail;  <<timed out>>             <<00597>>05695000
      end                                                      <<00597>>05700000
      until tos.(5:1)=1;   <<dfs set = wio ok>>                <<00597>>05705000
      assemble (wio 3);                                                 05710000
      if < then go ufail;                                               05715000
      if > then assemble(del);                                          05720000
    end;  <<write loop>>                                                05725000
    assemble(del; ddel);                                                05730000
  end;  <<writecard subroutine>>                                        05735000
                                                                        05740000
                                                                        05745000
$page                                                          <<02698>>05750000
subroutine clbfullsub;                                                  05755000
  begin                                                                 05760000
    if daccp.(15:1)=1 then go bagin;                                    05765000
    tos:=drtn;                                                          05770000
      tos:=writeword lor %140000; <<clear buf full>>           <<01.02>>05775000
    assemble(wio 1);                                                    05780000
    if < then go ufail;                                                 05785000
    tos:=%1000;     <<sde>>                                             05790000
    assemble(cio 1);                                                    05795000
    if <> then go ufail;                                                05800000
    if func=write then <<set up delay>>                                 05805000
    begin                                                               05810000
      ditp(dtrlx):=timereq(%20,@ditp,100d);                    <<01.02>>05815000
      daccp.(15:1):=1;                                                  05820000
      status:=1;                                                        05825000
      mstate:=callcmplt;                                                05830000
      go to fasout;                                                     05835000
bagin:                                                                  05840000
      aborttimereq(ditp(dtrlx));                                        05845000
      daccp.(15:1):=0;                                                  05850000
    tos:=drtn;                                                          05855000
    end;                                                                05860000
    tos:=clear;                                                         05865000
    assemble(cio 1);                                                    05870000
    if <> then go ufail;                                                05875000
    assemble(del);                                                      05880000
  if func=write then                                                    05885000
  begin                                                                 05890000
    if qmiscp=%20000 then go bag2                                       05895000
      else go welldone;                                        <<01.02>>05900000
  end;                                                                  05905000
end;  <<clear buffer full subroutine>>                                  05910000
$page                                                                   05915000
<<  i  n  i  t  i  a  t  o  r    >>                                     05920000
                                                                        05925000
     disable;     <<disable interrupts>>                                05930000
     ditp(0).iak:=0;  <<reset iak>>                                     05935000
     tos:=ioqp;                                                         05940000
     del;                                                               05945000
     if < then                                                          05950000
     begin     <<i/o has been aborted>>                                 05955000
       enable;                                                          05960000
       masterclear(ditp);                                               05965000
       if ioqp.pfailb =1 then tos:=pfabort else tos:=aborted;           05970000
       tos:=endio;                                                      05975000
       go to out;                                                       05980000
     end;                                                               05985000
     enable;                                                            05990000
     if mstate = completion then go completor;                          05995000
win:                                                                    06000000
     enable;                                                   <<01.02>>06005000
     tos:=drtn;     <<enable dev status,clear interrupts>>              06010000
     tos:=clear lor %10;                                                06015000
     assemble (cio 1; del);                                             06020000
     if <> then                                                         06025000
     begin                                                              06030000
ufail:                                                                  06035000
       enable;                                                 <<01.02>>06040000
       iofailure(drtn,ditp);   <<non responding device>>                06045000
fail:                                                                   06050000
       enable;                                                 <<01.02>>06055000
      iomessage(1,208,%10000,ldev,,,,,0);                      <<0u.eb>>06060000
      tos:=drtn;                                                        06065000
      tos:=mstrclear;                                                   06070000
      assemble(cio 1; del);                                             06075000
      if <> then assemble(del);                                         06080000
      tos:=unitfail;                                                    06085000
      tos:=endio;                                                       06090000
      go to bend;                                                       06095000
    end;                                                                06100000
    setflags;                                                           06105000
    if func = read then                                                 06110000
$page                                                                   06115000
<<i n i t i a t o r    r e a d                  >>                      06120000
    begin                                                               06125000
      eofcheck(ioqp,0d,0,0);    <<pre-read eof check>>                  06130000
      if <> then                                                        06135000
      begin                                                             06140000
        mstate:=endio;                                                  06145000
        return;                                                         06150000
      end;                                                              06155000
      if deof=1 then  <<last rd eof.swap buffers>>                      06160000
      begin                                                             06165000
        if mode=ascii then go swpbuf;                                   06170000
        tos:=badfunc;     <<invalid function>>                          06175000
        tos:=endio;                                                     06180000
        go to bend;                                                     06185000
      end;                                                              06190000
      axbflg:=0;                                                        06195000
      if -(fcnt-1)<=ioqp(qwbcnt)<=(hcnt-1) then                         06200000
      axbflg:=1;     <<use auxillary buffer>>                           06205000
      setwbcount;                                                       06210000
      feedcard;                                                         06215000
    end;  <<read initial>>                                              06220000
    if func = write then                                                06225000
$page                                                                   06230000
<<  i n i t i a t o r    w r i t e               >>                     06235000
                                                                        06240000
    begin                                                               06245000
      tos:=drtn;                                                        06250000
      assemble(tio 0);                                                  06255000
      if < then go ufail;                                               06260000
      if s0.(9:1)<> 1 then                                              06265000
      begin     <<device not ready>>                                    06270000
notrdy:                                                                 06275000
        iomessage(1,11,%10000,ldev,,,,,0);                     <<0u.eb>>06280000
        tos:=drtn;     <<clear>>                                        06285000
        tos:=clear;                                            <<00597>>06290000
        assemble(cio 1);                                                06295000
        if <> then go ufail;                                            06300000
        tos:=2;     <<eir>>                                             06305000
        assemble(cio 1);                                                06310000
        if <> then go ufail;                                            06315000
        assemble(del);                                                  06320000
        tos:=0;                                                         06325000
        tos:=reinit;                                                    06330000
        go bend;                                                        06335000
      end;                                                              06340000
      if tos.(11:1) <> 1  then feedcard;                       <<00597>>06345000
       <<if no card in vws, feed one>>                         <<00597>>06350000
      tos:=writeword;                                                   06355000
      assemble(wio 1);  <<hopp,stacker,inhibit options>>                06360000
      if < then go ufail;                                               06365000
      if > then go notrdy;                                              06370000
      tos:=%1000;     <<set device end>>                                06375000
      if not noprint then                                               06380000
      tos.(7:1):=1;     <<set print option>>                            06385000
      if not nopunch then                                               06390000
      tos.(8:1):=1;     <<set punch option>>                            06395000
      if ppsepar then                                                   06400000
      tos.(9:1):=1;     <<set separate print option>>                   06405000
      assemble(dup);     <<duplicate command>>                          06410000
      assemble(cio 2);   <<print,punch options>>                        06415000
      if <> then go ufail;                                              06420000
      tos:=(tos land %700) lor %40;  <<add in feed req>>                06425000
      assemble(cio 1);                                                  06430000
      if <> then go ufail;                                              06435000
      setwbcount;                                                       06440000
      if wbcnt < 0 then                                                 06445000
      j:=-(wbcnt)   <<#writes required ascii>>                          06450000
      else j:=wbcnt;<<#writer required col binary>>                     06455000
      bfill:=false;                                                     06460000
      writecard;                                                        06465000
      if j<fcnt then                                                    06470000
      begin     <<zero fill>>                                           06475000
        j:=fcnt-j;     <<#cols remaining>>                              06480000
        bfill:=true;                                                    06485000
        writecard;                                                      06490000
      end;     <<zero fill>>                                            06495000
      if ppsepar then                                                   06500000
      begin     <<separate print data>>                                 06505000
        mode:=ascii;     <<all printing is in ascii>>                   06510000
        j:=fcnt;     <<always print fcnt characters>>                   06515000
        bufadr:=bufadr+hcnt;    <<start of print buffer>>               06520000
        bfill:=false;                                                   06525000
        writecard;                                                      06530000
        bufadr:=bufadr-hcnt;    <<reset buffer>>                        06535000
      end;     <<separate print>>                                       06540000
      tos:=drtn;                                                        06545000
      tos:=%1003;     <<set dev end,enab int,start timer>>              06550000
      disable;                                                 <<01.02>>06555000
      assemble(cio 1);                                                  06560000
      if <> then go ufail;                                              06565000
      tos:=1;                                                           06570000
      tos:=callcmplt;     <<call completor>>                            06575000
      go out;                                                           06580000
    end;     <<write>>                                                  06585000
    if func = open then                                                 06590000
$page                                                                   06595000
<<  i n i t i a t o r    o p e n                  >>                    06600000
    begin     <<file open>>                                             06605000
      masterclear(ditp);                                                06610000
      daccp:=%40000;   <<set stacker control mode>>            <<00597>>06615000
      go welldone;                                                      06620000
    end;                                                                06625000
    if func = close then                                                06630000
$page                                                                   06635000
<<  i n i t i a t o r    c l o s e                 >>                   06640000
    begin     <<file close>>                                            06645000
      tos:=drtn;                                                        06650000
      assemble(tio 0);                                                  06655000
      if < then go ufail;                                               06660000
      if s0.(11:1)=1 then                                               06665000
      begin     <<card in wait stat-must be cleared>>                   06670000
        assemble(del);                                                  06675000
         tos:=writeword lor %44000;<<inhibit input feed>>      <<01.02>>06680000
        assemble(wio 1);                                                06685000
        if < then go ufail;                                             06690000
        if > then go notrdy;                                            06695000
        tos:=%1000;     <<set dev end>>                                 06700000
        assemble(cio 1);                                                06705000
        if <> then go ufail;                                            06710000
        tos:=%43;   <<frq,eir,stt>>                                     06715000
      disable;                                                 <<01.02>>06720000
        assemble(cio 1);                                                06725000
        if <> then go ufail;                                            06730000
         qmiscp:=%100000;                                      <<01.02>>06735000
         tos:=1;                                               <<01.02>>06740000
         tos:=callcmplt;                                       <<01.02>>06745000
         go out;                                               <<01.02>>06750000
      end;                                                              06755000
      go to welldone;                                                   06760000
    end;    <<file close>>                                              06765000
    if func = devclose then                                             06770000
$page                                                                   06775000
<<  i n i t i a t o r    d e v i c e   c l o s e   >>                   06780000
    begin     <<device close>>                                          06785000
      tos:=lpdtd(ldev);                                                 06790000
      tos.eof:=0;  <<reset eof field in lpdt>>                          06795000
      lpdtd(x):=tos;                                                    06800000
      daccp:=%40000;   <<reset default control settings>>      <<00597>>06805000
      go to welldone;                                                   06810000
    end;    <<device close>>                                            06815000
    if func = control then                                              06820000
$page                                                                   06825000
<<  i n i t i a t o r    c o n t r o l               >>                 06830000
    begin     <<control>>                                               06835000
      tos:=%40000;   <<set up control options>>                         06840000
      tos.(4:1):=p1.(6:1);  <<inhibit feed option>>                     06845000
      tos.(2:1):=p1.(10:1);  <<stacker option>>                         06850000
      tos.(3:1):=p1.(11:1);  <<hopper option>>                          06855000
      tos:=tos.(0:5);                                                   06860000
      daccp.(0:5):=tos;                                                 06865000
      writeword := daccp;                                      <<00597>>06870000
      if p1.(7:2) > 0   <<no print or no punch?>>              <<00597>>06875000
        then p1.(9:1) := 0;   <<then no separate buffer>>      <<00597>>06880000
      daccp.(7:3):=p1.(7:3);  <<print/punch options>>                   06885000
      daccp.(14:1):=1; <<turn on control flag>>                         06890000
      go to welldone;                                                   06895000
    end;     <<control>>                                                06900000
    if func > 5 then                                                    06905000
$page                                                                   06910000
<<  i n i t i a t o r    i n v a l i d                >>                06915000
    begin                                                               06920000
      tos:=invalid;                                                     06925000
      tos:=endio;                                                       06930000
      go bend;                                                          06935000
welldone:                                                               06940000
      tos:=1;     <<ending stat ok>>                                    06945000
      tos:=endio;                                                       06950000
bend:                                                                   06955000
      tos:=drtn;     <<eir>>                                            06960000
      tos:=2;                                                           06965000
      assemble(cio 1; del);                                             06970000
      if <> then go ufail;                                              06975000
out:                                                                    06980000
      mstate:=tos;     <<set monitor state>>                            06985000
      status:=tos;     <<set status>>                                   06990000
fasout:                                                                 06995000
      enable;                                                  <<01.02>>07000000
      return;                                                           07005000
    end;     <<initiator>>                                              07010000
                                                                        07015000
                                                                        07020000
                                                                        07025000
$page                                                                   07030000
<<        c  o  m  p  l  e  t  o  r        >>                           07035000
                                                                        07040000
                                                                        07045000
completor:                                                              07050000
<< get here if monitor state = 3.  should only get here if >>           07055000
<< function code = read,write,file close,or open for       >>           07060000
<< write only.                                             >>           07065000
                                                                        07070000
   tos:=drtn;                                                           07075000
   if daccp.(15:1)=1 then                                      <<00219>>07080000
     begin                                                     <<00219>>07085000
        func := ioqp(qfunc);                                   <<00219>>07090000
        clbfullsub;                                            <<00219>>07095000
     end;                                                      <<00219>>07100000
   tos:=clear ;  <<clear interrupts>>                                   07105000
   assemble(cio 1);                                                     07110000
   if <> then go ufail;                                                 07115000
   tos:=ditp(dstat);  <<get status>>                                    07120000
   << status now on tos>>                                               07125000
   tos:=tos&csr(2);     <<transfer error bit>>                          07130000
   if < then                                                            07135000
   begin     <<transfer error interrupt>>                               07140000
     tos:=xfererr;                                                      07145000
     tos:=endio;                                                        07150000
     go bend;                                                           07155000
   end;                                                                 07160000
   tos:=tos&csl(1);  <<watchdog timer bit>>                             07165000
   if < then go fail;     <<timed out>>                                 07170000
   tos:=tos&csl(9);  <<ready for command bit>>                          07175000
   if < then go cont;                                                   07180000
   tos:=tos&csl(4);  <<input buffer full bit>>                          07185000
   if < then go cont;                                                   07190000
   tos:=tos&csr(2);  <<bit 0 = not rdy bit>>                            07195000
   if < then                                                            07200000
   begin                                                                07205000
     masterclear(ditp);                                                 07210000
      if ioqp(qfunc).(8:8) = write  then go cont;              <<00288>>07215000
        <<handle in write completor if write>>                 <<00288>>07220000
     go notrdy;                                                         07225000
   end;                                                                 07230000
   go notrdy;                                                  <<01.02>>07235000
cont:                                                                   07240000
   assemble(del);     <<drtn on tos>>                                   07245000
   setflags;                                                            07250000
   if qmiscp=%20000 then                                                07255000
   begin                                                                07260000
     clbfullsub;                                                        07265000
bag2:                                                                   07270000
     qmiscp:=0;                                                         07275000
     mstate:=2;                                                         07280000
     go win;                                                            07285000
   end;                                                                 07290000
   if func = read then                                                  07295000
$page                                                                   07300000
<<  c o m p l e t o r  r e a d  >>                                      07305000
                                                                        07310000
   begin     <<read completion>>                                        07315000
     if qmiscp.(3:1)=1 then    <<see if op. cleared card>>     <<00597>>07320000
     begin  <<note - drtn is on tos>>                          <<00597>>07325000
       tos := %10;  <<enable device status>>                   <<00597>>07330000
       assemble(cio 1);                                        <<00597>>07335000
       if <> then go ufail;                                    <<00597>>07340000
       assemble(tio 0);   <<get device status>>                <<00597>>07345000
       if < then go ufail;                                     <<00597>>07350000
       if tos.(11:1) = 1 then   <<card in vws>>                <<00597>>07355000
       begin   <<device not cleared--wait again>>              <<00597>>07360000
         tos := 1;                                             <<00597>>07365000
         tos := callcmplt;  <<wait for irpt>>                  <<00597>>07370000
         go bend;                                              <<00597>>07375000
       end                                                     <<00597>>07380000
       else   <<operator cleared the bad card>>                <<00597>>07385000
       begin                                                   <<00597>>07390000
         qmiscp := 0;                                          <<00597>>07395000
         mstate := 2;                                          <<00597>>07400000
         go win;                                               <<00597>>07405000
       end;                                                    <<00597>>07410000
     end;                                                      <<00597>>07415000
     tos:=hcnt;                                                         07420000
     if mode=ascii then tos:=tos&lsl(1);                                07425000
     assemble(dup);                                                     07430000
     j:=tos;      <<#reads required>>                                   07435000
     m:=tos;      <<#request reads required>>                           07440000
     scratch:=false;                                                    07445000
     i:=-1;                                                             07450000
     k:=0;                                                              07455000
     if axbflg=1 then                                                   07460000
     begin     <<set for aux buffer>>                                   07465000
       tos:=0;     <<bank always 0>>                                    07470000
       tos:=@siop+%1000;                                                07475000
     end                                                                07480000
     else                                                               07485000
     begin     <<set for user buffer>>                                  07490000
       tos:=bank;                                                       07495000
       tos:=bufadr;                                                     07500000
     end;                                                               07505000
     << drtn on tos -2>>                                                07510000
     while (i:=i+1) < j do                                              07515000
     begin     <<read loop>>                                            07520000
       l := 1;        <<timeout counter>>                      <<00597>>07525000
       do             <<loop until rio allowed>>               <<00597>>07530000
       begin                                                   <<00597>>07535000
         assemble(tio 2);                                      <<00597>>07540000
         if < then go ufail;                                   <<00597>>07545000
         if (l:=l+1)=0 and i>0  then go fail;  <<timed out>>   <<00597>>07550000
       end                                                     <<00597>>07555000
       until tos.(5:1)=1   <<dfs set = rio allowed>>           <<00597>>07560000
           or l=0 and i=0;  <<time out on first col.>>         <<00597>>07565000
       assemble(rio 2);                                                 07570000
       if < then go ufail;                                              07575000
       if > then go notrdy;                                             07580000
       tos:=%2000;     <<idt>>                                          07585000
       if i+1=j then assemble(del)                                      07590000
       else assemble(cio 4);                                            07595000
       if <> then go ufail;                                             07600000
       tos:=clear;                                                      07605000
       assemble(cio 4);                                                 07610000
       if <> then go ufail;                                             07615000
       if i=0 then                                                      07620000
       begin    <<do this first time only>>                             07625000
         tos:=tos&csl(3);                                               07630000
         if < then                                                      07635000
         begin     <<read check>>                                       07640000
           i:=1;                                                        07645000
           if sechopp then i:=i+1;                                      07650000
           iomessage(1,217,%11000,ldev,i,,,,0);                <<0u.eb>>07655000
           qmiscp:=0;                                                   07660000
           clbfullsub;                                                  07665000
           qmiscp.(3:1) := 1;  <<wait for op. to clear card>>  <<00597>>07670000
           tos := 1;                                           <<00597>>07675000
           tos := callcmplt;  <<wait for interrupt>>           <<00597>>07680000
           go bend;                                            <<00597>>07685000
         end;     <<read check>>                                        07690000
         tos:=tos&csl(1);                                               07695000
         if < then if s0.(12:1)=0 then <<ibf=0,input check>>            07700000
         begin                                                          07705000
           tos:=drtn;                                                   07710000
           tos:=%1000;     <<sde>>                                      07715000
           assemble(cio 1;del);                                         07720000
           if <> then go ufail;                                         07725000
           go notrdy;                                                   07730000
         end;                                                           07735000
         tos:=tos&csr(4);                                               07740000
       end;     <<first time>>                                          07745000
arnd:                                                                   07750000
       tos:=tos land %7777;                                             07755000
       if i < 5 then                                                    07760000
       siop(i+48):=s0;  <<save for eofcheck (96colbin)>>                07765000
       if i<m then                                                      07770000
       begin   <<translate and cram into buffer>>                       07775000
         if mode = colbin then                                          07780000
         begin     <<column binary>>                                    07785000
           assemble(ssea);                                              07790000
           tos:=tos+1;     <<bump buffer indx>>                         07795000
           k:=k+1;                                                      07800000
         end                                                            07805000
         else                                                           07810000
         begin     <<ascii>>                                            07815000
           if fcnt=96 then                                              07820000
           begin                                                        07825000
             x:=tos;                                                    07830000
             tos:=a6(x);                                                07835000
             go to fc96;                                                07840000
           end;                                                         07845000
           assemble(test);                                              07850000
           if = then index:=tos                                         07855000
           else                                                         07860000
           begin                                                        07865000
             tos:=s0.(7:8)&lsl(7);  <<rows 1-8>>                        07870000
             tos.(8:1):=0;          <<test row 8>>                      07875000
             index:= if = then 0 else 8;                                07880000
             assemble (scan);                                           07885000
             if x < 8 then index:=index+x;                              07890000
             if tos <> 0 then                                           07895000
             begin    <<invalid hollerith>>                             07900000
              del;                                             <<01.03>>07905000
               index:=0;                                                07910000
               iomessage(1,218,%11100,ldev,i+1,if sechopp then <<0u.eb>>07915000
                  2 else 1,,,0);                               <<0u.eb>>07920000
               j:=0;  <<to get out of loop>>                            07925000
               scratch:=true;                                           07930000
               qmiscp:=0;                                               07935000
             end                                                        07940000
             else                                                       07945000
             begin                                                      07950000
               tos:=(tos cat s0(7:15:1))&lsr(8);                        07955000
               index:=tos&lsl(4) lor logical(index);                    07960000
             end;                                                       07965000
           end;                                                         07970000
           tos:=hollass(index);                                         07975000
fc96:                                                                   07980000
           if logical (i) then                                          07985000
           begin                                                        07990000
             tos.(0:8):=temp;                                           07995000
             assemble(ssea);                                            08000000
             tos:=tos+1;     <<bump buffer indx>>                       08005000
             k:=k+1;                                                    08010000
           end                                                          08015000
           else                                                         08020000
           begin                                                        08025000
             temp:=tos;  <<save first half>>                            08030000
           end;                                                         08035000
         end;     <<ascii>>                                             08040000
       end      <<translate>>                                           08045000
       else assemble(del);                                              08050000
     end;     <<read loop>>                                             08055000
     assemble(ddel; del);     <<clear out buffer pointers>>             08060000
     if scratch then                                                    08065000
     begin     <<invalid hollerith>>                                    08070000
       clbfullsub;                                                      08075000
       qmiscp.(3:1) := 1;     <<wait for op. to clear card>>   <<00597>>08080000
       tos := 1;                                               <<00597>>08085000
       tos := callcmplt;  <<wait for interrupt>>               <<00597>>08090000
       go bend;                                                <<00597>>08095000
     end;                                                               08100000
    clbfullsub;                                                         08105000
           if mode=colbin and fcnt=96 then                              08110000
           begin  <<check for 6 bit :eof:>>                             08115000
             if siop(48)=%12 and siop(49)=%65 and                       08120000
             siop(50)=%46 and siop(51)=%66 and siop(52)=%12             08125000
             then                                                       08130000
             begin  <<6 bit :eof: found>>                               08135000
               tos:=lpdtd(ldev);                                        08140000
               tos.eof:=1; <<set hardware eof>>                         08145000
               lpdtd(x):=tos;                                           08150000
             end;                                                       08155000
         end;  <<check for 6 bit :eof:>>                                08160000
         eofcheck(ioqp,if logical(axbflg) then abuf else ubuf,          08165000
         hcnt,if mode=ascii then 1 else -1);                            08170000
         if <> then                                                     08175000
         begin     <<eof found>>                                        08180000
           if < then if axbflg=0 then                                   08185000
           begin     <<on eof save data in aux buffer>>                 08190000
             tos:=abuf;                                                 08195000
             tos:=ubuf;                                                 08200000
             tos:=hcnt;                                                 08205000
             assemble(mabs);                                            08210000
             deof:=1;                                                   08215000
           end;                                                         08220000
           if axbflg=1 then deof:=1;                                    08225000
           mstate:=endio;                                               08230000
           return;                                                      08235000
         end                                                            08240000
         else                                                           08245000
         begin     <<eof not found>>                                    08250000
           if axbflg=1 then                                             08255000
           begin     <<move data from aux buffer to users>>             08260000
swpbuf:                                                                 08265000
             tos:=ubuf;                                                 08270000
             tos:=abuf;                                                 08275000
             tos:=ioqp(qwbcnt);                                         08280000
             if s0.(0:1)=1 then                                         08285000
             begin                                                      08290000
             tos:=-tos;  tos:=tos&asr(1); <<set to word cnt>>           08295000
             end;                                                       08300000
             if s0 > hcnt then s0:=hcnt;                                08305000
             assemble(mabs);                                            08310000
             axbflg:=0;                                                 08315000
           end;                                                         08320000
           deof:=0;     <<reset eof flag in dit>>                       08325000
         end;                                                           08330000
       go welldone;                                                     08335000
   end;      <<read completion>>                                        08340000
   if func = write then                                                 08345000
$page                                                                   08350000
<<  c o m p l e t o r  w r i t e  >>                                    08355000
                                                                        08360000
   begin     <<write completion>>                                       08365000
     if writeword.(4:1)=1 then go welldone;                             08370000
     <<if inhibit feed, no check for card at vws>>             <<00597>>08375000
     qmiscp:=0;                                                         08380000
     tos:=%10;                                                          08385000
     assemble(cio 1);     <<dse>>                                       08390000
     if <> then go ufail;                                               08395000
     assemble(tio 0);                                                   08400000
     if < then go ufail;                                                08405000
     if s0.(11:1)=0 then                                       <<00288>>08410000
     begin  <<no card in wait station should be>>                       08415000
         << first see if due to hopper empty>>                 <<00288>>08420000
         << if so, skip message...it will be caught >>         <<00288>>08425000
         << during write initiator for next card >>            <<00288>>08430000
                                                               <<00288>>08435000
         if tos.(12:1) = 1 and writeword.(3:1) = 1             <<00288>>08440000
          then go welldone;                                    <<00288>>08445000
         if writeword.(3:1) = 0  then  <<see if hopr 1 empty>> <<00288>>08450000
         begin                                                 <<00288>>08455000
            tos := drtn;                                       <<00288>>08460000
            assemble (rio 0);                                  <<00288>>08465000
            assemble (delb);     <<delete drtn>>               <<00288>>08470000
            if <  then  go ufail;                              <<00288>>08475000
            if s0.(0:1) = 1  then go fail;                     <<00288>>08480000
            if tos.(6:1) = 1  then go welldone;                <<00288>>08485000
         end;                                                  <<00288>>08490000
       iomessage(1,11,%10000,ldev,,,,,0);                      <<0u.eb>>08495000
         qmiscp:=%40000;                                       <<01.02>>08500000
       tos:=2;                                                          08505000
         disable;                                              <<01.02>>08510000
       assemble (cio 1);     <<eir>>                                    08515000
       if <> then go ufail;                                             08520000
       tos:=0;                                                          08525000
       tos:=wnew;                                                       08530000
       go bend;                                                         08535000
     end                                                                08540000
     else                                                               08545000
     begin                                                              08550000
         del;      <<delete status word>>                      <<00288>>08555000
clearb:                                                                 08560000
       clbfullsub;                                                      08565000
                                                                        08570000
       go welldone;                                                     08575000
     end;                                                               08580000
   end;      <<write completion>>                                       08585000
   if func = close then go welldone;                                    08590000
$page                                                                   08595000
   if func=open then                                                    08600000
   begin                                                                08605000
     if p2.(13:3)=1 then go clearb;                                     08610000
   end;                                                                 08615000
$page                                                                   08620000
<<  c o m p l e t o r  i n v a l i d  >>                                08625000
                                                                        08630000
<< if you get here function is invalid.should not happen>>              08635000
   tos:=invalid;                                                        08640000
   tos:=endio;                                                          08645000
   go bend;                                                             08650000
                                                                        08655000
help;   <<***provide linkage for help debugger***>>            <<00597>>08660000
                                                               <<00597>>08665000
end;     <<prpchdvr>>                                                   08670000
<< d r i v e r  l i n k a g e  a r e a >>                               08675000
                                                                        08680000
assemble(                                                               08685000
         pcal siodm;          <<monitor>>                               08690000
         pcal prpchdvr;       <<initiator>>                             08695000
         pcal prpchdvr;       <<completor>>                             08700000
         con 0;               <<no i/o process>>                        08705000
         pcal initz;          <<initialization>>                        08710000
         con 1;               <<1 interrupt handler>>                   08715000
         pcal gip);           <<interrupt handler>>                     08720000
end.                                                           <<02698>>08725000
