diff options
-rw-r--r-- | sux.h | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -1778,6 +1778,29 @@ static /*inline*/ void exec_base_inst(struct sux *cpu, uint8_t opcode, uint8_t p } } +#if 0 +#define t(w8, w7, w6, w5, w4, w3, w2, w1, w0, code) \ + do { \ + const uint32_t mask[9] = {w0, w1, w2, w3, w4, w5, w6, w7, w8}; \ + if (mask[o8] & o8m) { code } \ + } while (0); +#else +#define t(w8, w7, w6, w5, w4, w3, w2, w1, w0) \ + if ((const uint32_t [9]){w0, w1, w2, w3, w4, w5, w6, w7, w8}[o8] & o8m) +#endif + +#define inst(op, ext) \ +static /*inline*/ void inst_##op(struct sux *cpu, uint8_t prefix, int inc_pc, int inc_clk, uint8_t thread) { \ + const unsigned int o8 = 0x##op / 32, o8m = 1 << (0x##op % 32); \ + uint64_t addr = 0, idx = 0, tmp = -1 \ + uint8_t pbits = 0x##op < 0x100 ? 0x30 : 0x20; \ + t(1, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000) { addr = 0xFFA0; } /* NMI Vector. */ \ + t(2, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000) { addr = 0xFFC0; } /* Reset Vector. */ \ + t(4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000) { addr = 0xFFE0; } /* IRQ Vector. */ \ + t(0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000) { addr = 0xFFF0; } /* BRK Vector. */ \ + t(0, 0x00400160, 0x00400160, 0x00000160, 0x00000160, 0x00001160, 0x10005161, 0x10005161, 0x00001160) { addr = read_addr(cpu, prefix, inc_clk, ZM, inc_pc) + idx; } /* Read Zero Matrix address. */ \ +} + #undef ORTHO_1CC #undef ORTHO_1OP #undef ORTHO_2OP |