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
Next revisionBoth sides next revision
ref:ymodem [2011/07/13 20:50] digitalmanref:ymodem [2011/07/13 21:16] digitalman
Line 187: Line 187:
 ==== Some Messages from the Pioneer ==== ==== Some Messages from the Pioneer ====
  
 +<code>
     #: 130940 S0/Communications 25-Apr-85  18:38:47     #: 130940 S0/Communications 25-Apr-85  18:38:47
     Sb: my protocol     Sb: my protocol
-    Fm: Ward Christensen 76703,302 ((Edited for typesetting appearance))+    Fm: Ward Christensen 76703,302
     To: all     To: all
  
-    Be aware the article((Infoworld April 29 p. 16)) DID quote me correctly in terms of the phrases +    Be aware the article (Infoworld April 29 p. 16) DID quote me correctly 
-    like "not robust", etc.+    in terms of the phrases like "not robust", etc.
  
     It was a quick hack I threw together, very unplanned (like everything I     It was a quick hack I threw together, very unplanned (like everything I
Line 209: Line 210:
     (2) propose an "incremental extension" to it, which might take "exactly"     (2) propose an "incremental extension" to it, which might take "exactly"
     the form of Chuck Forsberg's YAM protocol.  He wrote YAM in C for CP/M and     the form of Chuck Forsberg's YAM protocol.  He wrote YAM in C for CP/M and
-    put it in the public domain, and wrote a batch protocol for Unix((VAX/VMS versions of these programs are also available)) called+    put it in the public domain, and wrote a batch protocol for Unix called
     rb and sb (receive batch, send batch), which was basically XMODEM with     rb and sb (receive batch, send batch), which was basically XMODEM with
        (a) a record 0 containing filename date time and size        (a) a record 0 containing filename date time and size
Line 235: Line 236:
     called rb and sb - receive batch and send batch.  They cleverly send a     called rb and sb - receive batch and send batch.  They cleverly send a
     "block 0" which contains the filename, date, time, and size.     "block 0" which contains the filename, date, time, and size.
-    Unfortunately, its UNIX style, and is a bit weird((The file length, time, and file mode are optional.  The pathname and file length may be sent alone if desired.)) - octal numbers, etc.+    Unfortunately, its UNIX style, and is a bit weird - octal numbers, etc.
     BUT, it is a nice way to overcome the kludgy "echo the chars of the name"     BUT, it is a nice way to overcome the kludgy "echo the chars of the name"
     introduced with MODEM7.  Further, chuck uses CRC-16 and optional 1K     introduced with MODEM7.  Further, chuck uses CRC-16 and optional 1K
Line 254: Line 255:
     CIS it detects the "busy" string back from the modem and substitutes a     CIS it detects the "busy" string back from the modem and substitutes a
     diff phone # into the dialing string and branches back to try it.     diff phone # into the dialing string and branches back to try it.
 +</code>
  
 ===== XMODEM Protocol Enhancements ===== ===== XMODEM Protocol Enhancements =====
Line 606: Line 608:
     |___________|________|______|______|_____|________|__________|     |___________|________|______|______|_____|________|__________|
  
-=== KMD/IMP Exceptions to YMODEM ===+==== KMD/IMP Exceptions to YMODEM ====
  
-    KMD and IMP use a "CK" character sequence emitted by the receiver to +KMD and IMP use a "CK" character sequence emitted by the receiver to 
-    trigger the use of 1024 byte blocks as an alternative to specifying this +trigger the use of 1024 byte blocks as an alternative to specifying this 
-    option to the sending program.  Although this two character sequence works +option to the sending program.  Although this two character sequence works 
-    well on single process micros in direct communication, timesharing systems +well on single process micros in direct communication, timesharing systems 
-    and packet switched networks can separate the successive characters by +and packet switched networks can separate the successive characters by 
-    several seconds, rendering this method unreliable.+several seconds, rendering this method unreliable.
  
-    Sending programs may detect the CK sequence if the operating enviornment +Sending programs may detect the CK sequence if the operating enviornment 
-    does not preclude reliable implementation.+does not preclude reliable implementation.
  
-    Instead of the standard YMODEM file length, KMD and IMP transmit the CP/M +Instead of the standard YMODEM file length, KMD and IMP transmit the CP/M 
-    record count in the last two bytes of the header block.+record count in the last two bytes of the header block.
  
- +===== YMODEM-g File Transmission =====
- +
- +
- +
- +
- +
- +
- +
- +
-    Chapter 6                                     XMODEM Protocol Enhancements +
- +
- +
- +
- +
- +
- +
- +
-    X/YMODEM Protocol Reference      10-27-87                               17 +
- +
- +
- +
-    6.  YMODEM-g File Transmission+
  
     Developing technology is providing phone line data transmission at ever     Developing technology is providing phone line data transmission at ever
Line 688: Line 669:
  
  
 +===== XMODEM Protocol Overview =====
  
 +8/9/82 by Ward Christensen.
  
 +I will maintain a master copy of this.  Please pass on changes or
 +suggestions via CBBS/Chicago at (312) 545-8086, CBBS/CPMUG (312) 849-1132
 +or by voice at (312) 849-6279.
  
- +==== Definitions ====
- +
- +
- +
- +
-    Chapter 6                                     XMODEM Protocol Enhancements +
- +
- +
- +
- +
- +
- +
- +
-    X/YMODEM Protocol Reference      10-27-87                               18 +
- +
- +
- +
-    7.  XMODEM PROTOCOL OVERVIEW +
- +
-    8/9/82 by Ward Christensen. +
- +
-    I will maintain a master copy of this.  Please pass on changes or +
-    suggestions via CBBS/Chicago at (312) 545-8086, CBBS/CPMUG (312) 849-1132 +
-    or by voice at (312) 849-6279. +
- +
-    7.1  Definitions+
  
       <soh> 01H       <soh> 01H
Line 726: Line 687:
  
  
-    7.2  Transmission Medium Level Protocol +==== Transmission Medium Level Protocol ====
- +
-    Asynchronous, 8 data bits, no parity, one stop bit. +
- +
-    The protocol imposes no restrictions on the contents of the data being +
-    transmitted.  No control characters are looked for in the 128-byte data +
-    messages.  Absolutely any kind of data may be sent - binary, ASCII, etc. +
-    The protocol has not formally been adopted to a 7-bit environment for the +
-    transmission of ASCII-only (or unpacked-hex) data , although it could be +
-    simply by having both ends agree to AND the protocol-dependent data with +
-    7F hex before validating it.  I specifically am referring to the checksum, +
-    and the block numbers and their ones- complement. +
- +
-    Those wishing to maintain compatibility of the CP/M file structure, i.e. +
-    to allow modemming ASCII files to or from CP/M systems should follow this +
-    data format: +
- +
-       + ASCII tabs used (09H); tabs set every 8. +
- +
-       + Lines terminated by CR/LF (0DH 0AH) +
- +
-       + End-of-file indicated by ^Z, 1AH.  (one or more) +
- +
-       + Data is variable length, i.e. should be considered a continuous +
-         stream of data bytes, broken into 128-byte chunks purely for the +
-         purpose of transmission. +
- +
-       + A CP/M "peculiarity": If the data ends exactly on a 128-byte +
-         boundary, i.e. CR in 127, and LF in 128, a subsequent sector +
-         containing the ^Z EOF character(s) is optional, but is preferred. +
-         Some utilities or user programs still do not handle EOF without ^Zs. +
- +
- +
- +
- +
- +
-    Chapter 7                                         Xmodem Protocol Overview +
- +
- +
- +
- +
- +
  
-    X/YMODEM Protocol Reference      10-27-87                               19+Asynchronous, 8 data bits, no parity, one stop bit.
  
 +The protocol imposes no restrictions on the contents of the data being
 +transmitted.  No control characters are looked for in the 128-byte data
 +messages.  Absolutely any kind of data may be sent - binary, ASCII, etc.
 +The protocol has not formally been adopted to a 7-bit environment for the
 +transmission of ASCII-only (or unpacked-hex) data , although it could be
 +simply by having both ends agree to AND the protocol-dependent data with
 +7F hex before validating it.  I specifically am referring to the checksum,
 +and the block numbers and their ones- complement.
  
 +Those wishing to maintain compatibility of the CP/M file structure, i.e.
 +to allow modemming ASCII files to or from CP/M systems should follow this
 +data format:
  
-       The last block sent is no different from others, i.e.  there is no +  * ASCII tabs used (09H); tabs set every 8. 
-         "short block".+  * Lines terminated by CR/LF (0DH 0AH) 
 +  * End-of-file indicated by ^Z, 1AH.  (one or more) 
 +  * Data is variable length, i.e. should be considered a continuous stream of data bytes, broken into 128-byte chunks purely for the      purpose of transmission. 
 +  * A CP/M "peculiarity": If the data ends exactly on a 128-byte boundary, i.e. CR in 127, and LF in 128, a subsequent sector         containing the ^Z EOF character(s) is optional, but is preferred. Some utilities or user programs still do not handle EOF without ^Zs. 
 +  * The last block sent is no different from others, i.e.  there is no "short block". 
 + 
                   Figure 8.  XMODEM Message Block Level Protocol                   Figure 8.  XMODEM Message Block Level Protocol
  
Line 789: Line 724:
     <cksum>       = the sum of the data bytes only.  Toss any carry.     <cksum>       = the sum of the data bytes only.  Toss any carry.
  
-    7.3  File Level Protocol+==== File Level Protocol====
  
-    7.3.1  Common_to_Both_Sender_and_Receiver +=== Common_to_Both_Sender_and_Receiver === 
-    All errors are retried 10 times.  For versions running with an operator +All errors are retried 10 times.  For versions running with an operator 
-    (i.e. NOT with XMODEM), a message is typed after 10 errors asking the +(i.e. NOT with XMODEM), a message is typed after 10 errors asking the 
-    operator whether to "retry or quit".+operator whether to "retry or quit".
  
-    Some versions of the protocol use <can>, ASCII ^X, to cancel transmission. +Some versions of the protocol use <can>, ASCII ^X, to cancel transmission. 
-    This was never adopted as a standard, as having a single "abort" character +This was never adopted as a standard, as having a single "abort" character 
-    makes the transmission susceptible to false termination due to an <ack> +makes the transmission susceptible to false termination due to an <ack> 
-    <nak> or <soh> being corrupted into a <can> and aborting transmission.+<nak> or <soh> being corrupted into a <can> and aborting transmission.
  
-    The protocol may be considered "receiver driven", that is, the sender need +The protocol may be considered "receiver driven", that is, the sender need 
-    not automatically re-transmit, although it does in the current +not automatically re-transmit, although it does in the current 
-    implementations.+implementations.
  
  
-    7.3.2  Receive_Program_Considerations +=== Receive_Program_Considerations === 
-    The receiver has a 10-second timeout.  It sends a <nak> every time it +The receiver has a 10-second timeout.  It sends a <nak> every time it 
-    times out.  The receiver's first timeout, which sends a <nak>, signals the +times out.  The receiver's first timeout, which sends a <nak>, signals the 
-    transmitter to start.  Optionally, the receiver could send a <nak> +transmitter to start.  Optionally, the receiver could send a <nak> 
-    immediately, in case the sender was ready.  This would save the initial 10 +immediately, in case the sender was ready.  This would save the initial 10 
-    second timeout.  However, the receiver MUST continue to timeout every 10 +second timeout.  However, the receiver MUST continue to timeout every 10 
-    seconds in case the sender wasn't ready.+seconds in case the sender wasn't ready.
  
-    Once into a receiving a block, the receiver goes into a one-second timeout +Once into a receiving a block, the receiver goes into a one-second timeout 
-    for each character and the checksum.  If the receiver wishes to <nak> a +for each character and the checksum.  If the receiver wishes to <nak> a 
-    block for any reason (invalid header, timeout receiving data), it must +block for any reason (invalid header, timeout receiving data), it must 
-    wait for the line to clear.  See "programming tips" for ideas+wait for the line to clear.  See "programming tips" for ideas
  
-    Synchronizing:  If a valid block number is received, it will be: 1) the +== Synchronizing == 
-    expected one, in which case everything is fine; or 2) a repeat of the +If a valid block number is received, it will be: 1) the 
-    previously received block.  This should be considered OK, and only +expected one, in which case everything is fine; or 2) a repeat of the 
-    indicates that the receivers <ack> got glitched, and the sender re- +previously received block.  This should be considered OK, and only 
-    transmitted; 3) any other block number indicates a fatal loss of +indicates that the receivers <ack> got glitched, and the sender re- 
-    synchronization, such as the rare case of the sender getting a line-glitch+transmitted; 3) any other block number indicates a fatal loss of 
 +synchronization, such as the rare case of the sender getting a line-glitch 
 +that looked like an <ack> Abort the transmission, sending a <can>
  
  
 +=== Sending_program_considerations ===
 +While waiting for transmission to begin, the sender has only a single very
 +long timeout, say one minute.  In the current protocol, the sender has a
 +10 second timeout before retrying.  I suggest NOT doing this, and letting
 +the protocol be completely receiver-driven.  This will be compatible with
 +existing programs.
  
