diff --git a/lib/cpu_proc.c b/lib/cpu_proc.c index 588f323..4146d2a 100644 --- a/lib/cpu_proc.c +++ b/lib/cpu_proc.c @@ -117,7 +117,7 @@ static void proc_cb(cpu_context *ctx) { emu_cycles(1); if(reg == RT_HL) { - emu_cycles(2); + //emu_cycles(2); } switch(bit_op) { @@ -333,11 +333,11 @@ static void proc_inc(cpu_context *ctx) { u16 val = cpu_read_reg(ctx->cur_inst->reg_1) + 1; if(is_16_bit(ctx->cur_inst->reg_1)) { - emu_cycles(1); + //emu_cycles(1); } if (ctx->cur_inst->reg_1 == RT_HL && ctx->dest_is_mem) { - val = bus_read(cpu_read_reg(RT_HL)) + 1; + val = ctx->fetched_data + 1; val &= 0xFF; bus_write(cpu_read_reg(RT_HL), val); } else { @@ -356,11 +356,11 @@ static void proc_dec(cpu_context *ctx) { u16 val = cpu_read_reg(ctx->cur_inst->reg_1) - 1; if(is_16_bit(ctx->cur_inst->reg_1)) { - emu_cycles(1); + //emu_cycles(1); } if (ctx->cur_inst->reg_1 == RT_HL && ctx->dest_is_mem) { - val = bus_read(cpu_read_reg(RT_HL)) - 1; + val = ctx->fetched_data - 1; val &= 0xFF; bus_write(cpu_read_reg(RT_HL), val); } else {