diff options
author | 2016-11-18 19:42:36 +1100 | |
---|---|---|
committer | 2016-11-18 19:42:36 +1100 | |
commit | 6e98171108797098195489dbd8e904f0602d86f3 (patch) | |
tree | 41df67b8b3f74fc155cff6246a7643d28ff26fca /src/devices/cpu | |
parent | 7e04d87d2142ad0aa97b48c4b6978448c6d34092 (diff) | |
parent | 0e2ca126efe45b4745268855f976f96791d7d064 (diff) |
Merge pull request #1731 from npwoods/dasmstream_sharc
Changed the sharc disassembler to use 'std::ostream &' internally
Diffstat (limited to 'src/devices/cpu')
-rw-r--r-- | src/devices/cpu/sharc/sharcdsm.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/devices/cpu/sharc/sharcdsm.cpp b/src/devices/cpu/sharc/sharcdsm.cpp index c0786f02ccd..1d99ab16f31 100644 --- a/src/devices/cpu/sharc/sharcdsm.cpp +++ b/src/devices/cpu/sharc/sharcdsm.cpp @@ -1176,7 +1176,7 @@ static void build_dasm_table(void) } } -static uint32_t sharc_dasm_one(char *buffer, offs_t pc, uint64_t opcode) +static uint32_t sharc_dasm_one(std::ostream &stream, offs_t pc, uint64_t opcode) { #define DEFAULT_DASM_WIDTH (64) @@ -1198,14 +1198,24 @@ static uint32_t sharc_dasm_one(char *buffer, offs_t pc, uint64_t opcode) flags = (*sharcdasm_table[op])(pc, opcode); - for (i=0; i < DEFAULT_DASM_WIDTH; i++) + for (i=0; i < DEFAULT_DASM_WIDTH && dasm_buffer[i]; i++) { - buffer[i] = dasm_buffer[i]; + stream << dasm_buffer[i]; } return flags; } +static uint32_t sharc_dasm_one(char *buffer, offs_t pc, uint64_t opcode) +{ + std::ostringstream stream; + uint32_t result = sharc_dasm_one(stream, pc, opcode); + std::string stream_str = stream.str(); + strcpy(buffer, stream_str.c_str()); + return result; +} + + CPU_DISASSEMBLE( sharc ) { uint64_t op; |