summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2016-11-11 16:31:39 -0500
committer Nathan Woods <npwoods@mess.org>2016-11-11 16:31:39 -0500
commit030d8530515c74dc878ce2c2100de70a49d2b739 (patch)
tree7673cf74d0ab15260fff68cfdc043233855447c7
parentdbd07cef385248937dc509135088f81329216209 (diff)
Changed the Cube Quest disassemblers to use 'std::ostream &' internally
-rw-r--r--src/devices/cpu/cubeqcpu/cubedasm.cpp43
1 files changed, 37 insertions, 6 deletions
diff --git a/src/devices/cpu/cubeqcpu/cubedasm.cpp b/src/devices/cpu/cubeqcpu/cubedasm.cpp
index 034ac4873b2..6d346f9dc7a 100644
--- a/src/devices/cpu/cubeqcpu/cubedasm.cpp
+++ b/src/devices/cpu/cubeqcpu/cubedasm.cpp
@@ -58,7 +58,7 @@ static const char *const dst[] =
SOUND DISASSEMBLY HOOK
***************************************************************************/
-CPU_DISASSEMBLE( cquestsnd )
+static offs_t internal_disasm_cquestsnd(cpu_device *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options)
{
static const char *const jmps[] =
{
@@ -103,7 +103,7 @@ CPU_DISASSEMBLE( cquestsnd )
int _rin = (inslow >> 26) & 1;
- sprintf(buffer, "%s %s %s %x,%x,%c %.2x %s %s %.2x %s %s %s %c %c %c",
+ util::stream_format(stream, "%s %s %s %x,%x,%c %02x %s %s %02x %s %s %s %c %c %c",
ins[i5_3],
src[i2_0],
dst[i8_6],
@@ -125,11 +125,21 @@ CPU_DISASSEMBLE( cquestsnd )
}
+CPU_DISASSEMBLE(cquestsnd)
+{
+ std::ostringstream stream;
+ offs_t result = internal_disasm_cquestsnd(device, stream, pc, oprom, opram, options);
+ std::string stream_str = stream.str();
+ strcpy(buffer, stream_str.c_str());
+ return result;
+}
+
+
/***************************************************************************
ROTATE DISASSEMBLY HOOK
***************************************************************************/
-CPU_DISASSEMBLE( cquestrot )
+static offs_t internal_disasm_cquestrot(cpu_device *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options)
{
static const char *const jmps[] =
{
@@ -204,7 +214,7 @@ CPU_DISASSEMBLE( cquestrot )
// int _sex = (inslow >> 19) & 0x1;
int i2_0 = (inslow >> 16) & 0x7;
- sprintf(buffer, "%s %s,%s %x,%x,%c %d %s %s %s %.2x",
+ util::stream_format(stream, "%s %s,%s %x,%x,%c %d %s %s %s %02x",
ins[i5_3],
src[i2_0],
dst[i8_6],
@@ -220,11 +230,22 @@ CPU_DISASSEMBLE( cquestrot )
return 1 | DASMFLAG_SUPPORTED;
}
+
+CPU_DISASSEMBLE(cquestrot)
+{
+ std::ostringstream stream;
+ offs_t result = internal_disasm_cquestrot(device, stream, pc, oprom, opram, options);
+ std::string stream_str = stream.str();
+ strcpy(buffer, stream_str.c_str());
+ return result;
+}
+
+
/***************************************************************************
LINE DRAWER DISASSEMBLY HOOK
***************************************************************************/
-CPU_DISASSEMBLE( cquestlin )
+static offs_t internal_disasm_cquestlin(cpu_device *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options)
{
static const char *const jmps[] =
{
@@ -288,7 +309,7 @@ CPU_DISASSEMBLE( cquestlin )
int _pbcs = (inslow >> 27) & 0x1;
int i2_0 = (inslow >> 24) & 0x7;
- sprintf(buffer, "%s %s,%s %x,%x %c %s %.2x %s %s %s %s",
+ util::stream_format(stream, "%s %s,%s %x,%x %c %s %02x %s %s %s %s",
ins[i5_3],
src[i2_0],
dst[i8_6],
@@ -304,3 +325,13 @@ CPU_DISASSEMBLE( cquestlin )
return 1 | DASMFLAG_SUPPORTED;
}
+
+
+CPU_DISASSEMBLE(cquestlin)
+{
+ std::ostringstream stream;
+ offs_t result = internal_disasm_cquestlin(device, stream, pc, oprom, opram, options);
+ std::string stream_str = stream.str();
+ strcpy(buffer, stream_str.c_str());
+ return result;
+}