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 int g(int i, u8 x, u8 t, u8 o) {
7 ANDI (t, 0x07)
8 if (3 & i >> 16 ) t+=8;
9 u8 xxx = data[t];
10 SUBI (xxx, -51)
11 xxx = (i*xxx) >> o;
12 AND (xxx, x)
13 ANDI (xxx, 3)
14 return xxx;
15 };
16
17 int main(void) {
18 int i;
19 int n;
20 int s;
21 u8 acc;
22 for (i = 0;; i++) {
23 acc = 0;
24 n = i >> 14;
25 s = i >> 17;
26 acc += g(i, 1, n, 12);
27 acc += g(i, s, n ^ i >> 13, 10);
28 acc += g(i, s / 3, n + ((i >> 11) % 3), 10);
29 acc += g(i, s / 5, 8 + n - ((i >> 10) % 3), 9);
30 putchar(acc<<4);
31 }
32 }
Imprint / Impressum