summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/x2212.h
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/x2212.h
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/x2212.h')
-rw-r--r--src/emu/machine/x2212.h55
1 files changed, 16 insertions, 39 deletions
diff --git a/src/emu/machine/x2212.h b/src/emu/machine/x2212.h
index fc85f32e9be..bebc5590baf 100644
--- a/src/emu/machine/x2212.h
+++ b/src/emu/machine/x2212.h
@@ -24,7 +24,7 @@
// to fire on power-down, effectively creating an "auto-save" functionality
#define MCFG_X2212_ADD_AUTOSAVE(_tag) \
MCFG_DEVICE_ADD(_tag, X2212, 0) \
- x2212_device_config::static_set_auto_save(device); \
+ x2212_device::static_set_auto_save(*device); \
@@ -33,50 +33,19 @@
//**************************************************************************
-// ======================> x2212_device_config
-
-class x2212_device_config : public device_config,
- public device_config_memory_interface,
- public device_config_nvram_interface
-{
- friend class x2212_device;
-
- // construction/destruction
- x2212_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
-
-public:
- // allocators
- static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
- virtual device_t *alloc_device(running_machine &machine) const;
-
- // inline configuration helpers
- static void static_set_auto_save(device_config *device);
-
-protected:
- // device_config_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
-
- // device-specific configuration
- address_space_config m_sram_space_config;
- address_space_config m_e2prom_space_config;
-
- // internal state
- bool m_auto_save;
-};
-
-
// ======================> x2212_device
class x2212_device : public device_t,
public device_memory_interface,
public device_nvram_interface
{
- friend class x2212_device_config;
-
+public:
// construction/destruction
- x2212_device(running_machine &_machine, const x2212_device_config &config);
+ x2212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // inline configuration helpers
+ static void static_set_auto_save(device_t &device);
-public:
// I/O operations
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -92,6 +61,9 @@ protected:
// device-level overrides
virtual void device_start();
+ // device_memory_interface overrides
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
+
// device_nvram_interface overrides
virtual void nvram_default();
virtual void nvram_read(emu_file &file);
@@ -99,9 +71,14 @@ protected:
static const int SIZE_DATA = 0x100;
- // internal state
- const x2212_device_config &m_config;
+ // configuration state
+ bool m_auto_save;
+
+ // device-specific configuration
+ address_space_config m_sram_space_config;
+ address_space_config m_e2prom_space_config;
+ // internal state
address_space * m_sram;
address_space * m_e2prom;