]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Debugger calculator floating point support and toggle options for floating point...
authorToni Wilen <twilen@winuae.net>
Mon, 6 Apr 2026 18:59:52 +0000 (21:59 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 6 Apr 2026 18:59:52 +0000 (21:59 +0300)
debug.cpp

index 7665dea55ca5384abeac1277ed528ba4619ca806..5f7262b11653b0dbdf7c75768b23e074f2487a6f 100644 (file)
--- 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 <file> <addr> [<n>] Load a block of Amiga memory.\n")
        _T("  S <file> <addr> <n>   Save a block of Amiga memory.\n")
-       _T("  s \"<string>\"/<values> [<addr>] [<length>]\n")
+       _T("  s \"<string>\"/<values> [<addr>] [<endaddr-1>]\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 [<ratio> <lines>]  \"Heat map\"\n")
        _T("  I <custom event>      Send custom event string\n")
-       _T("  ?<value>              Hex ($, 0x)/Bin (%)/Dec (!) converter and calculator. Floating point is partially supported.\n")
+       _T("  ?<value>              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;