-    Chapter 7                                         Xmodem Protocol Overview+When the sender has no more data, it sends an <eot>, and awaits an <ack>, 
 +resending the <eot> if it doesn't get one.  Again, the protocol could be 
 +receiver-driven, with the sender only having the high-level 1-minute 
 +timeout to abort.
  
  
- +Here is a sample of the data flow, sending a 3-block message.  It includes 
- +the two most common line hits - a garbaged block, and an <ack> reply 
- +getting garbaged.  <xx> represents the checksum byte.
- +
- +
-    X/YMODEM Protocol Reference      10-27-87                               20 +
- +
- +
- +
-    that looked like an <ack> Abort the transmission, sending a <can> +
- +
- +
-    7.3.3  Sending_program_considerations +
-    While waiting for transmission to begin, the sender has only a single very +
-    long timeout, say one minute.  In the current protocol, the sender has a +
-    10 second timeout before retrying.  I suggest NOT doing this, and letting +
-    the protocol be completely receiver-driven.  This will be compatible with +
-    existing programs. +
- +
-    When the sender has no more data, it sends an <eot>, and awaits an <ack>, +
-    resending the <eot> if it doesn't get one.  Again, the protocol could be +
-    receiver-driven, with the sender only having the high-level 1-minute +
-    timeout to abort. +
- +
- +
-    Here is a sample of the data flow, sending a 3-block message.  It includes +
-    the two most common line hits - a garbaged block, and an <ack> reply +
-    getting garbaged.  <xx> represents the checksum byte.+
  
                   Figure 9.  Data flow including Error Recovery                   Figure 9.  Data flow including Error Recovery
