summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-12-31 08:06:42 -0500
committer AJR <ajrhacker@users.noreply.github.com>2019-12-31 08:06:42 -0500
commit90dada1ea062fedd496c48cfdd8e2e0155ffd33d (patch)
tree9b5aa76382a1c764618c76b3b02f7db978b8403f
parent0a0baf3dfe037bee3dd7f8d205a80f0fa1f8ce3c (diff)
we32100: Calculate PC-relative offsets for effective addressing (nw)
att3b2.cpp: Add FDC (nw)
-rw-r--r--src/devices/cpu/we32000/we32100d.cpp63
-rw-r--r--src/devices/cpu/we32000/we32100d.h2
-rw-r--r--src/mame/drivers/att3b2.cpp9
3 files changed, 63 insertions, 11 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;
}
diff --git a/src/devices/cpu/we32000/we32100d.h b/src/devices/cpu/we32000/we32100d.h
index 1c287d85702..efc820675b9 100644
--- a/src/devices/cpu/we32000/we32100d.h
+++ b/src/devices/cpu/we32000/we32100d.h
@@ -27,7 +27,7 @@ private:
void dasm_srcw(std::ostream &stream, offs_t &pc, const data_buffer &opcodes);
void dasm_dst(std::ostream &stream, offs_t &pc, const data_buffer &opcodes);
void dasm_dstw(std::ostream &stream, offs_t &pc, const data_buffer &opcodes);
- void dasm_ea(std::ostream &stream, offs_t &pc, const data_buffer &opcodes);
+ void dasm_ea(std::ostream &stream, offs_t &pc, offs_t ppc, const data_buffer &opcodes);
void dasm_sr(std::ostream &stream, offs_t &pc, const data_buffer &opcodes);
void dasm_bdisp(std::ostream &stream, offs_t &pc, const data_buffer &opcodes, bool byte);
offs_t dasm_30xx(std::ostream &stream, offs_t &pc, const data_buffer &opcodes);
diff --git a/src/mame/drivers/att3b2.cpp b/src/mame/drivers/att3b2.cpp
index 27f03b508b2..6abdbe6d7fa 100644
--- a/src/mame/drivers/att3b2.cpp
+++ b/src/mame/drivers/att3b2.cpp
@@ -11,6 +11,8 @@
#include "machine/am9517a.h"
#include "machine/mc68681.h"
#include "machine/pit8253.h"
+//#include "machine/upd7261.h"
+#include "machine/wd_fdc.h"
class att3b2_state : public driver_device
{
@@ -38,6 +40,8 @@ void att3b2_state::mem_map_300(address_map &map)
map(0x00042000, 0x0004200f).rw("pit", FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask32(0x000000ff);
map(0x00048000, 0x0004800f).rw("dmac", FUNC(am9517a_device::read), FUNC(am9517a_device::write));
map(0x00049000, 0x0004900f).rw("duart", FUNC(scn2681_device::read), FUNC(scn2681_device::write));
+ //map(0x0004a000, 0x0004a001).rw("hdc", FUNC(upd7261_device::read), FUNC(upd7261_device::write));
+ map(0x0004d000, 0x0004d003).rw("fdc", FUNC(wd2797_device::read), FUNC(wd2797_device::write));
map(0x02000000, 0x02003fff).ram();
}
@@ -47,6 +51,7 @@ void att3b2_state::mem_map_600(address_map &map)
map(0x00041000, 0x0004100f).rw("pit", FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask32(0x000000ff);
map(0x00048000, 0x0004800f).rw("dmac", FUNC(am9517a_device::read), FUNC(am9517a_device::write));
map(0x00049000, 0x0004900f).rw("duart", FUNC(scn2681_device::read), FUNC(scn2681_device::write));
+ map(0x0004a000, 0x0004a003).rw("fdc", FUNC(wd2797_device::read), FUNC(wd2797_device::write));
map(0x02000000, 0x02003fff).mirror(0x1000000).ram();
}
@@ -65,7 +70,9 @@ void att3b2_state::att3b2(machine_config &config)
SCN2681(config, "duart", 3'686'400); // MC2681P
- // TODO: disk controllers (D7621AD, TMS2797NL)
+ // TODO: hard disk controller (NEC D7261AD)
+
+ WD2797(config, "fdc", 1'000'000); // TMS2797NL
}
void att3b2_state::att3b26(machine_config &config)