summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-01-04 21:02:14 -0500
committer AJR <ajrhacker@users.noreply.github.com>2018-01-04 21:02:14 -0500
commitdacae4aa1b0b17fcf859afffcbfa728d8fad07ba (patch)
treeef3f4bab792d396937b4010b2068354481698b3a
parentbe48503e920a1e86af45213d5fad26f7db633054 (diff)
3c505, omti8621, sc499: Eliminate firstcpu usage (nw)
-rw-r--r--src/devices/bus/isa/3c505.cpp17
-rw-r--r--src/devices/bus/isa/3c505.h6
-rw-r--r--src/devices/bus/isa/omti8621.cpp40
-rw-r--r--src/devices/bus/isa/omti8621.h2
-rw-r--r--src/devices/bus/isa/sc499.cpp17
-rw-r--r--src/devices/bus/isa/sc499.h2
6 files changed, 25 insertions, 59 deletions
diff --git a/src/devices/bus/isa/3c505.cpp b/src/devices/bus/isa/3c505.cpp
index 555aefd9142..6c73275da90 100644
--- a/src/devices/bus/isa/3c505.cpp
+++ b/src/devices/bus/isa/3c505.cpp
@@ -417,26 +417,13 @@ void threecom3c505_device::device_reset()
cpu_context - return a string describing the current CPU context
***************************************************************************/
-const char *threecom3c505_device::cpu_context()
+std::string threecom3c505_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/devices/bus/isa/3c505.h b/src/devices/bus/isa/3c505.h
index aed8556c0a2..efdbe7dc7de 100644
--- a/src/devices/bus/isa/3c505.h
+++ b/src/devices/bus/isa/3c505.h
@@ -138,7 +138,7 @@ protected:
virtual int tx_data(device_t *, const uint8_t *, int);
virtual int setfilter(device_t *, int);
- const char *cpu_context();
+ std::string cpu_context() const;
template <typename Format, typename... Params> void logerror(Format &&fmt, Params &&... args) const;
// device-level overrides
@@ -178,7 +178,7 @@ private:
void log(const char *title) const;
private:
- const char *cpu_context() { return m_device->cpu_context(); }
+ std::string cpu_context() const { return m_device->cpu_context(); }
threecom3c505_device *m_device; // pointer back to our device
uint16_t m_length;
@@ -198,7 +198,7 @@ private:
int is_empty () { return m_get_index == m_put_index; }
int is_full () { return ((m_put_index + 1) % m_size) == m_get_index; }
private:
- const char *cpu_context() { return m_device->cpu_context(); }
+ std::string cpu_context() const { return m_device->cpu_context(); }
threecom3c505_device *m_device; // pointer back to our device
uint16_t m_size;
diff --git a/src/devices/bus/isa/omti8621.cpp b/src/devices/bus/isa/omti8621.cpp
index 176e695169a..7352f4380a4 100644
--- a/src/devices/bus/isa/omti8621.cpp
+++ b/src/devices/bus/isa/omti8621.cpp
@@ -23,7 +23,7 @@
static int verbose = VERBOSE;
-#define LOG(x) { logerror ("%s: ", cpu_context(this)); logerror x; logerror ("\n"); }
+#define LOG(x) { logerror ("%s: ", cpu_context()); logerror x; logerror ("\n"); }
#define LOG1(x) { if (verbose > 0) LOG(x)}
#define LOG2(x) { if (verbose > 1) LOG(x)}
#define LOG3(x) { if (verbose > 2) LOG(x)}
@@ -186,23 +186,13 @@ enum {
cpu_context - return a string describing the current CPU context
***************************************************************************/
-static const char *cpu_context(const device_t *device) {
- static char statebuf[64]; /* string buffer containing state description */
-
- device_t *cpu = device->machine().firstcpu;
-
- /* if we have an executing CPU, output data */
- if (cpu != nullptr) {
- osd_ticks_t t = osd_ticks();
- int s = (t / osd_ticks_per_second()) % 3600;
- int ms = (t / (osd_ticks_per_second() / 1000)) % 1000;
+std::string omti8621_device::cpu_context() const
+{
+ osd_ticks_t t = osd_ticks();
+ int s = (t / osd_ticks_per_second()) % 3600;
+ int ms = (t / (osd_ticks_per_second() / 1000)) % 1000;
- sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(),
- cpu->safe_pcbase(), device->tag());
- } else {
- strcpy(statebuf, "(no context)");
- }
- return statebuf;
+ return string_format("%d.%03d %s", s, ms, machine().describe_context());
}
static SLOT_INTERFACE_START( pc_hd_floppies )
@@ -699,7 +689,7 @@ void omti8621_device::log_command(const uint8_t cdb[], const uint16_t cdb_length
{
if (verbose > 0) {
int i;
- logerror("%s: OMTI command ", cpu_context(this));
+ logerror("%s: OMTI command ", cpu_context());
switch (cdb[0]) {
case OMTI_CMD_TEST_DRIVE_READY: // 0x00
logerror("Test Drive Ready");
@@ -798,7 +788,7 @@ void omti8621_device::log_data()
{
if (verbose > 0) {
int i;
- logerror("%s: OMTI data (length=%02x)", cpu_context(this),
+ logerror("%s: OMTI data (length=%02x)", cpu_context(),
data_length);
for (i = 0; i < data_length && i < OMTI_DISK_SECTOR_SIZE; i++) {
logerror(" %02x", data_buffer[i]);
@@ -1317,7 +1307,7 @@ omti_disk_image_device::omti_disk_image_device(const machine_config &mconfig, co
void omti_disk_image_device::omti_disk_config(uint16_t disk_type)
{
- LOG1(("omti_disk_config: configuring disk with type %x", disk_type));
+ logerror("omti_disk_config: configuring disk with type %x\n", disk_type);
switch (disk_type)
{
@@ -1360,11 +1350,11 @@ void omti_disk_image_device::device_start()
if (!m_image->is_open())
{
- LOG1(("device_start_omti_disk: no disk"));
+ logerror("device_start_omti_disk: no disk\n");
}
else
{
- LOG1(("device_start_omti_disk: with disk image %s",m_image->basename() ));
+ logerror("device_start_omti_disk: with disk image %s\n", m_image->basename());
}
// default disk type
@@ -1377,14 +1367,14 @@ void omti_disk_image_device::device_start()
void omti_disk_image_device::device_reset()
{
- LOG1(("device_reset_omti_disk"));
+ logerror("device_reset_omti_disk\n");
if (exists() && fseek(0, SEEK_END) == 0)
{
uint32_t disk_size = (uint32_t)(ftell() / OMTI_DISK_SECTOR_SIZE);
uint16_t disk_type = disk_size >= 300000 ? OMTI_DISK_TYPE_348_MB : OMTI_DISK_TYPE_155_MB;
if (disk_type != m_type) {
- LOG1(("device_reset_omti_disk: disk size=%d blocks, disk type=%x", disk_size, disk_type ));
+ logerror("device_reset_omti_disk: disk size=%d blocks, disk type=%x\n", disk_size, disk_type);
omti_disk_config(disk_type);
}
}
@@ -1396,7 +1386,7 @@ void omti_disk_image_device::device_reset()
image_init_result omti_disk_image_device::call_create(int format_type, util::option_resolution *format_options)
{
- LOG(("device_create_omti_disk: creating OMTI Disk with %d blocks", m_sector_count));
+ logerror("device_create_omti_disk: creating OMTI Disk with %d blocks\n", m_sector_count);
int x;
unsigned char sectordata[OMTI_DISK_SECTOR_SIZE]; // empty block data
diff --git a/src/devices/bus/isa/omti8621.h b/src/devices/bus/isa/omti8621.h
index 33411ef0da5..6e1953e00f3 100644
--- a/src/devices/bus/isa/omti8621.h
+++ b/src/devices/bus/isa/omti8621.h
@@ -65,6 +65,8 @@ protected:
omti_disk_image_device *our_disks[OMTI_MAX_LUN+1];
+ std::string cpu_context() const;
+
private:
DECLARE_WRITE_LINE_MEMBER( fdc_irq_w );
DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
diff --git a/src/devices/bus/isa/sc499.cpp b/src/devices/bus/isa/sc499.cpp
index c7ccabf1802..d22d0e675c2 100644
--- a/src/devices/bus/isa/sc499.cpp
+++ b/src/devices/bus/isa/sc499.cpp
@@ -399,26 +399,13 @@ void sc499_device::device_reset()
cpu_context - return a string describing the current CPU context
-------------------------------------------------*/
-const char *sc499_device::cpu_context()
+std::string sc499_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/devices/bus/isa/sc499.h b/src/devices/bus/isa/sc499.h
index 0daf242eb83..70bb647463f 100644
--- a/src/devices/bus/isa/sc499.h
+++ b/src/devices/bus/isa/sc499.h
@@ -82,7 +82,7 @@ private:
virtual void dack_w(int line,uint8_t data) override;
virtual void eop_w(int state) override;
- const char *cpu_context();
+ std::string cpu_context() const;
template <typename Format, typename... Params> void logerror(Format &&fmt, Params &&... args) const;
void tape_status_clear(uint16_t value);