Line 880: Line 801:
     (finished)     (finished)
  
-    7.4  Programming Tips+==== Programming Tips ====
  
-       The character-receive subroutine should be called with a parameter +  * The character-receive subroutine should be called with a parameter specifying the number of seconds to wait.  The receiver should first call it with a time of 10, then <nak> and try again, 10 times.
-         specifying the number of seconds to wait.  The receiver should first +
-         call it with a time of 10, then <nak> and try again, 10 times.+
  
-         After receiving the <soh>, the receiver should call the character +After receiving the <soh>, the receiver should call the character 
-         receive subroutine with a 1-second timeout, for the remainder of the +receive subroutine with a 1-second timeout, for the remainder of the 
-         message and the <cksum> Since they are sent as a continuous stream, +message and the <cksum> Since they are sent as a continuous stream, 
-         timing out of this implies a serious like glitch that caused, say, +timing out of this implies a serious like glitch that caused, say, 
-         127 characters to be seen instead of 128.+127 characters to be seen instead of 128.
  
  
 +  *  When the receiver wishes to <nak>, it should call a "PURGE" subroutine, to wait for the line to clear.  Recall the sender tosses   any characters in its UART buffer immediately upon completing sending a block, to ensure no glitches were mis- interpreted.
  
-    Chapter 7                                         Xmodem Protocol Overview+The most common technique is for "PURGE" to call the character 
 +receive subroutine, specifying a 1-second timeout,((These times should be adjusted for use with timesharing systems. 
 +)) and looping 
 +back to PURGE until a timeout occurs.  The <nak> is then sent, 
 +ensuring the other end will see it.
  
 +   * You may wish to add code recommended by John Mahr to your character receive routine - to set an error flag if the UART shows framing         error, or overrun.  This will help catch a few more glitches - the         most common of which is a hit in the high bits of the byte in two         consecutive bytes.  The <cksum> comes out OK since counting in 1-byte         produces the same result of adding 80H + 80H as with adding 00H + 00H.
  
 +===== XMODEM/CRC Overview =====
  
 +Original 1/13/85 by John Byrns -- CRC option.
  
 +Please pass on any reports of errors in this document or suggestions for
 +improvement to me via Ward's/CBBS at (312) 849-1132, or by voice at (312) 885-1105.
  
 +The CRC used in the Modem Protocol is an alternate form of block check
 +which provides more robust error detection than the original checksum.
 +Andrew S. Tanenbaum says in his book, Computer Networks, that the CRC-
 +CCITT used by the Modem Protocol will detect all single and double bit
 +errors, all errors with an odd number of bits, all burst errors of length
 +16 or less, 99.997% of 17-bit error bursts, and 99.998% of 18-bit and
 +longer bursts.((This reliability figure is misleading because XMODEM's critical supervisory functions are not protected by this CRC.))
  
  
-    X/YMODEM Protocol Reference      10-27-87                               21 +The changes to the Modem Protocol to replace the checksum with the CRC are 
- +straight forward. If that were all that we did we would not be able to 
- +communicate between a program using the old checksum protocol and one 
- +using the new CRC protocol. An initial handshake was added to solve this 
-       + When the receiver wishes to <nak>, it should call a "PURGE" +problem. The handshake allows a receiving program with CRC capability to 
-         subroutine, to wait for the line to clear.  Recall the sender tosses +determine whether the sending program supports the CRC option, and to 
-         any characters in its UART buffer immediately upon completing sending +switch it to CRC mode if it does. This handshake is designed so that it 
-         a block, to ensure no glitches were mis- interpreted. +will work properly with programs which implement only the original 
- +protocol. A description of this handshake is presented in section 10.
-         The most common technique is for "PURGE" to call the character +
-         receive subroutine, specifying a 1-second timeout,[1] and looping +
-         back to PURGE until a timeout occurs.  The <nak> is then sent, +
-         ensuring the other end will see it. +
- +
-       + You may wish to add code recommended by John Mahr to your character +
-         receive routine - to set an error flag if the UART shows framing +
-         error, or overrun.  This will help catch a few more glitches - the +
-         most common of which is a hit in the high bits of the byte in two +
-         consecutive bytes.  The <cksum> comes out OK since counting in 1-byte +
-         produces the same result of adding 80H + 80H as with adding 00H + +
-         00H. +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
-    __________ +
- +
-     1. These times should be adjusted for use with timesharing systems. +
- +
- +
- +
- +
-    Chapter 7                                         Xmodem Protocol Overview +
- +
- +
- +
- +
- +
- +
- +
-    X/YMODEM Protocol Reference      10-27-87                               22 +
- +
- +
- +
-    8.  XMODEM/CRC Overview +
- +
-    Original 1/13/85 by John Byrns -- CRC option. +
- +
-    Please pass on any reports of errors in this document or suggestions for +
-    improvement to me via Ward's/CBBS at (312) 849-1132, or by voice at (312) +
-    885-1105. +
- +
-    The CRC used in the Modem Protocol is an alternate form of block check +
-    which provides more robust error detection than the original checksum. +
-    Andrew S. Tanenbaum says in his book, Computer Networks, that the CRC- +
-    CCITT used by the Modem Protocol will detect all single and double bit +
-    errors, all errors with an odd number of bits, all burst errors of length +
-    16 or less, 99.997% of 17-bit error bursts, and 99.998% of 18-bit and +
-    longer bursts.[1] +
- +
-    The changes to the Modem Protocol to replace the checksum with the CRC are +
-    straight forward. If that were all that we did we would not be able to +
-    communicate between a program using the old checksum protocol and one +
-    using the new CRC protocol. An initial handshake was added to solve this +
-    problem. The handshake allows a receiving program with CRC capability to +
-    determine whether the sending program supports the CRC option, and to +
-    switch it to CRC mode if it does. This handshake is designed so that it +
-    will work properly with programs which implement only the original +
-    protocol. A description of this handshake is presented in section 10.+
  
                 Figure 10.  Message Block Level Protocol, CRC mode                 Figure 10.  Message Block Level Protocol, CRC mode
Line 1010: Line 860:
     <CRC lo>     = byte containing the 8 lo order coefficients of the CRC.     <CRC lo>     = byte containing the 8 lo order coefficients of the CRC.
  
-    8.1  CRC Calculation +==== CRC Calculation ====
- +
-    8.1.1  Formal_Definition +
-    To calculate the 16 bit CRC the message bits are considered to be the +
-    coefficients of a polynomial. This message polynomial is first multiplied +
-    by X^16 and then divided by the generator polynomial (X^16 + X^12 + X^5 + +
- +
- +
-    __________ +
- +
-     1. This reliability figure is misleading because XMODEM's critical +
-        supervisory functions are not protected by this CRC. +
- +
- +
- +
- +
-    Chapter 8                                         Xmodem Protocol Overview +
- +
- +
- +
- +
- +
- +
- +
-    X/YMODEM Protocol Reference      10-27-87                               23 +
- +
  
-    1) using modulo two arithmetic. The remainder left after the division is +=== Formal_Definition === 
-    the desired CRC. Since a message block in the Modem Protocol is 128 bytes +To calculate the 16 bit CRC the message bits are considered to be the 
-    or 1024 bits, the message polynomial will be of order X^1023. The hi order +coefficients of a polynomial. This message polynomial is first multiplied 
-    bit of the first byte of the message block is the coefficient of X^1023 in +by X^16 and then divided by the generator polynomial (X^16 + X^12 + X^5 + 
-    the message polynomial.  The lo order bit of the last byte of the message +1) using modulo two arithmetic. The remainder left after the division is 
-    block is the coefficient of X^0 in the message polynomial.+the desired CRC. Since a message block in the Modem Protocol is 128 bytes 
 +or 1024 bits, the message polynomial will be of order X^1023. The hi order 
 +bit of the first byte of the message block is the coefficient of X^1023 in 
 +the message polynomial.  The lo order bit of the last byte of the message 
 +block is the coefficient of X^0 in the message polynomial.
  
                Figure 11.  Example of CRC Calculation written in C                Figure 11.  Example of CRC Calculation written in C
Line 1073: Line 901:
     }     }
  
