bus/electron: Added the P.R.E.S. AP1/AP6 and First Byte Printer Interface devices.

This commit is contained in:
Nigel Barnes 2020-08-23 22:12:48 +01:00
parent ae568f3f60
commit 2027f49eb3
6 changed files with 475 additions and 63 deletions

View file

@ -1025,6 +1025,8 @@ if (BUSES["ELECTRON"]~=null) then
MAME_DIR .. "src/devices/bus/electron/exp.h", MAME_DIR .. "src/devices/bus/electron/exp.h",
MAME_DIR .. "src/devices/bus/electron/fbjoy.cpp", MAME_DIR .. "src/devices/bus/electron/fbjoy.cpp",
MAME_DIR .. "src/devices/bus/electron/fbjoy.h", MAME_DIR .. "src/devices/bus/electron/fbjoy.h",
MAME_DIR .. "src/devices/bus/electron/fbprint.cpp",
MAME_DIR .. "src/devices/bus/electron/fbprint.h",
MAME_DIR .. "src/devices/bus/electron/mode7.cpp", MAME_DIR .. "src/devices/bus/electron/mode7.cpp",
MAME_DIR .. "src/devices/bus/electron/mode7.h", MAME_DIR .. "src/devices/bus/electron/mode7.h",
MAME_DIR .. "src/devices/bus/electron/plus1.cpp", MAME_DIR .. "src/devices/bus/electron/plus1.cpp",

View file

