From b66858d124f490f34c35b241f3d976fcb058055d Mon Sep 17 00:00:00 2001 From: tedgreen99 Date: Sun, 8 May 2022 20:12:44 -0600 Subject: Add time command to MAME debugger. Returns current machine time. (#9727) --- src/emu/debug/debugcmd.cpp | 10 ++++++++++ src/emu/debug/debugcmd.h | 1 + src/emu/debug/debughlp.cpp | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 21d143c7f1d..ff29281ab64 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -245,6 +245,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu m_console.register_command("suspend", CMDFLAG_NONE, 0, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_suspend, this, _1)); m_console.register_command("resume", CMDFLAG_NONE, 0, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_resume, this, _1)); m_console.register_command("cpulist", CMDFLAG_NONE, 0, 0, std::bind(&debugger_commands::execute_cpulist, this, _1)); + m_console.register_command("time", CMDFLAG_NONE, 0, 0, std::bind(&debugger_commands::execute_time, this, _1)); m_console.register_command("comadd", CMDFLAG_NONE, 1, 2, std::bind(&debugger_commands::execute_comment_add, this, _1)); m_console.register_command("//", CMDFLAG_NONE, 1, 2, std::bind(&debugger_commands::execute_comment_add, this, _1)); @@ -1671,6 +1672,15 @@ void debugger_commands::execute_cpulist(const std::vector ¶ms) } } +//------------------------------------------------- +// execute_time - execute the time command +//------------------------------------------------- + +void debugger_commands::execute_time(const std::vector ¶ms) +{ + m_console.printf("%s\n", m_machine.time().as_string()); +} + /*------------------------------------------------- execute_comment - add a comment to a line -------------------------------------------------*/ diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h index 88ae785e643..f93276d5d8d 100644 --- a/src/emu/debug/debugcmd.h +++ b/src/emu/debug/debugcmd.h @@ -130,6 +130,7 @@ private: void execute_resume(const std::vector ¶ms); void execute_next(const std::vector ¶ms); void execute_cpulist(const std::vector ¶ms); + void execute_time(const std::vector ¶ms); void execute_comment_add(const std::vector ¶ms); void execute_comment_del(const std::vector ¶ms); void execute_comment_save(const std::vector ¶ms); diff --git a/src/emu/debug/debughlp.cpp b/src/emu/debug/debughlp.cpp index 869167e96e8..dd2a506cde8 100644 --- a/src/emu/debug/debughlp.cpp +++ b/src/emu/debug/debughlp.cpp @@ -81,6 +81,7 @@ const help_item f_static_help_list[] = " stateload[sl] -- load a state file for the current driver\n" " snap [] -- save a screen snapshot.\n" " source -- reads commands from and executes them one by one\n" + " time -- prints current machine time to the console\n" " cls -- clears the console text buffer\n" " quit -- exits MAME and the debugger\n" }, @@ -580,6 +581,13 @@ const help_item f_static_help_list[] = "source break_and_trace.cmd\n" " Reads in debugger commands from break_and_trace.cmd and executes them.\n" }, + { + "time", + "\n" + " time\n" + "\n" + "The time command prints the current machine time to the console.\n" + }, { "quit", "\n" -- cgit v1.2.3