-    8.2  CRC File Level Protocol Changes+==== CRC File Level Protocol Changes ====
  
-    8.2.1  Common_to_Both_Sender_and_Receiver +=== Common_to_Both_Sender_and_Receiver === 
-    The only change to the File Level Protocol for the CRC option is the +The only change to the File Level Protocol for the CRC option is the 
-    initial handshake which is used to determine if both the sending and the +initial handshake which is used to determine if both the sending and the 
-    receiving programs support the CRC mode. All Modem Programs should support +receiving programs support the CRC mode. All Modem Programs should support 
-    the checksum mode for compatibility with older versions.  A receiving +the checksum mode for compatibility with older versions.  A receiving 
-    program that wishes to receive in CRC mode implements the mode setting +program that wishes to receive in CRC mode implements the mode setting 
-    handshake by sending a <C> in place of the initial <nak> If the sending +handshake by sending a <C> in place of the initial <nak> If the sending 
-    program supports CRC mode it will recognize the <C> and will set itself +program supports CRC mode it will recognize the <C> and will set itself 
-    into CRC mode, and respond by sending the first block as if a <nak> had +into CRC mode, and respond by sending the first block as if a <nak> had 
-    been received. If the sending program does not support CRC mode it will +been received. If the sending program does not support CRC mode it will 
-    not respond to the <C> at all. After the receiver has sent the <C> it will +not respond to the <C> at all. After the receiver has sent the <C> it will 
-    wait up to 3 seconds for the <soh> that starts the first block. If it +wait up to 3 seconds for the <soh> that starts the first block. If it 
-    receives a <soh> within 3 seconds it will assume the sender supports CRC +receives a <soh> within 3 seconds it will assume the sender supports CRC 
-    mode and will proceed with the file exchange in CRC mode. If no <soh> is+mode and will proceed with the file exchange in CRC mode. If no <soh> is 
 +received within 3 seconds the receiver will switch to checksum mode, send 
 +a <nak>, and proceed in checksum mode. If the receiver wishes to use 
 +checksum mode it should send an initial <nak> and the sending program 
 +should respond to the <nak> as defined in the original Modem Protocol. 
 +After the mode has been set by the initial <C> or <nak> the protocol 
 +follows the original Modem Protocol and is identical whether the checksum 
 +or CRC is being used.
  
  
 +=== Receive_Program_Considerations ===
 +There are at least 4 things that can go wrong with the mode setting
 +handshake.
  
