Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
ref:xmodem [2011/07/13 23:35] digitalmanref:xmodem [2011/07/13 23:49] (current) digitalman
Line 130: Line 130:
 this paper: this paper:
 <code> <code>
-          Name      Decimal        Hexadecimal    Description+      Name      Decimal        Hexadecimal    Description
  
-          SOH          01           H001          Start Of Header +      SOH          01           H001          Start Of Header 
-          EOT          04           H004          End Of Transmission +      EOT          04           H004          End Of Transmission 
-          ACK          06           H006          Acknowledge (positive) +      ACK          06           H006          Acknowledge (positive) 
-          DLE          16           H010          Data Link Escape +      DLE          16           H010          Data Link Escape 
-          X-On (DC1)   17           H011          Transmit On +      X-On (DC1)   17           H011          Transmit On 
-          X-Off(DC3)   19           H013          Transmit Off +      X-Off(DC3)   19           H013          Transmit Off 
-          NAK          21           H015          Negative Acknowledge +      NAK          21           H015          Negative Acknowledge 
-          SYN          22           H016          Synchronous idle +      SYN          22           H016          Synchronous idle 
-          CAN          24           H018          Cancel+      CAN          24           H018          Cancel
 </code> </code>
  
Line 150: Line 150:
 to say: to say:
  
-          "It was a quick hack I threw together, very unplanned (like +      "It was a quick hack I threw together, very unplanned (like 
-          everything I do), to satisfy a personal need to communicate +      everything I do), to satisfy a personal need to communicate 
-          with some other people.  ONLY the fact that it was done in +      with some other people.  ONLY the fact that it was done in 
-          8/77, and that I put it in the public domain immediately, +      8/77, and that I put it in the public domain immediately, 
-          made it become the standard that it is"....."People who +      made it become the standard that it is"....."People who 
-          suggest I make SIGNIFICANT changes to the protocol, such as +      suggest I make SIGNIFICANT changes to the protocol, such as 
-          'full duplex', 'multiple outstanding blocks', 'multiple +      'full duplex', 'multiple outstanding blocks', 'multiple 
-          destinations', etc etc don't understand that the incredible +      destinations', etc etc don't understand that the incredible 
-          simplicity of the protocol is one of the reasons it survived +      simplicity of the protocol is one of the reasons it survived 
-          to this day in as many machines and programs as it may be +      to this day in as many machines and programs as it may be 
-          found in!"+      found in!"
                  
  
Line 204: Line 204:
  
 <code> <code>
-          Transmitter                        Receiver+      Transmitter                        Receiver
  
-          [wait for one minute]         <    [NAK]+      [wait for one minute]         <    [NAK]
  
-          [begin block transmission]    >+      [begin block transmission]    >
 </code> </code>
  
Line 219: Line 219:
 The Xmodem Packet looks like this: The Xmodem Packet looks like this:
 <code> <code>
