if trace is on then dump the sub #50 ,sp ; current state to the disk file mov sp ,r1 ; allocate a small buffer mov #200$ ,r2 ; point to a header 10$: movb (r2)+ ,(r1)+ ; copy a header please bne 10$ ; until we find a null dec r1 ; all done movb state ,(r1)+ ; copy the current state over movb #40 ,(r1)+ ; sub sp ,r1 ; get the record length mov sp ,r0 ; and point back to the record calls putrec ,; dump it add #50 ,sp ; and deallocate the buffer 30$: tst debug ; terminal debugging on ? beq 40$ ; no .print #200$ ; yes, dump current state to ti: .print #state ,#1 ; .newli ; and a crlf 40$: call senlog ; packet stats 100$: return .save .psect $PDATA ,D 200$: .asciz /Sendsw - state is / .even .restore .dsabl lsb global .sbttl sattr send attribute data for the current file .enabl lsb sattr: inc numtry ; abort if we have been trying too much cmp numtry ,maxtry ; well ? blos 10$ ; no, keep it up movb #STA.ABO,r1 ; yes, return("ABORT") call m$retry ; flag the error type please br 100$ ; exit 10$: tst sendat ; really do this ? beq 90$ ; no mov atrctx ,r5 ; save ctx in case of timeout or nak calls w$attr ,<#filnam,#lun.in,#packet> ; get the next attr packet tst r0 ; any errors along the way ? bne 90$ ; yes tst r1 ; anything to send over ? beq 90$ ; no spack #MSG$ATR,paknum,r1,#packet ; send the next record out please rpack r2,r3,#recpkt ; get the reply please scan r1,#200$ ; and take action on the reply asl r0 ; dispatch based on the packet type jsr pc ,@210$(r0) ; simple br 100$ ; bye 90$: calls buffil ,<#packet> ; get the first buffer of data please mov r1 ,size ; and save it movb #STA.DAT,r1 ; switch to data state if no more attr 100$: return ; bye .save .psect $PDATA ,D 200$: .byte MSG$ERROR,MSG$NAK,MSG$ACK,TIMOUT,BADCHK,0 .even 210$: .word satr.$ .word satr.e ,satr.n ,satr.y ,satr$$ ,satr$$ .restore .dsabl lsb .sbttl handle the response to the packet sent by SATTR satr.$: movb #STA.ABO,r1 ; unrecognized packet type return satr$$: movb state ,r1 ; timeout, stay in current state mov r5 ,atrctx ; we want the same packet next time return ; and exit satr.e: calls prerrp ,<#recpkt> ; print out received error packet movb #STA.ABO,r1 ; abort return ; and exit satr.n: dec r3 ; a NAK, see if it's for the last bge 10$ ; packet mov #63. ,r3 ; --paknum<0 ? 63:paknum 10$: cmp r3 ,paknum ; same one ? beq 20$ ; yes movb state ,r1 ; no, continue on as before then mov r5 ,atrctx ; also restore context please return ; bye 20$: call satr.y ; same packet, goto ACK code return satr.y: cmp r3 ,paknum ; insure ACK is for correct packet beq 10$ ; yes movb state ,r1 ; no, continue in current state return 10$: clr numtry ; retrycount := 0 incm64 paknum ; paknum := (paknum+1) mod 64 movb #STA.ATR,r1 ; not eof, stay in ATTRIBUTE state return ; return("ATTRIBUTE") global .sbttl sbreak send a break .enabl lsb sbreak: inc numtry ; ABORT if retry count is too high cmp numtry ,maxtry ; well ? blos 10$ ; ok movb #STA.ABO,r1 ; no, abort the sending of this call m$retry ; flag the error type please br 100$ 10$: spack #MSG$BREAK,paknum,#0,#packet ; send a break packet rpack r2,r3,#recpkt ; read the response scan r1,#200$ ; and dispatch based on it asl r0 ; offset times two jsr pc ,@210$(r0) ; simple 100$: clc return .save .psect $PDATA ,D 200$: .byte MSG$ERROR,MSG$NAK,MSG$ACK,TIMOUT,BADCHK,0 .even 210$: .word sbrk.$ .word sbrk.e ,sbrk.n ,sbrk.y ,sbrk$$ ,sbrk$$ .restore .dsabl lsb global .sbttl sbreak routines sbrk.$: movb #STA.ABO,r1 ; default or timeout error return ; bye sbrk$$: movb state ,r1 ; receive failure (timeout) return ; remain in current state K11SENMAC[.050032]K11SEN.MAC[.050032]    X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddfp the rest of a file call clratr ; insure attribute stuff is cleared call inirepeat ; must reset pointers for repeat counts sub #100 ,sp ; and a converted filename buffer mov sp ,r4 ; and point to it please inc numtry ; abort if we have been trying too much cmp numtry ,maxtry ; well ? blos 10$ ; no, keep it up movb #STA.ABO,r1 ; yes, return("ABORT") call m$retry ; flag the error type please jmp 100$ ; exit 10$: tst inopn ; open files hanging around ? beq 20$ ; no calls close ,<#lun.in> ; yes, clean up please clr inopn ; it's closed now 20$: tstb filnam ; /38/ a REAL file today? beq 45$ ; /38/ no, must be extended server reply tst doauto ; see if we should check for binary beq 25$ ; no, don't do it please calls binfil ,<#filnam,#lun.in>; should we force binary mode ? tst r0 ; if gt, then yes ble 25$ ; no mov #binary ,image ; yes, force binary file operations 25$: calls open ,<#filnam,#lun.in,image>; open the file for input tst r0 ; did it work ? beq 30$ ; yes calls syserr , ; no calls error ,<#2,#errtxt,#filnam>; say so please movb #STA.ABO,r1 ; return("ABORT") br 100$ ; exit 30$: mov sp ,inopn ; file is open tst xmode ; is this a server X-tended reply? bne 45$ ; yes, send a simple X packet calls fillog ,<#1,#filnam> ; log this to disk calls namcvt ,<#filnam,r4> ; convert name to simple name tstb asname ; /36/ check for alternate name ? beq 35$ ; /36/ no mov #asname ,r4 ; /36/ yes, point to that name 35$: tst remote ; are we local here ? bne 40$ ; no, don't print this out calls printm ,<#4,#300$,#filnam,#310$,r4> 40$: strlen r4 ; and get the filename length spack #MSG$FILE,paknum,r0,r4 ; set the filename packet over clrb asname ; /36/ insure one shot only br 50$ ; ok 45$: spack #MSG$TEXT,paknum ; server extended reply here, send X 50$: rpack r2,r3,#recpkt ; get the response to the filename scan r1,#200$ ; and dispatch on the response asl r0 ; times 2 jsr pc ,@210$(r0) ; and call the appropiate response 100$: add #100 ,sp return .save .psect $PDATA ,D 200$: .byte MSG$ERROR,MSG$NAK,MSG$ACK,TIMOUT,BADCHK,0 .even 210$: .word sfil.$ .word sfil.e ,sfil.n ,sfil.y ,sfil$$ ,sfil$$ 300$: .asciz /Sending file / 310$: .asciz / as file / .even .restore .dsabl lsb global global .sbttl routines for SFILE sfil.$: movb #STA.ABO,r1 ; unknown response, return("ABORT") return sfil$$: movb state ,r1 ; timeout or checksum error return ; remain in current F state sfil.e: calls prerrp ,<#recpkt> ; error, abort aftering getting movb #STA.ABO,r1 ; the error packet printed. return sfil.n: dec r3 ; a NAK, see if it's for the last bge 10$ ; packet mov #63. ,r3 ; --paknum<0 ? 63:paknum 10$: cmp r3 ,paknum ; same one ? beq 20$ ; yes movb state ,r1 ; no, continue on as before then return ; bye 20$: call sfil.y ; same packet, goto ACK code return sfil.y: cmp r3 ,paknum ; same packet number being ACKED? beq 10$ ; yes movb state ,r1 ; no, continue in current state return 10$: clr numtry ; number_of_tries := 0 incm64 paknum ; packnumber := packnumber+1 mod 64 movb #STA.ATR,r1 ; return("ATTRIBUTE") tst xmode ; /38/ return((xmode) ?STA.DAT:STA.ATR) beq 20$ ; /38/ attributes next calls buffil ,<#packet> ; /38/ get the first buffer of data mov r1 ,size ; /38/ and save it movb #STA.DAT,r1 ; /38/ extended reply, no attributes 20$: return global .sbttl sdata send file data to other system .enabl lsb sdata: inc numtry ; abort if we have been trying too much movb paknum ,datauk ; /43/ cmp numtry ,maxtry ; well ? blos 10$ ; no, keep it up movb #STA.ABO,r1 ; yes, return("ABORT") call m$retry ; flag the error type please br 100$ ; exit 10$: spack #MSG$DATA,paknum,size,#packet ; send the next record out please rpack r2,r3,#K11SENMAC[.050032]K11SEN.MAC[.050032]    X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddf ; insure ACK is for correct packet beq 10$ ; yes movb state ,r1 ; no, continue in current state return 10$: add #1 ,dpnumber ; /43/ datapacket_number++ bcc 15$ ; /43/ mov #1 ,dpnumber ; /43/ Avoid overflow 15$: clr numtry ; retry_counter = 0 incm64 paknum ; paknum = paknum mod 64 tst remote ; is this a remote system? bne 40$ ; yes, forget about checking tst cccnt ; any control C's pending? bne 30$ ; yes, always send an error packet call chkabo ; now check for control X,Z or E cmpb r0 ,#ABT$ERROR&37 ; control E then send error packet beq 30$ ; yes cmpb r0 ,#ABT$CUR&37 ; control X then abort current file beq 20$ ; yes cmpb r0 ,#ABT$ALL&37 ; control Z then abort file group? bne 40$ ; nothing mov #-1 ,index ; flag that we are all done 20$: mov #STA.EOF,r1 ; force new state to EOF mov sp ,skipfl ; get SEOF to set discard in EOF return ; and exit 30$: spack #MSG$ERROR,paknum ; send an error packet clr cccnt ; /36/ clear control C flag mov #STA.ABO,r1 ; force state to ABORT return ; and exit 40$: cmpb recpkt ,#ABT$CUR ; did the ack contain a X for skipfile beq 80$ ; yes, fake EOF then cmpb recpkt ,#ABT$ALL ; did the ack contain a Z for skip all bne 90$ ; files ? no mov #-1 ,index ; flag a fake no more files 80$: movb #STA.EOF,r1 ; and fake EOF for either X or Z ack return 90$: add size ,charout+2 ; /43/ Keep track of counts adc charout+0 ; /43/ 32 bits please calls buffil ,<#packet> ; get the next buffer of data to send mov r1 ,size ; and save the size please bne 100$ ; something was there movb #STA.EOF,r1 ; EOF, set state to EOF state return ; return("EOF") 100$: movb #STA.DAT,r1 ; not eof, stay in DATA state return ; return("DATA") global .sbttl SEOF Send file eof packet .enabl lsb seof: inc numtry ; abort if we have been trying too much cmp numtry ,maxtry ; well ? blos 10$ ; no, keep it up movb #STA.ABO,r1 ; yes, return("ABORT") call m$retry ; flag the error type please br 100$ ; exit 10$: tst skipfl ; skipping the rest of a file ? beq 20$ ; no spack #MSG$EOF,paknum,#1,#220$; yes, send D in data field br 30$ 20$: spack #MSG$EOF,paknum ; send an EOF packet out now 30$: rpack r2,r3,#recpkt ; get the reply please scan r1,#200$ ; and take action on the reply asl r0 ; dispatch based on the packet type jsr pc ,@210$(r0) ; simple 100$: clr skipfl ; clear skip the file flag return ; bye .save .psect $PDATA ,D 200$: .byte MSG$ERROR,MSG$NAK,MSG$ACK,TIMOUT,BADCHK,0 .even 210$: .word seof.$ .word seof.e ,seof.n ,seof.y ,seof$$ ,seof$$ 220$: .byte 'D&137 ,0 .even .restore .dsabl lsb .sbttl handle the response to the packet sent by seof seof.$: movb #STA.ABO,r1 ; unrecognized packet type return seof$$: movb state ,r1 ; timeout, stay in current state return ; and exit seof.e: calls prerrp ,<#recpkt> ; print out received error packet return seof.n: dec r3 ; a NAK, see if it's for the last bge 10$ ; packet mov #63. ,r3 ; --paknum<0 ? 63:paknum 10$: cmp r3 ,paknum ; same one ? beq 20$ ; yes movb state ,r1 ; no, continue on as before then return ; bye 20$: call seof.y ; last packet, handle the kac return seof.y: cmp r3 ,paknum ; correct packet number beq 10$ ; yes movb state ,r1 ; no, return the last state return 10$: clr numtry ; clear the retry count incm64 paknum ; paknum := (paknum+1) mod 64 calls close ,<#lun.in> ; close the input file clr inopn ; input file is now closed cmp index ,#-1 ; force a break here from user beq 20$ ; yes clr r0 ; /38/ no errors tst xmode ; /38/ extended response? bne 20$ ; /38/ finish up the transaction call getnxt ; get the next input file ? tst r0 ; did it work ? bne 20$ ; no movb #STA.FIL,r1 ; yes, set new state to "FILE" return 20$: movb #STA.BRK,r1 ; return("BREAK") return .end K11SENMAC[.050032]K11SEN.MAC[.050032]v   X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\