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

  1.     .title    k11tra    transfer to remote without kermit
  2.     .ident    /2.0.01/
  3.  
  4.  
  5. ;    07-Mar-84  11:42:22   Brian Nelson
  6. ;
  7. ;    Copyright (C) 1984 Change Software, Inc.
  8.  
  9.  
  10.  
  11.     .if ndf, K11INC
  12.     .ift
  13.     .include    /IN:K11MAC.MAC/
  14.     .endc
  15.  
  16.     .psect    $code
  17.  
  18.     .iif ndf    ,k11inc    ,.error    ;include for K11MAC.MAC is missing
  19.     .enabl    gbl
  20.  
  21.  
  22. ;    Transfer  a  file  without  the  blessing  of  any
  23. ;    protocal to another system. What this  amounts  to
  24. ;    is  to  send  a  single  character from a file and
  25. ;    then wait for it's echo to show up.  Timeout  will
  26. ;    be  10  seconds.  It  is  presumed  the  the other
  27. ;    system is running some sort of  program  like  PIP
  28. ;    to  get  the  data. Line feeds will never be sent,
  29. ;    thus this  is  only  good  for  text  files.  This
  30. ;    option  will  hopefully  be  of some assistance in
  31. ;    getting initial bootstraps onto other systems.  If
  32. ;    the  value  in 2(r5) is <> 0 then assume the other
  33. ;    system will not echo else assume so. 
  34. ;
  35. ;    Usage:
  36. ;
  37. ;    Use the  SET LINE, SET SPEED  and CONNECT commands
  38. ;    to  initiate the  receiving  program on  the other
  39. ;    system. Then 'escape' back to Kermit-11 and simply
  40. ;    type TRA filename.type.
  41. ;
  42. ;
  43. ;    T R A N S F (%loc filename, %val echoflag )
  44. ;
  45. ;    Input:    @r5    addess of the .asciz filename to send
  46. ;        2(r5)    if <> 0 then don't wait for echoing of the data
  47. ;    Output:    r0    any system or RMS11 error codes
  48.  
  49.     .save                ; /47/
  50.     .psect    rwdata    ,rw,d,lcl,rel,con;/47/
  51. isecho:    .word    0
  52. noecho:    .word    0
  53.     .restore
  54.  
  55.  
  56. ;    10-Mar-86  10:10:15  BDN    Improve echo waiting logic
  57.  
  58.  
  59.  
  60.     .sbttl    the real (and simple) work of transfer
  61.  
  62. ;    A simple brute force transfer of a file.
  63.  
  64.  
  65. transf::clr    r2            ; input_open := false
  66.     clr    r3            ; terminal_set := false
  67.     mov    #3    ,isecho        ; /47/ Countdown on read timeouts
  68.     mov    2(r5)    ,noecho        ; /47/ Default for echoing
  69.     tst    remote            ; if remote
  70.     beq    10$            ;  then ttname := ourname
  71.     calls    gttnam    ,<#ttname>    ; get the terminal name here
  72. 10$:    calls    ttyini    ,<#ttname,#lun.ti,#ter$xo>
  73.     tst    r0
  74.     bne    20$
  75.     calls    ttysav    ,<#ttname>    ; save terminal settings
  76.     calls    ttyset    ,<#ttname>    ; set some things now
  77.     tst    r0            ; terminal setup work out ?
  78.     bne    20$            ; no
  79.     mov    sp    ,r3        ; yes
  80.  
  81. 20$:    calls    open    ,<@r5,#lun.in,#text>
  82.     tst    r0            ; did the open work today?
  83.     bne    90$            ; no
  84.     mov    sp    ,r2        ; flag that the file is open
  85.     mov    #200    ,r4        ; start of things
  86.  
  87.  
  88. 30$:    tst    cccnt            ; /47/ Control C today?
  89.     bne    90$            ; /47/ Yes, exit please
  90.     calls    getc    ,<#lun.in>    ; get the next ch in the file
  91.     tst    r0            ; did that work ?
  92.     bne    90$            ; no
  93.     dec    r4            ; time for the remote to dump a block?
  94.     bne    40$            ; no
  95.     calls    suspend    ,<#1,#0>    ; yes, sleep for 1 second
  96.     calls    cantyp    ,<#ttname,#lun.ti> ; /47/ Dump pending typeahead
  97.     mov    #200    ,r4        ; and re-init the count
  98. 40$:    cmpb    r1    ,#lf        ; a line feed we don't need ?
  99.     bne    50$            ; no
  100.     calls    suspend    ,<#0,#6>    ; wait 1/10 sec please
  101.     calls    xbinrea    ,<#lun.ti,#-1>    ; eat perhaps a line feed (no wait)
  102.     br    60$
  103. 50$:    mov    r1    ,-(sp)        ; yes, now send it to the other
  104.     mov    sp    ,r1        ; point to it please
  105.     calls    binwri    ,<r1,#1,#lun.ti>; simple to put a single char.
  106.     tst    (sp)+            ; pop the tiny buffer now please.
  107.     tst    r0            ; did that work out ?
  108.     bne    90$            ; no
  109.     tst    noecho            ; yes, should we try to eat echoes?
  110.     bne    60$            ; no
  111.     calls    xbinrea    ,<#lun.ti,#2>    ; /47/ yes, try for the echo please
  112.     tst    r0            ; /47/ did we ever get anything back?
  113.     beq    55$            ; /47/ Yes, keep going
  114.     dec    isecho            ; /47/ Shoud we give up looking for
  115.     bne    60$            ; /47/ data being echoed?
  116.     mov    sp    ,noecho        ; /47/ Yes, forget about the echoing
  117. 55$:    mov    #3    ,isecho        ; /47/ Start the counter for echoing
  118. 60$:    br    30$            ; next please
  119.  
  120.  
  121. 90$:    cmp    r0    ,#ER$EOF    ; RMS end of file today ?
  122.     beq    100$            ; yes, that ok
  123.     direrr    r0            ; no, print the error out and exit
  124. 100$:    tst    r2            ; input file still open ?
  125.     beq    110$            ; no
  126.     calls    close    ,<#lun.in>
  127. 110$:    tst    r3            ; should we put the terminal back ?
  128.     beq    120$            ; no
  129.     calls    ttyfin    ,<#ttname,#lun.ti>
  130.     calls    ttyrst    ,<#ttname>    ; yes
  131. 120$:    return
  132.  
  133.  
  134.     .end
  135.