From be48503e920a1e86af45213d5fad26f7db633054 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 4 Jan 2018 20:46:43 -0500 Subject: [PATCH] apollo_kbd.cpp: Eliminate firstcpu usage (nw) --- src/mame/machine/apollo_kbd.cpp | 17 ++--------------- src/mame/machine/apollo_kbd.h | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/mame/machine/apollo_kbd.cpp b/src/mame/machine/apollo_kbd.cpp index 3d25977459e..13e3ba485b8 100644 --- a/src/mame/machine/apollo_kbd.cpp +++ b/src/mame/machine/apollo_kbd.cpp @@ -266,26 +266,13 @@ void apollo_kbd_device::device_reset() cpu_context - return a string describing the current CPU context ***************************************************************************/ -const char *apollo_kbd_device::cpu_context() +std::string apollo_kbd_device::cpu_context() const { - static char statebuf[64]; /* string buffer containing state description */ - - device_t *cpu = machine().firstcpu; osd_ticks_t t = osd_ticks(); int s = (t / osd_ticks_per_second()) % 3600; int ms = (t / (osd_ticks_per_second() / 1000)) % 1000; - /* if we have an executing CPU, output data */ - if (cpu != nullptr) - { - sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(), - cpu->safe_pcbase(), tag()); - } - else - { - sprintf(statebuf, "%d.%03d", s, ms); - } - return statebuf; + return string_format("%d.%03d %s", s, ms, machine().describe_context()); } //************************************************************************** diff --git a/src/mame/machine/apollo_kbd.h b/src/mame/machine/apollo_kbd.h index 700dcb1fffd..a2486df55f3 100644 --- a/src/mame/machine/apollo_kbd.h +++ b/src/mame/machine/apollo_kbd.h @@ -65,7 +65,7 @@ private: TIMER_CALLBACK_MEMBER( kbd_scan_timer ); - const char *cpu_context() ; + std::string cpu_context() const; template void logerror(Format &&fmt, Params &&... args) const;