summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2016-11-20 18:27:25 -0500
committer Nathan Woods <npwoods@mess.org>2016-11-20 18:27:25 -0500
commit932f69d6e9a718f3a7c41df2f0d2877f4b360e43 (patch)
tree47f17e4cc390599c163447ce9962705682242cf8 /src
parent92d3c7869631ba13c651ba885326c6b08ebd57e4 (diff)
Eliminated 'device_disasm_interface::disassemble(std::string &buffer, ...'
Diffstat (limited to 'src')
-rw-r--r--src/emu/debug/debugcmd.cpp12
-rw-r--r--src/emu/debug/debugcpu.cpp6
-rw-r--r--src/emu/debug/dvdisasm.cpp12
-rw-r--r--src/emu/didisasm.cpp13
-rw-r--r--src/emu/didisasm.h1
5 files changed, 20 insertions, 24 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index 58f0322b8cd..42493267eda 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -2401,11 +2401,11 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[])
/* now write the data out */
util::ovectorstream output;
+ util::ovectorstream disasm;
output.reserve(512);
for (u64 i = 0; i < length; )
{
int pcbyte = space->address_to_byte(offset + i) & space->bytemask();
- std::string disasm;
const char *comment;
offs_t tempaddr;
int numbytes = 0;
@@ -2429,6 +2429,8 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[])
}
/* disassemble the result */
+ disasm.clear();
+ disasm.seekp(0);
i += numbytes = dasmintf->disassemble(disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
}
@@ -2445,7 +2447,8 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[])
}
/* add the disassembly */
- stream_format(output, "%s", disasm);
+ disasm.put('\0');
+ stream_format(output, "%s", &disasm.vec()[0]);
/* attempt to add the comment */
comment = space->device().debug()->comment_text(tempaddr);
@@ -2604,10 +2607,11 @@ void debugger_commands::execute_history(int ref, int params, const char *param[]
argbuf[numbytes] = m_cpu.read_opcode(*space, pcbyte + numbytes, 1);
}
- std::string buffer;
+ util::ovectorstream buffer;
dasmintf->disassemble(buffer, pc, opbuf, argbuf);
+ buffer.put('\0');
- m_console.printf("%0*X: %s\n", space->logaddrchars(), pc, buffer.c_str());
+ m_console.printf("%0*X: %s\n", space->logaddrchars(), pc, &buffer.vec()[0]);
}
}
diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp
index 40a8aae8a79..873bdf561ef 100644
--- a/src/emu/debug/debugcpu.cpp
+++ b/src/emu/debug/debugcpu.cpp
@@ -2627,7 +2627,7 @@ u32 device_debug::compute_opcode_crc32(offs_t pc) const
if (m_disasm != nullptr)
{
// disassemble to our buffer
- std::string diasmbuf;
+ std::ostringstream diasmbuf;
numbytes = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
}
@@ -3026,7 +3026,9 @@ u32 device_debug::dasm_wrapped(std::string &buffer, offs_t pc)
}
// disassemble to our buffer
- uint32_t result = m_disasm->disassemble(buffer, pc, opbuf, argbuf);
+ std::ostringstream stream;
+ uint32_t result = m_disasm->disassemble(stream, pc, opbuf, argbuf);
+ buffer = stream.str();
return result;
}
diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp
index d171e69cefb..37bb708027d 100644
--- a/src/emu/debug/dvdisasm.cpp
+++ b/src/emu/debug/dvdisasm.cpp
@@ -271,7 +271,7 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs)
instlen = 1;
if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH, physpcbyte))
{
- std::string dasmbuffer;
+ std::ostringstream dasmbuffer;
instlen = source.m_disasmintf->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK;
}
@@ -335,6 +335,7 @@ void debug_view_disasm::generate_bytes(offs_t pcbyte, int numbytes, int minbytes
bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
{
+ util::ovectorstream buffer;
bool changed = false;
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
const int char_num = source.m_space.is_octal() ? 3 : 2;
@@ -392,7 +393,8 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
source.m_space.logaddrchars()/2*char_num, source.m_space.byte_to_address(pcbyte));
// make sure we can translate the address, and then disassemble the result
- std::string buffer;
+ buffer.clear();
+ buffer.seekp(0);
int numbytes = 0;
offs_t physpcbyte = pcbyte;
if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH_DEBUG, physpcbyte))
@@ -410,10 +412,12 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
pc += numbytes = source.m_disasmintf->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK;
}
else
- buffer = "<unmapped>";
+ buffer << "<unmapped>";
+
+ buffer.put('\0');
// append the disassembly to the buffer
- util::stream_format(m_dasm.seekp(base + m_divider1 + 1), "%2$-*1$.*1$s ", m_dasm_width, buffer);
+ util::stream_format(m_dasm.seekp(base + m_divider1 + 1), "%2$-*1$.*1$s ", m_dasm_width, &buffer.vec()[0]);
// output the right column
if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED)
diff --git a/src/emu/didisasm.cpp b/src/emu/didisasm.cpp
index ae8e0e7047d..95353889a65 100644
--- a/src/emu/didisasm.cpp
+++ b/src/emu/didisasm.cpp
@@ -90,16 +90,3 @@ offs_t device_disasm_interface::disassemble(std::ostream &stream, offs_t pc, con
return result;
}
-
-
-//-------------------------------------------------
-// disassemble - interface for disassembly
-//-------------------------------------------------
-
-offs_t device_disasm_interface::disassemble(std::string &buffer, offs_t pc, const u8 *oprom, const u8 *opram, uint32_t options)
-{
- std::stringstream stream;
- offs_t result = disassemble(stream, pc, oprom, opram, options);
- buffer = stream.str();
- return result;
-}
diff --git a/src/emu/didisasm.h b/src/emu/didisasm.h
index 6322c38fdf5..c96fe3b9159 100644
--- a/src/emu/didisasm.h
+++ b/src/emu/didisasm.h
@@ -74,7 +74,6 @@ public:
// interface for disassembly
offs_t disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options = 0);
- offs_t disassemble(std::string &buffer, offs_t pc, const u8 *oprom, const u8 *opram, u32 options = 0);
protected:
// required operation overrides