electron: Amended cartridge slot interface to include OE and OE2 lines to specify ROM13.

- Added Slogger Plus 2 Expansion, Acorn Tube Interface and P.R.E.S. Advanced Plus 5 cartridge devices.
- Use derived 16Mhz clock on expansion bus and cartridge slots.
- Removed MCFG and added devcb3 in expansion and cartridge devices.
This commit is contained in:
Nigel Barnes 2019-01-23 02:06:55 +00:00
parent 709559b754
commit 89c09536ac
51 changed files with 1065 additions and 452 deletions

View File

@ -834,6 +834,8 @@ if (BUSES["ELECTRON"]~=null) then
MAME_DIR .. "src/devices/bus/electron/fbjoy.h",
MAME_DIR .. "src/devices/bus/electron/plus1.cpp",
MAME_DIR .. "src/devices/bus/electron/plus1.h",
MAME_DIR .. "src/devices/bus/electron/plus2.cpp",
MAME_DIR .. "src/devices/bus/electron/plus2.h",
MAME_DIR .. "src/devices/bus/electron/plus3.cpp",
MAME_DIR .. "src/devices/bus/electron/plus3.h",
MAME_DIR .. "src/devices/bus/electron/pwrjoy.cpp",
@ -861,6 +863,8 @@ if (BUSES["ELECTRON_CART"]~=null) then
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/ap5.cpp",
MAME_DIR .. "src/devices/bus/electron/cart/ap5.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",
@ -881,6 +885,8 @@ if (BUSES["ELECTRON_CART"]~=null) then
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",
MAME_DIR .. "src/devices/bus/electron/cart/tube.cpp",
MAME_DIR .. "src/devices/bus/electron/cart/tube.h",
}
end

View File

@ -46,16 +46,13 @@ void electron_abr_device::device_start()
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_abr_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_abr_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (!infc && !infd)
if (oe)
{
if (offset >= 0x0000 && offset < 0x4000)
{
data = m_nvram[(offset & 0x3fff) | (romqa << 14)];
}
data = m_nvram[(offset & 0x3fff) | (romqa << 14)];
}
return data;
@ -65,7 +62,7 @@ uint8_t electron_abr_device::read(address_space &space, offs_t offset, int infc,
// write - cartridge data write
//-------------------------------------------------
void electron_abr_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_abr_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -85,10 +82,9 @@ void electron_abr_device::write(address_space &space, offs_t offset, uint8_t dat
break;
}
}
if (!infc && !infd)
else if (oe)
{
if (offset >= 0x0000 && offset < 0x4000 && !m_bank_locked[romqa])
if (!m_bank_locked[romqa])
{
m_nvram[(offset & 0x3fff) | (romqa << 14)] = data;
}

View File

@ -32,8 +32,8 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
bool m_bank_locked[2];

View File

@ -47,7 +47,7 @@ void ap34_floppies(device_slot_interface &device)
void electron_ap34_device::device_add_mconfig(machine_config &config)
{
/* fdc */
WD1770(config, m_fdc, 16_MHz_XTAL / 2);
WD1770(config, m_fdc, DERIVED_CLOCK(1, 2));
FLOPPY_CONNECTOR(config, m_floppy0, ap34_floppies, "525qd", electron_ap34_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, ap34_floppies, nullptr, electron_ap34_device::floppy_formats).enable_sound(true);
}
@ -81,9 +81,9 @@ 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 electron_ap34_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xfe;
uint8_t data = 0xff;
if (infc)
{
@ -97,18 +97,16 @@ uint8_t electron_ap34_device::read(address_space &space, offs_t offset, int infc
break;
}
}
if (!infc && !infd)
else if (oe)
{
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];
}
else
{
data = m_rom[(offset & 0x3fff) | (romqa << 14)];
}
}
return data;
@ -118,7 +116,7 @@ uint8_t electron_ap34_device::read(address_space &space, offs_t offset, int infc
// write - cartridge data write
//-------------------------------------------------
void electron_ap34_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_ap34_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -135,8 +133,7 @@ void electron_ap34_device::write(address_space &space, offs_t offset, uint8_t da
break;
}
}
if (!infc && !infd)
else if (oe)
{
if (m_ram.size() != 0 && romqa == 0 && offset >= 0x3000)
{
@ -167,6 +164,7 @@ WRITE8_MEMBER(electron_ap34_device::wd1770_control_w)
m_fdc->dden_w(BIT(data, 3));
// bit 4: NMI - not connected
//m_slot->nmi_w(!BIT(data, 4));
// bit 5: reset
if (!BIT(data, 5)) m_fdc->soft_reset();

View File

@ -36,8 +36,8 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
DECLARE_WRITE8_MEMBER(wd1770_control_w);

View File

@ -0,0 +1,171 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
ACP Advanced Plus 5
**********************************************************************/
#include "emu.h"
#include "ap5.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(ELECTRON_AP5, electron_ap5_device, "electron_ap5", "P.R.E.S. Advanced Plus 5")
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void electron_ap5_device::device_add_mconfig(machine_config &config)
{
/* rom sockets */
GENERIC_SOCKET(config, m_romslot[0], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 14
m_romslot[0]->set_device_load(device_image_load_delegate(&electron_ap5_device::device_image_load_rom1_load, this));
GENERIC_SOCKET(config, m_romslot[1], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 15
m_romslot[1]->set_device_load(device_image_load_delegate(&electron_ap5_device::device_image_load_rom2_load, this));
/* via */
VIA6522(config, m_via, DERIVED_CLOCK(1, 16));
m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r));
m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w));
m_via->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
/* user port */
BBC_USERPORT_SLOT(config, m_userport, bbc_userport_devices, nullptr);
m_userport->cb1_handler().set(m_via, FUNC(via6522_device::write_cb1));
m_userport->cb2_handler().set(m_via, FUNC(via6522_device::write_cb2));
/* 1mhz bus port */
BBC_1MHZBUS_SLOT(config, m_1mhzbus, DERIVED_CLOCK(1, 16), bbc_1mhzbus_devices, nullptr);
m_1mhzbus->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
m_1mhzbus->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::nmi_w));
/* tube port */
BBC_TUBE_SLOT(config, m_tube, electron_tube_devices, nullptr);
m_tube->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// electron_ap5_device - constructor
//-------------------------------------------------
electron_ap5_device::electron_ap5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ELECTRON_AP5, tag, owner, clock)
, device_electron_cart_interface(mconfig, *this)
, m_via(*this, "via6522")
, m_tube(*this, "tube")
, m_1mhzbus(*this, "1mhzbus")
, m_userport(*this, "userport")
, m_romslot(*this, "rom%u", 1)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void electron_ap5_device::device_start()
{
}
//-------------------------------------------------
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_ap5_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (infc)
{
data = m_1mhzbus->fred_r(space, offset);
switch (offset & 0xf0)
{
case 0xb0:
data &= m_via->read(offset & 0x0f);
break;
case 0xe0:
data &= m_tube->host_r(space, offset & 0x0f);
break;
}
}
else if (infd)
{
data = m_1mhzbus->jim_r(space, offset);
}
else if (oe)
{
data = m_romslot[romqa]->read_rom(space, offset & 0x3fff);
}
else if (oe2)
{
data = m_rom[offset & 0x1fff];
}
return data;
}
//-------------------------------------------------
// write - cartridge data write
//-------------------------------------------------
void electron_ap5_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
m_1mhzbus->fred_w(space, offset, data);
switch (offset & 0xf0)
{
case 0xb0:
m_via->write(offset & 0x0f, data);
break;
case 0xe0:
m_tube->host_w(space, offset & 0x0f, data);
break;
}
}
else if (infd)
{
m_1mhzbus->jim_w(space, offset, data);
}
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
image_init_result electron_ap5_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;
}

View File

