From e7b79b1b52e9cecfb42616ef0422bc991d41be12 Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Sat, 16 Jul 2016 21:21:50 +0100 Subject: [PATCH] New NOT WORKING machine ======================= BT Merlin M2105 [Nigel Barnes] --- scripts/src/bus.lua | 4 + src/devices/bus/electron/exp.cpp | 39 +++++-- src/devices/bus/electron/exp.h | 180 +++++++++++++++++------------ src/devices/bus/electron/m2105.cpp | 154 ++++++++++++++++++++++++ src/devices/bus/electron/m2105.h | 55 +++++++++ src/mame/drivers/electron.cpp | 71 +++++++----- src/mame/includes/electron.h | 2 + src/mame/machine/electron.cpp | 35 +++++- src/mame/mame.lst | 1 + 9 files changed, 431 insertions(+), 110 deletions(-) create mode 100644 src/devices/bus/electron/m2105.cpp create mode 100644 src/devices/bus/electron/m2105.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 5fdd355a955..75a84c6ea83 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -570,6 +570,8 @@ if (BUSES["ECONET"]~=null) then MAME_DIR .. "src/devices/bus/econet/econet.h", MAME_DIR .. "src/devices/bus/econet/e01.cpp", MAME_DIR .. "src/devices/bus/econet/e01.h", + MAME_DIR .. "src/devices/bus/econet/ebridge.cpp", + MAME_DIR .. "src/devices/bus/econet/ebridge.h", } end @@ -583,6 +585,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/m2105.cpp", + MAME_DIR .. "src/devices/bus/electron/m2105.h", } end diff --git a/src/devices/bus/electron/exp.cpp b/src/devices/bus/electron/exp.cpp index ced8056d2eb..86337e31510 100644 --- a/src/devices/bus/electron/exp.cpp +++ b/src/devices/bus/electron/exp.cpp @@ -32,7 +32,7 @@ device_electron_expansion_interface::device_electron_expansion_interface(const m //------------------------------------------------- -// ~device_electron_expansion_card_interface - destructor +// ~device_electron_expansion_interface - destructor //------------------------------------------------- device_electron_expansion_interface::~device_electron_expansion_interface() @@ -49,8 +49,22 @@ 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, "Expansion port", tag, owner, clock, "electron_expansion_slot", __FILE__), - device_slot_interface(mconfig, *this) + 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) +{ +} + + +//------------------------------------------------- +// expansion_slot_device - destructor +//------------------------------------------------- + +electron_expansion_slot_device::~electron_expansion_slot_device() { } @@ -61,10 +75,12 @@ electron_expansion_slot_device::electron_expansion_slot_device(const machine_con 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(); } - //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- @@ -77,6 +93,15 @@ 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 ) @@ -90,7 +115,7 @@ void electron_expansion_slot_device::device_reset() //#include "aplus5.h" //#include "slogger.h" //#include "fbjoy.h" -//#include "m2105.h" +#include "m2105.h" SLOT_INTERFACE_START( electron_expansion_devices ) @@ -100,5 +125,5 @@ SLOT_INTERFACE_START( electron_expansion_devices ) //SLOT_INTERFACE("aplus5", ELECTRON_APLUS5) //SLOT_INTERFACE("slogger", ELECTRON_SLOGGER) //SLOT_INTERFACE("fbjoy", ELECTRON_FBJOY) - //SLOT_INTERFACE("m2105", ELECTRON_M2105) + SLOT_INTERFACE("m2105", ELECTRON_M2105) SLOT_INTERFACE_END diff --git a/src/devices/bus/electron/exp.h b/src/devices/bus/electron/exp.h index 2f59faec38a..68394d9f101 100644 --- a/src/devices/bus/electron/exp.h +++ b/src/devices/bus/electron/exp.h @@ -8,78 +8,78 @@ Pinout: - 18V AC 2 1 18V AC - AC RETURN 4 3 AC RETURN - -5V 6 5 -5V - 0V 8 7 0V - +5V 10 9 +5V - 16MHz 12 11 SOUND O/P - PHI OUT 14 13 13 IN - NMI 16 15 RST - R/W 18 17 IRQ - D6 20 19 D7 - D4 22 21 D5 - D2 24 23 D3 - D0 26 25 D1 - NC 28 27 RDY - SLOT 30 29 SLOT - A14 32 31 A15 - A12 34 33 A13 - A10 36 35 A11 - A0 38 37 A9 - A2 40 39 A1 - A4 42 41 A3 - A6 44 43 A5 - A8 46 45 A7 - 0V 48 47 0V - +5V 50 49 +5V + 18V AC 2 1 18V AC + AC RETURN 4 3 AC RETURN + -5V 6 5 -5V + 0V 8 7 0V + +5V 10 9 +5V + 16MHz 12 11 SOUND O/P + PHI OUT 14 13 /13 IN + NMI 16 15 RST + R/W 18 17 IRQ + D6 20 19 D7 + D4 22 21 D5 + D2 24 23 D3 + D0 26 25 D1 + NC 28 27 RDY + SLOT 30 29 SLOT + A14 32 31 A15 + A12 34 33 A13 + A10 36 35 A11 + A0 38 37 A9 + A2 40 39 A1 + A4 42 41 A3 + A6 44 43 A5 + A8 46 45 A7 + 0V 48 47 0V + +5V 50 49 +5V Signal Definitions: - 18V AC (pins 1,2) - These lines are connected directly to the output from the Electron mains power + 18V AC (pins 1,2) - These lines are connected directly to the output from the Electron mains power AC RETURNS (pins 3,4) - adaptor. A total of 6W may be drawn from these lines as long as no power is - taken from +5V (pins 9,10,49,50). For safety reasons these lines must never - be used as an AC input to the Electron. - -5V (pins 5,6) - A -5V supply from the Electron. Up to 20mA (total) may safely be drawn - from this line by expansion modules. - 0V (pins 7,8,47,48) - Ground. Expansion modules with their own power supply must have the 0V - lines commoned with the Electron. + taken from +5V (pins 9,10,49,50). For safety reasons these lines must never + be used as an AC input to the Electron. + -5V (pins 5,6) - A -5V supply from the Electron. Up to 20mA (total) may safely be drawn + from this line by expansion modules. + 0V (pins 7,8,47,48) - Ground. Expansion modules with their own power supply must have the 0V + lines commoned with the Electron. +5V (pins 9,10,49,50) - A +5V supply from the Electron. Up to 500mA (total) may safely be drawn - from this line by expansion modules as long as no power is taken from 18V - AC (pins 1,2,3,4). - SOUND O/P (pin 11) - Sound output. A 3V peak to peak source via a 1K series resistor from the - Electron ULA. - 16 MHz (pin 12) - 16 Megahertz from the Electron main oscillator. This output may be used - for clock generation within an expansion module. - /13 IN (pin 13) - 16 Megahertz divided by 13. This output may be used for baud rate - generation. If divided by 1024 it will give approximately 1200Hz. - PHI OUT (pin 14) - The 6502 input clock. The low time is nominally 250ns. The high time may - be 250ns (2MHz operation when reading ROMs) or 750ns or 1250ns - (stretched clock for a 1MHz access, the length depending on the phase of the - 2MHz clock) or up to 40us (if in modes 0-3) - RST (pin 15) - Reset (active low). This is an OUTPUT ONLY for the system reset line. It - may be used to initialise expansion modules on power up and when the - BREAK key is pressed. - NMI (pin 16) - Non-Maskable Interrupt (negative edge triggered). This is the system NMI - line which is open collector (wire-OR) and may be asserted by an expansion - module. The pull-up resistor on this line inside the ULA is 3k3. Care must - be taken to avoid masking other interrupts by holding the line low. Using - NMI on the Electron requires knowledge of operating system protocols. - IRQ (pin 17) - Interrupt Request (active low). This is the system IRQ line which is open - collector (wire-OR) and may be asserted by an expansion module. The pull- - up resistor on this line inside the ULA is 3k3. It is essential for the correct - operation of the machine that interrupts to not occur until the software is - capable of dealing with them. Interrupts on the Electron expansion bus should - therefore be disabled on power-up and reset. Significant use of interrupt - service time may affect other machine functions, eg the real time clock. - R/W (pin 18) - The system read/write line from the 6502. - D7-D0 (pins 19-26) - Bi-directional data bus. The direction of data is determined by R/W. - RDY (pin 27) - 6502 ready line (active low). May be asserted by an expansion module to - stop the processor when reading slow memory. This line works on read only - (R/W=1). - (pin 28) - No connection - (pins 29,30) - Polarising key connector. - A0-A15 (pins 31-46) - 6502 address bus. + from this line by expansion modules as long as no power is taken from 18V + AC (pins 1,2,3,4). + SOUND O/P (pin 11) - Sound output. A 3V peak to peak source via a 1K series resistor from the + Electron ULA. + 16 MHz (pin 12) - 16 Megahertz from the Electron main oscillator. This output may be used + for clock generation within an expansion module. + /13 IN (pin 13) - 16 Megahertz divided by 13. This output may be used for baud rate + generation. If divided by 1024 it will give approximately 1200Hz. + PHI OUT (pin 14) - The 6502 input clock. The low time is nominally 250ns. The high time may + be 250ns (2MHz operation when reading ROMs) or 750ns or 1250ns + (stretched clock for a 1MHz access, the length depending on the phase of the + 2MHz clock) or up to 40us (if in modes 0-3) + RST (pin 15) - Reset (active low). This is an OUTPUT ONLY for the system reset line. It + may be used to initialise expansion modules on power up and when the + BREAK key is pressed. + NMI (pin 16) - Non-Maskable Interrupt (negative edge triggered). This is the system NMI + line which is open collector (wire-OR) and may be asserted by an expansion + module. The pull-up resistor on this line inside the ULA is 3k3. Care must + be taken to avoid masking other interrupts by holding the line low. Using + NMI on the Electron requires knowledge of operating system protocols. + IRQ (pin 17) - Interrupt Request (active low). This is the system IRQ line which is open + collector (wire-OR) and may be asserted by an expansion module. The pull- + up resistor on this line inside the ULA is 3k3. It is essential for the correct + operation of the machine that interrupts to not occur until the software is + capable of dealing with them. Interrupts on the Electron expansion bus should + therefore be disabled on power-up and reset. Significant use of interrupt + service time may affect other machine functions, eg the real time clock. + R/W (pin 18) - The system read/write line from the 6502. + D7-D0 (pins 19-26) - Bi-directional data bus. The direction of data is determined by R/W. + RDY (pin 27) - 6502 ready line (active low). May be asserted by an expansion module to + stop the processor when reading slow memory. This line works on read only + (R/W=1). + (pin 28) - No connection + (pins 29,30) - Polarising key connector. + A0-A15 (pins 31-46) - 6502 address bus. **********************************************************************/ @@ -106,8 +106,20 @@ AC RETURNS (pins 3,4) - adaptor. A total of 6W may be drawn from these lines as MCFG_DEVICE_ADD(_tag, ELECTRON_EXPANSION_SLOT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) -#define MCFG_ELECTRON_PASSTHRU_EXPANSION_SLOT_ADD() \ - MCFG_ELECTRON_EXPANSION_SLOT_ADD(ELECTRON_EXPANSION_SLOT_TAG, 0, electron_expansion_devices, nullptr) +#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_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)) + +#define MCFG_ELECTRON_EXPANSION_SLOT_IRQ_HANDLER(_devcb) \ + devcb = &electron_expansion_slot_device::set_irq_handler(*device, DEVCB_##_devcb); + +#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); //************************************************************************** @@ -118,13 +130,30 @@ AC RETURNS (pins 3,4) - adaptor. A total of 6W may be drawn from these lines as class device_electron_expansion_interface; -class electron_expansion_slot_device : public device_t, - public device_slot_interface +class electron_expansion_slot_device : public device_t, public device_slot_interface { public: // construction/destruction electron_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - virtual ~electron_expansion_slot_device() {} + 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); } + + 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 @@ -132,10 +161,15 @@ protected: virtual void device_reset() override; device_electron_expansion_interface *m_card; + +private: + devcb_write_line m_irq_handler; + devcb_write_line m_nmi_handler; + devcb_write_line m_reset_handler; }; -// ======================> device_electron_expansion_card_interface +// ======================> device_electron_expansion_interface class device_electron_expansion_interface : public device_slot_card_interface { diff --git a/src/devices/bus/electron/m2105.cpp b/src/devices/bus/electron/m2105.cpp new file mode 100644 index 00000000000..1809f41a00a --- /dev/null +++ b/src/devices/bus/electron/m2105.cpp @@ -0,0 +1,154 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + BT Merlin M2105 + +**********************************************************************/ + + +#include "m2105.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ELECTRON_M2105 = &device_creator; + + +//------------------------------------------------- +// ROM( m2105 ) +//------------------------------------------------- + +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(0x8000, "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 ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( m2105 ) + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + + /* 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))*/ + + /* user via */ + MCFG_DEVICE_ADD("via6522_1", VIA6522, 1000000) + //MCFG_VIA6522_READPB_HANDLER(READ8(electron_m2105_device, m2105_via_user_read_portb)) + 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)) + + /* 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 + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor electron_m2105_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( m2105 ); +} + +const rom_entry *electron_m2105_device::device_rom_region() const +{ + return ROM_NAME( m2105 ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_m2105_device - constructor +//------------------------------------------------- + +electron_m2105_device::electron_m2105_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ELECTRON_M2105, "BT Merlin M2105", tag, owner, clock, "electron_m2105", __FILE__), + device_electron_expansion_interface(mconfig, *this), + m_exp_rom(*this, "exp_rom"), + m_via6522_0(*this, "via6522_0"), + m_via6522_1(*this, "via6522_1"), + m_tms(*this, "tms5220"), + m_centronics(*this, "centronics") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void electron_m2105_device::device_start() +{ +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void electron_m2105_device::device_reset() +{ +} diff --git a/src/devices/bus/electron/m2105.h b/src/devices/bus/electron/m2105.h new file mode 100644 index 00000000000..fb462d08ab7 --- /dev/null +++ b/src/devices/bus/electron/m2105.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + BT Merlin M2105 + +**********************************************************************/ + + +#ifndef __ELECTRON_M2105__ +#define __ELECTRON_M2105__ + +#include "emu.h" +#include "exp.h" +#include "machine/6522via.h" +#include "machine/mc68681.h" +#include "sound/tms5220.h" +#include "bus/centronics/ctronics.h" +#include "bus/rs232/rs232.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class electron_m2105_device: + public device_t, + public device_electron_expansion_interface + +{ +public: + // construction/destruction + electron_m2105_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const override; + virtual const rom_entry *device_rom_region() const override; + +protected: + virtual void device_start() override; + virtual void device_reset() override; + +private: + required_memory_region m_exp_rom; + required_device m_via6522_0; + required_device m_via6522_1; + required_device m_tms; + required_device m_centronics; +}; + + +// device type definition +extern const device_type ELECTRON_M2105; + + +#endif /* __ELECTRON_M2105__ */ diff --git a/src/mame/drivers/electron.cpp b/src/mame/drivers/electron.cpp index ac902576be6..9df4d593a57 100644 --- a/src/mame/drivers/electron.cpp +++ b/src/mame/drivers/electron.cpp @@ -54,7 +54,6 @@ that can be done through BASIC programs seem to behave properly (most of the tim Incomplete: - Sound (sound is too high?) - - Graphics (seems to be wrong for several games) - 1 MHz bus is not emulated - Bus claiming by ULA is not implemented - Currently the cartridge support always loads the upper rom in page 12 @@ -223,12 +222,28 @@ static MACHINE_CONFIG_START( electron, electron_state ) MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "electron_cart") MCFG_GENERIC_LOAD(electron_state, electron_cart) - /* expansion ports */ + /* expansion port */ MCFG_ELECTRON_EXPANSION_SLOT_ADD("exp", electron_expansion_devices, nullptr) + MCFG_ELECTRON_EXPANSION_SLOT_IRQ_HANDLER(INPUTLINE("maincpu", M6502_IRQ_LINE)) + MCFG_ELECTRON_EXPANSION_SLOT_NMI_HANDLER(INPUTLINE("maincpu", M6502_NMI_LINE)) + MCFG_ELECTRON_EXPANSION_SLOT_RES_HANDLER(INPUTLINE("maincpu", INPUT_LINE_RESET)) /* software lists */ - MCFG_SOFTWARE_LIST_ADD("cass_list","electron_cass") - MCFG_SOFTWARE_LIST_ADD("cart_list","electron_cart") + MCFG_SOFTWARE_LIST_ADD("cass_list", "electron_cass") + MCFG_SOFTWARE_LIST_ADD("cart_list", "electron_cart") +MACHINE_CONFIG_END + + +static MACHINE_CONFIG_DERIVED( btm2105, electron ) + MCFG_SCREEN_MODIFY("screen") + MCFG_SCREEN_COLOR(rgb_t::amber) + + /* expansion port */ + MCFG_DEVICE_MODIFY("exp") + MCFG_DEVICE_SLOT_INTERFACE(electron_expansion_devices, "m2105", true) + + /* software lists */ + MCFG_SOFTWARE_LIST_REMOVE("cass_list") MACHINE_CONFIG_END @@ -236,27 +251,31 @@ MACHINE_CONFIG_END ROM_START(electron) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) ROM_REGION( 0x44000, "user1", 0 ) /* OS Rom */ - ROM_LOAD( "os.rom", 0x40000, 0x4000, CRC(bf63fb1f) SHA1(a48b8fa0cfb09140e808ac8a187316c605a0b32e) ) /* Os rom */ - /* 00000 0 available for cartridges */ - /* 04000 1 available for cartridges */ - /* 08000 2 available for cartridges */ - /* 0c000 3 available for cartridges */ - /* 10000 4 available for cartridges */ - /* 14000 5 available for cartridges */ - /* 18000 6 available for cartridges */ - /* 1c000 7 available for cartridges */ - /* 20000 8 keyboard */ - /* 24000 9 keyboard mirror */ - /* 28000 10 Basic rom */ - ROM_LOAD( "basic.rom", 0x28000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281) ) - /* 2c000 11 Basic rom mirror */ - ROM_COPY( "user1", 0x28000, 0x2c000, 0x4000 ) - /* 30000 12 available for cartridges with a language ROM */ - /* 34000 13 available for cartridges with a language ROM */ - /* 38000 14 available for cartridges with a language ROM */ - /* 3c000 15 available for cartridges with a language ROM */ + ROM_LOAD( "os.rom", 0x40000, 0x4000, CRC(bf63fb1f) SHA1(a48b8fa0cfb09140e808ac8a187316c605a0b32e) ) /* OS rom */ + /* 00000 0 Second external socket on the expansion module (SK2) */ + /* 04000 1 Second external socket on the expansion module (SK2) */ + /* 08000 2 First external socket on the expansion module (SK1) */ + /* 0c000 3 First external socket on the expansion module (SK1) */ + /* 10000 4 Disc */ + /* 14000 5 USER applications */ + /* 18000 6 USER applications */ + /* 1c000 7 Modem interface ROM */ + /* 20000 8 Keyboard */ + /* 24000 9 Keyboard mirror */ + /* 28000 10 BASIC rom */ + /* 2c000 11 BASIC rom mirror */ + /* 30000 12 Expansion module operating system */ + /* 34000 13 High priority slot in expansion module */ + /* 38000 14 ECONET */ + /* 3c000 15 Reserved */ + ROM_LOAD("basic.rom", 0x28000, 0x4000, CRC(79434781) SHA1(4a7393f3a45ea309f744441c16723e2ef447a281)) + ROM_COPY("user1", 0x28000, 0x2c000, 0x4000) ROM_END -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ -COMP ( 1983, electron, 0, 0, electron, electron, driver_device, 0, "Acorn", "Acorn Electron", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -//COMP ( 1985, btm2501, electron, 0, electron, electron, driver_device, 0, "British Telecom Business Systems", "Merlin M2501", MACHINE_NOT_WORKING ) + +#define rom_btm2105 rom_electron + + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP ( 1983, electron, 0, 0, electron, electron, driver_device, 0, "Acorn", "Acorn Electron", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +COMP ( 1985, btm2105, electron, 0, btm2105, electron, driver_device, 0, "British Telecom Business Systems", "BT Merlin M2105", MACHINE_NOT_WORKING ) diff --git a/src/mame/includes/electron.h b/src/mame/includes/electron.h index a2c616c7954..6735289c230 100644 --- a/src/mame/includes/electron.h +++ b/src/mame/includes/electron.h @@ -76,6 +76,7 @@ public: m_beeper(*this, "beeper"), m_cart(*this, "cartslot"), m_keybd(*this, "LINE") + m_exp(*this, "exp") { } ULA m_ula; @@ -105,6 +106,7 @@ public: required_device m_beeper; required_device m_cart; required_ioport_array<14> m_keybd; + required_device m_exp; inline UINT8 read_vram( UINT16 addr ); inline void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); void electron_interrupt_handler(int mode, int interrupt); diff --git a/src/mame/machine/electron.cpp b/src/mame/machine/electron.cpp index a8df99e819f..e3d847ae835 100644 --- a/src/mame/machine/electron.cpp +++ b/src/mame/machine/electron.cpp @@ -366,10 +366,37 @@ void electron_state::machine_start() else lo_rom = memregion("user1")->base(); - membank("bank2")->configure_entries(0, 1, lo_rom, 0x4000); - membank("bank2")->configure_entries(1, 11, memregion("user1")->base() + 0x04000, 0x4000); - membank("bank2")->configure_entries(12, 1, up_rom, 0x4000); - membank("bank2")->configure_entries(13, 3, memregion("user1")->base() + 0x34000, 0x4000); + membank("bank2")->configure_entries(0, 1, lo_rom, 0x4000); + membank("bank2")->configure_entries(1, 1, up_rom, 0x4000); + + 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; diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 5838acde5c7..6d123ba52f9 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -11741,6 +11741,7 @@ avenger // (c) 1975 Electra @source:electron.cpp electron // 1983 Acorn Electron +btm2105 // 1985 BT Merlin M2105 @source:elekscmp.cpp elekscmp //