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           lbl     ,g115_tables
  11           ttl     g115_tables
  12           editp     on
  13           pmc       off
  14           pcc     off
  15 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  16 *
  17 *
  18 *      g115_tables, g115
  19 *
  20 *           control tables for running high-speed device obeying
  21 *      g115 protocol
  22 *
  23 *      split off from control_tables by robert coren 4/29/76
  24 *
  25 *
  26 *      tables redone by joe nicholls and art beatie may-nov 1978
  27 *              the same general concepts were used, but the implementatio
  28 *              may be different.
  29 *         a number of redundencies have been built in to maintain a known
  30 *                   state of things, such as reseting variable and dumpins.
  31 *
  32 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  33           rem
  34           rem
  35 g115      null
  36           rem
  37           symdef    g115
  38           symdef    gstar
  39           symdef    g15acu
  40           rem
  41           symref    begin
  42           symref    hungup
  43           symref    error
  44           symref    acutst
  45           symref    cvaddr
  46           symref    frebfh
  47           symref    setbpt
  48           symref    cvabs
  49           rem
  50           pmc       save,on
  51           comreg
  52           tib
  53           meters
  54           csbits
  55           tconst
  56           buffer
  57           cctdef
  58           pmc       restore
  59           rem
  60           base      64
  61 cct.3     null      * cct for use with grts, terminate on etx + bcc
  62           rem
  63           vfd 9/ct.ncs,9/ct.ncs * 000 001
  64           vfd 9/ct.ncs,9/ct.grt * 002 etx
  65           vfd 9/ct.ncs,9/ct.ncs * 004 005
  66           vfd 9/ct.ncs,9/ct.ncs * 006 007
  67           vfd 9/ct.ncs,9/ct.ncs * 010 011
  68           vfd 9/ct.ncs,9/ct.ncs * 012 013
  69           vfd 9/ct.ncs,9/ct.ncs * 014 015
  70           vfd 9/ct.ncs,9/ct.ncs * 016 017
  71           vfd 9/ct.ncs,9/ct.ncs * 020 021
  72           vfd 9/ct.ncs,9/ct.ncs * 022 023
  73           vfd 9/ct.ncs,9/ct.ncs * 024 025
  74           vfd 9/ct.ign,9/ct.grt * syn etb
  75           vfd 9/ct.ncs,9/ct.ncs * 030 031
  76           vfd 9/ct.ncs,9/ct.ncs * 032 033
  77           vfd 9/ct.ncs,9/ct.ncs * 034 035
  78           vfd 9/ct.ncs,9/ct.ncs * 036 037
  79           rem
  80           dup       1,48
  81           vfd       9/ct.ncs,9/ct.ncs
  82           start     g115,,w3gesm0a1000
  83           ttls      tib extension array definitions
  84           tibex     incnt,char          input char count
  85           tibex     fctype,char         function code type obtained
  86           tibex     optype,char         operation type of msg
  87           tibex     acknak,char         ack or nak char for msg
  88           tibex     seqcde,char         seq code to use in msg
  89           tibex     prevsc,char         previous seq code used
  90           tibex     xmtsc,char          xmited seq code
  91           tibex     modtyp,char         mode type we are in for gwrrd
  92           tibex     scrchr,char         storage for special control record char
  93           tibex     tibchr,char         place to stroe msg addr for comparision
  94           tibex     rtnlbl,word         label to return to for gotov
  95           tibex     ctlop,word          control word for line status new
  96           tibex     ctlop1,word         second control word for 36 bits
  97           tibex     ctlop2,word         some spare in tib
  98           tibex     ctlop3,word         make it even 4 words control
  99           tibex     msgchk,word         value of the check we did on the output message
 100           tibex     outchn,word         addr of last output buffer to check
 101           tibex     bsyinc,word         count for counting delay waits for 68/80
 102           tibex     dlytim,word         time to wait for response
 103           tibex     gflags,word         word of flags in tib extension
 104           rem
 105           rem
 106 trmchr    bool      000001    flag that remote is finished inputing
 107 xnak      bool      000002    internal to keep track of our naking
 108 rtntry    bool      000004    tried to allocate buffer before, so give up
 109 early     bool      000010    flag to say that we received our response before
 110 rmtcmp    bool      001000    for multics to multics init
 111           ttls      g115 - defined values
 112           rem                 /* defined modtyp test values */
 113 actinp    bool      1         active, input
 114 inact     bool      2         inactive
 115 actot1    bool      3         active, output 1
 116 actot2    bool      4         active, output 2
 117 actot3    bool      10        mixed i/o mode
 118 inact1    bool      7         scr ($*$dis) received
 119 inact2    bool      5         rfd received
 120 inact3    bool      6         inactive, responding to a $*$OUT record
 121 inact4    bool      11        inactive, inprocess of terminating
 122 inact5    bool      12        we have output the terminate message
 123           rem
 124           rem
 125           rem
 126           rem                 line status definitions for ctlop
 127 fspr      bool      1         spare line status
 128 fbld      bool      2         failure to build a message
 129 fxmit     bool      3         failure to xmit msg n time in a row
 130 fsoh      bool      4         failure to find soh chr in output msg
 131 fetx      bool      5         failure to find ext chr at end of output msg
 132 fmod      bool      6         bad mode in tib we will terminate and start over
 133 notimp    bool      7         line control order not implemented in these table
 134 otpend    bool      10        yes you have output pending
 135 discrd    bool      11        portion of pending output was deleted before sent
 136 lngmsg    bool      12        the assembled message was too long >324 character
 137           rem
 138           rem
 139           rem                 line control definitions for ctlop
 140           rem                 try to keep the same values as the bisinc tables
 141 lctrmt    bool      3         set for remote mode
 142 lcttwr    bool      5         see if output is pending
 143 lctrrt    bool      6         set for host mode (reset remote mode)
 144           rem
 145           rem
 146           rem
 147           rem
 148           rem                 /* defined fctype test values */
 149 srvmes    bool      1         service message
 150 scrmes    bool      2         special contrl record
 151 infmes    bool      3         information message
 152           rem
 153           rem
 154           rem
 155           rem                 /* defined operation code test values */
 156 opnorq    bool      0         no request
 157 optdat    bool      2         transmite data
 158 opwait    bool      4         wait tosend output
 159           rem
 160           rem
 161           rem
 162           rem                 /* defined instruction code test values */
 163 noinst    bool      0         no instruction
 164 select    bool      2         select
 165 termin    bool      3         terminate
 166 rdyfd     bool      4         ready for disconnect
 167 notrfd    bool      5         not ready for disconnect
 168 disc      bool      6         disconnect
 169           rem
 170           rem
 171           rem
 172           rem                 /* defined format codes */
 173 sm102     bool      102       upper case b
 174 sm103     bool      103       upper case c
 175 scr104    bool      104       upper case d
 176 scr105    bool      105       upper case e
 177 inf110    bool      110       upper case h
 178 inf111    bool      111       upper case i
 179 inf112    bool      112       upper case j
 180 inf113    bool      113       upper case k
 181 inf115    bool      115       upper case m
 182           rem
 183           rem
 184           rem                 /* defined scan masks */
 185 opmask    bool      7
 186 ackmsk    bool      70
 187           rem
 188           rem
 189           rem
 190           rem                 /* defined output chars */
 191 chr027    bool      027       end of transmission block etb
 192 chr036    bool      036       record separator
 193 chr040    bool      040       ascii blank and slew top
 194 chr044    bool      044       ascii dollar sign
 195 chr052    bool      052       ascii asterisk
 196 chr101    bool      101       one transmit seq code
 197 chr100    bool      100       address/identification code
 198 chr103    bool      103       terminate,ack
 199 chr102    bool      102       transmit data op,ack
 200 chr061    bool      061       scr - abort code
 201 chr010    bool      010       nak bit in operation code
 202 chr104    bool      104       ready for disconnect code
 203 chr105    bool      105       upper case e
 204 chr111    bool      111       upper case i
 205 chr112    bool      112       upper case j
 206 chr114    bool      114       upper case l and printer mc
 207 chr116    bool      116       upper case n and teleprinter mc
 208 chr117    bool      117       upper case o and printer mc
 209 chr123    bool      123       upper case s
 210 chr124    bool      124       upper case t
 211 chr125    bool      125       upper case u
 212 chr131    bool      131       upper case v
 213           eject
 214           rem                 gocase variable value and jump lists
 215 ginopt    chstr     (disc,rdyfd,select)
 216 ginout    adrlst    (gdis,grfd,gsel)
 217           rem
 218           rem
 219 redop     chstr     (disc,rdyfd,termin,notrfd,select)
 220 redopj    adrlst    (gdis,grfd,gterm)
 221 srjmp     adrlst    (gdis,grfd1,gterm1,wrecnk)
 222 opotjm    adrlst    (gdis,grfd1,outtrm,wrecnk,gterm1)
 223           rem
 224 etxcmp    chstr     (actot2,actot3)
 225 etxjmp    adrlst    (getmor,getmor)
 226 wrjmp     adrlst    (output,output)
 227 sohjmp    adrlst    (gterm,gterm)
 228           rem
 229 otptfc    chstr     (srvmes,scrmes)
 230 otptfj    adrlst    (otckop,otcksc)
 231 redjmp    adrlst    (redsrv,scrrcv)
 232           rem
 233 wextmd    chstr     (actinp,inact,inact1,actot1,actot2,actot3,inact3,inact4,i
 234           etc       nact2,inact5)
 235 wextjp    adrlst    (gredin,gidle,gdis,outsrv,output,output,gterm,gterm,gdis
 236           etc       ,endtrm)
 237 sctjmp    adrlst    (ginlop,gidle,gdis,gout,goodsc,goodsc,gterm1,endtr1,gdis,
 238           etc       endtr1)
 239           rem
 240 fccmp     chstr     (sm102,sm103,scr104,scr105,inf110,inf111,inf112,inf113,in
 241           etc       f115)
 242 fcjmp     adrlst    (fcsm,fcsm,fcscr,fcscr,fcinf,fcinf,fcinf,fcinf,fcinf)
 243           rem
 244 opck      chstr     (select,termin)
 245 opjmp     adrlst    (gckret,gckret)
 246           rem
 247           pmc       save,on
 248 scrcmp    chstr     (chr101,chr102,chr103,chr104,chr105,chr117)
 249 scrjmp    adrlst    (scra,scrqut,scrqut,scrd,scre,scro)
 250           rem
 251 norcmp    chstr     (inact1,inact2,inact3,inact4,inact5)
 252 norjmp    adrlst    (gdis,gdis,gterm1,endtr1,endtr1)
 253           rem
 254 trmcmp    chstr     (inact,inact5,inact4)
 255 trmjmp    adrlst    (gidle,endtrm)
 256 trmabt    adrlst    (gterm,endtr1,gterm1)
 257           rem
 258 msgcmp    chstr     (fsoh,fetx,lngmsg,discrd)
 259 msgjmp    adrlst    (ftfsoh,ftfetx,flong,gwrdrd)
 260           rem
 261 otptoc    chstr     (opnorq,optdat)
 262 otptoj    adrlst    (goodot,goodot)
 263           rem
 264 outopt    chstr     (noinst,disc,rdyfd)
 265 outopj    adrlst    (goutpt,gdis,grfd)
 266           rem
 267 msglcm    chstr     (actinp,actot3,inact3,inact4,inact5)
 268 msgljm    adrlst    (synbld,synbld,synbld,synbld,synbld)
 269           pmc       restore
 270           eject
 271           rem                 /* canned output messages */
 272 tdomsg    chstr     (soh,inf110,null,chr100,chr102,chr100,stx,etx,seteom)
 273 tnkmsg    chstr     (soh,inf110,null,chr100,chr112,chr100,stx,etx,null,seteom
 274           etc       )
 275 synmsg    chstr     (syn,syn,syn,syn)
 276 trmmsg    chstr     (soh,sm102,null,chr100,chr103,chr100,stx,etx,seteom)
 277 selmsg    chstr     (soh,sm102,null,chr100,chr102,chr100,stx,etx,seteom)
 278 rfdmsg    chstr     (soh,sm102,null,chr100,chr104,chr100,stx,etx,seteom)
 279 tdormt    chstr     (soh,sm102,null,chr100,chr100,chr100,stx,etx,seteom)
 280 tdack     chstr     (soh,inf110,null,chr100,chr100,chr100,stx,etx,seteom)
 281 wakmsg    chstr     (soh,inf110,null,chr100,chr104,chr100,stx,etx,seteom)
 282 dismsg    chstr     (soh,scr104,null,chr100,chr100,chr100,stx,chr116,chr104,c
 283           etc       hr111,chr123,chr036,etx,seteom)
 284 ndamsg    chstr     (soh,inf110,null,chr100,chr102,chr100,stx,chr116,chr116,c
 285           etc       hr117,chr040,chr104,chr101,chr124,chr101,chr036,etx,seteo
 286           etc       m)
 287 dlrout    chstr     (soh,scr104,null,chr100,chr100,chr100,stx,chr116,chr044,c
 288           etc       hr052,chr044,chr117,chr125,chr124,chr036,etx,seteom)
 289           rem
 290           rem
 291           rem
 292           rem                 /* outscn contrl lists */
 293 octrl1    chstr     (rescan,search,soh,ignore,ignore,replac,xmtsc)
 294 octrl2    chstr     (rescan,search,soh,ignore,strlrc,search,etx,ignore,outlrc
 295           etc       ,ignore,replac,null)
 296 octrl3    chstr     (rescan,search,soh,ignore,ignore,ignore,ignore,setbit,chr
 297           etc       010)
 298 octrl4    chstr     (rescan,search,soh,ignore,ignore,ignore,ignore,offbit,ack
 299           etc       msk)
 300 octrl5    chstr     (rescan,search,soh,ignore,strlrc,search,chr027,ignore,out
 301           etc       lrc,ignore,replac,null)
 302 octrl6    chstr     (rescan,search,soh,ignore,strlrc,search,eot,ignore,outlrc
 303           etc       ,ignore,replac,null)
 304           rem
 305           rem
 306           rem
 307           rem                 /* inscan contrl lists */
 308 adrscn    chstr     (rescan,search,soh,ignore,ignore,ignore,movchr,tibchr)
 309 fcscan    chstr     (movchr,fctype)
 310 ictrl1    chstr     (rescan,search,stx,ignore,ignore,match,chr061)
 311 ictrl2    chstr     (rescan,search,soh,ignore,strlrc,search,etx,ignore,cmplrc
 312           etc       ,replac,null)
 313 ictrl4    chstr     (ignore,movchr,seqcde,ignore,ignore,movmsk,optype,opmask,
 314           etc       movmsk,acknak,ackmsk)
 315 ictrl6    chstr     (search,stx,ignore,count,incnt,search,etx)
 316 ictrl7    chstr     (rescan,search,soh,ignore)
 317 ictrl9    chstr     (rescan,search,stx,ignore,count,incnt,search,chr027)
 318 icldlr    chstr     (rescan,search,stx,ignore,ignore,match,chr044,ignore,matc
 319           etc       h,chr052,ignore,match,chr044,ignore,movchr,scrchr,ignore)
 320 iclabt    chstr     (match,chr102,ignore,match,chr124)
 321 iclout    chstr     (match,chr125,ignore,match,chr124)
 322 icldis    chstr     (match,chr111,ignore,match,chr123)
 323 iclend    chstr     (match,chr116,ignore,match,chr104)
 324           ttl       new g115 tables
 325           ttls      g115 line initialization
 326 gstar     tstflg    tfacu,acutst        must dial phone first
 327           tstflg    tflisn,glisn        see if 68/80 told us to listen
 328           wait      0,0,begin if not wait for him to tell us
 329           rem
 330           rem
 331           rem
 332 glisn     contrl    sdtr+stat set our minimum leads needed
 333           wait      0,0,gntint          wait for 115 or hangup order
 334           rem                 we only need to see if modem is there,
 335           rem                 we dont care if the phone rings or not since
 336           rem                 dtr is set up before we look at the line
 337           status    dsr,0,gonlin        we have the terminal
 338 g15acu    nullop              return here after acu dials up
 339 gonlin    tstflg    tfdlup,setdpx       cluge to set duplex until cmf is updated
 340           setflg    tffdpx    force that we are full duplex if not dialup
 341           contrl    srts+stat full duplex
 342           wait      0,0,gntint          wait for cd and cts
 343           status    cd+cts,0,gtell      have full duplex line
 344 setdpx    clrflg    tffdpx    force that we are half duplex if dialup
 345 gtell     getext    ,errtib   get tib extension
 346           setcct    cct.3     get default cct
 347           clrlcf    gflags,trmchr+rmtcmp          make sure we start in known state
 348           setlcl    dlytim,8  set delay to assume host timing
 349           calsub    dmpall    and no output
 350           signal    dialup    finally tell moma we are here
 351           setchr    modtyp,inact        we are doing nothing yet
 352           setflg    tfmrcv    only need space for one msg
 353           goto      gidle     go do our thing
 354           rem
 355           rem
 356 errtib    goto      ghangn    cant do a thing without it
 357           rem                 at this time the only other thing is to punt
 358           rem                 but we dont want to take everybody with us
 359           ttls      g115 idle loop
 360 gidle     tstflg    tfhang,ghang        see if 68/80 told us to hangup
 361           setlcl    bsyinc,0  just incase we fell out while stalling
 362           tstlcf    gflags,trmchr,gottst if terminated, ok to output
 363 girec     setflg    tfcrcv    only looking for a select msg
 364           contrl    srec+rxmit          set to receive mode
 365           setime    5         give 115 5 seconds to talk
 366           wait      gidle,gidle,gtest wait to see what happend first
 367           status    brkchr,0,gin        got something from 115
 368           status    0,dsr,ghang         115 went home early
 369           status    parity,0,gipar      ignor bad data here
 370           status    exh,0,exhlim        we ate too much
 371           rem
 372 gottst    tstwrt    gout      got data to give out
 373           goto      girec     no so go check receive now
 374           rem
 375 gipar     meter1    m.par,1
 376           stpchn              whooo horse
 377           dumpin              and throw the garbage out
 378           goto      gidle
 379           ttls      g115 input from remote routine
 380 gin       contrl    rrec+smark          get out of rec mode
 381           wait      0,0,gtest
 382           status    marker,0,ginset
 383           status    exh,0,exhlim
 384           status    0,dsr,ghang
 385           rem
 386 ginset    calsub    gckin     see what we got
 387           cmpchr    fctype,srvmes,ginput did we get a select msg
 388 ginbad    dumpin              no so forget it
 389           goto      gidle
 390 ginput    gocase    optype,ginopt,ginout have something but what is it
 391           goto      ginbad    nothing that we want
 392           rem
 393 gsel      dumpin              throw out select msg
 394           setchr    prevsc,seqcde       save seq code we got
 395           goto      rednda    go ack select or do output
 396           rem
 397           rem
 398 
 399           rem                 return here after remote responds
 400           rem                 with next input
 401 gredin    gocase    fctype,otptfc,redjmp see what data was sent us
 402           cmpchr    incnt,null,rednda if no chars dont give it to anybody
 403 ginlop    calasm    ckibsy    see if dia has completed last input yet
 404           tstflg    tfhang,ghang        are we going home now?
 405           tstlcl    msgchk,1,gbusy if msgchk is one, dia has not finished
 406           tstlcl    bsyinc,0,shipit if 0 have msg to send in
 407           dumpin              else have not got new msg yet
 408           goto      rednda    and since channel was still in receive
 409           rem                 should dump and not send in possible noise
 410 shipit    meterm    0         record input message
 411           sendin              give it to 68/80
 412 rednda    setchr    modtyp,actinp       we are active input
 413           setlcl    bsyinc,0  we are not stalling now
 414           clrlcf    gflags,rtntry       say first try
 415           setlcl    rtnlbl,tdobld       where to come for second try
 416 tdobld    tstlcf    gflags,rmtcmp,rmttdo if we are remote ack with no request msg
 417           bldmsg    tdomsg,ftbld        build xmit data msg
 418           goto      gwrrd     go output the msg
 419           rem
 420 rmttdo    cmpchr    fctype,srvmes,rmtack if srv msg use srv msg no req as ack
 421           bldmsg    tdack,ftbld         else us info no req as ack
 422           goto      gwrrd
 423           rem
 424 rmtack    bldmsg    tdormt,ftbld bld no req msg
 425           goto      gwrrd
 426           rem
 427           rem
 428 gbusy     tstlcl    bsyinc,0,bsysnd is this the first stall wait
 429           goto      stalit    if not, just go stall
 430 bsysnd    meterm    0
 431           sendin              if so move pending input to safe place from dumpin
 432 stalit    meter2    m.cnt4,1  keep track of this
 433           tstlcf    gflags,rmtcmp,rmtbsy if rmt we wak instead
 434           tstwrt    gbusyo    does mother have output?
 435           tstlcl    bsyinc,12,bsyinp we waited 10 half seconds
 436           addlcl    bsyinc,1  incr busy counter
 437           setime    -500      give us a one half second to wait
 438           wait      ginlop,gbusyo,gtest wait and see what to do next
 439           status    0,dsr,ghang         left us cold did he?
 440           status    exh,0,exhlim        dont allow data forced down our throat
 441           rem
 442 gbusyo    cmpchr    modtyp,actot3,gwrrd if still outputing just go do it
 443           setchr    modtyp,actot3       output so say we are mixed io
 444           goto      gwrrd     go output
 445           rem
 446           rem
 447 bsyinp    setlcl    bsyinc,1  say we are still stalling
 448           setchr    modtyp,actinp       aviod confussion, this is an active input
 449           clrlcf    gflags,rtntry       say first try
 450           setlcl    rtnlbl,tnklbl       where to come for second try
 451 tnklbl    bldmsg    tnkmsg,ftbld        nak last input as a stall since a wait
 452           goto      gwrrd     msg is not defined to the remote
 453           rem
 454 redsrv    gocase    optype,redop,redopj see what optype we have
 455           dumpin              not of interest
 456           goto      rednda    go try again
 457           rem
 458 rmtbsy    setlcl    bsyinc,1  we are stalling but who cares if were rmt
 459           clrlcf    gflags,rtntry       say first try
 460           setlcl    rtnlbl,waklbl       where to come for second try
 461 waklbl    bldmsg    wakmsg,ftbld        send a wait msg
 462           goto      gwrrd
 463           ttls      output from main frame routine
 464 gout      stpchn              hold on boys our turn now
 465           dumpin              throw it to the dogs
 466           clrlcf    gflags,rtntry       first time
 467           setlcl    rtnlbl,selbld       where to come for second try
 468 selbld    bldmsg    selmsg,ftbld        try and get the line for us
 469           setchr    modtyp,actot1       say we want the line
 470           goto      gwrrd     ship it!
 471           rem
 472           rem
 473           rem                 come here after response to our select
 474 outsrv    cmpchr    fctype,srvmes,outopc if not service forget it unless multics to multics
 475           tstlcf    gflags,rmtcmp,cktdms if remote look for trans data msg
 476           goto      gout      if not, try select again
 477           rem
 478 cktdms    cmpchr    fctype,infmes,outinf check for xmit data msg
 479           goto      gout      else try select again
 480           rem
 481 outinf    dumpin              if xmit data, input not dmped previously
 482           cmpchr    optype,optdat,goutpt if xmit data, ok, if not bad
 483           rem
 484 outopc    gocase    optype,outopt,outopj see what type returned
 485           tstlcf    gflags,rmtcmp,outrmt see if we are remote
 486           goto      gout      try again if not
 487 outrmt    cmpchr    optype,select,gsel if so we must give in
 488           goto      gout      else not what we expected
 489           rem
 490 goutpt    meterm    1         count output message
 491           setchr    modtyp,actot2       we are outputing data
 492           goto      gwrrd
 493           rem
 494           rem
 495           rem                 return point for outputing data
 496           rem                 after we have the line from a select
 497 output    gocase    fctype,otptfc,otptfj see what function returned
 498           cmpchr    incnt,null,outnch were any chars returned
 499           dmpout              get rid of the msg we sent
 500           goto      ginlop    assume that this is multics to multics
 501           rem
 502 outnch    gocase    optype,otptoc,otptoj if a norequest or trans data, good
 503           goto      wrecnk    if not bad
 504           rem
 505           rem
 506 otcksc    dmpout              clear our output msg first
 507           goto      scrrcv    go process special control record
 508           rem
 509 otckop    gocase    optype,redop,opotjm if so resync logical line
 510           rem                 if terminate we want to send quit to 68/80
 511           goto      wrecnk    any other service msg is considered a nak
 512           rem
 513           rem
 514 goodot    dumpin              throw out 115 return msg
 515 goodsc    dmpout              dump the output msg we are thru with it
 516           tstwrt    morout    more 68/80 output?
 517           cmpchr    modtyp,actot3,ginlop if mixed io go back
 518           setimv    dlytim    give 7 secs to
 519           wait      otck68,gwrrd,gtest wait for output from 68/80
 520           status    0,dsr,ghang
 521           status    exh,0,exhlim        watch for runaway channel
 522 otck68    tstwrt    gwrrd     just made it for output, one last check
 523           tstlcf    gflags,rmtcmp,rmtout are we remote
 524           goto      gterm
 525 rmtout    clrlcf    gflags,rtntry
 526           setlcl    rtnlbl,mulout
 527 mulout    bldmsg    dlrout,ftbld        output the $*$out msg
 528           setchr    modtyp,inact4       equal to a terminate
 529           goto      gwrrd
 530           rem
 531 outtrm    tstlcf    gflags,rmtcmp,gterm1 if remote term means term
 532           goto      scrqut    else term means quit
 533           ttls      g115 routine to write and then read the response
 534 morout    meterm    1         meter next output message
 535 gwrrd     calasm    ckomsg    go check the msg to output
 536           gocase    msgchk,msgcmp,msgjmp see if msg was good or not
 537           rem                 if we fall through it was good
 538           goto      synlbl    and go and the syn chars
 539 gwrdrd    dmpout              dump the bad first part of the msg
 540 synlbl    clrlcf    gflags,rtntry       first time
 541           setlcl    rtnlbl,synbld       where to come for second time
 542           clrflg    tfcrcv    reset for idle may have set it again
 543           gocase    modtyp,msglcm,msgljm if inputing get bigger buffer
 544           setflg    tfcrcv    else only expect a control msg
 545 synbld    bldmsg    synmsg,ftbld        add 4 syn chars to front of msg
 546           cmpchr    modtyp,actinp,ckstal see if inputing
 547           goto      notstl    if not skip all this garbage
 548 ckstal    tstlcl    bsyinc,0,notstl     see if stalling
 549           holdot              save this for possible re-xmit
 550           goto      wckdpx    if so, send an erroneous msg so the level 6 will
 551           rem                 send the msg again with a nak and we with
 552           rem                 selectivly throw that msg away as a stall
 553           rem                 since the host does not have a defined wait
 554 notstl    scntr     0         init retry cntr to 0
 555           clrlcf    gflags,xnak         internal, first time always acking
 556           cmpchr    xmtsc,chr101,seqcd2 deside on which seq cd to use
 557           setchr    xmtsc,chr101        use #1
 558           goto      setsqc    go set the seq code
 559 seqcd2    setchr    xmtsc,chr102        have 1 so set it to #2
 560 setsqc    outscn    octrl1,ftfsoh       place seq code
 561           clrlcf    gflags,rtntry       first time
 562           setlcl    rtnlbl,setlrc       where to come for second time
 563 setlrc    outscn    octrl2,lrcetx       set lrc character
 564           holdot              save output for rexmit if neccessary
 565           goto      wckdpx    do the output
 566 lrcetx    outscn    octrl5,ftbld        no etx,try etb
 567           holdot              save this for xmit again latter
 568           goto      wckdpx    go do our thing
 569           rem
 570 lrceot    outscn    octrl6,ftbld        no etb, try eot, else give up
 571           holdot
 572           rem
 573           rem
 574 wckdpx    clrlcf    gflags,early        looking for new response
 575           tstflg    tffdpx,wfdpx        see which duplex to output with
 576           contrl    srts+stat half duplex
 577           setime    1         wait for 1 sec
 578           wait      ftxmit,0,gtest      for line to turn around
 579           status    0,dsr,ghang
 580           status    cts,0,wgotln        we got the line
 581           status    exh,0,exhlim        watch for runaway channel
 582           rem
 583 wgotln    dcwlst              set up the dcw list
 584           cmd       sxmit+srec          go into xmit mode and possible response
 585           output    (outmsg)  send data out
 586           cmd       sterm+rxmit         wait for msg to go out
 587           wait      0,0,gtest wait for status change
 588           status    0,dsr,ghang
 589           status    brkchr,0,elyrsp     fast wasn't he.
 590           status    exh,0,exhlim        watch for runaway channel
 591           status    0,cts,wrlost        lost line so try again
 592           status    term,0,wgood        output terminated properly
 593           rem
 594 wgood     contrl    rrts+stat ready ourselves for input
 595           tstlcf    gflags,early,lintrn already have our response
 596           setimv    dlytim    wait 7 secs
 597           wait      norsp,0,gtest       for a response
 598           status    0,dsr,ghang
 599           status    cd,0,lintrn         turned line properly
 600           status    exh,0,exhlim        watch for runaway channel
 601           rem
 602           rem
 603 wfdpx     dcwlst              bld dcw list for full dplx line
 604           cmd       sxmit+srec          ready for output and input for full dpx
 605           output    (outmsg)  go do it
 606           cmd       sterm+rxmit         ready for response
 607           wait      0,0,gtest wait for output tp finish
 608           status    0,dsr,ghang
 609           status    brkchr,0,elyrsp     fast son-of-a-gun
 610           status    exh,0,exhlim        watch for runaway channel
 611           status    term,0,lintrn       output finished properly
 612           rem
 613 elyrsp    setlcf    gflags,early        note that we have our response already
 614           waitm               go finish what we were doing
 615           rem
 616 lintrn    cmpchr    modtyp,inact4,trmchk if trminate msg, say we did it
 617           goto      rspwat    else just go wait for response
 618 trmchk    setchr    modtyp,inact5 say we sent it and dont do it again
 619 rspwat    tstlcf    gflags,early,wrecrp already have our response
 620           contrl    stat      see if anything interesting has happened
 621           setimv    dlytim    give us 7 secs
 622           wait      norsp,0,gtest       wait for a response
 623           status    0,dsr,ghang
 624           status    brkchr,0,wrecrp     got a response
 625           status    parity,0,gwrpar nak bad parity
 626           status    exh,0,exhlim        we ate too much go dmp it
 627           rem
 628 wrecrp    contrl    rrec+smark          get out of rec mode
 629           wait      0,0,gtest wait for rec to be reset
 630           status    marker,0,recrst     then continue
 631           status    exh,0,exhlim
 632           status    0,dsr,ghang
 633           rem
 634 recrst    calsub    gckin     see what we got
 635           cmpchr    fctype,null,wrnak error in response
 636           cmpchr    incnt,null,wcknak no data in response
 637           cmpchr    seqcde,prevsc,wckxnk same seq code
 638           goto      wsvsc     response ok save seq code
 639           rem
 640 wckxnk    tstlcf    gflags,xnak,wcknak see if we really already processed it
 641           dumpin              yes, (data msg with same seq code) dont need it
 642           setchr    incnt,null          keep things consistant
 643           rem
 644 wcknak    cmpchr    acknak,nak,wrecnk got a nak
 645           rem
 646 wsvsc     setchr    prevsc,seqcde       save the seq code
 647           cmpchr    fctype,srvmes,wsvmes service msg
 648           cmpchr    optype,opwait,wopwt need to wait 7 secs
 649 wrtok     gocase    modtyp,etxcmp,wrjmp output msg sent ok
 650           dmpout              we dont need it any more
 651           gocase    modtyp,wextmd,wextjp exit based on mode
 652           goto      badmod
 653           rem
 654           rem
 655 gwrpar    meter1    m.par,1
 656           stpchn              bad parity so throw it away
 657           dumpin
 658           goto      wrnak     and nak the msg
 659           rem
 660 wsvmes    gocase    modtyp,etxcmp,wrjmp if active output, let output decide what to do
 661           gocase    optype,redop,srjmp see if srv msg needs processing
 662           goto      wrtok     message received ok
 663           rem
 664 wopwt     dumpin              throw away the wait message
 665           meter2    m.cnt4,1
 666           outscn    octrl4,ftfsoh       set ack in byte
 667           setimv    dlytim    set time for 7 secs
 668           wait      wckdpx,0,gtest      re-xmit after 7 secs
 669           status    0,dsr,ghang
 670           status    exh,0,exhlim        watch for runaway channel
 671           rem
 672 wrecnk    dumpin              finished with input msg
 673           setchr    incnt,null          just to keep info consistant
 674           outscn    octrl4,ftfsoh       set ack in ic byte
 675           clrlcf    gflags,xnak         internal to say we are acking
 676           cmpchr    modtyp,actinp,ckbyin in inputing, check some more
 677           goto      wrlost    keep triing until he says ok
 678           rem
 679 ckbyin    tstlcl    bsyinc,0,wrlost     if not busy bad msg
 680           dmpout              cleanup the msg we forced out
 681           goto      ginlop    else things are backing up
 682           rem
 683 norsp     meter2    m.cnt3,1
 684           gocase    modtyp,norcmp,norjmp Level 6 may or may not answer our msg
 685           goto      wrlost    get back to idle state
 686           rem
 687           rem
 688 wrnak     outscn    octrl3,ftfsoh       set nak bit in ic byte
 689           setlcf    gflags,xnak         internal to say we are naking
 690 wrlost    meter2    m.cnt2,1
 691           acntr     1         bump retry counter
 692           tcntr     10,ftxmit too many xmition failures
 693           goto      wckdpx    go try again
 694           ttls      routine to test orders from main frame
 695 gtest     tstflg    tfhang,ghang        told to hangup
 696           tstflg    tfwabt,gpgwrt       write abort, purge output
 697           tstflg    tfrabt,gpginp       read abort,purge input
 698           linctl    ctlop,tstret        if no line control order just return
 699           tstlcl    ctlop,lcttwr,gtstot see if output pending for him
 700           tstlcl    ctlop,lctrmt,gtstrc are we to set remote mode
 701           tstlcl    ctlop,lctrrt,gtstrr are we ro reset remote mode
 702           setlcl    ctlop,notimp        else line control order not implemented
 703           setlcl    ctlop1,0  set second 18 bits
 704           setlcl    ctlop2,0  zero 3rd 18 bits
 705           setlcl    ctlop3,0  zero 4th 18 bits
 706           linsta    ctlop     go tell 68/80 we have no response
 707 tstret    waitm               not interested in anything else
 708           rem
 709           rem
 710 gntint    tstflg    tfhang,ghangn       hangup without tib ext
 711           waitm               dont care
 712           rem
 713           rem
 714 gpgwrt    stpchn              hold on for a second
 715           calsub    dmpall    purge all output
 716           clrflg    tfwabt    reset this flag
 717           tstflg    tfrabt,gpginp       see if read abort also is set
 718           gocase    modtyp,trmcmp,trmabt if teminating dont re-xmit
 719           goto      gterm     send terminate msg
 720           rem
 721           rem
 722 gpginp    stpchn              stop everything here also
 723           dumpin              purge all input
 724           clrflg    tfrabt    reset this flag
 725           gocase    modtyp,trmcmp,trmabt if terminating dont re-xmit
 726           goto      gterm
 727           rem
 728           rem
 729           rem
 730 gtstot    tstwrt    tstsot    if pending output tell 68/80, he asked us
 731           setlcl    ctlop,0   say we have no data
 732           goto      gtstrt    go return the info
 733 tstsot    setlcl    ctlop,otpend        say we have output pending
 734 gtstrt    setlcl    ctlop1,0  set second 18 bits
 735           setlcl    ctlop2,0  zero 3rd 18 bits
 736           setlcl    ctlop3,0  zero 4th 18 bits
 737           linsta    ctlop     go tell 68/80 his answer
 738           waitm               go back from where we came
 739           rem
 740 gtstrc    setlcf    gflags,rmtcmp+trmchr say to act as remote
 741           setlcl    dlytim,6  set timer as if we are remote
 742           waitm
 743           rem
 744 gtstrr    clrlcf    gflags,rmtcmp say to act as host
 745           setlcl    dlytim,8  set timer as if host
 746           waitm
 747           ttls      routines to give main frame a status indication
 748 ftbld     tstlcf    gflags,rtntry,bldfld see if we tried this before
 749           setime    1         if not wait 1 sec and try again
 750           wait      bldwt,0,gtest
 751           status    0,dsr,ghang         watch out
 752 bldwt     setlcf    gflags,rtntry       say we tried this once
 753           gotov     rtnlbl    go try again
 754 bldfld    meter2    m.cnt8,1
 755           setlcl    ctlop,fbld          failure to bld message for output
 756           setlcl    ctlop1,0  zero second 18 bits
 757           setlcl    ctlop2,0  zero 3rd 18 bits
 758           setlcl    ctlop3,0  zero 4th 18 bits
 759           linsta    ctlop     give this status to host
 760           goto      ghang     go hangup the line can do nothing
 761           rem
 762 ftxmit    meter2    m.cnt5,1
 763           setlcl    ctlop,fxmit         unable to send good output
 764           setlcl    ctlop1,0  zero second 18 bits
 765           setlcl    ctlop2,0  zero 3rd 18 bits
 766           setlcl    ctlop3,0  zero 4th 18 bits
 767           linsta    ctlop     give this status to host
 768           goto      gterm1    cleanup and idle
 769           rem
 770 ftfsoh    meter2    m.cnt6,1
 771           setlcl    ctlop,fsoh          failure to find soh on output msg
 772           setlcl    ctlop1,0  zero second 18 bits
 773           setlcl    ctlop2,0  zero 3rd 18 bits
 774           setlcl    ctlop3,0  zero 4th 18 bits
 775           linsta    ctlop     tell 68/80
 776           dmpout              get rid of bad msg
 777           gocase    modtyp,etxcmp,sohjmp if from 68/80 his problem
 778           goto      ghang     else our problem
 779           rem
 780 ftfetx    meter2    m.cnt6,1
 781           gocase    modtyp,etxcmp,etxjmp if output from mother it is her problem
 782           setlcl    ctlop,fetx          failure to find ext in canned output msg
 783           setlcl    ctlop1,0  0 second 18
 784           setlcl    ctlop2,0  zero 3rd 18 bits
 785           setlcl    ctlop3,0  zero 4th 18 bits
 786           linsta    ctlop     say we have a problem
 787           goto      ghang     so forget this whole bussiness
 788 getmor    signal    sndout    ask for more data please
 789           setimv    dlytim    give 68/80 7 seconds to come up with something
 790           wait      nomore,morout,gtest if not, dump and terminate
 791           status    0,dsr,ghang         watch out
 792           status    exh,0,exhlim        watch for runaway channel
 793 nomore    calasm    ckochn    one last chance to see if sliped in before wait
 794           tstlcl    outchn,0,gterm1 if 0 68/80 did not give more so dump it
 795           goto      gwrrd     else we got more so go try to output this
 796           rem
 797           rem
 798 badmod    setlcl    ctlop,fmod          say we have a bad mode in tib
 799           setlcl    ctlop1,0  zero second 18 bits
 800           setlcl    ctlop2,0  zero 3rd 18 bits
 801           setlcl    ctlop3,0  zero 4th 18 bits
 802           linsta    ctlop     tell host about our confussion
 803           calsub    dmpall    start with a clean slate
 804           dumpin              also dump the input
 805           goto      gterm
 806           rem
 807           rem
 808 flong     meter2    m.cnt7,1
 809           setlcl    ctlop,lngmsg        message was too long
 810           setlcl    ctlop1,0  zero 2nd 18 bits
 811           setlcl    ctlop2,0  zero 3rd 18 bits
 812           setlcl    ctlop3,0  zero 4th 18 bits
 813           linsta    ctlop     tell 68/80
 814           dmpout              get rid of bad msg
 815           gocase    modtyp,etxcmp,sohjmp if from 68/80 go terminate
 816           goto      ghang     else our problem so hangup
 817           ttls      routines to end a dialog
 818 gterm1    dmpout              if had no resp must dmp our msg
 819 gterm     dumpin              throw away the input
 820           gocase    modtyp,trmcmp,trmjmp already terminated or "ing"
 821           setchr    modtyp,inact4       end of input or output
 822           setlcf    gflags,trmchr       set the terminate flag
 823           clrlcf    gflags,rtntry       say first time
 824           setlcl    rtnlbl,trmbld       where to come for second try
 825 trmbld    bldmsg    trmmsg,ftbld        set up terminate msg
 826           goto      gwrrd     go output term msg
 827           rem
 828 endtr1    dmpout              if no resp must dmp out output
 829 endtrm    dumpin              make sure we are clean
 830           setchr    modtyp,inact        say we are truely inactive
 831           goto      gidle     go rest for a while
 832           rem
 833           rem
 834           rem
 835 gdis      stpchn              received disconnect
 836           dumpin              get rid of input if any
 837           calsub    dmpall    get rid of all output
 838           clrlcf    gflags,trmchr       lets reset things
 839           setchr    modtyp,inact        we are now inactive
 840           goto      gidle     go rest
 841           rem
 842           rem
 843           rem
 844 grfd1     dmpout              dump out old msg we had sent
 845 grfd      dumpin              ready for disconnect
 846           clrlcf    gflags,rtntry       first time
 847           setlcl    rtnlbl,rfdbld       where to come for second try
 848 rfdbld    bldmsg    rfdmsg,ftbld        generate rfd msg in response
 849           setchr    modtyp,inact2       set this mode
 850           goto      gwrrd     go put the msg out
 851           ttls      processing of special control records
 852 scrrcv    cmpchr    incnt,3,scrabt      only 3 chars returned
 853           goto      scrmor    if more or less further checking
 854 scrabt    inscan    ictrl1,passin       abort msg?
 855           goto      scrqut    abort so go quit
 856 scrmor    inscan    icldlr,passin       check for $*$ in this record
 857           gocase    scrchr,scrcmp,scrjmp go check this special control record
 858           goto      passin    nothing we expected so  give it to Multics
 859           rem
 860 scra      inscan    iclabt,passin       check for abort msg
 861           goto      scrqut    if so go quit 68/80
 862 scro      inscan    iclout,passin       check for out msg
 863           setlcf    gflags,trmchr       yes so set terminate flag
 864           dumpin              we are through with it
 865           tstwrt    gterm     if output, go do it now
 866           setime    5         give us 5 secs to
 867           wait      noout,gterm,gtest wait for output
 868           rem                 if no data send not data msg
 869           status    0,dsr,ghang         self explanitory
 870           status    exh,0,exhlim        watch for runaway channel
 871 noout     setchr    modtyp,inact3       waiting for response from NO DATA
 872           clrlcf    gflags,rtntry       first time
 873           setlcl    rtnlbl,bldnda       where to come to try again
 874 bldnda    bldmsg    ndamsg,ftbld        build no data msg
 875           goto      gwrrd     go output it
 876           rem
 877 scrd      inscan    icldis,passin       check fr a disconnect msg
 878           setchr    modtyp,inact1       we are in process of disconnecting
 879           dumpin              get rid of old dis msg
 880           clrlcf    gflags,rtntry       first try
 881           setlcl    rtnlbl,disbld       where to come for second try
 882 disbld    bldmsg    dismsg,ftbld        bld our own dis msg to the 115
 883           goto      gwrrd     go output our disconnect
 884           rem
 885 scre      inscan    iclend,passin       check for an end msg
 886           goto      gterm     if so go terminate
 887           rem
 888 exhlim    meter2    m.exh,1
 889           stpchn              hold everything, its too much
 890           rem                 and start over again
 891 scrqut    dumpin              get rid of msg
 892           signal    quit      quit to 68/80
 893           calsub    dmpall    dump all the output
 894           goto      gterm     go terminate this dialog
 895           rem
 896 passin    cmpchr    incnt,null,scrrtn nothing to give 68/80
 897           cmpchr    modtyp,actinp,scrrtn if actinp let input do the sendins
 898           sendin              give it to the 68/80
 899 scrrtn    gocase    modtyp,wextmd,sctjmp go back
 900           goto      badmod    bad data in tib
 901           ttls      routine to hangup the line
 902 ghang     retext              release the tib extension
 903 ghangn contrl       rxmit+rrec+rdtr+rrts lower all the contrl lines
 904           setime    5         wait 5 secs for modem to follow
 905           wait      ghg,0,0
 906           status    0,dsr,ghg modem did its thing
 907 ghg       stpchn              make sure all is stopped
 908           signal    hangup    tell momma he went home
 909           calsub    dmpall    purge all output buffers
 910           dumpin              purge input buffer
 911           clrflg    tfhang    reset flag for next time
 912           goto      hungup    back to main contrl tables
 913           rem                 thats all folks!
 914           ttls subroutine to insure all output is dumped
 915 dmpall    dmpout              throw output buffer away
 916           tstwrt    dmpall    still have some left
 917           retsub              return to caller
 918           ttls      subroutine to check for data remote sent to us
 919 gckin     inscan    ictrl2,gbadin       check lrc on input
 920           calasm    stpbcc    go strip the bcc character from the buffer
 921           inscan    ictrl7,gbadin       find soh
 922           inscan    fcscan,gbadin       get the msg type to a tib addr
 923           gocase    fctype,fccmp,fcjmp go to type of msg it is
 924           goto      gbadin    not a valid function code type
 925           rem
 926 fcsm      setchr    fctype,srvmes       service msg
 927           goto      gckcnt    go check the rest
 928 fcscr     setchr    fctype,scrmes       special record msg
 929           goto      gckcnt
 930 fcinf     setchr    fctype,infmes       information msg
 931 gckcnt    inscan    ictrl4,gbadin       save seq code, op type, and ack
 932           cmpchr    acknak,null,setack see if we got ack in msg
 933           setchr    acknak,nak          no so say nak
 934           goto      gack      go get the cnt
 935 setack    setchr    acknak,ack          yes we got an ack
 936 gack      inscan    ictrl6,gcketb       count the chars we got
 937           goto      gcksrv    see if srv msg needs more checks
 938 gcketb    inscan    ictrl9,gbadin       ck for etb if no etx
 939 gcksrv    cmpchr    fctype,srvmes,cksrv see if further checking required
 940           retsub              no so go back
 941 cksrv     gocase    optype,opck,opjmp see if srvmes to be saved
 942           dumpin              no so dump it
 943 gckret    retsub              return to caller
 944           rem
 945 gbadin    dumpin              get rid of bad msg
 946           setchr    fctype,null         say we got error
 947           setchr    optype,null         same here
 948           setchr    acknak,nak          nak the msg
 949           meter2    m.cnt1,1
 950           retsub              go back
 951           ttls subroutine to check for completion of dia input
 952 *
 953 *
 954 *         subroutine to check the dia input chain to see if one exists
 955 *         if it does, it is assumed that we are taking data faster than
 956 *         we can give it to the 68/80 and we must slow down by
 957 *         doing something else and checking again later.
 958 *
 959 *
 960 ckibsy    subr      cki,(x3)
 961           ila       msgchk    get tib addr of place to store result
 962           cax3                move that tib addr to x3
 963           tsy       ckmcad-*,*          call cvaddr to get real addr
 964           stx3      ckmans-*  save this addr to store status
 965           stz       ckmans-*,*          init the status to 0
 966           szn       t.dcp,1   set zero flag if no 68/80 input pending
 967           tze       ckirtn-*  not busy so just return
 968           aos       ckmans-*,*          else set it to one (fspr)
 969 ckirtn    return    ckibsy
 970           ttls      subroutine to check for any addtional output
 971 *
 972 *
 973 *         subroutine to check to see if dia_man has appended any addtional
 974 *         output to our output chain since we last looked at it.  dia_man will
 975 *         not notify us if he appended stuff to an already existing chain, so
 976 *         we have to check for the appending ourselves
 977 *
 978 *
 979 ckochn    subr      cko,(x3)
 980           ila       outchn    get tib addr of place to get buffer addr
 981           cax3                move this tib addr to x3
 982           tsy       ckmcad-*,*          convert tib addr to real addr
 983           stx3      ckmout-*  save addr of variable for later use
 984           lda       ckmout-*,*          get buffer through indirect
 985           tsy       a.a001-*,*          setbpt
 986           cax3
 987           lda       bf.nxt,3  get addr of the next buffer in the output chain
 988           sta       ckmout-*,*          if not 0 we have more output
 989           return    ckochn
 990           ttls subroutine to adjust the buffer tally to not reflect the lrc
 991 *
 992 *
 993 *         subroutine to adjust the buffer tally to not reflect the lrc
 994 *         character in the tally of the buffer with the terminate
 995 *         character.
 996 *
 997 *
 998 stpbcc    subr      stp,(x3)  strip block chaeck char
 999           stz       prvbuf-*