-               [SOH] [seq] [cmpl [seq] [128 data bytes] [csum]+       [SOH] [seq] [cmpl [seq] [128 data bytes] [csum]
  
-               SOH       Start of header character (decimal 1).+       SOH       Start of header character (decimal 1).
  
-               seq       one byte sequence number which starts at 1, and +       seq       one byte sequence number which starts at 1, and 
-                         increments by one until it reaches 255 and then +                 increments by one until it reaches 255 and then 
-                         wraps around to zero.+                 wraps around to zero.
  
-               cmpl seq  one byte 1's complement of seq.  This can be +       cmpl seq  one byte 1's complement of seq.  This can be 
-                         calculated as cmpl = 255 - (255 and seq) or using +                 calculated as cmpl = 255 - (255 and seq) or using 
-                         xor as cmpl = (255 and seq) xor 255.+                 xor as cmpl = (255 and seq) xor 255.
  
-               data      128, 8 bit bytes of data.  Note than when sending +       data      128, 8 bit bytes of data.  Note than when sending 
-                         CP/M and MS/DOS files a ^Z (decimal 26) must be +                 CP/M and MS/DOS files a ^Z (decimal 26) must be 
-                         added to then end of the file.  If the last block +                 added to then end of the file.  If the last block 
-                         of data is less than 128 bytes, the Xmodem packet +                 of data is less than 128 bytes, the Xmodem packet 
-                         must be padded with characters, usually ^Z's.+                 must be padded with characters, usually ^Z's.
  
-               csum      one byte sum of all of the data bytes where any +       csum      one byte sum of all of the data bytes where any 
-                         overflow or carry is discarded immediately.  For +                 overflow or carry is discarded immediately.  For 
-                         example, if the first 3 bytes are 255, 5 and 6 the +                 example, if the first 3 bytes are 255, 5 and 6 the 
-                         checksum after the first 3 bytes will be 10.+                 checksum after the first 3 bytes will be 10.
 </code> </code>
   
Line 263: Line 263:
 Let's look at a three block file transfer: Let's look at a three block file transfer:
 <code> <code>
-               Transmitter                                  Receiver+       Transmitter                                  Receiver
  
-                                             <<<<<          [NAK] +                                     <<<<<          [NAK] 
-               [SOH][001][255][...][csum]    >>>>> +       [SOH][001][255][...][csum]    >>>>> 
-                                             <<<<<          [ACK] +                                     <<<<<          [ACK] 
-               [SOH][002][254][...][csum]    >>>>> +       [SOH][002][254][...][csum]    >>>>> 
-                                             <<<<<          [ACK] +                                     <<<<<          [ACK] 
-               [SOH][003][253][...][csum]    >>>>> +       [SOH][003][253][...][csum]    >>>>> 
-                                             <<<<<          [ACK] +                                     <<<<<          [ACK] 
-               [EOT]                         >>>>> +       [EOT]                         >>>>> 
-                                             <<<<<          [ACK]+                                     <<<<<          [ACK]
 </code> </code>
 Seems easy, right?  And it is, until something goes wrong. Seems easy, right?  And it is, until something goes wrong.
Line 366: Line 366:
 end of transmission after receiving two EOT's. end of transmission after receiving two EOT's.
 <code> <code>
-                    Transmitter                   Receiver+        Transmitter                   Receiver
  
-                    [last block .. ]    >>>>> +        [last block .. ]    >>>>> 
-                                        <<<<<     [ACK] +                            <<<<<     [ACK] 
-                    [EOT]               >>>>> +        [EOT]               >>>>> 
-                                        <<<<<     [NAK] +                            <<<<<     [NAK] 
-                    [EOT]               >>>>> +        [EOT]               >>>>> 
-                                        <<<<<     [ACK]+                            <<<<<     [ACK]
 </code> </code>
 Just in case the transmitter was not prepared to resend the Just in case the transmitter was not prepared to resend the
Line 559: Line 559:
 === Rules === === Rules ===
  
- +1. The window is always 4 Xmodem packets.  That is, the transmitter will send 4 unacknowledged packets.  Transmission will not cease and the time out                         interval will not begin until 4 unacknowledged                         packets have been transmitted.  Note that the                         window may be less than 4   Xmodem packets for short                         files or at end-of-file. 
-1. The window is always 4 Xmodem packets.  That is,                         the transmitter will send 4 unacknowledged pack- +                         
-                         ets.  Transmission will not cease and the time out                         interval will not begin until 4 unacknowledged                         packets have been transmitted.  Note that the                         window may be less than 4   Xmodem packets for short                         files or at end-of-file.+
 2. The receiver will transmit acknowledgements in the form: 2. The receiver will transmit acknowledgements in the form:
  
Line 580: Line 579:
 example, after an unknown number of packets: example, after an unknown number of packets:
 <code> <code>
-                         Transmitter                             Receiver+         Transmitter                             Receiver
  
-                         .... +         .... 
-                         .... +         .... 
-                         .... +         .... 
-                         [Block Sequence Number H0FE] +         [Block Sequence Number H0FE] 
-                         [Block Sequence Number H0FF]            ACK[H002] +         [Block Sequence Number H0FF]            ACK[H002] 
-                         [Block Sequence Number H000]            ACK[H003] +         [Block Sequence Number H000]            ACK[H003] 
-                         [Block Sequence Number H001] +         [Block Sequence Number H001] 
-                         [Block Sequence Number H002]            ACK[H001] +         [Block Sequence Number H002]            ACK[H001] 
-                         .....+         .....
 </code> </code>
 Since some transmitters must close the window and Since some transmitters must close the window and
Line 600: Line 599:
  
   
- 
- 
  
 4. The receiver will reject a packet (request retransmission) by sending: 4. The receiver will reject a packet (request retransmission) by sending:
  
-                              NAK[sequence]+    NAK[sequence]
  
 Where [sequence] is then next window sequence Where [sequence] is then next window sequence
Line 633: Line 630:
 7. The timeout intervals at various points in processing are: 7. The timeout intervals at various points in processing are:
  
-Waiting for a character on receive, start of packet  not yet recognized:  +  * Waiting for a character on receive, start of packet  not yet recognized:   15 seconds 
-  15 seconds +  Waiting for a character on receive, start of packet has been recognized:   15 seconds 
-Waiting for a character on receive, start of packet has been recognized:      +  Waiting for an Ack or Nak on transmit side after the window has closed:    15 seconds4 
-  15 seconds +  Waiting for an X-On after receipt of an X-Off by the transmitter:          10 seconds
-Waiting for an Ack or Nak on transmit side after  the window has closed:    +
-  15 seconds4 +
-Waiting for an X-On after receipt of an X-Off by  the transmitter:          +
-  10 seconds+
  
 8. When the transmitter times out waiting for an ACK                         or NAK when the window is closed (e.g. four blocks                         have been transmitted), the transmitter will                         retransmit the last block transmitted and wait                         again.  Only after 10 consecutive timeouts have                         occurred will the transmitter cancel the transmission. 8. When the transmitter times out waiting for an ACK                         or NAK when the window is closed (e.g. four blocks                         have been transmitted), the transmitter will                         retransmit the last block transmitted and wait                         again.  Only after 10 consecutive timeouts have                         occurred will the transmitter cancel the transmission.
Line 698: Line 691:
 binary value (52) ends up in the first byte of I% and the second binary value (52) ends up in the first byte of I% and the second
 byte is zero. byte is zero.
-                                   Result +<code> 
- +                          Result
-               I%=0                [x'0000'+
-               I%=1                [x'0100'+
-               A$="A"              [x'41'+
-               I%=ASC(A$)          [x'4100'+
-               B$=MKI$(I%)         [x'4100' letter "A" then binary zero +
-               I%=CVI(CHR$(0)+A$)  [x'0041'+
-               A$=CHR$(65)         [x'41']+
  
 +      I%=0                [x'0000']
 +      I%=1                [x'0100']
 +      A$="A"              [x'41']
 +      I%=ASC(A$)          [x'4100']
 +      B$=MKI$(I%)         [x'4100' letter "A" then binary zero
 +      I%=CVI(CHR$(0)+A$)  [x'0041']
 +      A$=CHR$(65)         [x'41']
 +</code>
 Once this is understood, many problems with these algorithms goes    away. Once this is understood, many problems with these algorithms goes    away.
  
Line 874: Line 868:
 what its author has to say: what its author has to say:
  
-          "It was a quick hack I threw together, very unplanned (like +      "It was a quick hack I threw together, very unplanned (like 
-          everything I do), to satisfy a personal need to communicate +      everything I do), to satisfy a personal need to communicate 
-          with some other people.  ONLY the fact that it was done in +      with some other people.  ONLY the fact that it was done in 
-          8/77, and that I put it in the public domain immediately, +      8/77, and that I put it in the public domain immediately, 
-          made it become the standard that it is"....."People who +      made it become the standard that it is"....."People who 
-          suggest I make SIGNIFICANT changes to the protocol, such as +      suggest I make SIGNIFICANT changes to the protocol, such as 
-          'full duplex', 'multiple outstanding blocks', 'multiple +      'full duplex', 'multiple outstanding blocks', 'multiple 
-          destinations', etc etc don't understand that the incredible +      destinations', etc etc don't understand that the incredible 
-          simplicity of the protocol is one of the reasons it survived +      simplicity of the protocol is one of the reasons it survived 
-          to this day in as many machines and programs as it may be +      to this day in as many machines and programs as it may be 
-          found in!"+      found in!"
  
 Ward Christensen, quoted from a message posted on CompuServe Ward Christensen, quoted from a message posted on CompuServe