diff --git a/hash/electron_cart.xml b/hash/electron_cart.xml index 9be0196b06a..554f0ed0c0d 100644 --- a/hash/electron_cart.xml +++ b/hash/electron_cart.xml @@ -100,10 +100,10 @@ Acornsoft - + - + @@ -446,6 +446,19 @@ + + ROMPlus-144 + 1988 + JAFA Systems + + + + + + + + + Slogger Electron Disk System v1.00 1986 diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 31858f4ac61..30465695536 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -879,6 +879,8 @@ if (BUSES["ELECTRON_CART"]~=null) then MAME_DIR .. "src/devices/bus/electron/cart/mgc.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/romp144.cpp", + MAME_DIR .. "src/devices/bus/electron/cart/romp144.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", diff --git a/src/devices/bus/electron/cart/romp144.cpp b/src/devices/bus/electron/cart/romp144.cpp new file mode 100644 index 00000000000..6e4eb96bd84 --- /dev/null +++ b/src/devices/bus/electron/cart/romp144.cpp @@ -0,0 +1,162 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + JAFA Systems ROMPlus-144 + +**********************************************************************/ + + +#include "emu.h" +#include "romp144.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(ELECTRON_ROMP144, electron_romp144_device, "electron_romp144", "JAFA Systems ROMPlus-144") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void electron_romp144_device::device_add_mconfig(machine_config &config) +{ + /* rom sockets */ + GENERIC_SOCKET(config, m_romslot[0], generic_plain_slot, "electron_rom", "bin,rom"); + m_romslot[0]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom0, this)); + GENERIC_SOCKET(config, m_romslot[1], generic_plain_slot, "electron_rom", "bin,rom"); + m_romslot[1]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom1, this)); + GENERIC_SOCKET(config, m_romslot[2], generic_plain_slot, "electron_rom", "bin,rom"); + m_romslot[2]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom2, this)); + GENERIC_SOCKET(config, m_romslot[3], generic_plain_slot, "electron_rom", "bin,rom"); + m_romslot[3]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom3, this)); + GENERIC_SOCKET(config, m_romslot[4], generic_plain_slot, "electron_rom", "bin,rom"); + m_romslot[4]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom4, this)); + GENERIC_SOCKET(config, m_romslot[5], generic_plain_slot, "electron_rom", "bin,rom"); + m_romslot[5]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom5, this)); + GENERIC_SOCKET(config, m_romslot[6], generic_plain_slot, "electron_rom", "bin,rom"); + m_romslot[6]->set_device_load(device_image_load_delegate(&electron_romp144_device::device_image_load_rom6, this)); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_romp144_device - constructor +//------------------------------------------------- + +electron_romp144_device::electron_romp144_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ELECTRON_ROMP144, tag, owner, clock) + , device_electron_cart_interface(mconfig, *this) + , m_romslot(*this, "rom%u", 7) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_romp144_device::device_start() +{ + m_rom_select = 0xff; + m_rom_latch = 0xff; + + save_item(NAME(m_rom_select)); + save_item(NAME(m_rom_latch)); +} + +//------------------------------------------------- +// read - cartridge data read +//------------------------------------------------- + +uint8_t electron_romp144_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) +{ + uint8_t data = 0xff; + + if (oe) + { + if (romqa) + { + if ((m_rom_select & 0x07) == 0x00) + data = m_ram[offset & 0x3fff]; + else + data = m_romslot[(m_rom_select & 0x07) - 1]->read_rom(offset & 0x3fff); + } + else + { + if ((m_rom_select & 0x0f) == 0x08) + data = m_ram[(offset & 0x3fff) | 0x4000]; + else + data = m_rom[offset & 0x1fff]; + + /* roms selected with a read to latch */ + if ((offset & 0x3f00) == 0x3f00) + { + m_rom_latch = offset & 0x0f; + } + } + } + + return data; +} + +//------------------------------------------------- +// write - cartridge data write +//------------------------------------------------- + +void electron_romp144_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) +{ + if (oe) + { + if (romqa) + { + if ((m_rom_select & 0x07) == 0x00) + m_ram[offset & 0x3fff] = data; + } + else + { + if ((m_rom_select & 0x0f) == 0x08) + m_ram[(offset & 0x3fff) | 0x4000] = data; + + /* roms selected with a write to select */ + if ((offset & 0x3f00) == 0x3f00) + { + /* does the write match the read (upper RAM cannot be de-selected to protect *RSUBSTITUTE) */ + if (m_rom_latch == (offset & 0x0f) && m_rom_select != 0x08) + { + m_rom_select = m_rom_latch; + } + } + } + } +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +image_init_result electron_romp144_device::load_rom(device_image_interface &image, generic_slot_device *slot) +{ + uint32_t size = slot->common_get_size("rom"); + + // socket accepts 8K and 16K ROM only + if (size != 0x2000 && size != 0x4000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size: Only 8K/16K is supported"); + return image_init_result::FAIL; + } + + slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); + slot->common_load_rom(slot->get_rom_base(), size, "rom"); + + // mirror 8K ROMs + uint8_t *crt = slot->get_rom_base(); + if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000); + + return image_init_result::PASS; +} diff --git a/src/devices/bus/electron/cart/romp144.h b/src/devices/bus/electron/cart/romp144.h new file mode 100644 index 00000000000..45916a3ab38 --- /dev/null +++ b/src/devices/bus/electron/cart/romp144.h @@ -0,0 +1,60 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + JAFA Systems ROMPlus-144 + +**********************************************************************/ + +#ifndef MAME_BUS_ELECTRON_CART_ROMP144_H +#define MAME_BUS_ELECTRON_CART_ROMP144_H + +#include "slot.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class electron_romp144_device : + public device_t, + public device_electron_cart_interface +{ +public: + // construction/destruction + electron_romp144_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(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override; + virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override; + +private: + image_init_result load_rom(device_image_interface &image, generic_slot_device *slot); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom0) { return load_rom(image, m_romslot[0]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1) { return load_rom(image, m_romslot[1]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2) { return load_rom(image, m_romslot[2]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3) { return load_rom(image, m_romslot[3]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom4) { return load_rom(image, m_romslot[4]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom5) { return load_rom(image, m_romslot[5]); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom6) { return load_rom(image, m_romslot[6]); } + + required_device_array m_romslot; + + uint8_t m_rom_select; + uint8_t m_rom_latch; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(ELECTRON_ROMP144, electron_romp144_device) + + +#endif // MAME_BUS_ELECTRON_CART_ROMP144_H diff --git a/src/devices/bus/electron/cart/slot.cpp b/src/devices/bus/electron/cart/slot.cpp index 00ead3b654a..f8682b9c654 100644 --- a/src/devices/bus/electron/cart/slot.cpp +++ b/src/devices/bus/electron/cart/slot.cpp @@ -266,7 +266,9 @@ void electron_cartslot_device::write(offs_t offset, uint8_t data, int infc, int #include "cumana.h" #include "mgc.h" #include "peg400.h" -//#include "e2p.h" +//#include "pmse2p.h" +#include "romp144.h" +//#include "rs423.h" #include "sndexp.h" #include "sndexp3.h" #include "sp64.h" @@ -286,7 +288,9 @@ void electron_cart(device_slot_interface &device) device.option_add_internal("cumana", ELECTRON_CUMANA); device.option_add_internal("mgc", ELECTRON_MGC); device.option_add_internal("peg400", ELECTRON_PEG400); - //device.option_add_internal("e2p", ELECTRON_E2P); + //device.option_add_internal("pmse2p", ELECTRON_PMSE2P); + device.option_add_internal("romp144", ELECTRON_ROMP144); + //device.option_add_internal("rs423", ELECTRON_RS423); device.option_add_internal("sndexp", ELECTRON_SNDEXP); device.option_add_internal("sndexp3", ELECTRON_SNDEXP3); device.option_add_internal("sp64", ELECTRON_SP64);