mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-28 12:58:05 +11:00
f09aa0603c
My intention is to reuse the SPI relay to program AVR MCUs from a RC2014.
15 lines
367 B
Plaintext
15 lines
367 B
Plaintext
( Computes n into crc c with polynomial 0x1021 )
|
|
CODE _crc16 ( c n -- c )
|
|
HL POP, ( n ) DE POP, ( c )
|
|
A L LDrr, D XORr, D A LDrr,
|
|
B 8 LDri,
|
|
BEGIN,
|
|
E SLA, D RL,
|
|
IFC, ( msb is set, apply polynomial )
|
|
A D LDrr, 0x10 XORi, D A LDrr,
|
|
A E LDrr, 0x21 XORi, E A LDrr,
|
|
THEN,
|
|
DJNZ, AGAIN,
|
|
DE PUSH,
|
|
;CODE
|