summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/msm5832.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2011-04-27 05:11:18 +0000
committer Aaron Giles <aaron@aarongiles.com>2011-04-27 05:11:18 +0000
commit919913f118760c0ca41ab63512bd5c106f6fd840 (patch)
treecd6c115c8e9c5280ac4bd16eabfe69c7341151c2 /src/emu/machine/msm5832.c
parent84f2c31f7d6f6c667427b1d60c83e6dc9f420d60 (diff)
Collapsed device_config and device_t into one class. Updated all
existing modern devices and the legacy wrappers to work in this environment. This in general greatly simplifies writing a modern device. [Aaron Giles] General notes: * some more cleanup probably needs to happen behind this change, but I needed to get it in before the next device modernization or import from MESS :) * new template function device_creator which automatically defines the static function that creates the device; use this instead of creating a static_alloc_device_config function * added device_stop() method which is called at around the time the previous device_t's destructor was called; if you auto_free anything, do it here because the machine is gone when the destructor is called * changed the static_set_* calls to pass a device_t & instead of a device_config * * for many devices, the static config structure member names over- lapped the device's names for devcb_* functions; in these cases the members in the interface were renamed to have a _cb suffix * changed the driver_enumerator to only cache 100 machine_configs because caching them all took a ton of memory; fortunately this implementation detail is completely hidden behind the driver_enumerator interface * got rid of the macros for creating derived classes; doing it manually is now clean enough that it isn't worth hiding the details in a macro
Diffstat (limited to 'src/emu/machine/msm5832.c')
-rw-r--r--src/emu/machine/msm5832.c57
1 files changed, 7 insertions, 50 deletions
diff --git a/src/emu/machine/msm5832.c b/src/emu/machine/msm5832.c
index 9a0af084775..7f8eb374a39 100644
--- a/src/emu/machine/msm5832.c
+++ b/src/emu/machine/msm5832.c
@@ -22,6 +22,9 @@
#include "msm5832.h"
+// device type definition
+const device_type MSM5832 = &device_creator<msm5832_device>;
+
//**************************************************************************
// MACROS / CONSTANTS
@@ -56,51 +59,6 @@ static const int DAYS_PER_MONTH[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-// devices
-const device_type MSM5832 = msm5832_device_config::static_alloc_device_config;
-
-
-
-//**************************************************************************
-// DEVICE CONFIGURATION
-//**************************************************************************
-
-//-------------------------------------------------
-// msm5832_device_config - constructor
-//-------------------------------------------------
-
-msm5832_device_config::msm5832_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
- : device_config(mconfig, static_alloc_device_config, "MSM5832", tag, owner, clock),
- device_config_rtc_interface(mconfig, *this)
-{
-}
-
-
-//-------------------------------------------------
-// static_alloc_device_config - allocate a new
-// configuration object
-//-------------------------------------------------
-
-device_config *msm5832_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
-{
- return global_alloc(msm5832_device_config(mconfig, tag, owner, clock));
-}
-
-
-//-------------------------------------------------
-// alloc_device - allocate a new device object
-//-------------------------------------------------
-
-device_t *msm5832_device_config::alloc_device(running_machine &machine) const
-{
- return auto_alloc(machine, msm5832_device(machine, *this));
-}
-
-
-//**************************************************************************
// INLINE HELPERS
//**************************************************************************
@@ -214,15 +172,14 @@ inline void msm5832_device::advance_minutes()
// msm5832_device - constructor
//-------------------------------------------------
-msm5832_device::msm5832_device(running_machine &_machine, const msm5832_device_config &config)
- : device_t(_machine, config),
- device_rtc_interface(_machine, config, *this),
+msm5832_device::msm5832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, MSM5832, "MSM5832", tag, owner, clock),
+ device_rtc_interface(mconfig, *this),
m_hold(0),
m_address(0),
m_read(0),
m_write(0),
- m_cs(0),
- m_config(config)
+ m_cs(0)
{
for (int i = 0; i < 13; i++)
m_reg[i] = 0;