mirror of
https://github.com/holub/mame
synced 2025-07-02 00:29:37 +03:00
we32100: Calculate PC-relative offsets for effective addressing (nw)
att3b2.cpp: Add FDC (nw)
This commit is contained in:
parent
0a0baf3dfe
commit
90dada1ea0
@ -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);
|
util::stream_format(stream, "invalid(0x%02x)", n);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Positive or negative literal
|
||||||
stream << "&";
|
stream << "&";
|
||||||
format_signed(stream, s8(n));
|
format_signed(stream, s8(n));
|
||||||
}
|
}
|
||||||
@ -72,11 +73,15 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
|
|||||||
|
|
||||||
case 0x40:
|
case 0x40:
|
||||||
if (n != 0x4f)
|
if (n != 0x4f)
|
||||||
|
{
|
||||||
|
// Register
|
||||||
util::stream_format(stream, "%%%s", s_rnames[n & 0x0f]);
|
util::stream_format(stream, "%%%s", s_rnames[n & 0x0f]);
|
||||||
|
}
|
||||||
else if (dst)
|
else if (dst)
|
||||||
util::stream_format(stream, "invalid(0x%02x)", n);
|
util::stream_format(stream, "invalid(0x%02x)", n);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Word immediate
|
||||||
util::stream_format(stream, "&0x%08x", swapendian_int32(opcodes.r32(pc)));
|
util::stream_format(stream, "&0x%08x", swapendian_int32(opcodes.r32(pc)));
|
||||||
pc += 4;
|
pc += 4;
|
||||||
}
|
}
|
||||||
@ -84,11 +89,15 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
|
|||||||
|
|
||||||
case 0x50:
|
case 0x50:
|
||||||
if (n != 0x5b && n != 0x5f)
|
if (n != 0x5b && n != 0x5f)
|
||||||
|
{
|
||||||
|
// Register deferred
|
||||||
util::stream_format(stream, "(%%%s)", s_rnames[n & 0x0f]);
|
util::stream_format(stream, "(%%%s)", s_rnames[n & 0x0f]);
|
||||||
|
}
|
||||||
else if (n == 0x5b || dst)
|
else if (n == 0x5b || dst)
|
||||||
util::stream_format(stream, "invalid(0x%02x)", n);
|
util::stream_format(stream, "invalid(0x%02x)", n);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Halfword immediate
|
||||||
util::stream_format(stream, "&0x%04x", swapendian_int16(opcodes.r16(pc)));
|
util::stream_format(stream, "&0x%04x", swapendian_int16(opcodes.r16(pc)));
|
||||||
pc += 2;
|
pc += 2;
|
||||||
}
|
}
|
||||||
@ -97,23 +106,29 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321
|
|||||||
case 0x60:
|
case 0x60:
|
||||||
if (n != 0x6f)
|
if (n != 0x6f)
|
||||||
{
|
{
|
||||||
|
// FP short offset
|
||||||
format_signed(stream, n & 0x0f);
|
format_signed(stream, n & 0x0f);
|
||||||
stream << "(%fp)";
|
stream << "(%fp)";
|
||||||
}
|
}
|
||||||
else if (dst)
|
else if (dst)
|
||||||
util::stream_format(stream, "invalid(0x%02x)", n);
|
util::stream_format(stream, "invalid(0x%02x)", n);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Byte immediate
|
||||||
util::stream_format(stream, "&0x%02x", opcodes.r8(pc++));
|
util::stream_format(stream, "&0x%02x", opcodes.r8(pc++));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x70:
|
case 0x70:
|
||||||
if (n != 0x7f)
|
if (n != 0x7f)
|
||||||
{
|
{
|
||||||
|
// AP short offset
|
||||||
format_signed(stream, n & 0x0f);
|
format_signed(stream, n & 0x0f);
|
||||||
stream << "(%ap)";
|
stream << "(%ap)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Absolute
|
||||||
util::stream_format(stream, "$0x%08x", swapendian_int32(opcodes.r32(pc)));
|
util::stream_format(stream, "$0x%08x", swapendian_int32(opcodes.r32(pc)));
|
||||||
pc += 4;
|
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);
|
util::stream_format(stream, "invalid(0x%02x)", n);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Word displacement or displacement deferred
|
||||||
if (BIT(n, 4))
|
if (BIT(n, 4))
|
||||||
stream << "*";
|
stream << "*";
|
||||||
format_signed(stream, s32(swapendian_int32(opcodes.r32(pc))));
|
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);
|
util::stream_format(stream, "invalid(0x%02x)", n);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Halfword displacement or displacement deferred
|
||||||
if (BIT(n, 4))
|
if (BIT(n, 4))
|
||||||
stream << "*";
|
stream << "*";
|
||||||
format_signed(stream, s16(swapendian_int16(opcodes.r16(pc))));
|
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);
|
util::stream_format(stream, "invalid(0x%02x)", n);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Byte displacement or displacement deferred
|
||||||
if (BIT(n, 4))
|
if (BIT(n, 4))
|
||||||
stream << "*";
|
stream << "*";
|
||||||
format_signed(stream, s8(opcodes.r8(pc++)));
|
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:
|
case 0xe0:
|
||||||
if (n == 0xef)
|
if (n == 0xef)
|
||||||
{
|
{
|
||||||
|
// Absolute deferred
|
||||||
util::stream_format(stream, "*$0x%08x", swapendian_int32(opcodes.r32(pc)));
|
util::stream_format(stream, "*$0x%08x", swapendian_int32(opcodes.r32(pc)));
|
||||||
pc += 4;
|
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);
|
util::stream_format(stream, "reserved(0x%02x)", n);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Expanded operand type
|
||||||
if (!BIT(n, 1))
|
if (!BIT(n, 1))
|
||||||
util::stream_format(stream, "{%cword}", BIT(n, 2) ? 's' : 'u');
|
util::stream_format(stream, "{%cword}", BIT(n, 2) ? 's' : 'u');
|
||||||
else if (!BIT(n, 0))
|
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);
|
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++);
|
u8 n = opcodes.r8(pc++);
|
||||||
if (n >= 0x50 && (n < 0xe0 || n == 0xef) && n != 0x5f && n != 0x6f)
|
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
|
else
|
||||||
util::stream_format(stream, "invalid(0x%02x)", n);
|
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))
|
if (!BIT(op, 1))
|
||||||
{
|
{
|
||||||
util::stream_format(stream, "%-8s", "MOVAW");
|
util::stream_format(stream, "%-8s", "MOVAW");
|
||||||
dasm_ea(stream, pc, opcodes);
|
dasm_ea(stream, pc, ppc, opcodes);
|
||||||
stream << ",";
|
stream << ",";
|
||||||
dasm_dst(stream, pc, opcodes);
|
dasm_dst(stream, pc, opcodes);
|
||||||
}
|
}
|
||||||
@ -399,7 +444,7 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
|
|||||||
|
|
||||||
case 0x1c:
|
case 0x1c:
|
||||||
util::stream_format(stream, "%-8s", util::string_format("SWAP%cI", "W?HB"[op & 0x03]));
|
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;
|
break;
|
||||||
|
|
||||||
case 0x20:
|
case 0x20:
|
||||||
@ -428,7 +473,7 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
|
|||||||
if (!BIT(op, 1))
|
if (!BIT(op, 1))
|
||||||
{
|
{
|
||||||
util::stream_format(stream, "%-8s", "JMP");
|
util::stream_format(stream, "%-8s", "JMP");
|
||||||
dasm_ea(stream, pc, opcodes);
|
dasm_ea(stream, pc, ppc, opcodes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stream << "CFLUSH";
|
stream << "CFLUSH";
|
||||||
@ -443,9 +488,9 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
|
|||||||
if (!BIT(op, 1))
|
if (!BIT(op, 1))
|
||||||
{
|
{
|
||||||
util::stream_format(stream, "%-8s", "CALL");
|
util::stream_format(stream, "%-8s", "CALL");
|
||||||
dasm_ea(stream, pc, opcodes);
|
dasm_ea(stream, pc, ppc, opcodes);
|
||||||
stream << ",";
|
stream << ",";
|
||||||
dasm_ea(stream, pc, opcodes);
|
dasm_ea(stream, pc, ppc, opcodes);
|
||||||
flags |= STEP_OVER;
|
flags |= STEP_OVER;
|
||||||
}
|
}
|
||||||
else if (!BIT(op, 0))
|
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))
|
if (!BIT(op, 1))
|
||||||
{
|
{
|
||||||
util::stream_format(stream, "%-8s", "JSB");
|
util::stream_format(stream, "%-8s", "JSB");
|
||||||
dasm_ea(stream, pc, opcodes);
|
dasm_ea(stream, pc, ppc, opcodes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -851,7 +896,7 @@ offs_t we32100_disassembler::disassemble(std::ostream &stream, offs_t pc, const
|
|||||||
|
|
||||||
case 0xe0:
|
case 0xe0:
|
||||||
util::stream_format(stream, "%-8s", "PUSHAW");
|
util::stream_format(stream, "%-8s", "PUSHAW");
|
||||||
dasm_ea(stream, pc, opcodes);
|
dasm_ea(stream, pc, ppc, opcodes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ private:
|
|||||||
void dasm_srcw(std::ostream &stream, offs_t &pc, const data_buffer &opcodes);
|
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_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_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_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);
|
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);
|
offs_t dasm_30xx(std::ostream &stream, offs_t &pc, const data_buffer &opcodes);
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include "machine/am9517a.h"
|
#include "machine/am9517a.h"
|
||||||
#include "machine/mc68681.h"
|
#include "machine/mc68681.h"
|
||||||
#include "machine/pit8253.h"
|
#include "machine/pit8253.h"
|
||||||
|
//#include "machine/upd7261.h"
|
||||||
|
#include "machine/wd_fdc.h"
|
||||||
|
|
||||||
class att3b2_state : public driver_device
|
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(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(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(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();
|
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(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(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(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();
|
map(0x02000000, 0x02003fff).mirror(0x1000000).ram();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +70,9 @@ void att3b2_state::att3b2(machine_config &config)
|
|||||||
|
|
||||||
SCN2681(config, "duart", 3'686'400); // MC2681P
|
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)
|
void att3b2_state::att3b26(machine_config &config)
|
||||||
|
Loading…
Reference in New Issue
Block a user