collapseos/blk/603
Virgil Dupras f09aa0603c rc2014: separate SPI relay and SDC drivers
My intention is to reuse the SPI relay to program AVR MCUs from a
RC2014.
2020-06-29 18:48:00 -04:00

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