summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcmd.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-11-27 02:17:55 +1100
committer Vas Crabb <vas@vastheman.com>2022-11-27 02:17:55 +1100
commit24f4988467cded3ca58fd8d8b794479530f06676 (patch)
treea15d4270d0bcbd7caf5cf5554ea8391f8378f209 /src/emu/debug/debugcmd.cpp
parent473478186ebdc51937dc08a83a1398d13b2912d7 (diff)
Revert "Make numbers signed in debugger where it matters"
This reverts commit 922d5b3c81459173ce99970dca0e44825f0a4494. This broke an important use case with MIPS3 address comparisons no longer behaving intutively. It's also another case of a debugger change that wasn't followed through properly, with absolutely no attempt to update the internal debugger help or the documentation for the web site. I realise signed maths woud be a useful feature, for the debugger, but it needs to be done in a way that doesn't break important use cases.
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r--src/emu/debug/debugcmd.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index 25f2ce5fbeb..4ccb88fbe20 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -151,9 +151,6 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu
symtable.add("s32", 1, 1, // sign-extend from 32 bits
[] (int params, const u64 *param) -> u64
{ return s64(s32(u32(param[0]))); });
- symtable.add("sext", 2, 2, // sign-extend from any width
- [] (int params, const u64 *param) -> u64
- { return util::sext(param[0], param[1]); });
symtable.add("cpunum", std::bind(&debugger_commands::get_cpunum, this));
// add all single-entry save state globals
@@ -524,7 +521,11 @@ bool debugger_commands::mini_printf(std::ostream &stream, std::string_view forma
m_console.printf("Not enough parameters for format!\n");
return false;
}
- util::stream_format(stream, zerofill ? "%0*X" : "%*X", width, *param);
+ if (u32(*param >> 32) != 0)
+ util::stream_format(stream, zerofill ? "%0*X" : "%*X", (width <= 8) ? 1 : width - 8, u32(*param >> 32));
+ else if (width > 8)
+ util::stream_format(stream, zerofill ? "%0*X" : "%*X", width - 8, 0);
+ util::stream_format(stream, zerofill ? "%0*X" : "%*X", (width < 8) ? width : 8, u32(*param));
param++;
params--;
break;
@@ -536,35 +537,36 @@ bool debugger_commands::mini_printf(std::ostream &stream, std::string_view forma
m_console.printf("Not enough parameters for format!\n");
return false;
}
- util::stream_format(stream, zerofill ? "%0*o" : "%*o", width, *param);
- param++;
- params--;
- break;
-
- case 'D':
- case 'd':
- if (params == 0)
+ if (u32(*param >> 60) != 0)
{
- m_console.printf("Not enough parameters for format!\n");
- return false;
+ util::stream_format(stream, zerofill ? "%0*o" : "%*o", (width <= 20) ? 1 : width - 20, u32(*param >> 60));
+ util::stream_format(stream, "%0*o", 10, u32(BIT(*param, 30, 30)));
+ }
+ else
+ {
+ if (width > 20)
+ util::stream_format(stream, zerofill ? "%0*o" : "%*o", width - 20, 0);
+ if (u32(BIT(*param, 30, 30)) != 0)
+ util::stream_format(stream, zerofill ? "%0*o" : "%*o", (width <= 10) ? 1 : width - 10, u32(BIT(*param, 30, 30)));
+ else if (width > 10)
+ util::stream_format(stream, zerofill ? "%0*o" : "%*o", width - 10, 0);
}
- util::stream_format(stream, zerofill ? "%0*d" : "%*d", width, s64(*param));
+ util::stream_format(stream, zerofill ? "%0*o" : "%*o", (width < 10) ? width : 10, u32(BIT(*param, 0, 30)));
param++;
params--;
break;
- case 'U':
- case 'u':
+ case 'D':
+ case 'd':
if (params == 0)
{
m_console.printf("Not enough parameters for format!\n");
return false;
}
- util::stream_format(stream, zerofill ? "%0*u" : "%*u", width, *param);
+ util::stream_format(stream, zerofill ? "%0*d" : "%*d", width, u32(*param));
param++;
params--;
break;
-
case 'C':
case 'c':
if (params == 0)