1 * ***********************************************************
   2 * *                                                         *
   3 * * Copyright, (C) Honeywell Information Systems Inc., 1982 *
   4 * *                                                         *
   5 * * Copyright (c) 1972 by Massachusetts Institute of        *
   6 * * Technology and Honeywell Information Systems, Inc.      *
   7 * *                                                         *
   8 * ***********************************************************
   9 
  10 
  11           lbl       ,control_tables
  12           editp     on
  13           pmc       off
  14           pcc       off
  15           detail    off
  16 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  17 *
  18 *
  19 *         control_tables, ctrl
  20 *
  21 *              The control_tables are the primary driving program
  22 *         for the 355. They are interpreted by the control table
  23 *         interpreter, who performs various functions on behalf
  24 *         of the tables and calls the lsla, hsla, and dia interface
  25 *         routines when required.
  26 *
  27 *              This module contains the control tables for general-purpose
  28 *         low-speed lines and vanilla synchronous lines. It also contains
  29 *         all cct's, device tables, etc. Other modules contain
  30 *         special-purpose control tables for such things as g115, ards,
  31 *         tn1200 on 202c modem, and anything else which might come up.
  32 *
  33 *              The tables specify what actions are to be peformed for
  34 *         each line on the 355 and in what sequence these are to be
  35 *         done. This includes control of the datasets, printer/keyboard
  36 *         addressing for terminals which require it, and the initiation
  37 *         of i/o to the terminals. The tables are entered (or "started")
  38 *         for each line at the label "begin" by the init routine. After
  39 *         that the path through the tables is controlled by external
  40 *         events and the actions taken by these tables.
  41 *
  42 *         Originally coded 6/14/74 by Mike Grady
  43 *         Modified by Bob Adsit 7/20/75 to handle 115's
  44 *         Modified by Robert Coren 7/31/75 to handle tn1200 on 202c
  45 *         Modified by Robert Coren 4/29/76 to split up into several modules
  46 *         Modified by C. Hornig October 1980 to not send DLE EOT on hangup
  47 *         Modified by T. Oke to allow hardware flow control using CTS
  48 *         Modified by T. Oke to merge rapid breaks (less than .25 seconds)
  49 *           and avoid buffer overruns -- TR8447
  50 *         Modified by D. W. Cousins on Nov 22 1985 to abort the hungup
  51 *           500 ms timer for X.25 in order to process the activation order
  52 *           in time, else the wait loop will lose it. (TR PHX19612)
  53 *
  54 *
  55 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  56 
  57 * HISTORY COMMENTS:
  58 *  1) change(86-02-03,Kissel), approve(86-02-03,MCR7324):
  59 *     Modified to abort the hangup 500 ms timer for X.25 in order to process
  60 *     the activation order in time.  Otherwise, the wait loop would lose it
  61 *     (TR phx19612).
  62 *                                                      END HISTORY COMMENTS
  63 
  64           ttl       control_tables
  65           rem
  66           rem
  67 ctrl      null                /* setup primary symdef */
  68           rem
  69           symdef    ctrl
  70           rem
  71           symdef    begin
  72           symdef    hungup
  73           symdef    tdhung
  74           symdef    signal
  75           symdef    error
  76           symdef    cct.2
  77           symdef    stpchn
  78           symdef    diftyp    autobaud returns here for 1050 or 2741
  79           symdef    cct.3     syncronous etx cct
  80           symdef    cct.br
  81           symdef    chkaut    acu_tables come back to here
  82           symdef    maskr     restart point after masking channel
  83           rem
  84           symref    acutst
  85           symref    astart
  86           symref    ahang
  87           symref    tstart
  88           symref    ant202
  89           symref    gstar
  90           symref    bscstr
  91           symref    vstart
  92           symref    autost
  93           symref    a1star
  94           symref    a2star
  95           symref    a3star
  96           symref    s1star
  97           symref    s2star
  98           symref    s3star
  99           symref    pvstar
 100           symref    x25str
 101           symref    hdlstr
 102           symref    colts
 103           rem
 104           ind       begin1    /* 0, starting location of control tables */
 105           ind       devtbl    /* 1, ptr to array of device info tbls */
 106           dec       -1        /* 2, used to be ptr to cct array */
 107           ind       devtyp    /* 3, ptr to device type - speed table */
 108           ind       wru       /* 4, ptr to answerback reading code */
 109           bss       1         /* 5, reserve for delay tbl ptr*/
 110           ind       brk       /* 6, ptr to send line break code*/
 111           rem
 112           rem
 113           start     ctrl
 114           rem
 115           rem
 116           ttls      macro definitions
 117           eject
 118 * * * * * * * * * * * * * * * * * * * * *
 119 *
 120 *         devtyp macro
 121 *
 122 * * * * * * * * * * * * * * * * * * * * *
 123           rem
 124 devtyp    macro
 125           vfd       1/#1,4/0,o4/#2,o9/#3
 126           endm      devtyp
 127           rem
 128 * * * * * * * * * * * * * * * * * * * * *
 129 *
 130 *         devtbl macro
 131 *
 132 * * * * * * * * * * * * * * * * * * * * *
 133           rem
 134 devtbl    macro
 135           tab2      #1        sequence chars
 136           zero      #2        cct table addr
 137           zero      #3        keyboard addressing string array
 138           zero      #4        printer      "         "     "
 139           vfd       o18/#5    addressing flag and others
 140           tab6      #6        carriage movement table
 141           pmc       save,off
 142 dk        set       0
 143           idrp      #7
 144           ife       dk,0,3
 145 dk        set       1
 146 dval      set       #7
 147           ife       1,2,4
 148 dk        set       0
 149           pmc       restore
 150           vfd       o9/dval,o9/#7       break list
 151           pmc       save,off
 152           idrp
 153           pmc       restore
 154           ife       dk,1,1
 155           vfd       o9/dval,o9/0
 156           endm      devtbl
 157           rem
 158 tab2      macro
 159           vfd       o9/#1,o9/#2
 160           endm      tab2
 161           rem
 162 tab4      macro
 163           vfd       o9/#1,o9/#2
 164           vfd       o9/#3,o9/#4
 165           endm      tab4
 166           rem
 167 tab6      macro
 168           vfd       o9/#1,o9/#2
 169           vfd       o9/#3,o9/#4
 170           vfd       o9/#5,o9/#6
 171           endm      tab6
 172           rem
 173 * * * * * * * * * * * * * * * * * * * * *
 174 *
 175 *         adstr macro
 176 *
 177 * * * * * * * * * * * * * * * * * * * * *
 178           rem
 179 adstr     macro
 180           pmc       save,off
 181 adcnt     set       0
 182 adk       set       0
 183           idrp      #1
 184           ife       adk,0,3
 185 adk       set       1
 186 adval     set       #1
 187           ife       1,2,4
 188 adk       set       0
 189           pmc       restore
 190           vfd       o9/adval,o9/#1
 191           pmc       save,off
 192 adcnt     set       adcnt+1
 193           idrp
 194 adcnt     set       adcnt+1
 195 adcnt     set       adcnt/2
 196 adcnt     set       madlen-adcnt
 197           pmc       restore
 198           ife       adk,1,1
 199           vfd       o9/adval,o9/0
 200           bss       adcnt
 201           endm      adstr
 202           rem
 203           pmc       save,on
 204           tib
 205           meters
 206           buffer
 207           csbits
 208           tconst
 209           pmc       restore
 210           rem
 211           rem
 212 inlshf    bool      155       /* ibm nl with uppercase bit */
 213           rem
 214           rem
 215           rem       scan control strings
 216           rem
 217           rem
 218 iscn1     chstr     (rescan,search,ibmnl)
 219 iscn2     chstr     (rescan,search,ibmeot)
 220 iscn3     chstr     (rescan,search,inlshf)
 221 iscn6     chstr     (rescan,search,eotshf)
 222           ttls      device info tables
 223 devtbl    zero      d.asci    table for ascii devices
 224           zero      d.1050    table for 1050's
 225           zero      d.2741    table for 2741's
 226           zero      d.ards    table for the ards
 227           zero      d.sync    table for sync devices
 228           zero      d.sync    table for g115's
 229           zero      d.sync    table for bsc
 230           zero      d.t202    table for t202
 231           zero      d.vip     table for vip
 232           zero      d.asci    table for async1
 233           zero      d.asci    table for async2
 234           zero      d.asci    table for async3
 235           zero      d.sync    table for sync1
 236           zero      d.sync    table for sync2
 237           zero      d.sync    table for sync3
 238           zero      d.sync    table for polled vip
 239           zero      d.sync    table for X.25 LAP
 240           rem
 241           rem
 242           rem
 243           rem
 244           rem       devtbl flags
 245           rem
 246 dtfctl    bool      1         default setting of tfctrl
 247 dtfsft    bool      4         default setting of tfsftr
 248           rem
 249           rem       break list types
 250           rem
 251 blt.s     bool      1         break on one char
 252 blt.d     bool      2         break on two chars
 253 blt.t     bool      3         break on three chars
 254 blt.p1    bool      775       break on char plus one
 255           rem
 256           rem
 257 d.asci    devtbl    (0,0),0,k.asci,p.asci,0,
 258           etc       (nl,cr,tab,bs,nochar,nochar),(blt.t,ff,nl,etx)
 259           rem
 260 d.1050    devtbl    (0,0),0,k.1050,p.1050,dtfctl+dtfsft,
 261           etc       (ibmnl,nochar,ibmtab,ibmbs,ibmup,ibmdwn),
 262           etc       (blt.d,ibmnl,ibmeot)
 263           rem
 264 d.2741    devtbl    (0,0),0,k.2741,p.2741,dtfctl+dtfsft,
 265           etc       (ibmnl,nochar,ibmtab,ibmbs,ibmup,ibmdwn),
 266           etc       (blt.d,ibmnl,ibmeot)
 267           rem
 268 d.ards    devtbl    (0,0),0,0,0,0,(nl,cr,tab,bs,nochar,nochar),
 269           etc       (blt.d,ff,nl)
 270           rem
 271 d.sync    devtbl    (101,102),0,0,0,0,
 272           etc       (nochar,nochar,nochar,nochar,nochar,nochar),
 273           etc       (blt.p1,etx)
 274           rem
 275 d.t202    devtbl    (0,0),0,0,0,0,(nl,cr,tab,bs,nochar,nochar),
 276           etc       (blt.t,etx,ack,nak)
 277           rem
 278 d.vip     devtbl    (0,0),0,0,0,0,
 279           etc       (nochar,nochar,nochar,nochar,nochar,nochar),
 280           etc       (blt.p1,etx)
 281           rem
 282           rem
 283 madlen    equ       4         max addressing string length
 284           rem
 285 k.asci    adstr     (1,ack)
 286           rem
 287 p.asci    adstr     (1,nak)
 288           rem
 289 k.1050    adstr     (4,ibmdwn,ibmeot,ibmsl,ibm0)
 290           rem
 291 p.1050    adstr     (2,ibmsl,ibm9)
 292           rem
 293 k.2741    adstr     (2,ibmdwn,ibmeot)
 294           rem
 295 p.2741    adstr     (1,eoa)
 296           ttls      devtyp tables - device type/speed correspondence
 297           rem
 298           rem       Note: 2400 and 1800 synchronous are out of order for
 299           rem       compatibility with previous version that did not have
 300           rem       1200 and 1800
 301           rem
 302           rem       code      async speed         sync speed
 303           rem       ----      ----- -----         ---- -----
 304           rem
 305           rem       01         75                  1200
 306           rem       02         110                 2400
 307           rem       03         134.5               1800
 308           rem       04         150                 4800
 309           rem       05         300                 5400
 310           rem       06         600                 7200
 311           rem       07         1050                9600
 312           rem       10         1200               19200
 313           rem       11         1800               40800
 314           rem       12         option             50000
 315           rem       13         ----               72000
 316           rem
 317 async     equ       1
 318 sync      equ       0
 319           rem
 320 devtyp    devtyp    async,02,ttasci     110 baud, ascii type
 321           devtyp    async,03,tt2741     133 baud, 2741/1050
 322           devtyp    async,04,ttasci     150 baud, ascii type
 323           devtyp    async,05,ttasci     300 baud, ascii type
 324           devtyp    async,06,ttasci     600 baud, ascii type
 325           devtyp    async,10,ttasci     1200 baud, ascii type
 326           devtyp    async,11,ttasci     1800 baud, ascii type
 327           devtyp    async,12,ttasci     optn baud, ascii type
 328           devtyp    sync,01,ttsync      1200 baud, sync type
 329           devtyp    sync,03,ttsync      1800 baud, sync type
 330           devtyp    sync,02,ttsync      2400 baud, sync type
 331           devtyp    sync,04,ttsync      4800 baud, sync type
 332           devtyp    sync,06,ttsync      7200 baud, sync type
 333           devtyp    sync,07,ttsync      9600 baud, sync type
 334           devtyp    sync,10,ttsync      19200 baud, sync type
 335           devtyp    sync,11,ttsync      40800 baud, sync type
 336           devtyp    sync,12,ttsync      50000 baud, sync type
 337           devtyp    sync,13,ttsync      72000 baud, sync type
 338           dec       -1        end of table
 339           ttls      cct's - control character tables
 340           rem
 341           pmc       save,on
 342           cctdef
 343           pmc       restore
 344           rem
 345           rem
 346           base      64
 347           rem
 348           rem
 349 cct.2     null      * cct for ibm 2741 on hsla subchannel
 350           rem
 351           vfd       9/ct.ncs,9/ct.ncs * 000   001
 352           vfd       9/ct.ncs,9/ct.ncs * 002   003
 353           vfd       9/ct.ncs,9/ct.ncs * 004   005
 354           vfd       9/ct.ncs,9/ct.ncs * 006   007
 355           vfd       9/ct.ncs,9/ct.ncs * 010   011
 356           vfd       9/ct.ncs,9/ct.ncs * 012   013
 357           vfd       9/ct.ncs,9/ct.ncs * 014   015
 358           vfd       9/ct.ncs,9/ct.ncs * 016   017
 359           vfd       9/ct.ncs,9/ct.ncs * 020   021
 360           vfd       9/ct.ncs,9/ct.ncs * 022   023
 361           vfd       9/ct.ncs,9/ct.ncs * 024   025
 362           vfd       9/ct.ncs,9/ct.ncs * 026   027
 363           vfd       9/ct.ncs,9/ct.ncs * 030   031
 364           vfd       9/ct.ncs,9/ct.ncs * 032   033
 365           vfd       9/ct.ncs,9/ct.ncs * 034   035
 366           vfd       9/ct.ncs,9/ct.ncs * 036   037
 367           vfd       9/ct.ncs,9/ct.ncs * 040   041
 368           vfd       9/ct.ncs,9/ct.ncs * 042   043
 369           vfd       9/ct.ncs,9/ct.ncs * 044   045
 370           vfd       9/ct.ncs,9/ct.ncs * 046   047
 371           vfd       9/ct.ncs,9/ct.ncs * 050   051
 372           vfd       9/ct.ncs,9/ct.ncs * 052   053
 373           vfd       9/ct.ncs,9/ct.mrk * 054   nl
 374           vfd       9/ct.ncs,9/ct.ncs * 056   057
 375           vfd       9/ct.ncs,9/ct.ncs * 060   061
 376           vfd       9/ct.ncs,9/ct.ncs * 062   063
 377           vfd       9/ct.ncs,9/ct.ncs * 064   065
 378           vfd       9/ct.ncs,9/ct.ncs * 066   067
 379           vfd       9/ct.ncs,9/ct.ncs * 070   071
 380           vfd       9/ct.ncs,9/ct.ncs * 072   073
 381           vfd       9/ct.mrk,9/ct.ncs * eot   075
 382           vfd       9/ct.ncs,9/ct.ncs * 076   077
 383           rem
 384           vfd       9/ct.ncs,9/ct.ncs * 100   101
 385           vfd       9/ct.ncs,9/ct.ncs * 102   103
 386           vfd       9/ct.ncs,9/ct.ncs * 104   105
 387           vfd       9/ct.ncs,9/ct.ncs * 106   107
 388           vfd       9/ct.ncs,9/ct.ncs * 110   111
 389           vfd       9/ct.ncs,9/ct.ncs * 112   113
 390           vfd       9/ct.ncs,9/ct.ncs * 114   115
 391           vfd       9/ct.ncs,9/ct.ncs * 116   117
 392           vfd       9/ct.ncs,9/ct.ncs * 120   121
 393           vfd       9/ct.ncs,9/ct.ncs * 122   123
 394           vfd       9/ct.ncs,9/ct.ncs * 124   125
 395           vfd       9/ct.ncs,9/ct.ncs * 126   127
 396           vfd       9/ct.ncs,9/ct.ncs * 130   131
 397           vfd       9/ct.ncs,9/ct.ncs * 132   133
 398           vfd       9/ct.ncs,9/ct.ncs * 134   135
 399           vfd       9/ct.ncs,9/ct.ncs * 136   137
 400           vfd       9/ct.ncs,9/ct.ncs * 140   141
 401           vfd       9/ct.ncs,9/ct.ncs * 142   143
 402           vfd       9/ct.ncs,9/ct.ncs * 144   145
 403           vfd       9/ct.ncs,9/ct.ncs * 146   147
 404           vfd       9/ct.ncs,9/ct.ncs * 150   151
 405           vfd       9/ct.ncs,9/ct.ncs * 152   153
 406           vfd       9/ct.ncs,9/ct.mrk * 154   nl
 407           vfd       9/ct.ncs,9/ct.ncs * 156   157
 408           vfd       9/ct.ncs,9/ct.ncs * 160   161
 409           vfd       9/ct.ncs,9/ct.ncs * 162   163
 410           vfd       9/ct.ncs,9/ct.ncs * 164   165
 411           vfd       9/ct.ncs,9/ct.ncs * 166   167
 412           vfd       9/ct.ncs,9/ct.ncs * 170   171
 413           vfd       9/ct.ncs,9/ct.ncs * 172   173
 414           vfd       9/ct.mrk,9/ct.ncs * eot   175
 415           vfd       9/ct.ncs,9/ct.ncs * 176   177
 416           rem
 417 cct.3     null      * cct for use with grts, terminate on etx + bcc
 418           rem
 419           vfd       9/ct.ncs,9/ct.ncs * 000   001
 420           vfd       9/ct.ncs,9/ct.grt * 002   etx
 421           vfd       9/ct.ncs,9/ct.ncs * 004   005
 422           vfd       9/ct.ncs,9/ct.ncs * 006   007
 423           vfd       9/ct.ncs,9/ct.ncs * 010   011
 424           vfd       9/ct.ncs,9/ct.ncs * 012   013
 425           vfd       9/ct.ncs,9/ct.ncs * 014   015
 426           vfd       9/ct.ncs,9/ct.ncs * 016   017
 427           vfd       9/ct.ncs,9/ct.ncs * 020   021
 428           vfd       9/ct.ncs,9/ct.ncs * 022   023
 429           vfd       9/ct.ncs,9/ct.ncs * 024   025
 430           vfd       9/ct.ign,9/ct.ncs * syn   027
 431           vfd       9/ct.ncs,9/ct.ncs * 030   031
 432           vfd       9/ct.ncs,9/ct.ncs * 032   033
 433           vfd       9/ct.ncs,9/ct.ncs * 034   035
 434           vfd       9/ct.ncs,9/ct.ncs * 036   037
 435           rem
 436           rem
 437           dup       1,48
 438           vfd       9/ct.ncs,9/ct.ncs
 439           rem
 440           rem
 441 *         cct that breaks on all characters
 442 *         used occosionally for 1050's and 2741's, and
 443 *         externally by autobaud tables
 444           rem
 445 cct.br    null
 446           dup       1,64
 447           vfd       9/ct.eol,9/ct.eol
 448           ttls      wait for dialup
 449 tdhung    null                /* defined symbol for "hungup" t&d channel */
 450 begin     tstglb    gbf6up,start        /* make sure 6180 is up before start */
 451 begin1    wait      0,0,begin /* wait for test state */
 452           rem
 453 start     tstflg    tfauto,isauto       /* make all autobaud lines start ascii */
 454           goto      start1
 455 isauto    setype    ttasci
 456           rem
 457 start1    tstflg    tfhang,hangak       /* check for extra hangup */
 458           gotype    (norm,norm,norm,astart,norm,gstar,bscstr,tstart,vstart,a1
 459           etc       star,a2star,a3star,s1star,s2star,s3star,pvstar,x25str,hdl
 460           etc       str,colts) /* start up */
 461           rem
 462 norm      tstflg    tfacu,acutst        /* check if auto call unit is to be started */
 463           tstflg    tflisn,listen       /* if told to listen do it */
 464 restrt    clrflg    tfhang
 465 maskr     wait      0,0,begin /* wait till told to start again */
 466           rem
 467 hangak    signal    hangup    /* acknowledge hangup orders, since */
 468           goto      restrt    /* host may depend on interrupt */
 469           rem
 470 hungup    stpchn              /* hungup, stop and start over */
 471           contrl    rdtr      /* reset data term ready */
 472           setcct    scc.dl    /* get rid of any cct */
 473           setime    -500      /* make sure we leave dtr down for at least */
 474           wait      begin,0,hgtest      /* half a second */
 475           rem
 476 hgtest    tstglb    gbf6up,h1test       /* fnp must be up, else false start */
 477           waitm               /* no go - return to wait loop */
 478           rem
 479 h1test    iftype    ttx25l,x25str       /* x25 only aborts hangup timer */
 480           waitm               /* all others must wait */
 481           rem
 482 listen    clrflg    tfhang    /* so as not to be caught later by an old hangup */
 483           contrl    sdtr+srts+stat      /* set dtr and wait for status */
 484           setime    0         /* turn off the timer */
 485           rem
 486           wait      0,0,tstlsn          /* and wait here */
 487           status    ring,cd+cts+dsr,waitcd /* ring, wait for cd */
 488           status    cd+cts+dsr,0,dialed /* all on, dialup */
 489           rem
 490 waitcd    setime    20        /* wait 20 secs for cd */
 491           rem
 492           wait      nocd,0,tstlsn       /* if timeout, hangup on him */
 493           status    cd+cts+dsr,0,dialed
 494           rem
 495 nocd      contrl    rdtr      /* nothing, hangup on him now */
 496           setime    5         /* wait 5 secs for this to happen */
 497           wait      hungup,0,0          /* go to hungup when done */
 498           rem
 499 dialed    tstglb    gbf6up,godial       /* make sure we're supposed to accept calls */
 500           goto      hungup    /* we aren't */
 501 godial    gotype    (chkaut,diftyp,diftyp,error,dialsy)
 502           rem
 503 chkaut    setcct    scc.df    /* set default ascii cct */
 504           tstflg    tfauto,autost       /* do autobaud setting if needed */
 505           goto      signal
 506           rem
 507 tstlsn    tstglb    gbf6up,tsthng       /* see if multics stopped accepting calls */
 508           goto      hungup    /* it did */
 509           eject
 510 ************************************************************************
 511 *
 512 *         perform test to determine if 1050 or 2741 terminal
 513 *         the following code runs only on lsla's
 514 *
 515 ************************************************************************
 516           rem
 517 diftyp    ifhsla    difh01    /* special processing for hsla lines */
 518           dcwlst
 519           cmd       srec      /* enter receive mode for eoa */
 520           input     1,eoa     /* look for eoa from 2741 */
 521           cmd       smark     /* marker if recvd */
 522           rem
 523           setime    3         /* wait 3 seconds for eoa */
 524           rem
 525           wait      dt1050,0,0          /* timeout, is 1050 */
 526           status    marker,0,dt2741     /* yup, its a 2741 */
 527           rem
 528 dt1050    setype    tt1050    /* set to 1050 */
 529           rem
 530           dcwlst              /* make sure is really 1050 */
 531           cmd       sbrk      /* send line break */
 532           setime    1         /* give line break half a second to take */
 533           wait      dt105a,0,0
 534 dt105a    dcwlst
 535           cmd       rrec+sxmit          /* go into xmit mode */
 536           output    (ibmeot)  /* put 2741 into control-receive */
 537           cmd       srec+rxmit          /* go into recv */
 538           input     1,eoa     /* should respond with eoa */
 539           cmd       smark     /* send marker status */
 540           rem
 541           setime    3         /* wait 3 seconds for device */
 542           wait      signal,0,0          /* timeout, is really 1050 */
 543           status    marker,0,dt2741     /* got eoa, really 2741 */
 544           rem
 545 dt2741    setype    tt2741    /* set to 2741 */
 546           goto      signal
 547           rem
 548 ************************************************************************
 549 *
 550 *         perform test to determine if 1050 or 2741 terminal
 551 *         the following code runs only on hsla's
 552 *
 553 ************************************************************************
 554           rem
 555 difh01    setcct    cct.br    /* break on all characters */
 556           contrl    srec      /* set receive mode to wait for eoa */
 557           setime    3
 558           wait      difh02,0,0
 559           status    brkchr,0,difh03     /* got it, must be 2741 */
 560           rem
 561 difh02    setype    tt1050    /* no eoa, probably 1050 */
 562           dcwlst              /* but try 2741 test once more */
 563           cmd       sbrk
 564           setime    1         /* give line break time to take */
 565           wait      difh2a,0,0
 566 difh2a    dcwlst
 567           cmd       sxmit
 568           output    (ibmeot)
 569           cmd       rxmit
 570           setime    3
 571           wait      difh04,0,0          /* wait for eoa once more */
 572           rem
 573           status    brkchr,0,difh03     /* really 2741 */
 574           rem
 575 difh03    setype    tt2741
 576 difh04    setcct    cct.2     /* back to standard cct */
 577           goto      signal
 578           rem
 579 ************************************************************************
 580 *
 581 *         signal dialu to multics to say terminal is here
 582 *
 583 ************************************************************************
 584           rem
 585 dialsy    setcct    cct.3     /* cct for sync line */
 586           rem
 587 signal    dmpout              /* throw away any leftover output from 6180 */
 588           dumpin              /* likewise any input left on the line */
 589           signal    dialup    /* tell multics about this line */
 590           rem
 591           goto      getwrk    /* start looking for work */
 592           ttls      wru - read the answer back for a line
 593 ************************************************************************
 594 *
 595 *         perform wru processing to read answerback
 596 *         dia_man puts this address in t.cur to make us start here
 597 *
 598 ************************************************************************
 599           rem
 600 wru       wait      0,0,rdansb          /* test state here when answer back wanted */
 601           rem
 602 rdansb    scntr     0
 603           rem
 604 anslp     gotype    (rawru,ra1050,ra2741,error,error,error,error,ant202)
 605           rem
 606 ************************************************************************
 607 *
 608 *         ascii line
 609 *
 610 ************************************************************************
 611           rem
 612 rawru     stpchn              /* halt channel */
 613           dcwlst              /* dcw list to read answerback */
 614           cmd       sxmit     /* enter xmit mode */
 615           output    (awru)    /* send ascii wru char */
 616           cmd       rxmit+srec          /* go into receive mode */
 617           rem
 618           clrflg    tfkybd    /* clobbered keyboard */
 619           goto      answt     /* wait */
 620           rem
 621 ************************************************************************
 622 *
 623 *         1050 on lsla
 624 *
 625 ************************************************************************
 626           rem
 627 ra1050    stpchn              /* halt channel */
 628           ifhsla    rahs10    /* seperate code for hsla
 629           dcwlst              /* dcw list for 1050 answerback */
 630           cmd       sbrk      /* send line break */
 631           setime    1         /* give it time to happen */
 632           wait      ra105a,0,0
 633 ra105a    dcwlst
 634           cmd       sxmit+rrec
 635           output    (adprtr)
 636           cmd       rxmit+srec          /* enter rec for ans */
 637           rdtly     1         /* read only one char */
 638           cmd       sxmit+rrec          /* finish addressing */
 639           output    (eoa)
 640           cmd       rxmit+sterm
 641           rem
 642           clrflg    tfkybd    /* no more keyboard */
 643           setflg    tfprtr    /* printer on now */
 644           goto      answt     /* wait */
 645           rem
 646 ************************************************************************
 647 *
 648 *         1050 on hsla
 649 *
 650 ************************************************************************
 651           rem
 652 rahs10    setcct    cct.br    /* break on all chars */
 653           dcwlst
 654           cmd       sbrk
 655           setime    1         /* give it time to happen */
 656           wait      rahs1a,0,0
 657 rahs1a    dcwlst
 658           cmd       sxmit+srec
 659           output    (adprtr)
 660           cmd       rxmit
 661           setime    4
 662           wait      anstim,0,tsthng
 663           status    0,cts,hang2
 664           status    0,cd,hang2
 665           status    brkchr,0,rahs30     /* got reply */
 666           rem
 667 rahs30    dcwlst    sxmit+rrec
 668           output    (eoa)
 669           cmd       rxmit+sterm
 670           wait      anstim,0,tsthng
 671           status    0,cd,hang2
 672           status    0,cts,hang2
 673           status    term,0,rahs40
 674 rahs40    setflg    tfprtr
 675           clrflg    tfkybd
 676           setcct    cct.2
 677           goto      ansend
 678           rem
 679 ************************************************************************
 680 *
 681 *         2741 line
 682 *
 683 ************************************************************************
 684           rem
 685 ra2741    stpchn              /* halt channel */
 686           setcct    cct.2     /* should be this if hsla */
 687           dcwlst
 688           cmd       sbrk      /* line break */
 689           setime    1
 690           wait      ra274a,0,0
 691 ra274a    dcwlst
 692           cmd       sxmit+rrec
 693           output    (eoa,ibmprf,ibmpls,ibmeot)
 694           cmd       rxmit+srec
 695           rem
 696           clrflg    tfkybd
 697           goto      answt     /* wait */
 698           rem
 699 ************************************************************************
 700 *
 701 *         common answerback code
 702 *
 703 ************************************************************************
 704           rem
 705 answt     setime    4         /* wait four seconds for response */
 706           rem
 707           wait      anstim,0,0          /* retry on timeout */
 708           status    0,cts,hang2
 709           status    0,cd,hangb
 710           status    brkchr,0,ansend     /* got it */
 711           status    term,0,ansend       /* also */
 712           eject
 713 ansend    sendin              /* ship it */
 714           goto      getwrk    /* continue real stuff */
 715           rem
 716 anstim    acntr     1         /* bump counter */
 717           tcntr     3,ansnot  /* too much, punt */
 718           rem
 719           goto      anslp     /* loop for more */
 720           rem
 721 ansnot    signal    wrutim    /* tell as_ that there is no answer back */
 722           stpchn              /* throw away any funny input */
 723           dumpin
 724           iftype    tt1050,ansnt2       /* must reset cct on hsla 1050 */
 725           goto      getwrk
 726 ansnt2    setcct    cct.2
 727           goto      getwrk
 728           ttls      brk - send line break to the terminal
 729 ************************************************************************
 730 *
 731 *         send line break at users request
 732 *         dia_man puts this address in t.cur to make us start here
 733 *
 734 ************************************************************************
 735           rem
 736 brk       wait      0,0,brkst /*test state here when send break wanted*/
 737           rem
 738 brkst     scntr     0
 739           rem
 740           stpchn              /* kill user channel */
 741           dumpin              /* throw away input */
 742           setime    -100      /* wait for 100mils */
 743           contrl    sbrk
 744           wait      brkout,0,0
 745           status    0,cts,hang2
 746           status    0,cd,hangb
 747           status    break,0,brkout
 748 brkout    setcct    scc.bs    /* back to base cct, in case */
 749           clrflg    tffip     /* turn off frame in progress */
 750           tstflg    tfquit,writnl       /* print new-line if asked to */
 751           clrflg    (tfprtr,tfkybd)     /* nothing is addressed now */
 752           goto      getwrk    /* no newline, go read more */
 753           ttls      reading part of control tables
 754 ************************************************************************
 755 *
 756 *         start of real work of control_tables. if there is output
 757 *         to do, go do it, otherwise setup to read.
 758 *
 759 ************************************************************************
 760           rem
 761 getwrk    clrflg    (tfwabt,tfrabt)     /* clear in case we just did one */
 762           tstwrt    write     /* if any writing, do it */
 763           tstflg    tfhang,hanga        /* if we are to hangup, do it */
 764           tstflg    tfctrl,ckkybd       /* if control mode, check kybd */
 765           goto      read      /* go directly to it */
 766           rem
 767 ************************************************************************
 768 *
 769 *         starting input on a device that requires keyboard
 770 *         addressing. do it here.
 771 *
 772 ************************************************************************
 773           rem
 774 ckkybd    tstflg    tfkybd,read         /* if kybd addressed, read */
 775           clrflg    tfprtr    /* we are about to kill prtr */
 776           rem
 777           gotype    (kbasci,kb1050,kb2741,error,read)
 778           rem
 779 kbasci    dcwlst              /* dcwlst to address kybd */
 780           cmd       rrec+sxmit          /* set xmit mode */
 781           output    (adkybd)  /* send ack to tty37 */
 782           cmd       srec+rxmit+smark /* marker when done */
 783           rem
 784           goto      kybdwt    /* go to wait block */
 785           rem
 786 kb1050    null
 787 kb2741    ifhsla    kbhs01    /* special processing for hsla lines */
 788           dcwlst              /* same basic stuff 1050/2741 */
 789           cmd       sxmit+rrec          /* set xmit mode */
 790           output    (adkybd)  /* 1050 = lc, eot, /, 0 */
 791           rem                 /* 2741 = lc, eot */
 792           cmd       srec+rxmit          /* set recv to get eoa */
 793           input     1,eoa     /* read 1 look for eoa */
 794           cmd       smark     /* send marker */
 795           rem
 796           clrflg    tfupsf    /* we have sent low shift to device */
 797           goto      kybdwt    /* wait for marker */
 798           rem
 799 kbhs01    setcct    cct.br    /* break on all characters */
 800           dcwlst
 801           cmd       sxmit+srec
 802           output    (adkybd)
 803           cmd       rxmit
 804           setime    3
 805           wait      kbhs03,0,tsthng     /* wait for addressing to complete */
 806           status    0,cd,hang2
 807           status    break,0,kbhs04      /* user hit quit */
 808           status    brkchr,0,kbhs02     /* break char, kybd addressed */
 809           rem
 810 kbhs04    setcct    cct.2     /* back to standard cct */
 811           goto      otquit
 812 kbhs02    setcct    cct.2
 813           clrflg    tfupsf
 814           dumpin
 815           goto      kybdon
 816 kbhs03    setcct    cct.2
 817           goto      kybdto
 818           rem
 819 kybdwt    setime    3         /* wait 3 secs for keyboard */
 820           rem
 821           wait      kybdto,0,0          /* wait for kybd to be addressed */
 822           status    0,cd,hangb          /* no cd, maybe hangup */
 823           status    break,0,otquit      /* quit, tell 6180 */
 824           status    marker,0,kybdon     /* done addressing */
 825           rem
 826 kybdon    setflg    tfkybd    /* kybd on, set flag */
 827           tstwrt    write     /* if we are to write do it */
 828           goto      rwait     /* go to read wait */
 829           rem
 830 kybdto    contrl    rrec+rxmit+smark /* time out, stop and give up */
 831           wait      0,0,tstdmp
 832           status    0,cd,hangb
 833           status    marker,0,getwrk
 834           rem
 835 ************************************************************************
 836 *
 837 *         keyboard  addressing not required,  just set  rcv mode
 838 *
 839 ************************************************************************
 840           rem
 841 read      contrl    srec+rxmit          /* setup regular read */
 842           rem
 843 ************************************************************************
 844 *
 845 *         in receive mode now, wait for something to happen
 846 *
 847 ************************************************************************
 848           rem
 849 rwait     setime    0         /* turn off the timer */
 850           rem
 851           wait      0,rabort,tstrbp /* wait here for something */
 852           status    0,cd,hangb
 853           status    parity,0,sndchk     /* watch for parity errors */
 854           status    break,0,inquit
 855           status    brkchr,0,ckdata     /* check for eot 2741 */
 856           status    exh,0,inexh         /* too much input */
 857           status    xte,0,inxte         /* input too fast */
 858           status    prexh,0,preshp
 859           rem
 860 ************************************************************************
 861 *
 862 *         got input data - break character status
 863 *
 864 ************************************************************************
 865           rem
 866 ckdata    tstflg    tfrabt,dmpin        /* are we supposed to throw it away? */
 867           gotype    (sndata,sndata,ck2741,error,sndata)
 868           rem
 869 preshp    meter2    m.prex,1
 870           sendin              /* just send data on pre-exaust */
 871           waitm
 872           rem
 873 ************************************************************************
 874 *
 875 *         input is from 2741. special processing required for eots
 876 *
 877 ************************************************************************
 878           rem
 879 ck2741    inscan    iscn1,ckupnl        /* see if it looks like uppercase nl */
 880           setflg    tfeotx    /* got the nl, eot is next */
 881           goto      sndata    /* ship the data now */
 882           rem
 883 ckupnl    inscan    iscn3,ckeot         /* not an nl, see if it's eot */
 884           setflg    tfeotx    /* eot would be appropriate now */
 885           goto      sndata    /* pretend uppercase NL is lowercase NL */
 886 
 887 ckeot     inscan    iscn2,upeot         /* might be shifted eot */
 888           goto      goteot    /* all right, we have eot */
 889 upeot     inscan    iscn6,sndata        /* non-standard break, just send input */
 890           rem
 891 goteot    tstflg    tfeotx,ckfin        /* got the eot, fix kybd */
 892           clrflg    tfkybd    /* however his keyboard is still unaddressed */
 893           goto      inquit    /* not expected, must be quit */
 894           rem
 895 ckfin     clrflg    tfeotx    /* got it, turn of expected flag */
 896           stpchn              /* stop the channel */
 897           dumpin              /* throw away the eot */
 898           goto      kb2741    /* unlock his keyboard */
 899           rem
 900 ************************************************************************
 901 *
 902 *         have real data to send to multics
 903 *
 904 ************************************************************************
 905           rem
 906 sndata    sendin              /* send data to 6180 */
 907           tstwrt    getwrk    /* make sure no write to be done */
 908           goto      rwait     /* wait for more input */
 909           rem
 910 ************************************************************************
 911 *
 912 *         parity error. this is ignored except for sync line type
 913 *
 914 ************************************************************************
 915           rem
 916 sndchk    meter1    m.par,1
 917           iftype    ttsync,sndstp       /* if line sync type, stop channel */
 918           goto      sndata    /* else send data in to multics */
 919           rem
 920 sndstp    stpchn              /* stop reciever (resync) */
 921           sendin              /* ship stuff anyway */
 922           goto      getwrk    /* look for other processing */
 923           rem
 924 ************************************************************************
 925 *
 926 *         come here when too much input, or input too fast
 927 *
 928 ************************************************************************
 929           rem
 930 inxte     meter1    m.xte,1
 931           goto      holdup
 932           rem
 933 inexh     meter2    m.exh,1
 934 holdup    stpchn              /* kill users channel */
 935           sendin              /* ship off any input */
 936           meter1    m.quit,1  /* count 'bell-quits' */
 937           gotype    (holdac,holdwt,holdwt,error,holdwt)
 938 holdac    scntr     0         /* zero a bell counter */
 939 holdbl    dcwlst              /* warn  user of problems  with  bells */
 940           cmd       sxmit
 941           output    (bel)
 942           cmd       rxmit+sterm
 943           wait      0,0,tstrbt          /* wait for  bells to finish */
 944           status    0,cd,hangb
 945           status    break,0,otquit
 946           status    term,0,holdlp
 947           rem
 948 holdlp    acntr     1         /* count bells */
 949           tcntr     3,holdwt  /* done */
 950           setime    -150      /* scientifically determined optimal bell delay */
 951           wait      holdbl,0,tstrbt
 952           status    0,cd,hangb
 953           status    break,0,inquit
 954           rem
 955 holdwt    setime    10        /* give user 10 seconds to quit */
 956           contrl    sbrk
 957           wait      inquit,0,tstrbt
 958           status    0,cd,hangb
 959           status    break,0,inquit
 960           ttls      utility functions
 961 rabort    null                /* come here when output arrives */
 962           ckinpt    getwrk    /* check for input, none goto getwrk */
 963           tstflg    tfplit,raplit       /* polite mode? */
 964           goto      getwrk    /* no, process normally */
 965           rem
 966 raplit    setime    30        /* partial input, wait for it to complete */
 967           wait      pltout,0,tsthng
 968           status    0,cd,hangb
 969           status    parity,0,sndchk     /* watch for parity errors */
 970           status    break,0,otquit
 971           status    brkchr,0,ckdata     /* check for eot 2741 */
 972           status    exh,0,inexh
 973           status    xte,0,inxte
 974           status    prexh,0,preshp
 975           rem
 976 pltout    null                /* we have waited long enough, process output */
 977           tstflg    tfrabt,tstecp       /* are we supposed to throw away accumulated input? */
 978           goto      getwrk    /* no, proceed */
 979           rem
 980 tstdmp    tstflg    tfwabt,dump         /* test for dump output */
 981           goto      tsthng    /* no, check for hangup */
 982           waitm
 983           rem
 984 tstrbp    tstflg    tfrabt,tstplt       /* dump input? */
 985           goto      tsthng    /* no, check for hangup */
 986           rem
 987 tstrbt    tstflg    tfrabt,tstecp       /* check for read abort */
 988 tsthng    tstflg    tfhang,hanga        /* hang it up */
 989 twaitm    waitm
 990           rem
 991 tstplt    ckinpt    getwrk    /* there isn't anything to throw away */
 992           tstflg    tfplit,twaitm       /* if being polite, dump it later */
 993 tstecp    tstflg    tfecpx,echoat       /* are we in echoplex? */
 994           goto      dmpin     /* no, just dump it */
 995           rem
 996 echoat    ckinpt    getwrk    /* no accumulated input, forget it */
 997           echo      atchar    /* put at sign in echo buffer */
 998           rem
 999 dmpin     stpchn              /* stop the channel */
