summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/namco06.h
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/mame/machine/namco06.h
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/mame/machine/namco06.h')
-rw-r--r--src/mame/machine/namco06.h66
1 files changed, 24 insertions, 42 deletions
diff --git a/src/mame/machine/namco06.h b/src/mame/machine/namco06.h
index 04f4e56af28..9b2af7522ad 100644
--- a/src/mame/machine/namco06.h
+++ b/src/mame/machine/namco06.h
@@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
-#ifndef NAMCO06_H
-#define NAMCO06_H
+#ifndef MAME_MACHINE_NAMCO06_H
+#define MAME_MACHINE_NAMCO06_H
+
+#pragma once
struct namco_06xx_config
@@ -21,42 +23,42 @@ struct namco_06xx_config
namco_06xx_device::set_maincpu(*device, "^" _tag);
#define MCFG_NAMCO_06XX_READ_0_CB(_devcb) \
- devcb = &namco_06xx_device::set_read_0_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_read_callback<0>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_READ_1_CB(_devcb) \
- devcb = &namco_06xx_device::set_read_1_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_read_callback<1>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_READ_2_CB(_devcb) \
- devcb = &namco_06xx_device::set_read_2_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_read_callback<2>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_READ_3_CB(_devcb) \
- devcb = &namco_06xx_device::set_read_3_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_read_callback<3>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_READ_REQUEST_0_CB(_devcb) \
- devcb = &namco_06xx_device::set_read_request_0_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_read_request_callback<0>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_READ_REQUEST_1_CB(_devcb) \
- devcb = &namco_06xx_device::set_read_request_1_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_read_request_callback<1>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_READ_REQUEST_2_CB(_devcb) \
- devcb = &namco_06xx_device::set_read_request_2_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_read_request_callback<2>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_READ_REQUEST_3_CB(_devcb) \
- devcb = &namco_06xx_device::set_read_request_3_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_read_request_callback<3>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_WRITE_0_CB(_devcb) \
- devcb = &namco_06xx_device::set_write_0_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_write_callback<0>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_WRITE_1_CB(_devcb) \
- devcb = &namco_06xx_device::set_write_1_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_write_callback<1>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_WRITE_2_CB(_devcb) \
- devcb = &namco_06xx_device::set_write_2_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_write_callback<2>(*device, DEVCB_##_devcb);
#define MCFG_NAMCO_06XX_WRITE_3_CB(_devcb) \
- devcb = &namco_06xx_device::set_write_3_callback(*device, DEVCB_##_devcb);
+ devcb = &namco_06xx_device::set_write_callback<3>(*device, DEVCB_##_devcb);
/* device get info callback */
@@ -67,21 +69,11 @@ public:
static void set_maincpu(device_t &device, const char *tag) { downcast<namco_06xx_device &>(device).m_nmicpu.set_tag(tag); }
- template<class _Object> static devcb_base &set_read_0_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_read_0.set_callback(object); }
- template<class _Object> static devcb_base &set_read_1_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_read_1.set_callback(object); }
- template<class _Object> static devcb_base &set_read_2_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_read_2.set_callback(object); }
- template<class _Object> static devcb_base &set_read_3_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_read_3.set_callback(object); }
-
- template<class _Object> static devcb_base &set_read_request_0_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_readreq_0.set_callback(object); }
- template<class _Object> static devcb_base &set_read_request_1_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_readreq_1.set_callback(object); }
- template<class _Object> static devcb_base &set_read_request_2_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_readreq_2.set_callback(object); }
- template<class _Object> static devcb_base &set_read_request_3_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_readreq_3.set_callback(object); }
+ template <unsigned N, class Object> static devcb_base &set_read_callback(device_t &device, Object &&cb) { return downcast<namco_06xx_device &>(device).m_read[N].set_callback(std::forward<Object>(cb)); }
+ template <unsigned N, class Object> static devcb_base &set_read_request_callback(device_t &device, Object &&cb) { return downcast<namco_06xx_device &>(device).m_readreq[N].set_callback(std::forward<Object>(cb)); }
- template<class _Object> static devcb_base &set_write_0_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_write_0.set_callback(object); }
- template<class _Object> static devcb_base &set_write_1_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_write_1.set_callback(object); }
- template<class _Object> static devcb_base &set_write_2_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_write_2.set_callback(object); }
- template<class _Object> static devcb_base &set_write_3_callback(device_t &device, _Object object) { return downcast<namco_06xx_device &>(device).m_write_3.set_callback(object); }
+ template <unsigned N, class Object> static devcb_base &set_write_callback(device_t &device, Object &&cb) { return downcast<namco_06xx_device &>(device).m_write[N].set_callback(std::forward<Object>(cb)); }
DECLARE_READ8_MEMBER( data_r );
DECLARE_WRITE8_MEMBER( data_w );
@@ -102,24 +94,14 @@ private:
required_device<cpu_device> m_nmicpu;
- devcb_read8 m_read_0;
- devcb_read8 m_read_1;
- devcb_read8 m_read_2;
- devcb_read8 m_read_3;
+ devcb_read8 m_read[4];
- devcb_write_line m_readreq_0;
- devcb_write_line m_readreq_1;
- devcb_write_line m_readreq_2;
- devcb_write_line m_readreq_3;
+ devcb_write_line m_readreq[4];
- devcb_write8 m_write_0;
- devcb_write8 m_write_1;
- devcb_write8 m_write_2;
- devcb_write8 m_write_3;
+ devcb_write8 m_write[4];
};
-extern const device_type NAMCO_06XX;
-
+DECLARE_DEVICE_TYPE(NAMCO_06XX, namco_06xx_device)
-#endif
+#endif // MAME_MACHINE_NAMCO06_H