new version
[Chiptunes.git] / foo.c
CommitLineData
61fab018 1#include <stdio.h>
da32ed67 2#include "fakeasm.h"
61fab018 3typedef unsigned char u8;
da32ed67 4
3d47290d 5u8* data = "Qj}6jQ6%BY}6YB6%";
26c08307 6int g(int i, u8 x, u8 t, u8 o) {
3d47290d
TG
7 t = t & 0x7;
8 if (3 & i >> 16 ) t+=8;
9 u8 xxx = data[t];
da32ed67 10 SUBI (xxx, -51)
b312e447 11 xxx = (i*xxx) >> o;
156da8fc 12 AND (xxx, x)
cb4533d4
TG
13 ANDI (xxx, 3)
14 return xxx;
61fab018
TG
15};
16
17int main(void) {
fe9a76e4
TG
18 int i;
19 int n;
20 int s;
ab6fe4c2 21 u8 acc;
fe9a76e4 22 for (i = 0;; i++) {
ab6fe4c2 23 acc = 0;
fe9a76e4
TG
24 n = i >> 14;
25 s = i >> 17;
ab6fe4c2
TG
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);
fe9a76e4 31 }
61fab018 32}
Imprint / Impressum