machine/53c7xx.cpp: Don't use static buffers for messages, don't clash with the LOG_GENERAL constant.

This commit is contained in:
Vas Crabb 2022-02-25 05:47:34 +11:00
parent 81640f1587
commit c5230c145f
2 changed files with 12 additions and 15 deletions

View File

@ -23,10 +23,10 @@
// DEBUGGERY // DEBUGGERY
//************************************************************************** //**************************************************************************
#define LOG_UNHANDLED (1U << 0) #define LOG_UNHANDLED (1U << 1)
#define LOG_HOST (1U << 1) #define LOG_HOST (1U << 2)
#define LOG_STATE (1U << 2) #define LOG_STATE (1U << 3)
#define LOG_SCRIPTS (1U << 3) #define LOG_SCRIPTS (1U << 4)
#define VERBOSE (0) #define VERBOSE (0)
#include "logmacro.h" #include "logmacro.h"
@ -1735,7 +1735,7 @@ void ncr53c7xx_device::tc_int()
// disassemble_scripts - // disassemble_scripts -
//------------------------------------------------- //-------------------------------------------------
const char* ncr53c7xx_device::disassemble_scripts() std::string ncr53c7xx_device::disassemble_scripts()
{ {
static char const *const phases[] = static char const *const phases[] =
{ {
@ -1749,14 +1749,13 @@ const char* ncr53c7xx_device::disassemble_scripts()
"Message In" "Message In"
}; };
static char buffer[64]; std::string opstring;
char opstring[64];
switch ((m_dcmd >> 6) & 3) switch ((m_dcmd >> 6) & 3)
{ {
case 0: case 0:
{ {
sprintf(opstring, "BMOV: %s [%x] %d bytes\n", phases[m_dcmd & 7], m_dnad, m_dbc); opstring = util::string_format("BMOV: %s [%x] %d bytes\n", phases[m_dcmd & 7], m_dnad, m_dbc);
break; break;
} }
case 1: case 1:
@ -1773,7 +1772,7 @@ const char* ncr53c7xx_device::disassemble_scripts()
"ILLEGAL", "ILLEGAL",
}; };
sprintf(opstring, "IO: %s (%x)\n", ops[(m_dcmd >> 3) & 7], m_dnad); opstring = util::string_format("IO: %s (%x)\n", ops[(m_dcmd >> 3) & 7], m_dnad);
break; break;
} }
case 2: case 2:
@ -1790,17 +1789,15 @@ const char* ncr53c7xx_device::disassemble_scripts()
"ILLEGAL", "ILLEGAL",
}; };
sprintf(opstring, "TC: %s %c (%s) (%x)\n", ops[(m_dcmd >> 3) & 7], m_dbc & (1 << 19) ? 'T' : 'F', phases[m_dcmd & 7], m_dnad); opstring = util::string_format("TC: %s %c (%s) (%x)\n", ops[(m_dcmd >> 3) & 7], m_dbc & (1 << 19) ? 'T' : 'F', phases[m_dcmd & 7], m_dnad);
break; break;
} }
case 3: case 3:
{ {
sprintf(opstring, "ILLEGAL"); opstring = "ILLEGAL";
break; break;
} }
} }
sprintf(buffer, "SCRIPTS [%08x]: %s", m_dsp - 8, opstring); return util::string_format("SCRIPTS [%08x]: %s", m_dsp - 8, opstring);
return buffer;
} }

View File

@ -122,7 +122,7 @@ private:
void tc_return(); void tc_return();
void tc_int(); void tc_int();
void illegal(); void illegal();
const char* disassemble_scripts(); std::string disassemble_scripts();
// SCSI registers // SCSI registers