diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 15186ca5b30..770b4fae633 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -314,6 +314,23 @@ if (BUSES["ARCADIA"]~=null) then end +--------------------------------------------------- +-- +--@src/devices/bus/archimedes/econet/slot.h,BUSES["ARCHIMEDES_ECONET"] = true +--------------------------------------------------- + +if (BUSES["ARCHIMEDES_ECONET"]~=null) then + files { + MAME_DIR .. "src/devices/bus/archimedes/econet/slot.cpp", + MAME_DIR .. "src/devices/bus/archimedes/econet/slot.h", + MAME_DIR .. "src/devices/bus/archimedes/econet/econet.cpp", + MAME_DIR .. "src/devices/bus/archimedes/econet/econet.h", + MAME_DIR .. "src/devices/bus/archimedes/econet/rtfmjoy.cpp", + MAME_DIR .. "src/devices/bus/archimedes/econet/rtfmjoy.h", + } +end + + --------------------------------------------------- -- --@src/devices/bus/astrocde/slot.h,BUSES["ASTROCADE"] = true diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 782a5c9d55a..53d0dfcfc4d 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -848,6 +848,7 @@ BUSES["APRICOT_KEYBOARD"] = true BUSES["APRICOT_VIDEO"] = true BUSES["AQUARIUS"] = true BUSES["ARCADIA"] = true +BUSES["ARCHIMEDES_ECONET"] = true BUSES["ASTROCADE"] = true BUSES["ATA"] = true BUSES["BBC_1MHZBUS"] = true diff --git a/src/devices/bus/archimedes/econet/econet.cpp b/src/devices/bus/archimedes/econet/econet.cpp new file mode 100644 index 00000000000..bfcc27186c0 --- /dev/null +++ b/src/devices/bus/archimedes/econet/econet.cpp @@ -0,0 +1,77 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Archimedes Econet Module + +**********************************************************************/ + +#include "emu.h" +#include "econet.h" +#include "bus/econet/econet.h" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ARC_ECONET, arc_econet_device, "arc_econet", "Acorn ADF10/AEH52 Econet Module"); + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void arc_econet_device::device_add_mconfig(machine_config &config) +{ + MC6854(config, m_adlc); + m_adlc->out_txd_cb().set("econet", FUNC(econet_device::data_w)); + m_adlc->out_irq_cb().set(DEVICE_SELF_OWNER, FUNC(archimedes_econet_slot_device::efiq_w)); + + econet_device &econet(ECONET(config, "econet", 0)); + econet.clk_wr_callback().set(m_adlc, FUNC(mc6854_device::txc_w)); + econet.clk_wr_callback().append(m_adlc, FUNC(mc6854_device::rxc_w)); + econet.data_wr_callback().set(m_adlc, FUNC(mc6854_device::set_rx)); + + ECONET_SLOT(config, "econet254", "econet", econet_devices); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// archimedes_econet_device - constructor +//------------------------------------------------- + +arc_econet_device::arc_econet_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, ARC_ECONET, tag, owner, clock) + , device_archimedes_econet_interface(mconfig, *this) + , m_adlc(*this, "mc6854") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void arc_econet_device::device_start() +{ +} + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +u8 arc_econet_device::read(offs_t offset) +{ + return m_adlc->read(offset); +} + +void arc_econet_device::write(offs_t offset, u8 data) +{ + m_adlc->write(offset, data); +} diff --git a/src/devices/bus/archimedes/econet/econet.h b/src/devices/bus/archimedes/econet/econet.h new file mode 100644 index 00000000000..337cb077206 --- /dev/null +++ b/src/devices/bus/archimedes/econet/econet.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Archimedes Econet Module + +**********************************************************************/ + + +#ifndef MAME_BUS_ARCHIMEDES_ECONET_ECONET_H +#define MAME_BUS_ARCHIMEDES_ECONET_ECONET_H + +#pragma once + + +#include "slot.h" +#include "machine/mc6854.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> arc_econet_adf10_device + +class arc_econet_device: + public device_t, + public device_archimedes_econet_interface +{ +public: + // construction/destruction + arc_econet_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + virtual u8 read(offs_t offset) override; + virtual void write(offs_t offset, u8 data) override; + +private: + required_device m_adlc; +}; + + + +// device type definition +DECLARE_DEVICE_TYPE(ARC_ECONET, arc_econet_device); + + +#endif /* MAME_BUS_ARCHIMEDES_ECONET_ECONET_H */ diff --git a/src/devices/bus/archimedes/econet/rtfmjoy.cpp b/src/devices/bus/archimedes/econet/rtfmjoy.cpp new file mode 100644 index 00000000000..c53e7c155da --- /dev/null +++ b/src/devices/bus/archimedes/econet/rtfmjoy.cpp @@ -0,0 +1,94 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Archimedes RTFM Joystick Interface + +**********************************************************************/ + +#include "emu.h" +#include "rtfmjoy.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ARC_RTFM_JOY, arc_rtfm_joystick_device, "arc_rtfmjoy", "Acorn Archimedes RTFM Joystick Interface"); + + +//------------------------------------------------- +// INPUT_PORTS( rtfm_joystick ) +//------------------------------------------------- + +static INPUT_PORTS_START( rtfm_joystick ) + PORT_START("JOY0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Fire") PORT_PLAYER(1) + + PORT_START("JOY1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Fire") PORT_PLAYER(2) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor arc_rtfm_joystick_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( rtfm_joystick ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// archimedes_rtfm_joystick_device - constructor +//------------------------------------------------- + +arc_rtfm_joystick_device::arc_rtfm_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, ARC_RTFM_JOY, tag, owner, clock) + , device_archimedes_econet_interface(mconfig, *this) + , m_joy(*this, "JOY%u", 0U) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void arc_rtfm_joystick_device::device_start() +{ +} + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +u8 arc_rtfm_joystick_device::read(offs_t offset) +{ + u8 data = 0xff; + + switch (offset & 0x03) + { + case 0x01: + data = ~m_joy[0]->read() & 0x1f; + break; + case 0x02: + data = ~m_joy[1]->read() & 0x1f; + break; + } + + return data; +} diff --git a/src/devices/bus/archimedes/econet/rtfmjoy.h b/src/devices/bus/archimedes/econet/rtfmjoy.h new file mode 100644 index 00000000000..443d5a1560b --- /dev/null +++ b/src/devices/bus/archimedes/econet/rtfmjoy.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Archimedes RTFM Joystick Interface + +**********************************************************************/ + + +#ifndef MAME_BUS_ARCHIMEDES_ECONET_RTFMJOY_H +#define MAME_BUS_ARCHIMEDES_ECONET_RTFMJOY_H + +#pragma once + + +#include "slot.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class arc_rtfm_joystick_device: + public device_t, + public device_archimedes_econet_interface +{ +public: + // construction/destruction + arc_rtfm_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + + virtual u8 read(offs_t offset) override; + +private: + required_ioport_array<2> m_joy; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ARC_RTFM_JOY, arc_rtfm_joystick_device); + + +#endif /* MAME_BUS_ARCHIMEDES_ECONET_RTFMJOY_H */ diff --git a/src/devices/bus/archimedes/econet/slot.cpp b/src/devices/bus/archimedes/econet/slot.cpp new file mode 100644 index 00000000000..9c84798fd6d --- /dev/null +++ b/src/devices/bus/archimedes/econet/slot.cpp @@ -0,0 +1,102 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Archimedes Econet Module + +**********************************************************************/ + +#include "emu.h" +#include "slot.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ARCHIMEDES_ECONET_SLOT, archimedes_econet_slot_device, "archimedes_econet_slot", "Acorn Archimedes Econet Module slot") + + + +//************************************************************************** +// DEVICE BBC_MODEM PORT INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_archimedes_econet_interface - constructor +//------------------------------------------------- + +device_archimedes_econet_interface::device_archimedes_econet_interface(const machine_config &mconfig, device_t &device) : + device_interface(device, "arceconet") +{ + m_slot = dynamic_cast(device.owner()); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// archimedes_econet_slot_device - constructor +//------------------------------------------------- + +archimedes_econet_slot_device::archimedes_econet_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, ARCHIMEDES_ECONET_SLOT, tag, owner, clock) + , device_single_card_slot_interface(mconfig, *this) + , m_device(nullptr) + , m_efiq_handler(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void archimedes_econet_slot_device::device_start() +{ + m_device = get_card_device(); + + // resolve callbacks + m_efiq_handler.resolve_safe(); +} + + +//------------------------------------------------- +// read +//------------------------------------------------- + +u8 archimedes_econet_slot_device::read(offs_t offset) +{ + if (m_device) + return m_device->read(offset & 0x03); + else + return 0xff; +} + +//------------------------------------------------- +// write +//------------------------------------------------- + +void archimedes_econet_slot_device::write(offs_t offset, u8 data) +{ + if (m_device) + m_device->write(offset & 0x03, data); +} + +//------------------------------------------------- +// SLOT_INTERFACE( archimedes_econet_devices ) +//------------------------------------------------- + + +// slot devices +#include "econet.h" +#include "rtfmjoy.h" + + +void archimedes_econet_devices(device_slot_interface &device) +{ + device.option_add("econet", ARC_ECONET); + device.option_add("rtfmjoy", ARC_RTFM_JOY); +} diff --git a/src/devices/bus/archimedes/econet/slot.h b/src/devices/bus/archimedes/econet/slot.h new file mode 100644 index 00000000000..4d963fd608e --- /dev/null +++ b/src/devices/bus/archimedes/econet/slot.h @@ -0,0 +1,102 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Archimedes Econet Module + +********************************************************************** + + Pinout: + + 1 NEFIQ + 2 NWBE + 3 NS2 + 4 CLK2 + 5 LA2 + 6 LA3 + 7 BD0 + 8 BD1 + 9 BD2 + 10 BD3 + 11 BD4 + 12 BD5 + 13 BD6 + 14 BD7 + 15 NRST + 16 0V + 17 +5V + +**********************************************************************/ + +#ifndef MAME_BUS_ARCHIMEDES_ECONET_SLOT_H +#define MAME_BUS_ARCHIMEDES_ECONET_SLOT_H + +#pragma once + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> archimedes_econet_slot_device + +class device_archimedes_econet_interface; + +class archimedes_econet_slot_device : public device_t, public device_single_card_slot_interface +{ +public: + // construction/destruction + template + archimedes_econet_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, const char *default_option) + : archimedes_econet_slot_device(mconfig, tag, owner) + { + option_reset(); + slot_options(*this); + set_default_option(default_option); + set_fixed(false); + } + + archimedes_econet_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0); + + // callbacks + auto efiq_handler() { return m_efiq_handler.bind(); } + + virtual u8 read(offs_t offset); + virtual void write(offs_t offset, u8 data); + + DECLARE_WRITE_LINE_MEMBER( efiq_w ) { m_efiq_handler(state); } + +protected: + // device-level overrides + virtual void device_start() override; + + device_archimedes_econet_interface *m_device; + +private: + devcb_write_line m_efiq_handler; +}; + + +// ======================> device_archimedes_econet_interface + +class device_archimedes_econet_interface : public device_interface +{ +public: + virtual u8 read(offs_t offset) { return 0xff; } + virtual void write(offs_t offset, u8 data) { } + +protected: + device_archimedes_econet_interface(const machine_config &mconfig, device_t &device); + + archimedes_econet_slot_device *m_slot; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ARCHIMEDES_ECONET_SLOT, archimedes_econet_slot_device) + +void archimedes_econet_devices(device_slot_interface &device); + + +#endif // MAME_BUS_ARCHIMEDES_ECONET_SLOT_H