Computes CRC-16 (CCITT).
Description
This function updates the current CRC-16 with the value of the A register. The current implementation is based on Greg Cook CRC-16.
For more informations
Assembly call
; reset CRC-16 value
stwz <_crc
; _si contains the address of the input buffer
; X contains its size
cly
loop:
phy
phx
lda [_si], Y
jsr crc16
plx
ply
iny
dex
bne loop
; at the end of the loop _crc contains the 16 bit CRC of the input buffer
Parameters
A | Input byte |
_crc | Current CRC-16 value |
Return
_crc | Updated CRC-16 value |
A | CRC-16 value MSB |
X | CRC-16 value LSB |