-    Chapter 8                                         Xmodem Protocol Overview+  -  the initial <C> can be garbled or lost.
  
 +  -  the initial <soh> can be garbled.
  
 +  -  the initial <C> can be changed to a <nak>.
  
 +  -  the initial <nak> from a receiver which wants to receive in checksum      can be changed to a <C>.
  
 +The first problem can be solved if the receiver sends a second <C> after
 +it times out the first time. This process can be repeated several times.
 +It must not be repeated too many times before sending a <nak> and
 +switching to checksum mode or a sending program without CRC support may
 +time out and abort. Repeating the <C> will also fix the second problem if
 +the sending program cooperates by responding as if a <nak> were received
 +instead of ignoring the extra <C>.
  
 +It is possible to fix problems 3 and 4 but probably not worth the trouble
 +since they will occur very infrequently. They could be fixed by switching
 +modes in either the sending or the receiving program after a large number
 +of successive <nak>s. This solution would risk other problems however.
  
  
-    X/YMODEM Protocol Reference      10-27-87                               24+=== Sending_Program_Considerations === 
 +The sending program should start in the checksum mode. This will insure 
 +compatibility with checksum only receiving programs. Anytime a <C> is 
 +received before the first <nak> or <ack> the sending program should set 
 +itself into CRC mode and respond as if a <nak> were received. The sender 
 +should respond to additional <C>s as if they were <nak>s until the first 
 +<ack> is received. This will assist the receiving program in determining 
 +the correct mode when the <soh> is lost or garbled. After the first <ack> 
 +is received the sending program should ignore <C>s.
  
  
