diff options
author | 2022-05-15 16:15:00 +0100 | |
---|---|---|
committer | 2022-05-15 16:15:00 +0100 | |
commit | 3377ee1d7985fe6a2b4d79dd5d75c828bccbbbc2 (patch) | |
tree | 2b11cf96911a5ea38ae073f398d5fcdecc4dbaf6 | |
parent | 74728bc4d42ba21de9a58ad0442a413575e7e357 (diff) |
bus/bbc/internal: Added the Memex-B20 board.
-rw-r--r-- | scripts/src/bus.lua | 2 | ||||
-rw-r--r-- | src/devices/bus/bbc/internal/internal.cpp | 2 | ||||
-rw-r--r-- | src/devices/bus/bbc/internal/memex.cpp | 109 | ||||
-rw-r--r-- | src/devices/bus/bbc/internal/memex.h | 50 |
4 files changed, 163 insertions, 0 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 3a97d6e7c52..b1f17f54e3f 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -551,6 +551,8 @@ if (BUSES["BBC_INTERNAL"]~=null) then MAME_DIR .. "src/devices/bus/bbc/internal/cumana68k.h", MAME_DIR .. "src/devices/bus/bbc/internal/integrab.cpp", MAME_DIR .. "src/devices/bus/bbc/internal/integrab.h", + MAME_DIR .. "src/devices/bus/bbc/internal/memex.cpp", + MAME_DIR .. "src/devices/bus/bbc/internal/memex.h", MAME_DIR .. "src/devices/bus/bbc/internal/morleyaa.cpp", MAME_DIR .. "src/devices/bus/bbc/internal/morleyaa.h", MAME_DIR .. "src/devices/bus/bbc/internal/overlay.cpp", diff --git a/src/devices/bus/bbc/internal/internal.cpp b/src/devices/bus/bbc/internal/internal.cpp index b09f6fca29c..a365b5729dc 100644 --- a/src/devices/bus/bbc/internal/internal.cpp +++ b/src/devices/bus/bbc/internal/internal.cpp @@ -162,6 +162,7 @@ WRITE_LINE_MEMBER(bbc_internal_slot_device::irq6502_w) #include "atpl.h" #include "cumana68k.h" #include "integrab.h" +#include "memex.h" #include "morleyaa.h" #include "overlay.h" #include "peartree.h" @@ -186,6 +187,7 @@ void bbcb_internal_devices(device_slot_interface &device) device.option_add("atplsw", BBC_ATPLSW); /* ATPL Sidewise ROM/RAM expansion */ device.option_add("cumana68k", BBC_CUMANA68K); /* Cumana 68008 Upgrade Board */ device.option_add("integrab", BBC_INTEGRAB); /* Computech Integra-B */ + device.option_add("memexb20", BBC_MEMEXB20); /* Memex-B20 RAM expansion */ device.option_add("mr3000", BBC_MR3000); /* Peartree MR3000 ROM board */ device.option_add("mr4200", BBC_MR4200); /* Peartree MR4200 RAM board */ device.option_add("mr4300", BBC_MR4300); /* Peartree MR4300 ROM/RAM board */ diff --git a/src/devices/bus/bbc/internal/memex.cpp b/src/devices/bus/bbc/internal/memex.cpp new file mode 100644 index 00000000000..809313e4c68 --- /dev/null +++ b/src/devices/bus/bbc/internal/memex.cpp @@ -0,0 +1,109 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Memex B20 20K RAM expansion + + This is a DIY project from the May 1984 issue of Electronics and + Computing, with part two of the project in the August 1984 issue. + +**********************************************************************/ + + +#include "emu.h" +#include "memex.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(BBC_MEMEXB20, bbc_memexb20_device, "bbc_memexb20", "Memex-B20 RAM expansion"); + + +//------------------------------------------------- +// ROM( memexb20 ) +//------------------------------------------------- + +ROM_START(memexb20) + ROM_REGION(0x2000, "exp_rom", 0) + ROM_LOAD("memex-b20_v2.2.rom", 0x0000, 0x2000, CRC(98ee8eb6) SHA1(aad311797e204b0b69450460f8b4605409c31ddd)) +ROM_END + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *bbc_memexb20_device::device_rom_region() const +{ + return ROM_NAME(memexb20); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// bbc_memexb20_device - constructor +//------------------------------------------------- + +bbc_memexb20_device::bbc_memexb20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, BBC_MEMEXB20, tag, owner, clock) + , device_bbc_internal_interface(mconfig, *this) + , m_shadow(false) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bbc_memexb20_device::device_start() +{ + address_space &program = m_maincpu->space(AS_PROGRAM); + + program.install_write_handler(0xd000, 0xd000, write8smo_delegate(*this, FUNC(bbc_memexb20_device::enable_w))); + program.install_write_handler(0xc000, 0xc000, write8smo_delegate(*this, FUNC(bbc_memexb20_device::disable_w))); + + m_ram = make_unique_clear<uint8_t[]>(0x5000); + + /* register for save states */ + save_item(NAME(m_shadow)); + save_pointer(NAME(m_ram), 0x5000); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +void bbc_memexb20_device::enable_w(uint8_t data) +{ + m_shadow = true; +} + +void bbc_memexb20_device::disable_w(uint8_t data) +{ + m_shadow = false; +} + +uint8_t bbc_memexb20_device::ram_r(offs_t offset) +{ + uint8_t data = 0xff; + + if (m_shadow && offset >= 0x3000) + data = m_ram[offset - 0x3000]; + else + data = m_mb_ram->pointer()[offset]; + + return data; +} + +void bbc_memexb20_device::ram_w(offs_t offset, uint8_t data) +{ + if (m_shadow && offset >= 0x3000) + m_ram[offset - 0x3000] = data; + else + m_mb_ram->pointer()[offset] = data; +} diff --git a/src/devices/bus/bbc/internal/memex.h b/src/devices/bus/bbc/internal/memex.h new file mode 100644 index 00000000000..1e4f07bcb16 --- /dev/null +++ b/src/devices/bus/bbc/internal/memex.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Memex B20 20K RAM expansion + +**********************************************************************/ + + +#ifndef MAME_BUS_BBC_INTERNAL_MEMEX_H +#define MAME_BUS_BBC_INTERNAL_MEMEX_H + +#include "internal.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class bbc_memexb20_device : public device_t, public device_bbc_internal_interface +{ +public: + // construction/destruction + bbc_memexb20_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 const tiny_rom_entry *device_rom_region() const override; + + virtual bool overrides_ram() override { return true; } + virtual uint8_t ram_r(offs_t offset) override; + virtual void ram_w(offs_t offset, uint8_t data) override; + +private: + void enable_w(uint8_t data); + void disable_w(uint8_t data); + + bool m_shadow; + std::unique_ptr<uint8_t[]> m_ram; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(BBC_MEMEXB20, bbc_memexb20_device); + + +#endif /* MAME_BUS_BBC_INTERNAL_MEMEX_H */ |