4 static FILE *fo = NULL;
6 static void out(int r, int is_last)
10 fprintf(fo, " or $t%i, $t%i, $a2\n", r, r);
11 fprintf(fo, " sb $t%i, %i($a0)\n", r, r);
15 fprintf(fo, " or $t%i, $t%i, $a2\n", r, r);
16 fprintf(fo, " jr $ra\n");
17 fprintf(fo, " sb $t%i, %i($a0)\n", r, r);
21 unsigned char pattern_db[0x100];
23 static int check_label(unsigned char i)
26 fprintf(fo, "tile%i%i%i%i%i%i%i%i:\n", (i&0x80)?1:0, (i&0x40)?1:0, (i&0x20)?1:0, (i&0x10)?1:0,
27 (i&0x08)?1:0, (i&0x04)?1:0, (i&0x02)?1:0, (i&0x01)?1:0);
40 fo = fopen("out.s", "w");
43 memset(pattern_db, 0, sizeof(pattern_db));
45 for (i = 0xff; i > 0; i--)
47 if (check_label(i)) continue;
49 if (i & 0x01) out(0, !(i&0xfe));
51 if (i & 0x02) out(1, !(i&0xfc));
53 if (i & 0x04) out(2, !(i&0xf8));
55 if (i & 0x08) out(3, !(i&0xf0));
57 if (i & 0x10) out(4, !(i&0xe0));
59 if (i & 0x20) out(5, !(i&0xc0));
61 if (i & 0x40) out(6, !(i&0x80));
63 if (i & 0x80) out(7, 1);