@ -0,0 +1,60 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
ACP Advanced Plus 5
**********************************************************************/
#ifndef MAME_BUS_ELECTRON_CART_AP5_H
#define MAME_BUS_ELECTRON_CART_AP5_H
#include "slot.h"
#include "machine/6522via.h"
#include "bus/bbc/1mhzbus/1mhzbus.h"
#include "bus/bbc/tube/tube.h"
#include "bus/bbc/userport/userport.h"
#include "bus/generic/slot.h"
#include "bus/generic/carts.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class electron_ap5_device :
public device_t,
public device_electron_cart_interface
{
public:
// construction/destruction
electron_ap5_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, int oe, int oe2) override;
virtual void write(address_space &space, 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(rom1_load) { return load_rom(image, m_romslot[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_romslot[1]); }
required_device<via6522_device> m_via;
required_device<bbc_tube_slot_device> m_tube;
required_device<bbc_1mhzbus_slot_device> m_1mhzbus;
required_device<bbc_userport_slot_device> m_userport;
required_device_array<generic_slot_device, 2> m_romslot;
};
// device type definition
DECLARE_DEVICE_TYPE(ELECTRON_AP5, electron_ap5_device)
#endif // MAME_BUS_ELECTRON_CART_AP5_H

View File

@ -48,16 +48,13 @@ void electron_aqr_device::device_start()
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_aqr_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_aqr_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (!infc && !infd)
if (oe)
{
if (offset >= 0x0000 && offset < 0x4000)
{
data = m_ram[(offset & 0x3fff) | (m_page_register << 14)];
}
data = m_ram[(offset & 0x3fff) | (m_page_register << 14)];
}
return data;
@ -67,7 +64,7 @@ uint8_t electron_aqr_device::read(address_space &space, offs_t offset, int infc,
// write - cartridge data write
//-------------------------------------------------
void electron_aqr_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_aqr_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -84,12 +81,8 @@ void electron_aqr_device::write(address_space &space, offs_t offset, uint8_t dat
break;
}
}
if (!infc && !infd)
else if (oe)
{
if (offset >= 0x0000 && offset < 0x4000 && !m_lock_register)
{
m_ram[(offset & 0x3fff) | (m_page_register << 14)] = data;
}
m_ram[(offset & 0x3fff) | (m_page_register << 14)] = data;
}
}

View File

@ -32,8 +32,8 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
uint8_t m_page_register;

View File

@ -27,7 +27,7 @@ void electron_click_device::device_add_mconfig(machine_config &config)
{
/* rtc */
MC146818(config, m_rtc, 32.768_kHz_XTAL);
m_rtc->irq().set(FUNC(electron_click_device::irq_w));
m_rtc->irq().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
}
//-------------------------------------------------
@ -88,7 +88,7 @@ void electron_click_device::device_reset()
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_click_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_click_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
@ -105,8 +105,7 @@ uint8_t electron_click_device::read(address_space &space, offs_t offset, int inf
break;
}
}
if (!infc && !infd)
else if (oe)
{
offs_t rom_page_offset = (m_page_register & 0x03) * 0x2000;
offs_t ram_page_offset = ((m_page_register & 0x0c) >> 2) * 0x2000;
@ -128,7 +127,7 @@ uint8_t electron_click_device::read(address_space &space, offs_t offset, int inf
// write - cartridge data write
//-------------------------------------------------
void electron_click_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_click_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -143,8 +142,7 @@ void electron_click_device::write(address_space &space, offs_t offset, uint8_t d
break;
}
}
if (!infc && !infd)
else if (oe)
{
offs_t ram_page_offset = ((m_page_register & 0x0c) >> 2) * 0x2000;
@ -166,8 +164,3 @@ INPUT_CHANGED_MEMBER(electron_click_device::click_button)
m_slot->irq_w(CLEAR_LINE);
}
}
WRITE_LINE_MEMBER(electron_click_device::irq_w)
{
m_slot->irq_w(state);
}

View File

@ -41,12 +41,10 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
DECLARE_WRITE_LINE_MEMBER(irq_w);
required_device<mc146818_device> m_rtc;
uint8_t m_page_register;

View File

@ -48,12 +48,13 @@ void cumana_floppies(device_slot_interface &device)
void electron_cumana_device::device_add_mconfig(machine_config &config)
{
/* fdc */
FD1793(config, m_fdc, 16_MHz_XTAL / 16); // TODO: Not known whether DRQ and INTRQ are connected
FD1793(config, m_fdc, DERIVED_CLOCK(1, 16)); // TODO: Not known whether DRQ and INTRQ are connected
FLOPPY_CONNECTOR(config, m_floppy0, cumana_floppies, "525qd", electron_cumana_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, cumana_floppies, nullptr, electron_cumana_device::floppy_formats).enable_sound(true);
/* rtc */
MC146818(config, m_rtc, 32.768_kHz_XTAL);
m_rtc->irq().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
}
//**************************************************************************
@ -86,7 +87,7 @@ 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 electron_cumana_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
@ -106,8 +107,7 @@ uint8_t electron_cumana_device::read(address_space &space, offs_t offset, int in
break;
}
}
if (!infc && !infd)
else if (oe)
{
switch (romqa)
{
@ -134,7 +134,7 @@ uint8_t electron_cumana_device::read(address_space &space, offs_t offset, int in
// write - cartridge data write
//-------------------------------------------------
void electron_cumana_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_cumana_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -156,8 +156,7 @@ void electron_cumana_device::write(address_space &space, offs_t offset, uint8_t
break;
}
}
if (!infc && !infd)
else if (oe)
{
if (romqa == 0 && offset >= 0x3800)
{

View File

@ -37,8 +37,8 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
DECLARE_WRITE8_MEMBER(wd1793_control_w);

View File

@ -65,17 +65,14 @@ void electron_mgc_device::device_reset()
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_mgc_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_mgc_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (!infc && !infd)
if (oe)
{
if (offset >= 0x0000 && offset < 0x4000)
{
int m_page_mode = BIT(m_control_latch, 2) ? BIT(m_control_latch, 1) : !romqa;
data = m_nvram[(offset & 0x3fff) | (m_page_latch << 14) | (m_page_mode << 21)];
}
int m_page_mode = BIT(m_control_latch, 2) ? BIT(m_control_latch, 1) : !romqa;
data = m_nvram[(offset & 0x3fff) | (m_page_latch << 14) | (m_page_mode << 21)];
}
return data;
@ -85,7 +82,7 @@ uint8_t electron_mgc_device::read(address_space &space, offs_t offset, int infc,
// write - cartridge data write
//-------------------------------------------------
void electron_mgc_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_mgc_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -100,13 +97,9 @@ void electron_mgc_device::write(address_space &space, offs_t offset, uint8_t dat
break;
}
}
if (!infc && !infd)
else if (oe)
{
if (offset >= 0x0000 && offset < 0x4000 && BIT(m_control_latch, 0))
{
int m_page_mode = BIT(m_control_latch, 2) ? BIT(m_control_latch, 1) : !romqa;
m_nvram[(offset & 0x3fff) | (m_page_latch << 14) | (m_page_mode << 21)] = data;
}
int m_page_mode = BIT(m_control_latch, 2) ? BIT(m_control_latch, 1) : !romqa;
m_nvram[(offset & 0x3fff) | (m_page_latch << 14) | (m_page_mode << 21)] = data;
}
}

View File

@ -33,8 +33,8 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
uint8_t m_page_latch;

View File

@ -44,7 +44,7 @@ void peg400_floppies(device_slot_interface &device)
void electron_peg400_device::device_add_mconfig(machine_config &config)
{
/* fdc */
WD1770(config, m_fdc, 16_MHz_XTAL / 2);
WD1770(config, m_fdc, DERIVED_CLOCK(1, 2));
m_fdc->drq_wr_callback().set(FUNC(electron_peg400_device::fdc_drq_w));
FLOPPY_CONNECTOR(config, m_floppy0, peg400_floppies, "525qd", electron_peg400_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, peg400_floppies, nullptr, electron_peg400_device::floppy_formats).enable_sound(true);
@ -79,7 +79,7 @@ void electron_peg400_device::device_start()
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_peg400_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_peg400_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
@ -95,15 +95,14 @@ uint8_t electron_peg400_device::read(address_space &space, offs_t offset, int in
break;
}
}
if (!infc && !infd)
else if (oe)
{
switch (romqa)
{
case 0:
if (offset < 0x3800)
{
data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)];
data = m_rom[(offset & 0x3fff) | (romqa << 14)];
}
else
{
@ -111,7 +110,7 @@ uint8_t electron_peg400_device::read(address_space &space, offs_t offset, int in
}
break;
case 1:
data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)];
data = m_rom[(offset & 0x3fff) | (romqa << 14)];
break;
}
}
@ -123,7 +122,7 @@ uint8_t electron_peg400_device::read(address_space &space, offs_t offset, int in
// write - cartridge data write
//-------------------------------------------------
void electron_peg400_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_peg400_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -140,8 +139,7 @@ void electron_peg400_device::write(address_space &space, offs_t offset, uint8_t
break;
}
}
if (!infc && !infd)
else if (oe)
{
if (romqa == 0 && offset >= 0x3800)
{

View File

@ -34,8 +34,8 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
DECLARE_WRITE8_MEMBER(wd1770_control_w);

View File

@ -99,14 +99,6 @@ electron_cartslot_device::electron_cartslot_device(const machine_config &mconfig
{
}
//-------------------------------------------------
// electron_cartslot_device - destructor
//-------------------------------------------------
electron_cartslot_device::~electron_cartslot_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@ -237,13 +229,13 @@ std::string electron_cartslot_device::get_default_card_software(get_default_card
// read - cartridge read
//-------------------------------------------------
uint8_t electron_cartslot_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_cartslot_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (m_cart != nullptr)
{
data = m_cart->read(space, offset, infc, infd, romqa);
data = m_cart->read(space, offset, infc, infd, romqa, oe, oe2);
}
return data;
@ -253,11 +245,11 @@ uint8_t electron_cartslot_device::read(address_space &space, offs_t offset, int
// write - cartridge write
//-------------------------------------------------
void electron_cartslot_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_cartslot_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (m_cart != nullptr)
{
m_cart->write(space, offset, data, infc, infd, romqa);
m_cart->write(space, offset, data, infc, infd, romqa, oe, oe2);
}
}
@ -268,15 +260,18 @@ void electron_cartslot_device::write(address_space &space, offs_t offset, uint8_
#include "abr.h"
#include "ap34.h"
#include "ap5.h"
#include "aqr.h"
#include "click.h"
#include "cumana.h"
#include "mgc.h"
#include "peg400.h"
//#include "e2p.h"
#include "sndexp.h"
#include "sndexp3.h"
#include "sp64.h"
#include "stlefs.h"
#include "tube.h"
#include "std.h"
@ -285,13 +280,16 @@ void electron_cart(device_slot_interface &device)
device.option_add_internal("std", ELECTRON_STDCART);
device.option_add_internal("abr", ELECTRON_ABR);
device.option_add_internal("ap34", ELECTRON_AP34);
device.option_add_internal("ap5", ELECTRON_AP5);
device.option_add_internal("aqr", ELECTRON_AQR);
device.option_add_internal("click", ELECTRON_CLICK);
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("sndexp", ELECTRON_SNDEXP);
device.option_add_internal("sndexp3", ELECTRON_SNDEXP3);
device.option_add_internal("sp64", ELECTRON_SP64);
device.option_add_internal("stlefs", ELECTRON_STLEFS);
device.option_add_internal("tube", ELECTRON_TUBE);
}

View File

@ -105,16 +105,6 @@
#define ELECTRON_CART_ROM_REGION_TAG ":cart:rom"
#define MCFG_ELECTRON_CARTSLOT_ADD(_tag, _slot_intf, _def_slot) \
MCFG_DEVICE_ADD(_tag, ELECTRON_CARTSLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
#define MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(_devcb) \
downcast<electron_cartslot_device &>(*device).set_irq_handler(DEVCB_##_devcb);
#define MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(_devcb) \
downcast<electron_cartslot_device &>(*device).set_nmi_handler(DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
@ -130,12 +120,21 @@ class electron_cartslot_device : public device_t,
{
public:
// construction/destruction
template <typename T>
electron_cartslot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&slot_options, const char *default_option)
: electron_cartslot_device(mconfig, tag, owner, clock)
{
option_reset();
slot_options(*this);
set_default_option(default_option);
set_fixed(false);
}
electron_cartslot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~electron_cartslot_device();
// callbacks
template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_nmi_handler(Object &&cb) { return m_nmi_handler.set_callback(std::forward<Object>(cb)); }
auto irq_handler() { return m_irq_handler.bind(); }
auto nmi_handler() { return m_nmi_handler.bind(); }
// device-level overrides
virtual void device_start() override;
@ -159,8 +158,8 @@ public:
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// reading and writing
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa);
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa);
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2);
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2);
DECLARE_WRITE_LINE_MEMBER(irq_w) { m_irq_handler(state); }
DECLARE_WRITE_LINE_MEMBER(nmi_w) { m_nmi_handler(state); }
@ -183,8 +182,8 @@ public:
virtual ~device_electron_cart_interface();
// reading and writing
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa) { return 0xff; }
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa) { }
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) { return 0xff; }
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) { }
void rom_alloc(uint32_t size, const char *tag);
void ram_alloc(uint32_t size);