- +==== Data Flow Examples with CRC Option ==== 
-    received within 3 seconds the receiver will switch to checksum mode, send +Here is a data flow example for the case where the receiver requests 
-    a <nak>, and proceed in checksum mode. If the receiver wishes to use +transmission in the CRC mode but the sender does not support the CRC 
-    checksum mode it should send an initial <nak> and the sending program +option. This example also includes various transmission errors.  <xx> 
-    should respond to the <nak> as defined in the original Modem Protocol. +represents the checksum byte.
-    After the mode has been set by the initial <C> or <nak> the protocol +
-    follows the original Modem Protocol and is identical whether the checksum +
-    or CRC is being used. +
- +
- +
-    8.2.2  Receive_Program_Considerations +
-    There are at least 4 things that can go wrong with the mode setting +
-    handshake. +
- +
-      1.  the initial <C> can be garbled or lost. +
- +
-      2.  the initial <soh> can be garbled. +
- +
-      3.  the initial <C> can be changed to a <nak>+
- +
-      4.  the initial <nak> from a receiver which wants to receive in checksum +
-          can be changed to a <C>+
- +
-    The first problem can be solved if the receiver sends a second <C> after +
-    it times out the first time. This process can be repeated several times. +
-    It must not be repeated too many times before sending a <nak> and +
-    switching to checksum mode or a sending program without CRC support may +
-    time out and abort. Repeating the <C> will also fix the second problem if +
-    the sending program cooperates by responding as if a <nak> were received +
-    instead of ignoring the extra <C>+
- +
-    It is possible to fix problems 3 and 4 but probably not worth the trouble +
-    since they will occur very infrequently. They could be fixed by switching +
-    modes in either the sending or the receiving program after a large number +
-    of successive <nak>s. This solution would risk other problems however. +
- +
- +
-    8.2.3  Sending_Program_Considerations +
-    The sending program should start in the checksum mode. This will insure +
-    compatibility with checksum only receiving programs. Anytime a <C> is +
-    received before the first <nak> or <ack> the sending program should set +
-    itself into CRC mode and respond as if a <nak> were received. The sender +
-    should respond to additional <C>s as if they were <nak>s until the first +
-    <ack> is received. This will assist the receiving program in determining +
-    the correct mode when the <soh> is lost or garbled. After the first <ack> +
-    is received the sending program should ignore <C>s. +
- +
- +
- +
- +
- +
- +
- +
- +
- +
-    Chapter 8                                         Xmodem Protocol Overview +
- +
- +
- +
- +
- +
- +
- +
-    X/YMODEM Protocol Reference      10-27-87                               25 +
- +
- +
- +
-    8.3  Data Flow Examples with CRC Option +
- +
-    Here is a data flow example for the case where the receiver requests +
-    transmission in the CRC mode but the sender does not support the CRC +
-    option. This example also includes various transmission errors.  <xx> +
-    represents the checksum byte.+
  
           Figure 12.  Data Flow: Receiver has CRC Option, Sender Doesn't           Figure 12.  Data Flow: Receiver has CRC Option, Sender Doesn't
Line 1204: Line 996:
                             <---                <ack>                             <---                <ack>
  
-    Here is a data flow example for the case where the receiver requests +Here is a data flow example for the case where the receiver requests 
-    transmission in the CRC mode and the sender supports the CRC option.  This +transmission in the CRC mode and the sender supports the CRC option.  This 
-    example also includes various transmission errors.  <xxxx> represents the +example also includes various transmission errors.  <xxxx> represents the 
-    2 CRC bytes. +2 CRC bytes.
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
-    Chapter 8                                         Xmodem Protocol Overview +
- +
- +
- +
- +
- +
- +
- +
-    X/YMODEM Protocol Reference      10-27-87                               26 +
- +
  
                Figure 13.  Receiver and Sender Both have CRC Option                Figure 13.  Receiver and Sender Both have CRC Option
