8080 ROUTINE GENERATES CRC CHARACTER by Fred Gutman

advertisement
8080 ROUTINE GENERATES CRC CHARACTER
by Fred Gutman
California Microwave, Inc., Sunnyvale, CA
Communications and magnetic-storage controllers often use
cyclic redundancy checking (CRC)
to
enhance
data-transmission
accuracy; this method's popularity is due, in part, to its easy
implementa- tion with shift registers and exclusive-OR gates (EDN,
Sept 5, 1978, pgs 119-123).
Many software methods can emulate this hardware mechanization.
The more natural software method discussed here directly executes the
division of a message by a generating polynomial.
An example,
programmed on the 8080, appears in the figure.
CRC divides a message M(x) of any length by a generating
polynomial P(x) to form a quotient Q(x) and a remainder R(x):
M(x)/P(x)=Q(x)+R(x). R(x) is appended to the message and checked at
the receiving end of the communication channel or upon read- back of
magnetic-storage information.
In these operations, addition and division are based on the
exclusive-OR function without carry; only bit-by-bit differences are
important, not their arithmetic sum.
Thus, while this process
resembles nonrestoring binary division, its mechanization is somewhat
simpler.
Note that you don't have to store the quotient - the
remainder is the only useful part.
This versatile method accepts
different generating polynomials (table); you simply insert them into
the routine in the figure. In each case, an R-bit remainder is left
in location REM for transmission or checking. (R is the order of the
generating polynomial.)
TABLE
POLYNOMIAL
CR16: x16+x15+x2+1
SDLC: x16+x12+x5+1
CCITT: x16+x15+x10+x6+x5+1
x16+x15+x13+x7+x4+x2+x+1
HDLC: x14+x2+x+1
x8+x7+x2+1
CR12: x12+x11+x3+x2+x+1
BCC:
x8+1
CR16 REVERSE: x15+x14+x+1
CCIT REVERSE: x16+x11+x4+1
x8+x7+x5+x4+1
MASK
H=128
H=128
H=128
H=128
H=128
L=128
H=8
L=128
H=128
H=128
L=128
HEX FORM
8005
1021
8461
A097
4007
0185
180F
0101
4003
0811
01B1
-------------------------------------------------------------------NOTES FOR REPOSITORY USERS ON SIMTEL20
CRCs provide a convenient way to verify that a file received
from a repository is an exact duplicate of the file on the repository.
A standard CRC polynomial has been selected, and several different
programs have been created which analyze files and compute the value
of this CRC polynomial when the data in the file is provided as data
for the polynomial. The following list may prove to be useful:
Program Name
-----------NCRC
CRC
CRC
CRC
Implementation
Comments
--------------------TOPS-20
MICRO:<CPM.TOPS20>
NCRC.MID (written in Midas)
UNIX
PD:<UNIX.CPM>
CRCK2.C (generic C)
CP/M
MICRO:<CPM.DIRUTL>
CRCKxx.ASM (8080 asm)
xx=version number
ZCPR3
MICRO:<CPM.ZCPR3>
CRC.MAC (8080 asm)
Source code is provided for all of the routines listed above.
The repositories on SIMTEL20 contain CRCLST files, generated
by NCRC for TOPS-20, which contain the CRCs for the files contained in
them. The <ADA> repository's CRCLST file is:
PD:<ADA>ADA.CRCLST
Previous versions of the CRCLST are often retained for
historical purposes. Only the last N versions of ADA.CRCLST are
retained, where N is indeterminant.
By using the file reference
specified above, the latest version is always retrieved.
SAMPLE ADA.CRCLST
Filename
Type
Bytes
Directory PD:<ADA.COMPONENTS>
LIMPRIOR.ADA.2
ASCII
LIMPRIOR.PRO.2
ASCII
LIST.ADA.2
ASCII 17483
Sectors
7374
3461
137 =
CRC
58 = 3AH 364CH
28 = 1CH 813DH
89H 4B17H
LIST.PRO.2
PRIOR.ADA.2
PRIOR.PRO.2
SAFEIO.ADA.2
SAFEIO.PRO.2
ASCII
ASCII
ASCII
Directory PD:<ADA.GENERAL>
00READ.ME.2
ASCII
ADAREPOS.TXT.2
COPYRITE.DOC.1
COPYRITE.INF.1
COPYRITE.TXT.1
FTP.DOC.1
ASCII
LBR.DOC.2
ASCII
MLIST.DOC.1
ASCII
PROLOGUE.ADA.1
SAMPLE.PRO.1
UUCP-BIT.DOC.1
3397
6398
3582
ASCII
ASCII
27 =
50 =
28 =
9730
3661
1578
13 =
ASCII
3681
ASCII
4434
ASCII
5777
ASCII 11313
17412 137 =
955
8 =
807
7 =
ASCII
2513
ASCII
3461
ASCII
4649
1BH 7780H
32H A562H
1CH 5060H
77 = 4DH 7E5BH
29 = 1DH BB29H
DH
29 =
35 =
46 =
89 =
89H
8H
7H
20 =
28 =
37 =
84D1H
1DH
23H
2EH
59H
B0E3H
E967H
45FBH
14H
1CH
25H
9B3EH
206EH
AEBCH
9916H
3CB9H
813DH
CCBCH
Download