From 8de5574aab421fee729c1e74bfa2d17735102a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Mon, 13 Feb 2017 18:37:14 +0100 Subject: [PATCH] Handle accessing bus in zero page relative mode just as in zero page. It should make things less awkward and still work fine, as the only instructions using this mode are BBS and BBR. These only use first operand as the address in zero page to read data from. --- src/instruction.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/instruction.c b/src/instruction.c index 9ccd719..19af558 100644 --- a/src/instruction.c +++ b/src/instruction.c @@ -252,6 +252,7 @@ instruction_data_write_1(rk65c02emu_t *e, instrdef_t *id, instruction_t *i, uint switch (id->mode) { case ZP: + case ZPR: bus_write_1(e->bus, i->op1, val); break; case ZPX: @@ -290,13 +291,6 @@ instruction_data_write_1(rk65c02emu_t *e, instrdef_t *id, instruction_t *i, uint case ACCUMULATOR: e->regs.A = val; break; - case ZPR: - /* - * This mode is special as both operands have separate meaning. - * Handled withing emulation, as it is used only by BBS and BBR. - */ - assert(false); - break; case IMMEDIATE: case RELATIVE: case IABSOLUTE: @@ -329,6 +323,7 @@ instruction_data_read_1(rk65c02emu_t *e, instrdef_t *id, instruction_t *i) rv = i->op1; break; case ZP: + case ZPR: rv = bus_read_1(e->bus, i->op1); break; case ZPX: @@ -364,13 +359,6 @@ instruction_data_read_1(rk65c02emu_t *e, instrdef_t *id, instruction_t *i) case ABSOLUTEY: rv = bus_read_1(e->bus, (i->op1 + (i->op2 << 8)) + e->regs.Y); break; - case ZPR: - /* - * This mode is special as both operands have separate meaning. - * Handled withing emulation, as it is used only by BBS and BBR. - */ - assert(false); - break; case IABSOLUTE: case IABSOLUTEX: case RELATIVE: