diff options
author | 2019-11-11 18:44:47 +0000 | |
---|---|---|
committer | 2019-11-11 18:45:26 +0000 | |
commit | 68bfd84495602d0836c4188e5abeef5766d3c62b (patch) | |
tree | a80290836b97d98063cab55f8317cdad499bd4cd /src/devices/bus/bbc | |
parent | 63561e2c2c64d1fc3376fcd7d54051068e39b5f7 (diff) |
bbcb: Added Morley Electronics RAM Disc and PMS 64K Non-Volatile Ram Module devices.
Diffstat (limited to 'src/devices/bus/bbc')
-rw-r--r-- | src/devices/bus/bbc/1mhzbus/1mhzbus.cpp | 9 | ||||
-rw-r--r-- | src/devices/bus/bbc/1mhzbus/pms64k.cpp | 80 | ||||
-rw-r--r-- | src/devices/bus/bbc/1mhzbus/pms64k.h | 51 | ||||
-rw-r--r-- | src/devices/bus/bbc/1mhzbus/ramdisc.cpp | 203 | ||||
-rw-r--r-- | src/devices/bus/bbc/1mhzbus/ramdisc.h | 60 |
5 files changed, 400 insertions, 3 deletions
diff --git a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp index 65b7b265bde..50edb6e5506 100644 --- a/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp +++ b/src/devices/bus/bbc/1mhzbus/1mhzbus.cpp @@ -118,7 +118,8 @@ void bbc_1mhzbus_slot_device::jim_w(offs_t offset, uint8_t data) //#include "scsi.h" //#include "multiform.h" #include "opus3.h" -//#include "ramdisc.h" +#include "pms64k.h" +#include "ramdisc.h" //#include "graduate.h" #include "beebsid.h" //#include "prisma3.h" @@ -141,7 +142,8 @@ void bbc_1mhzbus_devices(device_slot_interface &device) //device.option_add("twdd", BBC_TWDD); /* Technomatic Winchester (Akhter Host Adaptor + ABD4070 */ //device.option_add("multiform", BBC_MULTIFORM); /* Technomatic Multiform Z80 */ device.option_add("opus3", BBC_OPUS3); /* Opus Challenger 3 */ - //device.option_add("ramdisc", BBC_RAMDISC); /* Morley Electronics RAM Disc */ + device.option_add("pms64k", BBC_PMS64K); /* PMS 64K Non-Volatile Ram Module */ + device.option_add("ramdisc", BBC_RAMDISC); /* Morley Electronics RAM Disc */ //device.option_add("graduate", BBC_GRADUATE); /* The Torch Graduate G400/G800 */ device.option_add("beebsid", BBC_BEEBSID); /* BeebSID */ //device.option_add("prisma3", BBC_PRISMA3); /* PRISMA-3 - Millipede 1989 */ @@ -165,7 +167,8 @@ void bbcm_1mhzbus_devices(device_slot_interface &device) //device.option_add("m87", BBC_M87); /* Peartree Music 87 Synthesiser */ //device.option_add("multiform", BBC_MULTIFORM); /* Technomatic Multiform Z80 */ device.option_add("opusa", BBC_OPUSA); /* Opus Challenger ADFS */ - //device.option_add("ramdisc", BBC_RAMDISC); /* Morley Electronics RAM Disc */ + device.option_add("pms64k", BBC_PMS64K); /* PMS 64K Non-Volatile Ram Module */ + device.option_add("ramdisc", BBC_RAMDISC); /* Morley Electronics RAM Disc */ //device.option_add("graduate", BBC_GRADUATE); /* The Torch Graduate G400/G800 */ device.option_add("beebsid", BBC_BEEBSID); /* BeebSID */ //device.option_add("prisma3", BBC_PRISMA3); /* PRISMA-3 - Millipede 1989 */ diff --git a/src/devices/bus/bbc/1mhzbus/pms64k.cpp b/src/devices/bus/bbc/1mhzbus/pms64k.cpp new file mode 100644 index 00000000000..0c975b39f48 --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/pms64k.cpp @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + PMS 64K Non-Volatile Ram Module + + TODO: + - Find accompanying software, needed to install utilities to RAM. + +**********************************************************************/ + + +#include "emu.h" +#include "pms64k.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(BBC_PMS64K, bbc_pms64k_device, "bbc_pms64k", "PMS 64K Non-Volatile Ram Module"); + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void bbc_pms64k_device::device_add_mconfig(machine_config &config) +{ + NVRAM(config, "nvram", nvram_device::DEFAULT_NONE); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// bbc_pms64k_device - constructor +//------------------------------------------------- + +bbc_pms64k_device::bbc_pms64k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, BBC_PMS64K, tag, owner, clock) + , device_bbc_1mhzbus_interface(mconfig, *this) + , m_nvram(*this, "nvram") + , m_ram_page(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bbc_pms64k_device::device_start() +{ + m_ram = std::make_unique<uint8_t[]>(0x10000); + m_nvram->set_base(m_ram.get(), 0x10000); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +void bbc_pms64k_device::fred_w(offs_t offset, uint8_t data) +{ + if (offset == 0xff) + { + m_ram_page = data; + } +} + +uint8_t bbc_pms64k_device::jim_r(offs_t offset) +{ + return m_ram[(m_ram_page << 8) | offset]; +} + +void bbc_pms64k_device::jim_w(offs_t offset, uint8_t data) +{ + m_ram[(m_ram_page << 8) | offset] = data; +} diff --git a/src/devices/bus/bbc/1mhzbus/pms64k.h b/src/devices/bus/bbc/1mhzbus/pms64k.h new file mode 100644 index 00000000000..8b817b7db1d --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/pms64k.h @@ -0,0 +1,51 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + PMS 64K Non-Volatile Ram Module + +**********************************************************************/ + + +#ifndef MAME_BUS_BBC_1MHZBUS_PMS64K_H +#define MAME_BUS_BBC_1MHZBUS_PMS64K_H + +#include "1mhzbus.h" +#include "machine/nvram.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class bbc_pms64k_device: + public device_t, + public device_bbc_1mhzbus_interface +{ +public: + // construction/destruction + bbc_pms64k_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 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<nvram_device> m_nvram; + std::unique_ptr<uint8_t[]> m_ram; + + uint8_t m_ram_page; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(BBC_PMS64K, bbc_pms64k_device); + + +#endif /* MAME_BUS_BBC_1MHZBUS_PMS64K_H */ diff --git a/src/devices/bus/bbc/1mhzbus/ramdisc.cpp b/src/devices/bus/bbc/1mhzbus/ramdisc.cpp new file mode 100644 index 00000000000..ef3c3265dbe --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/ramdisc.cpp @@ -0,0 +1,203 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Morley Electronics RAM Disc + + Notes: + - 1MB model has 4096 sectors &0000 to &0fff + - 2MB model has 8192 sectors &0000 to &1fff + +**********************************************************************/ + + +#include "emu.h" +#include "ramdisc.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(BBC_RAMDISC, bbc_ramdisc_device, "bbc_ramdisc", "Morley Electronics RAM Disc"); + + +//------------------------------------------------- +// INPUT_PORTS( ramdisc ) +//------------------------------------------------- + +static INPUT_PORTS_START(ramdisc) + PORT_START("POWER") + PORT_CONFNAME(0x01, 0x01, "Power") PORT_CHANGED_MEMBER(DEVICE_SELF, bbc_ramdisc_device, power_changed, 0) + PORT_CONFSETTING(0x00, DEF_STR(Off)) + PORT_CONFSETTING(0x01, DEF_STR(On)) +INPUT_PORTS_END + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor bbc_ramdisc_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(ramdisc); +} + +//------------------------------------------------- +// ROM( ramdisc ) +//------------------------------------------------- + +ROM_START(ramdisc) + ROM_REGION(0x4000, "exp_rom", 0) + ROM_LOAD("ramdisc101.rom", 0x0000, 0x4000, CRC(627568c2) SHA1(17e727998756fe35ff451fd2ce1d4b5977be24fc)) +ROM_END + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void bbc_ramdisc_device::device_add_mconfig(machine_config &config) +{ + /* ram disk */ + NVRAM(config, "nvram", nvram_device::DEFAULT_NONE); + + BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 1), bbc_1mhzbus_devices, nullptr); + m_1mhzbus->irq_handler().set(m_1mhzbus, FUNC(bbc_1mhzbus_slot_device::irq_w)); + m_1mhzbus->nmi_handler().set(m_1mhzbus, FUNC(bbc_1mhzbus_slot_device::nmi_w)); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *bbc_ramdisc_device::device_rom_region() const +{ + return ROM_NAME(ramdisc); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// bbc_ramdisc_device - constructor +//------------------------------------------------- + +bbc_ramdisc_device::bbc_ramdisc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, BBC_RAMDISC, tag, owner, clock) + , device_bbc_1mhzbus_interface(mconfig, *this) + , m_1mhzbus(*this, "1mhzbus") + , m_nvram(*this, "nvram") + , m_power(*this, "POWER") + , m_sector(0) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bbc_ramdisc_device::device_start() +{ + /* define 2mb ram */ + m_ram = std::make_unique<uint8_t[]>(RAM_SIZE); + m_nvram->set_base(m_ram.get(), RAM_SIZE); + + /* register for save states */ + save_pointer(NAME(m_ram), RAM_SIZE); + save_item(NAME(m_sector)); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +INPUT_CHANGED_MEMBER(bbc_ramdisc_device::power_changed) +{ + /* clear RAM on power off */ + if (!newval) + { + memset(m_ram.get(), 0xff, RAM_SIZE); + } +} + +uint8_t bbc_ramdisc_device::fred_r(offs_t offset) +{ + uint8_t data = 0xff; + + if (m_power->read()) + { + switch (offset) + { + case 0xc0: + /* sector LSB */ + data = m_sector & 0x00ff; + break; + case 0xc2: + /* sector MSB */ + data = (m_sector & 0xff00) >> 8; + break; + case 0xc1: + case 0xc3: + /* TODO: unknown purpose, must return 0x3f or 0x5f */ + data = 0x3f; + logerror("Read %04x -> %02x\n", offset | 0xfcc0, data); + break; + } + } + + data &= m_1mhzbus->fred_r(offset); + + return data; +} + +void bbc_ramdisc_device::fred_w(offs_t offset, uint8_t data) +{ + if (m_power->read()) + { + switch (offset) + { + case 0xc0: + /* sector LSB */ + m_sector = (m_sector & 0xff00) | data; + break; + case 0xc2: + /* sector MSB */ + m_sector = (m_sector & 0x00ff) | (data << 8); + break; + case 0xc1: + case 0xc3: + /* TODO: unknown purpose, always writes 0x00 or 0xff */ + logerror("Write %04x <- %02x\n", offset | 0xfcc0, data); + break; + } + } + + m_1mhzbus->fred_w(offset, data); +} + +uint8_t bbc_ramdisc_device::jim_r(offs_t offset) +{ + uint8_t data = 0xff; + + /* power on and sector < 2mb */ + if (m_power->read() && m_sector < RAM_SIZE) + { + data &= m_ram[(m_sector << 8) | offset]; + } + + data &= m_1mhzbus->jim_r(offset); + + return data; +} + +void bbc_ramdisc_device::jim_w(offs_t offset, uint8_t data) +{ + /* power on and sector < 2mb */ + if (m_power->read() && m_sector < RAM_SIZE) + { + m_ram[(m_sector << 8) | offset] = data; + } + + m_1mhzbus->jim_w(offset, data); +} diff --git a/src/devices/bus/bbc/1mhzbus/ramdisc.h b/src/devices/bus/bbc/1mhzbus/ramdisc.h new file mode 100644 index 00000000000..52b26284e06 --- /dev/null +++ b/src/devices/bus/bbc/1mhzbus/ramdisc.h @@ -0,0 +1,60 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Morley Electronics RAM Disc + +**********************************************************************/ + + +#ifndef MAME_BUS_BBC_1MHZBUS_RAMDISC_H +#define MAME_BUS_BBC_1MHZBUS_RAMDISC_H + +#include "1mhzbus.h" +#include "machine/nvram.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class bbc_ramdisc_device: + public device_t, + public device_bbc_1mhzbus_interface +{ +public: + // construction/destruction + bbc_ramdisc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_INPUT_CHANGED_MEMBER(power_changed); + +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; + virtual const tiny_rom_entry *device_rom_region() const 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: + static const size_t RAM_SIZE = 0x200000; + + required_device<bbc_1mhzbus_slot_device> m_1mhzbus; + required_device<nvram_device> m_nvram; + required_ioport m_power; + + std::unique_ptr<uint8_t[]> m_ram; + uint16_t m_sector; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(BBC_RAMDISC, bbc_ramdisc_device); + + +#endif /* MAME_BUS_BBC_1MHZBUS_RAMDISC_H */ |