summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/devlegcy.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-08-26 15:21:19 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-08-26 15:21:19 +0000
commit47dd9fe5680add9e438e75d71ce476b082382fdf (patch)
tree55f9ab6e9fe1351cbff6992924197ed9a6a33e26 /src/emu/devlegcy.c
parent33e4664bb21d437c5b8fee3c470b00084d0d9d8a (diff)
De-converted MACHINE_DRIVER from tokens back to constructor functions, regaining
type safety. If legacy devices still use inline data, those types are not checked. However, new devices no longer have access to the generic m_inline_data. Instead their MDRV_* macros should map to calls to static functions in the device config class which downcast a generic device_config to the specific device config, and then set the appropriate values. This is not to be done inline in order to prevent further code bloat in the constructors. See eeprom/7474/i2cmem/okim6295 for examples. #ifdef'ed several unused machine driver definitions that weren't referenced.
Diffstat (limited to 'src/emu/devlegcy.c')
-rw-r--r--src/emu/devlegcy.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/emu/devlegcy.c b/src/emu/devlegcy.c
index c3cd3d8bd23..9eb8e416003 100644
--- a/src/emu/devlegcy.c
+++ b/src/emu/devlegcy.c
@@ -128,6 +128,65 @@ const char *legacy_device_config_base::get_legacy_config_string(UINT32 state) co
//-------------------------------------------------
+// static_set_inline32 - configuration helper to
+// set a 32-bit value in the inline configuration
+//-------------------------------------------------
+
+void legacy_device_config_base::static_set_inline32(device_config *device, UINT32 offset, UINT32 size, UINT32 value)
+{
+ legacy_device_config_base *legacy = downcast<legacy_device_config_base *>(device);
+ void *dest = reinterpret_cast<UINT8 *>(legacy->m_inline_config) + offset;
+ if (size == 1)
+ *reinterpret_cast<UINT8 *>(dest) = value;
+ else if (size == 2)
+ *reinterpret_cast<UINT16 *>(dest) = value;
+ else if (size == 4)
+ *reinterpret_cast<UINT32 *>(dest) = value;
+ else
+ throw emu_fatalerror("Unexpected size %d in legacy_device_config_base::static_set_inline32", size);
+}
+
+
+//-------------------------------------------------
+// static_set_inline64 - configuration helper to
+// set a 64-bit value in the inline configuration
+//-------------------------------------------------
+
+void legacy_device_config_base::static_set_inline64(device_config *device, UINT32 offset, UINT32 size, UINT64 value)
+{
+ legacy_device_config_base *legacy = downcast<legacy_device_config_base *>(device);
+ void *dest = reinterpret_cast<UINT8 *>(legacy->m_inline_config) + offset;
+ if (size == 1)
+ *reinterpret_cast<UINT8 *>(dest) = value;
+ else if (size == 2)
+ *reinterpret_cast<UINT16 *>(dest) = value;
+ else if (size == 4)
+ *reinterpret_cast<UINT32 *>(dest) = value;
+ else if (size == 8)
+ *reinterpret_cast<UINT64 *>(dest) = value;
+ else
+ throw emu_fatalerror("Unexpected size %d in legacy_device_config_base::static_set_inline64", size);
+}
+
+
+//-------------------------------------------------
+// static_set_inline_float - configuration helper
+// to set a floating-point value in the inline
+// configuration
+//-------------------------------------------------
+
+void legacy_device_config_base::static_set_inline_float(device_config *device, UINT32 offset, UINT32 size, float value)
+{
+ legacy_device_config_base *legacy = downcast<legacy_device_config_base *>(device);
+ void *dest = reinterpret_cast<UINT8 *>(legacy->m_inline_config) + offset;
+ if (size == 4)
+ *reinterpret_cast<float *>(dest) = value;
+ else
+ throw emu_fatalerror("Unexpected size %d in legacy_device_config_base::static_set_inline_float", size);
+}
+
+
+//-------------------------------------------------
// device_validity_check - perform validity
// checks on a device configuration
//-------------------------------------------------