Line 1256: Line 1021:
  
  
 +===== More Information =====
  
 +Please contact Omen Technology for troff source files and typeset copies
 +of this document.
  
  
 +==== TeleGodzilla Bulletin Board ====
 +More information may be obtained by calling TeleGodzilla at 503-621-3746.
 +Speed detection is automatic for 1200, 2400 and 19200(Telebit PEP) bps.
 +TrailBlazer modem users may issue the TeleGodzilla trailblazer command to
 +swith to 19200 bps once they have logged in.
  
 +Interesting files include RZSZ.ZOO (C source code), YZMODEM.ZOO (Official
 +XMODEM, YMODEM, and ZMODEM protocol descriptions), ZCOMMEXE.ARC,
 +ZCOMMDOC.ARC, and ZCOMMHLP.ARC (PC-DOS shareware comm program with XMODEM,
 +True YMODEM(TM), ZMODEM, Kermit Sliding Windows, Telink, MODEM7 Batch,
 +script language, etc.).
  
  
 +==== Unix UUCP Access ====
  
 +UUCP sites can obtain the current version of this file with
 +    uucp omen!/u/caf/public/ymodem.doc /tmp
 +A continually updated list of available files is stored in
 +    /usr/spool/uucppublic/FILES.
 +When retrieving these files with uucp,
 +remember that the destination directory on your system must be writeable
 +by anyone, or the UUCP transfer will fail.
  
 +The following L.sys line calls TeleGodzilla (Pro-YAM in host operation).
 +TeleGodzilla determines the incoming speed automatically.
  
 +In response to "Name Please:" uucico gives the Pro-YAM "link" command as a
 +user name.  The password (Giznoid) controls access to the Xenix system
 +connected to the IBM PC's other serial port.  Communications between
 +Pro-YAM and Xenix use 9600 bps; YAM converts this to the caller's speed.
  
- +Finally, the calling uucico logs in as uucp.
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
-    Chapter 8                                         Xmodem Protocol Overview +
- +
- +
- +
- +
- +
- +
- +
-    X/YMODEM Protocol Reference      10-27-87                               27 +
- +
- +
- +
-    9.  MORE INFORMATION +
- +
-    Please contact Omen Technology for troff source files and typeset copies +
-    of this document. +
- +
- +
-    9.1  TeleGodzilla Bulletin Board +
- +
-    More information may be obtained by calling TeleGodzilla at 503-621-3746. +
-    Speed detection is automatic for 1200, 2400 and 19200(Telebit PEP) bps. +
-    TrailBlazer modem users may issue the TeleGodzilla trailblazer command to +
-    swith to 19200 bps once they have logged in. +
- +
-    Interesting files include RZSZ.ZOO (C source code), YZMODEM.ZOO (Official +
-    XMODEM, YMODEM, and ZMODEM protocol descriptions), ZCOMMEXE.ARC, +
-    ZCOMMDOC.ARC, and ZCOMMHLP.ARC (PC-DOS shareware comm program with XMODEM, +
-    True YMODEM(TM), ZMODEM, Kermit Sliding Windows, Telink, MODEM7 Batch, +
-    script language, etc.). +
- +
- +
-    9.2  Unix UUCP Access +
- +
-    UUCP sites can obtain the current version of this file with +
-                     uucp omen!/u/caf/public/ymodem.doc /tmp +
-    A continually updated list of available files is stored in +
-    /usr/spool/uucppublic/FILES.  When retrieving these files with uucp, +
-    remember that the destination directory on your system must be writeable +
-    by anyone, or the UUCP transfer will fail. +
- +
-    The following L.sys line calls TeleGodzilla (Pro-YAM in host operation). +
-    TeleGodzilla determines the incoming speed automatically. +
- +
-    In response to "Name Please:" uucico gives the Pro-YAM "link" command as a +
-    user name.  The password (Giznoid) controls access to the Xenix system +
-    connected to the IBM PC's other serial port.  Communications between +
-    Pro-YAM and Xenix use 9600 bps; YAM converts this to the caller's speed. +
- +
-    Finally, the calling uucico logs in as uucp. +
     omen Any ACU 2400 1-503-621-3746 se:--se: link ord: Giznoid in:--in: uucp     omen Any ACU 2400 1-503-621-3746 se:--se: link ord: Giznoid in:--in: uucp
  
  
  
-    10.  REVISIONS+==== REVISIONS ====
  
-    10-27-87 Optional fields added for number of files remaining to be sent +  * 10-27-87 Optional fields added for number of files remaining to be sent and total number of bytes remaining to be sent. 
-    and total number of bytes remaining to be sent. +  10-18-87 Flow control discussion added to 1024 byte block descritpion, minor revisions for clarity per user comments. 
-    10-18-87 Flow control discussion added to 1024 byte block descritpion, +  8-03-87 Revised for clarity. 
-    minor revisions for clarity per user comments. +  5-31-1987 emphasizes minimum requirements for YMODEM, and updates information on accessing files. 
-    8-03-87 Revised for clarity. +  * 9-11-1986 clarifies nomenclature and some minor points. 
-    5-31-1987 emphasizes minimum requirements for YMODEM, and updates+  * The April 15 1986 edition clarifies some points concerning CRC 
 +    calculations and spaces in the header.
  
  
 +===== YMODEM Programs =====
  
-    Chapter 10                                        Xmodem Protocol Overview 
- 
- 
- 
- 
- 
- 
- 
-    X/YMODEM Protocol Reference      10-27-87                               28 
- 
- 
- 
-    information on accessing files. 
-    9-11-1986 clarifies nomenclature and some minor points. 
-    The April 15 1986 edition clarifies some points concerning CRC 
-    calculations and spaces in the header. 
- 
- 
-    11.  YMODEM Programs 
  