1000           dumpin              /* throw away read chain */
1001           dmprpy              /* dump any accumulated replay */
1002           goto      getwrk
1003           rem
1004 dump      stpchn              /* stop channel */
1005           dmpout              /* dump the output */
1006           goto      getwrk
1007           rem
1008 inquit    stpchn              /* stop the input for now */
1009           setcct    scc.bs    /* back to base cct, in case */
1010           clrflg    tffip     /* turn off frame in progress */
1011           sendin              /* send any input to 6180 */
1012           signal    quit      /* tell 6180 */
1013 
1014 ***************************************************************************
1015 *
1016 *         Throw away rapid breaks to prevent over-run.
1017 *         Here we require a .25 second gap between observable breaks to
1018 *         prevent too many breaks and send_outputs caused by a terminal
1019 *         set at too low a line speed.
1020 *
1021 *         This is done by waiting .25 seconds before continuing break
1022 *         processing.  If another break occurs within this period, it is
1023 *         ignored and any stored up input is dumped, to prevent buffer
1024 *         over-commitment.
1025 *
1026 *         We will get out of it, either if mcs sends us stuff, or the line
1027 *         is hung up (cd drops).
1028 *
1029 ***************************************************************************
1030 
1031 iqthld    setime    -250      /* wait 1/4 second for break timeout
1032           wait      iqtcon,iqtcon,tsthng  /* timeout or mcs output - continue
1033 *                                            control order - obey hangup
1034           status    0,cd,hangb          /* carrier drop loses the line
1035           status    break,0,iqtbrk      /* continued break
1036 
1037 iqtbrk    dumpin                        /* lose the input accumulated input
1038           dmprpy                        /* dump accumulated replay
1039           goto iqthld                   /* continue break
1040 
1041 iqtcon    tstflg    tfquit,writnl       /* print new-line if asked to */
1042           clrflg    (tfprtr,tfkybd)     /* nothing is addressed now */
1043           goto      getwrk    /* no newline, go read more */
1044           rem
1045 otquit    stpchn              /* stop the input for now */
1046           setcct    scc.bs    /* back to base cct */
1047           clrflg    tffip     /* turn off frame in progress */
1048           sendin              /* ship any input */
1049           setfld    t.omct,0  /* treat like block acknowledgement */
1050           signal    quit      /* tell 6180 */
1051 
1052 *****************************************************************************
1053 *
1054 *         Same break processing as for input, for same reasons.
1055 *
1056 ****************************************************************************
1057 
1058 oqthld    setime    -250
1059           wait      oqtcon,oqtcon,tsthng
1060           status    0,cd,hangb
1061           status    break,0,oqtbrk
1062 
1063 oqtbrk    dumpin
1064           dmprpy
1065           goto      oqthld
1066 
1067 oqtcon    tstflg    tfquit,qdump        /* dump and print nl ? */
1068           clrflg    (tfprtr,tfkybd)     /* we'll have to re-address */
1069           goto      getwrk    /* go look for work to be done */
1070           rem
1071 qdump     dmpout              /* throw away the output chain */
1072 writnl    prepnl              /* setup new-line for output */
1073           scntr     -10       /* flag meaning printing new-line after quit */
1074           goto      write2
1075           rem
1076 error     punt      1         /* ards error */
1077           ttls      writing part of tables
1078 write     tstflg    tfpfnl,write3       /* see if in prefixnl mode */
1079           goto      write1    /* no, dont prepnl check */
1080 write3    ckinpt    write1    /* check to see if input snuck in */
1081           prepnl              /* it did, setup to write newline */
1082 write1    scntr     0         /* flag meaning not doing nl after quit */
1083 write2    tstflg    tfctrl,ckprtr       /* if we need to address ptr */
1084           goto      print     /* nope, go and print */
1085           rem
1086 ckprtr    tstflg    tfprtr,print        /* if we need to address ptr */
1087           clrflg    tfkybd    /* yes, clear kybd */
1088           rem
1089           gotype    (ptasci,pt1050,pt2741,error,print)
1090           rem
1091 ptasci    dcwlst              /* dcw list to address prtr */
1092           cmd       sxmit+rrec          /* go to xmit mode */
1093           output    (adprtr)  /* send prtr addr string, nak for 37 */
1094           cmd       smark     /* send marker when done */
1095           output    (outmsg)  /* send the data */
1096           cmd       sterm+rxmit         /* and terminate when finished */
1097           rem
1098           goto      prtrwt    /* go wait for addressing */
1099           rem
1100 pt1050    dcwlst              /* dcw list for 1050 adressing */
1101           cmd       sbrk      /* send a line break */
1102           setime    1         /* have to let it happen */
1103           wait      pt105a,0,0
1104 pt105a    dcwlst
1105           cmd       sxmit+rrec          /* go to transmit mode */
1106           output    (adprtr)  /* address 1050 prtr, with /9 */
1107           cmd       srec+rxmit          /* enter receive mode */
1108           input     1,null    /* read one char */
1109           cmd       sxmit+rrec          /* enter transmit mode again */
1110           output    (eoa)     /* send eoa char */
1111           cmd       smark     /* send marker status when done */
1112           output    (outmsg)  /* now, send the guys data */
1113           cmd       sterm+rxmit         /* and terminate when done */
1114           rem
1115           goto      prtrwt    /* wait for addressing to finish */
1116           rem
1117 pt2741    dcwlst              /* address 2741 printer */
1118           cmd       sbrk      /* send a line break */
1119           setime    1         /* give it time */
1120           wait      pt274a,0,0
1121 pt274a    dcwlst
1122           cmd       sxmit+rrec          /* enter transmit mode */
1123           output    (adprtr)  /* address printer now with eoa */
1124           cmd       smark     /* send marker when done addressing */
1125           output    (outmsg)  /* send the data */
1126           cmd       sterm+rxmit         /* send term when done outout */
1127           rem
1128           clrflg    tfeotx    /* clear eot expected flag */
1129           goto      prtrwt
1130           rem
1131 prtrwt    setime    5         /* wait 5 secs for addressing */
1132           rem
1133           wait      prtrto,0,tsthng     /* if timeout, punt */
1134           status    0,cd,hangb
1135           status    marker,0,prtron     /* printer is addressed now */
1136           status    break,0,otquit      /* quit? */
1137           rem
1138 prtrto    stpchn              /* timed out waiting for printer addressing */
1139           contrl    stat      /* make sure no hangup during stpchn */
1140           setime    -150
1141           wait      prttim,0,tstdmp
1142           status    0,cd,hangb
1143           rem
1144 prttim    tstflg    tfwabt,dump
1145           tstwrt    write1    /* real timeout, try again */
1146           goto      getwrk
1147           rem
1148 prtron    setflg    tfprtr    /* printer on now */
1149           tcntr     -10,wwait /* ignore write-abort on nl after quit */
1150           tstflg    tfwabt,dump         /* were we asked to punt */
1151           goto      wwait     /* no, wait for write to finish */
1152           rem
1153 print     tstflg    tffdpx,printf       /* full dpx, dont reset rec */
1154           tstflg    tfecpx,printf       /* likewise for echoplex */
1155           rem
1156           dcwlst              /* start output on device wo addressing */
1157           cmd       sxmit+rrec          /* enter xmit mode and reset rec */
1158           output    (outmsg)  /* put in the data */
1159           cmd       sterm+rxmit         /* and terminate */
1160           rem
1161           goto      wwait     /* wait for terminate */
1162           rem
1163 printf    tstflg    (tfblak,tfofc),chkeob /* check for block acknowledgement */
1164 sprint    dcwlst              /* full dpx write */
1165           cmd       sxmit+srec          /* enter xmit mode */
1166           output    (outmsg)
1167           cmd       sterm+rxmit         /* term when done */
1168           rem
1169 wwait     tstflg    tfrpon,wwait1       /* replay already started? */
1170           tstflg    tfrply,prplay       /* no, should we start one? */
1171           goto      wwait1    /* no, go wait */
1172           rem
1173 prplay    ckinpt    wwait1    /* check for any input */
1174           setflg    tfrpon    /* set replay in progress flag */
1175           gtinpt              /* scoop up current input */
1176           rem
1177 wwait1    setime    0         /* turn off the timer */
1178           rem
1179           wait      0,0,wtest /* wait for status or dump */
1180           status    0,cd,hangb
1181           status    brkchr,0,wsend      /* send data input during full dpx */
1182           status    exh,0,wexh          /* stop the receiver now */
1183           status    break,0,otquit      /* quit? */
1184           status    term,0,wterm        /* all done */
1185           rem
1186 wterm     tstflg    tfrabt,tstecp       /* see if there was a resetread */
1187           tstwrt    getwrk    /* if any to do, do it */
1188           tstflg    tfrpon,wdrply       /* replay ready, do it */
1189           tstflg    tfplit,wdplit       /* check polite write term */
1190           goto      getwrk    /* all ok */
1191           rem
1192 wdrply    tstrpy    wdrpdn    /* if no replay chain goto wdrpdn */
1193           setime    1         /* wait 1 second for all output */
1194           wait      wdrpto,write1,tstrbt
1195           status    0,cd,hangb
1196           status    brkchr,0,wsend      /* send data input during full dpx */
1197           status    exh,0,wexh          /* stop the receiver now */
1198           status    break,0,otquit      /* quit? */
1199           rem
1200 wdrpto    replay              /* make the saved input an output chain */
1201           goto      write1    /* put out those chars now */
1202           rem
1203 wdrpdn    clrflg    tfrpon    /* done now, clear flag */
1204           goto      getwrk    /* all done replaying */
1205           rem
1206 wdplit    ckinpt    getwrk    /* had we just been polite to him? */
1207           setime    1         /* yes, wait for more output */
1208           wait      wdplto,write1,tsthng
1209           status    0,cd,hangb
1210           status    brkchr,0,wsend      /* send data input during full dpx */
1211           status    exh,0,wexh          /* stop the receiver now */
1212           status    break,0,otquit      /* quit? */
1213           rem
1214 wdplto    goto      getwrk    /* ok, we have waited for all output */
1215           rem
1216 wsend     tstflg    tfrabt,wtstec       /* see if we were told to throw it away */
1217           sendin              /* no, ship the data */
1218           waitm               /* and wait some more */
1219           rem
1220 wtstec    tstflg    tfecpx,wdecho       /* echoplex? */
1221           goto      wdmpin    /* no, just dump it */
1222           rem
1223 wdecho    echo      atchar    /* put at sign in echo buffer */
1224 wdmpin    dumpin              /* throw away input */
1225           dmprpy              /* dump any accumulated replay */
1226           waitm               /* keep waiting */
1227           rem
1228 wexh      meter2    m.exh,1
1229           contrl    rrec      /* stop the input now */
1230           goto      wsend     /* ship it and wait more */
1231           rem
1232 wtest     tcntr     -10,wtestm          /* doning newline after quit */
1233           tstflg    tfwabt,dump         /* dump_output, do it */
1234 wtestm    clrflg    tfwabt
1235           waitm               /* but don't perform hangup till output finishes */
1236           rem
1237 chkeob    tstfld    t.omct,2,waitak     /* more than two blocks outstanding? */
1238           goto      sprint    /* proceed with output */
1239           rem
1240 waitak    contrl    srec      /* we have to be able to see ack char */
1241           wait      0,0,tstack          /* here to suspend output until ack */
1242           status    0,cd,hangb          /* likewise */
1243           status    brkchr,0,wsend      /* forward input anyway */
1244           status    exh,0,wexh          /* always handle exhaust */
1245           status    break,0,otquit      /* likewise quit */
1246           rem
1247 tstack    tstfld    t.omct,2,wtest      /* wasn't ack, look for other things */
1248           goto      sprint    /* was ack, resume output */
1249           ttls      check and perform hangups
1250           rem       come here when told to hangup line
1251           rem
1252 hanga     stpchn              /* stop the channel */
1253           tstwrt    write     /* make sure there is no output now */
1254           setime    1         /* wait to make sure there's no more output */
1255           rem
1256           wait      hanga1,getwrk,0     /* if timeout, time to hang up */
1257           status    0,cts,hang3         /* line is hung up anyway */
1258           status    0,cd,hang3          /* likewise */
1259           rem
1260 hanga1    gotype    (hang5,hang5,hang5,ahang,hang3)
1261           rem
1262           rem
1263           rem
1264           rem       come here when cts drops on a line
1265           rem
1266 hang2     gotype    (hang5,hang5,hang5,hang5,hang10)
1267           rem
1268 hang5     contrl    rxmit+rrec+rdtr+stat /* hangup and request status */
1269           rem
1270 hangwt    setime    5         /* wait 5 seconds for it to happen */
1271           rem
1272           wait      hang3,0,0 /* if timeout, give up on him */
1273           status    0,cts,hang3         /* still down, done */
1274           rem
1275 hang3     stpchn              /* stop channel again */
1276           dmpout              /* throw away output */
1277           signal    hangup    /* did it, tell 6180 */
1278           clrflg    (tflisn,tfhang)     /* clear the listen and hangup flags */
1279           goto      hungup
1280           rem
1281           rem
1282           rem
1283           rem       here when cd drops on a line
1284           rem
1285 hangb     setime    1         /* wait one sec for carrier */
1286           rem
1287           wait      hang4,0,0 /* if timeout, check somemore */
1288           status    0,cts,hang2         /* if cts has dropped now, hangup */
1289           rem
1290 hang4     contrl    rxmit+rrec+stat     /* get status of line */
1291           setime    5         /* wait 5 seconds */
1292           rem
1293           wait      hang4,0,0 /* if timeout, try to get status again */
1294           status    0,cts,hang2         /* cts down, hangup */
1295           status    0,cd,hang2          /* cd down still, giveup */
1296           status    cd+cts+dsr,0,hangqt /* back up, call it quit */
1297           rem
1298 hangqt    gotype    (hang6,hang6,hang6,hang6,hang11)
1299           rem
1300 hang6     sendin              /* send any input to 6180 */
1301           signal    quit      /* tell 6180 of quit */
1302           goto      dump      /* dump any output, what else can I do */
1303           rem
1304           rem       here when cd or cts drop on private sync lines
1305           rem
1306 hang10    contrl    rxmit+rrec+stat     /* get line status */
1307           setime    10        /* wait 10 seconds for return */
1308           rem
1309           wait      hang10,0,tsthng
1310           status    cd+cts+dsr,0,hang11
1311           rem
1312 hang11    goto      getwrk
1313           rem
1314           rem
1315           rem
1316 *         the following is a control table subroutine to stop a channel
1317 *         it is called by the stpchn macro from all control tables.
1318           rem
1319 stpchn    contrl    rrec+rxmit+smark
1320           setime    1         /* if it doesn't come through in a second */
1321           wait      stptmo,0,0          /* try again */
1322           status    marker,0,stpch2
1323 stpch2    retsub
1324           rem
1325 stptmo    addlcl    stptmc,1  /* timed out, keep count */
1326           goto      stpchn    /* try it again */
1327 stptmc    oct       0
1328           rem
1329           end