home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
ZCPR33
/
S-Z
/
SLB36HLP.LBR
/
SYSLIBG.HZP
/
SYSLIBG.HLP
Wrap
Text File
|
2000-06-30
|
3KB
|
89 lines
:CRC Routines
Thσá CR├ Routine≤ ma∙ bσ useΣ t∩ checδ thσ validit∙á oµ ì
aεá incominτ seria∞ bytσ streaφ oµ arbitrar∙ length«á Thesσ ì
routine≤á computσ anΣ checδ ß truσ 16-bi⌠ Cycliπá Redundanc∙ ì
Codσ (CRC).
The use of these routines will guarantee detection of:
1) all single- and double-bit errors
2) all errors with an odd number of error bits
3) all burst errors of length 16 or less
Additionally, the following statistics:
1) 99.9969% of all 17-bit error bursts
2) 99.9984% of all possible longer error bursts
Thσ followinτ screeε displa∙ illustrate≤ ß typica∞á wa∙ ì
t∩ usσ thesσ routines:
CRC$MAKE: ; ROUTINE TO ESTABLISH OUTGOING CRC VALUE
CALL CRCCLR ; CLEAR CRC
<loop CALLing CRCUPD> ; ACQUIRE VALUES
CALL CRCDONE ; GET VALUE
SHLD CRCVAL ; SAVE VALUE
CRC$CHECK: ; ROUTINE TO CHECK INCOMING CRC VALUE
CALL CRCCLR ; CLEAR CRC
<loop CALLing CRCUPD> ; ACQUIRE VALUES
CALL CRCDONE ; GET VALUE
XCHG ; VALUE IN DE
LHLD CRCVAL ; GET FIRST VALUE IN HL
CALL COMPHD ; COMPARE HL TO DE
JNZ ERROR ; CRC'S DON'T MATCH IF NOT EQUAL
Thσáá followinτáá screeεá display≤á describσá thσáá CR├ ì
routines«áá Thσáá CRC- routine≤á usσá thσáá X^16+X^12+X^5+▒ ì
polynomial¼áá thσá CRC1- routine≤á usσá thσá X^16+X^15+X^2+▒ ì
polynomial¼áááá anΣáááá thσááá CRC2-routine≤áááá usσáááá thσ ì
X^16+X^15+X^13+X^7+X^4+X^2+X+▒ polynomial.
Routine: CRCCLR, CRC1CLR, CRC2CLR
Function:
Clea≥á thσá interna∞ CR├ Accumulato≥ iε preparatioεá t∩ ì
CR├ computation.
Inputs: None
Outputs: None
Registers Affected: None
SYSLIB Routines Called: None
Special Error Conditions: None
Routine: CRCUPD, CRC1UPD, CRC2UPD
Function:á Updatσá thσ CR├ Accumulato≥ valuσ witΦá thσ ì
nex⌠ byte.
Inputs: A=byte to be included in CRC
Outputs: None
Registers Affected: None
SYSLIB Routines Called: None
Special Error Conditions: None
Routine: CRCDONE, CRC1DONE, CRC2DONE
Function:
Terminatσáá CR├á valuσá accumulatioεá anΣá returεáá thσ ì
calculateΣ 16-bi⌠ CR├ value.
Inputs: None
Outputs: HL = calculated CRC value
Registers Affected: HL
SYSLIB Routines Called: None
Special Error Conditions: None