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       ,vip_tables
 11           ttl       vip_tables
 12           editp     on
 13           pmc       off
 14           detail    off
 15           pcc       off
 16 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 17 *
 18 *
 19 *         vip_tables, vip
 20 *
 21 *         control tables for a vip terminal, hardwired or on 201c modem
 22 *
 23 *         written 07/12/76 by Robert S. Coren
 24 *
 25 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 26           rem
 27           rem
 28 vip       null
 29           symdef    vip
 30           symdef    vstart
 31           symdef    cct.9
 32           rem
 33           symref    begin
 34           symref    hungup
 35           symref    error
 36           rem
 37           rem
 38           start     vip
 39           pmc       save,on
 40           tib
 41           csbits
 42           tconst
 43           pmc       restore
 44           ttls      constants for vip_tables
 45 vipdsp    bool      140       address display
 46           rem
 47           rem
 48           rem       char positions in tib extension
 49           rem
 50 intype    bool      460
 51 outype    bool      461
 52 fcode     bool      462
 53 reason    bool      463
 54 wbusy     bool      464
 55           rem
 56           rem       wbusy values
 57           rem
 58 no        bool      000       did not get busy message
 59 yes       bool      001       did get busy message
 60           rem
 61           rem
 62           rem       output reason values
 63           rem
 64 wmsg      bool      001       regular output message
 65 reply     bool      002       ack or nak response
 66           rem
 67           rem
 68           rem       special status codes
 69           rem
 70 pgof      bool      156       page overflow
 71 busy      bool      157       busy, terminal offline
 72           rem
 73           rem
 74 quiet     bool      177       fake message code for "quiescent" message
 75           rem
 76           rem
 77           rem       input scan control strings
 78           rem
 79 irnl      chstr     (rescan,search,etx,replac,nl)
 80 irff      chstr     (rescan,search,etx,replac,ff)
 81 ingood    chstr     (rescan,search,soh,replac,null,ignore,replac,null,ignore,
 82           etc       movchr,intype,replac,null,ignore,movchr,fcode,replac,null
 83           etc       ,ignore,replac,null,ignore,match,stx,replac,null)
 84 inlrc     chstr     (rescan,search,soh,ignore,strlrc,search,etx,ignore,cmplrc
 85           etc       ,replac,null)
 86 issoh     chstr     (rescan,match,soh,ignore)
 87 iseot1    chstr     (rescan,match,eot)
 88 iseot2    chstr     (match,eot)
 89           rem
 90           rem
 91           rem       output scan control strings
 92           rem
 93 setack    chstr     (rescan,search,soh,ignore,ignore,replac,outype)
 94 setlrc    chstr     (rescan,search,soh,ignore,strlrc,search,etx,ignore,outlrc
 95           etc       )
 96 setetx    chstr     (rescan,endchn,ignore,replac,etx)
 97 seteot    chstr     (rescan,search,etx,ignore,ignore,replac,syn,ignore,replac
 98           etc       ,syn,ignore,replac,syn,ignore,replac,syn,ignore,replac,eo
 99           etc       t)
