text
stringlengths 0
99.6k
|
|---|
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
|
Each block of the transfer in CRC mode looks like:
|
<SOH><blk #><255-blk #><--128 data bytes--><CRC hi><CRC lo>
|
in which:
|
<SOH> = 01 hex
|
<blk #> = binary number, starts at 01 increments by 1, and
|
wraps 0FFH to 00H (not to 01)
|
<255-blk #> = ones complement of blk #.
|
<CRC hi> = byte containing the 8 hi order coefficients of the CRC.
|
<CRC lo> = byte containing the 8 lo order coefficients of the CRC.
|
8.1 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
|
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
|
The following XMODEM crc routine is taken from "rbsb.c". Please refer to
|
the source code for these programs (contained in RZSZ.ZOO) for usage. A
|
fast table driven version is also included in this file.
|
/* update CRC */
|
unsigned short
|
updcrc(c, crc)
|
register c;
|
register unsigned crc;
|
{
|
register count;
|
for (count=8; --count>=0;) {
|
if (crc & 0x8000) {
|
crc <<= 1;
|
crc += (((c<<=1) & 0400) != 0);
|
crc ^= 0x1021;
|
}
|
else {
|
crc <<= 1;
|
crc += (((c<<=1) & 0400) != 0);
|
}
|
}
|
return crc;
|
}
|
8.2 CRC File Level Protocol Changes
|
8.2.1 Common_to_Both_Sender_and_Receiver
|
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
|
receiving programs support the CRC mode. All Modem Programs should support
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.