1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-10 09:58:04 +11:00
collapseos/blk/423
Virgil Dupras 124da6adec Move SD Card subsystem outside of RC2014 recipe and add protocols
Although the SPI Relay driver is RC2014-specific, the SD Card driver
is generic enough to be a subsystem. That's the second subsystem we
add and this warrants, I think, the formalization of a new concept:
protocols.
2020-08-16 14:30:33 -04:00

15 lines
409 B
Plaintext

( Computes n into crc c with polynomial 0x1021 )
CODE _crc16 ( c n -- c ) EXX, ( protect BC )
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,
EXX, ( unprotect BC ) ;CODE