changeset 1424:4f96103b4b47

Fix s(tep) debug command for the case of dbra with an expired counter reg
author Michael Pavone <pavone@retrodev.com>
date Thu, 06 Jul 2017 21:51:35 -0700
parents 9a3e003bdcb3
children 49d3c572b3f2
files debug.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/debug.c	Fri Jun 30 18:42:52 2017 -0700
+++ b/debug.c	Thu Jul 06 21:51:35 2017 -0700
@@ -796,10 +796,16 @@
 					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;
 				}