new version
[Chiptunes.git] / foo.c
1 #include <stdio.h>
2 #include "fakeasm.h"
3 typedef unsigned char u8;
4
5 u8* data = "Qj}6jQ6%BY}6YB6%";
6 u8 g(int i, u8 x, u8 t, u8 o) {
7 u8 tmp;
8 ANDI (t, 0x07)
9 tmp = i >> 16;
10 ANDI (tmp, 3)
11 if (tmp) t+=8;
12 t = data[t];
13 SUBI (t, -51)
14 t = (i*t) >> o;
15 AND (t, x)
16 ANDI (t, 3)
17 return t;
18 };
19
20 int main(void) {
21 int i;
22 int n;
23 int s;
24 u8 acc;
25 for (i = 0;; i++) {
26 acc = 0;
27 n = i >> 14;
28 s = i >> 17;
29 acc += g(i, 1, n, 12);
30 acc += g(i, s, n ^ i >> 13, 10);
31 acc += g(i, s / 3, n + ((i >> 11) % 3), 10);
32 acc += g(i, s / 5, 8 + n - ((i >> 10) % 3), 9);
33 putchar(acc<<4);
34 }
35 }
Imprint / Impressum