summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/we32000/we32100d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/we32000/we32100d.cpp')
-rw-r--r--src/devices/cpu/we32000/we32100d.cpp63
1 files changed, 54 insertions, 9 deletions
diff --git a/src/devices/cpu/we32000/we32100d.cpp b/src/devices/cpu/we32000/we32100d.cpp
index 2552c60b5fe..a14cae7008a 100644
--- a/src/devices/cpu/we32000/we32100d.cpp
+++ b/src/devices/cpu/we32000/we32100d.cpp
@@ -65,6 +65,7 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
util::stream_format(stream, "invalid(0x%02x)", n);
else
{
+ // Positive or negative literal
stream << "&";
format_signed(stream, s8(n));
}
@@ -72,11 +73,15 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
case 0x40:
if (n != 0x4f)
+ {
+ // Register
util::stream_format(stream, "%%%s", s_rnames[n & 0x0f]);
+ }
else if (dst)
util::stream_format(stream, "invalid(0x%02x)", n);
else
{
+ // Word immediate
util::stream_format(stream, "&0x%08x", swapendian_int32(opcodes.r32(pc)));
pc += 4;
}
@@ -84,11 +89,15 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
case 0x50:
if (n != 0x5b && n != 0x5f)
+ {
+ // Register deferred
util::stream_format(stream, "(%%%s)", s_rnames[n & 0x0f]);
+ }
else if (n == 0x5b || dst)
util::stream_format(stream, "invalid(0x%02x)", n);
else
{
+ // Halfword immediate
util::stream_format(stream, "&0x%04x", swapendian_int16(opcodes.r16(pc)));
pc += 2;
}
@@ -97,23 +106,29 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
case 0x60:
if (n != 0x6f)
{
+ // FP short offset
format_signed(stream, n & 0x0f);
stream << "(%fp)";
}
else if (dst)
util::stream_format(stream, "invalid(0x%02x)", n);
else
+ {
+ // Byte immediate
util::stream_format(stream, "&0x%02x", opcodes.r8(pc++));
+ }
break;
case 0x70:
if (n != 0x7f)
{
+ // AP short offset
format_signed(stream, n & 0x0f);
stream << "(%ap)";
}
else
{
+ // Absolute
util::stream_format(stream, "$0x%08x", swapendian_int32(opcodes.r32(pc)));
pc += 4;
}
@@ -124,6 +139,7 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
util::stream_format(stream, "invalid(0x%02x)", n);
else
{
+ // Word displacement or displacement deferred
if (BIT(n, 4))
stream << "*";
format_signed(stream, s32(swapendian_int32(opcodes.r32(pc))));
@@ -137,6 +153,7 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
util::stream_format(stream, "invalid(0x%02x)", n);
else
{
+ // Halfword displacement or displacement deferred
if (BIT(n, 4))
stream << "*";
format_signed(stream, s16(swapendian_int16(opcodes.r16(pc))));
@@ -150,6 +167,7 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
util::stream_format(stream, "invalid(0x%02x)", n);
else
{
+ // Byte displacement or displacement deferred
if (BIT(n, 4))
stream << "*";
format_signed(stream, s8(opcodes.r8(pc++)));
@@ -160,6 +178,7 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
case 0xe0:
if (n == 0xef)
{
+ // Absolute deferred
util::stream_format(stream, "*$0x%08x", swapendian_int32(opcodes.r32(pc)));
pc += 4;
}
@@ -167,6 +186,7 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
util::stream_format(stream, "reserved(0x%02x)", n);
else
{
+ // Expanded operand type
if (!BIT(n, 1))
util::stream_format(stream, "{%cword}", BIT(n, 2) ? 's' : 'u');
else if (!BIT(n, 0))
@@ -210,11 +230,36 @@ void we32100_disassembler::dasm_dstw(std::ostream &stream, offs_t &pc, const we3
util::stream_format(stream, "invalid(0x%02x)", n);
}
-void we32100_disassembler::dasm_ea(std::ostream &stream, offs_t &pc, const we32100_disassembler::data_buffer &opcodes)
+void we32100_disassembler::dasm_ea(std::ostream &stream, offs_t &pc, offs_t ppc, const we32100_disassembler::data_buffer &opcodes)
{
u8 n = opcodes.r8(pc++);
if (n >= 0x50 && (n < 0xe0 || n == 0xef) && n != 0x5f && n != 0x6f)
- dasm_am(stream, pc, opcodes, n, false);
+ {
+ if ((n & 0x8f) == 0x8f && n != 0xef)
+ {
+ if (BIT(n, 4))
+ stream << "*";
+
+ // Show calculated PC-relative displacement
+ s32 disp;
+ if (BIT(n, 6))
+ disp = s8(opcodes.r8(pc++));
+ else if (BIT(n, 5))
+ {
+ disp = s16(swapendian_int16(opcodes.r16(pc)));
+ pc += 2;
+ }
+ else
+ {
+ disp = s32(swapendian_int32(opcodes.r32(pc)));
+ pc += 4;
+ }
+ format_signed(stream, disp);
+ util::stream_format(stream, "(%%%s) <%x>", s_rnames[15], u32(ppc + disp));
+ }
+ else
+ dasm_am(stream, pc, opcodes, n, false);
+ }
else
util::stream_format(stream, "invalid(0x%02x)", n);
}
@@ -332,7 +377,7 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
if (!BIT(op, 1))
{
util::stream_format(stream, "%-8s", "MOVAW");
- dasm_ea(stream, pc, opcodes);
+ dasm_ea(stream, pc, ppc, opcodes);
stream << ",";
dasm_dst(stream, pc, opcodes);
}
@@ -399,7 +444,7 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
case 0x1c:
util::stream_format(stream, "%-8s", util::string_format("SWAP%cI", "W?HB"[op & 0x03]));
- dasm_ea(stream, pc, opcodes);
+ dasm_ea(stream, pc, ppc, opcodes);
break;
case 0x20:
@@ -428,7 +473,7 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
if (!BIT(op, 1))
{
util::stream_format(stream, "%-8s", "JMP");
- dasm_ea(stream, pc, opcodes);
+ dasm_ea(stream, pc, ppc, opcodes);
}
else
stream << "CFLUSH";
@@ -443,9 +488,9 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
if (!BIT(op, 1))
{
util::stream_format(stream, "%-8s", "CALL");
- dasm_ea(stream, pc, opcodes);
+ dasm_ea(stream, pc, ppc, opcodes);
stream << ",";
- dasm_ea(stream, pc, opcodes);
+ dasm_ea(stream, pc, ppc, opcodes);
flags |= STEP_OVER;
}
else if (!BIT(op, 0))
@@ -479,7 +524,7 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
if (!BIT(op, 1))
{
util::stream_format(stream, "%-8s", "JSB");
- dasm_ea(stream, pc, opcodes);
+ dasm_ea(stream, pc, ppc, opcodes);
}
else
{
@@ -851,7 +896,7 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
case 0xe0:
util::stream_format(stream, "%-8s", "PUSHAW");
- dasm_ea(stream, pc, opcodes);
+ dasm_ea(stream, pc, ppc, opcodes);
break;
}