Commit | Line | Data |
---|---|---|
61fab018 | 1 | #include <stdio.h> |
da32ed67 | 2 | #include "fakeasm.h" |
61fab018 | 3 | typedef unsigned char u8; |
da32ed67 | 4 | |
24abdcbb TG |
5 | u8 data[] = { |
6 | 0x84, 0x9d, 0xb0, 0x69, 0x9d, 0x84, 0x69, 0x58, | |
7 | 0x75, 0x8c, 0xb0, 0x69, 0x8c, 0x75, 0x69, 0x58 | |
8 | }; | |
21289482 | 9 | u8 g(int i, u8 x, u8 t, u8 o) { |
63363195 | 10 | u8 tmp; |
0f219114 | 11 | ANDI (t, 0x07) |
63363195 TG |
12 | tmp = i >> 16; |
13 | ANDI (tmp, 3) | |
09cf3949 TG |
14 | TST (tmp) |
15 | BREQ (skip) | |
16 | SUBI (t, -8) | |
17 | skip: | |
c616f0c2 | 18 | t = data[t]; |
c616f0c2 TG |
19 | t = (i*t) >> o; |
20 | AND (t, x) | |
21 | ANDI (t, 3) | |
22 | return t; | |
61fab018 TG |
23 | }; |
24 | ||
25 | int main(void) { | |
fe9a76e4 | 26 | int i; |
c65ddced TG |
27 | unsigned short n; |
28 | unsigned short s; | |
ab6fe4c2 | 29 | u8 acc; |
fe9a76e4 | 30 | for (i = 0;; i++) { |
ab6fe4c2 | 31 | acc = 0; |
fe9a76e4 TG |
32 | n = i >> 14; |
33 | s = i >> 17; | |
ab6fe4c2 TG |
34 | acc += g(i, 1, n, 12); |
35 | acc += g(i, s, n ^ i >> 13, 10); | |
36 | acc += g(i, s / 3, n + ((i >> 11) % 3), 10); | |
37 | acc += g(i, s / 5, 8 + n - ((i >> 10) % 3), 9); | |
38 | putchar(acc<<4); | |
fe9a76e4 | 39 | } |
61fab018 | 40 | } |