; 18 jly 85 esj converted ;;;;;;;;;;;;; RDATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; E'F A:S(NWLS) E'O RDATA.(X) ; read a data packet from the other KERMIT /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERCOM /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERDEF I'R NUM,LEN,STATUS,X,TNUM I'R TV1,TV2,TV3,TV4 W'R (NUMTRY.GT.MAXTRY) LCLSTATE=BIGA ;exceeded maxtry , gives up E'E CLOSTEXT.(FD) O'E NUMTRY=NUMTRY+1 ;try it again STATUS=RPACK.(LEN,NUM,PACKET) ;read a packet E'E DODOT. ; tell all if ok to W'R (STATUS.EQ.BIGD) ;we got the data packet W'R (NUM.NE.N) W'R (OLDTRY.GT.MAXTRY) LCLSTATE=BIGA E'E CLOSTEXT.(FD) O'E OLDTRY=OLDTRY+1 W'R (NUM.EQ.(N-1)) E'E SPAR.(PACKET) ;we got a duplicted packet TV1=BIGY ;just ACK it TV2=6 E'E SPACK.(TV1,NUM,TV2,PACKET) NUMTRY=0 LCLSTATE=STATE O'E LCLSTATE=BIGA E'E CLOSTEXT.(FD) E'L E'L O'E E'E BUFEMP.(PACKET,LEN) ;write the data packet just receive TNUM=N ;into the receiving disk file TV1=BIGY TV2=TNUM TV3=0 TV4=0 E'E SPACK.(TV1,TV2,TV3,TV4) ;ACK the just received packet OLDTRY=NUMTRY NUMTRY=0 N=(N+1) .MOD. 64 LCLSTATE=BIGD E'L O'R (STATUS.EQ.BIGF) ;the packet is the file header W'R (OLDTRY.GT.MAXTRY) ;we should have already gotten LCLSTATE=BIGA ;exceeded number of retry, give E'E CLOSTEXT.(FD) O'E OLDTRY=OLDTRY+1 W'R (NUM.EQ.(N-1)) ;we got duplicate file header p TV1=BIGY TV2=0 TV3=0 E'E SPACK.(TV1,NUM,TV2,TV3) ;just ACK it NUMTRY=0 LCLSTATE=STATE O'E LCLSTATE=BIGA E'E CLOSTEXT.(FD) E'L E'L O'R (STATUS.EQ.BIGZ) ;we got the EOF packet W'R (NUM.NE.N) LCLSTATE=BIGA E'E CLOSTEXT.(FD) O'E TNUM=N TV1=BIGY TV2=0 TV3=0 E'E SPACK.(TV1,TNUM,TV2,TV3) ;ACK it E'E CLOSTEXT.(FD) ;close the receiving disk fi N = (N+1) .MOD. 64 LCLSTATE=BIGF ;change the state to look fo E'L O'R (STATUS.EQ.BAD) LCLSTATE=STATE ;there was an error in the TNUM=N ;checksum TV1=BIGN TV2=0 TV3=0 E'E SPACK.(TV1,TNUM,TV2,TV3) ;NAK it O'E LCLSTATE=BIGA ;we got a unknown packet type E'E CLOSTEXT.(FD) E'L ;gives up E'L F'N LCLSTATE E'N