text
stringlengths
0
99.6k
<SOH><blk #><255-blk #><--128 data bytes--><cksum>
in which:
<SOH> = 01 hex
<blk #> = binary number, starts at 01 increments by 1, and
wraps 0FFH to 00H (not to 01)
<255-blk #> = blk # after going thru 8080 "CMA" instr, i.e.
each bit complemented in the 8-bit block number.
Formally, this is the "ones complement".
<cksum> = the sum of the data bytes only. Toss any carry.
7.3 File Level Protocol
7.3.1 Common_to_Both_Sender_and_Receiver
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
operator whether to "retry or quit".
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
makes the transmission susceptible to false termination due to an <ack>
<nak> or <soh> being corrupted into a <can> and aborting transmission.
The protocol may be considered "receiver driven", that is, the sender need
not automatically re-transmit, although it does in the current
implementations.
7.3.2 Receive_Program_Considerations
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
transmitter to start. Optionally, the receiver could send a <nak>
immediately, in case the sender was ready. This would save the initial 10
second timeout. However, the receiver MUST continue to timeout every 10
seconds in case the sender wasn't ready.
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
block for any reason (invalid header, timeout receiving data), it must
wait for the line to clear. See "programming tips" for ideas
Synchronizing: If a valid block number is received, it will be: 1) the
expected one, in which case everything is fine; or 2) a repeat of the
previously received block. This should be considered OK, and only
indicates that the receivers <ack> got glitched, and the sender re-
transmitted; 3) any other block number indicates a fatal loss of
synchronization, such as the rare case of the sender getting a line-glitch
Chapter 7 Xmodem Protocol Overview
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
SENDER RECEIVER
times out after 10 seconds,
<--- <nak>
<soh> 01 FE -data- <xx> --->
<--- <ack>
<soh> 02 FD -data- xx ---> (data gets line hit)
<--- <nak>
<soh> 02 FD -data- xx --->
<--- <ack>
<soh> 03 FC -data- xx --->
(ack gets garbaged) <--- <ack>
<soh> 03 FC -data- xx ---> <ack>
<eot> --->
<--- <anything except ack>
<eot> --->
<--- <ack>
(finished)