From e9ea36bf28921c0979bf423ec6c6ee03b17b1ddc Mon Sep 17 00:00:00 2001 From: Ryan Holtz Date: Sat, 2 May 2020 11:29:45 +0200 Subject: [PATCH] -am2901b: Added a skeleton device for the AMD Am2901B 4-bit Bipolar Microprocessor Slice. [Ryan Holtz] --- scripts/src/machine.lua | 12 ++ scripts/target/mame/arcade.lua | 1 + scripts/target/mame/mess.lua | 1 + src/devices/machine/am2901b.cpp | 228 ++++++++++++++++++++++++++++++++ src/devices/machine/am2901b.h | 105 +++++++++++++++ src/mame/drivers/dpb7000.cpp | 16 +++ 6 files changed, 363 insertions(+) create mode 100644 src/devices/machine/am2901b.cpp create mode 100644 src/devices/machine/am2901b.h diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua index fa3f7148253..ff3315b13de 100644 --- a/scripts/src/machine.lua +++ b/scripts/src/machine.lua @@ -94,6 +94,18 @@ if (MACHINES["AKIKO"]~=null) then } end +--------------------------------------------------- +-- +--@src/devices/machine/am2901b.h,MACHINES["AM2901B"] = true +--------------------------------------------------- + +if (MACHINES["AM2901B"]~=null) then + files { + MAME_DIR .. "src/devices/machine/am2901b.cpp", + MAME_DIR .. "src/devices/machine/am2901b.h", + } +end + -------------------------------------------------- -- --@src/devices/machine/arm_iomd.h,MACHINES["ARM_IOMD"] = true diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 539d6fb003d..79a06c745c5 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -383,6 +383,7 @@ VIDEOS["VRENDER0"] = true MACHINES["ACORN_VIDC"] = true MACHINES["AKIKO"] = true +--MACHINES["AM2901B"] = true MACHINES["ARM_IOMD"] = true MACHINES["AUTOCONFIG"] = true MACHINES["BUSMOUSE"] = true diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 0f8dfc70669..f21de018f9c 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -420,6 +420,7 @@ VIDEOS["BT431"] = true -------------------------------------------------- MACHINES["AKIKO"] = true +MACHINES["AM2901B"] = true MACHINES["AUTOCONFIG"] = true MACHINES["BUSMOUSE"] = true MACHINES["CR511B"] = true diff --git a/src/devices/machine/am2901b.cpp b/src/devices/machine/am2901b.cpp new file mode 100644 index 00000000000..bdea385a183 --- /dev/null +++ b/src/devices/machine/am2901b.cpp @@ -0,0 +1,228 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/*************************************************************************** + + am2901b.cpp + AMD Am2901B / Am2901C + Four-Bit Bipolar Microprocessor Slice + + To Do: + - Opcode hookup + - Verification + +***************************************************************************/ + +#include "emu.h" +#include "am2901b.h" + +#define VERBOSE (1) +#include "logmacro.h" + +/*****************************************************************************/ + +DEFINE_DEVICE_TYPE(AM2901B, am2901b_device, "am2901b", "AMD Am2901B Bitslice Processor") + +//------------------------------------------------- +// am2901b_device - constructor +//------------------------------------------------- + +am2901b_device::am2901b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, AM2901B, tag, owner, clock) + , m_d(0) + , m_q(0) + , m_i(0) + , m_a_addr(0) + , m_b_addr(0) + , m_a_latch(0) + , m_b_latch(0) + , m_q0_in(false) + , m_q3_in(false) + , m_ram0_in(false) + , m_ram3_in(false) + , m_ci(false) + , m_cp(false) + , m_y_out(0) + , m_g_out(true) + , m_p_out(true) + , m_ovr_out(false) + , m_f0_out(true) + , m_f3_out(false) + , m_co_out(false) + , m_y(*this) + , m_g(*this) + , m_p(*this) + , m_q0(*this) + , m_q3(*this) + , m_ram0(*this) + , m_ram3(*this) + , m_ovr(*this) + , m_f0(*this) + , m_f3(*this) + , m_co(*this) +{ +} + +void am2901b_device::device_start() +{ + save_item(NAME(m_a)); + save_item(NAME(m_d)); + save_item(NAME(m_q)); + save_item(NAME(m_i)); + + save_item(NAME(m_a_addr)); + save_item(NAME(m_b_addr)); + + save_item(NAME(m_a_latch)); + save_item(NAME(m_b_latch)); + + save_item(NAME(m_q0_in)); + save_item(NAME(m_q3_in)); + save_item(NAME(m_ram0_in)); + save_item(NAME(m_ram3_in)); + save_item(NAME(m_ci)); + save_item(NAME(m_cp)); + + save_item(NAME(m_y_out)); + save_item(NAME(m_g_out)); + save_item(NAME(m_p_out)); + save_item(NAME(m_q0_out)); + save_item(NAME(m_q3_out)); + save_item(NAME(m_ram0_out)); + save_item(NAME(m_ram3_out)); + save_item(NAME(m_ovr_out)); + save_item(NAME(m_f0_out)); + save_item(NAME(m_f3_out)); + save_item(NAME(m_co_out)); + + m_y.resolve_safe(); + m_g.resolve_safe(); + m_p.resolve_safe(); + m_q0.resolve_safe(); + m_q3.resolve_safe(); + m_ram0.resolve_safe(); + m_ram3.resolve_safe(); + m_ovr.resolve_safe(); + m_f0.resolve_safe(); + m_f3.resolve_safe(); + m_co.resolve_safe(); +} + +void am2901b_device::device_reset() +{ + memset(m_a, 0, sizeof(uint8_t) * 16); + m_d = 0; + m_q = 0; + m_i = 0; + + m_a_addr = 0; + m_b_addr = 0; + + m_a_latch = 0; + m_b_latch = 0; + + m_q0_in = false; + m_q3_in = false; + m_ram0_in = false; + m_ram3_in = false; + m_ci = false; + m_cp = false; + + m_y_out = 0; + m_g_out = true; + m_p_out = true; + m_q0_out = false; + m_q3_out = false; + m_ram0_out = false; + m_ram3_out = false; + m_ovr_out = false; + m_f0_out = true; + m_f3_out = false; + m_co_out = false; +} + +void am2901b_device::a_w(uint8_t data) +{ + m_a_addr = data; +} + +void am2901b_device::b_w(uint8_t data) +{ + m_b_addr = data; +} + +void am2901b_device::d_w(uint8_t data) +{ + m_d = data; +} + +void am2901b_device::i_w(uint16_t data) +{ + m_i = data; +} + +WRITE_LINE_MEMBER(am2901b_device::q0_w) +{ + m_q0_in = (bool)state; +} + +WRITE_LINE_MEMBER(am2901b_device::q3_w) +{ + m_q3_in = (bool)state; +} + +WRITE_LINE_MEMBER(am2901b_device::ram0_w) +{ + m_ram0_in = (bool)state; +} + +WRITE_LINE_MEMBER(am2901b_device::ram3_w) +{ + m_ram3_in = (bool)state; +} + +WRITE_LINE_MEMBER(am2901b_device::ci_w) +{ + m_ci = (bool)state; +} + +WRITE_LINE_MEMBER(am2901b_device::cp_w) +{ + bool old = m_cp; + m_cp = (bool)state; + if (!old && m_cp) + { + m_a_latch = m_a[m_a_addr]; + m_b_latch = m_a[m_b_addr]; + execute(); + } +} + +void am2901b_device::execute() +{ + disassemble(); +} + +void am2901b_device::disassemble() +{ + static const char s_r_table[8] = { 'A', 'A', '0', '0', '0', 'D', 'D', 'D' }; + static const char s_s_table[8] = { 'Q', 'B', 'Q', 'B', 'A', 'A', 'Q', '0' }; + static const char *const s_func_table[8] = + { + "ADD", "SUBR", "SUBS", "OR", "AND", "NOTRS", "EXOR", "EXNOR" + }; + static const char *const s_dst_table[8] = + { + "QREG", "NOP", "RAMA", "RAMF", "RAMQD", "RAMD", "RAMQU", "RAMU" + }; + + char dasm_buf[64]; + int buf_idx = snprintf(dasm_buf, ARRAY_LENGTH(dasm_buf), "%s %s", s_func_table[(m_i >> 3) & 7], s_dst_table[(m_i >> 6) & 7]); + while (buf_idx < 12) + { + dasm_buf[buf_idx] = ' '; + buf_idx++; + } + snprintf(dasm_buf + buf_idx, ARRAY_LENGTH(dasm_buf) - 12, "%c,%c", s_r_table[m_i & 7], s_s_table[m_i & 7]); + + LOG("%s: %s\n", machine().describe_context(), dasm_buf); +} \ No newline at end of file diff --git a/src/devices/machine/am2901b.h b/src/devices/machine/am2901b.h new file mode 100644 index 00000000000..4e7a25e3915 --- /dev/null +++ b/src/devices/machine/am2901b.h @@ -0,0 +1,105 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/*************************************************************************** + + am2901b.h + AMD Am2901B / Am2901C + Four-Bit Bipolar Microprocessor Slice + +***************************************************************************/ + +#ifndef MAME_MACHINE_AM2901B_H +#define MAME_MACHINE_AM2901B_H + +#pragma once + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> am2901b_device + +class am2901b_device : public device_t +{ +public: + // construction/destruction + am2901b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + auto y() { return m_y.bind(); } + auto g() { return m_g.bind(); } + auto p() { return m_p.bind(); } + auto q0() { return m_q0.bind(); } + auto q3() { return m_q3.bind(); } + auto ram0() { return m_ram0.bind(); } + auto ram3() { return m_ram3.bind(); } + auto ovr() { return m_ovr.bind(); } + auto f0() { return m_f0.bind(); } + auto f3() { return m_f3.bind(); } + + void a_w(uint8_t data); + void b_w(uint8_t data); + void d_w(uint8_t data); + void i_w(uint16_t data); + + DECLARE_WRITE_LINE_MEMBER(q0_w); + DECLARE_WRITE_LINE_MEMBER(q3_w); + DECLARE_WRITE_LINE_MEMBER(ram0_w); + DECLARE_WRITE_LINE_MEMBER(ram3_w); + DECLARE_WRITE_LINE_MEMBER(ci_w); + DECLARE_WRITE_LINE_MEMBER(cp_w); + +private: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + void execute(); + void disassemble(); + + uint8_t m_a[16]; + uint8_t m_d; + uint8_t m_q; + uint16_t m_i; + + uint8_t m_a_addr; + uint8_t m_b_addr; + + uint8_t m_a_latch; + uint8_t m_b_latch; + + bool m_q0_in; + bool m_q3_in; + bool m_ram0_in; + bool m_ram3_in; + bool m_ci; + bool m_cp; + + uint8_t m_y_out; + bool m_g_out; + bool m_p_out; + bool m_q0_out; + bool m_q3_out; + bool m_ram0_out; + bool m_ram3_out; + bool m_ovr_out; + bool m_f0_out; + bool m_f3_out; + bool m_co_out; + + devcb_write8 m_y; + devcb_write_line m_g; + devcb_write_line m_p; + devcb_write_line m_q0; + devcb_write_line m_q3; + devcb_write_line m_ram0; + devcb_write_line m_ram3; + devcb_write_line m_ovr; + devcb_write_line m_f0; + devcb_write_line m_f3; + devcb_write_line m_co; +}; + +// device type definition +DECLARE_DEVICE_TYPE(AM2901B, am2901b_device) + +#endif // MAME_MACHINE_AM2901B_H diff --git a/src/mame/drivers/dpb7000.cpp b/src/mame/drivers/dpb7000.cpp index ca6206540d2..1592faf9f08 100644 --- a/src/mame/drivers/dpb7000.cpp +++ b/src/mame/drivers/dpb7000.cpp @@ -15,6 +15,7 @@ #include "imagedev/floppy.h" #include "machine/6850acia.h" #include "machine/am25s55x.h" +#include "machine/am2901b.h" #include "machine/am2910.h" #include "machine/com8116.h" #include "machine/fdc_pll.h" @@ -76,6 +77,10 @@ public: , m_filter_multprom(*this, "filter_multprom") , m_filter_signal(nullptr) , m_filter_mult(nullptr) + , m_size_yl(*this, "filter_de") + , m_size_yh(*this, "filter_df") + , m_size_xl(*this, "filter_dg") + , m_size_xh(*this, "filter_dh") { } @@ -300,6 +305,11 @@ private: uint8_t m_filter_abbb[16]; // Size Card + required_device m_size_yl; + required_device m_size_yh; + required_device m_size_xl; + required_device m_size_xh; + uint8_t m_size_h; uint8_t m_size_v; @@ -1825,6 +1835,12 @@ void dpb7000_state::dpb7000(machine_config &config) m_fdd_serial->rxd_handler().set(FUNC(dpb7000_state::fddcpu_debug_rx)); config.set_perfect_quantum(m_fddcpu); + + // Size Card + AM2901B(config, m_size_yl); + AM2901B(config, m_size_yh); + AM2901B(config, m_size_xl); + AM2901B(config, m_size_xh); }