summaryrefslogtreecommitdiff
path: root/debug.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-07-06 21:51:35 -0700
committerMichael Pavone <pavone@retrodev.com>2017-07-06 21:51:35 -0700
commitca926b3fb134dc47b0ff6815356c619344a8214c (patch)
tree16192f9c1291bb2d71a26d1c4c385e016d3ccbb0 /debug.c
parent34891053bed6e161e8cdd9712e61c6c9dd7b105b (diff)
Fix s(tep) debug command for the case of dbra with an expired counter reg
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c14
1 files changed, 10 insertions, 4 deletions
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;
}