summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/electron
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-05-07 23:18:47 +1000
committer Vas Crabb <vas@vastheman.com>2017-05-14 21:44:11 +1000
commit0f0d39ef81562c75e79176dd3bebb1e491ca39d5 (patch)
tree201cee7fdf55ee800f83859a92efd2cfe66cf2b3 /src/devices/bus/electron
parente6c4be2b4d71c7a6c95be0bae111eb416ff0f9e7 (diff)
Move static data out of devices into the device types. This is a significant change, so please pay attention.
The core changes are: * Short name, full name and source file are no longer members of device_t, they are part of the device type * MACHINE_COFIG_START no longer needs a driver class * MACHINE_CONFIG_DERIVED_CLASS is no longer necessary * Specify the state class you want in the GAME/COMP/CONS line * The compiler will work out the base class where the driver init member is declared * There is one static device type object per driver rather than one per machine configuration Use DECLARE_DEVICE_TYPE or DECLARE_DEVICE_TYPE_NS to declare device type. * DECLARE_DEVICE_TYPE forward-declares teh device type and class, and declares extern object finders. * DECLARE_DEVICE_TYPE_NS is for devices classes in namespaces - it doesn't forward-declare the device type. Use DEFINE_DEVICE_TYPE or DEFINE_DEVICE_TYPE_NS to define device types. * These macros declare storage for the static data, and instantiate the device type and device finder templates. The rest of the changes are mostly just moving stuff out of headers that shouldn't be there, renaming stuff for consistency, and scoping stuff down where appropriate. Things I've actually messed with substantially: * More descriptive names for a lot of devices * Untangled the fantasy sound from the driver state, which necessitates breaking up sound/flip writes * Changed DECO BSMT2000 ready callback into a device delegate * Untangled Microprose 3D noise from driver state * Used object finders for CoCo multipak, KC85 D002, and Irem sound subdevices * Started to get TI-99 stuff out of the TI-990 directory and arrange bus devices properly * Started to break out common parts of Samsung ARM SoC devices * Turned some of FM, SID, SCSP DSP, EPIC12 and Voodoo cores into something resmbling C++ * Tried to make Z180 table allocation/setup a bit safer * Converted generic keyboard/terminal to not use WRITE8 - space/offset aren't relevant * Dynamically allocate generic terminal buffer so derived devices (e.g. teleprinter) can specify size * Imporved encapsulation of Z80DART channels * Refactored the SPC7110 bit table generator loop to make it more readable * Added wrappers for SNES PPU operations so members can be made protected * Factored out some boilerplate for YM chips with PSG * toaplan2 gfx * stic/intv resolution * Video System video * Out Run/Y-board sprite alignment * GIC video hookup * Amstrad CPC ROM box members * IQ151 ROM cart region * MSX cart IRQ callback resolution time * SMS passthrough control devices starting subslots I've smoke-tested several drivers, but I've probably missed something. Things I've missed will likely blow up spectacularly with failure to bind errors and the like. Let me know if there's more subtle breakage (could have happened in FM or Voodoo). And can everyone please, please try to keep stuff clean. In particular, please stop polluting the global namespace. Keep things out of headers that don't need to be there, and use things that can be scoped down rather than macros. It feels like an uphill battle trying to get this stuff under control while more of it's added.
Diffstat (limited to 'src/devices/bus/electron')
-rw-r--r--src/devices/bus/electron/exp.cpp6
-rw-r--r--src/devices/bus/electron/exp.h20
-rw-r--r--src/devices/bus/electron/fbjoy.cpp8
-rw-r--r--src/devices/bus/electron/fbjoy.h10
-rw-r--r--src/devices/bus/electron/m2105.cpp20
-rw-r--r--src/devices/bus/electron/m2105.h9
-rw-r--r--src/devices/bus/electron/plus3.cpp16
-rw-r--r--src/devices/bus/electron/plus3.h11
-rw-r--r--src/devices/bus/electron/pwrjoy.cpp10
-rw-r--r--src/devices/bus/electron/pwrjoy.h11
10 files changed, 61 insertions, 60 deletions
diff --git a/src/devices/bus/electron/exp.cpp b/src/devices/bus/electron/exp.cpp
index 93175809a57..3bcc1377e19 100644
--- a/src/devices/bus/electron/exp.cpp
+++ b/src/devices/bus/electron/exp.cpp
@@ -14,7 +14,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type ELECTRON_EXPANSION_SLOT = device_creator<electron_expansion_slot_device>;
+DEFINE_DEVICE_TYPE(ELECTRON_EXPANSION_SLOT, electron_expansion_slot_device, "electron_expansion_slot", "Acorn Electron Expansion port")
//**************************************************************************
@@ -50,8 +50,8 @@ 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_t clock) :
- device_t(mconfig, ELECTRON_EXPANSION_SLOT, "Acorn Electron Expansion port", tag, owner, clock, "electron_expansion_slot", __FILE__),
- device_slot_interface(mconfig, *this),
+ device_t(mconfig, ELECTRON_EXPANSION_SLOT, tag, owner, clock),
+ device_slot_interface(mconfig, *this),
m_card(nullptr),
m_irq_handler(*this),
m_nmi_handler(*this)
diff --git a/src/devices/bus/electron/exp.h b/src/devices/bus/electron/exp.h
index a87b1670fcc..57b98aa6d5c 100644
--- a/src/devices/bus/electron/exp.h
+++ b/src/devices/bus/electron/exp.h
@@ -83,10 +83,10 @@ AC RETURNS (pins 3,4) - adaptor. A total of 6W may be drawn from these lines as
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_ELECTRON_EXP_H
+#define MAME_BUS_ELECTRON_EXP_H
-#ifndef __ELECTRON_EXPANSION_SLOT__
-#define __ELECTRON_EXPANSION_SLOT__
+#pragma once
@@ -133,11 +133,11 @@ public:
virtual ~electron_expansion_slot_device();
// callbacks
- template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object)
- { return downcast<electron_expansion_slot_device &>(device).m_irq_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_irq_handler(device_t &device, Object &&cb)
+ { return downcast<electron_expansion_slot_device &>(device).m_irq_handler.set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_nmi_handler(device_t &device, _Object object)
- { return downcast<electron_expansion_slot_device &>(device).m_nmi_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_nmi_handler(device_t &device, Object &&cb)
+ { return downcast<electron_expansion_slot_device &>(device).m_nmi_handler.set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
@@ -161,18 +161,20 @@ 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:
+ device_electron_expansion_interface(const machine_config &mconfig, device_t &device);
+
electron_expansion_slot_device *m_slot;
};
// device type definition
extern const device_type ELECTRON_EXPANSION_SLOT;
+DECLARE_DEVICE_TYPE(ELECTRON_EXPANSION_SLOT, electron_expansion_device)
SLOT_INTERFACE_EXTERN( electron_expansion_devices );
-#endif
+#endif // MAME_BUS_ELECTRON_EXP_H
diff --git a/src/devices/bus/electron/fbjoy.cpp b/src/devices/bus/electron/fbjoy.cpp
index 532df461f6a..643b697615b 100644
--- a/src/devices/bus/electron/fbjoy.cpp
+++ b/src/devices/bus/electron/fbjoy.cpp
@@ -15,7 +15,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type ELECTRON_FBJOY = device_creator<electron_fbjoy_device>;
+DEFINE_DEVICE_TYPE(ELECTRON_FBJOY, electron_fbjoy_device, "electron_fbjoy", "First Byte Joystick Interface")
static INPUT_PORTS_START( fbjoy )
@@ -47,9 +47,9 @@ ioport_constructor electron_fbjoy_device::device_input_ports() const
//-------------------------------------------------
electron_fbjoy_device::electron_fbjoy_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ELECTRON_FBJOY, "First Byte Joystick Interface", tag, owner, clock, "electron_fbjoy", __FILE__),
- device_electron_expansion_interface(mconfig, *this),
- m_joy(*this, "JOY")
+ : device_t(mconfig, ELECTRON_FBJOY, tag, owner, clock)
+ , device_electron_expansion_interface(mconfig, *this)
+ , m_joy(*this, "JOY")
{
}
diff --git a/src/devices/bus/electron/fbjoy.h b/src/devices/bus/electron/fbjoy.h
index 0323f4f4bbf..d532c896d46 100644
--- a/src/devices/bus/electron/fbjoy.h
+++ b/src/devices/bus/electron/fbjoy.h
@@ -8,10 +8,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_ELECTRON_FBJOY_H
+#define MAME_BUS_ELECTRON_FBJOY_H
-#ifndef __ELECTRON_FBJOY__
-#define __ELECTRON_FBJOY__
+#pragma once
#include "exp.h"
@@ -46,7 +46,7 @@ private:
// device type definition
-extern const device_type ELECTRON_FBJOY;
+DECLARE_DEVICE_TYPE(ELECTRON_FBJOY, electron_fbjoy_device)
-#endif
+#endif // MAME_BUS_ELECTRON_FBJOY_H
diff --git a/src/devices/bus/electron/m2105.cpp b/src/devices/bus/electron/m2105.cpp
index ba437842a4c..1e3ebc2308a 100644
--- a/src/devices/bus/electron/m2105.cpp
+++ b/src/devices/bus/electron/m2105.cpp
@@ -16,7 +16,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type ELECTRON_M2105 = device_creator<electron_m2105_device>;
+DEFINE_DEVICE_TYPE(ELECTRON_M2105, electron_m2105_device, "electron_m2105", "Acorn M2105 Expansion")
//-------------------------------------------------
@@ -123,15 +123,15 @@ const tiny_rom_entry *electron_m2105_device::device_rom_region() const
//-------------------------------------------------
electron_m2105_device::electron_m2105_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ELECTRON_M2105, "Acorn M2105 Expansion", 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_duart(*this, "sc2681"),
- m_tms(*this, "tms5220"),
- m_centronics(*this, "centronics"),
- m_irqs(*this, "irqs")
+ : device_t(mconfig, ELECTRON_M2105, tag, owner, clock)
+ , 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_duart(*this, "sc2681")
+ , m_tms(*this, "tms5220")
+ , m_centronics(*this, "centronics")
+ , m_irqs(*this, "irqs")
{
}
diff --git a/src/devices/bus/electron/m2105.h b/src/devices/bus/electron/m2105.h
index d9d8d5b3aed..94ab1d8ec5f 100644
--- a/src/devices/bus/electron/m2105.h
+++ b/src/devices/bus/electron/m2105.h
@@ -6,9 +6,10 @@
**********************************************************************/
+#ifndef MAME_BUS_ELECTRON_M2105_M
+#define MAME_BUS_ELECTRON_M2105_M
-#ifndef __ELECTRON_M2105__
-#define __ELECTRON_M2105__
+#pragma once
#include "exp.h"
#include "machine/6522via.h"
@@ -53,7 +54,7 @@ private:
// device type definition
-extern const device_type ELECTRON_M2105;
+DECLARE_DEVICE_TYPE(ELECTRON_M2105, electron_m2105_device)
-#endif /* __ELECTRON_M2105__ */
+#endif // MAME_BUS_ELECTRON_M2105_M
diff --git a/src/devices/bus/electron/plus3.cpp b/src/devices/bus/electron/plus3.cpp
index 98189b6cae7..46395d81f09 100644
--- a/src/devices/bus/electron/plus3.cpp
+++ b/src/devices/bus/electron/plus3.cpp
@@ -24,7 +24,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type ELECTRON_PLUS3 = device_creator<electron_plus3_device>;
+DEFINE_DEVICE_TYPE(ELECTRON_PLUS3, electron_plus3_device, "electron_plus3", "Acorn Plus 3 Disc Expansion")
//-------------------------------------------------
@@ -102,12 +102,12 @@ const tiny_rom_entry *electron_plus3_device::device_rom_region() const
//-------------------------------------------------
electron_plus3_device::electron_plus3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t 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_t(mconfig, ELECTRON_PLUS3, tag, owner, clock)
+ , 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")
{
}
@@ -121,7 +121,7 @@ void electron_plus3_device::device_start()
m_slot = dynamic_cast<electron_expansion_slot_device *>(owner());
space.install_readwrite_handler(0xfcc0, 0xfcc0, READ8_DELEGATE(electron_plus3_device, wd1770_status_r), WRITE8_DELEGATE(electron_plus3_device, wd1770_status_w));
- space.install_readwrite_handler(0xfcc4, 0xfcc7, READ8_DEVICE_DELEGATE(m_fdc, wd1770_t, read), WRITE8_DEVICE_DELEGATE(m_fdc, wd1770_t, write));
+ space.install_readwrite_handler(0xfcc4, 0xfcc7, READ8_DEVICE_DELEGATE(m_fdc, wd1770_device, read), WRITE8_DEVICE_DELEGATE(m_fdc, wd1770_device, write));
}
//-------------------------------------------------
diff --git a/src/devices/bus/electron/plus3.h b/src/devices/bus/electron/plus3.h
index 80aa3ec2320..0fc49206f89 100644
--- a/src/devices/bus/electron/plus3.h
+++ b/src/devices/bus/electron/plus3.h
@@ -6,9 +6,8 @@
**********************************************************************/
-
-#ifndef __ELECTRON_PLUS3__
-#define __ELECTRON_PLUS3__
+#ifndef MAME_BUS_ELECTRON_PLUS3_H
+#define MAME_BUS_ELECTRON_PLUS3_H
#include "exp.h"
#include "machine/wd_fdc.h"
@@ -42,7 +41,7 @@ protected:
private:
required_memory_region m_exp_rom;
- required_device<wd1770_t> m_fdc;
+ required_device<wd1770_device> m_fdc;
required_device<floppy_connector> m_floppy0;
optional_device<floppy_connector> m_floppy1;
@@ -51,7 +50,7 @@ private:
// device type definition
-extern const device_type ELECTRON_PLUS3;
+DECLARE_DEVICE_TYPE(ELECTRON_PLUS3, electron_plus3_device)
-#endif /* __ELECTRON_PLUS3__ */
+#endif // MAME_BUS_ELECTRON_PLUS3_H
diff --git a/src/devices/bus/electron/pwrjoy.cpp b/src/devices/bus/electron/pwrjoy.cpp
index 02f65b277e9..98d6422cdd8 100644
--- a/src/devices/bus/electron/pwrjoy.cpp
+++ b/src/devices/bus/electron/pwrjoy.cpp
@@ -13,7 +13,7 @@
// DEVICE DEFINITIONS
//**************************************************************************
-const device_type ELECTRON_PWRJOY = device_creator<electron_pwrjoy_device>;
+DEFINE_DEVICE_TYPE(ELECTRON_PWRJOY, electron_pwrjoy_device, "electron_pwrjoy", "Power Software Joystick Interface")
ROM_START( pwrjoy )
@@ -56,10 +56,10 @@ const tiny_rom_entry *electron_pwrjoy_device::device_rom_region() const
//-------------------------------------------------
electron_pwrjoy_device::electron_pwrjoy_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ELECTRON_PWRJOY, "Power Software Joystick Interface", tag, owner, clock, "electron_pwrjoy", __FILE__),
- device_electron_expansion_interface(mconfig, *this),
- m_exp_rom(*this, "exp_rom"),
- m_joy(*this, "JOY")
+ : device_t(mconfig, ELECTRON_PWRJOY, tag, owner, clock)
+ , device_electron_expansion_interface(mconfig, *this)
+ , m_exp_rom(*this, "exp_rom")
+ , m_joy(*this, "JOY")
{
}
diff --git a/src/devices/bus/electron/pwrjoy.h b/src/devices/bus/electron/pwrjoy.h
index fba6b1b8c1e..1566f21d10d 100644
--- a/src/devices/bus/electron/pwrjoy.h
+++ b/src/devices/bus/electron/pwrjoy.h
@@ -6,10 +6,10 @@
**********************************************************************/
-#pragma once
+#ifndef MAME_BUS_ELECTRON_PWRJOY_H
+#define MAME_BUS_ELECTRON_PWRJOY_H
-#ifndef __ELECTRON_PWRJOY__
-#define __ELECTRON_PWRJOY__
+#pragma once
#include "exp.h"
@@ -46,7 +46,6 @@ private:
// device type definition
-extern const device_type ELECTRON_PWRJOY;
-
+DECLARE_DEVICE_TYPE(ELECTRON_PWRJOY, electron_pwrjoy_device)
-#endif
+#endif // MAME_BUS_ELECTRON_PWRJOY_H