From c12ed1dd926b6d40c9a88158f94fa48af77e03e1 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 14 Jan 2022 13:27:05 -0400 Subject: Consolidate reading addresses for non-indirect addressing modes into a single block. --- sux.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sux.h b/sux.h index 0b79805..23130b8 100644 --- a/sux.h +++ b/sux.h @@ -1795,16 +1795,17 @@ static /*inline*/ void inst_##op(struct sux *cpu, uint8_t prefix, uint8_t size, const uint8_t rs = 1 << ((prefix >> 4) & 3); \ uint64_t addr = 0, idx = 0, tmp = -1, tmp2 = -1; \ uint64_t dummy = 0, *reg = &dummy; \ - int pre_idx = 0; \ + int pre_idx = 0, mem_type = ZM; \ 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(7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000) { prefix = 0x0F; } /* Interrupts. */ \ + t(7, 0x00060000, 0x00060000, 0x00160000, 0x00160000, 0x01160200, 0x01160000, 0x01170000, 0x01170000) { mem_type = ABS; } /* Interrupts, and absolute. */ \ t(0, 0x01000100, 0x01000100, 0x04000400, 0x00000000, 0x00000000, 0x40004000, 0x40004000, 0x00000000) { idx = cpu->x; } /* Register index. */ \ t(0, 0x06400200, 0x06400400, 0x00000000, 0x00000000, 0x00000000, 0x10000000, 0x10000000, 0x00000000) { idx = cpu->y; } \ - 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(7, 0x00460160, 0x00460160, 0x00160160, 0x00160160, 0x01161360, 0x11165161, 0x11175161, 0x01171160) { addr = read_addr(cpu, prefix, inc_clk, mem_type, inc_pc) + idx; } /* Read address from memory. */ \ t(0, 0x01000000, 0x01000000, 0x04000400, 0x00000000, 0x00000000, 0x40000000, 0x40000000, 0x00000000) { pre_idx = 1; } /* Set pre-index flag, for indexed indirect. */ \ t(0, 0x07101210, 0x17101410, 0x14001400, 0x10001000, 0x10000000, 0x40000000, 0x40000000, 0x00000000) { addr = ind_idx_addr(cpu, prefix, inc_clk, ZM, inc_pc, idx, pre_idx); } /* Indirect addressing, with indexing. */ \ t(0, 0x07561370, 0x17561570, 0x14161560, 0x10161160, 0x11161160, 0x51165161, 0x51175161, 0x01171160) { tmp = read_value(cpu, 0, addr, rs, inc_clk, 1); } /* Read data from memory. */ \ -- cgit v1.2.3-13-gbd6f