From 1107d8dbe3b28c2cc585ae5ad33406efe06eb0db Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Mon, 13 Apr 2026 20:41:30 +0300 Subject: [PATCH] Debugger updates --- calc.cpp | 9 +++++++-- debug.cpp | 29 +++++++++++++++++------------ newcpu.cpp | 3 +++ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/calc.cpp b/calc.cpp index 0afd1b5b..db0df582 100644 --- a/calc.cpp +++ b/calc.cpp @@ -47,6 +47,7 @@ static int op_preced(const TCHAR c) switch(c) { case 0xf0: case 0xf1: case 0xf2: case '!': + case '~': return 4; case '*': case '/': case '\\': case '%': case '|': case '&': case '^': @@ -68,7 +69,7 @@ static bool op_left_assoc(const TCHAR c) switch(c) { // left to right case '*': case '/': case '%': case '+': case '-': - case '|': case '&': case '^': + case '|': case '&': case '^': case '~': case 0xf0: case 0xf1: case 0xf2: return true; // right to left @@ -88,6 +89,7 @@ static unsigned int op_arg_count(const TCHAR c) return 2; case '!': case ':': + case '~': case 0xf0: case 0xf1: case 0xf2: return 1; default: @@ -96,7 +98,7 @@ static unsigned int op_arg_count(const TCHAR c) return 0; } -#define is_operator(c) (c == '+' || c == '-' || c == '/' || c == '*' || c == '!' || c == '%' || c == '=' || \ +#define is_operator(c) (c == '+' || c == '-' || c == '/' || c == '*' || c == '!' || c == '%' || c == '=' || c == '~' || \ c == '|' || c == '&' || c == '^' || c == '@' || c == ('@' | 0x80) || c == '>' || c == '<' || c == ('>' | 0x80) || c == ('<' | 0x80) || \ c == '?' || c == ':' || c == 0xf0 || c == 0xf1 || c == 0xf2) #define is_function(c) (c >= 'A' && c <= 'Z') @@ -395,6 +397,9 @@ static bool docalcx(TCHAR op, double v1, double v2, double *valp) case ':': v = v1; break; + case '~': + v = ~(int)v1; + break; #ifdef DEBUGGER case 0xf0: v = get_byte_debug((uaecptr)v1); diff --git a/debug.cpp b/debug.cpp index 95f56882..b8408633 100644 --- a/debug.cpp +++ b/debug.cpp @@ -213,7 +213,7 @@ static const TCHAR help[] = { _T(" od Enable/disable Copper vpos/hpos tracing.\n") _T(" ot Copper single step trace.\n") _T(" ob Copper breakpoint.\n") - _T(" H[H] Show PC history (HH=full CPU info) instructions.\n") + _T(" H[H][s] Show PC history (HH=full CPU info, s=disable DMA info) instructions.\n") _T(" C Search for values like energy or lifes in games.\n") _T(" mmu Set current MMU translation function code for all debugging instructions.\n") _T(" mmud Dump MMU tables.\n") @@ -520,7 +520,7 @@ static bool isoperator(TCHAR **cp) TCHAR c1 = c ? _totupper((*cp)[1]) : 0; TCHAR c2 = c1 ? _totupper((*cp)[2]) : 0; return c == '+' || c == '-' || c == '/' || c == '*' || c == '(' || c == ')' || - c == '|' || c == '&' || c == '^' || c == '=' || c == '>' || c == '<' || + c == '|' || c == '&' || c == '^' || c == '~' || c == '=' || c == '>' || c == '<' || (c == 'R' && (c1 == 'L' || c1 == 'W' || c1 == 'B') && c2 == '('); } @@ -6469,7 +6469,7 @@ static void searchmem (TCHAR **cc) } } } - console_out_f(_T("Searching from %08X to %08X..\n"), addr + 1, endaddr - 1); + console_out_f(_T("Searching from %08X to %08X\n"), addr + 1, endaddr - 1); nextaddr_init(addr); bool out = false; int colcnt = 0; @@ -6659,7 +6659,7 @@ static void debug_sprite (TCHAR **inptr) ypos = ypos_ecs; ypose = ypose_ecs; } - + int spritey = 0; for (y = ypos; y < ypose; y++) { int x; addr += size * 4; @@ -6716,12 +6716,13 @@ static void debug_sprite (TCHAR **inptr) } } tmp[width] = 0; - console_out_f (_T("%3d %06X %s\n"), y, addr, tmp); + console_out_f (_T("%3d %3d %06X %s\n"), y, spritey, addr, tmp); + spritey++; } console_out_f (_T("Sprite address %08X, Width=%d\n"), saddr, size * 16); - console_out_f (_T("OCS: StartX=%d StartY=%d EndY=%d Height=%d\n"), xpos, ypos, ypose, ypose - ypos + 1); - console_out_f (_T("ECS: StartX=%d (%d.%d) StartY=%d EndY=%d Height=%d %s\n"), xpos_ecs, xpos_ecs / 4, xpos_ecs & 3, ypos_ecs, ypose_ecs, ypose_ecs - ypos_ecs + 1, ecs ? _T(" (*)") : _T("")); + console_out_f (_T("OCS: StartX=%d StartY=%d EndY=%d Height=%d\n"), xpos, ypos, ypose - 1, ypose - ypos); + console_out_f (_T("ECS: StartX=%d (%d.%d) StartY=%d EndY=%d Height=%d %s\n"), xpos_ecs, xpos_ecs / 4, xpos_ecs & 3, ypos_ecs, ypose_ecs - 1, ypose_ecs - ypos_ecs + 1, ecs ? _T(" (*)") : _T("")); console_out_f (_T("Attach: %d. AGA SSCAN/SH10 bit: %d\n"), attach, sh10); addr += size * 4; @@ -6856,7 +6857,7 @@ static void find_ea (TCHAR **inptr) } } } - console_out_f (_T("Searching from %08X to %08X\n"), addr + 1, end); + console_out_f (_T("Searching from %08X to %08X\n"), addr + 1, end - 1); end2 = 0; nextaddr_init(addr); bool out = false; @@ -6870,7 +6871,7 @@ static void find_ea (TCHAR **inptr) out = true; hits++; if (hits > 100) { - console_out_f (_T("Too many hits. End addr = %08X\n"), addr); + console_out_f (_T("Too many hits. End addr = %08X\n"), addr - 1); break; } } @@ -7476,6 +7477,7 @@ static bool debug_line (TCHAR *input) uae_u32 oldpc = m68k_getpc (); int lastframes, lastvpos, lasthpos; struct regstruct save_regs = regs; + bool dmadata = true; badly = 0; if (inptr[0] == 'H') { @@ -7487,7 +7489,10 @@ static bool debug_line (TCHAR *input) dmadbg = 1; inptr++; } - + if (inptr[0] == 's') { + dmadata = false; + inptr++; + } if (more_params(&inptr)) count = readint(&inptr, NULL); else @@ -7517,7 +7522,7 @@ static bool debug_line (TCHAR *input) if (badly) { m68k_dumpstate(NULL, 0xffffffff); } else { - if (dmadbg && lastvpos >= 0) { + if (dmadbg && lastvpos >= 0 && dmadata) { dma_disasm(lastframes, lastvpos, lasthpos, history[temp].fp, history[temp].vpos, history[temp].hpos); } lastframes = history[temp].fp; @@ -7951,11 +7956,11 @@ static bool check_breakpoint(struct breakpoint_node *bpn, uaecptr pc) static bool check_breakpoint_count(struct breakpoint_node *bpn, uaecptr pc) { + bpn->cnt--; if (bpn->cnt <= 0) { return true; } console_out_f(_T("Breakpoint %d hit: PC=%08x, count=%d.\n"), bpn - bpnodes, pc, bpn->cnt); - bpn->cnt--; return false; } diff --git a/newcpu.cpp b/newcpu.cpp index 46a0fb87..a60f42bb 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -6937,6 +6937,9 @@ void m68k_dumpcache (bool dc) if (!currprefs.cpu_compatible) return; if (currprefs.cpu_model == 68020) { + if (dc) { + return; + } for (int i = 0; i < CACHELINES020; i += 4) { for (int j = 0; j < 4; j++) { int s = i + j; -- 2.47.3