add credit, add 013 debug timer message on keypress
[uccvend-snackrom.git] / ROM2 / gencrctab.c
1 #include <stdio.h>
2 #define CRC16 0x1021            /* Generator polynomial (X^16 + X^12 + X^5 + 1) */
3 int main() {
4         int val;
5         printf("const u16 crctab[] = {\n\t");
6         for (val = 0; val <= 255; val++) {
7                 int i;
8                 unsigned int crc;
9                 crc = val << 8;
10                 for (i = 0; i < 8; i++) {
11                         crc <<= 1;
12                         if (crc & 0x10000)
13                                 crc ^= CRC16;
14                 }
15                 printf("0x%04x,", crc&0xffff);
16                 if ((val+1)%8 == 0) printf("\n\t");
17     }
18         printf("};\n");
19         return 0;
20 }

UCC git Repository :: git.ucc.asn.au