diff options
| author | 2016-11-16 17:38:36 +1100 | |
|---|---|---|
| committer | 2016-11-16 17:38:36 +1100 | |
| commit | 633214b69b002c2ab8227068cdb6bca66cfe412d (patch) | |
| tree | 00c37bb7eaffda816e92489c316bb53b24d17d44 /src | |
| parent | df6bd669193b25e171e5dee069847db1e9031d56 (diff) | |
| parent | 13f672682c938cc2a34f591e538367233357f9e5 (diff) | |
Merge pull request #1707 from npwoods/dasmstream_mb86235
Changed the mb86235 disassembler to use 'std::ostream &' internally
Diffstat (limited to 'src')
| -rw-r--r-- | src/devices/cpu/mb86235/mb86235d.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/devices/cpu/mb86235/mb86235d.cpp b/src/devices/cpu/mb86235/mb86235d.cpp index 9b5597cbfdd..73cd908cc29 100644 --- a/src/devices/cpu/mb86235/mb86235d.cpp +++ b/src/devices/cpu/mb86235/mb86235d.cpp @@ -790,38 +790,34 @@ static char* dasm_xfer3(uint64_t opcode) return buffer; } -static unsigned dasm_mb86235(char *buffer, uint32_t pc, uint64_t opcode) +static unsigned dasm_mb86235(std::ostream &stream, uint32_t pc, uint64_t opcode) { - char *p = buffer; - - p[0] = 0; - switch ((opcode >> 61) & 7) { case 0: // ALU / MUL / double transfer (type 1) - p += sprintf(p, "%s : %s", dasm_alu_mul(opcode, true), dasm_double_xfer1(opcode)); + util::stream_format(stream, "%s : %s", dasm_alu_mul(opcode, true), dasm_double_xfer1(opcode)); break; case 1: // ALU / MYL / transfer (type 1) - p += sprintf(p, "%s : %s", dasm_alu_mul(opcode, true), dasm_xfer1(opcode)); + util::stream_format(stream, "%s : %s", dasm_alu_mul(opcode, true), dasm_xfer1(opcode)); break; case 2: // ALU / MUL / control - p += sprintf(p, "%s : %s", dasm_alu_mul(opcode, true), dasm_control(pc, opcode)); + util::stream_format(stream, "%s : %s", dasm_alu_mul(opcode, true), dasm_control(pc, opcode)); break; case 4: // ALU or MUL / double transfer (type 2) - p += sprintf(p, "%s : %s", dasm_alu_mul(opcode, false), dasm_double_xfer2(opcode)); + util::stream_format(stream, "%s : %s", dasm_alu_mul(opcode, false), dasm_double_xfer2(opcode)); break; case 5: // ALU or MUL / transfer (type 2) - p += sprintf(p, "%s : %s", dasm_alu_mul(opcode, false), dasm_xfer2(opcode)); + util::stream_format(stream, "%s : %s", dasm_alu_mul(opcode, false), dasm_xfer2(opcode)); break; case 6: // ALU or MUL / control - p += sprintf(p, "%s : %s", dasm_alu_mul(opcode, false), dasm_control(pc, opcode)); + util::stream_format(stream, "%s : %s", dasm_alu_mul(opcode, false), dasm_control(pc, opcode)); break; case 7: // transfer (type 3) - p += sprintf(p, "%s", dasm_xfer3(opcode)); + util::stream_format(stream, "%s", dasm_xfer3(opcode)); break; default: - p += sprintf(p, "???"); + util::stream_format(stream, "???"); break; } @@ -830,10 +826,20 @@ static unsigned dasm_mb86235(char *buffer, uint32_t pc, uint64_t opcode) -CPU_DISASSEMBLE( mb86235 ) +static offs_t internal_disasm_mb86235(cpu_device *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options) { uint64_t op = *(uint64_t*)oprom; op = little_endianize_int64(op); - return dasm_mb86235(buffer, pc, op); + return dasm_mb86235(stream, pc, op); +} + + +CPU_DISASSEMBLE(mb86235) +{ + std::ostringstream stream; + offs_t result = internal_disasm_mb86235(device, stream, pc, oprom, opram, options); + std::string stream_str = stream.str(); + strcpy(buffer, stream_str.c_str()); + return result; } |
