summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2016-11-19 09:47:27 -0500
committer Nathan Woods <npwoods@mess.org>2016-11-19 09:47:27 -0500
commitb8110263af2bb0dbf5385fc83398026f30d46ca5 (patch)
treeefc8afd19234e63751a2d30c8aef45c95bd4de1d /src/devices/cpu
parentf53a594cb5dc71a00939f7887b22f68694fede03 (diff)
Changed the lc8670 disassembler to use 'std::ostream &' internally
Diffstat (limited to 'src/devices/cpu')
-rw-r--r--src/devices/cpu/lc8670/lc8670.h2
-rw-r--r--src/devices/cpu/lc8670/lc8670dsm.cpp25
2 files changed, 20 insertions, 7 deletions
diff --git a/src/devices/cpu/lc8670/lc8670.h b/src/devices/cpu/lc8670/lc8670.h
index 51c78b602c9..525eecf1643 100644
--- a/src/devices/cpu/lc8670/lc8670.h
+++ b/src/devices/cpu/lc8670/lc8670.h
@@ -260,6 +260,8 @@ private:
OP_RII8
};
+ offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options);
+
// disasm table
struct dasm_entry
{
diff --git a/src/devices/cpu/lc8670/lc8670dsm.cpp b/src/devices/cpu/lc8670/lc8670dsm.cpp
index af2672a88bc..180cc54e16b 100644
--- a/src/devices/cpu/lc8670/lc8670dsm.cpp
+++ b/src/devices/cpu/lc8670/lc8670dsm.cpp
@@ -151,7 +151,7 @@ void lc8670_cpu_device::dasm_arg(uint8_t op, char *buffer, offs_t pc, int arg, c
// helper function
//-------------------------------------------------
-offs_t lc8670_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
+offs_t lc8670_cpu_device::disasm_disassemble(std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
{
int pos = 0;
char arg1[16], arg2[16];
@@ -161,18 +161,29 @@ offs_t lc8670_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const uint
int op_idx = decode_op(op);
const dasm_entry *inst = &s_dasm_table[op_idx];
- buffer += sprintf(buffer,"%-8s", inst->str);
+ util::stream_format(stream, "%-8s", inst->str);
dasm_arg(op, inst->inv ? arg2 : arg1, pc+0, inst->arg1, oprom, pos);
dasm_arg(op, inst->inv ? arg1 : arg2, pc+1, inst->arg2, oprom, pos);
- strcat(buffer, arg1);
+ stream << arg1;
if (inst->arg2 != OP_NULL)
- {
- strcat(buffer, ",");
- strcat(buffer, arg2);
- }
+ stream << "," << arg2;
return pos;
}
+
+//-------------------------------------------------
+// disasm_disassemble - call the disassembly
+// helper function
+//-------------------------------------------------
+
+offs_t lc8670_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
+{
+ std::ostringstream stream;
+ offs_t result = disasm_disassemble(stream, pc, oprom, opram, options);
+ std::string stream_str = stream.str();
+ strcpy(buffer, stream_str.c_str());
+ return result;
+}