100           rem
101           pmc       save,on
102           ttls      vip cct
103           rem
104           cctdef
105           rem
106 ct.vip    equ       ct.sw+ct.t1s
107 ct.eom    equ       ct.sw+ct.t0s+ct.syn
108           rem
109           rem
110           base      64
111 cct.9     null      * cct for vip, terminate on etx + bcc, resync on eot
112           rem
113           vfd       9/ct.ncs,9/ct.ncs * 000   001
114           vfd       9/ct.ncs,9/ct.vip * 002   etx
115           vfd       9/ct.eom,9/ct.ncs * eot   005
116           vfd       9/ct.ncs,9/ct.ncs * 006   007
117           vfd       9/ct.ncs,9/ct.ncs * 010   011
118           vfd       9/ct.ncs,9/ct.ncs * 012   013
119           vfd       9/ct.ncs,9/ct.ncs * 014   015
120           vfd       9/ct.ncs,9/ct.ncs * 016   017
121           vfd       9/ct.ncs,9/ct.ncs * 020   021
122           vfd       9/ct.ncs,9/ct.ncs * 022   023
123           vfd       9/ct.ncs,9/ct.ncs * 024   025
124           vfd       9/ct.ign,9/ct.ncs * syn   027
125           vfd       9/ct.ncs,9/ct.ncs * 030   031
126           vfd       9/ct.ncs,9/ct.ncs * 032   033
127           vfd       9/ct.ncs,9/ct.ncs * 034   035
128           vfd       9/ct.ncs,9/ct.ncs * 036   037
129           rem
130           rem
131           pmc       restore
132           rem
133           rem
134           rem
135           rem       canned output messages
136           rem
137 ackmsg    chstr     (syn,syn,syn,syn,soh,vipdsp,null,space,space,stx,etx,sete
138           etc       om)
139 outhdr    chstr     (syn,syn,syn,syn,soh,vipdsp,null,space,space,stx)
140           ttls      dialup sequence
141           rem
142 vstart    tstflg    tflisn,vlisn
143           wait      0,0,begin /* not listening,wait for further notice */
144           rem
145 vlisn     contrl    sdtr+stat /* start seeing who's there */
146           tstflg    tfdlup,vdial        /* dialup or hardwired? */
147           wait      0,0,vtlisn          /* hardwired, wait for it to happen */
148           rem
149           status    cd+dsr,0,dialed
150 vdial     wait      0,0,vtlisn          /* wait for someone to call */
151           status    dsr,0,dialed
152           rem
153 vtlisn    tstglb    gbf6up,vtest1       /* told not to listen? */
154           goto      hungup    /* yes */
155           rem
156 dialed    getext    4,error   /* get tib extension */
157           dumpin
158           dmpout
159           setchr    wbusy,no
160           signal    dialup    /* tell hardcore */
161           setcct    cct.9     /* establisj the cct */
162           rem                 /* fall through to main loop */
163           ttls      main loop and input processing
164           rem
165 what      tstflg    tfhang,vhang
166           clrflg    (tfwabt,tfrabt)     /* start clean */
167 read      tstwrt    vwrite    /* output pending? */
168           contrl    srec+rxmit+rrts     /* no, get set to read */
169           setime    0         /* see what happens next */
170           wait      0,vwrite,vtest
171           status    0,dsr,vhang3        /* lost dsr, it's all over */
172           status    brkchr,0,vread      /* input arrived */
173           status    exh,0,stopc         /* too much input */
174           status    xte,0,stopc         /* excess interrupts or something *?
175           status    parity,0,stopc
176           rem
177 vtest     tstflg    tfhang,vhang        /* never mind, we're supposed to hang up */
178           waitm               /* or if not, go back to what we were doing */
179           rem
180 vtest1    tstflg    tfhang,vhang2       /* hang up before dialup is even finished */
181           waitm
182           rem
183 stopc     stpchn              /* something blew, go back and start over */
184           dumpin
185           goto      what
186           rem
187 vread     calsub    chekin    /* we have an input message, check it out */
188           cmpchr    intype,null,sndack  /* regular input-type message? */
189           dmpmsg              /* no, what's it doing here */
190           cmpchr    intype,nochar,sndnak          /* bad input? */
191           clrflg    tfrabt    /* so we can get next input */
192           waitm               /* no, don't respond to it */
193 sndnak    setchr    outype,nak          /* else send nak, try it again */
194           goto      acknak
195           rem
196 sndack    setchr    outype,ack          /* it's all right, say so */
197           cmpchr    fcode,q,inquit      /* nul message, was it quit? */
198           tstflg    tfrabt,skip         /* we're supposed to throw this away */
199           cmpchr    fcode,l,inff        /* or form-feed? */
200           inscan    irnl,error          /* replace etx with nl */
201           goto      insend    /* ship it */
202           rem
203 inff      inscan    irff,error          /* replace etx with ff */
204 insend    sendin
205           rem
206 acknak    setime    3         /* wait now for eot msg */
207           rem
208           wait      aknkto,0,vtest      /* if none, continue */
209           status    0,dsr,vhang3        /* died mid-stream */
210           status    brkchr,0,aknkto     /* got syn syn eot after text msg */
211           status    exh,0,badeom        /* whats this action? */
212           status    parity,0,badeom     /* on one char?? */
213           rem
214 badeom    stpchn              /* kill it now */
215           rem
216 aknkto    dumpin              /* throw away the syn syn eot msg */
217           bldmsg    ackmsg,error        /* send ack or nak */
218           outscn    setack,error
219           outscn    setlrc,error
220           outscn    seteot,error        /put eot on the end of msg/
221           setchr    reason,reply        /* so after write is done we go to top */
222           goto      write
223           rem
224 skip      dumpin              /* read abort */
225           goto      acknak    /* acknowledge it anyway */
226           rem
227 inquit    stpchn              /* simulated quit */
228           dumpin
229           dmpout
230           signal    quit      /* so do it */
231           contrl    srec
232           goto      acknak    /* have to acknowledge it */
233           ttls      output stuff
234           rem
235 vwrite    tstflg    tfwabt,nowrit       /* sorry, changed our minds */
236           bldmsg    outhdr,error        /* attach standard output header to message */
237           outscn    setetx,error        /* put etx at end */
238           outscn    setlrc,error        /* and block check */
239           outscn    seteot,error        /place eot on msg/
240 rewrit    setchr    reason,wmsg         /* so we'll know where to go after */
241           rem
242 write     holdot              /* make sure we hold output */
243           tstflg    tfdlup,wrdial       /* here to do all output */
244           dcwlst              /* hardwired output */
245           cmd       sxmit+srec+srts
246           output    (outmsg)
247           cmd       sterm+rxmit+rrts
248           setime    0
249           wait      0,0,tstdmp          /* just wait for terminate */
250           status    term,0,wdone
251           rem
252 wrdial    contrl    srts+rrec+rxmit+stat          /* on dialup, we have to wait for cts */
253           setime    3         /* it better not take that long */
254           wait      wrdial,0,0          /* but if it does, we'll just try again */
255           status    0,dsr,vhang         /* whoops, goodbye */
256           status    cts,0,wxmit         /* that's what we want to hear */
257           rem
258 wxmit     dcwlst
259           cmd       sxmit
260           output    (outmsg)
261           cmd       sterm+rxmit+rrts
262           wait      0,0,tstdmp          /* wait for terminate */
263           status    0,dsr,vhang         /* all right, who hung us up now */
264           status    term,0,wdone        /* output finished */
265           status    0,cts,wrdial        /* lost cts, try again */
266           rem
267 wdone     tstflg    tfhang,vhang        /* hang up if we're supposed to */
268           cmpchr    reason,reply,akdone /* find out why we were writing */
269           cmpchr    reason,wmsg,getack
270           punt      2         /* no known reason */
271           rem
272 getack    setime    10        /* allow plenty of time for ack */
273           contrl    srec      /* get into receive mode */
274           wait      write,0,vtest       /* if it doesn't come, send output again */
275           status    0,dsr,vhang3        /* how tiresome */
276           status    brkchr,0,chkack     /* we got something, go see what */
277           status    exh,0,stopc         /* be serious */
278           status    parity,0,stopc      /* god help us */
279           rem
280 chkack    calsub    chekin    /* make sure it's a reasonable message */
281           cmpchr    intype,ack,gotack   /* good, it's an ack */
282           cmpchr    intype,nak,gotnak   /* terminal didn't like it */
283           cmpchr    intype,pgof,fulscr  /* overflew the screen */
284           cmpchr    intype,busy,offlin  /* terminal was offline */
285           rem
286 igmsg     dmpmsg              /* nothing we've ever seen, ignore it */
287           waitm               /* try again */
288           rem
289 gotack    dmpmsg              /* we don't want this for anything */
290           setchr    wbusy,no  /* not off line now */
291           dmpout              /* through with output now */
292           goto      what      /* see what to do next */
293           rem
294 akdone    dmpout              /* through with this now too */
295           cmpchr    wbusy,yes,rewrit    /* we got a busy, try write again */
296           goto      what      /* otherwise wait around */
297           rem
298 gotnak    dumpin              /* we lost */
299           goto      write     /* try it again */
300           rem
301 nowrit    dmpout              /* told to throw output away */
302           clrflg    tfwabt
303           setchr    wbusy,no
304           goto      what
305           rem
306           rem                 /* terminal offline or screen full */
307 fulscr    dmpout              /* can't handle this output, too big */
308           dmpmsg              /* not interesting any more */
309           goto      what      /* start again */
310           rem
311 offlin    setchr    wbusy,yes /* he was offline */
312           contrl    srec+rxmit+stat     /* we're going to wait to hear from him */
313           setime    3         /* check again every now and again */
314           wait      write,0,tstdmp      /* someone might change their mind about output */
315           status    0,dsr,vhang3
316           status    brkchr,0,vread      /* if we got input, things are going again */
317           status    exh,0,ostopc        /* unless we got too much */
318           status    parity,0,ostopc     /* ugh */
319           rem
320 tstdmp    tstflg    tfwabt,nowrit       /* changed our mind about output */
321           waitm
322           rem
323 ostopc    stpchn
324           dumpin              /* if we had parity, nothing's interesting */
325           goto      write     /* try output again */
326           ttls      hangup routine
327 vhang     retext              /* return tib extension */
328 vhang2    contrl    rxmit+rrec+rdtr     /* hangup line */
329           tstflg    tfdlup,vhang4       /* drop dtr and wait for dsr on dialup */
330           goto      vhang1    /* but don't wait for hardwired */
331           rem
332 vhang4    setime    5         /* wait 5 secs */
333           wait      vhang1,0,0          /* if timeout, try again */
334           status    0,dsr,vhang1        /* dsr down */
335 vhang1    stpchn              /* stop channel */
336           dmpout              /* throw away any output */
337           dumpin              /* throw away any input */
338           signal    hangup    /* tell 6180 about hangup */
339           clrflg    (tflisn,tfhang)     /* clear the listen and hangup flags */
340           goto      hungup    /* thats all folks */
341 vhang3    tstflg    tfdlup,vhang        /* right type, give up */
342           waitm               /* else wait till it comes back */
343           ttls      subroutine for checking input message
344           rem
345 chekin    inscan    iseot1,chksoh       /* see if it's quiescent without soh */
346           goto      nomsg     /* yes, say so */
347 chksoh    inscan    issoh,inerr         /* first char had better be soh */
348           inscan    iseot2,chklrc       /* if next character is eot, nothing here */
349 nomsg     setchr    intype,quiet        /* call it quiescent */
350           retsub
351           rem
352 chklrc    inscan    inlrc,inerr         /* see if checksum is any good */
353           inscan    ingood,inerr        /* and then rest of message */
354           retsub              /* that's cool, ingood set message type */
355           rem
356 inerr     setchr    intype,nochar       /* mark message as unrecognizable */
357           retsub
358           end