Merge pull request #1672 from npwoods/dasmstream_e0c6200

Changed the e0c6200 disassembler to use 'std::ostream &' internally
This commit is contained in:
Vas Crabb 2016-11-12 18:14:25 +11:00 committed by GitHub
commit 7a3018de4b

View File

@ -110,7 +110,7 @@ static char* decode_param(uint16_t opcode, int param, char* buffer)
} }
CPU_DISASSEMBLE(e0c6200) static offs_t internal_disasm_e0c6200(cpu_device *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options)
{ {
uint16_t op = (oprom[1] | oprom[0] << 8) & 0xfff; uint16_t op = (oprom[1] | oprom[0] << 8) & 0xfff;
@ -690,19 +690,28 @@ CPU_DISASSEMBLE(e0c6200)
// fetch mnemonic // fetch mnemonic
char *dst = buffer; util::stream_format(stream, "%-6s", em_name[m]);
dst += sprintf(dst, "%-6s", em_name[m]);
// fetch param(s) // fetch param(s)
char pbuffer[10]; char pbuffer[10];
if (p1 != -1) if (p1 != -1)
{ {
dst += sprintf(dst, "%s", decode_param(op, p1, pbuffer)); util::stream_format(stream, "%s", decode_param(op, p1, pbuffer));
if (p2 != -1) if (p2 != -1)
{ {
dst += sprintf(dst, ",%s", decode_param(op, p2, pbuffer)); util::stream_format(stream, ",%s", decode_param(op, p2, pbuffer));
} }
} }
return 1 | em_flags[m] | DASMFLAG_SUPPORTED; return 1 | em_flags[m] | DASMFLAG_SUPPORTED;
} }
CPU_DISASSEMBLE(e0c6200)
{
std::ostringstream stream;
offs_t result = internal_disasm_e0c6200(device, stream, pc, oprom, opram, options);
std::string stream_str = stream.str();
strcpy(buffer, stream_str.c_str());
return result;
}