1000           stz       prsbuf-*
1001           stz       prschr-*
1002           lda       t.icp,1   get input chain
1003           tze       stprtn-*  if none, go back
1004 stpbuf    sta       prsabs-*  save absolute address of buffer
1005           tsy       a.a001-*,*          setbpt
1006           cax3
1007           stx3      prsbuf-*  save virtual addr of this input buffer
1008           lda       bf.flg,3  get flag word into a
1009           ana       stpbrk-*  and to get if brk char is here or not
1010           tze       stpnxt-*  if zero then use other buffer
1011           lda       bf.tly,3  get tally word into a
1012           ana       tlymsk-*  and separate character count
1013           tze       stprtn-*  must be error, forwe have term char here it said
1014           iaa       -1        char #1 is in 0 position
1015           sta       prschr-*  save the tally to add later
1016           ana       stpodd-*  see if even or odd
1017           tze       stpevn-*  it is even
1018           lda       prschr-*  get tally back
1019           ars       1         divide by 2
1020           ora       stpbyt-*  looking for odd byte since odd count
1021           tra       stpdo-*   go do the add
1022 stpevn    lda       prschr-*  get tally back
1023           ars       1         divide by 2
1024           ora       ckobyt-*  looking for even byte
1025 stpdo     sta       prschr-*  save for later use
1026           cx3a                move buffer addr to a
1027           iaa       bf.dta    incr to get real data
1028           ora       ckobyt-*  set to byte addring
1029           cax3                set x3 to this char addr
1030           adcx3     prschr-*  set x3 to the char pointed to by tally
1031           lda       0,3,b.0   load a with this char
1032           tnz       stpnxt-*  either we were here already or lrc not checked
1033           ldx3      prsbuf-*  get buffer back
1034           lda       bf.tly,3  get tally back to a
1035           iaa       -1        add -1 (substract 1)
1036           sta       bf.tly,3  and put it back decremented
1037           ana       tlymsk-*  just get the count
1038           tnz       stpnxt-*  go look at the next buff if not zero count
1039           ldq       bf.nxt,3  if zero must release it
1040           lda       prvbuf-*  get previous buffer
1041           tze       stprtn-*  error
1042           tsy       a.a001-*,*          setbpt
1043           cax3
1044           stq       bf.nxt,3  unthread the buffer we will free
1045           lda       bf.flg,3  get the flags for this buffer
1046           ora       stplst-*  say this is the real end of msg
1047           ora       stpbrk-*  say this is really where the break char is
1048           sta       bf.flg,3  put the modified flags back
1049           lda       prsabs-*  get back the buffer to be freed
1050           tsy       a.a001-*,*          setbpt
1051           cax3
1052           lda       bf.siz,3  get size code
1053           ars       15        get size code as interger
1054           iaa       1         total # of 32 word groups
1055           sta       stptly-*  save num of icpl we need to subtract
1056           lda       t.icpl,1  get count of icp buffer lengths
1057           cmpa      stptly-*  just check to make sure
1058           tmi       stprtn-*  icpl less than number we calculated, error
1059           sba       stptly-*  substract out our buffer we are releasing
1060           sta       t.icpl,1  put back the correct tally
1061           lda       prsabs-*  get buffer address
1062           ilq       0         tell frebuf to use size code
1063           tsy       stpfre-*,*          go free this buffer
1064 stpnxt    lda       prsabs-*  get the old pres buff
1065           sta       prvbuf-*  and store it as a previous buff
1066           tsy       a.a001-*,*          setbpt
1067           cax3
1068           lda       bf.nxt,3  get addr of next buffer
1069           tze       stprtn-*  no more so return
1070           tra       stpbuf-*  go try this buffer now
1071 stprtn    return    stpbcc
1072           rem
1073 stpbrk    vfd       o18/bffbrk          break char flag
1074 stpbyt    zero      0,b.1     odd byte addring
1075 stpodd    vfd       o18/1     looking at least significant bit (b17)
1076 stplst    vfd       o18/bfflst          mask to set last buff in msg flag
1077 stptly    bss       1         total num of 32 word blocks in buffer
1078 stpfre    ind       frebfh    to free a buffer
1079           rem
1080 a.a001    ind       setbpt
1081 a.a002    ind       cvabs
1082 a.a003    ind       .crbpe,*
1083           ttls      subroutine to check an output msg
1084 *
1085 *         possibilities are
1086 *                   good msg transmit
1087 *                   particle msg        ask multics for more
1088 *                   particle msg(s) followed
1089 *                      by good msg      throw away particle msgs
1090 *                   msg > 324 text chars throw away
1091 *                   invalid msg         throw away
1092 *
1093 *         subroutine to check for a valid output message
1094 *         a status is stored in the tib extension depending on the
1095 *         result of our check.
1096 *         gocase is then used to decide what to do with the status
1097 *
1098 *
1099 ckomsg    subr      ckm,(x3)
1100           ila       msgchk    get tib addr of place to put our result
1101           cax3                move that tib addr to x3
1102           tsy       ckmcad-*,*          call cvaddr to get real addr
1103           stx3      ckmans-*  save the addr to store our answer
1104           ila       outchn    our last buffer addr
1105           cax3                move this tib addr to x3
1106           tsy       ckmcad-*,*          get real addr to that variable
1107           stx3      ckmout-*  place real addr in word to use later
1108           stz       ckmans-*,*          init answer to 0 and place it
1109           lda       t.ocp,1   get output chain
1110           tze       ckmrtn-*  no output so just return
1111           stz       ckmflg-*  init our found flag to 0
1112           stz       lstbuf-*  init last buffer address
1113           stz       prvbuf-*  init prev last msg buffer
1114           stz       ckmcnt-*  init character count of message
1115 ckmbuf    tsy       a.a001-*,*          setbpt
1116           sta       prsbuf-*  save base of present buffer
1117           cax3                save this buffer addr in x3
1118           lda       bf.tly,3  get number of chars in this data buffer
1119           ana       tlymsk-*  tally is low 9 bits
1120           iaa       1         set our buffer overflow number
1121           sta       ckmmax-*  save our over flow number
1122           stz       buftly-*  set number of characters we start with
1123           cx3a                get base of buffer back to a
1124           iaa       bf.dta    get to first character in buffer
1125           ora       ckobyt-*  get to the 0 byte
1126           cax3                get this real addr to x3 for use
1127 ckmget    aos       buftly-*  have scanned up another one in buffer
1128           lda       buftly-*  get our buffer characters read
1129           cmpa      ckmmax-*  see if we should switch to next buffer now
1130           tnz       ckmsbf-*  use the same buffer
1131           ldx3      prsbuf-*  get our present buffer
1132           cx3a                convert to absolute address
1133           tsy       a.a002-*,*          cvabs
1134           sta       lstbuf-*  save our present buffer for reference
1135           lda       bf.nxt,3  get next buffer addr
1136           tnz       ckmbuf-*  if not zero we have a next buffer
1137           tra       ckmmor-*  else we are at end of string
1138 ckmsbf    aos       ckmcnt-*  incr our character count
1139           lda       ckmlen-*  load a with max msg length
1140           cmpa      ckmcnt-*  see if we are too long yet
1141           tmi       ckmlng-*  if so go notify
1142           lda       0,3,b.0   get the character to check
1143           cmpa      ckmetx-*  see if we have an etx char
1144           tze       ckmsta-*  yes so msg is complete
1145           cmpa      ckmetb-*  see if we have an etb which is ok
1146           tze       ckmsta-*  yes so msg can be sent
1147           cmpa      ckmeot-*  see if eot char
1148           tze       ckmsta-*  yes so it is ok
1149           cmpa      ckmsoh-*  see if it is an soh char
1150           tnz       ckmnxt-*  no so go get the next char
1151           aos       ckmflg-*  say we found another soh char
1152           szn       lstbuf-*  see if first buffer we looked at
1153           tze       ckmnxt-*  first so dont discard it.
1154           stx3      prschr-*  save our present character location
1155           ldq       a.a003-*,*          (.crbpe,*) hold on to pte
1156           szn       prvbuf-*  see if we had a previous last msg
1157           tze       ckmset-*  if not, go set this one
1158           ldx3      prvbuf-*  get that previous buffer
1159           lda       bftlsn-*  load a with the last buf not flag
1160           ansa      bf.flg,3  set the last flag to 0
1161 ckmset    ldx3      lstbuf-*  go get our lst buffer
1162           stx3      prvbuf-*  say we set one here
1163           stz       ckmcnt-*  restart our msg char cnt here
1164           ila       discrd    say we have to dump
1165           sta       ckmans-*,*          save this status
1166           cx3a                convert buffer address to virtual
1167           tsy       a.a001-*,*          setbpt
1168           cax3                back to x3
1169           lda       bftmsk-*  load a with the last flag mask
1170           orsa      bf.flg,3  set the last flag
1171           ldx3      prschr-*  go back to our present character
1172           stq       a.a003-*,*          (.crbpe,*) restore pte
1173 ckmnxt    iacx3     0,b.1     incr to the next character
1174           tra       ckmget-*  go get the next character
1175 ckmlng    ila       lngmsg    message was too long
1176           tra       ckmwan-*  see if it was a msg at all
1177 ckmmor    lda       prsbuf-*  get the addr of our last good buffer
1178           tsy       a.a002-*,*          cvabs
1179           sta       ckmout-*,*          save this addr in our tib
1180           ila       fetx      if we got here we didnt find an etx
1181 ckmwan    sta       ckmans-*,*          place the answer we have so far
1182 ckmsta    szn       ckmflg-*  see if we found at least one soh char
1183           tnz       ckmrtn-*  if we did skip next error msg
1184           ila       fsoh      say we failed to find soh char
1185           sta       ckmans-*,*          store our answer in the tib
1186 ckmrtn    return    ckomsg    return to the caller
1187           rem
1188 lstbuf    bss       1         last buffer we looked at
1189 prvbuf    bss       1         previous buffer we set last buf flag in
1190 prsbuf    bss       1         virtual addr of the present buffer we are in
1191 prsabs    bss       1         absolute "   "    "     "     "     "  "   "
1192 ckobyt    zero      0,b.0     the first byte of the word
1193 ckmmax    bss       1         max number of chars + 1 we allowed in buff
1194 buftly    bss       1         char we are looking at in buffer
1195 ckmsoh    vfd       o18/soh   soh character mask
1196 bftlsn    vfd       o18//bfflst         last buff zeroed mask
1197 bftmsk    vfd       o18/bfflst          last buff mask
1198 ckmans    bss       1         final addr to store our response
1199 ckmout    bss       1         final addr to store last output buffer in
1200 ckmcnt    bss       1         character count of msg
1201 ckmetx    vfd       o18/etx   etx character
1202 ckmetb    vfd       o18/chr027          etb character
1203 ckmeot    vfd       o18/eot   eot character
1204 ckmflg    bss       1         flag that we had found atleast one soh char
1205 ckmlen    dec       332       max length of msg plus header, plus etx
1206 prschr    bss       1         our present character location in buffer
1207 tlymsk    vfd       o18/buftmk          mask to get tally count
1208 ckmcad    ind       cvaddr    external subroutine to get real tib addr
1209           eject
1210           end