mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-20 15:18:05 +11:00
17 lines
450 B
Plaintext
17 lines
450 B
Plaintext
CODE _sdcSel SDC_CSLOW OUTnA, ;CODE
|
|
CODE _sdcDesel SDC_CSHIGH OUTnA, ;CODE
|
|
( Computes n into crc c with polynomial 0x1021 )
|
|
CODE _crc16 ( c n -- c )
|
|
HL POPqq, ( n ) DE POPqq, ( c )
|
|
A L LDrr, D XORr, D A LDrr,
|
|
B 8 LDrn,
|
|
BEGIN,
|
|
E SLAr, D RLr,
|
|
IFC, ( msb is set, apply polynomial )
|
|
A D LDrr, 0x10 XORn, D A LDrr,
|
|
A E LDrr, 0x21 XORn, E A LDrr,
|
|
THEN,
|
|
DJNZ, AGAIN,
|
|
DE PUSHqq,
|
|
;CODE
|