text
string
7.4 Programming Tips
+ 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.
After receiving the <soh>, the receiver should call the character
receive subroutine with a 1-second timeout, for the remainder of the
message and the <cksum>. Since they are sent as a continuous stream,
timing out of this implies a serious like glitch that caused, say,
127 characters to be seen instead of 128.
Chapter 7 Xmodem Protocol Overview
X/YMODEM Protocol Reference 10-27-87 21
+ 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.
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.