diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 0ba196a4500..c0aaa3f5d5d 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -650,6 +650,8 @@ if (BUSES["ELECTRON"]~=null) then files { MAME_DIR .. "src/devices/bus/electron/exp.cpp", MAME_DIR .. "src/devices/bus/electron/exp.h", + MAME_DIR .. "src/devices/bus/electron/plus3.cpp", + MAME_DIR .. "src/devices/bus/electron/plus3.h", MAME_DIR .. "src/devices/bus/electron/m2105.cpp", MAME_DIR .. "src/devices/bus/electron/m2105.h", } diff --git a/src/devices/bus/electron/exp.cpp b/src/devices/bus/electron/exp.cpp index 86337e31510..c8c892058c6 100644 --- a/src/devices/bus/electron/exp.cpp +++ b/src/devices/bus/electron/exp.cpp @@ -51,11 +51,9 @@ device_electron_expansion_interface::~device_electron_expansion_interface() electron_expansion_slot_device::electron_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ELECTRON_EXPANSION_SLOT, "Acorn Electron Expansion port", tag, owner, clock, "electron_expansion_slot", __FILE__), device_slot_interface(mconfig, *this), - m_io(nullptr), m_card(nullptr), m_irq_handler(*this), - m_nmi_handler(*this), - m_reset_handler(*this) + m_nmi_handler(*this) { } @@ -75,10 +73,11 @@ electron_expansion_slot_device::~electron_expansion_slot_device() void electron_expansion_slot_device::device_start() { + m_card = dynamic_cast(get_card_device()); + // resolve callbacks m_irq_handler.resolve_safe(); m_nmi_handler.resolve_safe(); - m_reset_handler.resolve_safe(); } //------------------------------------------------- @@ -93,15 +92,6 @@ void electron_expansion_slot_device::device_reset() } } -//------------------------------------------------- -// set_io_space - set address space we are attached to -//------------------------------------------------- - -void electron_expansion_slot_device::set_io_space(address_space *io) -{ - m_io = io; -} - //------------------------------------------------- // SLOT_INTERFACE( electron_expansion_devices ) @@ -110,7 +100,7 @@ void electron_expansion_slot_device::set_io_space(address_space *io) // slot devices //#include "plus1.h" -//#include "plus3.h" +#include "plus3.h" //#include "aplus3.h" //#include "aplus5.h" //#include "slogger.h" @@ -120,7 +110,7 @@ void electron_expansion_slot_device::set_io_space(address_space *io) SLOT_INTERFACE_START( electron_expansion_devices ) //SLOT_INTERFACE("plus1", ELECTRON_PLUS1) - //SLOT_INTERFACE("plus3", ELECTRON_PLUS3) + SLOT_INTERFACE("plus3", ELECTRON_PLUS3) //SLOT_INTERFACE("aplus3", ELECTRON_APLUS3) //SLOT_INTERFACE("aplus5", ELECTRON_APLUS5) //SLOT_INTERFACE("slogger", ELECTRON_SLOGGER) diff --git a/src/devices/bus/electron/exp.h b/src/devices/bus/electron/exp.h index 68394d9f101..b89f795060b 100644 --- a/src/devices/bus/electron/exp.h +++ b/src/devices/bus/electron/exp.h @@ -102,15 +102,14 @@ AC RETURNS (pins 3,4) - adaptor. A total of 6W may be drawn from these lines as // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_ELECTRON_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \ +#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, false) + 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) \ + MCFG_ELECTRON_EXPANSION_SLOT_ADD(ELECTRON_EXPANSION_SLOT_TAG, electron_expansion_devices, _def_slot, false) \ MCFG_ELECTRON_EXPANSION_SLOT_IRQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, electron_expansion_slot_device, irq_w)) \ - MCFG_ELECTRON_EXPANSION_SLOT_NMI_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, electron_expansion_slot_device, nmi_w)) \ - MCFG_ELECTRON_EXPANSION_SLOT_RES_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, electron_expansion_slot_device, reset_w)) + MCFG_ELECTRON_EXPANSION_SLOT_NMI_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, electron_expansion_slot_device, nmi_w)) #define MCFG_ELECTRON_EXPANSION_SLOT_IRQ_HANDLER(_devcb) \ devcb = &electron_expansion_slot_device::set_irq_handler(*device, DEVCB_##_devcb); @@ -118,9 +117,6 @@ AC RETURNS (pins 3,4) - adaptor. A total of 6W may be drawn from these lines as #define MCFG_ELECTRON_EXPANSION_SLOT_NMI_HANDLER(_devcb) \ devcb = &electron_expansion_slot_device::set_nmi_handler(*device, DEVCB_##_devcb); -#define MCFG_ELECTRON_EXPANSION_SLOT_RES_HANDLER(_devcb) \ - devcb = &electron_expansion_slot_device::set_reset_handler(*device, DEVCB_##_devcb); - //************************************************************************** // TYPE DEFINITIONS @@ -137,8 +133,6 @@ public: electron_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~electron_expansion_slot_device(); - void set_io_space(address_space *io); - // callbacks template static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast(device).m_irq_handler.set_callback(object); } @@ -146,14 +140,8 @@ public: template static devcb_base &set_nmi_handler(device_t &device, _Object object) { return downcast(device).m_nmi_handler.set_callback(object); } - template static devcb_base &set_reset_handler(device_t &device, _Object object) - { return downcast(device).m_reset_handler.set_callback(object); } - DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); } DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); } - DECLARE_WRITE_LINE_MEMBER( reset_w ) { m_reset_handler(state); } - - address_space *m_io; protected: // device-level overrides @@ -165,7 +153,6 @@ protected: private: devcb_write_line m_irq_handler; devcb_write_line m_nmi_handler; - devcb_write_line m_reset_handler; }; diff --git a/src/devices/bus/electron/m2105.cpp b/src/devices/bus/electron/m2105.cpp index 4c7669faa3c..1815c8bfe14 100644 --- a/src/devices/bus/electron/m2105.cpp +++ b/src/devices/bus/electron/m2105.cpp @@ -22,38 +22,32 @@ const device_type ELECTRON_M2105 = &device_creator; //------------------------------------------------- ROM_START( m2105 ) - ROM_REGION(0x40000, "exp_rom", 0) - ROM_DEFAULT_BIOS("350") - ROM_SYSTEM_BIOS(0, "350", "v3.50") - ROMX_LOAD("ic22-sm-35l-1.ic22", 0x30000, 0x4000, CRC(e8f8a639) SHA1(eb7fa1e884be9c072ae0c1e598507b802422127f), ROM_BIOS(1)) - ROMX_LOAD("ic23-sm-35l-1.ic23", 0x34000, 0x4000, CRC(b1bb1d83) SHA1(07ca3a93744519b8d03bbf1c3c3537c0a0a3c6fe), ROM_BIOS(1)) - ROMX_LOAD("sk01-pc-35l-1.ic24", 0x38000, 0x4000, CRC(54fd4c09) SHA1(9588296306581580ba223cf6bce4be61476f14c4), ROM_BIOS(1)) - ROMX_LOAD("sk02-pc-35l-1.ic24", 0x3c000, 0x4000, CRC(c08de988) SHA1(86f2da5f8e9a5301ad40360e286f841f42e94a99), ROM_BIOS(1)) - ROM_SYSTEM_BIOS(1, "340", "v3.40") - ROMX_LOAD("ic22-sm-34l-1.ic22", 0x30000, 0x4000, CRC(b514b15f) SHA1(a9c6c20b5a4f860b000511dde2f54497bcdd97b0), ROM_BIOS(2)) - ROMX_LOAD("ic23-sm-34l-1.ic23", 0x34000, 0x4000, CRC(18875889) SHA1(d1a7dd87c4d99869a1961becec5e9d567d8fad53), ROM_BIOS(2)) - ROMX_LOAD("sk01-pc-34l-1.ic24", 0x38000, 0x4000, CRC(a8796c9e) SHA1(29bc01b8f7617b252e4b243d13b1bbd3cd32cc3b), ROM_BIOS(2)) - ROMX_LOAD("sk02-pc-34l-1.ic24", 0x3c000, 0x4000, CRC(fa74063c) SHA1(cdc31c606e69e7a6d221b7340a310d475d487fc9), ROM_BIOS(2)) - ROM_SYSTEM_BIOS(2, "207", "v2.07") - ROMX_LOAD("ic22-sm-207l-1.ic22", 0x30000, 0x4000, CRC(0c431547) SHA1(13d2eab49b9c79f507b7dd8436d1e56cf43be412), ROM_BIOS(3)) - ROMX_LOAD("ic23-sm-207l-1.ic23", 0x34000, 0x4000, CRC(15044d49) SHA1(e75fe4321579a9027527a0e256050d1444b3fe82), ROM_BIOS(3)) - ROMX_LOAD("sk01-pc-207l-1.ic24", 0x38000, 0x4000, CRC(0850bcea) SHA1(270e7a31e69e1454cfb70ced23a50f5d97efe4d5), ROM_BIOS(3)) - ROMX_LOAD("sk02-pc-207l-1.ic24", 0x3c000, 0x4000, CRC(d8b9143f) SHA1(4e132c7a6dae4caf7203139b51882706d508c449), ROM_BIOS(3)) + ROM_REGION(0x10000, "exp_rom", 0) + ROM_DEFAULT_BIOS("v350") - ROM_REGION(0x8000, "vsm", 0) /* system speech PHROM */ + ROM_SYSTEM_BIOS(0, "v350", "V3.50 16/02/87") + ROMX_LOAD("ic22-sm-35l-1.ic22", 0x0000, 0x4000, CRC(e8f8a639) SHA1(eb7fa1e884be9c072ae0c1e598507b802422127f), ROM_BIOS(1)) + ROMX_LOAD("ic23-sm-35l-1.ic23", 0x4000, 0x4000, CRC(b1bb1d83) SHA1(07ca3a93744519b8d03bbf1c3c3537c0a0a3c6fe), ROM_BIOS(1)) + ROMX_LOAD("sk01-pc-35l-1.ic24", 0x8000, 0x4000, CRC(54fd4c09) SHA1(9588296306581580ba223cf6bce4be61476f14c4), ROM_BIOS(1)) + ROMX_LOAD("sk02-pc-35l-1.ic24", 0xc000, 0x4000, CRC(c08de988) SHA1(86f2da5f8e9a5301ad40360e286f841f42e94a99), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "v341", "V3.41 26/11/85") + ROMX_LOAD("ic22-sm-34l-1.ic22", 0x0000, 0x4000, CRC(b514b15f) SHA1(a9c6c20b5a4f860b000511dde2f54497bcdd97b0), ROM_BIOS(2)) + ROMX_LOAD("ic23-sm-34l-1.ic23", 0x4000, 0x4000, CRC(18875889) SHA1(d1a7dd87c4d99869a1961becec5e9d567d8fad53), ROM_BIOS(2)) + ROMX_LOAD("sk01-pc-34l-1.ic24", 0x8000, 0x4000, CRC(a8796c9e) SHA1(29bc01b8f7617b252e4b243d13b1bbd3cd32cc3b), ROM_BIOS(2)) + ROMX_LOAD("sk02-pc-34l-1.ic24", 0xc000, 0x4000, CRC(fa74063c) SHA1(cdc31c606e69e7a6d221b7340a310d475d487fc9), ROM_BIOS(2)) + + ROM_SYSTEM_BIOS(2, "v207", "V2.07 14/03/85") + ROMX_LOAD("ic22-sm-207l-1.ic22", 0x0000, 0x4000, CRC(0c431547) SHA1(13d2eab49b9c79f507b7dd8436d1e56cf43be412), ROM_BIOS(3)) + ROMX_LOAD("ic23-sm-207l-1.ic23", 0x4000, 0x4000, CRC(15044d49) SHA1(e75fe4321579a9027527a0e256050d1444b3fe82), ROM_BIOS(3)) + ROMX_LOAD("sk01-pc-207l-1.ic24", 0x8000, 0x4000, CRC(0850bcea) SHA1(270e7a31e69e1454cfb70ced23a50f5d97efe4d5), ROM_BIOS(3)) + ROMX_LOAD("sk02-pc-207l-1.ic24", 0xc000, 0x4000, CRC(d8b9143f) SHA1(4e132c7a6dae4caf7203139b51882706d508c449), ROM_BIOS(3)) + + ROM_REGION(0x4000, "vsm", 0) /* system speech PHROM */ ROM_LOAD("phroma.bin", 0x0000, 0x4000, CRC(98e1bf9e) SHA1(b369809275cb67dfd8a749265e91adb2d2558ae6)) ROM_END -//------------------------------------------------- -// ADDRESS_MAP( m2105 ) -//------------------------------------------------- - -//static ADDRESS_MAP_START( m2105_mem, AS_IO, 8, electron_m2105_device ) -// AM_RANGE(0x30000, 0x3ffff) AM_MIRROR(0x4000) AM_ROM AM_REGION("m2105_rom", 0) -//ADDRESS_MAP_END - - //------------------------------------------------- // MACHINE_DRIVER( m2105 ) //------------------------------------------------- @@ -62,13 +56,16 @@ static MACHINE_CONFIG_FRAGMENT( m2105 ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_INPUT_MERGER_ACTIVE_HIGH("irqs") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(WRITELINE(electron_m2105_device, intrq_w)) + /* system via */ MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000) /*MCFG_VIA6522_READPA_HANDLER(READ8(electron_m2105_device, m2105_via_system_read_porta)) MCFG_VIA6522_READPB_HANDLER(READ8(electron_m2105_device, m2105_via_system_read_portb)) MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(electron_m2105_device, m2105_via_system_write_porta)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(electron_m2105_device, m2105_via_system_write_portb)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(electron_m2105_device, m2105_via_system_irq_w))*/ + MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(electron_m2105_device, m2105_via_system_write_portb))*/ + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("irqs", input_merger_active_high_device, in0_w)) /* user via */ MCFG_DEVICE_ADD("via6522_1", VIA6522, 1000000) @@ -76,30 +73,27 @@ static MACHINE_CONFIG_FRAGMENT( m2105 ) MCFG_VIA6522_WRITEPA_HANDLER(DEVWRITE8("cent_data_out", output_latch_device, write)) //MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(electron_m2105_device, m2105_via_user_write_portb)) MCFG_VIA6522_CA2_HANDLER(DEVWRITELINE("centronics", centronics_device, write_strobe)) - //MCFG_VIA6522_IRQ_HANDLER(WRITELINE(electron_m2105_device, m2105_via_user_irq_w)) + MCFG_VIA6522_IRQ_HANDLER(DEVWRITELINE("irqs", input_merger_active_high_device, in1_w)) + + /* duart */ + MCFG_MC68681_ADD("sc2681", XTAL_3_6864MHz) + MCFG_MC68681_IRQ_CALLBACK(DEVWRITELINE("irqs", input_merger_active_high_device, in2_w)) + MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + //MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(electron_m2105_device, sio_out_w)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_a_w)) + + /* printer */ + MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") + MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522_1", via6522_device, write_ca1)) MCFG_DEVCB_INVERT /* ack seems to be inverted? */ + MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") /* speech hardware */ MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) MCFG_SOUND_ADD("tms5220", TMS5220, 640000) MCFG_TMS52XX_SPEECHROM("vsm") MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - - /* duart */ - MCFG_MC68681_ADD("sc2681", XTAL_3_6864MHz) - //MCFG_MC68681_IRQ_CALLBACK(DEVWRITELINE("maincpu", i80186_cpu_device, int0_w)) - //MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE("rs232_1", rs232_port_device, write_txd)) - //MCFG_MC68681_B_TX_CALLBACK(DEVWRITELINE("rs232_2", rs232_port_device, write_txd)) - //MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(electron_m2105_device, sio_out_w)) - - //MCFG_RS232_PORT_ADD("rs232_1", default_rs232_devices, "terminal") - //MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_a_w)) - //MCFG_RS232_PORT_ADD("rs232_2", default_rs232_devices, nullptr) - //MCFG_RS232_RXD_HANDLER(DEVWRITELINE("sc2681", mc68681_device, rx_b_w)) - - /* printer */ - MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("via6522_1", via6522_device, write_ca1)) MCFG_DEVCB_INVERT /* ack seems to be inverted? */ - MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") MACHINE_CONFIG_END @@ -132,8 +126,10 @@ electron_m2105_device::electron_m2105_device(const machine_config &mconfig, cons m_exp_rom(*this, "exp_rom"), m_via6522_0(*this, "via6522_0"), m_via6522_1(*this, "via6522_1"), + m_duart(*this, "sc2681"), m_tms(*this, "tms5220"), - m_centronics(*this, "centronics") + m_centronics(*this, "centronics"), + m_irqs(*this, "irqs") { } @@ -143,6 +139,12 @@ electron_m2105_device::electron_m2105_device(const machine_config &mconfig, cons void electron_m2105_device::device_start() { + address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM); + m_slot = dynamic_cast(owner()); + + space.install_readwrite_handler(0xfc40, 0xfc5f, READ8_DEVICE_DELEGATE(m_via6522_1, via6522_device, read), WRITE8_DEVICE_DELEGATE(m_via6522_1, via6522_device, write)); + space.install_readwrite_handler(0xfc60, 0xfc6f, READ8_DEVICE_DELEGATE(m_duart, mc68681_device, read), WRITE8_DEVICE_DELEGATE(m_duart, mc68681_device, write)); + space.install_readwrite_handler(0xfc70, 0xfc8f, READ8_DEVICE_DELEGATE(m_via6522_0, via6522_device, read), WRITE8_DEVICE_DELEGATE(m_via6522_0, via6522_device, write)); } //------------------------------------------------- @@ -151,4 +153,18 @@ void electron_m2105_device::device_start() void electron_m2105_device::device_reset() { + machine().root_device().membank("bank2")->configure_entry(12, memregion("exp_rom")->base() + 0x0000); + machine().root_device().membank("bank2")->configure_entry(13, memregion("exp_rom")->base() + 0x4000); + machine().root_device().membank("bank2")->configure_entry( 0, memregion("exp_rom")->base() + 0x8000); + machine().root_device().membank("bank2")->configure_entry( 2, memregion("exp_rom")->base() + 0xc000); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE_LINE_MEMBER(electron_m2105_device::intrq_w) +{ + m_slot->irq_w(state); } diff --git a/src/devices/bus/electron/m2105.h b/src/devices/bus/electron/m2105.h index f2efa191941..9a97622fd93 100644 --- a/src/devices/bus/electron/m2105.h +++ b/src/devices/bus/electron/m2105.h @@ -14,6 +14,7 @@ #include "exp.h" #include "machine/6522via.h" #include "machine/mc68681.h" +#include "machine/input_merger.h" #include "sound/tms5220.h" #include "bus/centronics/ctronics.h" #include "bus/rs232/rs232.h" @@ -31,6 +32,8 @@ public: // construction/destruction electron_m2105_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + DECLARE_WRITE_LINE_MEMBER(intrq_w); + // optional information overrides virtual machine_config_constructor device_mconfig_additions() const override; virtual const tiny_rom_entry *device_rom_region() const override; @@ -43,8 +46,10 @@ private: required_memory_region m_exp_rom; required_device m_via6522_0; required_device m_via6522_1; + required_device m_duart; required_device m_tms; required_device m_centronics; + required_device m_irqs; }; diff --git a/src/devices/bus/electron/plus3.cpp b/src/devices/bus/electron/plus3.cpp new file mode 100644 index 00000000000..2a4e1eadec6 --- /dev/null +++ b/src/devices/bus/electron/plus3.cpp @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + ALA13 - Acorn Plus 3 + + http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/Acorn_Plus3.html + + The Acorn Plus 3 was a hardware module that connected independently + of the Plus 1 and provided a double-density 3½" disc drive connected + through a WD1770 drive controller and an ADFS ROM. There were two + versions of the Plus 3 produced: A Single-sided and a Double-sided + drive version. + +**********************************************************************/ + + +#include "plus3.h" +#include "softlist.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ELECTRON_PLUS3 = &device_creator; + + +//------------------------------------------------- +// MACHINE_DRIVER( plus3 ) +//------------------------------------------------- + +FLOPPY_FORMATS_MEMBER(floppy_formats) + FLOPPY_ACORN_SSD_FORMAT, + FLOPPY_ACORN_DSD_FORMAT, + FLOPPY_ACORN_ADFS_OLD_FORMAT +FLOPPY_FORMATS_END0 + +SLOT_INTERFACE_START(electron_floppies) + SLOT_INTERFACE("35ssdd", FLOPPY_35_SSDD) + SLOT_INTERFACE("35dd", FLOPPY_35_DD) + SLOT_INTERFACE("525sssd", FLOPPY_525_SSSD) + SLOT_INTERFACE("525sd", FLOPPY_525_SD) + SLOT_INTERFACE("525dd", FLOPPY_525_DD) + SLOT_INTERFACE("525qd", FLOPPY_525_QD) +SLOT_INTERFACE_END + + +MACHINE_CONFIG_FRAGMENT( plus3 ) + /* fdc */ + MCFG_WD1770_ADD("fdc", XTAL_16MHz / 2) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", electron_floppies, "35dd", floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", electron_floppies, nullptr, floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) + + /* software lists */ + MCFG_SOFTWARE_LIST_ADD("flop_ls", "electron_flop") + + // pass-through + MCFG_ELECTRON_PASSTHRU_EXPANSION_SLOT_ADD(nullptr) +MACHINE_CONFIG_END + + +ROM_START( plus3 ) + // Bank 4 Disc + ROM_REGION(0x4000, "exp_rom", 0) + ROM_DEFAULT_BIOS("adfs") + ROM_SYSTEM_BIOS(0, "adfs", "Acorn ADFS") + ROMX_LOAD("adfs.rom", 0x0000, 0x4000, CRC(3289bdc6) SHA1(e7c7a1094d50a3579751df2007269067c8ff6812), ROM_BIOS(1)) + + ROM_SYSTEM_BIOS(1, "dfs200", "Advanced 1770 DFS 2.00") + ROMX_LOAD("acp_dfs1770_200.rom", 0x0000, 0x4000, CRC(5a3a13c7) SHA1(d5dad7ab5a0237c44d0426cd85a8ec86545747e0), ROM_BIOS(2)) +ROM_END + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor electron_plus3_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( plus3 ); +} + +const tiny_rom_entry *electron_plus3_device::device_rom_region() const +{ + return ROM_NAME( plus3 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_plus3_device - constructor +//------------------------------------------------- + +electron_plus3_device::electron_plus3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ELECTRON_PLUS3, "Acorn Plus 3 Disc Expansion", tag, owner, clock, "electron_plus3", __FILE__), + device_electron_expansion_interface(mconfig, *this), + m_exp_rom(*this, "exp_rom"), + m_fdc(*this, "fdc"), + m_floppy0(*this, "fdc:0"), + m_floppy1(*this, "fdc:1") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_plus3_device::device_start() +{ + address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM); + m_slot = dynamic_cast(owner()); + + space.install_write_handler(0xfcc0, 0xfcc3, WRITE8_DELEGATE(electron_plus3_device, wd1770_status_w)); + space.install_readwrite_handler(0xfcc4, 0xfccf, READ8_DEVICE_DELEGATE(m_fdc, wd1770_t, read), WRITE8_DEVICE_DELEGATE(m_fdc, wd1770_t, write)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void electron_plus3_device::device_reset() +{ + machine().root_device().membank("bank2")->configure_entry(4, memregion("exp_rom")->base()); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +WRITE8_MEMBER(electron_plus3_device::wd1770_status_w) +{ + floppy_image_device *floppy = nullptr; + + m_drive_control = data; + + // bit 0, 1: drive select + if (BIT(data, 0)) floppy = m_fdc->subdevice("0")->get_device(); + if (BIT(data, 1)) floppy = m_fdc->subdevice("1")->get_device(); + m_fdc->set_floppy(floppy); + + // bit 2: side select + if (floppy) + floppy->ss_w(BIT(data, 2)); + + // bit 3: density + m_fdc->dden_w(BIT(data, 3)); + + // bit 4: interrupt enable? + + // bit 5: reset + if (!BIT(data, 5)) m_fdc->soft_reset(); +} \ No newline at end of file diff --git a/src/devices/bus/electron/plus3.h b/src/devices/bus/electron/plus3.h new file mode 100644 index 00000000000..d2690c6864b --- /dev/null +++ b/src/devices/bus/electron/plus3.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + ALA13 - Acorn Plus 3 + +**********************************************************************/ + + +#ifndef __ELECTRON_PLUS3__ +#define __ELECTRON_PLUS3__ + +#include "emu.h" +#include "exp.h" +#include "machine/wd_fdc.h" +#include "formats/acorn_dsk.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class electron_plus3_device: + public device_t, + public device_electron_expansion_interface +{ +public: + // construction/destruction + electron_plus3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_FLOPPY_FORMATS(floppy_formats); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const override; + virtual const tiny_rom_entry *device_rom_region() const override; + + DECLARE_WRITE8_MEMBER(wd1770_status_w); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + +private: + required_memory_region m_exp_rom; + required_device m_fdc; + required_device m_floppy0; + optional_device m_floppy1; + + int m_drive_control; +}; + + +// device type definition +extern const device_type ELECTRON_PLUS3; + + +#endif /* __ELECTRON_PLUS3__ */ diff --git a/src/mame/drivers/electron.cpp b/src/mame/drivers/electron.cpp index 00657a2aaa5..725c827421d 100644 --- a/src/mame/drivers/electron.cpp +++ b/src/mame/drivers/electron.cpp @@ -62,7 +62,6 @@ Incomplete: the software list and loading code. Missing: - - Support for floppy disks - Other peripherals ******************************************************************************/ @@ -105,6 +104,10 @@ ADDRESS_MAP_END INPUT_CHANGED_MEMBER(electron_state::trigger_reset) { m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); + if (newval) + { + m_exp->reset(); + } } static INPUT_PORTS_START( electron ) @@ -228,7 +231,7 @@ static MACHINE_CONFIG_START( electron, electron_state ) MCFG_GENERIC_LOAD(electron_state, electron_cart) /* expansion port */ - MCFG_ELECTRON_EXPANSION_SLOT_ADD("exp", electron_expansion_devices, nullptr) + 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)) diff --git a/src/mame/machine/electron.cpp b/src/mame/machine/electron.cpp index 2c9d869b2fd..10091c75bdd 100644 --- a/src/mame/machine/electron.cpp +++ b/src/mame/machine/electron.cpp @@ -399,32 +399,6 @@ void electron_state::machine_start() for (int page = 2; page < 16; page++) membank("bank2")->configure_entries(page, 1, memregion("user1")->base() + page * 0x4000, 0x4000); - /* enumerate expansion ROMs */ - electron_expansion_slot_device* exp_port = m_exp; - - while (exp_port != nullptr) - { - device_t* temp; - - temp = dynamic_cast(exp_port->get_card_device()); - if (temp != nullptr) - { - for (int page = 4; page < 16; page++) - { - memory_region *temp_region = temp->memregion("exp_rom"); - if (temp_region != nullptr && temp_region->base() != nullptr && temp_region->base()[page * 0x4000 + 0x06] != 0x00) - { - membank("bank2")->configure_entries(page, 1, temp_region->base() + page * 0x4000, 0x4000); - } - exp_port = temp->subdevice("exp"); - } - } - else - { - exp_port = nullptr; - } - } - m_ula.interrupt_status = 0x82; m_ula.interrupt_control = 0x00; timer_set(attotime::zero, TIMER_SETUP_BEEP);