From 417383e65370dd2875f3bdf13e69873a130530ea Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Mon, 6 Apr 2026 21:59:52 +0300 Subject: [PATCH] Debugger calculator floating point support and toggle options for floating point format output, end address updates. --- debug.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/debug.cpp b/debug.cpp index 7665dea5..5f7262b1 100644 --- a/debug.cpp +++ b/debug.cpp @@ -76,7 +76,7 @@ uae_u64 debug_illegal_mask; static int debug_mmu_mode; static bool break_if_enforcer; static uaecptr debug_pc; - +static bool debug_float; static int trace_cycles; static int last_hpos1, last_hpos2; static int last_vpos1, last_vpos2; @@ -230,7 +230,7 @@ static const TCHAR help[] = { _T(" wd [<0-1>] Enable illegal access logger. 1 = enable break.\n") _T(" L [] Load a block of Amiga memory.\n") _T(" S Save a block of Amiga memory.\n") - _T(" s \"\"/ [] []\n") + _T(" s \"\"/ [] []\n") _T(" Search for string/bytes.\n") _T(" T or Tt Show exec tasks and their PCs.\n") _T(" Td,Tl,Tr,Tp,Ts,TS,Ti,TO,TM,Tf Show devs, libs, resources, ports, semaphores,\n") @@ -249,7 +249,7 @@ static const TCHAR help[] = { _T(" v [-2 to -5] = enable visual DMA debugger.\n") _T(" vh [ ] \"Heat map\"\n") _T(" I Send custom event string\n") - _T(" ? Hex ($, 0x)/Bin (%)/Dec (!) converter and calculator. Floating point is partially supported.\n") + _T(" ? Hex ($, 0x)/Bin (%)/Dec (!) converter and calculator. \"?.\" to include also floating point formats.\n") #ifdef _WIN32 _T(" x Close debugger.\n") _T(" xx Switch between console and GUI debugger.\n") @@ -1131,6 +1131,7 @@ docalc: int v = calc(form, &out, tmp, sizeof(tmp) / sizeof(TCHAR)); if (v > 0) { *val = (uae_u32)out; + *valx80 = doubletof80(out); if (size && *size == 0) { uae_s32 v = (uae_s32)(*val); if (v > 255 || v < -127) { @@ -1287,9 +1288,6 @@ static void converter(TCHAR **c) return; } - uae_u64 df = floatx80_to_float64(xf, &st); - uae_u32 sf = floatx80_to_float32(xf, &st); - int i, j; for (i = 0, j = 0; i < 32; i++) { s[j++] = (v & (1 << (31 - i))) ? '1' : '0'; @@ -1298,9 +1296,15 @@ static void converter(TCHAR **c) } } s[j] = 0; - console_out_f(_T("$%08X = %%%s = %u = %d ($%08X.S = $%08X%08X.D = $%04X.%08X%08X.X = %f)\n"), v, s, v, (uae_s32)v, - sf, (uae_u32)(df >> 32), (uae_u32)df, (uae_u32)(xf.high), (uae_u32)(xf.low >> 32), (uae_u32)xf.low, - f80todouble(xf)); + if (debug_float) { + uae_u64 df = floatx80_to_float64(xf, &st); + uae_u32 sf = floatx80_to_float32(xf, &st); + console_out_f(_T("$%08X = %%%s = %u = %d ($%08X.S = $%08X%08X.D = $%04X.%08X%08X.X = %f)\n"), v, s, v, (uae_s32)v, + sf, (uae_u32)(df >> 32), (uae_u32)df, (uae_u32)(xf.high), (uae_u32)(xf.low >> 32), (uae_u32)xf.low, + f80todouble(xf)); + } else { + console_out_f(_T("$%08X = %%%s = %u = %d\n"), v, s, v, (uae_s32)v); + } } static bool isrom(uaecptr addr) @@ -6417,7 +6421,7 @@ static void searchmem (TCHAR **cc) endaddr = readhex(cc, NULL); } } - console_out_f (_T("Searching from %08X to %08X..\n"), addr + 1, endaddr); + console_out_f (_T("Searching from %08X to %08X..\n"), addr + 1, endaddr - 1); nextaddr_init(addr); bool out = false; while ((addr = nextaddr(addr, endaddr, NULL, true, &out)) != 0xffffffff) { @@ -7730,10 +7734,15 @@ static bool debug_line (TCHAR *input) break; case 'h': case '?': - if (more_params (&inptr)) - converter (&inptr); - else + if (more_params(&inptr)) { + if (peekchar(&inptr) == '.') { + debug_float = !debug_float; + } else { + converter(&inptr); + } + } else { debug_help (); + } break; } return false; -- 2.47.3