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%";
21289482 6u8 g(int i, u8 x, u8 t, u8 o) {
63363195 7 u8 tmp;
0f219114 8 ANDI (t, 0x07)
63363195
TG
9 tmp = i >> 16;
10 ANDI (tmp, 3)
11 if (tmp) t+=8;
c616f0c2
TG
12 t = data[t];
13 SUBI (t, -51)
14 t = (i*t) >> o;
15 AND (t, x)
16 ANDI (t, 3)
17 return t;
61fab018
TG
18};
19
20int main(void) {
fe9a76e4
TG
21 int i;
22 int n;
23 int s;
ab6fe4c2 24 u8 acc;
fe9a76e4 25 for (i = 0;; i++) {
ab6fe4c2 26 acc = 0;
fe9a76e4
TG
27 n = i >> 14;
28 s = i >> 17;
ab6fe4c2
TG
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);
fe9a76e4 34 }
61fab018 35}
Imprint / Impressum