From 5b46a3b8ab50cc3937d91c55009000774aa64ee9 Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Fri, 3 Jan 2020 14:02:47 +0000 Subject: [PATCH] bus/bbc/1mhzbus: Added Sprow BeebIDE 16-bit and RetroClinic BBC 8-bit IDE interfaces. --- scripts/src/bus.lua | 2 + src/devices/bus/bbc/1mhzbus/1mhzbus.cpp | 5 + src/devices/bus/bbc/1mhzbus/ide.cpp | 191 ++++++++++++++++++++++++ src/devices/bus/bbc/1mhzbus/ide.h | 82 ++++++++++ 4 files changed, 280 insertions(+) create mode 100644 src/devices/bus/bbc/1mhzbus/ide.cpp create mode 100644 src/devices/bus/bbc/1mhzbus/ide.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 3f645f4d1b5..1a9fb3d0fd8 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -473,6 +473,8 @@ if (BUSES["BBC_1MHZBUS"]~=null) then MAME_DIR .. "src/devices/bus/bbc/1mhzbus/beebsid.h", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/emrmidi.cpp", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/emrmidi.h", + MAME_DIR .. "src/devices/bus/bbc/1mhzbus/ide.cpp", + MAME_DIR .. "src/devices/bus/bbc/1mhzbus/ide.h", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/ieee488.cpp", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/ieee488.h", MAME_DIR .. "src/devices/bus/bbc/1mhzbus/m2000.cpp", diff --git a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp index 3acebb1215b..6eb6c623769 100644 --- a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp +++ b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp @@ -112,6 +112,7 @@ void bbc_1mhzbus_slot_device::jim_w(offs_t offset, uint8_t data) //#include "teletext.h" //#include "digitiser.h" #include "emrmidi.h" +#include "ide.h" #include "ieee488.h" #include "m2000.h" //#include "m5000.h" @@ -135,6 +136,8 @@ void bbc_1mhzbus_devices(device_slot_interface &device) //device.option_add("m500", BBC_M500); /* Acorn ANV02 Music 500 */ //device.option_add("awdd", BBC_AWDD); /* Acorn Winchester 110/130 */ device.option_add("autoprom", BBC_AUTOPROM); /* ATPL AutoPrommer */ + device.option_add("beebide", BBC_BEEBIDE); /* Sprow BeebIDE 16-bit */ + device.option_add("ide8", BBC_IDE8); /* RetroClinic BBC 8-bit IDE */ //device.option_add("beebscan", BBC_BEEBSCAN); /* Beeb HandScan */ device.option_add("b488", BBC_B488); /* Aries B488 */ //device.option_add("videodig", BBC_VIDEODIG); /* Video Digitiser (RH Electronics) */ @@ -158,6 +161,8 @@ void bbcm_1mhzbus_devices(device_slot_interface &device) device.option_add("ieee488", BBC_IEEE488); /* Acorn ANK01 IEEE488 Interface */ //device.option_add("m500", BBC_M500); /* Acorn ANV02 Music 500 */ //device.option_add("awdd", BBC_AWDD); /* Acorn Winchester 110/130 */ + device.option_add("beebide", BBC_BEEBIDE); /* Sprow BeebIDE 16-bit */ + device.option_add("ide8", BBC_IDE8); /* RetroClinic BBC 8-bit IDE */ device.option_add("b488", BBC_B488); /* Aries B488 */ //device.option_add("videodig", BBC_VIDEODIG); /* Video Digitiser (RH Electronics) */ device.option_add("emrmidi", BBC_EMRMIDI); /* EMR Midi Interface */ diff --git a/src/devices/bus/bbc/1mhzbus/ide.cpp b/src/devices/bus/bbc/1mhzbus/ide.cpp new file mode 100644 index 00000000000..90b7d33f5f6 --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/ide.cpp @@ -0,0 +1,191 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + RetroClinic BBC 8-bit IDE Interface + + http://www.retroclinic.com/acorn/bbcide/bbcide.htm + + Sprow BeebIDE 16-bit IDE Interface for the BBC series + + http://www.sprow.co.uk/bbc/beebide.htm + +**********************************************************************/ + + +#include "emu.h" +#include "ide.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(BBC_IDE8, bbc_ide8_device, "bbc_ide8", "RetroClinic BBC 8-bit IDE Interface"); +DEFINE_DEVICE_TYPE(BBC_BEEBIDE, bbc_beebide_device, "bbc_beebide", "Sprow BeebIDE 16-bit IDE Interface"); + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void bbc_ide8_device::device_add_mconfig(machine_config& config) +{ + ATA_INTERFACE(config, m_ide).options(ata_devices, "hdd", nullptr, false); + m_ide->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w)); +} + +void bbc_beebide_device::device_add_mconfig(machine_config& config) +{ + ATA_INTERFACE(config, m_ide).options(ata_devices, "hdd", nullptr, false); + m_ide->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w)); + + BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 1), bbc_1mhzbus_devices, nullptr); + m_1mhzbus->irq_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::irq_w)); + m_1mhzbus->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(bbc_1mhzbus_slot_device::nmi_w)); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// bbc_ide_device - constructor +//------------------------------------------------- + +bbc_ide8_device::bbc_ide8_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) + : device_t(mconfig, BBC_IDE8, tag, owner, clock) + , device_bbc_1mhzbus_interface(mconfig, *this) + , m_ide(*this, "ide") +{ +} + +bbc_beebide_device::bbc_beebide_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) + : device_t(mconfig, BBC_BEEBIDE, tag, owner, clock) + , device_bbc_1mhzbus_interface(mconfig, *this) + , m_ide(*this, "ide") + , m_1mhzbus(*this, "1mhzbus") + , m_ide_data(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bbc_beebide_device::device_start() +{ + save_item(NAME(m_ide_data)); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t bbc_ide8_device::fred_r(offs_t offset) +{ + uint8_t data = 0xff; + + switch (offset & 0xf8) + { + case 0x40: + data = m_ide->read_cs0(offset & 0x07, 0xff); + break; + case 0x48: + data = m_ide->read_cs1(offset & 0x07, 0xff); + break; + } + + return data; +} + +void bbc_ide8_device::fred_w(offs_t offset, uint8_t data) +{ + switch (offset & 0xf8) + { + case 0x40: + m_ide->write_cs0(offset & 0x07, data, 0xff); + break; + case 0x48: + m_ide->write_cs1(offset & 0x07, data, 0xff); + break; + } +} + + +uint8_t bbc_beebide_device::fred_r(offs_t offset) +{ + uint8_t data = 0xff; + + switch (offset & 0xf8) + { + case 0x40: + if (offset == 0x40) + { + m_ide_data = m_ide->read_cs0(offset & 0x07); + data = m_ide_data & 0x00ff; + } + else + { + data = m_ide->read_cs0(offset & 0x07); + } + break; + case 0x48: + if (offset & 0x04) + { + data = m_ide->read_cs1(offset & 0x07); + } + else + { + data = m_ide_data >> 8; + } + break; + } + + data &= m_1mhzbus->fred_r(offset); + + return data; +} + +void bbc_beebide_device::fred_w(offs_t offset, uint8_t data) +{ + switch (offset & 0xf8) + { + case 0x40: + if (offset == 0x40) + { + m_ide_data = (m_ide_data & 0xff00) | data; + m_ide->write_cs0(offset & 0x07, m_ide_data); + } + else + { + m_ide->write_cs0(offset & 0x07, data); + } + break; + case 0x48: + if (offset & 0x04) + { + m_ide->write_cs1(offset & 0x07, data); + } + else + { + m_ide_data = data << 8; + } + break; + } + + m_1mhzbus->fred_w(offset, data); +} + +uint8_t bbc_beebide_device::jim_r(offs_t offset) +{ + return m_1mhzbus->jim_r(offset); +} + +void bbc_beebide_device::jim_w(offs_t offset, uint8_t data) +{ + m_1mhzbus->jim_w(offset, data); +} diff --git a/src/devices/bus/bbc/1mhzbus/ide.h b/src/devices/bus/bbc/1mhzbus/ide.h new file mode 100644 index 00000000000..cd90dab4de1 --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/ide.h @@ -0,0 +1,82 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + RetroClinic BBC 8-bit IDE Interface + + http://www.retroclinic.com/acorn/bbcide/bbcide.htm + + Sprow BeebIDE 16-bit IDE Interface for the BBC series + + http://www.sprow.co.uk/bbc/beebide.htm + +**********************************************************************/ + + +#ifndef MAME_BUS_BBC_1MHZBUS_IDE_H +#define MAME_BUS_BBC_1MHZBUS_IDE_H + +#include "1mhzbus.h" +#include "bus/ata/ataintf.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class bbc_ide8_device : + public device_t, + public device_bbc_1mhzbus_interface +{ +public: + // construction/destruction + bbc_ide8_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; + + virtual uint8_t fred_r(offs_t offset) override; + virtual void fred_w(offs_t offset, uint8_t data) override; + +private: + required_device m_ide; +}; + + +class bbc_beebide_device : + public device_t, + public device_bbc_1mhzbus_interface +{ +public: + // construction/destruction + bbc_beebide_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; + + virtual uint8_t fred_r(offs_t offset) override; + virtual void fred_w(offs_t offset, uint8_t data) override; + virtual uint8_t jim_r(offs_t offset) override; + virtual void jim_w(offs_t offset, uint8_t data) override; + +private: + required_device m_ide; + required_device m_1mhzbus; + + uint16_t m_ide_data; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(BBC_IDE8, bbc_ide8_device); +DECLARE_DEVICE_TYPE(BBC_BEEBIDE, bbc_beebide_device); + + +#endif /* MAME_BUS_BBC_1MHZBUS_IDE_H */