-    ZCOMM, A shareware little brother to Professional-YAM, is available as +ZCOMM, A shareware little brother to Professional-YAM, is available as 
-    ZCOMMEXE.ARC on TeleGodzilla and other bulletin board systems.  ZCOMM may +ZCOMMEXE.ARC on TeleGodzilla and other bulletin board systems.  ZCOMM may 
-    be used to test YMODEM amd ZMODEM implementations.+be used to test YMODEM amd ZMODEM implementations.
  
-    Unix programs supporting YMODEM are available on TeleGodzilla in RZSZ.ZOO. +Unix programs supporting YMODEM are available on TeleGodzilla in RZSZ.ZOO. 
-    This ZOO archive includes a ZCOMM/Pro-YAM/PowerCom script ZUPL.T to upload +This ZOO archive includes a ZCOMM/Pro-YAM/PowerCom script ZUPL.T to upload 
-    a bootstrap program MINIRB.C, compile it, and then upload the rest of the +a bootstrap program MINIRB.C, compile it, and then upload the rest of the 
-    files using the compiled MINIRB.  Most Unix like systems are supported, +files using the compiled MINIRB.  Most Unix like systems are supported, 
-    including V7, Xenix, Sys III, 4.2 BSD, SYS V, Idris, Coherent, and +including V7, Xenix, Sys III, 4.2 BSD, SYS V, Idris, Coherent, and 
-    Regulus.+Regulus.
  
-    A version for VAX-VMS is available in VRBSB.SHQ.+A version for VAX-VMS is available in VRBSB.SHQ.
  
-    Irv Hoff has added 1k blocks and basic YMODEM batch transfers to the KMD +Irv Hoff has added 1k blocks and basic YMODEM batch transfers to the KMD 
-    and IMP series programs, which replace the XMODEM and MODEM7/MDM7xx series +and IMP series programs, which replace the XMODEM and MODEM7/MDM7xx series 
-    respectively.  Overlays are available for a wide variety of CP/M systems.+respectively.  Overlays are available for a wide variety of CP/M systems.
  
-    Questions about Professional-YAM communications software may be directed +Questions about Professional-YAM communications software may be directed to:
-    to:+
          Chuck Forsberg          Chuck Forsberg
          Omen Technology Inc          Omen Technology Inc
Line 1405: Line 1105:
          GEnie: CAF          GEnie: CAF
  
-    Unlike ZMODEM and Kermit, XMODEM and YMODEM place obstacles in the path of +Unlike ZMODEM and Kermit, XMODEM and YMODEM place obstacles in the path of 
-    a reliable high performance implementation, evidenced by poor reliability +a reliable high performance implementation, evidenced by poor reliability 
-    under stress of the industry leaders' XMODEM and YMODEM programs.  Omen +under stress of the industry leaders' XMODEM and YMODEM programs.  Omen 
-    Technology provides consulting and other services to those wishing to +Technology provides consulting and other services to those wishing to 
-    implement XMODEM, YMODEM, and ZMODEM with state of the art features and +implement XMODEM, YMODEM, and ZMODEM with state of the art features and 
-    reliability. +reliability.
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
-    Chapter 11                                        Xmodem Protocol Overview +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
-                                     CONTENTS +
- +
- +
-     1.  TOWER OF BABEL...................................................   2 +
-         1.1  Definitions.................................................   2 +
- +
-     2.  YMODEM MINIMUM REQUIREMENTS......................................   4 +
- +
-     3.  WHY YMODEM?......................................................   5 +
-         3.1  Some Messages from the Pioneer..............................   6 +
- +
-     4.  XMODEM PROTOCOL ENHANCEMENTS.....................................   9 +
-         4.1  Graceful Abort..............................................   9 +
-         4.2  CRC-16 Option...............................................   9 +
-         4.3  XMODEM-1k 1024 Byte Block...................................  10 +
- +
-     5.  YMODEM Batch File Transmission...................................  12 +
-         5.1  KMD/IMP Exceptions to YMODEM................................  16 +
- +
-     6.  YMODEM-g File Transmission.......................................  17 +
- +
-     7.  XMODEM PROTOCOL OVERVIEW.........................................  18 +
-         7.1  Definitions.................................................  18 +
-         7.2  Transmission Medium Level Protocol..........................  18 +
-         7.3  File Level Protocol.........................................  19 +
-         7.4  Programming Tips............................................  20 +
- +
-     8.  XMODEM/CRC Overview..............................................  22 +
-         8.1  CRC Calculation.............................................  22 +
-         8.2  CRC File Level Protocol Changes.............................  23 +
-         8.3  Data Flow Examples with CRC Option..........................  25 +
- +
-     9.  MORE INFORMATION.................................................  27 +
-         9.1  TeleGodzilla Bulletin Board.................................  27 +
-         9.2  Unix UUCP Access............................................  27 +
- +
-    10.  REVISIONS........................................................  27 +
- +
-    11.  YMODEM Programs..................................................  28 +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
-                                      - i - +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
  
  
Line 1531: Line 1141:
  
     Figure 13.  Receiver and Sender Both have CRC Option..................  26     Figure 13.  Receiver and Sender Both have CRC Option..................  26
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
-                                      - ii - 
- 
- 
- 
-