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