Changed the AMIS2000 disassembler to use 'std::ostream &' internally

This commit is contained in:
Nathan Woods 2016-10-25 23:12:26 -04:00
parent 0671e2c044
commit 2f1dffd0ef

View File

@ -100,14 +100,13 @@ static const uint8_t s2000_mnemonic[0x100] =
CPU_DISASSEMBLE( amis2000 ) static offs_t internal_disasm_amis2000(cpu_device *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options)
{ {
int pos = 0; int pos = 0;
uint8_t op = oprom[pos++]; uint8_t op = oprom[pos++];
uint8_t instr = s2000_mnemonic[op]; uint8_t instr = s2000_mnemonic[op];
char *dst = buffer; util::stream_format(stream, "%-5s ", s_mnemonics[instr]);
dst += sprintf(dst, "%-5s ", s_mnemonics[instr]);
// opcode parameter // opcode parameter
int mask = s_bits[instr]; int mask = s_bits[instr];
@ -124,10 +123,20 @@ CPU_DISASSEMBLE( amis2000 )
param &= mask; param &= mask;
if (mask < 0x10) if (mask < 0x10)
dst += sprintf(dst, "%d", param); util::stream_format(stream, "%d", param);
else else
dst += sprintf(dst, "$%02X", param); util::stream_format(stream, "$%02X", param);
} }
return pos | s_flags[instr] | DASMFLAG_SUPPORTED; return pos | s_flags[instr] | DASMFLAG_SUPPORTED;
} }
CPU_DISASSEMBLE(amis2000)
{
std::ostringstream stream;
offs_t result = internal_disasm_amis2000(device, stream, pc, oprom, opram, options);
std::string stream_str = stream.str();
strcpy(buffer, stream_str.c_str());
return result;
}