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

This commit is contained in:
Nathan Woods 2016-11-03 06:52:59 -04:00
parent 3ee5564b78
commit eae8e62a6d

View File

@ -222,7 +222,7 @@ static void InitDasm32010(void)
OpInizialized = 1;
}
CPU_DISASSEMBLE( tms32010 )
static offs_t internal_disasm_tms32010(cpu_device *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options)
{
uint32_t flags = 0;
int a, b, d, k, m, n, p, r, s, w; /* these can all be filled in by parsing an instruction */
@ -252,7 +252,7 @@ CPU_DISASSEMBLE( tms32010 )
}
if (op == -1)
{
sprintf(buffer, "dw %04Xh *(invalid op)", code);
util::stream_format(stream, "dw %04Xh *(invalid op)", code);
return cnt | DASMFLAG_SUPPORTED;
}
//buffertmp = buffer;
@ -306,7 +306,7 @@ CPU_DISASSEMBLE( tms32010 )
{
if (*cp == '%')
{
char num[20], *q;
char num[20];
cp++;
switch (*cp++)
{
@ -323,14 +323,22 @@ CPU_DISASSEMBLE( tms32010 )
default:
fatalerror("illegal escape character in format '%s'\n",Op[op].fmt);
}
q = num; while (*q) *buffer++ = *q++;
*buffer = '\0';
stream << num;
}
else
{
*buffer++ = *cp++;
*buffer = '\0';
stream << *cp++;
}
}
return cnt | flags | DASMFLAG_SUPPORTED;
}
CPU_DISASSEMBLE(tms32010)
{
std::ostringstream stream;
offs_t result = internal_disasm_tms32010(device, stream, pc, oprom, opram, options);
std::string stream_str = stream.str();
strcpy(buffer, stream_str.c_str());
return result;
}