@ -107,7 +107,7 @@ void electron_expansion_slot_device::expbus_w(offs_t offset, uint8_t data)
// slot devices // slot devices
#include "fbjoy.h" #include "fbjoy.h"
//#include "fbprint.h" #include "fbprint.h"
#include "mode7.h" #include "mode7.h"
//#include "lebox.h" //#include "lebox.h"
#include "plus1.h" #include "plus1.h"
@ -123,8 +123,10 @@ void electron_expansion_slot_device::expbus_w(offs_t offset, uint8_t data)
void electron_expansion_devices(device_slot_interface &device) void electron_expansion_devices(device_slot_interface &device)
{ {
device.option_add("ap1", ELECTRON_AP1);
device.option_add("ap6", ELECTRON_AP6);
device.option_add("fbjoy", ELECTRON_FBJOY); device.option_add("fbjoy", ELECTRON_FBJOY);
//device.option_add("fbprint", ELECTRON_FBPRINT); device.option_add("fbprint", ELECTRON_FBPRINT);
device.option_add("mode7", ELECTRON_MODE7); device.option_add("mode7", ELECTRON_MODE7);
//device.option_add("lebox", ELECTRON_LEBOX); //device.option_add("lebox", ELECTRON_LEBOX);
device.option_add("plus1", ELECTRON_PLUS1); device.option_add("plus1", ELECTRON_PLUS1);

View file

@ -0,0 +1,90 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
First Byte Printer Interface
**********************************************************************/
#include "emu.h"
#include "fbprint.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(ELECTRON_FBPRINT, electron_fbprint_device, "electron_fbprint", "First Byte Printer Interface")
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void electron_fbprint_device::device_add_mconfig(machine_config &config)
{
/* printer */
CENTRONICS(config, m_centronics, centronics_devices, "printer");
m_centronics->busy_handler().set([this](int state) { m_centronics_busy = state; });
output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
m_centronics->set_output_latch(latch);
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// electron_fbprint_device - constructor
//-------------------------------------------------
electron_fbprint_device::electron_fbprint_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ELECTRON_FBPRINT, tag, owner, clock)
, device_electron_expansion_interface(mconfig, *this)
, m_centronics(*this, "centronics")
, m_cent_data_out(*this, "cent_data_out")
, m_centronics_busy(0)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void electron_fbprint_device::device_start()
{
}
//-------------------------------------------------
// expbus_r - expansion data read
//-------------------------------------------------
uint8_t electron_fbprint_device::expbus_r(offs_t offset)
{
uint8_t data = 0xff;
if (offset == 0xfc72)
{
data = (m_centronics_busy << 7) | 0x7f;
}
return data;
}
//-------------------------------------------------
// expbus_w - expansion data write
//-------------------------------------------------
void electron_fbprint_device::expbus_w(offs_t offset, uint8_t data)
{
if (offset == 0xfc71)
{
m_cent_data_out->write(data);
m_centronics->write_strobe(0);
m_centronics->write_strobe(1);
}
}

View file

@ -0,0 +1,50 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
First Byte Printer Interface
**********************************************************************/
#ifndef MAME_BUS_ELECTRON_FBPRINT_H
#define MAME_BUS_ELECTRON_FBPRINT_H
#include "exp.h"
#include "bus/centronics/ctronics.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class electron_fbprint_device:
public device_t,
public device_electron_expansion_interface
{
public:
// construction/destruction
electron_fbprint_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(offs_t offset) override;
virtual void expbus_w(offs_t offset, uint8_t data) override;
required_device<centronics_device> m_centronics;
required_device<output_latch_device> m_cent_data_out;
int m_centronics_busy;
};
// device type definition
DECLARE_DEVICE_TYPE(ELECTRON_FBPRINT, electron_fbprint_device)
#endif /* MAME_BUS_ELECTRON_FBPRINT_H */

View file

@ -23,6 +23,8 @@
//************************************************************************** //**************************************************************************
DEFINE_DEVICE_TYPE(ELECTRON_PLUS1, electron_plus1_device, "electron_plus1", "Acorn Plus 1 Expansion") DEFINE_DEVICE_TYPE(ELECTRON_PLUS1, electron_plus1_device, "electron_plus1", "Acorn Plus 1 Expansion")
DEFINE_DEVICE_TYPE(ELECTRON_AP1, electron_ap1_device, "electron_ap1", "P.R.E.S. Advanced Plus 1")
DEFINE_DEVICE_TYPE(ELECTRON_AP6, electron_ap6_device, "electron_ap6", "P.R.E.S. Advanced Plus 6")
//------------------------------------------------- //-------------------------------------------------
@ -36,22 +38,33 @@ ROM_START( plus1 )
ROM_SYSTEM_BIOS(0, "plus1", "Expansion 1.00") ROM_SYSTEM_BIOS(0, "plus1", "Expansion 1.00")
ROMX_LOAD("plus1.rom", 0x0000, 0x1000, CRC(ac30b0ed) SHA1(2de04ab7c81414d6c9c967f965c53fc276392463), ROM_BIOS(0)) ROMX_LOAD("plus1.rom", 0x0000, 0x1000, CRC(ac30b0ed) SHA1(2de04ab7c81414d6c9c967f965c53fc276392463), ROM_BIOS(0))
ROM_RELOAD( 0x1000, 0x1000) ROM_RELOAD( 0x1000, 0x1000)
ROM_END
ROM_SYSTEM_BIOS(1, "presap1", "PRES Expansion 1.1") ROM_START( ap1 )
ROMX_LOAD("presplus1.rom", 0x0000, 0x1000, CRC(8ef1e0e5) SHA1(080e1b788b3fe4fa272cd2cc792293eb7b874e82), ROM_BIOS(1)) // Bank 12 Expansion module operating system
ROM_REGION( 0x2000, "exp_rom", 0 )
ROM_DEFAULT_BIOS("ap2")
ROM_SYSTEM_BIOS(0, "ap1", "PRES Expansion 1.1")
ROMX_LOAD("presplus1.rom", 0x0000, 0x1000, CRC(8ef1e0e5) SHA1(080e1b788b3fe4fa272cd2cc792293eb7b874e82), ROM_BIOS(0))
ROM_RELOAD( 0x1000, 0x1000) ROM_RELOAD( 0x1000, 0x1000)
ROM_SYSTEM_BIOS(2, "presap2", "PRES AP2 Support 1.23") ROM_SYSTEM_BIOS(1, "ap2", "PRES AP2 Support 1.23")
ROMX_LOAD("presap2_123.rom", 0x0000, 0x2000, CRC(f796689c) SHA1(bc40a79e6d2b4cb5e549d5d21f673c66a661850d), ROM_BIOS(2)) ROMX_LOAD("presap2_123.rom", 0x0000, 0x2000, CRC(f796689c) SHA1(bc40a79e6d2b4cb5e549d5d21f673c66a661850d), ROM_BIOS(1))
ROM_SYSTEM_BIOS(3, "sl200", "Slogger Expansion 2.00") ROM_SYSTEM_BIOS(2, "ap6", "RH Plus 1 1.33")
ROMX_LOAD("elkexp200.rom", 0x0000, 0x2000, CRC(dee02843) SHA1(5c9b940b4ddb46e9a223160310683a32266300c8), ROM_BIOS(3)) ROMX_LOAD("ap6v133.rom", 0x0000, 0x2000, CRC(566c7bfe) SHA1(f1053109ea236dd3e4b91ec64859480e8c2ed549), ROM_BIOS(2))
ROM_END
ROM_SYSTEM_BIOS(4, "sl201", "Slogger Expansion 2.01") ROM_START( ap6 )
ROMX_LOAD("elkexp201.rom", 0x0000, 0x2000, CRC(0e896892) SHA1(4e0794f1083fe529b01bd4fa100996a533ed8b10), ROM_BIOS(4)) // Bank 12 Expansion module operating system
ROM_REGION( 0x4000, "exp_rom", 0 )
ROM_DEFAULT_BIOS("ap6")
ROM_SYSTEM_BIOS(0, "ap2", "PRES AP2 Support 1.23")
ROMX_LOAD("presap2_123.rom", 0x0000, 0x2000, CRC(f796689c) SHA1(bc40a79e6d2b4cb5e549d5d21f673c66a661850d), ROM_BIOS(0))
ROM_RELOAD( 0x2000, 0x2000)
ROM_SYSTEM_BIOS(5, "sl202", "Slogger Expansion 2.02") ROM_SYSTEM_BIOS(1, "ap6", "RH Plus 1 1.33")
ROMX_LOAD("elkexp202.rom", 0x0000, 0x2000, CRC(32b440be) SHA1(dbc73e8d919c5615d0241d99db60e06324e16c86), ROM_BIOS(5)) ROMX_LOAD("ap6v133t.rom", 0x0000, 0x4000, CRC(364591eb) SHA1(316a25aeeda0266dae510eea52324b087875740f), ROM_BIOS(1))
ROM_END ROM_END
//------------------------------------------------- //-------------------------------------------------
@ -76,9 +89,23 @@ static INPUT_PORTS_START( plus1 )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2)
INPUT_PORTS_END INPUT_PORTS_END
static INPUT_PORTS_START( ap6 )
PORT_INCLUDE(plus1)
PORT_START("LINKS")
PORT_CONFNAME(0x01, 0x01, "J1 ROM 13")
PORT_CONFSETTING(0x00, "Disabled")
PORT_CONFSETTING(0x01, "Enabled")
PORT_CONFNAME(0x02, 0x02, "J2 ROM 4")
PORT_CONFSETTING(0x00, "Disabled")
PORT_CONFSETTING(0x02, "Enabled")
PORT_CONFNAME(0x04, 0x04, "J3 ROM 4,5,6,7")
PORT_CONFSETTING(0x00, "Disabled")
PORT_CONFSETTING(0x04, "Enabled")
INPUT_PORTS_END
//------------------------------------------------- //-------------------------------------------------
// machine_config_additions - device-specific // input_ports - device-specific input ports
// machine configurations
//------------------------------------------------- //-------------------------------------------------
ioport_constructor electron_plus1_device::device_input_ports() const ioport_constructor electron_plus1_device::device_input_ports() const
@ -86,6 +113,11 @@ ioport_constructor electron_plus1_device::device_input_ports() const
return INPUT_PORTS_NAME( plus1 ); return INPUT_PORTS_NAME( plus1 );
} }
ioport_constructor electron_ap6_device::device_input_ports() const
{
return INPUT_PORTS_NAME( ap6 );
}
//------------------------------------------------- //-------------------------------------------------
// device_add_mconfig - add device configuration // device_add_mconfig - add device configuration
//------------------------------------------------- //-------------------------------------------------
@ -94,13 +126,13 @@ void electron_plus1_device::device_add_mconfig(machine_config &config)
{ {
/* printer */ /* printer */
CENTRONICS(config, m_centronics, centronics_devices, "printer"); CENTRONICS(config, m_centronics, centronics_devices, "printer");
m_centronics->busy_handler().set(FUNC(electron_plus1_device::busy_w)); m_centronics->busy_handler().set([this](int state) { m_centronics_busy = state; });
output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out")); output_latch_device &latch(OUTPUT_LATCH(config, "cent_data_out"));
m_centronics->set_output_latch(latch); m_centronics->set_output_latch(latch);
/* adc */ /* adc */
ADC0844(config, m_adc); ADC0844(config, m_adc);
m_adc->intr_callback().set(FUNC(electron_plus1_device::ready_w)); m_adc->intr_callback().set([this](int state) { m_adc_ready = !state; });
m_adc->ch1_callback().set_ioport("JOY1"); m_adc->ch1_callback().set_ioport("JOY1");
m_adc->ch2_callback().set_ioport("JOY2"); m_adc->ch2_callback().set_ioport("JOY2");
m_adc->ch3_callback().set_ioport("JOY3"); m_adc->ch3_callback().set_ioport("JOY3");
@ -115,6 +147,25 @@ void electron_plus1_device::device_add_mconfig(machine_config &config)
m_cart_sk2->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w)); m_cart_sk2->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(electron_expansion_slot_device::nmi_w));
} }
void electron_ap6_device::device_add_mconfig(machine_config &config)
{
electron_plus1_device::device_add_mconfig(config);
/* rom sockets */
GENERIC_SOCKET(config, m_rom[0], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[0]->set_device_load(FUNC(electron_ap6_device::rom1_load));
GENERIC_SOCKET(config, m_rom[1], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[1]->set_device_load(FUNC(electron_ap6_device::rom2_load));
GENERIC_SOCKET(config, m_rom[2], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[2]->set_device_load(FUNC(electron_ap6_device::rom3_load));
GENERIC_SOCKET(config, m_rom[3], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[3]->set_device_load(FUNC(electron_ap6_device::rom4_load));
GENERIC_SOCKET(config, m_rom[4], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[4]->set_device_load(FUNC(electron_ap6_device::rom5_load));
GENERIC_SOCKET(config, m_rom[5], generic_plain_slot, "electron_rom", "bin,rom");
m_rom[5]->set_device_load(FUNC(electron_ap6_device::rom6_load));
}
//------------------------------------------------- //-------------------------------------------------
// rom_region - device-specific ROM region // rom_region - device-specific ROM region
//------------------------------------------------- //-------------------------------------------------
@ -124,6 +175,16 @@ const tiny_rom_entry *electron_plus1_device::device_rom_region() const
return ROM_NAME( plus1 ); return ROM_NAME( plus1 );
} }
const tiny_rom_entry *electron_ap1_device::device_rom_region() const
{
return ROM_NAME( ap1 );
}
const tiny_rom_entry *electron_ap6_device::device_rom_region() const
{
return ROM_NAME( ap6 );
}
//************************************************************************** //**************************************************************************
// LIVE DEVICE // LIVE DEVICE
//************************************************************************** //**************************************************************************
@ -132,20 +193,37 @@ const tiny_rom_entry *electron_plus1_device::device_rom_region() const
// electron_plus1_device - constructor // electron_plus1_device - constructor
//------------------------------------------------- //-------------------------------------------------
electron_plus1_device::electron_plus1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : electron_plus1_device::electron_plus1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
device_t(mconfig, ELECTRON_PLUS1, tag, owner, clock), : device_t(mconfig, type, tag, owner, clock)
device_electron_expansion_interface(mconfig, *this), , device_electron_expansion_interface(mconfig, *this)
m_exp_rom(*this, "exp_rom"), , m_exp_rom(*this, "exp_rom")
m_cart_sk1(*this, "cart_sk1"), , m_cart_sk1(*this, "cart_sk1")
m_cart_sk2(*this, "cart_sk2"), , m_cart_sk2(*this, "cart_sk2")
m_centronics(*this, "centronics"), , m_centronics(*this, "centronics")
m_cent_data_out(*this, "cent_data_out"), , m_cent_data_out(*this, "cent_data_out")
m_adc(*this, "adc"), , m_adc(*this, "adc")
m_joy(*this, "JOY%u", 1), , m_joy(*this, "JOY%u", 1)
m_buttons(*this, "BUTTONS"), , m_buttons(*this, "BUTTONS")
m_romsel(0), , m_romsel(0)
m_centronics_busy(0), , m_centronics_busy(0)
m_adc_ready(0) , m_adc_ready(0)
{
}
electron_plus1_device::electron_plus1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: electron_plus1_device(mconfig, ELECTRON_PLUS1, tag, owner, clock)
{
}
electron_ap1_device::electron_ap1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: electron_plus1_device(mconfig, ELECTRON_AP1, tag, owner, clock)
{
}
electron_ap6_device::electron_ap6_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock)
: electron_plus1_device(mconfig, ELECTRON_AP6, tag, owner, clock)
, m_rom(*this, "rom%u", 1)
, m_links(*this, "LINKS")
{ {
} }
@ -156,6 +234,23 @@ electron_plus1_device::electron_plus1_device(const machine_config &mconfig, cons
void electron_plus1_device::device_start() void electron_plus1_device::device_start()
{ {
/* register for save states */
save_item(NAME(m_romsel));
}
void electron_ap6_device::device_start()
{
electron_plus1_device::device_start();
m_ram = make_unique_clear<uint8_t[]>(0x18000);
memset(m_ram.get(), 0xff, 0x18000);
m_bank_locked[0] = false;
m_bank_locked[1] = false;
/* register for save states */
save_pointer(NAME(m_ram), 0x18000);
save_item(NAME(m_bank_locked));
} }
@ -169,10 +264,7 @@ uint8_t electron_plus1_device::expbus_r(offs_t offset)
switch (offset >> 12) switch (offset >> 12)
{ {
case 0x8: case 0x8: case 0x9: case 0xa: case 0xb:
case 0x9:
case 0xa:
case 0xb:
switch (m_romsel) switch (m_romsel)
{ {
case 0: case 0:
@ -206,7 +298,11 @@ uint8_t electron_plus1_device::expbus_r(offs_t offset)
} }
else if (offset == 0xfc72) else if (offset == 0xfc72)
{ {
data &= status_r(); // Status: b7: printer Busy
// b6: ADC conversion end
// b5: Fire Button 1
// b4: Fire Button 2
data &= (m_centronics_busy << 7) | (m_adc_ready << 6) | m_buttons->read() | 0x0f;
} }
break; break;
@ -221,6 +317,63 @@ uint8_t electron_plus1_device::expbus_r(offs_t offset)
} }
uint8_t electron_ap6_device::expbus_r(offs_t offset)
{
uint8_t data = electron_plus1_device::expbus_r(offset);
switch (offset >> 12)
{
case 0x8: case 0x9: case 0xa: case 0xb:
switch (m_romsel)
{
case 4:
if (BIT(m_links->read(), 1) && BIT(m_links->read(), 2)) // ROM 4 enabled
{
if (m_rom[m_romsel - 4]->exists())
data = m_rom[m_romsel - 4]->read_rom(offset & 0x3fff);
else
data = m_ram[(m_romsel - 4) << 14 | (offset & 0x3fff)];
}
break;
case 5: case 6: case 7:
if (BIT(m_links->read(), 2)) // ROM 4,5,6,7 enabled
{
if (m_rom[m_romsel - 4]->exists())
data = m_rom[m_romsel - 4]->read_rom(offset & 0x3fff);
else
data = m_ram[(m_romsel - 4) << 14 | (offset & 0x3fff)];
}
break;
case 12:
data = m_exp_rom->base()[offset & 0x3fff];
break;
case 13:
if (BIT(m_links->read(), 0)) // ROM 13 enabled
{
if (m_rom[m_romsel - 9]->exists())
data &= m_rom[m_romsel - 9]->read_rom(offset & 0x3fff);
else
data &= m_ram[(m_romsel - 9) << 14 | (offset & 0x3fff)];
}
break;
case 14:
if (m_rom[m_romsel - 9]->exists())
data &= m_rom[m_romsel - 9]->read_rom(offset & 0x3fff);
else
data &= m_ram[(m_romsel - 9) << 14 | (offset & 0x3fff)];
break;
}
break;
}
return data;
}
//------------------------------------------------- //-------------------------------------------------
// expbus_w - expansion data write // expbus_w - expansion data write
//------------------------------------------------- //-------------------------------------------------
@ -229,10 +382,7 @@ void electron_plus1_device::expbus_w(offs_t offset, uint8_t data)
{ {
switch (offset >> 12) switch (offset >> 12)
{ {
case 0x8: case 0x8: case 0x9: case 0xa: case 0xb:
case 0x9:
case 0xa:
case 0xb:
switch (m_romsel) switch (m_romsel)
{ {
case 0: case 0:
@ -260,6 +410,8 @@ void electron_plus1_device::expbus_w(offs_t offset, uint8_t data)
else if (offset == 0xfc71) else if (offset == 0xfc71)
{ {
m_cent_data_out->write(data); m_cent_data_out->write(data);
m_centronics->write_strobe(0);
m_centronics->write_strobe(1);
} }
break; break;
@ -279,30 +431,100 @@ void electron_plus1_device::expbus_w(offs_t offset, uint8_t data)
} }
void electron_ap6_device::expbus_w(offs_t offset, uint8_t data)
{
electron_plus1_device::expbus_w(offset, data);
switch (offset >> 12)
{
case 0x8: case 0x9: case 0xa: case 0xb:
switch (m_romsel)
{
case 4:
if (BIT(m_links->read(), 1) && BIT(m_links->read(), 2)) // ROM 4 enabled
{
if (!m_rom[m_romsel - 4]->exists())
m_ram[(m_romsel - 4) << 14 | (offset & 0x3fff)] = data;
}
break;
case 7:
if (BIT(m_links->read(), 2)) // ROM 4,5,6,7 enabled
{
if (!m_rom[m_romsel - 4]->exists())
m_ram[(m_romsel - 4) << 14 | (offset & 0x3fff)] = data;
}
break;
case 5: case 6:
if (BIT(m_links->read(), 2)) // ROM 4,5,6,7 enabled
{
if (!m_rom[m_romsel - 4]->exists() && !m_bank_locked[0])
m_ram[(m_romsel - 4) << 14 | (offset & 0x3fff)] = data;
}
break;
case 13:
if (BIT(m_links->read(), 0)) // ROM 13 enabled
{
if (!m_rom[m_romsel - 9]->exists() && !m_bank_locked[1])
m_ram[(m_romsel - 9) << 14 | (offset & 0x3fff)] = data;
}
break;
case 14:
if (!m_rom[m_romsel - 9]->exists())
m_ram[(m_romsel - 9) << 14 | (offset & 0x3fff)] = data;
break;
}
break;
case 0xf:
switch (offset >> 8)
{
case 0xfc:
switch (offset & 0xff)
{
case 0xdc:
m_bank_locked[0] = false;
break;
case 0xdd:
m_bank_locked[0] = true;
break;
case 0xde:
m_bank_locked[1] = false;
break;
case 0xdf:
m_bank_locked[1] = true;
break;
}
break;
}
}
}
//************************************************************************** //**************************************************************************
// IMPLEMENTATION // IMPLEMENTATION
//************************************************************************** //**************************************************************************
u8 electron_plus1_device::status_r() image_init_result electron_ap6_device::load_rom(device_image_interface &image, generic_slot_device *slot)
{ {
u8 data = 0x0f; uint32_t size = slot->common_get_size("rom");
// Status: b7: printer Busy
// b6: ADC conversion end
// b5: Fire Button 1
// b4: Fire Button 2
data |= (m_centronics_busy << 7);
data |= (m_adc_ready << 6);
data |= m_buttons->read();
return data; // 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;
}
WRITE_LINE_MEMBER(electron_plus1_device::busy_w) slot->rom_alloc(0x4000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
{ slot->common_load_rom(slot->get_rom_base(), size, "rom");
m_centronics_busy = !state;
}
WRITE_LINE_MEMBER(electron_plus1_device::ready_w) // mirror 8K ROMs
{ uint8_t *crt = slot->get_rom_base();
m_adc_ready = !state; if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
return image_init_result::PASS;
} }

View file

@ -11,10 +11,11 @@
#define MAME_BUS_ELECTRON_PLUS1_H #define MAME_BUS_ELECTRON_PLUS1_H
#include "exp.h" #include "exp.h"
#include "softlist.h"
#include "machine/adc0844.h" #include "machine/adc0844.h"
#include "bus/centronics/ctronics.h" #include "bus/centronics/ctronics.h"
#include "bus/electron/cart/slot.h" #include "bus/electron/cart/slot.h"
#include "bus/generic/slot.h"
#include "bus/generic/carts.h"
//************************************************************************** //**************************************************************************
// TYPE DEFINITIONS // TYPE DEFINITIONS
@ -29,6 +30,8 @@ public:
electron_plus1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); electron_plus1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected: protected:
electron_plus1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides // device-level overrides
virtual void device_start() override; virtual void device_start() override;
@ -40,11 +43,6 @@ protected:
virtual uint8_t expbus_r(offs_t offset) override; virtual uint8_t expbus_r(offs_t offset) override;
virtual void expbus_w(offs_t offset, uint8_t data) override; virtual void expbus_w(offs_t offset, uint8_t data) override;
private:
u8 status_r();
DECLARE_WRITE_LINE_MEMBER(busy_w);
DECLARE_WRITE_LINE_MEMBER(ready_w);
required_memory_region m_exp_rom; required_memory_region m_exp_rom;
required_device<electron_cartslot_device> m_cart_sk1; required_device<electron_cartslot_device> m_cart_sk1;
required_device<electron_cartslot_device> m_cart_sk2; required_device<electron_cartslot_device> m_cart_sk2;
@ -60,8 +58,56 @@ private:
}; };
class electron_ap1_device : public electron_plus1_device
{
public:
electron_ap1_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock);
protected:
// optional information overrides
virtual const tiny_rom_entry* device_rom_region() const override;
};
class electron_ap6_device : public electron_plus1_device
{
public:
electron_ap6_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 const tiny_rom_entry* device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
virtual uint8_t expbus_r(offs_t offset) override;
virtual void expbus_w(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]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom4_load) { return load_rom(image, m_rom[3]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom5_load) { return load_rom(image, m_rom[4]); }
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(rom6_load) { return load_rom(image, m_rom[5]); }
required_device_array<generic_slot_device, 6> m_rom;
required_ioport m_links;
std::unique_ptr<uint8_t[]> m_ram;
bool m_bank_locked[2];
};
// device type definition // device type definition
DECLARE_DEVICE_TYPE(ELECTRON_PLUS1, electron_plus1_device) DECLARE_DEVICE_TYPE(ELECTRON_PLUS1, electron_plus1_device)
DECLARE_DEVICE_TYPE(ELECTRON_AP1, electron_ap1_device)
DECLARE_DEVICE_TYPE(ELECTRON_AP6, electron_ap6_device)
#endif /* MAME_BUS_ELECTRON_PLUS1_H */ #endif /* MAME_BUS_ELECTRON_PLUS1_H */