mirror of
https://github.com/holub/mame
synced 2025-04-27 10:43:07 +03:00
Merge pull request #1747 from npwoods/dasmstream_lc8670
Changed the lc8670 disassembler to use 'std::ostream &' internally
This commit is contained in:
commit
8d233c0cc7
@ -260,6 +260,8 @@ private:
|
|||||||
OP_RII8
|
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
|
// disasm table
|
||||||
struct dasm_entry
|
struct dasm_entry
|
||||||
{
|
{
|
||||||
|
@ -151,7 +151,7 @@ void lc8670_cpu_device::dasm_arg(uint8_t op, char *buffer, offs_t pc, int arg, c
|
|||||||
// helper function
|
// 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;
|
int pos = 0;
|
||||||
char arg1[16], arg2[16];
|
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);
|
int op_idx = decode_op(op);
|
||||||
const dasm_entry *inst = &s_dasm_table[op_idx];
|
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 ? arg2 : arg1, pc+0, inst->arg1, oprom, pos);
|
||||||
dasm_arg(op, inst->inv ? arg1 : arg2, pc+1, inst->arg2, 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)
|
if (inst->arg2 != OP_NULL)
|
||||||
{
|
stream << "," << arg2;
|
||||||
strcat(buffer, ",");
|
|
||||||
strcat(buffer, arg2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pos;
|
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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user