From 8b17c9b333d20f4cb54d13cebadf46a149f0be77 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 14 Jan 2022 13:23:09 -0400 Subject: Add bitmasks for reading data from memory, and immediate data. --- sux.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sux.h') diff --git a/sux.h b/sux.h index bec5bd6..965fd70 100644 --- a/sux.h +++ b/sux.h @@ -1792,14 +1792,18 @@ static /*inline*/ void exec_base_inst(struct sux *cpu, uint8_t opcode, uint8_t p #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; \ + const uint8_t rs = 1 << ((prefix >> 4) & 3); \ + uint64_t addr = 0, idx = 0, tmp = -1, tmp2 = -1; \ + uint64_t dummy = 0, *reg = &dummy; \ + uint8_t pbits = 0x##op < 0x100 ? 0x10 : 0; \ 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. */ \ t(0, 0x00060000, 0x00060000, 0x00160000, 0x00160000, 0x01160000, 0x01160000, 0x01170000, 0x01170000) { addr = read_addr(cpu, prefix, inc_clk, ABS, inc_pc); } /* Read Absolute address. */ \ + t(0, 0x07561370, 0x17561570, 0x14161560, 0x10161160, 0x11161160, 0x51165161, 0x51175161, 0x01171160) { tmp = read_value(cpu, 0, addr, rs, inc_clk, 1); } /* Read data from memory. */ \ + t(0, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000016, 0x00000016, 0x00000016, 0x00000016) { tmp = read_value(cpu, 0, cpu->pc, rs, inc_clk, 0); cpu->pc += rs; } /* Immediate data. */ \ } #undef ORTHO_1CC -- cgit v1.2.3-13-gbd6f