From 91da52721edb64a257962ff4d11550051c2633ed Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Wed, 31 Jan 2018 18:29:49 +0000 Subject: [PATCH] electron: Added cartridge devices for: - P.R.E.S. Advanced Plus 3/4 - Advanced Quarter Meg Ram - Cumana Floppy Disk System - Sound Expansion - Sound Expansion v3 - Stop Press 64 - Solidisk EFS New working software list additions ----------------------------------- electron_cart: Solidisk EFS 2.1E New NOT_WORKING software list additions --------------------------------------- electron_cart: Stop Press 64 Software list items promoted to working --------------------------------------- electron_cart: Advanced Plus 3, Advanced Quarter Meg RAM, Slogger Electron Disk System, Sound Expansion v3 --- hash/electron_cart.xml | 82 ++++++--- scripts/src/bus.lua | 14 ++ src/devices/bus/electron/cart/ap34.cpp | 173 +++++++++++++++++++ src/devices/bus/electron/cart/ap34.h | 55 ++++++ src/devices/bus/electron/cart/aqr.cpp | 95 +++++++++++ src/devices/bus/electron/cart/aqr.h | 46 +++++ src/devices/bus/electron/cart/cumana.cpp | 195 ++++++++++++++++++++++ src/devices/bus/electron/cart/cumana.h | 57 +++++++ src/devices/bus/electron/cart/peg400.cpp | 29 ++-- src/devices/bus/electron/cart/peg400.h | 3 +- src/devices/bus/electron/cart/slot.cpp | 20 ++- src/devices/bus/electron/cart/sndexp.cpp | 167 ++++++++++++++++++ src/devices/bus/electron/cart/sndexp.h | 52 ++++++ src/devices/bus/electron/cart/sndexp3.cpp | 113 +++++++++++++ src/devices/bus/electron/cart/sndexp3.h | 50 ++++++ src/devices/bus/electron/cart/sp64.cpp | 113 +++++++++++++ src/devices/bus/electron/cart/sp64.h | 46 +++++ src/devices/bus/electron/cart/stlefs.cpp | 172 +++++++++++++++++++ src/devices/bus/electron/cart/stlefs.h | 57 +++++++ src/devices/bus/electron/plus1.cpp | 119 +++++++------ src/devices/bus/electron/romboxp.cpp | 107 ++++++------ 21 files changed, 1617 insertions(+), 148 deletions(-) create mode 100644 src/devices/bus/electron/cart/ap34.cpp create mode 100644 src/devices/bus/electron/cart/ap34.h create mode 100644 src/devices/bus/electron/cart/aqr.cpp create mode 100644 src/devices/bus/electron/cart/aqr.h create mode 100644 src/devices/bus/electron/cart/cumana.cpp create mode 100644 src/devices/bus/electron/cart/cumana.h create mode 100644 src/devices/bus/electron/cart/sndexp.cpp create mode 100644 src/devices/bus/electron/cart/sndexp.h create mode 100644 src/devices/bus/electron/cart/sndexp3.cpp create mode 100644 src/devices/bus/electron/cart/sndexp3.h create mode 100644 src/devices/bus/electron/cart/sp64.cpp create mode 100644 src/devices/bus/electron/cart/sp64.h create mode 100644 src/devices/bus/electron/cart/stlefs.cpp create mode 100644 src/devices/bus/electron/cart/stlefs.h diff --git a/hash/electron_cart.xml b/hash/electron_cart.xml index 3158f6e4f65..a91648f0d06 100644 --- a/hash/electron_cart.xml +++ b/hash/electron_cart.xml @@ -254,6 +254,20 @@ + + Stop Press 64 + 1991 + Slogger + + + + + + + + + + View 1984 @@ -283,7 +297,7 @@ Advanced Battery-Backed RAM 1987 - P.R.E.S. + Advanced Computer Products @@ -292,9 +306,9 @@ - + Advanced Plus 3 - 1988 + 1987 P.R.E.S. @@ -317,8 +331,8 @@ - - Advanced Plus 34 + + Advanced Plus 3/4 1988 P.R.E.S. @@ -333,51 +347,52 @@ - + Advanced Quarter Meg RAM - 1988 - P.R.E.S. + 1987 + Advanced Computer Products + - + Cumana Floppy Disc System v1.00 - 1984 + 1985 Cumana - + - + Cumana Floppy Disc System v1.01 - 1984 + 1985 Cumana - + - + Cumana Floppy Disc System v1.02 - 1984 + 1985 Cumana - + @@ -407,7 +422,7 @@ - + Slogger Electron Disk System v1.00 1986 Slogger @@ -416,11 +431,11 @@ - + - + Slogger Electron Disk System v1.02 1986 Slogger @@ -429,11 +444,11 @@ - + - + Slogger Electron Disk System v1.03 1986 Slogger @@ -442,29 +457,46 @@ - + + + + + + Solidisk EFS 2.1E + 1985 + Solidisk + + + + + + - Sound Expansion v1 + Sound Expansion 1988 Project Expansions + + - + Sound Expansion v3 1989 Complex Software Systems + + diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 24e8efb6c06..b9864626a51 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -749,12 +749,26 @@ if (BUSES["ELECTRON_CART"]~=null) then MAME_DIR .. "src/devices/bus/electron/cart/slot.h", MAME_DIR .. "src/devices/bus/electron/cart/abr.cpp", MAME_DIR .. "src/devices/bus/electron/cart/abr.h", + MAME_DIR .. "src/devices/bus/electron/cart/ap34.cpp", + MAME_DIR .. "src/devices/bus/electron/cart/ap34.h", + MAME_DIR .. "src/devices/bus/electron/cart/aqr.cpp", + MAME_DIR .. "src/devices/bus/electron/cart/aqr.h", MAME_DIR .. "src/devices/bus/electron/cart/click.cpp", MAME_DIR .. "src/devices/bus/electron/cart/click.h", + MAME_DIR .. "src/devices/bus/electron/cart/cumana.cpp", + MAME_DIR .. "src/devices/bus/electron/cart/cumana.h", MAME_DIR .. "src/devices/bus/electron/cart/peg400.cpp", MAME_DIR .. "src/devices/bus/electron/cart/peg400.h", + MAME_DIR .. "src/devices/bus/electron/cart/sndexp.cpp", + MAME_DIR .. "src/devices/bus/electron/cart/sndexp.h", + MAME_DIR .. "src/devices/bus/electron/cart/sndexp3.cpp", + MAME_DIR .. "src/devices/bus/electron/cart/sndexp3.h", + MAME_DIR .. "src/devices/bus/electron/cart/sp64.cpp", + MAME_DIR .. "src/devices/bus/electron/cart/sp64.h", MAME_DIR .. "src/devices/bus/electron/cart/std.cpp", MAME_DIR .. "src/devices/bus/electron/cart/std.h", + MAME_DIR .. "src/devices/bus/electron/cart/stlefs.cpp", + MAME_DIR .. "src/devices/bus/electron/cart/stlefs.h", } end diff --git a/src/devices/bus/electron/cart/ap34.cpp b/src/devices/bus/electron/cart/ap34.cpp new file mode 100644 index 00000000000..d22fd885c04 --- /dev/null +++ b/src/devices/bus/electron/cart/ap34.cpp @@ -0,0 +1,173 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + P.R.E.S. Advanced Plus3/4 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/PRES_AP3A.html + + TODO: + - AP4 (DFS) is unreliable, maybe WD1770 reset issue to be investigated + - add spare ROM slot in AP3 and AP4, not AP3/4 + +**********************************************************************/ + + +#include "emu.h" +#include "ap34.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ELECTRON_AP34, electron_ap34_device, "electron_ap34", "P.R.E.S. Advanced Plus 3/4") + + +//------------------------------------------------- +// MACHINE_DRIVER( ap34 ) +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER(electron_ap34_device::floppy_formats) + FLOPPY_ACORN_SSD_FORMAT, + FLOPPY_ACORN_DSD_FORMAT, + FLOPPY_ACORN_ADFS_OLD_FORMAT +FLOPPY_FORMATS_END0 + +SLOT_INTERFACE_START(ap34_floppies) + SLOT_INTERFACE("35dd", FLOPPY_35_DD) + SLOT_INTERFACE("525qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(electron_ap34_device::device_add_mconfig) + /* fdc */ + MCFG_WD1770_ADD("fdc", 16_MHz_XTAL / 2) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", ap34_floppies, "525qd", electron_ap34_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", ap34_floppies, nullptr, electron_ap34_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_ap34_device - constructor +//------------------------------------------------- + +electron_ap34_device::electron_ap34_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ELECTRON_AP34, tag, owner, clock) + , device_electron_cart_interface(mconfig, *this) + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_ap34_device::device_start() +{ +} + +//------------------------------------------------- +// read - cartridge data read +//------------------------------------------------- + +uint8_t electron_ap34_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa) +{ + uint8_t data = 0xfe; + + if (infc) + { + switch (offset & 0xff) + { + case 0xc4: + case 0xc5: + case 0xc6: + case 0xc7: + data = m_fdc->read(space, offset & 0x03); + break; + } + } + + if (!infc && !infd) + { + if (offset >= 0x0000 && offset < 0x4000) + { + data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)]; + } + + if (m_ram.size() != 0 && romqa == 0 && offset >= 0x3000) + { + data = m_ram[offset & 0x0fff]; + } + } + + return data; +} + +//------------------------------------------------- +// write - cartridge data write +//------------------------------------------------- + +void electron_ap34_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) +{ + if (infc) + { + switch (offset & 0xff) + { + case 0xc0: + wd1770_control_w(space, 0, data); + break; + case 0xc4: + case 0xc5: + case 0xc6: + case 0xc7: + m_fdc->write(space, offset & 0x03, data); + break; + } + } + + if (!infc && !infd) + { + if (m_ram.size() != 0 && romqa == 0 && offset >= 0x3000) + { + m_ram[offset & 0x0fff] = data; + } + } +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE8_MEMBER(electron_ap34_device::wd1770_control_w) +{ + floppy_image_device *floppy = nullptr; + + // bit 0, 1: drive select + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + m_fdc->set_floppy(floppy); + + // bit 2: side select + if (floppy) + floppy->ss_w(BIT(data, 2)); + + // bit 3: density + m_fdc->dden_w(BIT(data, 3)); + + // bit 4: NMI - not connected + + // bit 5: reset + if (!BIT(data, 5)) m_fdc->soft_reset(); +} diff --git a/src/devices/bus/electron/cart/ap34.h b/src/devices/bus/electron/cart/ap34.h new file mode 100644 index 00000000000..e75ff07fed5 --- /dev/null +++ b/src/devices/bus/electron/cart/ap34.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + P.R.E.S. Advanced Plus3/4 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/PRES_AP3A.html + +**********************************************************************/ + +#ifndef MAME_BUS_ELECTRON_CART_AP34_H +#define MAME_BUS_ELECTRON_CART_AP34_H + +#include "slot.h" +#include "machine/wd_fdc.h" +#include "formats/acorn_dsk.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class electron_ap34_device : + public device_t, + public device_electron_cart_interface +{ +public: + // construction/destruction + electron_ap34_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; + + // electron_cart_interface overrides + virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override; + virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override; + +private: + DECLARE_WRITE8_MEMBER(wd1770_control_w); + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ELECTRON_AP34, electron_ap34_device) + + +#endif // MAME_BUS_ELECTRON_CART_AP34_H diff --git a/src/devices/bus/electron/cart/aqr.cpp b/src/devices/bus/electron/cart/aqr.cpp new file mode 100644 index 00000000000..117f8e0290f --- /dev/null +++ b/src/devices/bus/electron/cart/aqr.cpp @@ -0,0 +1,95 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Advanced Quarter Meg Ram + +***************************************************************************/ + +#include "emu.h" +#include "aqr.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ELECTRON_AQR, electron_aqr_device, "electron_aqr", "Electron Advanced Quarter Meg Ram cartridge") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_aqr_device - constructor +//------------------------------------------------- + +electron_aqr_device::electron_aqr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ELECTRON_AQR, tag, owner, clock) + , device_electron_cart_interface(mconfig, *this) + , m_page_register(0) + , m_lock_register(false) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_aqr_device::device_start() +{ + save_item(NAME(m_page_register)); + save_item(NAME(m_lock_register)); +} + + +//------------------------------------------------- +// read - cartridge data read +//------------------------------------------------- + +uint8_t electron_aqr_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa) +{ + uint8_t data = 0xff; + + if (!infc && !infd) + { + if (offset >= 0x0000 && offset < 0x4000) + { + data = m_ram[(offset & 0x3fff) + (m_page_register * 0x4000)]; + } + } + + return data; +} + +//------------------------------------------------- +// write - cartridge data write +//------------------------------------------------- + +void electron_aqr_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) +{ + if (infc) + { + switch (offset & 0xff) + { + case 0xfc: + m_page_register = data; + break; + case 0xfd: + m_lock_register = false; + break; + case 0xfe: + m_lock_register = true; + break; + } + } + + if (!infc && !infd) + { + if (offset >= 0x0000 && offset < 0x4000 && !m_lock_register) + { + m_ram[(offset & 0x3fff) + (m_page_register * 0x4000)] = data; + } + } +} diff --git a/src/devices/bus/electron/cart/aqr.h b/src/devices/bus/electron/cart/aqr.h new file mode 100644 index 00000000000..6ede0b8144d --- /dev/null +++ b/src/devices/bus/electron/cart/aqr.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Advanced Quarter Meg Ram + +***************************************************************************/ + +#ifndef MAME_BUS_ELECTRON_CART_AQR_H +#define MAME_BUS_ELECTRON_CART_AQR_H + +#pragma once + +#include "slot.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> electron_aqr_device + +class electron_aqr_device : public device_t, + public device_electron_cart_interface +{ +public: + // construction/destruction + electron_aqr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // electron_cart_interface overrides + virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override; + virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override; + +private: + uint8_t m_page_register; + bool m_lock_register; +}; + +// device type definition +DECLARE_DEVICE_TYPE(ELECTRON_AQR, electron_aqr_device) + +#endif // MAME_BUS_ELECTRON_CART_AQR_H diff --git a/src/devices/bus/electron/cart/cumana.cpp b/src/devices/bus/electron/cart/cumana.cpp new file mode 100644 index 00000000000..ef184695f9f --- /dev/null +++ b/src/devices/bus/electron/cart/cumana.cpp @@ -0,0 +1,195 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Cumana Floppy Disk System + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Cumana_FDsystem.html + + TODO: + - add floppy format CDFS, and find original utilities disc + - confirm whether DRQ and INTRQ are connected + - add spare ROM slot + +**********************************************************************/ + + +#include "emu.h" +#include "cumana.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ELECTRON_CUMANA, electron_cumana_device, "electron_cumana", "Cumana Floppy Disk System") + + +//------------------------------------------------- +// MACHINE_DRIVER( cumana ) +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER(electron_cumana_device::floppy_formats) + FLOPPY_ACORN_SSD_FORMAT, + FLOPPY_ACORN_DSD_FORMAT, + FLOPPY_ACORN_ADFS_OLD_FORMAT +FLOPPY_FORMATS_END0 + +SLOT_INTERFACE_START(cumana_floppies) + SLOT_INTERFACE("35dd", FLOPPY_35_DD) + SLOT_INTERFACE("525qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(electron_cumana_device::device_add_mconfig) + /* fdc */ + MCFG_FD1793_ADD("fdc", 16_MHz_XTAL / 16) // TODO: Not known whether DRQ and INTRQ are connected + MCFG_FLOPPY_DRIVE_ADD("fdc:0", cumana_floppies, "525qd", electron_cumana_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", cumana_floppies, nullptr, electron_cumana_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + /* rtc */ + MCFG_MC146818_ADD("rtc", 32.768_kHz_XTAL) +MACHINE_CONFIG_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_cumana_device - constructor +//------------------------------------------------- + +electron_cumana_device::electron_cumana_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ELECTRON_CUMANA, tag, owner, clock) + , device_electron_cart_interface(mconfig, *this) + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") + , m_rtc(*this, "rtc") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_cumana_device::device_start() +{ +} + +//------------------------------------------------- +// read - cartridge data read +//------------------------------------------------- + +uint8_t electron_cumana_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa) +{ + uint8_t data = 0xff; + + if (infc) + { + switch (offset & 0xff) + { + case 0x90: + case 0x91: + case 0x92: + case 0x93: + data = m_fdc->read(space, offset & 0x03); + break; + case 0x98: + case 0x9c: + data = m_rtc->read(space, BIT(offset, 2)); + break; + } + } + + if (!infc && !infd) + { + switch (romqa) + { + case 0: + if (offset < 0x3800) + { + data = m_rom[offset & 0x3fff]; + } + else + { + data = m_nvram[offset & 0x07ff]; + } + break; + case 1: + // TODO: rom slot not implemented + break; + } + } + + return data; +} + +//------------------------------------------------- +// write - cartridge data write +//------------------------------------------------- + +void electron_cumana_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) +{ + if (infc) + { + switch (offset & 0xff) + { + case 0x90: + case 0x91: + case 0x92: + case 0x93: + m_fdc->write(space, offset & 0x03, data); + break; + case 0x94: + wd1793_control_w(space, 0, data); + break; + case 0x98: + case 0x9c: + m_rtc->write(space, BIT(offset, 2), data); + break; + break; + } + } + + if (!infc && !infd) + { + if (romqa == 0 && offset >= 0x3800) + { + m_nvram[offset & 0x07ff] = data; + } + } +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE8_MEMBER(electron_cumana_device::wd1793_control_w) +{ + floppy_image_device *floppy = nullptr; + + // bit 1, 2: drive select + if (BIT(data, 1)) floppy = m_floppy0->get_device(); + if (BIT(data, 2)) floppy = m_floppy1->get_device(); + m_fdc->set_floppy(floppy); + + // bit 0: side select + if (floppy) + floppy->ss_w(BIT(data, 0)); + + // bit 3: density + m_fdc->dden_w(BIT(data, 3)); + + // bit 4: motor on + if (floppy) + floppy->mon_w(!BIT(data, 4)); + + // bit 5: head load +} diff --git a/src/devices/bus/electron/cart/cumana.h b/src/devices/bus/electron/cart/cumana.h new file mode 100644 index 00000000000..aaecf97bcfb --- /dev/null +++ b/src/devices/bus/electron/cart/cumana.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Cumana Floppy Disk System + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Cumana_FDsystem.html + +**********************************************************************/ + +#ifndef MAME_BUS_ELECTRON_CART_CUMANA_H +#define MAME_BUS_ELECTRON_CART_CUMANA_H + +#include "slot.h" +#include "machine/wd_fdc.h" +#include "machine/mc146818.h" +#include "formats/acorn_dsk.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class electron_cumana_device : + public device_t, + public device_electron_cart_interface +{ +public: + // construction/destruction + electron_cumana_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; + + // electron_cart_interface overrides + virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override; + virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override; + +private: + DECLARE_WRITE8_MEMBER(wd1793_control_w); + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; + required_device m_rtc; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ELECTRON_CUMANA, electron_cumana_device) + + +#endif // MAME_BUS_ELECTRON_CART_CUMANA_H diff --git a/src/devices/bus/electron/cart/peg400.cpp b/src/devices/bus/electron/cart/peg400.cpp index a6f3398ff33..1bf8442421f 100644 --- a/src/devices/bus/electron/cart/peg400.cpp +++ b/src/devices/bus/electron/cart/peg400.cpp @@ -4,6 +4,9 @@ Slogger Pegasus 400 disk interface + TODO: + - add spare ROM slot + **********************************************************************/ @@ -84,9 +87,6 @@ uint8_t electron_peg400_device::read(address_space &space, offs_t offset, int in { switch (offset & 0xff) { - case 0xc0: - data = m_drive_control; - break; case 0xc4: case 0xc5: case 0xc6: @@ -98,14 +98,21 @@ uint8_t electron_peg400_device::read(address_space &space, offs_t offset, int in if (!infc && !infd) { - if (offset >= 0x0000 && offset < 0x4000) + switch (romqa) { + case 0: + if (offset < 0x3800) + { + data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)]; + } + else + { + data = m_ram[offset & 0x07ff]; + } + break; + case 1: data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)]; - } - - if (romqa == 0 && offset >= 0x3800 && offset < 0x4000) - { - data = m_ram[offset & 0x07ff]; + break; } } @@ -136,7 +143,7 @@ void electron_peg400_device::write(address_space &space, offs_t offset, uint8_t if (!infc && !infd) { - if (offset >= 0x3800 && offset < 0x4000) + if (romqa == 0 && offset >= 0x3800) { m_ram[offset & 0x07ff] = data; } @@ -152,8 +159,6 @@ WRITE8_MEMBER(electron_peg400_device::wd1770_control_w) { floppy_image_device *floppy = nullptr; - m_drive_control = data; - // bit 0, 1: drive select if (BIT(data, 0)) floppy = m_floppy0->get_device(); if (BIT(data, 1)) floppy = m_floppy1->get_device(); diff --git a/src/devices/bus/electron/cart/peg400.h b/src/devices/bus/electron/cart/peg400.h index e85aaa232b4..11b1eff31ae 100644 --- a/src/devices/bus/electron/cart/peg400.h +++ b/src/devices/bus/electron/cart/peg400.h @@ -43,9 +43,8 @@ private: required_device m_fdc; required_device m_floppy0; - optional_device m_floppy1; + required_device m_floppy1; - int m_drive_control; int m_fdc_ie; }; diff --git a/src/devices/bus/electron/cart/slot.cpp b/src/devices/bus/electron/cart/slot.cpp index 805e0449462..9fcec6f4e45 100644 --- a/src/devices/bus/electron/cart/slot.cpp +++ b/src/devices/bus/electron/cart/slot.cpp @@ -267,18 +267,28 @@ void electron_cartslot_device::write(address_space &space, offs_t offset, uint8_ //------------------------------------------------- #include "abr.h" -//#include "ap34.h" +#include "ap34.h" +#include "aqr.h" #include "click.h" -//#include "cumana.h" +#include "cumana.h" #include "peg400.h" +#include "sndexp.h" +#include "sndexp3.h" +#include "sp64.h" +#include "stlefs.h" #include "std.h" SLOT_INTERFACE_START(electron_cart) SLOT_INTERFACE_INTERNAL("std", ELECTRON_STDCART) SLOT_INTERFACE_INTERNAL("abr", ELECTRON_ABR) - //SLOT_INTERFACE_INTERNAL("ap34", ELECTRON_AP34) + SLOT_INTERFACE_INTERNAL("ap34", ELECTRON_AP34) + SLOT_INTERFACE_INTERNAL("aqr", ELECTRON_AQR) SLOT_INTERFACE_INTERNAL("click", ELECTRON_CLICK) - //SLOT_INTERFACE_INTERNAL("cumana", ELECTRON_CUMANA) + SLOT_INTERFACE_INTERNAL("cumana", ELECTRON_CUMANA) SLOT_INTERFACE_INTERNAL("peg400", ELECTRON_PEG400) -SLOT_INTERFACE_END + SLOT_INTERFACE_INTERNAL("sndexp", ELECTRON_SNDEXP) + SLOT_INTERFACE_INTERNAL("sndexp3", ELECTRON_SNDEXP3) + SLOT_INTERFACE_INTERNAL("sp64", ELECTRON_SP64) + SLOT_INTERFACE_INTERNAL("stlefs", ELECTRON_STLEFS) +SLOT_INTERFACE_END \ No newline at end of file diff --git a/src/devices/bus/electron/cart/sndexp.cpp b/src/devices/bus/electron/cart/sndexp.cpp new file mode 100644 index 00000000000..b7fbf0e837c --- /dev/null +++ b/src/devices/bus/electron/cart/sndexp.cpp @@ -0,0 +1,167 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Sound Expansion cartridge (Project Expansions) + + TODO: + - compare with actual hardware, sounds awful compared to v3 + - implement jumper to configure 8K as sideways RAM + +**********************************************************************/ + + +#include "emu.h" +#include "sndexp.h" +#include "speaker.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ELECTRON_SNDEXP, electron_sndexp_device, "electron_sndexp", "Electron Sound Expansion cartridge") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(electron_sndexp_device::device_add_mconfig) + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("sn76489", SN76489, 16_MHz_XTAL / 4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) +MACHINE_CONFIG_END + +//------------------------------------------------- +// INPUT_PORTS( sndexp ) +//------------------------------------------------- + +INPUT_PORTS_START(sndexp) + // TODO: Not known how jumper affects RAM access + PORT_START("JUMPER") + PORT_DIPNAME(0x01, 0x00, "SOUND / RAM") + PORT_DIPSETTING(0x00, "SOUND") + PORT_DIPSETTING(0x01, "RAM") +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor electron_sndexp_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(sndexp); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_sndexp_device - constructor +//------------------------------------------------- + +electron_sndexp_device::electron_sndexp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ELECTRON_SNDEXP, tag, owner, clock) + , device_electron_cart_interface(mconfig, *this) + , m_sn(*this, "sn76489") + , m_jumper(*this, "JUMPER") + , m_sound_latch(0) + , m_sound_enable(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_sndexp_device::device_start() +{ + save_item(NAME(m_sound_latch)); + save_item(NAME(m_sound_enable)); +} + +//------------------------------------------------- +// read - cartridge data read +//------------------------------------------------- + +uint8_t electron_sndexp_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa) +{ + uint8_t data = 0xff; + + if (!infc && !infd) + { + if (m_jumper->read()) + { + if (romqa == 0) + { + data = m_rom[offset & 0x1fff]; + } + else + { + data = m_ram[offset & 0x1fff]; + } + } + else + { + if (offset < 0x2000) + { + data = m_rom[offset & 0x1fff]; + } + else + { + data = m_ram[offset & 0x1fff]; + } + } + } + + return data; +} + +//------------------------------------------------- +// write - cartridge data write +//------------------------------------------------- + +void electron_sndexp_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) +{ + if (infc) + { + switch (offset & 0xff) + { + case 0x84: + m_sound_latch = data; + break; + case 0x85: + if ((data & 0x01) && !m_sound_enable) + { + m_sn->write(m_sound_latch); + } + m_sound_enable = data & 0x01; + break; + } + } + + if (!infc && !infd) + { + if (m_jumper->read()) + { + if (romqa == 1) + { + m_ram[offset & 0x1fff] = data; + } + } + else + { + if (offset < 0x2000) + { + m_ram[offset & 0x1fff] = data; + } + else + { + m_ram[offset & 0x1fff] = data; + } + } + } +} diff --git a/src/devices/bus/electron/cart/sndexp.h b/src/devices/bus/electron/cart/sndexp.h new file mode 100644 index 00000000000..87d94ba84a2 --- /dev/null +++ b/src/devices/bus/electron/cart/sndexp.h @@ -0,0 +1,52 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Sound Expansion cartridge (Project Expansions) + +**********************************************************************/ + +#ifndef MAME_BUS_ELECTRON_CART_SNDEXP_H +#define MAME_BUS_ELECTRON_CART_SNDEXP_H + +#include "slot.h" +#include "sound/sn76496.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class electron_sndexp_device : + public device_t, + public device_electron_cart_interface +{ +public: + // construction/destruction + electron_sndexp_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 ioport_constructor device_input_ports() const override; + + // electron_cart_interface overrides + virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override; + virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override; + +private: + required_device m_sn; + required_ioport m_jumper; + + uint8_t m_sound_latch; + uint8_t m_sound_enable; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ELECTRON_SNDEXP, electron_sndexp_device) + + +#endif // MAME_BUS_ELECTRON_CART_SNDEXP_H diff --git a/src/devices/bus/electron/cart/sndexp3.cpp b/src/devices/bus/electron/cart/sndexp3.cpp new file mode 100644 index 00000000000..dd1dd67f23c --- /dev/null +++ b/src/devices/bus/electron/cart/sndexp3.cpp @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Sound Expansion v3 cartridge (Complex Software Systems) + +**********************************************************************/ + + +#include "emu.h" +#include "sndexp3.h" +#include "speaker.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ELECTRON_SNDEXP3, electron_sndexp3_device, "electron_sndexp3", "Electron Sound Expansion v3 cartridge") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(electron_sndexp3_device::device_add_mconfig) + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("sn76489", SN76489, 16_MHz_XTAL / 4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) +MACHINE_CONFIG_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_sndexp3_device - constructor +//------------------------------------------------- + +electron_sndexp3_device::electron_sndexp3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ELECTRON_SNDEXP3, tag, owner, clock) + , device_electron_cart_interface(mconfig, *this) + , m_sn(*this, "sn76489") + , m_sound_latch(0) + , m_sound_enable(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_sndexp3_device::device_start() +{ + save_item(NAME(m_sound_latch)); + save_item(NAME(m_sound_enable)); +} + +//------------------------------------------------- +// read - cartridge data read +//------------------------------------------------- + +uint8_t electron_sndexp3_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa) +{ + uint8_t data = 0xff; + + if (!infc && !infd && romqa) + { + if (offset < 0x2000) + { + data = m_rom[offset & 0x1fff]; + } + else + { + data = m_ram[offset & 0x1fff]; + } + } + + return data; +} + +//------------------------------------------------- +// write - cartridge data write +//------------------------------------------------- + +void electron_sndexp3_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) +{ + if (infc) + { + switch (offset & 0xff) + { + case 0x98: + m_sound_latch = data; + break; + case 0x99: + if ((data & 0x01) && !m_sound_enable) + { + m_sn->write(m_sound_latch); + } + m_sound_enable = data & 0x01; + break; + } + } + + if (!infc && !infd && romqa) + { + if (offset >= 0x2000) + { + m_ram[offset & 0x1fff] = data; + } + } +} diff --git a/src/devices/bus/electron/cart/sndexp3.h b/src/devices/bus/electron/cart/sndexp3.h new file mode 100644 index 00000000000..2ad0869ca65 --- /dev/null +++ b/src/devices/bus/electron/cart/sndexp3.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Sound Expansion v3 cartridge (Complex Software Systems) + +**********************************************************************/ + +#ifndef MAME_BUS_ELECTRON_CART_SNDEXP3_H +#define MAME_BUS_ELECTRON_CART_SNDEXP3_H + +#include "slot.h" +#include "sound/sn76496.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class electron_sndexp3_device : + public device_t, + public device_electron_cart_interface +{ +public: + // construction/destruction + electron_sndexp3_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; + + // electron_cart_interface overrides + virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override; + virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override; + +private: + required_device m_sn; + + uint8_t m_sound_latch; + uint8_t m_sound_enable; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ELECTRON_SNDEXP3, electron_sndexp3_device) + + +#endif // MAME_BUS_ELECTRON_CART_SNDEXP3_H diff --git a/src/devices/bus/electron/cart/sp64.cpp b/src/devices/bus/electron/cart/sp64.cpp new file mode 100644 index 00000000000..11db24fbba6 --- /dev/null +++ b/src/devices/bus/electron/cart/sp64.cpp @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Slogger Stop Press 64 cartridge emulation + +***************************************************************************/ + +#include "emu.h" +#include "sp64.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ELECTRON_SP64, electron_sp64_device, "electron_sp64", "Slogger Stop Press 64 cartridge") + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_sp64_device - constructor +//------------------------------------------------- + +electron_sp64_device::electron_sp64_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ELECTRON_SP64, tag, owner, clock) + , device_electron_cart_interface(mconfig, *this) + , m_page_register(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_sp64_device::device_start() +{ + save_item(NAME(m_page_register)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void electron_sp64_device::device_reset() +{ + m_page_register = 0; +} + + +//------------------------------------------------- +// read - cartridge data read +//------------------------------------------------- + +uint8_t electron_sp64_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa) +{ + uint8_t data = 0xff; + + if (infc) + { + switch (offset & 0xff) + { + case 0xfa: + data = m_page_register; + break; + } + } + + if (!infc && !infd) + { + offs_t rom_page_offset = m_page_register * 0x4000; + + switch (romqa) + { + case 0: + data = m_rom[rom_page_offset + (offset & 0x3fff)]; + break; + case 1: + data = m_ram[offset & 0x1fff]; + break; + } + } + + return data; +} + +//------------------------------------------------- +// write - cartridge data write +//------------------------------------------------- + +void electron_sp64_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) +{ + if (infc) + { + switch (offset & 0xff) + { + case 0xfa: + m_page_register = data; + break; + } + } + + if (!infc && !infd) + { + if (romqa == 1) + { + m_ram[offset & 0x1fff] = data; + } + } +} diff --git a/src/devices/bus/electron/cart/sp64.h b/src/devices/bus/electron/cart/sp64.h new file mode 100644 index 00000000000..7e5de9f18f6 --- /dev/null +++ b/src/devices/bus/electron/cart/sp64.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/*************************************************************************** + + Slogger Stop Press 64 cartridge emulation + +***************************************************************************/ + +#ifndef MAME_BUS_ELECTRON_CART_SP64_H +#define MAME_BUS_ELECTRON_CART_SP64_H + +#pragma once + +#include "slot.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> electron_sp64_device + +class electron_sp64_device : public device_t, + public device_electron_cart_interface +{ +public: + // construction/destruction + electron_sp64_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; + + // electron_cart_interface overrides + virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override; + virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override; + +private: + uint8_t m_page_register; +}; + +// device type definition +DECLARE_DEVICE_TYPE(ELECTRON_SP64, electron_sp64_device) + +#endif // MAME_BUS_ELECTRON_CART_SP64_H diff --git a/src/devices/bus/electron/cart/stlefs.cpp b/src/devices/bus/electron/cart/stlefs.cpp new file mode 100644 index 00000000000..29cfdf471e1 --- /dev/null +++ b/src/devices/bus/electron/cart/stlefs.cpp @@ -0,0 +1,172 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Solidisk EFS + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Solidisk_EFS.html + + TODO: + - add Winchester slot + - unknown how 16K RAM is paged as SWR (adverts claim it was unreliable) + +**********************************************************************/ + + +#include "emu.h" +#include "stlefs.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ELECTRON_STLEFS, electron_stlefs_device, "electron_stlefs", "Solidisk EFS") + + +//------------------------------------------------- +// MACHINE_DRIVER( stlefs ) +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER(electron_stlefs_device::floppy_formats) + FLOPPY_ACORN_SSD_FORMAT, + FLOPPY_ACORN_DSD_FORMAT, + FLOPPY_ACORN_ADFS_OLD_FORMAT +FLOPPY_FORMATS_END + +SLOT_INTERFACE_START(stlefs_floppies) + SLOT_INTERFACE("35dd", FLOPPY_35_DD) + SLOT_INTERFACE("525qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_START(electron_stlefs_device::device_add_mconfig) + /* fdc */ + MCFG_WD1770_ADD("fdc", 16_MHz_XTAL / 2) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(electron_stlefs_device, fdc_intrq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(electron_stlefs_device, fdc_drq_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", stlefs_floppies, "525qd", electron_stlefs_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", stlefs_floppies, nullptr, electron_stlefs_device::floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) +MACHINE_CONFIG_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_stlefs_device - constructor +//------------------------------------------------- + +electron_stlefs_device::electron_stlefs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ELECTRON_STLEFS, tag, owner, clock) + , device_electron_cart_interface(mconfig, *this) + , m_fdc(*this, "fdc") + , m_floppy0(*this, "fdc:0") + , m_floppy1(*this, "fdc:1") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_stlefs_device::device_start() +{ +} + +//------------------------------------------------- +// read - cartridge data read +//------------------------------------------------- + +uint8_t electron_stlefs_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa) +{ + uint8_t data = 0xff; + + if (infc) + { + switch (offset & 0xff) + { + case 0xc4: + case 0xc5: + case 0xc6: + case 0xc7: + data = m_fdc->read(space, offset & 0x03); + break; + } + } + + if (!infc && !infd) + { + if (offset >= 0x0000 && offset < 0x4000) + { + data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)]; + } + } + + return data; +} + +//------------------------------------------------- +// write - cartridge data write +//------------------------------------------------- + +void electron_stlefs_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) +{ + if (infc) + { + switch (offset & 0xff) + { + case 0xc0: + wd1770_control_w(space, 0, data); + break; + case 0xc4: + case 0xc5: + case 0xc6: + case 0xc7: + m_fdc->write(space, offset & 0x03, data); + break; + //case 0xcb: + //m_page_register = data; + } + } +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE8_MEMBER(electron_stlefs_device::wd1770_control_w) +{ + floppy_image_device *floppy = nullptr; + + // bit 0, 1: drive select + if (BIT(data, 0)) floppy = m_floppy0->get_device(); + if (BIT(data, 1)) floppy = m_floppy1->get_device(); + m_fdc->set_floppy(floppy); + + // bit 2: side select + if (floppy) + floppy->ss_w(BIT(data, 2)); + + // bit 3: density + m_fdc->dden_w(BIT(data, 3)); + + // bit 5: reset + if (!BIT(data, 5)) m_fdc->soft_reset(); +} + +void electron_stlefs_device::fdc_intrq_w(int state) +{ + m_slot->irq_w(state); +} + +void electron_stlefs_device::fdc_drq_w(int state) +{ + m_slot->nmi_w(state); +} diff --git a/src/devices/bus/electron/cart/stlefs.h b/src/devices/bus/electron/cart/stlefs.h new file mode 100644 index 00000000000..9c0672bd4c5 --- /dev/null +++ b/src/devices/bus/electron/cart/stlefs.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Solidisk EFS + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Solidisk_EFS.html + +**********************************************************************/ + +#ifndef MAME_BUS_ELECTRON_CART_STLEFS_H +#define MAME_BUS_ELECTRON_CART_STLEFS_H + +#include "slot.h" +#include "machine/wd_fdc.h" +#include "formats/acorn_dsk.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class electron_stlefs_device : + public device_t, + public device_electron_cart_interface +{ +public: + // construction/destruction + electron_stlefs_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; + + // electron_cart_interface overrides + virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) override; + virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) override; + +private: + DECLARE_WRITE8_MEMBER(wd1770_control_w); + DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w); + DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device m_fdc; + required_device m_floppy0; + required_device m_floppy1; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ELECTRON_STLEFS, electron_stlefs_device) + + +#endif // MAME_BUS_ELECTRON_CART_STLEFS_H diff --git a/src/devices/bus/electron/plus1.cpp b/src/devices/bus/electron/plus1.cpp index e7fdfd5f2c8..d4d5ad619ed 100644 --- a/src/devices/bus/electron/plus1.cpp +++ b/src/devices/bus/electron/plus1.cpp @@ -164,47 +164,50 @@ void electron_plus1_device::device_start() uint8_t electron_plus1_device::expbus_r(address_space &space, offs_t offset, uint8_t data) { - if (offset >= 0x8000 && offset < 0xc000) + switch (offset >> 12) { + case 0x8: + case 0x9: + case 0xa: + case 0xb: switch (m_romsel) { case 0: case 1: - if (m_cart_sk2->exists()) - { - data = m_cart_sk2->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01); - } + data = m_cart_sk2->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01); break; case 2: case 3: - if (m_cart_sk1->exists()) - { - data = m_cart_sk1->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01); - } + data = m_cart_sk1->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01); break; case 12: data = m_exp_rom->base()[offset & 0x1fff]; break; } - } - else if ((offset & 0xfc00) == 0xfc00) - { - data &= m_cart_sk1->read(space, offset & 0xff, 1, 0, m_romsel & 0x01); - data &= m_cart_sk2->read(space, offset & 0xff, 1, 0, m_romsel & 0x01); + break; - if (offset == 0xfc70) + case 0xf: + switch (offset >> 8) { - data &= m_adc->read(space, offset); + case 0xfc: + data &= m_cart_sk1->read(space, offset & 0xff, 1, 0, m_romsel & 0x01); + data &= m_cart_sk2->read(space, offset & 0xff, 1, 0, m_romsel & 0x01); + + if (offset == 0xfc70) + { + data &= m_adc->read(space, offset); + } + else if (offset == 0xfc72) + { + data &= status_r(space, offset); + } + break; + + case 0xfd: + data &= m_cart_sk1->read(space, offset & 0xff, 0, 1, m_romsel & 0x01); + data &= m_cart_sk2->read(space, offset & 0xff, 0, 1, m_romsel & 0x01); + break; } - else if (offset == 0xfc72) - { - data &= status_r(space, offset); - } - } - else if ((offset & 0xfd00) == 0xfd00) - { - data &= m_cart_sk1->read(space, offset & 0xff, 0, 1, m_romsel & 0x01); - data &= m_cart_sk2->read(space, offset & 0xff, 0, 1, m_romsel & 0x01); } return data; @@ -217,49 +220,55 @@ uint8_t electron_plus1_device::expbus_r(address_space &space, offs_t offset, uin void electron_plus1_device::expbus_w(address_space &space, offs_t offset, uint8_t data) { - if (offset >= 0x8000 && offset < 0xc000) + switch (offset >> 12) { + case 0x8: + case 0x9: + case 0xa: + case 0xb: switch (m_romsel) { case 0: case 1: - if (m_cart_sk2->exists()) - { - m_cart_sk2->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01); - } + m_cart_sk2->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01); break; case 2: case 3: - if (m_cart_sk1->exists()) + m_cart_sk1->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01); + break; + } + break; + + case 0xf: + switch (offset >> 8) + { + case 0xfc: + m_cart_sk1->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01); + m_cart_sk2->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01); + + if (offset == 0xfc70) { - m_cart_sk1->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01); + m_adc->write(space, offset, data); + } + else if (offset == 0xfc71) + { + m_cent_data_out->write(data); + } + break; + + case 0xfd: + m_cart_sk1->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01); + m_cart_sk2->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01); + break; + + case 0xfe: + if (offset == 0xfe05) + { + m_romsel = data & 0x0f; } break; } } - else if ((offset & 0xfc00) == 0xfc00) - { - m_cart_sk1->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01); - m_cart_sk2->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01); - - if (offset == 0xfc70) - { - m_adc->write(space, offset, data); - } - else if (offset == 0xfc71) - { - m_cent_data_out->write(data); - } - else if (offset == 0xfe05) - { - m_romsel = data & 0x0f; - } - } - else if ((offset & 0xfd00) == 0xfd00) - { - m_cart_sk1->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01); - m_cart_sk2->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01); - } } diff --git a/src/devices/bus/electron/romboxp.cpp b/src/devices/bus/electron/romboxp.cpp index 8fc1fdbc91a..a33175dccd9 100644 --- a/src/devices/bus/electron/romboxp.cpp +++ b/src/devices/bus/electron/romboxp.cpp @@ -165,29 +165,27 @@ void electron_romboxp_device::device_reset() uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset, uint8_t data) { - if (offset >= 0x8000 && offset < 0xc000) + switch (offset >> 12) { + case 0x8: + case 0x9: + case 0xa: + case 0xb: switch (m_romsel) { case 0: case 1: - if (m_cart[1]->exists()) - { - data = m_cart[1]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01); - } + data = m_cart[1]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01); break; case 2: case 3: - if (m_cart[0]->exists()) - { - data = m_cart[0]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01); - } + data = m_cart[0]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01); break; case 4: case 5: case 6: case 7: - if (m_rom_base == 4 && m_rom[m_romsel - 4]->exists()) + if (m_rom_base == 4) { data = m_rom[m_romsel - 4]->read_rom(space, offset & 0x3fff); } @@ -198,28 +196,33 @@ uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset, u case 13: case 14: case 15: - if (m_rom_base == 12 && m_rom[m_romsel - 12]->exists()) + if (m_rom_base == 12) { data = m_rom[m_romsel - 12]->read_rom(space, offset & 0x3fff); } break; } - } - else if ((offset & 0xfc00) == 0xfc00) - { - data &= m_cart[0]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01); - data &= m_cart[1]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01); + break; - if (offset == 0xfc72) + case 0xf: + switch (offset >> 8) { - data &= status_r(space, offset); + case 0xfc: + data &= m_cart[0]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01); + data &= m_cart[1]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01); + + if (offset == 0xfc72) + { + data &= status_r(space, offset); + } + break; + + case 0xfd: + data &= m_cart[0]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01); + data &= m_cart[1]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01); + break; } } - else if ((offset & 0xfd00) == 0xfd00) - { - data &= m_cart[0]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01); - data &= m_cart[1]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01); - } return data; } @@ -230,45 +233,51 @@ uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset, u void electron_romboxp_device::expbus_w(address_space &space, offs_t offset, uint8_t data) { - if (offset >= 0x8000 && offset < 0xc000) + switch (offset >> 12) { + case 0x8: + case 0x9: + case 0xa: + case 0xb: switch (m_romsel) { case 0: case 1: - if (m_cart[1]->exists()) - { - m_cart[1]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01); - } + m_cart[1]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01); break; case 2: case 3: - if (m_cart[0]->exists()) + m_cart[0]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01); + break; + } + break; + + case 0xf: + switch (offset >> 8) + { + case 0xfc: + m_cart[0]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01); + m_cart[1]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01); + + if (offset == 0xfc71) { - m_cart[0]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01); + m_cent_data_out->write(data); + } + break; + + case 0xfd: + m_cart[0]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01); + m_cart[1]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01); + break; + + case 0xfe: + if (offset == 0xfe05) + { + m_romsel = data & 0x0f; } break; } } - else if ((offset & 0xfc00) == 0xfc00) - { - m_cart[0]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01); - m_cart[1]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01); - - if (offset == 0xfc71) - { - m_cent_data_out->write(data); - } - else if (offset == 0xfe05) - { - m_romsel = data & 0x0f; - } - } - else if ((offset & 0xfd00) == 0xfd00) - { - m_cart[0]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01); - m_cart[1]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01); - } } //**************************************************************************