2 ; Piotr Fusik, 14.11.2001
\r
4 ; unsigned long __fastcall__ crc32 (unsigned long crc, unsigned char* buf,
\r
10 .import compleax, incsp2, incsp4, popax, popeax
\r
11 .importzp sreg, ptr1, ptr2, tmp1, tmp2
\r
13 POLYNOMIAL = $EDB88320
\r
28 eor #(POLYNOMIAL>>24)&$FF
\r
32 eor #(POLYNOMIAL>>16)&$FF
\r
36 eor #(POLYNOMIAL>>8)&$FF
\r
41 bcs @L4 ; branch always
\r
58 inc table_initialised
\r
63 ; ptr2 = (len & 0xff) == 0 ? len : len + 0x100;
\r
73 ; if (buf == NULL) return 0;
\r
76 ; if (!tables_initialised) make_tables();
\r
77 lda table_initialised
\r
83 ; if (len == 0) return crc;
\r
93 ; crc = (crc >> 8) ^ table[(crc & 0xff) ^ *p++];
\r