2020-06-27 22:01:56 -04:00
|
|
|
CODE _sdcSel SDC_CSLOW OUTiA, ;CODE
|
|
|
|
CODE _sdcDesel SDC_CSHIGH OUTiA, ;CODE
|
2020-04-24 20:46:01 -04:00
|
|
|
( Computes n into crc c with polynomial 0x1021 )
|
|
|
|
CODE _crc16 ( c n -- c )
|
2020-06-27 22:01:56 -04:00
|
|
|
HL POP, ( n ) DE POP, ( c )
|
2020-04-24 20:46:01 -04:00
|
|
|
A L LDrr, D XORr, D A LDrr,
|
2020-06-27 22:01:56 -04:00
|
|
|
B 8 LDri,
|
2020-04-24 20:46:01 -04:00
|
|
|
BEGIN,
|
2020-06-27 22:01:56 -04:00
|
|
|
E SLA, D RL,
|
2020-04-24 20:46:01 -04:00
|
|
|
IFC, ( msb is set, apply polynomial )
|
2020-06-27 22:01:56 -04:00
|
|
|
A D LDrr, 0x10 XORi, D A LDrr,
|
|
|
|
A E LDrr, 0x21 XORi, E A LDrr,
|
2020-04-24 20:46:01 -04:00
|
|
|
THEN,
|
|
|
|
DJNZ, AGAIN,
|
2020-06-27 22:01:56 -04:00
|
|
|
DE PUSH,
|
2020-04-23 13:55:00 -04:00
|
|
|
;CODE
|