View File

@ -27,11 +27,13 @@ DEFINE_DEVICE_TYPE(ELECTRON_SNDEXP, electron_sndexp_device, "electron_sndexp", "
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_START(electron_sndexp_device::device_add_mconfig)
void electron_sndexp_device::device_add_mconfig(machine_config &config)
{
/* sound hardware */
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("sn76489", SN76489, 16_MHz_XTAL / 4)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_CONFIG_END
SN76489(config, m_sn, DERIVED_CLOCK(1, 4));
m_sn->add_route(ALL_OUTPUTS, "mono", 1.0);
}
//-------------------------------------------------
// INPUT_PORTS( sndexp )
@ -87,11 +89,11 @@ void electron_sndexp_device::device_start()
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_sndexp_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_sndexp_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (!infc && !infd)
if (oe)
{
if (m_jumper->read())
{
@ -124,7 +126,7 @@ uint8_t electron_sndexp_device::read(address_space &space, offs_t offset, int in
// write - cartridge data write
//-------------------------------------------------
void electron_sndexp_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_sndexp_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -142,8 +144,7 @@ void electron_sndexp_device::write(address_space &space, offs_t offset, uint8_t
break;
}
}
if (!infc && !infd)
else if (oe)
{
if (m_jumper->read())
{

View File

@ -33,8 +33,8 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
required_device<sn76489_device> m_sn;

View File

@ -23,12 +23,13 @@ DEFINE_DEVICE_TYPE(ELECTRON_SNDEXP3, electron_sndexp3_device, "electron_sndexp3"
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_START(electron_sndexp3_device::device_add_mconfig)
void electron_sndexp3_device::device_add_mconfig(machine_config &config)
{
/* sound hardware */
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("sn76489", SN76489, 16_MHz_XTAL / 4)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_CONFIG_END
SN76489(config, m_sn, DERIVED_CLOCK(1, 4));
m_sn->add_route(ALL_OUTPUTS, "mono", 1.0);
}
//**************************************************************************
// LIVE DEVICE
@ -61,11 +62,11 @@ void electron_sndexp3_device::device_start()
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_sndexp3_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_sndexp3_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (!infc && !infd && romqa)
if (oe && romqa)
{
if (offset < 0x2000)
{
@ -84,7 +85,7 @@ uint8_t electron_sndexp3_device::read(address_space &space, offs_t offset, int i
// write - cartridge data write
//-------------------------------------------------
void electron_sndexp3_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_sndexp3_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -102,8 +103,7 @@ void electron_sndexp3_device::write(address_space &space, offs_t offset, uint8_t
break;
}
}
if (!infc && !infd && romqa)
else if (oe && romqa)
{
if (offset >= 0x2000)
{

View File

@ -32,8 +32,8 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
required_device<sn76489_device> m_sn;

View File

@ -55,7 +55,7 @@ void electron_sp64_device::device_reset()
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_sp64_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_sp64_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
@ -68,15 +68,14 @@ uint8_t electron_sp64_device::read(address_space &space, offs_t offset, int infc
break;
}
}
if (!infc && !infd)
else if (oe)
{
offs_t rom_page_offset = m_page_register * 0x4000;
offs_t rom_page_offset = m_page_register << 14;
switch (romqa)
{
case 0:
data = m_rom[rom_page_offset + (offset & 0x3fff)];
data = m_rom[rom_page_offset | (offset & 0x3fff)];
break;
case 1:
data = m_ram[offset & 0x1fff];
@ -91,7 +90,7 @@ uint8_t electron_sp64_device::read(address_space &space, offs_t offset, int infc
// write - cartridge data write
//-------------------------------------------------
void electron_sp64_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_sp64_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -102,8 +101,7 @@ void electron_sp64_device::write(address_space &space, offs_t offset, uint8_t da
break;
}
}
if (!infc && !infd)
else if (oe)
{
if (romqa == 1)
{

View File

@ -33,8 +33,8 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
uint8_t m_page_register;

View File

@ -43,13 +43,13 @@ void electron_stdcart_device::device_start()
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_stdcart_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa)
uint8_t electron_stdcart_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (!infc && !infd)
if (oe)
{
data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)];
data = m_rom[(offset & 0x3fff) | (romqa << 14)];
}
return data;

View File

@ -31,7 +31,7 @@ protected:
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 uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
};
// device type definition

View File

@ -47,9 +47,9 @@ void stlefs_floppies(device_slot_interface &device)
void electron_stlefs_device::device_add_mconfig(machine_config &config)
{
/* fdc */
WD1770(config, m_fdc, 16_MHz_XTAL / 2);
m_fdc->intrq_wr_callback().set(FUNC(electron_stlefs_device::fdc_intrq_w));
m_fdc->drq_wr_callback().set(FUNC(electron_stlefs_device::fdc_drq_w));
WD1770(config, m_fdc, DERIVED_CLOCK(1, 2));
m_fdc->intrq_wr_callback().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
m_fdc->drq_wr_callback().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::nmi_w));
FLOPPY_CONNECTOR(config, m_floppy0, stlefs_floppies, "525qd", electron_stlefs_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, stlefs_floppies, nullptr, electron_stlefs_device::floppy_formats).enable_sound(true);
}
@ -83,7 +83,7 @@ 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 electron_stlefs_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
@ -99,13 +99,9 @@ uint8_t electron_stlefs_device::read(address_space &space, offs_t offset, int in
break;
}
}
if (!infc && !infd)
else if (oe)
{
if (offset >= 0x0000 && offset < 0x4000)
{
data = m_rom[(offset & 0x3fff) + (romqa * 0x4000)];
}
data = m_rom[(offset & 0x3fff) | (romqa << 14)];
}
return data;
@ -115,7 +111,7 @@ uint8_t electron_stlefs_device::read(address_space &space, offs_t offset, int in
// write - cartridge data write
//-------------------------------------------------
void electron_stlefs_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa)
void electron_stlefs_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
@ -160,13 +156,3 @@ WRITE8_MEMBER(electron_stlefs_device::wd1770_control_w)
// 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);
}

View File

@ -36,13 +36,11 @@ protected:
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;
virtual uint8_t read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) 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<wd1770_device> m_fdc;

View File

@ -0,0 +1,91 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Acorn Electron Tube Interface
**********************************************************************/
#include "emu.h"
#include "tube.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(ELECTRON_TUBE, electron_tube_device, "electron_tube", "Acorn Electron Tube Interface")
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void electron_tube_device::device_add_mconfig(machine_config &config)
{
/* tube port */
BBC_TUBE_SLOT(config, m_tube, electron_tube_devices, nullptr);
m_tube->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// electron_tube_device - constructor
//-------------------------------------------------
electron_tube_device::electron_tube_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ELECTRON_TUBE, tag, owner, clock)
, device_electron_cart_interface(mconfig, *this)
, m_tube(*this, "tube")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void electron_tube_device::device_start()
{
}
//-------------------------------------------------
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_tube_device::read(address_space &space, offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (infc)
{
if (offset >= 0xe0 && offset < 0xf0)
{
data = m_tube->host_r(space, offset & 0x0f);
}
}
else if (oe2)
{
data = m_rom[offset & 0x1fff];
}
return data;
}
//-------------------------------------------------
// write - cartridge data write
//-------------------------------------------------
void electron_tube_device::write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
if (offset >= 0xe0 && offset < 0xf0)
{
m_tube->host_w(space, offset & 0x0f, data);
}
}
}

View File

@ -0,0 +1,47 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Acorn Electron Tube Interface
**********************************************************************/
#ifndef MAME_BUS_ELECTRON_CART_TUBE_H
#define MAME_BUS_ELECTRON_CART_TUBE_H
#include "slot.h"
#include "bus/bbc/tube/tube.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class electron_tube_device :
public device_t,
public device_electron_cart_interface
{
public:
// construction/destruction
electron_tube_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, int oe, int oe2) override;
virtual void write(address_space &space, offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
required_device<bbc_tube_slot_device> m_tube;
};
// device type definition
DECLARE_DEVICE_TYPE(ELECTRON_TUBE, electron_tube_device)
#endif // MAME_BUS_ELECTRON_CART_TUBE_H

View File

@ -32,15 +32,6 @@ device_electron_expansion_interface::device_electron_expansion_interface(const m
}
//-------------------------------------------------
// ~device_electron_expansion_interface - destructor
//-------------------------------------------------
device_electron_expansion_interface::~device_electron_expansion_interface()
{
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@ -59,15 +50,6 @@ electron_expansion_slot_device::electron_expansion_slot_device(const machine_con
}
//-------------------------------------------------
// expansion_slot_device - destructor
//-------------------------------------------------
electron_expansion_slot_device::~electron_expansion_slot_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@ -93,11 +75,13 @@ void electron_expansion_slot_device::device_reset()
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_expansion_slot_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
uint8_t electron_expansion_slot_device::expbus_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
if (m_card != nullptr)
{
data = m_card->expbus_r(space, offset, data);
data = m_card->expbus_r(space, offset);
}
return data;
@ -126,6 +110,7 @@ void electron_expansion_slot_device::expbus_w(address_space &space, offs_t offse
//#include "fbprint.h"
//#include "jafamode7.h"
#include "plus1.h"
#include "plus2.h"
#include "plus3.h"
#include "pwrjoy.h"
#include "rombox.h"
@ -140,6 +125,7 @@ void electron_expansion_devices(device_slot_interface &device)
//device.option_add("fbprint", ELECTRON_FBPRINT);
//device.option_add("jafamode7", ELECTRON_JAFAMODE7);
device.option_add("plus1", ELECTRON_PLUS1);
device.option_add("plus2", ELECTRON_PLUS2);
device.option_add("plus3", ELECTRON_PLUS3);
device.option_add("pwrjoy", ELECTRON_PWRJOY);
device.option_add("rombox", ELECTRON_ROMBOX);

View File

@ -90,33 +90,6 @@ AC RETURNS (pins 3,4) - adaptor. A total of 6W may be drawn from these lines as
//**************************************************************************
// CONSTANTS
//**************************************************************************
#define ELECTRON_EXPANSION_SLOT_TAG "exp"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_ELECTRON_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot, _fixed) \
MCFG_DEVICE_ADD(_tag, ELECTRON_EXPANSION_SLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
#define MCFG_ELECTRON_PASSTHRU_EXPANSION_SLOT_ADD(_def_slot) \
MCFG_ELECTRON_EXPANSION_SLOT_ADD(ELECTRON_EXPANSION_SLOT_TAG, electron_expansion_devices, _def_slot, false) \
MCFG_ELECTRON_EXPANSION_SLOT_IRQ_HANDLER(WRITELINE(DEVICE_SELF_OWNER, electron_expansion_slot_device, irq_w)) \
MCFG_ELECTRON_EXPANSION_SLOT_NMI_HANDLER(WRITELINE(DEVICE_SELF_OWNER, electron_expansion_slot_device, nmi_w))
#define MCFG_ELECTRON_EXPANSION_SLOT_IRQ_HANDLER(_devcb) \
downcast<electron_expansion_slot_device &>(*device).set_irq_handler(DEVCB_##_devcb);
#define MCFG_ELECTRON_EXPANSION_SLOT_NMI_HANDLER(_devcb) \
downcast<electron_expansion_slot_device &>(*device).set_nmi_handler(DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@ -129,14 +102,22 @@ class electron_expansion_slot_device : public device_t, public device_slot_inter
{
public:
// construction/destruction
template <typename T>
electron_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&opts, const char *dflt)
: electron_expansion_slot_device(mconfig, tag, owner, clock)
{
option_reset();
opts(*this);
set_default_option(dflt);
set_fixed(false);
}
electron_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~electron_expansion_slot_device();
// callbacks
template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_nmi_handler(Object &&cb) { return m_nmi_handler.set_callback(std::forward<Object>(cb)); }
auto irq_handler() { return m_irq_handler.bind(); }
auto nmi_handler() { return m_nmi_handler.bind(); }
uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data);
uint8_t expbus_r(address_space &space, offs_t offset);
void expbus_w(address_space &space, offs_t offset, uint8_t data);
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); }
@ -160,10 +141,7 @@ private:
class device_electron_expansion_interface : public device_slot_card_interface
{
public:
// construction/destruction
virtual ~device_electron_expansion_interface();
virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) { return data; }
virtual uint8_t expbus_r(address_space &space, offs_t offset) { return 0xff; }
virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) { }
protected:

View File

@ -67,8 +67,10 @@ void electron_fbjoy_device::device_start()
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_fbjoy_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
uint8_t electron_fbjoy_device::expbus_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
if (offset == 0xfcc0)
{
data = m_joy->read() | 0xe0;

View File

@ -33,7 +33,7 @@ public:
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
virtual uint8_t expbus_r(address_space &space, offs_t offset) override;
protected:
// device-level overrides

View File

@ -59,27 +59,27 @@ void electron_m2105_device::device_add_mconfig(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
INPUT_MERGER_ANY_HIGH(config, m_irqs);
m_irqs->output_handler().set(FUNC(electron_m2105_device::intrq_w));
INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
/* nvram */
RAM(config, m_ram).set_default_size("64K");
/* system via */
VIA6522(config, m_via6522_0, 1000000);
/*m_via6522_0->readpa_handler().set(FUNC(electron_m2105_device::m2105_via_system_read_porta));
m_via6522_0->readpb_handler().set(FUNC(electron_m2105_device::m2105_via_system_read_portb));
m_via6522_0->writepa_handler().set(FUNC(electron_m2105_device::m2105_via_system_write_porta));
m_via6522_0->writepb_handler().set(FUNC(electron_m2105_device::m2105_via_system_write_portb));*/
VIA6522(config, m_via6522_0, DERIVED_CLOCK(1, 16));
//m_via6522_0->readpa_handler().set(FUNC(electron_m2105_device::m2105_via_system_read_porta));
m_via6522_0->readpb_handler().set(m_tms, FUNC(tms5220_device::status_r));
//m_via6522_0->writepa_handler().set(FUNC(electron_m2105_device::m2105_via_system_write_porta));
m_via6522_0->writepb_handler().set(m_tms, FUNC(tms5220_device::data_w));
m_via6522_0->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>));
/* user via */
VIA6522(config, m_via6522_1, 1000000);
//m_via6522_1->readpb_handler().set(FUNC(electron_m2105_device::m2105_via_user_read_portb));
m_via6522_1->writepa_handler().set("cent_data_out", FUNC(output_latch_device::bus_w));
//m_via6522_1->writepb_handler().set(FUNC(electron_m2105_device::m2105_via_user_write_portb));
VIA6522(config, m_via6522_1, DERIVED_CLOCK(1, 16));
m_via6522_1->writepb_handler().set("cent_data_out", FUNC(output_latch_device::bus_w));
m_via6522_1->ca2_handler().set(m_centronics, FUNC(centronics_device::write_strobe));
m_via6522_1->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>));
/* duart */
SCN2681(config, m_duart, XTAL(3'686'400));
/* duart */
SCN2681(config, m_duart, XTAL(3'686'400)); // TODO: confirm clock
m_duart->irq_cb().set(m_irqs, FUNC(input_merger_device::in_w<2>));
m_duart->a_tx_cb().set("rs232", FUNC(rs232_port_device::write_txd));
//m_duart->outport_cb().set(FUNC(electron_m2105_device::sio_out_w));
@ -93,10 +93,14 @@ void electron_m2105_device::device_add_mconfig(machine_config &config)
output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
m_centronics->set_output_latch(latch);
/* AM7910 modem */
/* speech hardware */
SPEECHROM(config, "vsm", 0);
TMS5220(config, m_tms, 640000);
m_tms->set_speechrom_tag("vsm");
//m_tms->irq_handler().set(m_via6522_0, FUNC(via6522_device::write_cb1));
//m_tms->readyq_handler().set(m_via6522_0, FUNC(via6522_device::write_cb2));
m_tms->add_route(ALL_OUTPUTS, "mono", 1.0);
}
@ -117,12 +121,14 @@ electron_m2105_device::electron_m2105_device(const machine_config &mconfig, cons
: device_t(mconfig, ELECTRON_M2105, tag, owner, clock)
, device_electron_expansion_interface(mconfig, *this)
, m_exp_rom(*this, "exp_rom")
, m_ram(*this, RAM_TAG)
, m_via6522_0(*this, "via6522_0")
, m_via6522_1(*this, "via6522_1")
, m_duart(*this, "duart")
, m_tms(*this, "tms5220")
, m_centronics(*this, "centronics")
, m_irqs(*this, "irqs")
, m_ram_page(0)
, m_romsel(0)
{
}
@ -133,7 +139,7 @@ electron_m2105_device::electron_m2105_device(const machine_config &mconfig, cons
void electron_m2105_device::device_start()
{
m_slot = dynamic_cast<electron_expansion_slot_device *>(owner());
save_item(NAME(m_ram_page));
}
//-------------------------------------------------
@ -148,37 +154,57 @@ void electron_m2105_device::device_reset()
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_m2105_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
uint8_t electron_m2105_device::expbus_r(address_space &space, offs_t offset)
{
if (offset >= 0x8000 && offset < 0xc000)
uint8_t data = 0xff;
switch (offset >> 12)
{
case 0x8:
case 0x9:
case 0xa:
case 0xb:
switch (m_romsel)
{
case 0:
data = m_exp_rom->base()[0x8000 + (offset & 0x3fff)];
data = m_exp_rom->base()[0x8000 | (offset & 0x3fff)];
break;
case 2:
data = m_exp_rom->base()[0xc000 + (offset & 0x3fff)];
data = m_exp_rom->base()[0xc000 | (offset & 0x3fff)];
break;
case 12:
data = m_exp_rom->base()[0x0000 + (offset & 0x3fff)];
data = m_exp_rom->base()[0x0000 | (offset & 0x3fff)];
break;
case 13:
data = m_exp_rom->base()[0x4000 + (offset & 0x3fff)];
data = m_exp_rom->base()[0x4000 | (offset & 0x3fff)];
break;
}
break;
case 0xf:
switch (offset >> 8)
{
case 0xfc:
logerror("read %04x\n", offset);
if (offset >= 0xfc50 && offset < 0xfc60)
{
data = m_duart->read(offset & 0x0f);
}
else if (offset >= 0xfc60 && offset < 0xfc70)
{
data = m_via6522_1->read(offset & 0x0f);
}
else if (offset >= 0xfc70 && offset < 0xfc80)
{
data = m_via6522_0->read(offset & 0x0f);
}
break;
case 0xfd:
//if (m_ram_page < 0x80)
data = m_ram->pointer()[(m_ram_page << 8) | (offset & 0xff)];
break;
}
}
else if (offset >= 0xfc40 && offset < 0xfc60)
{
data = m_via6522_1->read(offset);
}
else if (offset >= 0xfc60 && offset < 0xfc70)
{
data = m_duart->read(offset & 0x0f);
}
else if (offset >= 0xfc70 && offset < 0xfc90)
{
data = m_via6522_0->read(offset);
}
return data;
@ -190,34 +216,42 @@ uint8_t electron_m2105_device::expbus_r(address_space &space, offs_t offset, uin
void electron_m2105_device::expbus_w(address_space &space, offs_t offset, uint8_t data)
{
if (offset >= 0x8000 && offset < 0xc000)
switch (offset >> 12)
{
logerror("write ram bank %d\n", m_romsel);
}
else if (offset >= 0xfc40 && offset < 0xfc60)
{
m_via6522_1->write(offset, data);
}
else if (offset >= 0xfc60 && offset < 0xfc70)
{
m_duart->write(offset & 0x0f, data);
}
else if (offset >= 0xfc70 && offset < 0xfc90)
{
m_via6522_0->write(offset, data);
}
else if (offset == 0xfe05)
{
m_romsel = data & 0x0f;
case 0xf:
switch (offset >> 8)
{
case 0xfc:
logerror("write %04x %02x\n", offset, data);
if (offset >= 0xfc50 && offset < 0xfc60)
{
m_duart->write(offset & 0x0f, data);
}
else if (offset >= 0xfc60 && offset < 0xfc70)
{
m_via6522_1->write(offset & 0x0f, data);
}
else if (offset >= 0xfc70 && offset < 0xfc80)
{
m_via6522_0->write(offset & 0x0f, data);
}
else if (offset == 0xfcff)
{
m_ram_page = data;
}
break;
case 0xfd:
//if (m_ram_page < 0x80)
m_ram->pointer()[(m_ram_page << 8) | (offset & 0xff)] = data;
break;
case 0xfe:
if (offset == 0xfe05)
{
m_romsel = data & 0x0f;
}
break;
}
}
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
WRITE_LINE_MEMBER(electron_m2105_device::intrq_w)
{
m_slot->irq_w(state);
}

View File

@ -12,6 +12,7 @@
#pragma once
#include "exp.h"
#include "machine/ram.h"
#include "machine/6522via.h"
#include "machine/mc68681.h"
#include "machine/input_merger.h"
@ -40,13 +41,12 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
virtual uint8_t expbus_r(address_space &space, offs_t offset) override;
virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:
DECLARE_WRITE_LINE_MEMBER(intrq_w);
required_memory_region m_exp_rom;
required_device<ram_device> m_ram;
required_device<via6522_device> m_via6522_0;
required_device<via6522_device> m_via6522_1;
required_device<scn2681_device> m_duart;
@ -54,6 +54,7 @@ private:
required_device<centronics_device> m_centronics;
required_device<input_merger_device> m_irqs;
uint8_t m_ram_page;
uint8_t m_romsel;
};

View File

@ -90,11 +90,13 @@ ioport_constructor electron_plus1_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_START(electron_plus1_device::device_add_mconfig)
void electron_plus1_device::device_add_mconfig(machine_config &config)
{
/* printer */
MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, electron_plus1_device, busy_w))
MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
CENTRONICS(config, m_centronics, centronics_devices, "printer");
m_centronics->busy_handler().set(FUNC(electron_plus1_device::busy_w));
output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
m_centronics->set_output_latch(latch);
/* adc */
ADC0844(config, m_adc);
@ -105,13 +107,13 @@ MACHINE_CONFIG_START(electron_plus1_device::device_add_mconfig)
m_adc->ch4_callback().set_ioport("JOY4");
/* cartridges */
MCFG_ELECTRON_CARTSLOT_ADD("cart_sk1", electron_cart, nullptr)
MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(WRITELINE(*this, electron_plus1_device, irq_w))
MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(WRITELINE(*this, electron_plus1_device, nmi_w))
MCFG_ELECTRON_CARTSLOT_ADD("cart_sk2", electron_cart, nullptr)
MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(WRITELINE(*this, electron_plus1_device, irq_w))
MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(WRITELINE(*this, electron_plus1_device, nmi_w))
MACHINE_CONFIG_END
ELECTRON_CARTSLOT(config, m_cart_sk1, DERIVED_CLOCK(1, 1), electron_cart, nullptr);
m_cart_sk1->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
m_cart_sk1->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
ELECTRON_CARTSLOT(config, m_cart_sk2, DERIVED_CLOCK(1, 1), electron_cart, nullptr);
m_cart_sk2->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
m_cart_sk2->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
}
//-------------------------------------------------
// rom_region - device-specific ROM region
@ -154,7 +156,6 @@ electron_plus1_device::electron_plus1_device(const machine_config &mconfig, cons
void electron_plus1_device::device_start()
{
m_slot = dynamic_cast<electron_expansion_slot_device *>(owner());
}
@ -162,8 +163,10 @@ void electron_plus1_device::device_start()
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_plus1_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
uint8_t electron_plus1_device::expbus_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
switch (offset >> 12)
{
case 0x8:
@ -174,15 +177,19 @@ uint8_t electron_plus1_device::expbus_r(address_space &space, offs_t offset, uin
{
case 0:
case 1:
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, 1, 0);
break;
case 2:
case 3:
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, 1, 0);
break;
case 12:
data = m_exp_rom->base()[offset & 0x1fff];
break;
case 13:
data &= m_cart_sk1->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
data &= m_cart_sk2->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
break;
}
break;
@ -190,22 +197,22 @@ uint8_t electron_plus1_device::expbus_r(address_space &space, offs_t offset, uin
switch (offset >> 8)
{
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);
data &= m_cart_sk1->read(space, offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
data &= m_cart_sk2->read(space, offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
if (offset == 0xfc70)
{
data &= m_adc->read(space, offset);
data &= m_adc->read(space, 0);
}
else if (offset == 0xfc72)
{
data &= status_r(space, offset);
data &= status_r(space, 0);
}
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);
data &= m_cart_sk1->read(space, offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
data &= m_cart_sk2->read(space, offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
break;
}
}
@ -230,11 +237,11 @@ void electron_plus1_device::expbus_w(address_space &space, offs_t offset, uint8_
{
case 0:
case 1:
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, 1, 0);
break;
case 2:
case 3:
m_cart_sk1->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01);
m_cart_sk1->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
break;
}
break;
@ -243,12 +250,12 @@ void electron_plus1_device::expbus_w(address_space &space, offs_t offset, uint8_
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);
m_cart_sk1->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
m_cart_sk2->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
if (offset == 0xfc70)
{
m_adc->write(space, offset, data);
m_adc->write(space, 0, data);
}
else if (offset == 0xfc71)
{
@ -257,8 +264,8 @@ void electron_plus1_device::expbus_w(address_space &space, offs_t offset, uint8_
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);
m_cart_sk1->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
m_cart_sk2->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
break;
case 0xfe:
@ -299,13 +306,3 @@ WRITE_LINE_MEMBER(electron_plus1_device::ready_w)
{
m_adc_ready = !state;
}
WRITE_LINE_MEMBER(electron_plus1_device::irq_w)
{
m_slot->irq_w(state);
}
WRITE_LINE_MEMBER(electron_plus1_device::nmi_w)
{
m_slot->nmi_w(state);
}

View File

@ -37,15 +37,13 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
virtual uint8_t expbus_r(address_space &space, offs_t offset) override;
virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:
DECLARE_READ8_MEMBER(status_r);
DECLARE_WRITE_LINE_MEMBER(busy_w);
DECLARE_WRITE_LINE_MEMBER(ready_w);
DECLARE_WRITE_LINE_MEMBER(irq_w);
DECLARE_WRITE_LINE_MEMBER(nmi_w);
required_memory_region m_exp_rom;
required_device<electron_cartslot_device> m_cart_sk1;

View File

@ -0,0 +1,236 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Slogger Plus 2
The Plus 2 interface from Slogger has been designed to compliment
the Slogger Rombox Plus and Acorn Plus 1 by offering further
expansion capabilities. This has been achieved by providing two
extra cartridge slots, three ROM sockets and connections for a
Usr Port and even further expansion via two expansion points.
**********************************************************************/
#include "emu.h"
#include "plus2.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(ELECTRON_PLUS2, electron_plus2_device, "electron_plus2", "Slogger Plus 2 Expansion")
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void electron_plus2_device::device_add_mconfig(machine_config &config)
{
/* rom sockets */
GENERIC_SOCKET(config, m_rom[0], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 13
m_rom[0]->set_device_load(device_image_load_delegate(&electron_plus2_device::device_image_load_rom1_load, this));
GENERIC_SOCKET(config, m_rom[1], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 14
m_rom[1]->set_device_load(device_image_load_delegate(&electron_plus2_device::device_image_load_rom2_load, this));
GENERIC_SOCKET(config, m_rom[2], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 15
m_rom[2]->set_device_load(device_image_load_delegate(&electron_plus2_device::device_image_load_rom3_load, this));
/* cartridges */
ELECTRON_CARTSLOT(config, m_cart[0], DERIVED_CLOCK(1, 1), electron_cart, nullptr);
m_cart[0]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
m_cart[0]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
ELECTRON_CARTSLOT(config, m_cart[1], DERIVED_CLOCK(1, 1), electron_cart, nullptr);
m_cart[1]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
m_cart[1]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
/* via */
VIA6522(config, m_via, DERIVED_CLOCK(1, 16));
m_via->readpb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_r));
m_via->writepb_handler().set(m_userport, FUNC(bbc_userport_slot_device::pb_w));
m_via->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
/* user port */
BBC_USERPORT_SLOT(config, m_userport, bbc_userport_devices, nullptr);
m_userport->cb1_handler().set(m_via, FUNC(via6522_device::write_cb1));
m_userport->cb2_handler().set(m_via, FUNC(via6522_device::write_cb2));
/* pass-through */
ELECTRON_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), electron_expansion_devices, nullptr);
m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// electron_plus2_device - constructor
//-------------------------------------------------
electron_plus2_device::electron_plus2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ELECTRON_PLUS2, tag, owner, clock)
, device_electron_expansion_interface(mconfig, *this)
, m_exp(*this, "exp")
, m_via(*this, "via6522")
, m_rom(*this, "rom%u", 1)
, m_cart(*this, "cart%u", 1)
, m_userport(*this, "userport")
, m_romsel(0)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void electron_plus2_device::device_start()
{
}
//-------------------------------------------------
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_plus2_device::expbus_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
switch (offset >> 12)
{
case 0x8:
case 0x9:
case 0xa:
case 0xb:
switch (m_romsel)
{
case 4:
case 5:
data = m_cart[1]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01, 1, 0);
break;
case 6:
case 7:
data = m_cart[0]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01, 1, 0);
break;
case 13:
data &= m_cart[0]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
data &= m_cart[1]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
case 14:
case 15:
data &= m_rom[m_romsel - 13]->read_rom(space, offset & 0x3fff);
break;
}
break;
case 0xf:
switch (offset >> 8)
{
case 0xfc:
data &= m_cart[0]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
data &= m_cart[1]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
if (offset >= 0xfcb0 && offset < 0xfcc0)
{
data &= m_via->read(offset & 0x0f);
}
break;
case 0xfd:
data &= m_cart[0]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
data &= m_cart[1]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
break;
}
}
data &= m_exp->expbus_r(space, offset);
return data;
}
//-------------------------------------------------
// expbus_w - expansion data write
//-------------------------------------------------
void electron_plus2_device::expbus_w(address_space &space, offs_t offset, uint8_t data)
{
switch (offset >> 12)
{
case 0x8:
case 0x9:
case 0xa:
case 0xb:
switch (m_romsel)
{
case 4:
case 5:
m_cart[1]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
break;
case 6:
case 7:
m_cart[0]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
break;
}
break;
case 0xf:
switch (offset >> 8)
{
case 0xfc:
m_cart[0]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
m_cart[1]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
if (offset >= 0xfcb0 && offset < 0xfcc0)
{
m_via->write(offset & 0x0f, data);
}
break;
case 0xfd:
m_cart[0]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
m_cart[1]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
break;
case 0xfe:
if (offset == 0xfe05)
{
m_romsel = data & 0x0f;
}
break;
}
}
m_exp->expbus_w(space, offset, data);
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
image_init_result electron_plus2_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;
}

View File

@ -0,0 +1,62 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Slogger Plus 2
**********************************************************************/
#ifndef MAME_BUS_ELECTRON_PLUS2_H
#define MAME_BUS_ELECTRON_PLUS2_H
#include "exp.h"
#include "machine/6522via.h"
#include "bus/electron/cart/slot.h"
#include "bus/bbc/userport/userport.h"
#include "bus/generic/slot.h"
#include "bus/generic/carts.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class electron_plus2_device:
public device_t,
public device_electron_expansion_interface
{
public:
// construction/destruction
electron_plus2_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 uint8_t expbus_r(address_space &space, offs_t offset) override;
virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:
image_init_result load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom2_load) { return load_rom(image, m_rom[1]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom3_load) { return load_rom(image, m_rom[2]); }
required_device<electron_expansion_slot_device> m_exp;
required_device<via6522_device> m_via;
required_device_array<generic_slot_device, 3> m_rom;
required_device_array<electron_cartslot_device, 2> m_cart;
required_device<bbc_userport_slot_device> m_userport;
uint8_t m_romsel;
};
// device type definition
DECLARE_DEVICE_TYPE(ELECTRON_PLUS2, electron_plus2_device)
#endif /* MAME_BUS_ELECTRON_PLUS2_H */

View File

@ -65,15 +65,20 @@ ROM_END
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_START(electron_plus3_device::device_add_mconfig)
void electron_plus3_device::device_add_mconfig(machine_config &config)
{
/* fdc */
WD1770(config, m_fdc, 16_MHz_XTAL / 2);
FLOPPY_CONNECTOR(config, m_floppy0, electron_floppies, "35dd", floppy_formats, true).enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, electron_floppies, nullptr, floppy_formats).enable_sound(true);
WD1770(config, m_fdc, DERIVED_CLOCK(1, 2));
FLOPPY_CONNECTOR(config, m_floppy0, electron_floppies, "35dd", floppy_formats).set_fixed(true);
m_floppy0->enable_sound(true);
FLOPPY_CONNECTOR(config, m_floppy1, electron_floppies, nullptr, floppy_formats);
m_floppy1->enable_sound(true);
/* pass-through */
MCFG_ELECTRON_PASSTHRU_EXPANSION_SLOT_ADD(nullptr)
MACHINE_CONFIG_END
ELECTRON_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), electron_expansion_devices, nullptr);
m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
}
const tiny_rom_entry *electron_plus3_device::device_rom_region() const
{
@ -112,8 +117,10 @@ void electron_plus3_device::device_start()
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_plus3_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
uint8_t electron_plus3_device::expbus_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
if (offset >= 0x8000 && offset < 0xc000)
{
if (m_romsel == 4)
@ -130,7 +137,7 @@ uint8_t electron_plus3_device::expbus_r(address_space &space, offs_t offset, uin
data = m_fdc->read(offset & 0x03);
}
data &= m_exp->expbus_r(space, offset, data);
data &= m_exp->expbus_r(space, offset);
return data;
}

View File

@ -34,7 +34,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
virtual uint8_t expbus_r(address_space &space, offs_t offset) override;
virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:

View File

@ -78,8 +78,10 @@ void electron_pwrjoy_device::device_start()
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_pwrjoy_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
uint8_t electron_pwrjoy_device::expbus_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
if (offset >= 0x8000 && offset < 0xc000)
{
if (m_romsel == 15)

View File

@ -32,7 +32,7 @@ public:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
virtual uint8_t expbus_r(address_space &space, offs_t offset) override;
virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
protected:

View File

@ -51,36 +51,31 @@ ioport_constructor electron_rombox_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_START(electron_rombox_device::device_add_mconfig)
void electron_rombox_device::device_add_mconfig(machine_config &config)
{
/* rom sockets */
MCFG_GENERIC_SOCKET_ADD("rom1", generic_plain_slot, "electron_rom")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_rombox_device, rom1_load)
MCFG_GENERIC_SOCKET_ADD("rom2", generic_plain_slot, "electron_rom")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_rombox_device, rom2_load)
MCFG_GENERIC_SOCKET_ADD("rom3", generic_plain_slot, "electron_rom")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_rombox_device, rom3_load)
MCFG_GENERIC_SOCKET_ADD("rom4", generic_plain_slot, "electron_rom")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_rombox_device, rom4_load)
MCFG_GENERIC_SOCKET_ADD("rom5", generic_plain_slot, "electron_rom")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_rombox_device, rom5_load)
MCFG_GENERIC_SOCKET_ADD("rom6", generic_plain_slot, "electron_rom")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_rombox_device, rom6_load)
MCFG_GENERIC_SOCKET_ADD("rom7", generic_plain_slot, "electron_rom")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_rombox_device, rom7_load)
MCFG_GENERIC_SOCKET_ADD("rom8", generic_plain_slot, "electron_rom")
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_rombox_device, rom8_load)
GENERIC_SOCKET(config, m_rom[0], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[0]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom1_load, this));
GENERIC_SOCKET(config, m_rom[1], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[1]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom2_load, this));
GENERIC_SOCKET(config, m_rom[2], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[2]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom3_load, this));
GENERIC_SOCKET(config, m_rom[3], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[3]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom4_load, this));
GENERIC_SOCKET(config, m_rom[4], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[4]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom5_load, this));
GENERIC_SOCKET(config, m_rom[5], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[5]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom6_load, this));
GENERIC_SOCKET(config, m_rom[6], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[6]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom7_load, this));
GENERIC_SOCKET(config, m_rom[7], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[7]->set_device_load(device_image_load_delegate(&electron_rombox_device::device_image_load_rom8_load, this));
/* pass-through */
MCFG_ELECTRON_PASSTHRU_EXPANSION_SLOT_ADD(nullptr)
MACHINE_CONFIG_END
ELECTRON_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), electron_expansion_devices, nullptr);
m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
}
//**************************************************************************
// LIVE DEVICE
@ -122,8 +117,10 @@ void electron_rombox_device::device_reset()
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_rombox_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
uint8_t electron_rombox_device::expbus_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
if (offset >= 0x8000 && offset < 0xc000)
{
switch (m_romsel)
@ -158,7 +155,7 @@ uint8_t electron_rombox_device::expbus_r(address_space &space, offs_t offset, ui
}
}
data &= m_exp->expbus_r(space, offset, data);
data &= m_exp->expbus_r(space, offset);
return data;
}

