; 16 jly 85 esj converted ;;;;;;;;;;;;;;;;; SDATA ;;;;;;;;;;;;; E'F A:S(NWLS) E'O SDATA.(X) ; sends a data packet to other KERMIT /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERCOM /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERDEF I'R X,NUM,LEN,STATUS,TNUM,TV1 I'R RECKPT(100) ; packet to get the ack back in I'R LCLSTATE ; temp for returned state # E'E TYPMSG.($ IN SDATA !$) W'R (NUMTRY.GT.MAXTRY) LCLSTATE=BIGA E'E CLOSTEXT.(FD) T'O GETOUT O'E NUMTRY=NUMTRY+1 E'L TNUM=N TV1=BIGD E'E SPACK.(TV1,TNUM,SIZE,PACKET) ;send that data packet STATUS=RPACK.(LEN,NUM,RECPKT) ;get the reply E'E DODOT. ; tell all if ok # E'E TYPOUT.(2,'A000'.LOR.STATUS) # E'E TYPEMSG.($ got dis status!$) ; the next statements is to make sure we are not one packet ; ahead of other KERMIT, it will happen if other KERMIT send a NAK ; (due to time-out detection feature) before we send the first ; SINIT packet W'R ((STATUS.EQ.BIGY).AND.(N.EQ.(NUM+1))) STATUS=RPACK.(LEN,NUM,RECKPT) E'L W'R (STATUS.EQ.BIGN) ;we got a NAK W'R (N.NE.(NUM-1)) LCLSTATE=STATE ;to the right sequence #, tyr T'O GETOUT E'L O'R(STATUS.EQ.BIGY) ;we got a ACK W'R (N.NE.NUM) LCLSTATE=STATE ;but, it was for the last pac T'O GETOUT E'L NUMTRY=0 N=(N+1).MOD.64 ;increment frame sequence num SIZE=BUFILL.(PACKET) ;fill up more data onto buffe W'R (SIZE.EQ.EOF) ;we got EOF on the sending LCLSTATE=BIGZ ;disk file, change state so t T'O GETOUT ;we can sent ane EOF packet E'L LCLSTATE=BIGD ;we send the DATA packet, sen T'O GETOUT O'R(STATUS.EQ.BAD) ;we got a checksum error LCLSTATE=STATE ;try it again T'O GETOUT O'E LCLSTATE=BIGA ;we got unknown packet type o E'E CLOSTEXT.(FD) T'O GETOUT E'L ;an error type packet GETOUT C'E # E'E TYPOUT.(2,'A000'.LOR. LCLSTATE) # E'E TYPEMSG.($ rdata exit state!$) F'N LCLSTATE E'N