home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pdp11 / k11rtc.mac < prev    next >
Text File  |  2020-01-01  |  19KB  |  665 lines

  1.  
  2.  
  3.  
  4. ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  5. ; !!!!!
  6. ; !!!!!    The file is NO longer used.
  7.  
  8.  
  9.  
  10.     .title    k11con    terminal emu
  11.     .ident    /8.0.01/
  12.     .psect
  13.  
  14.     r$rt11    =    1
  15.  
  16. ;    Brian Nelson  29-Dec-83  16:00:09  initial version
  17. ;    Brian Nelson  23-Jan-84  16:19:49  RSX mods
  18. ;    Brian Nelson  16-Apr-84  08:01:57  Merge Bob Denny's changes for RSX
  19. ;    John Pieper   840607        Fix  TC.DLU  for autocall modems (RSX)
  20. ;    John Pieper   840614        Attach lun.ti (even though slaved!)
  21. ;    Brian nelson  840616        Don't change TC.DLU, does not work for
  22. ;                    my system at any rate.
  23.  
  24.     .iif ndf, r$rt11, r$rt11 = 0    ; assume not rt11 today
  25.  
  26.  
  27.     .include    /IN:K11MAC.MAC/
  28.     .iif ndf    ,k11inc    ,.error    ; missing INCLUDE for K11MAC.MAC
  29.  
  30.     locmod    =    ter$cc ! ter$bi    ; for the 11's console
  31.     remmod    =    ter$cc
  32.  
  33. ;    note:    vt125's are a problem as they don't send xon when you type one
  34.  
  35.     .psect    $code
  36.  
  37.     .sbttl    connect code for kermit
  38.     .enabl    gbl
  39.     .enabl    lsb
  40.  
  41.  
  42.  
  43. doconn::message    <You have linked in obsolete CONNECT code>,cr
  44.     tstb    ttname            ; insure that a device name is set
  45.     bne    1$            ; ok
  46.     message    <You must first define an output port:>,cr    ;jfp 840607
  47.     message    <Use the SET LINE command for this.>,cr
  48.     return
  49.  
  50.     
  51. 1$:    message    <Connecting to line >    ; Print the line and speed out
  52.     print    #ttname            ; the link name
  53.     calls    ttspee    ,<#ttname>    ; get the speed now
  54.     tst    r0            ; not if we can't get it
  55.     ble    5$            ; yes, do not print 0 or -1 baud
  56.     message    < at >            ; and the speed
  57.     sub    #10    ,sp        ; try to format the response a little
  58.     mov    sp    ,r1        ; allocate a buffer and point to it
  59.     deccvt    r0,r1,#4        ; convert to decimal, 4 wide
  60.     print    r1    ,#4        ; print it
  61.     add    #10    ,sp        ; pop the buffer
  62.     message    < baud>,cr        ; and finish off the message
  63. 5$:    message    < Type CTRL >
  64.     clr    -(sp)            ; allocate a text buffer
  65.     bisb    conesc    ,(sp)        ; get it
  66.     add    #100    ,(sp)        ; convert it back to printable
  67.     mov    sp    ,r0        ; point to it now
  68.     print    r0    ,#1        ; at last
  69.     tst    (sp)+            ; pop the buffer
  70.     message    < and then C to return to command level>,cr
  71.  
  72.     call    getsys            ; get the exec we are running today
  73.     cmpb    r0    ,#sy$rsts    ; rsts today ?
  74.     bne    10$            ; no
  75.     call    dorsts            ; yes, call the correct routine
  76.     br    100$
  77. 10$:    cmpb    r0    ,#sy$rt
  78.     bne    20$
  79.     call    dort11
  80.     br    100$
  81. 20$:    call    dorsx
  82.     br    100$
  83.  
  84. 100$:    return
  85.  
  86.     .dsabl    lsb
  87.  
  88.     global    <conesc    ,getsys    ,ttcons    ,ttname    ,lun.co    ,lun.ti>
  89.  
  90.  
  91.     .sbttl    do the connect command for RSTS/E
  92.  
  93. ;     This is the  module that handles the CONNECT command for a Kermit
  94. ;    running in local mode on a RSTS or RT11 system. The method used is
  95. ;    simply to try a read  without stall on the remote's line,  echo to
  96. ;    the user's  terminal if there was data,  read without stall on the
  97. ;    users local terminal and send that data to the remote if there was
  98. ;    data to be read. If neither terminal  had data to get, then Kermit
  99. ;    will suspend itself  for 1 second.  For RT11, we will never stall.
  100. ;    Also,  for RT11,  whenever we get 20 (8) characters,  we will send
  101. ;    the remote  system an  XOFF so we can catch up on the input due to
  102. ;    the RT MT service overhead for single character i/o.
  103.  
  104.     chcount    =    0
  105.     exectyp    =    2
  106.     needxon    =    4
  107.     locsize    =    10
  108.  
  109. dort11:
  110. dorsts:    sub    #locsiz    ,sp        ; allocate local r/w data
  111.     mov    sp    ,r4        ; and a pointer to it please
  112.     clr    -(sp)            ; allocate single character buffer
  113.     mov    sp    ,r3        ; and point to it please
  114.     call    getsys            ; get system type
  115.     movb    r0    ,exectyp(r4)    ; save system type in exectype(r4)
  116.     mov    #10    ,chcount(r4)    ; count down for rt11 to do an XOFF
  117.     clr    needxon(r4)        ; don't need to send xon yet
  118.     calls    noecho    ,<#ttname>    ; don't want echoing please
  119.     calls    gttnam    ,<#ttcons>    ; get the 11's terminal name
  120.     calls    ttyini    ,<#ttcons,#lun.co,#locmod>
  121.     tst    r0            ; did it work
  122.     bne    5$            ; no, exit with error
  123.     calls    ttysav    ,<#ttcons>    ; save terminal settings
  124.     calls    ttyset    ,<#ttcons>    ; set terminal up
  125.     tst    r0            ; did the initialization work ?
  126.     bne    5$            ; no, exit
  127.     calls    ttyini    ,<#ttname,#lun.ti,#remmod>
  128.     tst    r0            ; did the initialization work ?
  129.     bne    5$            ; no, exit
  130.     calls    ttyset    ,<#ttname>    ; ok, set some useful things up
  131.     br    10$
  132. 5$:    jmp    90$
  133.  
  134. 10$:    .iif ne,r$rt11    ,call contrp    ; special ^C things for RT11
  135.  
  136. 20$:    clr    r2            ; assume a short nap is needed
  137.     calls    xbinrea    ,<#lun.ti,#-1>    ; try to get a charater from remote
  138.     call    errchk            ; insure error is correct one
  139.     tst    r0            ; did it work ?
  140.     bne    30$            ; no, send an XON to the remote system
  141.     clrpar    r1            ; yes, drop any aprity bits please
  142.     movb    r1    ,@r3        ; yes, get the character and print
  143.     cmpb    r1    ,#'S&37        ; /48/ Xoff?
  144.     beq    24$            ; /48/ Yes, ignore
  145.     calls    binwri    ,<r3,#1,#lun.co>; it out on the local terminal
  146. 24$:    call    dumplo            ; dump to a log file perhaps
  147.     mov    sp    ,r2        ; and say we don't want to sleep
  148.     dec    chcount(r4)        ; is it time to do a RT11 XOFF ?
  149.     bne    40$            ; no, wait a while then
  150.     cmpb    exectype(r4),#sy$rt    ; if not rt11, then skip the xoff
  151.     bne    25$
  152.     mov    #2    ,needxon(r4)    ; will need to send xon later
  153.     call    sxoff            ; yes, send an xoff please
  154. 25$:    mov    #10    ,chcount(r4)    ; and reset the character counter
  155.     br    40$            ; and look for local terminal input
  156. 30$:    cmpb    exectype(r4),#sy$rt    ; if not rt, then skip the xon
  157.     bne    40$            ; not rt
  158.     tst    needxon(r4)        ; really send an xon today?
  159.     beq    40$            ; no
  160.     dec    needxon(r4)        ; don't overdo sending xon's please
  161.     call    sxon            ; no data, send an xon please
  162.  
  163. 40$:    calls    xbinrea    ,<#lun.co,#-1>    ; see if any input is pending from
  164.     tst    r0            ; the local terminal
  165.     bne    70$            ; no
  166.     movb    r1    ,@r3        ; yes, get it and send it to the
  167.  
  168.     bic    #^C177    ,r1        ; insure no high bits are set.
  169.     cmpb    r1    ,conesc        ; other system unless it's the escape
  170.     bne    50$
  171.     calls    xbinrea    ,<#lun.co,#20>    ; char. get the next one please
  172.     tst    r0            ; but wait for it. did it work  ?
  173.     bne    70$            ; no
  174.     bic    #^C177    ,r1        ; insure no high bits are set.
  175.     cmpb    r1    ,conesc        ; really send the escape ?
  176.     beq    50$            ; yes
  177.     call    concmd            ; yes, do the command
  178.     tst    r0            ; exit ?
  179.     bne    100$            ; yes, bye
  180.     br    70$            ; no, next please
  181.  
  182. 50$:    setpar    @r3    ,@r3        ; insure correct outgoing parity now
  183.     calls    binwri    ,<r3,#1,#lun.ti>; the data is for the remote system
  184.     tst    duplex            ; full or half duplex connection?
  185.     beq    60$            ; full
  186.     calls    binwri    ,<r3,#1,#lun.co>; half, send it back please
  187. 60$:    mov    sp    ,r2        ; flag that no wait is needed
  188. 70$:    tst    r2            ; should we take a short nap ?
  189.     bne    80$            ; no
  190.     cmpb    exectype(r4),#sy$rt    ; don't wait if rt11
  191.     beq    80$            ; yep, it's rt11 today
  192.     calls    suspend    ,<#1,#0>    ; yes, sleep 1 second for RSTS/E
  193. 80$:    jmp    20$            ; and back for more
  194.  
  195.  
  196.         
  197. 90$:    direrr    r0            ; problems in getting the connection
  198.  
  199. 100$:    tst    (sp)+            ; pop the one byte buffer and exit
  200.     calls    ttyfin    ,<#ttcons,#lun.co>    
  201.     calls    ttyrst    ,<#ttcons>    ; restore terminal settings
  202.     calls    ttyfin    ,<#ttname,#lun.ti>
  203.     .iif ne,r$rt11    ,call    conrst    ; for RT11 control C junk
  204.     add    #locsiz    ,sp        ; pop local r/w data
  205.     return                ; bye
  206.  
  207.  
  208.  
  209.  
  210.     .sbttl    RSX Connect code - Rev. Notes
  211.  
  212. ;
  213. ; This is the terminal emulator for Kermit-11 on native RSX.  It was
  214. ; rewritten because the original version developed on the RSTS emulator
  215. ; was unsuitable for native RSX.  It wouldn't work reliably at baud
  216. ; rates over 1200 on a moderately busy system.
  217. ;
  218. ;
  219. ; Bob Denny    10-Mar-84
  220. ;
  221. ;    NOTE:    vt125's are a problem as they don't send xon when you type one
  222. ;
  223. ; John Pieper    840607        fix for connecting to an autocall modem
  224. ;    Note:  Autocall modems are a pain under RSX.
  225. ;    If the  TTnn:  is set  /remote ,
  226. ;      the Terminal Handler will NOT let you talk to it until it senses
  227. ;      DSR .  This logic is based on the assumption that a remote line
  228. ;      will be used only for incoming calls.
  229. ;    If the  TTnn:  is set  /noremote ,
  230. ;      then you can talk to it, but the Terminal Handler will drop  DTR .
  231. ;      Thus, unless your modem has a local  DTR  override, it thinks
  232. ;      that you are not connected to it.
  233. ;    Solution:  RSX-11m V4.1  allows  TC.DLU = 2
  234. ;      which holds  DTR  but allows you to talk without having  DSR .
  235. ;    Note -- this mechanism is NOT available from  MCR  level.
  236. ;      Further,  TC.DLU  must be reset to 1 when KERMIT is done or else
  237. ;      the system will not recognize the  TT  as really being remote --
  238. ;      things such as  .IFF <LOCAL>  in an indirect command file will fail.
  239. ;
  240. ;  John Pieper    840614    Slave Terminal Fix!
  241. ;    Due to a change in the Terminal Handler, a slaved terminal must also
  242. ;      be attached or else unsolicited input will NOT be kept in the
  243. ;      typeahead buffer.  (See Software Dispatch Dec. 1983).
  244. ;      Terminal Emulation sure works better with this fix !!
  245.  
  246.     .sbttl    RSX Connect code - Definitions
  247. ;
  248.     .if eq    ,r$rt11
  249.     .iff
  250. dorsx::    return
  251.     .ift                ; keep some sanity for the rt assembler
  252.  
  253.     ef.rem    = 14.            ; Remote event flag
  254.     em.rem    = 020000        ; Remote event flag mask
  255.     ef.loc    = 15.            ; Local event flag
  256.     em.loc    = 040000        ; Local event flag mask
  257.  
  258. ;
  259. ; LOCAL IMPURE DATA
  260. ;
  261.     .psect    $idata    rw,d,lcl,rel,con
  262. ;
  263. ; Characteristics buffers
  264. ;
  265. ;    Note: TC.SLV must be second in the list   BDN 18-Apr-84  10:47:18
  266. ;
  267. savti:    .byte    TC.FDX,0,TC.SLV,0    ; Original setting for remote
  268. savco:    .byte    TC.FDX,0        ; Original setting for local
  269. fdxchr:    .byte    TC.FDX,1,TC.SLV,1    ; Change to FDX if required
  270.  
  271. ;  Buffers for Autocall modem fix
  272. savti2:    .byte    TC.DLU,0,TC.ABD,0    ; TC.ABD maybe not needed - can't hurt
  273.     sizti2    =  .-savti2        ;  in case we ever add more functions
  274. fixti2:    .byte    TC.DLU,2,TC.ABD,0    ; values we need for a modem
  275.  
  276. rtab:    .byte    TC.TBF,0        ; #chars in remote typeahead
  277. ltab:    .byte    TC.TBF,0        ; #chars in local typeahead
  278.  
  279.     .mcall    qio$    qiow$
  280. ;
  281. ; Oft' used QIO DPB's
  282. ;
  283. remread:
  284.     qio$    <io.rne!tf.ral>,lun.ti,ef.rem,,remios,,<rembf,1>
  285. locread:
  286.     qio$    <io.rne!tf.ral>,lun.co,ef.loc,,locios,,<locbf,1>
  287. remwrite:
  288.     qiow$    io.wal,lun.ti,ef.loc,,,,<locbf,1>
  289. locwrite:
  290.     qiow$    io.wal,lun.co,ef.rem,,,,<rembf>
  291. locech:
  292.     qiow$    io.wal,lun.co,ef.rem,,,,<locbf,1>
  293. remtest:
  294.     qiow$    sf.gmc,lun.ti,ef.rem,,remios,,<rtab,2>
  295. remtab:
  296.     qiow$    <io.rne!tf.ral>,lun.ti,ef.rem,,remios,,<rembf+1>
  297.  
  298. ;
  299. ; Other stuff
  300. ;
  301. efbuf:    .blkw    4                ; Event flags buffer
  302. rembf:    .blkb    256.                ; Remote data buffer
  303. locbf:    .blkb    256.                ; Local data buffer
  304. eseen:    .word    0                ; 1 = escape seen
  305. locios:    .word    0,0
  306. remios:    .word    0,0
  307.  
  308.     .psect    $code
  309.  
  310.     .endc                ; for r$rt11 = 0
  311.  
  312.  
  313. ;    .sbttl    RSX Connect Code -- Setup
  314.  
  315.     .if eq    ,r$rt11
  316.     .ift
  317.  
  318.     .mcall    qio$    qiow$    qiow$s    dir$    wtlo$s
  319.     .mcall    alun$s    dscp$s    encp$s    exit$s    rdaf$s    srex$s
  320.  
  321.     .sbttl    Connect code for RSX kermit 
  322. ;
  323. ;     D O C O N N  -  Connect for native RSX
  324. ;
  325. ; Assumes that the remote device has been attached via the
  326. ; SET LINE command and its "asslun()" routine.
  327.  
  328.     .enabl    lsb
  329.  
  330.  
  331. dorsx:    clr    eseen            ; must do this for next connect cmd
  332.     calls    ttpars    ,<#ttname>    ; Get remote unit number
  333.     srex$s    #rsxabo            ; abort perhaps
  334.     alun$s    #lun.ti,r1,r0        ; Assign it
  335.     alun$s    #lun.co,#"TI,#0        ; Assign our local terminal
  336.     tst    proflg
  337.     bne    5$            ; yes, don't try to attach xk0:
  338.     qiow$s    #io.att,#lun.ti,#ef.rem    ; and now Attach it. (jfp 840614)
  339. 5$:
  340.     ;
  341.     ; Save local and remote's /{NO}FULLDUPLEX settings, and
  342.     ; set them to /FULLDUPLEX.  Then DISABLE CHECKPOINTING
  343.     ; so asynchronous buffered I/O is disabled and true full
  344.     ; duplex communication can take place.
  345.     ; BDN 18-Apr-84  10:41:51  Also force slave mode
  346.     ;
  347.     qiow$s    #sf.gmc,#lun.ti,#ef.rem,,,,<#savti,#4>    ; This is crude ...
  348.     qiow$s    #sf.gmc,#lun.co,#ef.loc,,,,<#savco,#2>
  349.     qiow$s    #sf.smc,#lun.ti,#ef.rem,,#remios,,<#fdxchr,#4>
  350.     qiow$s    #sf.smc,#lun.co,#ef.loc,,#remios,,<#fdxchr,#2>
  351.  
  352.     ; If  lun.ti  is currently /noremote (hard wire connection), leave it.
  353.     ; Notify user to make sure correct  TT number.
  354.     ; If it is /remote , fix it for autocall.
  355.  
  356.     tst    proflg
  357.     bne    10$
  358.     qiow$s    #sf.gmc,#lun.ti,#ef.rem,,,,<#savti2,#sizti2>
  359.     tstb    savti2+1            ; currently /remote ?
  360.     bne    6$                ;  Yes
  361.     message    <Note:  This is NOT a Remote line.>,cr
  362.     br    10$                ; that's all we do if local.
  363. 6$:
  364. ;-    qiow$s    #sf.smc,#lun.ti,#ef.rem,,,,<#fixti2,#sizti2>    ; fix it.
  365. 10$:    dscp$s                    ; **DISABLE CHECKPOINTING**
  366.  
  367.  
  368.  
  369.     .sbttl    RSX Connect code - Remote Input
  370.     ;
  371.     ; Prime incoming and outgoing streams
  372.     ;
  373.     dir$    #remread
  374.     dir$    #locread
  375.  
  376.     ;
  377.     ; Main loop - Handle incoming and outgoing streams
  378.     ; until escape character is detected on outgoing (local KB)
  379.     ;
  380. 20$:    wtlo$s    0,#<em.loc!em.rem>        ; Wait for a character on either
  381.     rdaf$s    #efbuf                ; Read the event flags
  382.  
  383.     ;
  384.     ; Handle character(s) on incoming stream
  385.     ;
  386.     bit    #em.rem,efbuf+0            ; Anything coming in?
  387.     beq    40$                ; (no)
  388.     movb    remios    ,r5            ; get the status of the read
  389.     call    iocheck                ; and check for allowable errors
  390.     bcs    100$                ; fatal (likely was IE.DNR)
  391.  
  392.     dir$    #remtest            ; More in typeahead?
  393.     movb    remios    ,r5            ; get the status of the read
  394.     call    iocheck                ; and check for allowable errors
  395.     bcs    100$                ; fatal (likely was IE.DNR)
  396.  
  397.     clr    r0                ; m+ may have a lot ready to get
  398.     bisb    rtab+1,r0            ; r0 = # in typeahead
  399.     beq    30$                ; (no)
  400.     mov    r0,remtab+q.iopl+2        ; Set # to read to drain
  401.     dir$    #remtab                ; Read 'em in
  402. ;-    movb    remios    ,r5            ; get the status of the read
  403. ;-    call    iocheck                ; and check for allowable errors
  404. ;-    bcs    100$                ; fatal (likely was IE.DNR)
  405.  
  406. 30$:    inc    r0                ; r0 = total # chars to show
  407.     mov    r0,locwrite+q.iopl+2        ; Write out this many
  408.     dir$    #locwrite
  409.     mov    locwrite+q.iopl+0,r2        ; now dump junk to logging file
  410. 35$:    movb    (r2)+    ,r1            ; a character at a time
  411.     call    dumplo                ; simple to do
  412.     sob    r0    ,35$            ; next please
  413.     dir$    #remread            ; Re-issue read
  414.  
  415.     .sbttl    RSX Connect code - Local Input
  416.     ;
  417.     ; Handle characters on outgoing (Local input) stream
  418.     ;  do this without fast-drain (yet)
  419.     ;
  420. 40$:    bit    #em.loc,efbuf+0            ; Anything typed locally?
  421.     beq    20$                ; (no, loop back)
  422.  
  423.     movb    locbf,r1            ; r1 = just typed character
  424.     bic    #^C177,r1            ; drop bit 7 if mark set (BDN)
  425.     cmpb    r1,conesc            ; Console escape?
  426.     bne    50$                ; (no)
  427.     tst    eseen                ; Already seen one escape?
  428.     bne    60$                ; (yes, send this one)
  429.     inc    eseen                ; Yes, note it for now
  430.     br    70$                ; And go read again
  431.  
  432. 50$:    tst    eseen                ; Character following conesc?
  433.     beq    60$                ; (no, send it)
  434.     call    concmd                ; Yup, process it
  435.     tst    r0                ; Exit CONNECT mode?
  436.     bne    100$                ; (yes, clean up etc.)
  437.  
  438. 60$:    clr    eseen                ; Assure escape flag reset
  439.     setpar    locbf    ,locbf            ; set correctr outgoing parity
  440.     dir$    #remwrite            ; Transmit character to remote
  441.     tst    duplex                ; ibm type things today?
  442.     beq    70$                ; no
  443.     dir$    #locech                ; need half duplex duplex ?
  444. 70$:    dir$    #locread            ; Re-issue local read
  445.     jmp    20$                ; Loop back
  446.  
  447.     .sbttl    RSX Connect code - Clean Up and Exit
  448.  
  449. ;
  450. ; Exit CONNECT mode
  451. ;
  452. 100$:    call    rsxrst            ; restore terminal settings
  453.     encp$s                ;**ENABLE CHECKP**
  454.     return
  455.  
  456.     
  457.  
  458. rsxabo:    call    rsxrst            ; called via requested exit
  459.     srex$s                ; disable further exits
  460.     exit$s                ; bye
  461.  
  462.  
  463. rsxrst:    qiow$s    #io.kil,#lun.ti,#ef.rem        ; Kill incoming I/O
  464.     qiow$s    #io.kil,#lun.co,#ef.loc        ; Kill incoming I/O
  465.     qiow$s    #sf.smc,#lun.ti,#ef.rem,,,,<#savti,#4>    ; Restore lines
  466.     qiow$s    #sf.smc,#lun.co,#ef.loc,,,,<#savco,#2>
  467.     qiow$s    #sf.smc,#lun.ti,#ef.rem,,,,<#savti2,#sizti2>    ;jfp
  468.     qiow$s    #io.det,#lun.ti,#ef.rem        ; De-Attach remote line
  469.     return
  470.  
  471.  
  472.  
  473. iocheck:mov    r0    ,-(sp)        ; insure this is saved
  474.     tstb    r5            ; sucessesful read qio ?
  475.     bpl    180$            ; yes
  476.     scan    r5    ,#200$        ; allowable error code ?
  477.     tst    r0            ; well
  478.     bne    180$            ; yes, let it through
  479.     neg    r5            ; make > 0 for direrr macro
  480.     direrr    r5            ; simple
  481.     sec                ; failure, exit to command level
  482.     br    190$            ; bye
  483. 180$:    clc                ; success, stay in connect code
  484. 190$:    mov    (sp)+    ,r0        ; restore old r0 please
  485.     return
  486.  
  487. 200$:    .byte    IE.BCC    ,IE.DAO    ,IE.IES    ,IE.NOD    ,IE.PES    ,IE.VER    ,0
  488.     .even
  489.  
  490.  
  491.     global    <conesc    ,ttcons    ,ttname    ,lun.co    ,lun.ti>
  492.  
  493.     .dsabl    lsb
  494.  
  495.     .endc                ; for r$rt11 = 0
  496.  
  497.  
  498.  
  499.     .sbttl    errchk    check for allowable errors on the link
  500.  
  501.  
  502.  
  503. errchk:    mov    r0    ,-(sp)        ; save the error code
  504.     cmpb    r0    ,#nodata    ; check error codes out please
  505.     beq    210$            ; that is what we wanted (no data)
  506.     tst    r0            ; any other kind of error ?
  507.     beq    210$            ; no
  508.     calls    syserr    ,<r0,#errtxt>    ; yes, get the error text please
  509.     strlen    #errtxt            ; ok
  510.     add    #errtxt    ,r0        ; get the length, point to the end
  511.     movb    #cr    ,(r0)+        ; and stuff a carriage return and
  512.     movb    #lf    ,(r0)+        ; a line feed in
  513.     clrb    @r0            ; insure .asciz please
  514.     strlen    #errtxt            ; the length once again
  515.     calls    binwri    ,<#errtxt,r0,#lun.co> ; try to print error on TI
  516.     tst    r0            ; did that also fail ?
  517.     beq    210$            ; no
  518.     mov    @sp    ,r0        ; yes
  519.     direrr    r0            ; yes, print on default TI: lun
  520. 210$:    mov    (sp)+    ,r0        ; pop saved r0 and exit
  521.     return                ; bye
  522.  
  523.     global    <errtxt    ,lun.co    ,nodata>
  524.  
  525.  
  526.  
  527.  
  528.     .sbttl    concmd    terminal emulation escape commands
  529.  
  530. concmd:    save    <r1>
  531.     bicb    #^C177    ,r1
  532.     scan    r1,#200$        ; look for a match here
  533.     asl    r0            ; word offsets
  534.     jsr    pc    ,@210$(r0)    ; dispatch to the correct routine
  535.     unsave    <r1>
  536.     return
  537.  
  538.  
  539. 200$:    .byte    'C&137    ,'c!40        ; drop connection ctrl \ C
  540.     .byte    'I&137    ,'i!40        ; init the line
  541.     .byte    'Q&137    ,'q!40        ; quit logging but leave file open
  542.     .byte    'R&137    ,'r!40        ; resume logging if file is open
  543.     .byte    'X&137    ,'X!40        ; control Q and then thats all
  544.     .byte    'B&137    ,'b!40
  545.     .byte    '?    ,177        ; help, rub for send break
  546.     .byte    'H&137    ,'h!40
  547.     .byte    0
  548.     .even
  549.  
  550. 210$:    .word    con.$            ; unknown escape command
  551.     .word    con.c    ,con.c        ; drop connection
  552.     .word    con.i    ,con.i        ; get modems attention
  553.     .word    con.q    ,con.q        ; turn console logging off
  554.     .word    con.r    ,con.r        ; turn it back on please
  555.     .word    con.x    ,con.x        ; send XON
  556.     .word    con.br    ,con.br        ; break
  557.     .word    con.hl    ,con.br        ; print out commands
  558.     .word    con.hl    ,con.hl        ; help
  559.  
  560.  
  561.  
  562. con.$:    calls    binwri    ,<#200$,#1,#lun.co>    ; beep at user
  563.     clr    r0
  564.     return
  565.  
  566. 200$:    .byte    'G&37            ; [BEL]
  567.     .even
  568.  
  569.  
  570. con.c:    mov    sp    ,r0        ; set flag to exit connect code
  571.     return                ; simple
  572.  
  573.  
  574. con.i:    calls    ttydtr    ,<#ttname>    ; try to force DTR up on the line
  575.     clr    r0
  576.     return
  577.  
  578.  
  579. con.q:    bic    #log$co    ,trace        ; turn off console logging
  580.     clr    r0
  581.     return
  582.  
  583.  
  584. con.r:    bit    #log$op    ,trace        ; if the file is open do it
  585.     beq    100$            ; no
  586.     bis    #log$co    ,trace        ; yes, enable this
  587. 100$:    clr    r0
  588.     return
  589.  
  590.  
  591. con.x:    calls    binwri    ,<#200$,#1,#lun.ti>; insure a control Q goes down
  592.     calls    ttxon    ,<#ttname>
  593.     clr    r0
  594.     return
  595.  
  596. 200$:    .byte    'Q&37
  597.     .even
  598.  
  599. con.br:    calls    senbrk    ,<#ttname,#lun.ti>
  600.     clr    r0
  601.     return
  602.  
  603.  
  604.  
  605. con.hl:    strlen    #200$
  606.     calls    binwri    ,<#200$,r0,#lun.co>
  607.     clr    r0
  608.     return
  609.  
  610. 200$:    .ascii    /B    Try to send a  break to the  remote/<cr><lf>
  611.     .ascii    /C    Connect back to the local Kermit-11/<cr><lf>
  612.     .ascii    /I    Drop  and raise DTR (for RSTS only)/<cr><lf>
  613.     .ascii    /Q    Quit console logging.   See SET LOG/<cr><lf>
  614.     .ascii    /R    Resume console logging. See SET LOG/<cr><lf>
  615.     .ascii    /X    Send XON and cancel any active XONs/<cr><lf>
  616.     .asciz    /RUBOUT    Try to fake a break to the remote/<cr><lf>
  617.     .ascii    /?    Print this message/<cr><lf>
  618.     .byte    0
  619.     .even
  620.  
  621.  
  622.  
  623.  
  624.     .sbttl    dump i/o to a log file ?
  625.  
  626.  
  627. dumplo:    bit    #log$co    ,trace        ; is this enabled ?
  628.     beq    100$            ; no
  629.     bit    #log$op    ,trace        ; is it open
  630.     beq    100$            ; no
  631.     save    <r0,r1>            ; yes, save temps please
  632.     mov    r1    ,r0        ; call simple version
  633.     mov    #lun.lo    ,r1        ; unit number
  634.     call    putcr0            ; thats it folks
  635.     unsave    <r1,r0>
  636. 100$:    return
  637.  
  638.  
  639.  
  640. sxon:    tst    conflow
  641.     beq    100$
  642.     calls    binwri    ,<#xon,#1,#lun.ti>
  643. 100$:    return
  644.  
  645. sxoff:    tst    conflow
  646.     beq    100$
  647.     calls    binwri    ,<#xoff,#1,#lun.ti>
  648. 100$:    return
  649.  
  650.  
  651.     .save
  652.     .psect    $pdata
  653. xon:    .byte    'Q&37
  654. xoff:    .byte    'S&37
  655.     .even
  656.     .restore
  657.  
  658.  
  659.  
  660.     global    <lun.lo    ,putcr0    ,trace    ,conflow>
  661.  
  662.  
  663.  
  664.     .end
  665.