polynomials?
ZXNet echo conference «code.zx»
From Walerij Kozhevnikov → To All 6 April 1998
Hello All!
Who asked about the subject?
Cyclic ones have the highest degree of noise immunity.
control codes constructed on the basis of polynomials. Moreover, than
The higher the degree of the polynomial, the more reliable the CRC.
Things like this here... The checking area of blocks is fixed
length and frames must contain the inverted remainder of
division modulo two by a generating polynomial of a collection of bits
service and information areas, multiplied by X^K, where
K is the size of the check area in bits.
So when writing to floppy disks, a polynomial is used
16th power with a minimum code distance of 4:
X^16+X^12+X^5+1
(in accordance with GOST 17422-82). In this case, the length of the block should
be no more than 2^15 bits.
The same idea applies to hard magnetic drives.
disks, and even in everyone’s favorite RAR archiver.
Now closer to the point... I present a subprogram demonstrating
method for calculating CRC using the VG-93 controller (and not only it!):
LD IX, ARRAY ADDRESS
LD DE,ARAY LENGTH
LD HL,0 INITIAL CONDITIONS
LD B,(IX+00)
LD C,08
M1 LD A,B
XOR H
SLA B
SLA L
JR C,M2
SLA H
JR M3
M2 SLA H
INC H
M3 BIT 7,A
JR Z,M4
INC L
JR M5
M4 LD A,20
XOR L
LD L,A
LD A,10
XOR H
LD H,A
M5 DEC C
JR NZ,M1
INC IX
LD B,(IX+00)
LD C,08
DEC DE
LD A,D
OR E
JR NZ,M1The CRC will be located at the exit in HL!
I warn you right away - for the subroutine to work, it is necessary
sufficient time, because all flop controllers count
It's a hardware thing!
So if there are brakes, reduce the degree of the polynomial!
Good luck!
Jason.
Powered by ScorpionZS256turbo+/SMUC/HDD'IDE130Mb/FDD'800/
/CMOS/Covox/ATkbd/Mouse/CDOS...