testpico: more timing tests
[megadrive.git] / testpico / hcnt2linear.c
CommitLineData
e71680d5 1#include <stdio.h>
2#include <assert.h>
3
4//| Mode |H32 (RSx=00) |H40 (RSx=11) |
5//|HCounter |[1]0x000-0x127 |[1]0x000-0x16C | 00-93 00-b6
6//|progression |[2]0x1D2-0x1FF |[2]0x1C9-0x1FF | e9-ff e4-ff
7
8int main()
9{
10 unsigned char result[256];
11 int i, j, val, vals[420];
12
13 for (i = val = 0; val < 0x200; i++)
14 {
15 vals[i] = val++;
16 if (val == 0x16d)
17 val = 0x1C9;
18 }
19 assert(i == 420);
20 for (i = 0; i < 256; i++)
21 {
22 result[i] = 0;
23 for (j = 0; j < 420; j++)
24 if (vals[j] / 2 == i)
25 break;
26 if (j < 420)
27 result[i] = (255 * j + 210) / 419;
28 }
29
30 printf("{");
31 for (i = 0; i < 256; i++)
32 printf(" 0x%02x%s", result[i], i < 255 ? "," : "");
33 printf(" }\n");
34
35 printf("{");
36 for (i = 0; i < 64; i++)
37 printf(" 0x%02x%s", result[i*4+2], i < 63 ? "," : "");
38 printf(" }\n");
39
40 printf("{");
41 for (i = 0; i < 16; i++)
42 printf(" 0x%02x%s", result[i*16+8], i < 15 ? "," : "");
43 printf(" }\n");
44
45 return 0;
46}