From ca926b3fb134dc47b0ff6815356c619344a8214c Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Thu, 6 Jul 2017 21:51:35 -0700 Subject: Fix s(tep) debug command for the case of dbra with an expired counter reg --- debug.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'debug.c') diff --git a/debug.c b/debug.c index 547a2bd..ff4c8d5 100644 --- a/debug.c +++ b/debug.c @@ -796,10 +796,16 @@ int run_debugger_command(m68k_context *context, char *input_buf, m68kinst inst, branch_f = after; branch_t = m68k_branch_target(&inst, context->dregs, context->aregs) & 0xFFFFFF; insert_breakpoint(context, branch_t, debugger); - } else if(inst.op == M68K_DBCC && inst.extra.cond != COND_FALSE) { - branch_t = after; - branch_f = m68k_branch_target(&inst, context->dregs, context->aregs) & 0xFFFFFF; - insert_breakpoint(context, branch_f, debugger); + } else if(inst.op == M68K_DBCC) { + if (inst.extra.cond == COND_FALSE) { + if (context->dregs[inst.dst.params.regs.pri] & 0xFFFF) { + after = m68k_branch_target(&inst, context->dregs, context->aregs); + } + } else { + branch_t = after; + branch_f = m68k_branch_target(&inst, context->dregs, context->aregs); + insert_breakpoint(context, branch_f, debugger); + } } else { after = m68k_branch_target(&inst, context->dregs, context->aregs) & 0xFFFFFF; } -- cgit v1.2.3