diff options
author | Vas Crabb <cuavas@users.noreply.github.com> | 2016-10-26 21:20:42 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-26 21:20:42 +1100 |
commit | a6bf53220224e8c7af733562a838a2bb0cc94a62 (patch) | |
tree | 9668bb4a5fd160c748eebe4e36749595a918d7b3 | |
parent | 0671e2c0449c05e4b8a30d4fd57b2948ea3485ca (diff) | |
parent | 2f1dffd0ef3315c44c67d5bffec23b8e213b50d6 (diff) |
Merge pull request #1565 from npwoods/dasmstream_amis2000
Changed the AMIS2000 disassembler to use 'std::ostream &' internally
-rw-r--r-- | src/devices/cpu/amis2000/amis2000d.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/devices/cpu/amis2000/amis2000d.cpp b/src/devices/cpu/amis2000/amis2000d.cpp index f820fcec79a..90a786de0af 100644 --- a/src/devices/cpu/amis2000/amis2000d.cpp +++ b/src/devices/cpu/amis2000/amis2000d.cpp @@ -100,14 +100,13 @@ static const uint8_t s2000_mnemonic[0x100] = -CPU_DISASSEMBLE( amis2000 ) +static offs_t internal_disasm_amis2000(cpu_device *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options) { int pos = 0; uint8_t op = oprom[pos++]; uint8_t instr = s2000_mnemonic[op]; - char *dst = buffer; - dst += sprintf(dst, "%-5s ", s_mnemonics[instr]); + util::stream_format(stream, "%-5s ", s_mnemonics[instr]); // opcode parameter int mask = s_bits[instr]; @@ -124,10 +123,20 @@ CPU_DISASSEMBLE( amis2000 ) param &= mask; if (mask < 0x10) - dst += sprintf(dst, "%d", param); + util::stream_format(stream, "%d", param); else - dst += sprintf(dst, "$%02X", param); + util::stream_format(stream, "$%02X", param); } return pos | s_flags[instr] | DASMFLAG_SUPPORTED; } + + +CPU_DISASSEMBLE(amis2000) +{ + std::ostringstream stream; + offs_t result = internal_disasm_amis2000(device, stream, pc, oprom, opram, options); + std::string stream_str = stream.str(); + strcpy(buffer, stream_str.c_str()); + return result; +} |