From eabf30121c4f8412a6bf841b01383557ab5a9202 Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Sun, 9 Feb 2014 10:29:29 -0800 Subject: Properly handle dbcc, rtr and rte in the debugger next command --- blastem.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'blastem.c') diff --git a/blastem.c b/blastem.c index 0d173fc..d7cf953 100644 --- a/blastem.c +++ b/blastem.c @@ -1465,17 +1465,27 @@ m68k_context * debugger(m68k_context * context, uint32_t address) printf(format, param, value); break; case 'n': - //TODO: Deal with dbcc, rtr and rte if (inst.op == M68K_RTS) { after = (read_dma_value(context->aregs[7]/2) << 16) | read_dma_value(context->aregs[7]/2 + 1); + } else if (inst.op == M68K_RTE || inst.op == M68K_RTR) { + after = (read_dma_value((context->aregs[7]+2)/2) << 16) | read_dma_value((context->aregs[7]+2)/2 + 1); } else if(inst.op == M68K_BCC && inst.extra.cond != COND_FALSE) { - if (inst.extra.cond = COND_TRUE) { + if (inst.extra.cond == COND_TRUE) { after = inst.address + 2 + inst.src.params.immed; } else { branch_f = after; branch_t = inst.address + 2 + inst.src.params.immed; insert_breakpoint(context, branch_t, (uint8_t *)debugger); } + } else if(inst.op == M68K_DBCC) { + if (inst.extra.cond == COND_FALSE) { + if (context->dregs[inst.dst.params.regs.pri] & 0xFFFF) { + after = inst.address + 2 + inst.src.params.immed; + } + } else if (inst.extra.cond != COND_TRUE) { + branch_t = after; + branch_f = inst.address + 2 + inst.src.params.immed; + } } else if(inst.op == M68K_JMP) { switch(inst.src.addr_mode) { -- cgit v1.2.3