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; +}