.title KRTTRA ASCII transfer to remote .ident "V04.64" ; /E64/ 05-May-96 John Santos ; ; Conditionalize for RSTS/E ; Restore RSTS-specific version of c$tran ; /63/ 24-Dec-94 Billy Youdelman ; /62/ 27-Jul-93 Billy Youdelman V03.62 ; ; now called direct instead of through KRTCM1 ; /BBS/ 1-Dec-91 Billy Youdelman V03.61 ; ; after each byte sent the response from the receiver is echo'd ; this makes it handy for reading text files into a called system's ; message editor, etc.. speed is locked at 1 byte/tick, which is ; 600 baud in 60Hz land ; ; added code at EOF so last char(s) echo'd by remote are displayed ; modified action on EOF to reconnect, also suppress CONNECTs sign-on ; message for a cleaner return ; 07-Mar-84 11:42:22 Brian Nelson ; ; Copyright 1984 Change Software, Inc. .include "IN:KRTMAC.MAC" .iif ndf KRTINC .error <; .include for IN:KRTMAC.MAC failed> .if df RT11 ; /E64/ .mcall .TTYOUT ,.TWAIT .endc ;RT11 ; /E64/ .psect $pdata .if df RT11 ; /E64/ fifteen:.word 0 ,15 ; wait fifteen ticks after EOF short: .word 0 ,1 ; wait up to 1 tick for remote to echo twarea: .word 0 ,0 ; .twait work area .endc ;RT11 ; /E64/ .if df RSTS ; /E64/ isecho: .word 0 .endc ;RSTS ; /E64/ .psect $code .if df RT11 ; /E64/ .sbttl TRANSMIT ; /BBS/ heavily hacked.. ; input: argbuf = name of file to send ; output: r0 = if <>, error code c$tran::tst remote ; /62/ disallow to TT beq 10$ ; prevents typing TSX lead-in! direrr #er$pls ; please SET LINE first return 10$: clr r2 ; input_open := false clr r3 ; terminal_set := false upcase argbuf ; /62/ upper case all args calls fparse , ; /62/ parse the file name please tst r0 ; did the $parse work ok? bne 50$ ; no calls iswild ,<#srcnam> ; check for wildcarded file spec tst r0 ; is it? bne 50$ ; ya.. call opentt ; open the link tst r0 ; did it work? bne 50$ ; no mov sp ,r3 ; ya, flag link is init'd.. calls open ,<#srcnam,#lun.in,#text> ; open the input file tst r0 ; did it work? bne 50$ ; no mov sp ,r2 ; ya, flag the file is open 20$: tst cccnt ; ^C typed? bne 60$ ; ya, exit calls getc ,<#lun.in> ; no, get the next char in the file tst r0 ; did that work? bne 50$ ; no cmpb r1 ,#lf ; a line feed we don't need? beq 20$ ; ya, skip it mov r1 ,-(sp) ; one word buffer mov sp ,r1 ; point to it please calls binwri , ; simple to put a single char tst (sp)+ ; pop the tiny buffer now .twait #twarea ,#short ; wait one tick 30$: calls xbinrea ,<#-1> ; now try for the echo please tst r0 ; get anything back? bne 20$ ; no, continue sending tst tsxsav ; running under TSX? beq 40$ ; no cmpb r1 ,m.tsxr ; /62/ ya, don't type beq 30$ ; the lead-in char 40$: mov r1 ,r0 ; pass char to .ttyout .ttyout ; dump it to the terminal br 30$ ; and see if another can be had 50$: mov r0 ,r4 ; save a copy of the error cmp r0 ,#er$eof ; end of file? beq 60$ ; yes, that's ok direrr r0 ; no, print the error out and exit 60$: tst r2 ; input file still open? beq 100$ ; no .twait #twarea ,#fifteen ; after EOF, wait 15. ticks 70$: calls xbinrea ,<#-1> ; now clean up echo at end tst r0 ; get anything back this time? bne 90$ ; no, all done tst tsxsav ; running under TSX? beq 80$ ; no cmpb r1 ,m.tsxr ; /62/ ya, don't type beq 70$ ; the lead-in char 80$: mov r1 ,r0 ; pass char to .ttyout .ttyout ; dump it to the terminal br 70$ ; see if another can be had 90$: calls close ,<#lun.in> ; close the input file 100$: cmp r4 ,#er$eof ; end of file today? beq 130$ ; ya, reconnect with link open tst r3 ; should we put the terminal back? beq 110$ ; no call clostt ; close the link device 110$: tst r2 ; ever get file open? beq 120$ ; no, so skip the newline .newline ; for prompt 120$: clr r0 ; /62/ error already handled.. return 130$: mov #bell ,r0 ; load a beep .ttyout ; ring the bell when done mov sp ,conmsg ; suppress CONNECT sign-on msg jmp c$conn ; and connect automatically.. .endc ;RT11 ; /E64/ .if df RSTS ; /E64/ .sbttl TRANSMIT ; /E64/ heavily hacked.. ; Transfer a file without the blessing of any ; protocal to another system. What this amounts to ; is to send a single character from a file and ; then wait for it's echo to show up. Timeout will ; be 10 seconds. It is presumed the the other ; system is running some sort of program like PIP ; to get the data. Line feeds will never be sent, ; thus this is only good for text files. This ; option will hopefully be of some assistance in ; getting initial bootstraps onto other systems. ; ; Usage: ; ; Use the SET LINE, SET SPEED and CONNECT commands ; to initiate the receiving program on the other ; system. Then 'escape' back to Kermit-11 and simply ; type TRA filename.type. ; ; ; T R A N S F (%loc filename ) ; ; Input: @r5 addess of the .asciz filename to send ; Output: r0 any system or RMS11 error codes .sbttl the real (and simple) work of transfer ; A simple brute force transfer of a file. c$tran::clr r2 ; input_open := false clr r3 ; terminal_set := false mov #3 ,isecho ; /47/ Countdown on read timeouts tst remote ; if remote beq 10$ ; then ttname := ourname calls gttnam ,<#ttname> ; get the terminal name here 10$: calls ttyini ,<#ter$xo> tst r0 bne 20$ calls ttysav ,<#ttname> ; save terminal settings calls ttyset ,<#ttname> ; set some things now tst r0 ; terminal setup work out ? bne 20$ ; no mov sp ,r3 ; yes 20$: calls open ,<@r5,#lun.in,#text> tst r0 ; did the open work today? bne 90$ ; no mov sp ,r2 ; flag that the file is open mov #200 ,r4 ; start of things 30$: tst cccnt ; /47/ Control C today? bne 90$ ; /47/ Yes, exit please calls getc ,<#lun.in> ; get the next ch in the file tst r0 ; did that work ? bne 90$ ; no dec r4 ; time for the remote to dump a block? bne 40$ ; no calls suspend ,<#1,#0> ; yes, sleep for 1 second call cantyp ; /47/ Dump pending typeahead mov #200 ,r4 ; and re-init the count 40$: cmpb r1 ,#lf ; a line feed we don't need ? bne 50$ ; no calls suspend ,<#0,#6> ; wait 1/10 sec please calls xbinrea ,<#-1> ; eat perhaps a line feed (no wait) br 60$ 50$: mov r1 ,-(sp) ; yes, now send it to the other mov sp ,r1 ; point to it please calls binwri , ; simple to put a single char. tst (sp)+ ; pop the tiny buffer now please. tst r0 ; did that work out ? bne 90$ ; no calls xbinrea ,<#2> ; /47/ yes, try for the echo please tst r0 ; /47/ did we ever get anything back? beq 55$ ; /47/ Yes, keep going dec isecho ; /47/ Shoud we give up looking for bne 60$ ; /47/ data being echoed? 55$: mov #3 ,isecho ; /47/ Start the counter for echoing 60$: br 30$ ; next please 90$: cmp r0 ,#ER$EOF ; RMS end of file today ? beq 100$ ; yes, that ok direrr r0 ; no, print the error out and exit 100$: tst r2 ; input file still open ? beq 110$ ; no calls close ,<#lun.in> 110$: tst r3 ; should we put the terminal back ? beq 120$ ; no calls ttyfin calls ttyrst ; yes 120$: return .endc ;RSTS ; /E64/ .end