From b4ecb617be43c3d6b1a60fb9c49e9cc4a5107e26 Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Fri, 7 Oct 2022 09:05:28 -0400 Subject: bus/epson_qx: Added hard disk support for the Epson QX-10. (#10378) * Added IDE hard disk option board. * Added ComFiler CR-1510 option board. --- scripts/src/bus.lua | 4 ++ src/devices/bus/epson_qx/cr1510.cpp | 62 +++++++++++++++++++ src/devices/bus/epson_qx/cr1510.h | 50 ++++++++++++++++ src/devices/bus/epson_qx/ide.cpp | 115 ++++++++++++++++++++++++++++++++++++ src/devices/bus/epson_qx/ide.h | 58 ++++++++++++++++++ src/devices/bus/epson_qx/option.cpp | 5 ++ 6 files changed, 294 insertions(+) create mode 100644 src/devices/bus/epson_qx/cr1510.cpp create mode 100644 src/devices/bus/epson_qx/cr1510.h create mode 100644 src/devices/bus/epson_qx/ide.cpp create mode 100644 src/devices/bus/epson_qx/ide.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 4fabd53ea76..b9ec930f2cb 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -3906,6 +3906,10 @@ end --------------------------------------------------- if (BUSES["EPSON_QX"]~=null) then files { + MAME_DIR .. "src/devices/bus/epson_qx/cr1510.cpp", + MAME_DIR .. "src/devices/bus/epson_qx/cr1510.h", + MAME_DIR .. "src/devices/bus/epson_qx/ide.cpp", + MAME_DIR .. "src/devices/bus/epson_qx/ide.h", MAME_DIR .. "src/devices/bus/epson_qx/multifont.cpp", MAME_DIR .. "src/devices/bus/epson_qx/multifont.h", MAME_DIR .. "src/devices/bus/epson_qx/option.cpp", diff --git a/src/devices/bus/epson_qx/cr1510.cpp b/src/devices/bus/epson_qx/cr1510.cpp new file mode 100644 index 00000000000..3506597a86e --- /dev/null +++ b/src/devices/bus/epson_qx/cr1510.cpp @@ -0,0 +1,62 @@ +// license:BSD-3-Clause +// copyright-holders:Brian Johnson +/******************************************************************* + * + * Comrex ComFiler CR-1510 Card + * + *******************************************************************/ + +#include "emu.h" +#include "cr1510.h" + + +//************************************************************************** +// EPSON CR-1510 DEVICE +//************************************************************************** + +DEFINE_DEVICE_TYPE(EPSON_QX_OPTION_CR1510, bus::epson_qx::cr1510_device, "epson_qx_option_cr1510", "Comrex ComFiler CR-1510") + +namespace bus::epson_qx { + +//------------------------------------------------- +// cr1510_device - constructor +//------------------------------------------------- +cr1510_device::cr1510_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, EPSON_QX_OPTION_CR1510, tag, owner, clock), + device_option_expansion_interface(mconfig, *this), + m_hdd(*this, "hdd") +{ +} + +//------------------------------------------------- +// device_add_mconfig - device-specific config +//------------------------------------------------- +void cr1510_device::device_add_mconfig(machine_config &config) +{ + WD1000(config, m_hdd, 0); + + HARDDISK(config, "hdd:0", 0); +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- +void cr1510_device::device_start() +{ + address_space &space = m_bus->iospace(); + space.install_device(0x80, 0x87, *this, &cr1510_device::map); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- +void cr1510_device::device_reset() +{ +} + +void cr1510_device::map(address_map &map) +{ + map(0x00, 0x07).rw(m_hdd, FUNC(wd1000_device::read), FUNC(wd1000_device::write)); +} + +} // namespace bus::epson_qx diff --git a/src/devices/bus/epson_qx/cr1510.h b/src/devices/bus/epson_qx/cr1510.h new file mode 100644 index 00000000000..6078d536880 --- /dev/null +++ b/src/devices/bus/epson_qx/cr1510.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Brian Johnson +/******************************************************************* + * + * ComFiler CR-1510 Card + * + *******************************************************************/ + +#ifndef MAME_BUS_EPSON_QX_CR1510_H +#define MAME_BUS_EPSON_QX_CR1510_H + +#pragma once + +#include "option.h" + +#include "machine/wd1000.h" + +namespace bus::epson_qx { + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +/* Epson CR-1510 Device */ + +class cr1510_device : public device_t, public bus::epson_qx::device_option_expansion_interface +{ +public: + // construction/destruction + cr1510_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; + + void map(address_map &map); +private: + required_device m_hdd; +}; + +} // namespace bus::epson_qx + +// device type definition +DECLARE_DEVICE_TYPE_NS(EPSON_QX_OPTION_CR1510, bus::epson_qx, cr1510_device) + +#endif // MAME_BUS_EPSON_QX_CR1510_H diff --git a/src/devices/bus/epson_qx/ide.cpp b/src/devices/bus/epson_qx/ide.cpp new file mode 100644 index 00000000000..80c613bf87d --- /dev/null +++ b/src/devices/bus/epson_qx/ide.cpp @@ -0,0 +1,115 @@ +// license:BSD-3-Clause +// copyright-holders:Brian Johnson +/******************************************************************* + * + * IDE Compact Flash Adapter + * + * This implements a Compact flash adapter expansion card for QX-10 + * systems. The boot disk necessary to support this card is listed below. + * + * Disk Image: https://github.com/brijohn/qx10/raw/master/diskimages/qx10cf.imd + * Board Design: https://github.com/brijohn/qx10/tree/master/kicad/cf_adapter + * + *******************************************************************/ + +#include "emu.h" +#include "ide.h" + + +//************************************************************************** +// EPSON IDE DEVICE +//************************************************************************** + +DEFINE_DEVICE_TYPE(EPSON_QX_OPTION_IDE, bus::epson_qx::ide_device, "epson_qx_option_ide", "Epson QX-10 Compact Flash Adapter") + +namespace bus::epson_qx { + +static INPUT_PORTS_START( ide ) + PORT_START("IOBASE") + PORT_CONFNAME(0xf0, 0xd0, "IO Base Address Selection") + PORT_CONFSETTING(0x80, "&80") + PORT_CONFSETTING(0x90, "&90") + PORT_CONFSETTING(0xa0, "&A0") + PORT_CONFSETTING(0xb0, "&B0") + PORT_CONFSETTING(0xc0, "&C0") + PORT_CONFSETTING(0xd0, "&D0") + PORT_CONFSETTING(0xe0, "&E0") + PORT_CONFSETTING(0xf0, "&F0") +INPUT_PORTS_END + +//------------------------------------------------- +// ide_device - constructor +//------------------------------------------------- +ide_device::ide_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, EPSON_QX_OPTION_IDE, tag, owner, clock), + device_option_expansion_interface(mconfig, *this), + m_hdd(*this, "hdd"), + m_iobase(*this, "IOBASE"), + m_installed(false) +{ +} + +//------------------------------------------------- +// device_input_ports - device-specific ports +//------------------------------------------------- +ioport_constructor ide_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( ide ); +} + +//------------------------------------------------- +// device_add_mconfig - device-specific config +//------------------------------------------------- +void ide_device::device_add_mconfig(machine_config &config) +{ + IDE_HARDDISK(config, m_hdd, 0); +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- +void ide_device::device_start() +{ + m_installed = false; + + save_item(NAME(m_installed)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- +void ide_device::device_reset() +{ + if (!m_installed) { + address_space &space = m_bus->iospace(); + offs_t iobase = m_iobase->read() & 0xf0; + space.install_device(iobase, iobase+0x0f, *this, &ide_device::map); + m_installed = true; + } +} + +uint8_t ide_device::read(offs_t offset) +{ + if (offset < 8) { + return m_hdd->read_cs0(offset); + } else if (offset == 14 || offset == 15) { + return m_hdd->read_cs1(offset & 7); + } + return 0xff; +} + +void ide_device::write(offs_t offset, uint8_t data) +{ + if (offset < 8) { + m_hdd->write_cs0(offset, data); + } else if (offset == 14) { + m_hdd->write_cs1(offset & 7, data); + } +} + +void ide_device::map(address_map &map) +{ + map(0x00, 0x0f).rw(FUNC(ide_device::read), FUNC(ide_device::write)); +} + +} // namespace bus::epson_qx diff --git a/src/devices/bus/epson_qx/ide.h b/src/devices/bus/epson_qx/ide.h new file mode 100644 index 00000000000..3bc61b333ca --- /dev/null +++ b/src/devices/bus/epson_qx/ide.h @@ -0,0 +1,58 @@ +// license:BSD-3-Clause +// copyright-holders:Brian Johnson +/******************************************************************* + * + * IDE Compact Flash Adapter + * + *******************************************************************/ + +#ifndef MAME_BUS_EPSON_QX_IDE_H +#define MAME_BUS_EPSON_QX_IDE_H + +#pragma once + +#include "option.h" + +#include "bus/ata/idehd.h" + +namespace bus::epson_qx { + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +/* Epson IDE Device */ + +class ide_device : public device_t, public bus::epson_qx::device_option_expansion_interface +{ +public: + // construction/destruction + ide_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; + + uint8_t read(offs_t offset); + void write(offs_t offset, uint8_t data); + + void map(address_map &map); + +private: + required_device m_hdd; + required_ioport m_iobase; + + bool m_installed; +}; + +} // namespace bus::epson_qx + +// device type definition +DECLARE_DEVICE_TYPE_NS(EPSON_QX_OPTION_IDE, bus::epson_qx, ide_device) + +#endif // MAME_BUS_EPSON_QX_IDE_H diff --git a/src/devices/bus/epson_qx/option.cpp b/src/devices/bus/epson_qx/option.cpp index 8caf042cc36..89d85c32a9f 100644 --- a/src/devices/bus/epson_qx/option.cpp +++ b/src/devices/bus/epson_qx/option.cpp @@ -7,6 +7,9 @@ *******************************************************************/ #include "emu.h" #include "option.h" + +#include "cr1510.h" +#include "ide.h" #include "multifont.h" DEFINE_DEVICE_TYPE(EPSON_QX_OPTION_BUS_SLOT, bus::epson_qx::option_slot_device, "epson_qx_option_slot", "QX-10 Option slot") @@ -206,6 +209,8 @@ void device_option_expansion_interface::interface_pre_start() void option_bus_devices(device_slot_interface &device) { + device.option_add("cr1510", EPSON_QX_OPTION_CR1510); + device.option_add("ide", EPSON_QX_OPTION_IDE); device.option_add("multifont", EPSON_QX_OPTION_MULTIFONT); } -- cgit v1.2.3