home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / computervision / kermit.sdata < prev    next >
Text File  |  2020-01-01  |  3KB  |  85 lines

  1. ; 16 jly 85 esj converted
  2. ;;;;;;;;;;;;;;;;;             SDATA          ;;;;;;;;;;;;;
  3.       E'F A:S(NWLS)
  4.       E'O SDATA.(X)
  5.  
  6. ;     sends a data packet to other KERMIT
  7.  
  8. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERCOM
  9. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERDEF
  10.  
  11.       I'R X,NUM,LEN,STATUS,TNUM,TV1
  12.       I'R RECKPT(100)      ; packet to get the ack back in
  13.       I'R LCLSTATE         ; temp for returned state
  14.  
  15. #     E'E TYPMSG.($ IN SDATA !$)
  16.  
  17.       W'R (NUMTRY.GT.MAXTRY)
  18.          LCLSTATE=BIGA
  19.          E'E CLOSTEXT.(FD)
  20.          T'O GETOUT
  21.       O'E
  22.           NUMTRY=NUMTRY+1
  23.       E'L
  24.  
  25.       TNUM=N
  26.       TV1=BIGD
  27.  
  28.       E'E SPACK.(TV1,TNUM,SIZE,PACKET)    ;send that data packet
  29.  
  30.       STATUS=RPACK.(LEN,NUM,RECPKT)       ;get the reply
  31.  
  32.       E'E DODOT.                          ; tell all if ok
  33.  
  34. #      E'E TYPOUT.(2,'A000'.LOR.STATUS)
  35. #      E'E TYPEMSG.($  got dis status!$)
  36.  
  37. ;     the next statements is to make sure we are not one packet
  38. ;     ahead of other KERMIT, it will happen if other KERMIT send a NAK
  39. ;     (due to time-out detection feature) before we send the first
  40. ;     SINIT packet
  41.  
  42.       W'R ((STATUS.EQ.BIGY).AND.(N.EQ.(NUM+1)))
  43.           STATUS=RPACK.(LEN,NUM,RECKPT)
  44.       E'L
  45.  
  46.       W'R (STATUS.EQ.BIGN)               ;we got a NAK
  47.          W'R (N.NE.(NUM-1))
  48.             LCLSTATE=STATE                    ;to the right sequence #, tyr
  49.             T'O GETOUT
  50.           E'L
  51.  
  52.       O'R(STATUS.EQ.BIGY)          ;we got a ACK
  53.               W'R (N.NE.NUM)
  54.                  LCLSTATE=STATE               ;but, it was for the last pac
  55.                  T'O GETOUT
  56.               E'L
  57.  
  58.               NUMTRY=0
  59.               N=(N+1).MOD.64              ;increment frame sequence num
  60.               SIZE=BUFILL.(PACKET)          ;fill up more data onto buffe
  61.               W'R (SIZE.EQ.EOF)          ;we got EOF on the sending
  62.                  LCLSTATE=BIGZ                ;disk file, change state so t
  63.                  T'O GETOUT                    ;we can sent ane EOF packet
  64.               E'L
  65.  
  66.               LCLSTATE=BIGD                   ;we send the DATA packet, sen
  67.               T'O GETOUT
  68.  
  69.       O'R(STATUS.EQ.BAD)           ;we got a checksum error
  70.               LCLSTATE=STATE                  ;try it again
  71.               T'O GETOUT
  72.  
  73.       O'E
  74.            LCLSTATE=BIGA                      ;we got unknown packet type o
  75.            E'E CLOSTEXT.(FD)
  76.            T'O GETOUT
  77.  
  78.       E'L                                ;an error type packet
  79. GETOUT C'E
  80. #      E'E TYPOUT.(2,'A000'.LOR. LCLSTATE)
  81. #      E'E TYPEMSG.($ rdata exit state!$)
  82.  
  83.       F'N LCLSTATE
  84.       E'N
  85.