summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2016-11-11 16:20:03 -0500
committer Nathan Woods <npwoods@mess.org>2016-11-11 16:20:03 -0500
commit4546f7888296cf8866bf35d5431ff437ad9b5256 (patch)
treeb2584c1519431cfbfa638002b3457a971839a4b7
parentdbd07cef385248937dc509135088f81329216209 (diff)
Changed the cosmac disassembler to use 'std::ostream &' internally
-rw-r--r--src/devices/cpu/cosmac/cosdasm.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/devices/cpu/cosmac/cosdasm.cpp b/src/devices/cpu/cosmac/cosdasm.cpp
index ce93110e021..c5689b25fcc 100644
--- a/src/devices/cpu/cosmac/cosdasm.cpp
+++ b/src/devices/cpu/cosmac/cosdasm.cpp
@@ -18,10 +18,10 @@ enum
};
#define CDP1801_OPCODE(...) \
- sprintf(buffer, __VA_ARGS__)
+ util::stream_format(stream, __VA_ARGS__)
#define CDP1802_OPCODE(...) \
- if (variant < TYPE_1802) sprintf(buffer, "illegal"); else sprintf(buffer, __VA_ARGS__)
+ if (variant < TYPE_1802) stream << "illegal"; else util::stream_format(stream, __VA_ARGS__)
static offs_t implied(const uint8_t opcode)
{
@@ -53,7 +53,7 @@ static offs_t long_skip(offs_t pc)
return pc + 3;
}
-static uint32_t disassemble(device_t *device, char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t variant)
+static uint32_t disassemble(device_t *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t variant)
{
const uint8_t *startram = opram;
uint32_t flags = 0;
@@ -185,6 +185,16 @@ static uint32_t disassemble(device_t *device, char *buffer, offs_t pc, const uin
}
+static uint32_t disassemble(device_t *device, char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t variant)
+{
+ std::ostringstream stream;
+ uint32_t result = disassemble(device, stream, pc, oprom, opram, variant);
+ std::string stream_str = stream.str();
+ strcpy(buffer, stream_str.c_str());
+ return result;
+}
+
+
CPU_DISASSEMBLE( cdp1801 )
{
return disassemble(device, buffer, pc, oprom, opram, TYPE_1801);