home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / b / krttra.mac < prev    next >
Text File  |  2020-01-01  |  4KB  |  127 lines

  1.     .title    KRTTRA    ASCII transfer to remote
  2.     .ident    "V03.63"
  3.  
  4. ; /63/    27-Sep-97  Billy Youdelman  V03.63
  5.  
  6. ; /62/    27-Jul-93  Billy Youdelman  V03.62
  7. ;
  8. ;    now called direct instead of through KRTCM1
  9.  
  10. ; /BBS/     1-Dec-91  Billy Youdelman  V03.61
  11. ;
  12. ;    after each byte sent the response from the receiver is echo'd
  13. ;    this makes it handy for reading text files into a called system's
  14. ;    message editor, etc..  speed is locked at 1 byte/tick, which is
  15. ;    600 baud in 60Hz land
  16. ;
  17. ;    added code at EOF so last char(s) echo'd by remote are displayed
  18. ;    modified action on EOF to reconnect, also suppress CONNECTs sign-on
  19. ;    message for a cleaner return
  20.  
  21. ;    07-Mar-84  11:42:22   Brian Nelson
  22. ;
  23. ;    Copyright 1984 Change Software, Inc.
  24.  
  25.  
  26.     .include "IN:KRTMAC.MAC"
  27.     .iif ndf  KRTINC  .error    <; .include for IN:KRTMAC.MAC failed>
  28.  
  29.     .mcall    .TTYOUT    ,.TWAIT
  30.  
  31.  
  32.     .psect    $pdata
  33. fifteen:.word    0 ,15            ; wait fifteen ticks after EOF
  34. short:    .word    0 ,1            ; wait up to 1 tick for remote to echo
  35. twarea:    .word    0 ,0            ; .twait work area
  36.  
  37.  
  38.     .psect    $code
  39.     .sbttl    TRANSMIT        ; /BBS/ heavily hacked..
  40.  
  41. ;    input:    argbuf    = name of file to send
  42. ;    output:       r0    = if <>, error code
  43.  
  44. c$tran::tst    remote            ; /62/ disallow to TT
  45.     beq    10$            ; prevents typing TSX lead-in!
  46.     direrr    #er$pls            ; please SET LINE first
  47.     return
  48.  
  49. 10$:    clr    r2            ; input_open := false
  50.     clr    r3            ; terminal_set := false
  51.     upcase    argbuf            ; /62/ upper case all args
  52.     calls    fparse    ,<argbuf,#srcnam> ; /62/ parse the file name please
  53.     tst    r0            ; did the $parse work ok?
  54.     bne    50$            ; no
  55.     calls    iswild    ,<#srcnam>    ; check for wildcarded file spec
  56.     tst    r0            ; is it?
  57.     bne    50$            ; ya..
  58.  
  59.     call    opentt            ; open the link
  60.     tst    r0            ; did it work?
  61.     bne    50$            ; no
  62.     mov    sp    ,r3        ; ya, flag link is init'd..
  63.     calls    open    ,<#srcnam,#lun.in,#text> ; open the input file
  64.     tst    r0            ; did it work?
  65.     bne    50$            ; no
  66.     mov    sp    ,r2        ; ya, flag the file is open
  67.  
  68. 20$:    tst    cccnt            ; ^C typed?
  69.     bne    60$            ; ya, exit
  70.     calls    getc    ,<#lun.in>    ; no, get the next char in the file
  71.     tst    r0            ; did that work?
  72.     bne    50$            ; no
  73.     cmpb    r1    ,#lf        ; a line feed we don't need?
  74.     beq    20$            ; ya, skip it
  75.     mov    r1    ,-(sp)        ; one word buffer
  76.     mov    sp    ,r1        ; point to it please
  77.     calls    binwri    ,<r1,#1>    ; simple to put a single char
  78.     tst    (sp)+            ; pop the tiny buffer now
  79.     .twait    #twarea    ,#short        ; wait one tick
  80. 30$:    calls    xbinrea    ,<#-1>        ; now try for the echo please
  81.     tst    r0            ; get anything back?
  82.     bne    20$            ; no, continue sending
  83.     tst    tsxsav            ; running under TSX?
  84.     beq    40$            ; no
  85.     cmpb    r1    ,m.tsxr        ; /62/ ya, don't type
  86.     beq    30$            ; the lead-in char
  87. 40$:    mov    r1    ,r0        ; pass char to .ttyout
  88.     .ttyout                ; dump it to the terminal
  89.     br    30$            ; and see if another can be had
  90.  
  91. 50$:    mov    r0    ,r4        ; save a copy of the error
  92.     cmp    r0    ,#er$eof    ; end of file?
  93.     beq    60$            ; yes, that's ok
  94.     direrr    r0            ; no, print the error out and exit
  95. 60$:    tst    r2            ; input file still open?
  96.     beq    100$            ; no
  97.     .twait    #twarea    ,#fifteen    ; after EOF, wait 15. ticks
  98. 70$:    calls    xbinrea    ,<#-1>        ; now clean up echo at end
  99.     tst    r0            ; get anything back this time?
  100.     bne    90$            ; no, all done
  101.     tst    tsxsav            ; running under TSX?
  102.     beq    80$            ; no
  103.     cmpb    r1    ,m.tsxr        ; /62/ ya, don't type
  104.     beq    70$            ; the lead-in char
  105. 80$:    mov    r1    ,r0        ; pass char to .ttyout
  106.     .ttyout                ; dump it to the terminal
  107.     br    70$            ; see if another can be had
  108.  
  109. 90$:    calls    close    ,<#lun.in>    ; close the input file
  110. 100$:    cmp    r4    ,#er$eof    ; end of file today?
  111.     beq    130$            ; ya, reconnect with link open
  112.     tst    r3            ; should we put the terminal back?
  113.     beq    110$            ; no
  114.     call    clostt            ; close the link device
  115. 110$:    tst    r2            ; ever get file open?
  116.     beq    120$            ; no, so skip the newline
  117.     .newline            ; for prompt
  118. 120$:    clr    r0            ; /62/ error already handled..
  119.     return
  120.  
  121. 130$:    mov    #bell    ,r0        ; load a beep
  122.     .ttyout                ; ring the bell when done
  123.     mov    sp    ,conmsg        ; suppress CONNECT sign-on msg
  124.     jmp    c$conn            ; and connect automatically..
  125.  
  126.     .end
  127.