summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-01-16 13:12:56 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2022-01-16 13:16:14 -0400
commitff291e298ad211447de98bb92cdb71da77da4281 (patch)
treea5508429a1837cbd2e788db8e8b2fc3b65b2895e
parent8aef7c3081634e16f039ae563797977c337069dc (diff)
Add bitmasks for the registers.
-rw-r--r--sux.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sux.h b/sux.h
index 23130b8..df99c76 100644
--- a/sux.h
+++ b/sux.h
@@ -1797,6 +1797,7 @@ static /*inline*/ void inst_##op(struct sux *cpu, uint8_t prefix, uint8_t size,
uint64_t dummy = 0, *reg = &dummy; \
int pre_idx = 0, mem_type = ZM; \
uint8_t pbits = 0x##op < 0x100 ? 0x10 : 0; \
+ /* Decode Address. */ \
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. */ \
@@ -1808,6 +1809,12 @@ static /*inline*/ void inst_##op(struct sux *cpu, uint8_t prefix, uint8_t size,
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. */ \
+ /* Load Source. */ \
+ t(0, 0x02220022, 0x00320422, 0x00220432, 0x00661076, 0x00660066, 0x00660466, 0x51665466, 0x00660466) { reg = &cpu->a; } /* Most operations use the accumulator as an operand */ \
+ t(0, 0x04100000, 0x04000000, 0x04000200, 0x02000000, 0x10000000, 0x51005000, 0x00000000, 0x04100110) { reg = &cpu->b; } /* stb, cpb, inb, deb, tba */ \
+ t(0, 0x00000000, 0x00001200, 0x02000000, 0x00001000, 0x05001000, 0x04000000, 0x00100110, 0x00000000) { reg = &cpu->x; } /* stx, cpx, inx, dex, txa, txy */ \
+ t(0, 0x00000000, 0x00000000, 0x00000000, 0x10001200, 0x02000400, 0x00100110, 0x04000000, 0x01001000) { reg = &cpu->y; } /* sty, cpy, iny, dey, tya, tyx */ \
+ t(0, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000) { reg = &cpu->sp; } /* tsx */ \
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. */ \
}