View File

@ -35,7 +35,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
virtual uint8_t expbus_r(address_space &space, offs_t offset) override;
virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:

View File

@ -84,34 +84,32 @@ ioport_constructor electron_romboxp_device::device_input_ports() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_START(electron_romboxp_device::device_add_mconfig)
void electron_romboxp_device::device_add_mconfig(machine_config &config)
{
/* printer */
MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, electron_romboxp_device, busy_w))
MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
CENTRONICS(config, m_centronics, centronics_devices, "printer");
m_centronics->busy_handler().set(FUNC(electron_romboxp_device::busy_w));
output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
m_centronics->set_output_latch(latch);
/* rom sockets */
MCFG_GENERIC_SOCKET_ADD("rom1", generic_plain_slot, "electron_rom") // ROM SLOT 4/12
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_romboxp_device, rom1_load)
MCFG_GENERIC_SOCKET_ADD("rom2", generic_plain_slot, "electron_rom") // ROM SLOT 5/13
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_romboxp_device, rom2_load)
MCFG_GENERIC_SOCKET_ADD("rom3", generic_plain_slot, "electron_rom") // ROM SLOT 6/14 also ROM/RAM
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_romboxp_device, rom3_load)
MCFG_GENERIC_SOCKET_ADD("rom4", generic_plain_slot, "electron_rom") // ROM SLOT 7/15
MCFG_GENERIC_EXTENSIONS("bin,rom")
MCFG_GENERIC_LOAD(electron_romboxp_device, rom4_load)
GENERIC_SOCKET(config, m_rom[0], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 4/12
m_rom[0]->set_device_load(device_image_load_delegate(&electron_romboxp_device::device_image_load_rom1_load, this));
GENERIC_SOCKET(config, m_rom[1], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 5/13
m_rom[1]->set_device_load(device_image_load_delegate(&electron_romboxp_device::device_image_load_rom2_load, this));
GENERIC_SOCKET(config, m_rom[2], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 6/14 also ROM/RAM
m_rom[2]->set_device_load(device_image_load_delegate(&electron_romboxp_device::device_image_load_rom3_load, this));
GENERIC_SOCKET(config, m_rom[3], generic_plain_slot, "electron_rom", "bin,rom"); // ROM SLOT 7/15
m_rom[3]->set_device_load(device_image_load_delegate(&electron_romboxp_device::device_image_load_rom4_load, this));
/* cartridges */
MCFG_ELECTRON_CARTSLOT_ADD("cart1", electron_cart, nullptr) // ROM SLOT 0/1
MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(WRITELINE(*this, electron_romboxp_device, irq_w))
MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(WRITELINE(*this, electron_romboxp_device, nmi_w))
MCFG_ELECTRON_CARTSLOT_ADD("cart2", electron_cart, nullptr) // ROM SLOT 2/3
MCFG_ELECTRON_CARTSLOT_IRQ_HANDLER(WRITELINE(*this, electron_romboxp_device, irq_w))
MCFG_ELECTRON_CARTSLOT_NMI_HANDLER(WRITELINE(*this, electron_romboxp_device, nmi_w))
MACHINE_CONFIG_END
ELECTRON_CARTSLOT(config, m_cart[0], DERIVED_CLOCK(1, 1), electron_cart, nullptr); // ROM SLOT 0/1
m_cart[0]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
m_cart[0]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
ELECTRON_CARTSLOT(config, m_cart[1], DERIVED_CLOCK(1, 1), electron_cart, nullptr); // ROM SLOT 2/3
m_cart[1]->irq_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::irq_w));
m_cart[1]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
}
const tiny_rom_entry *electron_romboxp_device::device_rom_region() const
{
@ -147,7 +145,6 @@ electron_romboxp_device::electron_romboxp_device(const machine_config &mconfig,
void electron_romboxp_device::device_start()
{
m_slot = dynamic_cast<electron_expansion_slot_device *>(owner());
}
//-------------------------------------------------
@ -163,8 +160,10 @@ void electron_romboxp_device::device_reset()
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset, uint8_t data)
uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset)
{
uint8_t data = 0xff;
switch (offset >> 12)
{
case 0x8:
@ -175,11 +174,11 @@ uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset, u
{
case 0:
case 1:
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, 1, 0);
break;
case 2:
case 3:
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, 1, 0);
break;
case 4:
case 5:
@ -194,6 +193,8 @@ uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset, u
data = m_exp_rom->base()[offset & 0x1fff];
break;
case 13:
data &= m_cart[0]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
data &= m_cart[1]->read(space, offset & 0x3fff, 0, 0, m_romsel & 0x01, 0, 1);
case 14:
case 15:
if (m_rom_base == 12)
@ -208,8 +209,8 @@ uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset, u
switch (offset >> 8)
{
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);
data &= m_cart[0]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
data &= m_cart[1]->read(space, offset & 0xff, 1, 0, m_romsel & 0x01, 0, 0);
if (offset == 0xfc72)
{
@ -218,8 +219,8 @@ uint8_t electron_romboxp_device::expbus_r(address_space &space, offs_t offset, u
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);
data &= m_cart[0]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
data &= m_cart[1]->read(space, offset & 0xff, 0, 1, m_romsel & 0x01, 0, 0);
break;
}
}
@ -243,11 +244,11 @@ void electron_romboxp_device::expbus_w(address_space &space, offs_t offset, uint
{
case 0:
case 1:
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, 1, 0);
break;
case 2:
case 3:
m_cart[0]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01);
m_cart[0]->write(space, offset & 0x3fff, data, 0, 0, m_romsel & 0x01, 1, 0);
break;
}
break;
@ -256,8 +257,8 @@ void electron_romboxp_device::expbus_w(address_space &space, offs_t offset, uint
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);
m_cart[0]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
m_cart[1]->write(space, offset & 0xff, data, 1, 0, m_romsel & 0x01, 0, 0);
if (offset == 0xfc71)
{
@ -266,8 +267,8 @@ void electron_romboxp_device::expbus_w(address_space &space, offs_t offset, uint
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);
m_cart[0]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
m_cart[1]->write(space, offset & 0xff, data, 0, 1, m_romsel & 0x01, 0, 0);
break;
case 0xfe:
@ -317,13 +318,3 @@ image_init_result electron_romboxp_device::load_rom(device_image_interface &imag
return image_init_result::PASS;
}
WRITE_LINE_MEMBER(electron_romboxp_device::irq_w)
{
m_slot->irq_w(state);
}
WRITE_LINE_MEMBER(electron_romboxp_device::nmi_w)
{
m_slot->nmi_w(state);
}

View File

@ -40,14 +40,12 @@ protected:
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
virtual uint8_t expbus_r(address_space &space, offs_t offset, uint8_t data) override;
virtual uint8_t expbus_r(address_space &space, offs_t offset) override;
virtual void expbus_w(address_space &space, offs_t offset, uint8_t data) override;
private:
DECLARE_READ8_MEMBER(status_r);
DECLARE_WRITE_LINE_MEMBER(busy_w);
DECLARE_WRITE_LINE_MEMBER(irq_w);
DECLARE_WRITE_LINE_MEMBER(nmi_w);
image_init_result load_rom(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom1_load) { return load_rom(image, m_rom[0]); }

View File

@ -106,7 +106,7 @@ void electron_state::electron64_opcodes(address_map &map)
INPUT_CHANGED_MEMBER(electron_state::trigger_reset)
{
m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE);
if (newval)
if (!newval)
{
m_exp->reset();
}
@ -211,7 +211,8 @@ static INPUT_PORTS_START( electron64 )
PORT_CONFSETTING(0x02, "64K")
INPUT_PORTS_END
MACHINE_CONFIG_START(electron_state::electron)
void electron_state::electron(machine_config &config)
{
M6502(config, m_maincpu, 16_MHz_XTAL / 8);
m_maincpu->set_addrmap(AS_PROGRAM, &electron_state::electron_mem);
@ -222,7 +223,7 @@ MACHINE_CONFIG_START(electron_state::electron)
m_screen->set_video_attributes(VIDEO_UPDATE_SCANLINE);
m_screen->set_palette("palette");
PALETTE(config, "palette", FUNC(electron_state::electron_colours), 16);
PALETTE(config, "palette", FUNC(electron_state::electron_colours), 8);
SPEAKER(config, "mono").front_center();
BEEP(config, m_beeper, 300).add_route(ALL_OUTPUTS, "mono", 1.00);
@ -235,33 +236,34 @@ MACHINE_CONFIG_START(electron_state::electron)
m_cassette->set_interface("electron_cass");
/* expansion port */
MCFG_ELECTRON_EXPANSION_SLOT_ADD("exp", electron_expansion_devices, "plus3", false)
MCFG_ELECTRON_EXPANSION_SLOT_IRQ_HANDLER(INPUTLINE("maincpu", M6502_IRQ_LINE))
MCFG_ELECTRON_EXPANSION_SLOT_NMI_HANDLER(INPUTLINE("maincpu", M6502_NMI_LINE))
ELECTRON_EXPANSION_SLOT(config, m_exp, 16_MHz_XTAL, electron_expansion_devices, "plus3");
m_exp->irq_handler().set_inputline(m_maincpu, M6502_IRQ_LINE);
m_exp->nmi_handler().set_inputline(m_maincpu, M6502_NMI_LINE);
/* software lists */
SOFTWARE_LIST(config, "cass_list").set_original("electron_cass");
SOFTWARE_LIST(config, "cart_list").set_original("electron_cart");
SOFTWARE_LIST(config, "flop_list").set_original("electron_flop");
SOFTWARE_LIST(config, "rom_list").set_original("electron_rom");
MACHINE_CONFIG_END
}
MACHINE_CONFIG_START(electron_state::btm2105)
void electron_state::btm2105(machine_config &config)
{
electron(config);
m_screen->set_color(rgb_t::amber());
/* expansion port */
MCFG_DEVICE_MODIFY("exp")
MCFG_DEVICE_SLOT_INTERFACE(electron_expansion_devices, "m2105", true)
m_exp->set_default_option("m2105");
m_exp->set_fixed(true);
/* software lists */
config.device_remove("cass_list");
config.device_remove("cart_list");
config.device_remove("flop_list");
config.device_remove("rom_list");
MACHINE_CONFIG_END
}
void electron_state::electron64(machine_config &config)
@ -275,7 +277,6 @@ void electron_state::electron64(machine_config &config)
}
/* Electron Rom Load */
ROM_START(electron)
ROM_REGION( 0x4000, "mos", 0 )
ROM_LOAD( "b02_acornos-1.rom", 0x0000, 0x4000, CRC(a0c2cf43) SHA1(a27ce645472cc5497690e4bfab43710efbb0792d) )

View File

@ -237,7 +237,7 @@ READ8_MEMBER(electron_state::electron_paged_r)
default:
/* ROM in extension devices */
data = m_exp->expbus_r(space, 0x8000 + offset, 0xff);
data = m_exp->expbus_r(space, 0x8000 + offset);
break;
}
return data;
@ -275,7 +275,7 @@ READ8_MEMBER(electron_state::electron_fred_r)
/* The Issue 4 ULA returns data from OS ROM, whereas Issue 6 ULA will return 0xff */
//logerror("FRED: read fc%02x\n", offset);
return m_exp->expbus_r(space, 0xfc00 + offset, 0xff);
return m_exp->expbus_r(space, 0xfc00 + offset);
}
WRITE8_MEMBER(electron_state::electron_fred_w)
@ -297,7 +297,7 @@ READ8_MEMBER(electron_state::electron_jim_r)
/* The Issue 4 ULA returns data from OS ROM, whereas Issue 6 ULA will return 0xff */
//logerror("JIM: read fd%02x\n", offset);
return m_exp->expbus_r(space, 0xfd00 + offset, 0xff);
return m_exp->expbus_r(space, 0xfd00 + offset);
}
WRITE8_MEMBER(electron_state::electron_jim_w)