summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/6526cia.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/6526cia.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/6526cia.h')
-rw-r--r--src/emu/machine/6526cia.h66
1 files changed, 31 insertions, 35 deletions
diff --git a/src/emu/machine/6526cia.h b/src/emu/machine/6526cia.h
index 970d9ab91c1..ab17474524c 100644
--- a/src/emu/machine/6526cia.h
+++ b/src/emu/machine/6526cia.h
@@ -39,7 +39,7 @@
- //**************************************************************************
+//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
@@ -72,51 +72,30 @@ struct mos6526_interface
{
int m_tod_clock;
- devcb_write_line m_out_irq_func;
- devcb_write_line m_out_pc_func;
- devcb_write_line m_out_cnt_func;
- devcb_write_line m_out_sp_func;
-
- devcb_read8 m_in_pa_func;
- devcb_write8 m_out_pa_func;
-
- devcb_read8 m_in_pb_func;
- devcb_write8 m_out_pb_func;
-};
-
-
-
-// ======================> mos6526_device_config
+ devcb_write_line m_out_irq_cb;
+ devcb_write_line m_out_pc_cb;
+ devcb_write_line m_out_cnt_cb;
+ devcb_write_line m_out_sp_cb;
-class mos6526_device_config : public device_config,
- public mos6526_interface
-{
- friend class mos6526_device;
-
- // construction/destruction
- mos6526_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
+ devcb_read8 m_in_pa_cb;
+ devcb_write8 m_out_pa_cb;
-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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
+ devcb_read8 m_in_pb_cb;
+ devcb_write8 m_out_pb_cb;
};
// ======================> mos6526_device
-class mos6526_device : public device_t
+class mos6526_device : public device_t,
+ public mos6526_interface
{
- friend class mos6526_device_config;
friend class dart_channel;
+protected:
// construction/destruction
- mos6526_device(running_machine &_machine, const mos6526_device_config &_config);
+ mos6526_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
public:
UINT8 reg_r(UINT8 offset);
@@ -148,6 +127,7 @@ public:
protected:
// device-level overrides
+ virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void device_post_load() { }
@@ -221,8 +201,24 @@ private:
UINT8 m_cnt;
UINT8 m_shift;
UINT8 m_serial;
+};
+
+class mos6526r1_device : public mos6526_device
+{
+public:
+ mos6526r1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+};
- const mos6526_device_config &m_config;
+class mos6526r2_device : public mos6526_device
+{
+public:
+ mos6526r2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+};
+
+class mos8520_device : public mos6526_device
+{
+public:
+ mos8520_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};