mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-25 17:28:06 +11:00
440ea43a88
Initially, I used the same letters as those used in the z80 ref docs, but it makes the different assemblers harder to use than they should. Having consistent "argtype" rules across assemblers should help.
17 lines
442 B
Plaintext
17 lines
442 B
Plaintext
CODE _sdcSel SDC_CSLOW OUTiA, ;CODE
|
|
CODE _sdcDesel SDC_CSHIGH OUTiA, ;CODE
|
|
( 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
|