Code: Select all
DIM table% 256 * 4
FOR loop% = 0 TO 255
w% = loop% << 8
FOR loop2% = 0 TO 7
w% = (w% << 1) EOR ((w%>>15 AND 1) * &1021)
NEXT
table%!(loop% * 4) = w% AND &FFFF
NEXT
Code: Select all
crc = (crc<<8 EOR table%!((crc>>8 EOR value)<<2)) AND &FFFF
The CRC is reset to FFFF at the following points:
FM:
- On hitting an ID marker (F57E)
On hitting a sync marker (5554)
- On hitting a sync marker (4489)
If you want to look at the source, the APD decoder is in: adffs.file_types.APD