From 51fa9aa2e81400cfa4df380a751fe15e7b3d254e Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Tue, 10 Jul 2018 10:55:47 +0100 Subject: Acorn Bus slot devices for:- Acorn Atom: - AtomSID - Acorn Atom Disc Pack - Econet Board Acorn System: - 32K Dynamic RAM Board - 8K Static RAM Board - Cassette Interface Board - Econet Board - Floppy Disc Controller Board - 40 Column VDU Board - 80x25 VDU Board - Versatile Interface Board CMS: - CMS 40/80 Video Terminal Card - CMS Floppy Disc Controller - CMS High Resolution Colour Graphics Card --- scripts/src/bus.lua | 41 +++++++ scripts/target/mame/mess.lua | 1 + src/devices/bus/acorn/atom/discpack.cpp | 117 +++++++++++++++++++ src/devices/bus/acorn/atom/discpack.h | 56 +++++++++ src/devices/bus/acorn/atom/econet.cpp | 78 +++++++++++++ src/devices/bus/acorn/atom/econet.h | 51 ++++++++ src/devices/bus/acorn/atom/sid.cpp | 60 ++++++++++ src/devices/bus/acorn/atom/sid.h | 46 ++++++++ src/devices/bus/acorn/bus.cpp | 198 ++++++++++++++++++++++++++++++++ src/devices/bus/acorn/bus.h | 125 ++++++++++++++++++++ src/devices/bus/acorn/cms/4080term.cpp | 177 ++++++++++++++++++++++++++++ src/devices/bus/acorn/cms/4080term.h | 61 ++++++++++ src/devices/bus/acorn/cms/fdc.cpp | 125 ++++++++++++++++++++ src/devices/bus/acorn/cms/fdc.h | 55 +++++++++ src/devices/bus/acorn/cms/hires.cpp | 115 +++++++++++++++++++ src/devices/bus/acorn/cms/hires.h | 54 +++++++++ src/devices/bus/acorn/system/32k.cpp | 96 ++++++++++++++++ src/devices/bus/acorn/system/32k.h | 48 ++++++++ src/devices/bus/acorn/system/8k.cpp | 162 ++++++++++++++++++++++++++ src/devices/bus/acorn/system/8k.h | 57 +++++++++ src/devices/bus/acorn/system/cass.cpp | 100 ++++++++++++++++ src/devices/bus/acorn/system/cass.h | 57 +++++++++ src/devices/bus/acorn/system/econet.cpp | 88 ++++++++++++++ src/devices/bus/acorn/system/econet.h | 54 +++++++++ src/devices/bus/acorn/system/fdc.cpp | 114 ++++++++++++++++++ src/devices/bus/acorn/system/fdc.h | 57 +++++++++ src/devices/bus/acorn/system/vdu40.cpp | 127 ++++++++++++++++++++ src/devices/bus/acorn/system/vdu40.h | 59 ++++++++++ src/devices/bus/acorn/system/vdu80.cpp | 195 +++++++++++++++++++++++++++++++ src/devices/bus/acorn/system/vdu80.h | 61 ++++++++++ src/devices/bus/acorn/system/vib.cpp | 116 +++++++++++++++++++ src/devices/bus/acorn/system/vib.h | 64 +++++++++++ src/devices/bus/econet/econet.h | 2 + src/devices/machine/i8271.h | 4 + 34 files changed, 2821 insertions(+) create mode 100644 src/devices/bus/acorn/atom/discpack.cpp create mode 100644 src/devices/bus/acorn/atom/discpack.h create mode 100644 src/devices/bus/acorn/atom/econet.cpp create mode 100644 src/devices/bus/acorn/atom/econet.h create mode 100644 src/devices/bus/acorn/atom/sid.cpp create mode 100644 src/devices/bus/acorn/atom/sid.h create mode 100644 src/devices/bus/acorn/bus.cpp create mode 100644 src/devices/bus/acorn/bus.h create mode 100644 src/devices/bus/acorn/cms/4080term.cpp create mode 100644 src/devices/bus/acorn/cms/4080term.h create mode 100644 src/devices/bus/acorn/cms/fdc.cpp create mode 100644 src/devices/bus/acorn/cms/fdc.h create mode 100644 src/devices/bus/acorn/cms/hires.cpp create mode 100644 src/devices/bus/acorn/cms/hires.h create mode 100644 src/devices/bus/acorn/system/32k.cpp create mode 100644 src/devices/bus/acorn/system/32k.h create mode 100644 src/devices/bus/acorn/system/8k.cpp create mode 100644 src/devices/bus/acorn/system/8k.h create mode 100644 src/devices/bus/acorn/system/cass.cpp create mode 100644 src/devices/bus/acorn/system/cass.h create mode 100644 src/devices/bus/acorn/system/econet.cpp create mode 100644 src/devices/bus/acorn/system/econet.h create mode 100644 src/devices/bus/acorn/system/fdc.cpp create mode 100644 src/devices/bus/acorn/system/fdc.h create mode 100644 src/devices/bus/acorn/system/vdu40.cpp create mode 100644 src/devices/bus/acorn/system/vdu40.h create mode 100644 src/devices/bus/acorn/system/vdu80.cpp create mode 100644 src/devices/bus/acorn/system/vdu80.h create mode 100644 src/devices/bus/acorn/system/vib.cpp create mode 100644 src/devices/bus/acorn/system/vib.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index c67ee9c9805..f3133cb94d5 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -98,6 +98,47 @@ if (BUSES["ABCBUS"]~=null) then end +--------------------------------------------------- +-- +--@src/devices/bus/acorn/bus.h,BUSES["ACORN"] = true +--------------------------------------------------- + +if (BUSES["ACORN"]~=null) then + files { + MAME_DIR .. "src/devices/bus/acorn/bus.cpp", + MAME_DIR .. "src/devices/bus/acorn/bus.h", + MAME_DIR .. "src/devices/bus/acorn/atom/sid.cpp", + MAME_DIR .. "src/devices/bus/acorn/atom/sid.h", + MAME_DIR .. "src/devices/bus/acorn/atom/discpack.cpp", + MAME_DIR .. "src/devices/bus/acorn/atom/discpack.h", + MAME_DIR .. "src/devices/bus/acorn/atom/econet.cpp", + MAME_DIR .. "src/devices/bus/acorn/atom/econet.h", + MAME_DIR .. "src/devices/bus/acorn/cms/4080term.cpp", + MAME_DIR .. "src/devices/bus/acorn/cms/4080term.h", + MAME_DIR .. "src/devices/bus/acorn/cms/fdc.cpp", + MAME_DIR .. "src/devices/bus/acorn/cms/fdc.h", + MAME_DIR .. "src/devices/bus/acorn/cms/hires.cpp", + MAME_DIR .. "src/devices/bus/acorn/cms/hires.h", + MAME_DIR .. "src/devices/bus/acorn/system/32k.cpp", + MAME_DIR .. "src/devices/bus/acorn/system/32k.h", + MAME_DIR .. "src/devices/bus/acorn/system/8k.cpp", + MAME_DIR .. "src/devices/bus/acorn/system/8k.h", + MAME_DIR .. "src/devices/bus/acorn/system/cass.cpp", + MAME_DIR .. "src/devices/bus/acorn/system/cass.h", + MAME_DIR .. "src/devices/bus/acorn/system/econet.cpp", + MAME_DIR .. "src/devices/bus/acorn/system/econet.h", + MAME_DIR .. "src/devices/bus/acorn/system/fdc.cpp", + MAME_DIR .. "src/devices/bus/acorn/system/fdc.h", + MAME_DIR .. "src/devices/bus/acorn/system/vdu40.cpp", + MAME_DIR .. "src/devices/bus/acorn/system/vdu40.h", + MAME_DIR .. "src/devices/bus/acorn/system/vdu80.cpp", + MAME_DIR .. "src/devices/bus/acorn/system/vdu80.h", + MAME_DIR .. "src/devices/bus/acorn/system/vib.cpp", + MAME_DIR .. "src/devices/bus/acorn/system/vib.h", + } +end + + --------------------------------------------------- -- --@src/devices/bus/adam/exp.h,BUSES["ADAM"] = true diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 36e88077a4b..17be595034d 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -653,6 +653,7 @@ BUSES["A7800"] = true BUSES["A800"] = true BUSES["ABCBUS"] = true BUSES["ABCKB"] = true +BUSES["ACORN"] = true BUSES["ADAM"] = true BUSES["ADAMNET"] = true BUSES["APF"] = true diff --git a/src/devices/bus/acorn/atom/discpack.cpp b/src/devices/bus/acorn/atom/discpack.cpp new file mode 100644 index 00000000000..5c357d22136 --- /dev/null +++ b/src/devices/bus/acorn/atom/discpack.cpp @@ -0,0 +1,117 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Atom Disc Pack + +**********************************************************************/ + + +#include "emu.h" +#include "discpack.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ATOM_DISCPACK, atom_discpack_device, "atom_discpack", "Acorn Atom Disc Pack") + +//------------------------------------------------- +// MACHINE_DRIVER( discpack ) +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER(atom_discpack_device::floppy_formats ) + FLOPPY_ACORN_SSD_FORMAT +FLOPPY_FORMATS_END + +static void atom_floppies(device_slot_interface &device) +{ + device.option_add("525sssd", FLOPPY_525_SSSD); + device.option_add("525sd", FLOPPY_525_SD); + device.option_add("525qd", FLOPPY_525_QD); +} + +ROM_START( discpack ) + ROM_REGION(0x1000, "dos_rom", 0) + ROM_LOAD("dosrom.ic18", 0x0000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c)) +ROM_END + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void atom_discpack_device::device_add_mconfig(machine_config &config) +{ + I8271(config, m_fdc, 0); + m_fdc->intrq_wr_callback().set(FUNC(atom_discpack_device::fdc_intrq_w)); + m_fdc->hdl_wr_callback().set(FUNC(atom_discpack_device::motor_w)); + m_fdc->opt_wr_callback().set(FUNC(atom_discpack_device::side_w)); + FLOPPY_CONNECTOR(config, m_floppy[0], atom_floppies, "525sssd", atom_discpack_device::floppy_formats); + m_floppy[0]->enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[1], atom_floppies, nullptr, atom_discpack_device::floppy_formats); + m_floppy[1]->enable_sound(true); +} + + +const tiny_rom_entry *atom_discpack_device::device_rom_region() const +{ + return ROM_NAME( discpack ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// atom_discpack_device - constructor +//------------------------------------------------- + +atom_discpack_device::atom_discpack_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ATOM_DISCPACK, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_dos_rom(*this, "dos_rom") + , m_fdc(*this, "i8271") + , m_floppy(*this, "i8271:%u", 0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void atom_discpack_device::device_start() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_device(0x0a00, 0x0a03, *m_fdc, &i8271_device::map); + space.install_readwrite_handler(0x0a04, 0x0a04, 0, 0x1f8, 0, read8_delegate(FUNC(i8271_device::data_r), m_fdc.target()), write8_delegate(FUNC(i8271_device::data_w), m_fdc.target())); + space.install_ram(0x2000, 0x23ff); + space.install_ram(0x2400, 0x27ff); + space.install_ram(0x3c00, 0x3fff); + space.install_rom(0xe000, 0xefff, m_dos_rom->base()); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE_LINE_MEMBER(atom_discpack_device::motor_w) +{ + if (m_floppy[0]->get_device()) m_floppy[0]->get_device()->mon_w(!state); + if (m_floppy[1]->get_device()) m_floppy[1]->get_device()->mon_w(!state); +} + +WRITE_LINE_MEMBER(atom_discpack_device::side_w) +{ + if (m_floppy[0]->get_device()) m_floppy[0]->get_device()->ss_w(state); + if (m_floppy[1]->get_device()) m_floppy[1]->get_device()->ss_w(state); +} + +WRITE_LINE_MEMBER(atom_discpack_device::fdc_intrq_w) +{ + m_bus->nmi_w(state); +} diff --git a/src/devices/bus/acorn/atom/discpack.h b/src/devices/bus/acorn/atom/discpack.h new file mode 100644 index 00000000000..75918d1e8f0 --- /dev/null +++ b/src/devices/bus/acorn/atom/discpack.h @@ -0,0 +1,56 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Atom Disc Pack + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_ATOM_DISCPACK_H +#define MAME_BUS_ACORN_ATOM_DISCPACK_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "machine/i8271.h" +#include "formats/acorn_dsk.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class atom_discpack_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + atom_discpack_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_FLOPPY_FORMATS(floppy_formats); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + +private: + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(motor_w); + DECLARE_WRITE_LINE_MEMBER(side_w); + + required_memory_region m_dos_rom; + required_device m_fdc; + required_device_array m_floppy; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ATOM_DISCPACK, atom_discpack_device) + + +#endif // MAME_BUS_ACORN_ATOM_DISCPACK_H diff --git a/src/devices/bus/acorn/atom/econet.cpp b/src/devices/bus/acorn/atom/econet.cpp new file mode 100644 index 00000000000..32bfe0ab0c9 --- /dev/null +++ b/src/devices/bus/acorn/atom/econet.cpp @@ -0,0 +1,78 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Atom Econet Interface + + Part No. 102,002 + +**********************************************************************/ + +#include "emu.h" +#include "econet.h" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ATOM_ECONET, atom_econet_device, "atom_econet", "Acorn Atom Econet Interface") + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(atom_econet_device::device_add_mconfig) + /* econet */ + MCFG_DEVICE_ADD(m_adlc, MC6854, 0) + MCFG_MC6854_OUT_TXD_CB(WRITELINE(m_econet, econet_device, host_data_w)) + MCFG_MC6854_OUT_IRQ_CB(WRITELINE(*this, atom_econet_device, bus_irq_w)) + + ECONET(config, m_econet, 0); + m_econet->clk_wr_callback().set(m_adlc, FUNC(mc6854_device::txc_w)); + m_econet->clk_wr_callback().append(m_adlc, FUNC(mc6854_device::rxc_w)); + m_econet->data_wr_callback().set(m_adlc, FUNC(mc6854_device::set_rx)); + MCFG_ECONET_SLOT_ADD("econet254", 254, econet_devices, nullptr) +MACHINE_CONFIG_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// atom_econet_device - constructor +//------------------------------------------------- + +atom_econet_device::atom_econet_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ATOM_ECONET, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_adlc(*this, "mc6854") + , m_econet(*this, "econet") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void atom_econet_device::device_start() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_readwrite_handler(0xb400, 0xb403, read8_delegate(FUNC(mc6854_device::read), m_adlc.target()), write8_delegate(FUNC(mc6854_device::write), m_adlc.target())); + space.install_read_handler(0xb404, 0xb404, read8_delegate(FUNC(atom_econet_device::statid_r), this)); +} + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +READ8_MEMBER(atom_econet_device::statid_r) +{ + return 0xfe; +} + +WRITE_LINE_MEMBER(atom_econet_device::bus_irq_w) +{ + m_bus->irq_w(state); +} diff --git a/src/devices/bus/acorn/atom/econet.h b/src/devices/bus/acorn/atom/econet.h new file mode 100644 index 00000000000..8d5f5e8eb19 --- /dev/null +++ b/src/devices/bus/acorn/atom/econet.h @@ -0,0 +1,51 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Atom Econet Interface + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_ATOM_ECONET_H +#define MAME_BUS_ACORN_ATOM_ECONET_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "bus/econet/econet.h" +#include "machine/mc6854.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class atom_econet_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + atom_econet_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + DECLARE_READ8_MEMBER(statid_r); + DECLARE_WRITE_LINE_MEMBER(bus_irq_w); + + required_device m_adlc; + required_device m_econet; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ATOM_ECONET, atom_econet_device) + + +#endif // MAME_BUS_ACORN_ATOM_ECONET_H diff --git a/src/devices/bus/acorn/atom/sid.cpp b/src/devices/bus/acorn/atom/sid.cpp new file mode 100644 index 00000000000..a72b924ddfc --- /dev/null +++ b/src/devices/bus/acorn/atom/sid.cpp @@ -0,0 +1,60 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + AtomSID emulation + +**********************************************************************/ + + +#include "emu.h" +#include "sid.h" +#include "speaker.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ATOM_SID, atom_sid_device, "atom_sid", "AtomSID") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void atom_sid_device::device_add_mconfig(machine_config &config) +{ + SPEAKER(config, "speaker").front_center(); + MOS6581(config, m_sid, 4_MHz_XTAL / 4); + m_sid->add_route(ALL_OUTPUTS, "speaker", 1.0); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// atom_sid_device - constructor +//------------------------------------------------- + +atom_sid_device::atom_sid_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ATOM_SID, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_sid(*this, "sid6581") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void atom_sid_device::device_start() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_readwrite_handler(0xbdc0, 0xbddf, read8_delegate(FUNC(mos6581_device::read), m_sid.target()), write8_delegate(FUNC(mos6581_device::write), m_sid.target())); +} diff --git a/src/devices/bus/acorn/atom/sid.h b/src/devices/bus/acorn/atom/sid.h new file mode 100644 index 00000000000..8383bbdf9c8 --- /dev/null +++ b/src/devices/bus/acorn/atom/sid.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + AtomSID emulation + +**********************************************************************/ + +#ifndef MAME_BUS_ACORN_ATOM_SID_H +#define MAME_BUS_ACORN_ATOM_SID_H + +#include "bus/acorn/bus.h" +#include "sound/mos6581.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> atom_sid_device + +class atom_sid_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + atom_sid_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + required_device m_sid; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ATOM_SID, atom_sid_device) + + +#endif // MAME_BUS_ACORN_ATOM_SID_H diff --git a/src/devices/bus/acorn/bus.cpp b/src/devices/bus/acorn/bus.cpp new file mode 100644 index 00000000000..83cf01ed051 --- /dev/null +++ b/src/devices/bus/acorn/bus.cpp @@ -0,0 +1,198 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Bus Extension emulation + + Part No. 100,031 + +**********************************************************************/ + +#include "emu.h" +#include "bus.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_BUS_SLOT, acorn_bus_slot_device, "acorn_bus_slot", "Acorn Bus Eurocard slot") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_bus_slot_device - constructor +//------------------------------------------------- +acorn_bus_slot_device::acorn_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_BUS_SLOT, tag, owner, clock) + , device_slot_interface(mconfig, *this) + , m_bus(*this, finder_base::DUMMY_TAG) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_bus_slot_device::device_start() +{ + device_acorn_bus_interface *const dev = dynamic_cast(get_card_device()); + if (dev) + dev->set_acorn_bus(m_bus); + + // tell acorn bus that there is one slot with the specified tag + downcast(*m_bus).add_slot(tag()); +} + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_BUS, acorn_bus_device, "acorn_bus", "Acorn Bus") + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_bus_device - constructor +//------------------------------------------------- + +acorn_bus_device::acorn_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_BUS, tag, owner, clock) + , m_maincpu(*this, finder_base::DUMMY_TAG) + , m_out_irq_cb(*this) + , m_out_nmi_cb(*this) +{ +} + + +void acorn_bus_device::add_slot(const char *tag) +{ + device_t *dev = subdevice(tag); + + add_slot(dynamic_cast(dev)); +} + +void acorn_bus_device::add_slot(device_slot_interface *slot) +{ + m_slot_list.push_front(slot); +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_bus_device::device_start() +{ + // resolve callbacks + m_out_irq_cb.resolve_safe(); + m_out_nmi_cb.resolve_safe(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void acorn_bus_device::device_reset() +{ +} + +// interrupt request from acorn_bus card +WRITE_LINE_MEMBER(acorn_bus_device::irq_w) { m_out_irq_cb(state); } +WRITE_LINE_MEMBER(acorn_bus_device::nmi_w) { m_out_nmi_cb(state); } + + + +//************************************************************************** +// DEVICE CONFIG ACORN BUS INTERFACE +//************************************************************************** + + +//************************************************************************** +// DEVICE ACORN BUS INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_acorn_bus_interface - constructor +//------------------------------------------------- + +device_acorn_bus_interface::device_acorn_bus_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device) + , m_bus(nullptr) + , m_bus_dev(nullptr) + , m_next(nullptr) +{ +} + + +//------------------------------------------------- +// ~device_acorn_bus_interface - destructor +//------------------------------------------------- + +device_acorn_bus_interface::~device_acorn_bus_interface() +{ +} + +void device_acorn_bus_interface::set_acorn_bus_device() +{ + m_bus = dynamic_cast(m_bus_dev); +} + + +//------------------------------------------------- +// SLOT_INTERFACE( acorn_bus_devices ) +//------------------------------------------------- + + +// slot devices +#include "system/32k.h" +#include "system/8k.h" +#include "system/cass.h" +#include "system/econet.h" +#include "system/fdc.h" +#include "system/vdu40.h" +#include "system/vdu80.h" +#include "system/vib.h" + +#include "atom/sid.h" +#include "atom/discpack.h" +#include "atom/econet.h" + +#include "cms/4080term.h" +#include "cms/fdc.h" +#include "cms/hires.h" + +void acorn_bus_devices(device_slot_interface &device) +{ + device.option_add("32k", ACORN_32K); /* 32K Dynamic RAM Board */ + device.option_add("8k", ACORN_8K); /* 8K Static RAM Board */ + //device.option_add("8kcmos", ACORN_8KCMOS); /* 8K CMOS RAM Board */ + //device.option_add("analog", ACORN_ANALOG); /* Analog Interface Board */ + device.option_add("cass", ACORN_CASS); /* Cassette Interface Board */ + device.option_add("econet", ACORN_ECONET); /* Econet Board */ + device.option_add("fdc", ACORN_FDC); /* Floppy Disc Controller Board */ + device.option_add("vdu40", ACORN_VDU40); /* 40 Column VDU Board */ + device.option_add("vdu80", ACORN_VDU80); /* 80x25 VDU Board */ + device.option_add("vib", ACORN_VIB); /* Versatile Interface Board */ +} + +void atom_bus_devices(device_slot_interface &device) +{ + device.option_add("32k", ACORN_32K); /* 32K Dynamic RAM Board */ + device.option_add("sid", ATOM_SID); /* AtomSID */ + device.option_add("discpack", ATOM_DISCPACK); /* Acorn Atom Disc Pack */ + device.option_add("econet", ATOM_ECONET); /* Econet Board */ +} + +void cms_bus_devices(device_slot_interface &device) +{ + device.option_add("4080term", CMS_4080TERM); /* CMS 40/80 Video Terminal Card */ + device.option_add("fdc", CMS_FDC); /* CMS Floppy Disc Controller */ + device.option_add("hires", CMS_HIRES); /* CMS High Resolution Colour Graphics Card */ +} diff --git a/src/devices/bus/acorn/bus.h b/src/devices/bus/acorn/bus.h new file mode 100644 index 00000000000..ea7014100b5 --- /dev/null +++ b/src/devices/bus/acorn/bus.h @@ -0,0 +1,125 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Bus Extension emulation + +**********************************************************************/ + +#ifndef MAME_BUS_ACORN_BUS_H +#define MAME_BUS_ACORN_BUS_H + +#pragma once + +#include + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class acorn_bus_device; + +class acorn_bus_slot_device : public device_t, public device_slot_interface +{ +public: + // construction/destruction + template + acorn_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&bus_tag, U &&opts, const char *dflt) + : acorn_bus_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + m_bus.set_tag(std::forward(bus_tag)); + } + acorn_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // configuration + required_device m_bus; +}; + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_BUS_SLOT, acorn_bus_slot_device) + + +class device_acorn_bus_interface; + +// ======================> acorn_bus_device +class acorn_bus_device : public device_t +{ +public: + // construction/destruction + acorn_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // inline configuration + template void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward(tag)); } + auto out_irq_callback() { return m_out_irq_cb.bind(); } + auto out_nmi_callback() { return m_out_nmi_cb.bind(); } + + address_space &memspace() const { return m_maincpu->space(AS_PROGRAM); } + + DECLARE_WRITE_LINE_MEMBER(irq_w); + DECLARE_WRITE_LINE_MEMBER(nmi_w); + + void add_slot(const char *tag); + void add_slot(device_slot_interface *slot); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // internal state + required_device m_maincpu; + + devcb_write_line m_out_irq_cb; + devcb_write_line m_out_nmi_cb; + + std::forward_list m_slot_list; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_BUS, acorn_bus_device) + +// ======================> device_acorn_bus_interface + +// class representing interface-specific live acorn bus card +class device_acorn_bus_interface : public device_slot_card_interface +{ + friend class acorn_bus_device; + template friend class simple_list; +public: + // construction/destruction + virtual ~device_acorn_bus_interface(); + + device_acorn_bus_interface *next() const { return m_next; } + + void set_acorn_bus_device(); + + // inline configuration + void set_acorn_bus(device_t *acorn_bus_device) { m_bus_dev = acorn_bus_device; } + +public: + device_acorn_bus_interface(const machine_config &mconfig, device_t &device); + + acorn_bus_device *m_bus; + device_t *m_bus_dev; + +private: + device_acorn_bus_interface *m_next; +}; + + +void acorn_bus_devices(device_slot_interface &device); +void atom_bus_devices(device_slot_interface &device); +void cms_bus_devices(device_slot_interface &device); + + +#endif // MAME_BUS_ACORN_BUS_H diff --git a/src/devices/bus/acorn/cms/4080term.cpp b/src/devices/bus/acorn/cms/4080term.cpp new file mode 100644 index 00000000000..c282715b7ae --- /dev/null +++ b/src/devices/bus/acorn/cms/4080term.cpp @@ -0,0 +1,177 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + CMS 40/80 Video Terminal Card + + Part No. CMS 0010-3 + +**********************************************************************/ + + +#include "emu.h" +#include "4080term.h" +#include "screen.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(CMS_4080TERM, cms_4080term_device, "cms_4080term", "CMS 40/80 Video Terminal Card") + + +//------------------------------------------------- +// gfx_layout cms_4080term_charlayout +//------------------------------------------------- + +static const gfx_layout cms_4080term_charlayout = +{ + 8, 10, /* 8 x 10 characters */ + 256, /* 256 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 7, 6, 5, 4, 3, 2, 1, 0 }, + /* y offsets */ + { 0, 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, 8 * 8, 9 * 8 }, + 8 * 16 /* every char takes 16 bytes */ +}; + +//------------------------------------------------- +// GFXDECODE( gfx_cms_4080term ) +//------------------------------------------------- + +static GFXDECODE_START(gfx_cms_4080term) + GFXDECODE_ENTRY("ef9345", 0x2000, cms_4080term_charlayout, 0, 4) +GFXDECODE_END + +//------------------------------------------------- +// MACHINE_DRIVER( cms_4080term ) +//------------------------------------------------- + +ROM_START(cms_4080term) + ROM_REGION(0x4000, "ef9345", 0) + ROM_LOAD("charset.rom", 0x0000, 0x2000, BAD_DUMP CRC(b2f49eb3) SHA1(d0ef530be33bfc296314e7152302d95fdf9520fc)) // from dcvg5k +ROM_END + + +static DEVICE_INPUT_DEFAULTS_START(keyboard) + DEVICE_INPUT_DEFAULTS("RS232_TXBAUD", 0xff, RS232_BAUD_1200) + DEVICE_INPUT_DEFAULTS("RS232_STARTBITS", 0xff, RS232_STARTBITS_1) + DEVICE_INPUT_DEFAULTS("RS232_DATABITS", 0xff, RS232_DATABITS_8) + DEVICE_INPUT_DEFAULTS("RS232_PARITY", 0xff, RS232_PARITY_NONE) + DEVICE_INPUT_DEFAULTS("RS232_STOPBITS", 0xff, RS232_STOPBITS_2) +DEVICE_INPUT_DEFAULTS_END + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(cms_4080term_device::device_add_mconfig) + /* video hardware */ + device = &SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(50); + m_screen->set_size(768, 312); + m_screen->set_visarea(0, 492 - 1, 0, 270 - 1); + MCFG_SCREEN_UPDATE_DEVICE("ef9345", ef9345_device, screen_update) + + MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cms_4080term) + MCFG_PALETTE_ADD("palette", 8) + + EF9345(config, m_ef9345, 0); + m_ef9345->set_screen("screen"); + m_ef9345->set_palette_tag("palette"); + + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", cms_4080term_device, update_scanline, "screen", 0, 10) + + VIA6522(config, m_via, 1_MHz_XTAL); + m_via->writepa_handler().set("cent_data_out", FUNC(output_latch_device::bus_w)); + m_via->ca2_handler().set(m_centronics, FUNC(centronics_device::write_strobe)); + m_via->irq_handler().set(FUNC(cms_4080term_device::bus_irq_w)); + + MOS6551(config, m_acia, 0); + m_acia->set_xtal(1.8432_MHz_XTAL); + m_acia->txd_handler().set(m_rs232, FUNC(rs232_port_device::write_txd)); + m_acia->rts_handler().set(m_rs232, FUNC(rs232_port_device::write_rts)); + m_acia->dtr_handler().set(m_rs232, FUNC(rs232_port_device::write_dtr)); + m_acia->irq_handler().set(FUNC(cms_4080term_device::bus_irq_w)); + + RS232_PORT(config, m_rs232, default_rs232_devices, "keyboard"); + m_rs232->set_option_device_input_defaults("keyboard", DEVICE_INPUT_DEFAULTS_NAME(keyboard)); + m_rs232->rxd_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); + m_rs232->dcd_handler().set(m_acia, FUNC(mos6551_device::write_dcd)); + m_rs232->dsr_handler().set(m_acia, FUNC(mos6551_device::write_dsr)); + m_rs232->cts_handler().set(m_acia, FUNC(mos6551_device::write_cts)); + + /* printer */ + CENTRONICS(config, m_centronics, centronics_devices, "printer"); + m_centronics->ack_handler().set(m_via, FUNC(via6522_device::write_ca1)); + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") +MACHINE_CONFIG_END + + +const tiny_rom_entry *cms_4080term_device::device_rom_region() const +{ + return ROM_NAME( cms_4080term ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// cms_4080term_device - constructor +//------------------------------------------------- + +cms_4080term_device::cms_4080term_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, CMS_4080TERM, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_via(*this, "via") + , m_acia(*this, "acia") + , m_screen(*this, "screen") + , m_ef9345(*this, "ef9345") + , m_rs232(*this, "rs232") + , m_centronics(*this, "centronics") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cms_4080term_device::device_start() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_readwrite_handler(0xfd20, 0xfd2f, read8_delegate(FUNC(ef9345_device::data_r), m_ef9345.target()), write8_delegate(FUNC(ef9345_device::data_w), m_ef9345.target())); + space.install_readwrite_handler(0xfd30, 0xfd3f, read8_delegate(FUNC(via6522_device::read), m_via.target()), write8_delegate(FUNC(via6522_device::write), m_via.target())); + space.install_readwrite_handler(0xfd40, 0xfd4f, read8_delegate(FUNC(mos6551_device::read), m_acia.target()), write8_delegate(FUNC(mos6551_device::write), m_acia.target())); + + uint8_t *FNT = memregion("ef9345")->base(); + uint16_t dest = 0x2000; + + /* Unscramble the chargen rom as the format is too complex for gfxdecode to handle unaided */ + for (uint16_t a = 0; a < 8192; a += 4096) + for (uint16_t b = 0; b < 2048; b += 64) + for (uint16_t c = 0; c < 4; c++) + for (uint16_t d = 0; d < 64; d += 4) + FNT[dest++] = FNT[a | b | c | d]; +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +TIMER_DEVICE_CALLBACK_MEMBER(cms_4080term_device::update_scanline) +{ + m_ef9345->update_scanline((uint16_t)param); +} + +WRITE_LINE_MEMBER(cms_4080term_device::bus_irq_w) +{ + m_bus->irq_w(state); +} diff --git a/src/devices/bus/acorn/cms/4080term.h b/src/devices/bus/acorn/cms/4080term.h new file mode 100644 index 00000000000..14d1beacd43 --- /dev/null +++ b/src/devices/bus/acorn/cms/4080term.h @@ -0,0 +1,61 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + CMS 40/80 Video Terminal Card + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_CMS_4080TERM_H +#define MAME_BUS_ACORN_CMS_4080TERM_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "bus/rs232/rs232.h" +#include "bus/centronics/ctronics.h" +#include "machine/6522via.h" +#include "machine/mos6551.h" +#include "machine/timer.h" +#include "video/ef9345.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class cms_4080term_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + cms_4080term_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + TIMER_DEVICE_CALLBACK_MEMBER(update_scanline); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + +private: + DECLARE_WRITE_LINE_MEMBER(bus_irq_w); + + required_device m_via; + required_device m_acia; + required_device m_screen; + required_device m_ef9345; + required_device m_rs232; + required_device m_centronics; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(CMS_4080TERM, cms_4080term_device) + + +#endif // MAME_BUS_ACORN_CMS_4080TERM_H diff --git a/src/devices/bus/acorn/cms/fdc.cpp b/src/devices/bus/acorn/cms/fdc.cpp new file mode 100644 index 00000000000..f58e45f9c05 --- /dev/null +++ b/src/devices/bus/acorn/cms/fdc.cpp @@ -0,0 +1,125 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + CMS Floppy Disc Controller Board + + Part No. CMS 0015-1 + +**********************************************************************/ + + +#include "emu.h" +#include "fdc.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(CMS_FDC, cms_fdc_device, "cms_fdc", "CMS Floppy Disc Controller Board") + +//------------------------------------------------- +// MACHINE_DRIVER( cms_fdc ) +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER(cms_fdc_device::floppy_formats ) + FLOPPY_ACORN_SSD_FORMAT +FLOPPY_FORMATS_END + +static void cms_floppies(device_slot_interface &device) +{ + device.option_add("35dd", FLOPPY_35_DD); +} + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void cms_fdc_device::device_add_mconfig(machine_config &config) +{ + WD1770(config, m_fdc, 8_MHz_XTAL); + //m_fdc->intrq_wr_callback().set(FUNC(cms_fdc_device::bus_irq_w)); + //m_fdc->drq_wr_callback().set(FUNC(cms_fdc_device::bus_nmi_w)); + FLOPPY_CONNECTOR(config, m_floppy[0], cms_floppies, "35dd", floppy_formats); + m_floppy[0]->enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[1], cms_floppies, "35dd", floppy_formats); + m_floppy[1]->enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[2], cms_floppies, nullptr, floppy_formats); + m_floppy[2]->enable_sound(true); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// cms_fdc_device - constructor +//------------------------------------------------- + +cms_fdc_device::cms_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, CMS_FDC, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_fdc(*this, "wd1770") + , m_floppy(*this, "wd1770:%u", 0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cms_fdc_device::device_start() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_readwrite_handler(0xfc50, 0xfc5f, read8_delegate(FUNC(cms_fdc_device::wd1770_state_r), this), write8_delegate(FUNC(cms_fdc_device::wd1770_control_w), this)); + space.install_readwrite_handler(0xfc40, 0xfc4f, read8_delegate(FUNC(wd1770_device::read), m_fdc.target()), write8_delegate(FUNC(wd1770_device::write), m_fdc.target())); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +READ8_MEMBER(cms_fdc_device::wd1770_state_r) +{ + uint8_t data = 0x3f; + + data |= m_fdc->intrq_r() << 6; + data |= m_fdc->drq_r() << 7; + logerror("floppy state %02x\n", data); + return data; +} + +WRITE8_MEMBER(cms_fdc_device::wd1770_control_w) +{ + floppy_image_device *floppy = nullptr; + logerror("floppy control %02x\n", data); + + // bit 0, 1, 2: drive select + if (BIT(data, 0)) floppy = m_floppy[0]->get_device(); + if (BIT(data, 1)) floppy = m_floppy[1]->get_device(); + if (BIT(data, 2)) floppy = m_floppy[2]->get_device(); + m_fdc->set_floppy(floppy); + + // bit 3: side select + if (floppy) + floppy->ss_w(BIT(data, 3)); + + // bit 7: density ?? + m_fdc->dden_w(BIT(data, 7)); +} + +WRITE_LINE_MEMBER(cms_fdc_device::bus_nmi_w) +{ + m_bus->nmi_w(state); +} + +WRITE_LINE_MEMBER(cms_fdc_device::bus_irq_w) +{ + m_bus->irq_w(state); +} \ No newline at end of file diff --git a/src/devices/bus/acorn/cms/fdc.h b/src/devices/bus/acorn/cms/fdc.h new file mode 100644 index 00000000000..865896a2eeb --- /dev/null +++ b/src/devices/bus/acorn/cms/fdc.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + CMS Floppy Disc Controller Board + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_CMS_FDC_H +#define MAME_BUS_ACORN_CMS_FDC_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "machine/wd_fdc.h" +#include "formats/acorn_dsk.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class cms_fdc_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + cms_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_FLOPPY_FORMATS(floppy_formats); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + DECLARE_READ8_MEMBER(wd1770_state_r); + DECLARE_WRITE8_MEMBER(wd1770_control_w); + DECLARE_WRITE_LINE_MEMBER(bus_irq_w); + DECLARE_WRITE_LINE_MEMBER(bus_nmi_w); + + required_device m_fdc; + required_device_array m_floppy; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(CMS_FDC, cms_fdc_device) + + +#endif // MAME_BUS_ACORN_CMS_FDC_H diff --git a/src/devices/bus/acorn/cms/hires.cpp b/src/devices/bus/acorn/cms/hires.cpp new file mode 100644 index 00000000000..35ef26fd598 --- /dev/null +++ b/src/devices/bus/acorn/cms/hires.cpp @@ -0,0 +1,115 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + CMS High Resolution Colour Graphics Card + + Part No. CMS Video-4 + +**********************************************************************/ + + +#include "emu.h" +#include "hires.h" +#include "screen.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(CMS_HIRES, cms_hires_device, "cms_hires", "CMS High Resolution Colour Graphics Card") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(cms_hires_device::device_add_mconfig) + /* video hardware */ + device = &SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_size(512, 312); + m_screen->set_visarea(0, 512 - 1, 0, 256 - 1); + m_screen->set_refresh_hz(50); + MCFG_SCREEN_UPDATE_DEVICE("ef9366", ef9365_device, screen_update) + MCFG_PALETTE_ADD("palette", 16) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("flash_rate", cms_hires_device, flash_rate, attotime::from_hz(3)) // from 555 timer (4.7uF, 100K, 470R) + + EF9365(config, m_gdp, 14_MHz_XTAL / 8); + m_gdp->set_screen("screen"); + m_gdp->set_palette_tag("palette"); + m_gdp->set_nb_bitplanes(4); + m_gdp->set_display_mode(ef9365_device::DISPLAY_MODE_512x256); +MACHINE_CONFIG_END + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// cms_hires_device - constructor +//------------------------------------------------- + +cms_hires_device::cms_hires_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, CMS_HIRES, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_screen(*this, "screen") + , m_gdp(*this, "ef9366") + , m_flash_state(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cms_hires_device::device_start() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_readwrite_handler(0xfc10, 0xfc1f, read8_delegate(FUNC(ef9365_device::data_r), m_gdp.target()), write8_delegate(FUNC(ef9365_device::data_w), m_gdp.target())); + space.install_write_handler(0xfc20, 0xfc2f, write8_delegate(FUNC(cms_hires_device::colour_reg_w), this)); + + save_item(NAME(m_flash_state)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void cms_hires_device::device_reset() +{ + /* Generate hardware palette */ + for (int i=0; i<8; i++) + { + m_gdp->set_color_entry(i + 8, ((i & 1) ^ 1) * 255, (((i & 2) >> 1) ^ 1) * 255, (((i & 4) >> 2) ^ 1) * 255); + } +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +TIMER_DEVICE_CALLBACK_MEMBER(cms_hires_device::flash_rate) +{ + m_flash_state = !m_flash_state; + + /* Generate hardware flashing palette */ + for (int i=0; i<8; i++) + { + if (m_flash_state) + m_gdp->set_color_entry(i, ((i & 1) ^ 1) * 255, (((i & 2) >> 1) ^ 1) * 255, (((i & 4) >> 2) ^ 1) * 255); + else + m_gdp->set_color_entry(i, 0, 0, 0); + } +} + +WRITE8_MEMBER(cms_hires_device::colour_reg_w) +{ + m_gdp->set_color_filler(data & 0x0f); +} diff --git a/src/devices/bus/acorn/cms/hires.h b/src/devices/bus/acorn/cms/hires.h new file mode 100644 index 00000000000..5f2f2a691c2 --- /dev/null +++ b/src/devices/bus/acorn/cms/hires.h @@ -0,0 +1,54 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + CMS High Resolution Colour Graphics Card + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_CMS_HIRES_H +#define MAME_BUS_ACORN_CMS_HIRES_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "machine/timer.h" +#include "video/ef9365.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class cms_hires_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + cms_hires_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + TIMER_DEVICE_CALLBACK_MEMBER(flash_rate); + DECLARE_WRITE8_MEMBER(colour_reg_w); + + required_device m_screen; + required_device m_gdp; + + int m_flash_state; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(CMS_HIRES, cms_hires_device) + + +#endif // MAME_BUS_ACORN_CMS_HIRES_H diff --git a/src/devices/bus/acorn/system/32k.cpp b/src/devices/bus/acorn/system/32k.cpp new file mode 100644 index 00000000000..bc131f60091 --- /dev/null +++ b/src/devices/bus/acorn/system/32k.cpp @@ -0,0 +1,96 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn 32K Dynamic RAM Board + + Part No. 200,010 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_32KDRAM.html + + The 32K Dynamic RAM Board is provided with soldered links which give + the Dynamic RAM the addresses 2000 to 7FFF and C000 to DFFF, Acorn + Memory Blocks 2 to 7, C and D. + + The 16K DRAM option can he equipped with 8 DRAM IC; in Bank B. The + Address Selection Links are then required to give DRAM addresses 8000 + to BFFF. + +**********************************************************************/ + + +#include "emu.h" +#include "32k.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_32K, acorn_32k_device, "acorn_32k", "Acorn 32K Dynamic RAM Board") + + +//------------------------------------------------- +// INPUT_PORTS( 32k ) +//------------------------------------------------- + +INPUT_PORTS_START( 32k ) + PORT_START("LINKS") + PORT_CONFNAME(0x01, 0x00, "Address Selection (RAM)") + PORT_CONFSETTING(0x00, "32K: &2000-&7FFF, &C000-&DFFF") + PORT_CONFSETTING(0x01, "16K: &8000-&BFFF") +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor acorn_32k_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( 32k ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_32k_device - constructor +//------------------------------------------------- + +acorn_32k_device::acorn_32k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_32K, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_links(*this, "LINKS") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_32k_device::device_start() +{ +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void acorn_32k_device::device_reset() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + if (m_links->read()) + { + space.install_ram(0x8000, 0xbfff); + } + else + { + space.install_ram(0x2000, 0x7fff); + space.install_ram(0xc000, 0xdfff); + } +} diff --git a/src/devices/bus/acorn/system/32k.h b/src/devices/bus/acorn/system/32k.h new file mode 100644 index 00000000000..0ef4c10f3c3 --- /dev/null +++ b/src/devices/bus/acorn/system/32k.h @@ -0,0 +1,48 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn 32K Dynamic RAM Board + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_32KDRAM.html + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_SYSTEM_32K_H +#define MAME_BUS_ACORN_SYSTEM_32K_H + +#pragma once + +#include "bus/acorn/bus.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class acorn_32k_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + acorn_32k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + +private: + required_ioport m_links; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_32K, acorn_32k_device) + + +#endif // MAME_BUS_ACORN_SYSTEM_32K_H diff --git a/src/devices/bus/acorn/system/8k.cpp b/src/devices/bus/acorn/system/8k.cpp new file mode 100644 index 00000000000..5ac32c1a82f --- /dev/null +++ b/src/devices/bus/acorn/system/8k.cpp @@ -0,0 +1,162 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn 8K Static Memory Board + + Part No. 200,003 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_Memory.html + + The Acorn Extension Memory board provides an extra 8K bytes of + user RAM space and has sockets for two ROMs which may be 2, 4 or 8K + devices providing 4 or 8K bytes of firmware. + +**********************************************************************/ + + +#include "emu.h" +#include "8k.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_8K, acorn_8k_device, "acorn_8k", "Acorn 8K Static Memory Board") + + +//------------------------------------------------- +// INPUT_PORTS( 8k ) +//------------------------------------------------- + +INPUT_PORTS_START( 8k ) + PORT_START("LINKS") + PORT_CONFNAME(0x07, 0x01, "Address Selection (RAM)") + PORT_CONFSETTING(0x00, "&0000-&1FFF") + PORT_CONFSETTING(0x01, "&2000-&3FFF") + PORT_CONFSETTING(0x02, "&4000-&5FFF") + PORT_CONFSETTING(0x03, "&6000-&7FFF") + PORT_CONFSETTING(0x04, "&8000-&9FFF") + PORT_CONFSETTING(0x05, "&A000-&BFFF") + PORT_CONFSETTING(0x06, "&C000-&DFFF") + PORT_CONFSETTING(0x07, "&E000-&FFFF") + PORT_CONFNAME(0x70, 0x50, "Address Selection (ROM)") + PORT_CONFSETTING(0x00, "&0000-&1FFF") + PORT_CONFSETTING(0x10, "&2000-&3FFF") + PORT_CONFSETTING(0x20, "&4000-&5FFF") + PORT_CONFSETTING(0x30, "&6000-&7FFF") + PORT_CONFSETTING(0x40, "&8000-&9FFF") + PORT_CONFSETTING(0x50, "&A000-&BFFF") + PORT_CONFSETTING(0x60, "&C000-&DFFF") + PORT_CONFSETTING(0x70, "&E000-&FFFF") +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor acorn_8k_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( 8k ); +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(acorn_8k_device::device_add_mconfig) + /* rom sockets */ + MCFG_GENERIC_SOCKET_ADD("rom0", generic_plain_slot, "acrnsys_rom") // IC17 + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(acorn_8k_device, rom0_load) + MCFG_GENERIC_SOCKET_ADD("rom1", generic_plain_slot, "acrnsys_rom") // IC18 + MCFG_GENERIC_EXTENSIONS("bin,rom") + MCFG_GENERIC_LOAD(acorn_8k_device, rom1_load) +MACHINE_CONFIG_END + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_8k_device - constructor +//------------------------------------------------- + +acorn_8k_device::acorn_8k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_8K, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_rom(*this, "rom%u", 0) + , m_links(*this, "LINKS") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_8k_device::device_start() +{ +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void acorn_8k_device::device_reset() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + uint16_t ram_addr = (m_links->read() & 0x0f) << 13; + + if (ram_addr == 0x0000) // BLK0 + { + space.install_ram(0x1000, 0x1fff); + } + else + { + space.install_ram(ram_addr, ram_addr + 0x1fff); + } + + uint16_t rom_addr = (m_links->read() & 0xf0) << 9; + + if (m_rom[0]->exists() && rom_addr != 0x0000) // BLK0 + { + space.install_rom(rom_addr + 0x0000, rom_addr + 0x0fff, m_rom[0]->get_rom_base()); + } + if (m_rom[1]->exists() && rom_addr != 0xe000) // don't replace OS in page F + { + space.install_rom(rom_addr + 0x1000, rom_addr + 0x1fff, m_rom[1]->get_rom_base()); + } +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +image_init_result acorn_8k_device::load_rom(device_image_interface &image, generic_slot_device *slot) +{ + uint32_t size = slot->common_get_size("rom"); + + // socket accepts 2K and 4K ROM only + if (size != 0x0800 && size != 0x1000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only 2K/4K is supported"); + return image_init_result::FAIL; + } + + slot->rom_alloc(0x1000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + slot->common_load_rom(slot->get_rom_base(), size, "rom"); + + // mirror 2K ROMs + uint8_t *rom = slot->get_rom_base(); + if (size <= 0x0800) memcpy(rom + 0x0800, rom, 0x0800); + + return image_init_result::PASS; +} diff --git a/src/devices/bus/acorn/system/8k.h b/src/devices/bus/acorn/system/8k.h new file mode 100644 index 00000000000..125b636cd5b --- /dev/null +++ b/src/devices/bus/acorn/system/8k.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn 8K Static Memory Board + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_Memory.html + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_SYSTEM_8K_H +#define MAME_BUS_ACORN_SYSTEM_8K_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class acorn_8k_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + acorn_8k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + +private: + image_init_result load_rom(device_image_interface &image, generic_slot_device *slot); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom0_load) { return load_rom(image, m_rom[0]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[1]); } + + required_device_array m_rom; + required_ioport m_links; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_8K, acorn_8k_device) + + +#endif // MAME_BUS_ACORN_SYSTEM_8K_H diff --git a/src/devices/bus/acorn/system/cass.cpp b/src/devices/bus/acorn/system/cass.cpp new file mode 100644 index 00000000000..36038405a84 --- /dev/null +++ b/src/devices/bus/acorn/system/cass.cpp @@ -0,0 +1,100 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Cassette Interface + + Part No. 100,001 + +**********************************************************************/ + + +#include "emu.h" +#include "cass.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_CASS, acorn_cass_device, "acorn_cass", "Acorn Cassette Interface") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(acorn_cass_device::device_add_mconfig) + /* sound hardware */ + SPEAKER(config, "mono").front_center(); + WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25); + + CASSETTE(config, "cassette", 0); + MCFG_TIMER_DRIVER_ADD_PERIODIC("cass_c", acorn_cass_device, cass_c, attotime::from_hz(4800)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("cass_p", acorn_cass_device, cass_p, attotime::from_hz(40000)) +MACHINE_CONFIG_END + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_cass_device - constructor +//------------------------------------------------- + +acorn_cass_device::acorn_cass_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_CASS, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_cass(*this, "cassette") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_cass_device::device_start() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE_LINE_MEMBER(acorn_cass_device::cass_w) +{ + m_cass_state = state; +} + +TIMER_DEVICE_CALLBACK_MEMBER(acorn_cass_device::cass_c) +{ + m_cass_data[3]++; + + if (m_cass_state != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_cass_state; + } + + if (m_cass_state) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +TIMER_DEVICE_CALLBACK_MEMBER(acorn_cass_device::cass_p) +{ + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + uint8_t cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + //m_bus->write_pb7(m_cass_data[1] < 12); + m_cass_data[1] = 0; + } +} \ No newline at end of file diff --git a/src/devices/bus/acorn/system/cass.h b/src/devices/bus/acorn/system/cass.h new file mode 100644 index 00000000000..02a323bb994 --- /dev/null +++ b/src/devices/bus/acorn/system/cass.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Cassette Interface + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_SYSTEM_CASS_H +#define MAME_BUS_ACORN_SYSTEM_CASS_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "machine/timer.h" +#include "imagedev/cassette.h" +#include "sound/wave.h" +#include "speaker.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class acorn_cass_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + acorn_cass_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + DECLARE_WRITE_LINE_MEMBER(cass_w); + TIMER_DEVICE_CALLBACK_MEMBER(cass_c); + TIMER_DEVICE_CALLBACK_MEMBER(cass_p); + + required_device m_cass; + + uint8_t m_cass_data[4]; + bool m_cass_state; + bool m_cassold; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_CASS, acorn_cass_device) + + +#endif // MAME_BUS_ACORN_SYSTEM_CASS_H diff --git a/src/devices/bus/acorn/system/econet.cpp b/src/devices/bus/acorn/system/econet.cpp new file mode 100644 index 00000000000..01b4c6010be --- /dev/null +++ b/src/devices/bus/acorn/system/econet.cpp @@ -0,0 +1,88 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Econet Interface + + Part No. 200,024 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_Econet.html + +**********************************************************************/ + +#include "emu.h" +#include "econet.h" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_ECONET, acorn_econet_device, "acorn_econet", "Acorn Econet Interface") + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(acorn_econet_device::device_add_mconfig) + /* econet */ + MCFG_DEVICE_ADD(m_adlc, MC6854, 0) + MCFG_MC6854_OUT_TXD_CB(WRITELINE(m_econet, econet_device, host_data_w)) + MCFG_MC6854_OUT_IRQ_CB(WRITELINE(*this, acorn_econet_device, bus_irq_w)) + + ECONET(config, m_econet, 0); + m_econet->clk_wr_callback().set(m_adlc, FUNC(mc6854_device::txc_w)); + m_econet->clk_wr_callback().append(m_adlc, FUNC(mc6854_device::rxc_w)); + m_econet->data_wr_callback().set(m_adlc, FUNC(mc6854_device::set_rx)); + MCFG_ECONET_SLOT_ADD("econet254", 254, econet_devices, nullptr) +MACHINE_CONFIG_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_econet_device - constructor +//------------------------------------------------- + +acorn_econet_device::acorn_econet_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_ECONET, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_adlc(*this, "mc6854") + , m_econet(*this, "econet") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_econet_device::device_start() +{ +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void acorn_econet_device::device_reset() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_readwrite_handler(0x1940, 0x1943, read8_delegate(FUNC(mc6854_device::read), m_adlc.target()), write8_delegate(FUNC(mc6854_device::write), m_adlc.target())); + space.install_read_handler(0x1944, 0x1944, read8_delegate(FUNC(acorn_econet_device::statid_r), this)); +} + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +READ8_MEMBER(acorn_econet_device::statid_r) +{ + return 0xfe; +} + +WRITE_LINE_MEMBER(acorn_econet_device::bus_irq_w) +{ + m_bus->irq_w(state); +} diff --git a/src/devices/bus/acorn/system/econet.h b/src/devices/bus/acorn/system/econet.h new file mode 100644 index 00000000000..4b876674ae4 --- /dev/null +++ b/src/devices/bus/acorn/system/econet.h @@ -0,0 +1,54 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Econet Interface + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_Econet.html + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_SYSTEM_ECONET_H +#define MAME_BUS_ACORN_SYSTEM_ECONET_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "bus/econet/econet.h" +#include "machine/mc6854.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class acorn_econet_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + acorn_econet_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + DECLARE_READ8_MEMBER(statid_r); + DECLARE_WRITE_LINE_MEMBER(bus_irq_w); + + required_device m_adlc; + required_device m_econet; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_ECONET, acorn_econet_device) + + +#endif // MAME_BUS_ACORN_SYSTEM_ECONET_H diff --git a/src/devices/bus/acorn/system/fdc.cpp b/src/devices/bus/acorn/system/fdc.cpp new file mode 100644 index 00000000000..ef4046c9555 --- /dev/null +++ b/src/devices/bus/acorn/system/fdc.cpp @@ -0,0 +1,114 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Floppy Disc Controller Board + + Part No. 200,004 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_fdc.html + +**********************************************************************/ + + +#include "emu.h" +#include "fdc.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_FDC, acorn_fdc_device, "acorn_fdc", "Acorn Floppy Disc Controller Board") + +//------------------------------------------------- +// MACHINE_DRIVER( fdc ) +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER(acorn_fdc_device::floppy_formats ) + FLOPPY_ACORN_SSD_FORMAT +FLOPPY_FORMATS_END + +static void acorn_floppies(device_slot_interface &device) +{ + device.option_add("525sssd", FLOPPY_525_SSSD); + device.option_add("525sd", FLOPPY_525_SD); + device.option_add("525qd", FLOPPY_525_QD); +} + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void acorn_fdc_device::device_add_mconfig(machine_config &config) +{ + I8271(config, m_fdc, 0); + m_fdc->intrq_wr_callback().set(FUNC(acorn_fdc_device::bus_nmi_w)); + m_fdc->hdl_wr_callback().set(FUNC(acorn_fdc_device::motor_w)); + m_fdc->opt_wr_callback().set(FUNC(acorn_fdc_device::side_w)); + FLOPPY_CONNECTOR(config, m_floppy[0], acorn_floppies, "525qd", acorn_fdc_device::floppy_formats); + m_floppy[0]->enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[1], acorn_floppies, "525qd", acorn_fdc_device::floppy_formats); + m_floppy[1]->enable_sound(true); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_fdc_device - constructor +//------------------------------------------------- + +acorn_fdc_device::acorn_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_FDC, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_fdc(*this, "i8271") + , m_floppy(*this, "i8271:%u", 0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_fdc_device::device_start() +{ +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void acorn_fdc_device::device_reset() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_device(0x0a00, 0x0a03, *m_fdc, &i8271_device::map); + space.install_readwrite_handler(0x0a04, 0x0a04, 0, 0x1f8, 0, read8_delegate(FUNC(i8271_device::data_r), m_fdc.target()), write8_delegate(FUNC(i8271_device::data_w), m_fdc.target())); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE_LINE_MEMBER(acorn_fdc_device::motor_w) +{ + if (m_floppy[0]->get_device()) m_floppy[0]->get_device()->mon_w(!state); + if (m_floppy[1]->get_device()) m_floppy[1]->get_device()->mon_w(!state); +} + +WRITE_LINE_MEMBER(acorn_fdc_device::side_w) +{ + if (m_floppy[0]->get_device()) m_floppy[0]->get_device()->ss_w(state); + if (m_floppy[1]->get_device()) m_floppy[1]->get_device()->ss_w(state); +} + +WRITE_LINE_MEMBER(acorn_fdc_device::bus_nmi_w) +{ + m_bus->nmi_w(state); +} diff --git a/src/devices/bus/acorn/system/fdc.h b/src/devices/bus/acorn/system/fdc.h new file mode 100644 index 00000000000..44c3881ffc0 --- /dev/null +++ b/src/devices/bus/acorn/system/fdc.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Floppy Disc Controller Board + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_fdc.html + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_SYSTEM_FDC_H +#define MAME_BUS_ACORN_SYSTEM_FDC_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "machine/i8271.h" +#include "formats/acorn_dsk.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class acorn_fdc_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + acorn_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_FLOPPY_FORMATS(floppy_formats); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + DECLARE_WRITE_LINE_MEMBER(bus_nmi_w); + DECLARE_WRITE_LINE_MEMBER(motor_w); + DECLARE_WRITE_LINE_MEMBER(side_w); + + required_device m_fdc; + required_device_array m_floppy; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_FDC, acorn_fdc_device) + + +#endif // MAME_BUS_ACORN_SYSTEM_FDC_H diff --git a/src/devices/bus/acorn/system/vdu40.cpp b/src/devices/bus/acorn/system/vdu40.cpp new file mode 100644 index 00000000000..535250ef081 --- /dev/null +++ b/src/devices/bus/acorn/system/vdu40.cpp @@ -0,0 +1,127 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn 40 Column VDU Interface + + Part No. 200,002 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_VDU.html + +**********************************************************************/ + + +#include "emu.h" +#include "vdu40.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_VDU40, acorn_vdu40_device, "acorn_vdu40", "Acorn 40 Column VDU Interface") + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(acorn_vdu40_device::device_add_mconfig) + device = &SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(12_MHz_XTAL, 768, 132, 612, 311, 20, 270); + MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update) + + MCFG_PALETTE_ADD("palette", 8) + + HD6845(config, m_crtc, 12_MHz_XTAL / 6); + m_crtc->set_screen("screen"); + m_crtc->set_show_border_area(false); + m_crtc->set_char_width(12); + m_crtc->out_vsync_callback().set(FUNC(acorn_vdu40_device::vsync_changed)); + m_crtc->set_update_row_callback(FUNC(acorn_vdu40_device::crtc_update_row), this); + + SAA5050(config, m_trom, 12_MHz_XTAL / 2); + m_trom->set_screen_size(40, 25, 40); +MACHINE_CONFIG_END + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_vdu40_device - constructor +//------------------------------------------------- + +acorn_vdu40_device::acorn_vdu40_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_VDU40, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_screen(*this, "screen") + , m_crtc(*this, "mc6845") + , m_trom(*this, "saa5050") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_vdu40_device::device_start() +{ + /* allocate m_videoram */ + m_videoram = std::make_unique(0x0400); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void acorn_vdu40_device::device_reset() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_ram(0x0400, 0x07ff, m_videoram.get()); + space.install_readwrite_handler(0x0800, 0x0800, read8_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::address_w), m_crtc.target())); + space.install_readwrite_handler(0x0801, 0x0801, read8_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::register_w), m_crtc.target())); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +MC6845_UPDATE_ROW(acorn_vdu40_device::crtc_update_row) +{ + uint32_t *p = &bitmap.pix32(y); + + m_trom->lose_w(1); + m_trom->lose_w(0); + + for (int column = 0; column < x_count; column++) + { + m_trom->write(m_videoram[(ma + column) & 0x3ff]); + + m_trom->f1_w(1); + m_trom->f1_w(0); + + for (int bit = 0; bit < 12; bit++) + { + m_trom->tr6_w(1); + m_trom->tr6_w(0); + + int col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); + + int r = BIT(col, 0) * 0xff; + int g = BIT(col, 1) * 0xff; + int b = BIT(col, 2) * 0xff; + + *p++ = rgb_t(r, g, b); + } + } +} + +WRITE_LINE_MEMBER(acorn_vdu40_device::vsync_changed) +{ + m_trom->dew_w(state); +} diff --git a/src/devices/bus/acorn/system/vdu40.h b/src/devices/bus/acorn/system/vdu40.h new file mode 100644 index 00000000000..ff80a76d1ea --- /dev/null +++ b/src/devices/bus/acorn/system/vdu40.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn 40 Column VDU Interface + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_VDU.html + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_SYSTEM_VDU40_H +#define MAME_BUS_ACORN_SYSTEM_VDU40_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "video/saa5050.h" +#include "video/mc6845.h" +#include "emupal.h" +#include "screen.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class acorn_vdu40_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + acorn_vdu40_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + MC6845_UPDATE_ROW(crtc_update_row); + DECLARE_WRITE_LINE_MEMBER(vsync_changed); + + required_device m_screen; + required_device m_crtc; + required_device m_trom; + + std::unique_ptr m_videoram; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_VDU40, acorn_vdu40_device) + + +#endif // MAME_BUS_ACORN_SYSTEM_VDU40_H diff --git a/src/devices/bus/acorn/system/vdu80.cpp b/src/devices/bus/acorn/system/vdu80.cpp new file mode 100644 index 00000000000..77fd4d7a629 --- /dev/null +++ b/src/devices/bus/acorn/system/vdu80.cpp @@ -0,0 +1,195 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn 80x25 VDU Interface + + Part No. 400,019 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_80x25VDUIF.html + +**********************************************************************/ + + +#include "emu.h" +#include "vdu80.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_VDU80, acorn_vdu80_device, "acorn_vdu80", "Acorn 80x25 VDU Interface") + + +//------------------------------------------------- +// INPUT_PORTS( vdu80 ) +//------------------------------------------------- + +INPUT_PORTS_START( vdu80 ) + PORT_START("LINKS") + PORT_CONFNAME(0x01, 0x00, "Address Selection (RAM/CRTC)") + PORT_CONFSETTING(0x00, "A: &1000-&17FF/&1840-&1841") + PORT_CONFSETTING(0x01, "B: &F000-&F7FF/&E840-&E841") + PORT_CONFNAME(0x02, 0x00, "LK2: Display Inversion") + PORT_CONFSETTING(0x00, DEF_STR(No)) + PORT_CONFSETTING(0x02, DEF_STR(Yes)) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor acorn_vdu80_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( vdu80 ); +} + + +//------------------------------------------------- +// MACHINE_DRIVER( vdu80 ) +//------------------------------------------------- + +ROM_START( vdu80 ) + ROM_REGION(0x0800, "chargen", 0) + ROM_LOAD("80chvdu.ic13", 0x0000, 0x0800, CRC(a943f01b) SHA1(04c326a745ba6a78185ebc2adeecb53a166a6ab3)) +ROM_END + + +//------------------------------------------------- +// gfx_layout acorn_vdu80_charlayout +//------------------------------------------------- + +static const gfx_layout acorn_vdu80_charlayout = +{ + 6, 10, /* 6 x 10 characters */ + 128, /* 128 characters */ + 1, /* 1 bits per pixel */ + { 0 }, /* no bitplanes */ + /* x offsets */ + { 0, 1, 2, 3, 4, 5 }, + /* y offsets */ + { 0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8, 8 * 8, 9 * 8 }, + 8 * 16 /* every char takes 16 bytes */ +}; + +//------------------------------------------------- +// GFXDECODE( gfx_acorn_vdu80 ) +//------------------------------------------------- + +static GFXDECODE_START(gfx_acorn_vdu80) + GFXDECODE_ENTRY("chargen", 0, acorn_vdu80_charlayout, 0, 1) +GFXDECODE_END + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(acorn_vdu80_device::device_add_mconfig) + device = &SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_color(rgb_t::white()); + m_screen->set_raw(12_MHz_XTAL, 768, 132, 612, 312, 20, 270); + MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update) + + MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_acorn_vdu80) + MCFG_PALETTE_ADD_MONOCHROME("palette") + + H46505(config, m_crtc, 2_MHz_XTAL); + m_crtc->set_screen("screen"); + m_crtc->set_show_border_area(false); + m_crtc->set_char_width(6); + m_crtc->set_update_row_callback(FUNC(acorn_vdu80_device::crtc_update_row), this); +MACHINE_CONFIG_END + + +const tiny_rom_entry *acorn_vdu80_device::device_rom_region() const +{ + return ROM_NAME( vdu80 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_vdu80_device - constructor +//------------------------------------------------- + +acorn_vdu80_device::acorn_vdu80_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_VDU80, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_chargen(*this, "chargen") + , m_screen(*this, "screen") + , m_crtc(*this, "mc6845") + , m_palette(*this, "palette") + , m_links(*this, "LINKS") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_vdu80_device::device_start() +{ + /* allocate m_videoram */ + m_videoram = std::make_unique(0x0800); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void acorn_vdu80_device::device_reset() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + if (m_links->read() & 0x01) + { + space.install_ram(0xf000, 0x0f7ff, m_videoram.get()); + + space.install_readwrite_handler(0xe840, 0xe840, 0, 0x3f, 0, read8_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::address_w), m_crtc.target())); + space.install_readwrite_handler(0xe841, 0xe841, 0, 0x3e, 0, read8_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::register_w), m_crtc.target())); + } + else + { + space.install_ram(0x1000, 0x017ff, m_videoram.get()); + + space.install_readwrite_handler(0x1840, 0x1840, 0, 0x3f, 0, read8_delegate(FUNC(mc6845_device::status_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::address_w), m_crtc.target())); + space.install_readwrite_handler(0x1841, 0x1841, 0, 0x3e, 0, read8_delegate(FUNC(mc6845_device::register_r), m_crtc.target()), write8_delegate(FUNC(mc6845_device::register_w), m_crtc.target())); + } +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +MC6845_UPDATE_ROW(acorn_vdu80_device::crtc_update_row) +{ + uint8_t invert = BIT(m_links->read(), 1); + uint32_t *p = &bitmap.pix32(y); + + for (int column = 0; column < x_count; column++) + { + uint8_t code = m_videoram[(ma + column) & 0x7ff]; + uint16_t addr = (code << 4) | (ra & 0x0f); + uint8_t data = m_chargen->base()[addr & 0x7ff]; + + if (column == cursor_x) + { + data = 0xff; + } + + for (int bit = 0; bit < 6; bit++) + { + *p++ = m_palette->pen(BIT(data, 7) ^ invert); + + data <<= 1; + } + } +} diff --git a/src/devices/bus/acorn/system/vdu80.h b/src/devices/bus/acorn/system/vdu80.h new file mode 100644 index 00000000000..8ebb7e0a327 --- /dev/null +++ b/src/devices/bus/acorn/system/vdu80.h @@ -0,0 +1,61 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn 80x25 VDU Interface + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_80x25VDUIF.html + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_SYSTEM_VDU80_H +#define MAME_BUS_ACORN_SYSTEM_VDU80_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "video/mc6845.h" +#include "emupal.h" +#include "screen.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class acorn_vdu80_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + acorn_vdu80_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + virtual ioport_constructor device_input_ports() const override; + +private: + MC6845_UPDATE_ROW(crtc_update_row); + + required_memory_region m_chargen; + required_device m_screen; + required_device m_crtc; + required_device m_palette; + required_ioport m_links; + + std::unique_ptr m_videoram; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_VDU80, acorn_vdu80_device) + + +#endif // MAME_BUS_ACORN_SYSTEM_VDU80_H diff --git a/src/devices/bus/acorn/system/vib.cpp b/src/devices/bus/acorn/system/vib.cpp new file mode 100644 index 00000000000..c0d739fcbc4 --- /dev/null +++ b/src/devices/bus/acorn/system/vib.cpp @@ -0,0 +1,116 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Versatile Interface Board + + Part No. 200,009 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_UIB.html + +**********************************************************************/ + + +#include "emu.h" +#include "vib.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ACORN_VIB, acorn_vib_device, "acorn_vib", "Acorn Versatile Interface Board") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(acorn_vib_device::device_add_mconfig) + INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(FUNC(acorn_vib_device::irq_w)); + + VIA6522(config, m_via6522, XTAL(1'000'000)); + m_via6522->writepa_handler().set("cent_data_out", FUNC(output_latch_device::bus_w)); + m_via6522->ca2_handler().set(m_centronics, FUNC(centronics_device::write_strobe)); + m_via6522->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>)); + + CENTRONICS(config, m_centronics, centronics_devices, "printer"); + m_centronics->ack_handler().set(m_via6522, FUNC(via6522_device::write_ca1)); + m_centronics->busy_handler().set(m_via6522, FUNC(via6522_device::write_pa7)); + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + I8255(config, m_ppi8255, 0); + + ACIA6850(config, m_acia, 0); + m_acia->txd_handler().set(m_rs232, FUNC(rs232_port_device::write_txd)); + m_acia->rts_handler().set(m_rs232, FUNC(rs232_port_device::write_rts)); + m_acia->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>)); + + RS232_PORT(config, m_rs232, default_rs232_devices, nullptr); + m_rs232->rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd)); + m_rs232->cts_handler().set(m_acia, FUNC(acia6850_device::write_cts)); + m_rs232->dcd_handler().set(m_acia, FUNC(acia6850_device::write_dcd)); + + CLOCK(config, m_acia_clock, 1.8432_MHz_XTAL); + m_acia_clock->signal_handler().set(FUNC(acorn_vib_device::write_acia_clock)); +MACHINE_CONFIG_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// acorn_vib_device - constructor +//------------------------------------------------- + +acorn_vib_device::acorn_vib_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ACORN_VIB, tag, owner, clock) + , device_acorn_bus_interface(mconfig, *this) + , m_ppi8255(*this, "ppi8255") + , m_via6522(*this, "via6522") + , m_acia(*this, "acia6850") + , m_acia_clock(*this, "acia_clock") + , m_centronics(*this, "centronics") + , m_rs232(*this, "rs232") + , m_irqs(*this, "irqs") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void acorn_vib_device::device_start() +{ +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void acorn_vib_device::device_reset() +{ + set_acorn_bus_device(); + address_space &space = m_bus->memspace(); + + space.install_readwrite_handler(0x0c00, 0x0c0f, 0, 0x10, 0, read8_delegate(FUNC(via6522_device::read), m_via6522.target()), write8_delegate(FUNC(via6522_device::write), m_via6522.target())); + space.install_readwrite_handler(0x0c20, 0x0c21, 0, 0x1e, 0, read8_delegate(FUNC(acia6850_device::read), m_acia.target()), write8_delegate(FUNC(acia6850_device::write), m_acia.target())); + space.install_readwrite_handler(0x0c40, 0x0c43, 0, 0x1c, 0, read8_delegate(FUNC(i8255_device::read), m_ppi8255.target()), write8_delegate(FUNC(i8255_device::write), m_ppi8255.target())); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE_LINE_MEMBER(acorn_vib_device::write_acia_clock) +{ + m_acia->write_txc(state); + m_acia->write_rxc(state); +} + +WRITE_LINE_MEMBER(acorn_vib_device::irq_w) +{ + m_bus->irq_w(state); +} diff --git a/src/devices/bus/acorn/system/vib.h b/src/devices/bus/acorn/system/vib.h new file mode 100644 index 00000000000..d4d710a3256 --- /dev/null +++ b/src/devices/bus/acorn/system/vib.h @@ -0,0 +1,64 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Acorn Versatile Interface Board + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_UIB.html + +**********************************************************************/ + + +#ifndef MAME_BUS_ACORN_SYSTEM_VIB_H +#define MAME_BUS_ACORN_SYSTEM_VIB_H + +#pragma once + +#include "bus/acorn/bus.h" +#include "bus/centronics/ctronics.h" +#include "bus/rs232/rs232.h" +#include "machine/i8255.h" +#include "machine/6522via.h" +#include "machine/6850acia.h" +#include "machine/clock.h" +#include "machine/input_merger.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class acorn_vib_device : + public device_t, + public device_acorn_bus_interface +{ +public: + // construction/destruction + acorn_vib_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + DECLARE_WRITE_LINE_MEMBER(write_acia_clock); + DECLARE_WRITE_LINE_MEMBER(irq_w); + + required_device m_ppi8255; + required_device m_via6522; + required_device m_acia; + required_device m_acia_clock; + required_device m_centronics; + required_device m_rs232; + required_device m_irqs; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ACORN_VIB, acorn_vib_device) + + +#endif // MAME_BUS_ACORN_SYSTEM_VIB_H diff --git a/src/devices/bus/econet/econet.h b/src/devices/bus/econet/econet.h index 611d9aa49bf..cdaccc03a25 100644 --- a/src/devices/bus/econet/econet.h +++ b/src/devices/bus/econet/econet.h @@ -59,6 +59,8 @@ public: template devcb_base &set_clk_wr_callback(Object &&cb) { return m_write_clk.set_callback(std::forward(cb)); } template devcb_base &set_data_wr_callback(Object &&cb) { return m_write_data.set_callback(std::forward(cb)); } + auto clk_wr_callback() { return m_write_clk.bind(); } + auto data_wr_callback() { return m_write_data.bind(); } void add_device(device_t *target, int address); diff --git a/src/devices/machine/i8271.h b/src/devices/machine/i8271.h index 32d70b507a0..6c413081d69 100644 --- a/src/devices/machine/i8271.h +++ b/src/devices/machine/i8271.h @@ -33,6 +33,10 @@ public: template devcb_base &set_drq_wr_callback(Object &&cb) { return drq_cb.set_callback(std::forward(cb)); } template devcb_base &set_hdl_wr_callback(Object &&cb) { return hdl_cb.set_callback(std::forward(cb)); } template devcb_base &set_opt_wr_callback(Object &&cb) { return opt_cb.set_callback(std::forward(cb)); } + auto intrq_wr_callback() { return intrq_cb.bind(); } + auto drq_wr_callback() { return drq_cb.bind(); } + auto hdl_wr_callback() { return hdl_cb.bind(); } + auto opt_wr_callback() { return opt_cb.bind(); } DECLARE_READ8_MEMBER (data_r); DECLARE_WRITE8_MEMBER(data_w); -- cgit v1.2.3