mirror of
https://github.com/holub/mame
synced 2025-10-08 09:30:17 +03:00
Changed the PPS4 disassembler to use 'std::ostream &' internally
This commit is contained in:
parent
06613b3dd1
commit
fe09ebc47d
@ -367,49 +367,48 @@ static const uint16_t table[] = {
|
|||||||
/* ff */ t_TM | t_I6i | t_OVER
|
/* ff */ t_TM | t_I6i | t_OVER
|
||||||
};
|
};
|
||||||
|
|
||||||
CPU_DISASSEMBLE( pps4 )
|
static offs_t internal_disasm_pps4(cpu_device *device, std::ostream &stream, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options)
|
||||||
{
|
{
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
unsigned PC = pc;
|
unsigned PC = pc;
|
||||||
uint8_t op = OP(pc++);
|
uint8_t op = OP(pc++);
|
||||||
uint32_t tok = table[op];
|
uint32_t tok = table[op];
|
||||||
char *dst = nullptr;
|
|
||||||
|
|
||||||
if (0 == (tok & t_MASK)) {
|
if (0 == (tok & t_MASK)) {
|
||||||
sprintf(buffer, "%s", token_str[tok & t_MASK]);
|
stream << token_str[tok & t_MASK];
|
||||||
} else {
|
} else {
|
||||||
dst = buffer + sprintf(buffer, "%-7s", token_str[tok & t_MASK]);
|
util::stream_format(stream, "%-7s", token_str[tok & t_MASK]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok & t_I3c) {
|
if (tok & t_I3c) {
|
||||||
// 3 bit immediate, complemented
|
// 3 bit immediate, complemented
|
||||||
uint8_t i = ~op & 7;
|
uint8_t i = ~op & 7;
|
||||||
if (0 != i) // only print if non-zero
|
if (0 != i) // only print if non-zero
|
||||||
dst += sprintf(dst, "%x", i);
|
util::stream_format(stream, "%x", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok & t_I4) {
|
if (tok & t_I4) {
|
||||||
// 4 bit immediate
|
// 4 bit immediate
|
||||||
uint8_t i = op & 15;
|
uint8_t i = op & 15;
|
||||||
dst += sprintf(dst, "%x", i);
|
util::stream_format(stream, "%x", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok & t_I4c) {
|
if (tok & t_I4c) {
|
||||||
// 4 bit immediate, complemented
|
// 4 bit immediate, complemented
|
||||||
uint8_t i = ~op & 15;
|
uint8_t i = ~op & 15;
|
||||||
dst += sprintf(dst, "%x", i);
|
util::stream_format(stream, "%x", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok & t_I4p) {
|
if (tok & t_I4p) {
|
||||||
// 4 bit immediate offset into page 3
|
// 4 bit immediate offset into page 3
|
||||||
uint8_t i = op & 15;
|
uint8_t i = op & 15;
|
||||||
dst += sprintf(dst, "[%x]", 0x0c0 | i);
|
util::stream_format(stream, "[%x]", 0x0c0 | i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok & t_I6p) {
|
if (tok & t_I6p) {
|
||||||
// 6 bit immediate offset into current page
|
// 6 bit immediate offset into current page
|
||||||
uint8_t i = op & 63;
|
uint8_t i = op & 63;
|
||||||
dst += sprintf(dst, "%x", (PC & ~63) | i);
|
util::stream_format(stream, "%x", (PC & ~63) | i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok & t_I6i) {
|
if (tok & t_I6i) {
|
||||||
@ -418,19 +417,19 @@ CPU_DISASSEMBLE( pps4 )
|
|||||||
// 8 bit absolute offset at 0x0100
|
// 8 bit absolute offset at 0x0100
|
||||||
uint16_t addr = (1 << 8) | 0; // ROM[ip3] can't be reached!?
|
uint16_t addr = (1 << 8) | 0; // ROM[ip3] can't be reached!?
|
||||||
(void)addr; // avoid unused variable warning
|
(void)addr; // avoid unused variable warning
|
||||||
dst += sprintf(dst, "[%x]", i6p3);
|
util::stream_format(stream, "[%x]", i6p3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok & t_I8) {
|
if (tok & t_I8) {
|
||||||
// 8 bit immediate I/O port address
|
// 8 bit immediate I/O port address
|
||||||
uint8_t arg = ARG(pc++);
|
uint8_t arg = ARG(pc++);
|
||||||
dst += sprintf(dst, "%02x", arg);
|
util::stream_format(stream, "%02x", arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok & t_I8c) {
|
if (tok & t_I8c) {
|
||||||
// 8 bit immediate offset into page
|
// 8 bit immediate offset into page
|
||||||
uint16_t arg = ~ARG(pc++) & 255;
|
uint16_t arg = ~ARG(pc++) & 255;
|
||||||
dst += sprintf(dst, "%02x", arg);
|
util::stream_format(stream, "%02x", arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok & t_OVER) // TL or TML
|
if (tok & t_OVER) // TL or TML
|
||||||
@ -441,3 +440,12 @@ CPU_DISASSEMBLE( pps4 )
|
|||||||
|
|
||||||
return (pc - PC) | flags | DASMFLAG_SUPPORTED;
|
return (pc - PC) | flags | DASMFLAG_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPU_DISASSEMBLE(pps4)
|
||||||
|
{
|
||||||
|
std::ostringstream stream;
|
||||||
|
offs_t result = internal_disasm_pps4(device, 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