diff options
author | 2016-05-30 19:31:41 +0100 | |
---|---|---|
committer | 2016-06-05 22:53:37 +0100 | |
commit | 364ac3ea14cef34a28c1ce5047918639f2380c98 (patch) | |
tree | 4c0961f5683da12d9ec9e59009b115d2f476fbc5 /src/devices/bus/electron | |
parent | 02879abeacb68921ea0d2fc66749757448700e38 (diff) |
electron: added preliminary expansion port
Diffstat (limited to 'src/devices/bus/electron')
-rw-r--r-- | src/devices/bus/electron/exp.cpp | 104 | ||||
-rw-r--r-- | src/devices/bus/electron/exp.h | 158 |
2 files changed, 262 insertions, 0 deletions
diff --git a/src/devices/bus/electron/exp.cpp b/src/devices/bus/electron/exp.cpp new file mode 100644 index 00000000000..b13f6534002 --- /dev/null +++ b/src/devices/bus/electron/exp.cpp @@ -0,0 +1,104 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Electron Expansion Port emulation + +**********************************************************************/ + +#include "exp.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ELECTRON_EXPANSION_SLOT = &device_creator<electron_expansion_slot_device>; + + +//************************************************************************** +// DEVICE ELECTRON_EXPANSION CARD INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_electron_expansion_interface - constructor +//------------------------------------------------- + +device_electron_expansion_interface::device_electron_expansion_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device) +{ + m_slot = dynamic_cast<electron_expansion_slot_device *>(device.owner()); +} + + +//------------------------------------------------- +// ~device_electron_expansion_card_interface - destructor +//------------------------------------------------- + +device_electron_expansion_interface::~device_electron_expansion_interface() +{ +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// electron_expansion_slot_device - constructor +//------------------------------------------------- + +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_start - device-specific startup +//------------------------------------------------- + +void electron_expansion_slot_device::device_start() +{ + m_card = dynamic_cast<device_electron_expansion_interface *>(get_card_device()); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void electron_expansion_slot_device::device_reset() +{ + if (get_card_device()) + { + get_card_device()->reset(); + } +} + + +//------------------------------------------------- +// SLOT_INTERFACE( electron_expansion_devices ) +//------------------------------------------------- + + +// slot devices +//#include "plus1.h" +//#include "plus3.h" +//#include "aplus3.h" +//#include "aplus5.h" +//#include "slogger.h" +//#include "fbjoy.h" +//#include "m2105.h" + + +SLOT_INTERFACE_START( electron_expansion_devices ) + //SLOT_INTERFACE("plus1", ELECTRON_PLUS1) + //SLOT_INTERFACE("plus3", ELECTRON_PLUS3) + //SLOT_INTERFACE("aplus3", ELECTRON_APLUS3) + //SLOT_INTERFACE("aplus5", ELECTRON_APLUS5) + //SLOT_INTERFACE("slogger", ELECTRON_SLOGGER) + //SLOT_INTERFACE("fbjoy", ELECTRON_FBJOY) + //SLOT_INTERFACE("m2105", ELECTRON_M2105) +SLOT_INTERFACE_END diff --git a/src/devices/bus/electron/exp.h b/src/devices/bus/electron/exp.h new file mode 100644 index 00000000000..cfcb7478a10 --- /dev/null +++ b/src/devices/bus/electron/exp.h @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Electron Expansion Port emulation + +********************************************************************** + + 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 + + Signal Definitions: + + 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. ++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. + +**********************************************************************/ + +#pragma once + +#ifndef __ELECTRON_EXPANSION_SLOT__ +#define __ELECTRON_EXPANSION_SLOT__ + +#include "emu.h" + + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +#define ELECTRON_EXPANSION_SLOT_TAG "exp" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_ELECTRON_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \ + 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) + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> electron_expansion_slot_device + +class device_electron_expansion_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() {} + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + device_electron_expansion_interface *m_card; +}; + + +// ======================> device_electron_expansion_card_interface + +class device_electron_expansion_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_electron_expansion_interface(const machine_config &mconfig, device_t &device); + virtual ~device_electron_expansion_interface(); + +protected: + electron_expansion_slot_device *m_slot; +}; + + +// device type definition +extern const device_type ELECTRON_EXPANSION_SLOT; + +SLOT_INTERFACE_EXTERN( electron_expansion_devices ); + + +#endif |