summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/video
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/video
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/video')
-rw-r--r--src/emu/video/cdp1861.c53
-rw-r--r--src/emu/video/cdp1861.h40
-rw-r--r--src/emu/video/cdp1862.c89
-rw-r--r--src/emu/video/cdp1862.h40
-rw-r--r--src/emu/video/crt9007.c159
-rw-r--r--src/emu/video/crt9007.h68
-rw-r--r--src/emu/video/crt9021.c76
-rw-r--r--src/emu/video/crt9021.h40
-rw-r--r--src/emu/video/crt9212.c79
-rw-r--r--src/emu/video/crt9212.h44
-rw-r--r--src/emu/video/dm9368.c79
-rw-r--r--src/emu/video/dm9368.h38
-rw-r--r--src/emu/video/hd44102.c63
-rw-r--r--src/emu/video/hd44102.h39
-rw-r--r--src/emu/video/hd61830.c114
-rw-r--r--src/emu/video/hd61830.h51
-rw-r--r--src/emu/video/hd63484.c2
-rw-r--r--src/emu/video/mc6845.c2
-rw-r--r--src/emu/video/msm6255.c63
-rw-r--r--src/emu/video/msm6255.h35
-rw-r--r--src/emu/video/s2636.c2
-rw-r--r--src/emu/video/saa5050.c2
-rw-r--r--src/emu/video/sed1330.c122
-rw-r--r--src/emu/video/sed1330.h53
-rw-r--r--src/emu/video/tlc34076.c2
-rw-r--r--src/emu/video/tms9927.c2
-rw-r--r--src/emu/video/upd3301.c93
-rw-r--r--src/emu/video/upd3301.h44
-rw-r--r--src/emu/video/voodoo.c12
29 files changed, 473 insertions, 1033 deletions
diff --git a/src/emu/video/cdp1861.c b/src/emu/video/cdp1861.c
index 1c275d89df6..dffa37af41b 100644
--- a/src/emu/video/cdp1861.c
+++ b/src/emu/video/cdp1861.c
@@ -24,19 +24,20 @@
//**************************************************************************
-// GLOBAL VARIABLES
+// LIVE DEVICE
//**************************************************************************
-// devices
-const device_type CDP1861 = cdp1861_device_config::static_alloc_device_config;
-
-
+// device type definition
+const device_type CDP1861 = &device_creator<cdp1861_device>;
-//**************************************************************************
-// DEVICE CONFIGURATION
-//**************************************************************************
+//-------------------------------------------------
+// cdp1861_device - constructor
+//-------------------------------------------------
-GENERIC_DEVICE_CONFIG_SETUP(cdp1861, "CDP1861")
+cdp1861_device::cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, CDP1861, "CDP1861", tag, owner, clock)
+{
+}
//-------------------------------------------------
@@ -45,7 +46,7 @@ GENERIC_DEVICE_CONFIG_SETUP(cdp1861, "CDP1861")
// complete
//-------------------------------------------------
-void cdp1861_device_config::device_config_complete()
+void cdp1861_device::device_config_complete()
{
// inherit a copy of the static data
const cdp1861_interface *intf = reinterpret_cast<const cdp1861_interface *>(static_config());
@@ -55,29 +56,13 @@ void cdp1861_device_config::device_config_complete()
// or initialize to defaults if none provided
else
{
- memset(&m_out_int_func, 0, sizeof(m_out_int_func));
- memset(&m_out_dmao_func, 0, sizeof(m_out_dmao_func));
- memset(&m_out_efx_func, 0, sizeof(m_out_efx_func));
+ memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
+ memset(&m_out_dmao_cb, 0, sizeof(m_out_dmao_cb));
+ memset(&m_out_efx_cb, 0, sizeof(m_out_efx_cb));
}
}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// cdp1861_device - constructor
-//-------------------------------------------------
-
-cdp1861_device::cdp1861_device(running_machine &_machine, const cdp1861_device_config &config)
- : device_t(_machine, config),
- m_config(config)
-{
-}
-
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -85,9 +70,9 @@ cdp1861_device::cdp1861_device(running_machine &_machine, const cdp1861_device_c
void cdp1861_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this);
- devcb_resolve_write_line(&m_out_dmao_func, &m_config.m_out_dmao_func, this);
- devcb_resolve_write_line(&m_out_efx_func, &m_config.m_out_efx_func, this);
+ devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
+ devcb_resolve_write_line(&m_out_dmao_func, &m_out_dmao_cb, this);
+ devcb_resolve_write_line(&m_out_efx_func, &m_out_efx_cb, this);
// allocate timers
m_int_timer = timer_alloc(TIMER_INT);
@@ -95,8 +80,8 @@ void cdp1861_device::device_start()
m_dma_timer = timer_alloc(TIMER_DMA);
// find devices
- m_cpu = machine().device<cpu_device>(m_config.m_cpu_tag);
- m_screen = machine().device<screen_device>(m_config.m_screen_tag);
+ m_cpu = machine().device<cpu_device>(m_cpu_tag);
+ m_screen = machine().device<screen_device>(m_screen_tag);
m_bitmap = auto_bitmap_alloc(machine(), m_screen->width(), m_screen->height(), m_screen->format());
// register for state saving
diff --git a/src/emu/video/cdp1861.h b/src/emu/video/cdp1861.h
index 0bce7e8d497..d03b88148a8 100644
--- a/src/emu/video/cdp1861.h
+++ b/src/emu/video/cdp1861.h
@@ -93,45 +93,22 @@ struct cdp1861_interface
const char *m_cpu_tag;
const char *m_screen_tag;
- devcb_write_line m_out_int_func;
- devcb_write_line m_out_dmao_func;
- devcb_write_line m_out_efx_func;
-};
-
-
-
-// ======================> cdp1861_device_config
-
-class cdp1861_device_config : public device_config,
- public cdp1861_interface
-{
- friend class cdp1861_device;
-
- // construction/destruction
- cdp1861_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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
+ devcb_write_line m_out_int_cb;
+ devcb_write_line m_out_dmao_cb;
+ devcb_write_line m_out_efx_cb;
};
// ======================> cdp1861_device
-class cdp1861_device : public device_t
+class cdp1861_device : public device_t,
+ public cdp1861_interface
{
- friend class cdp1861_device_config;
-
+public:
// construction/destruction
- cdp1861_device(running_machine &_machine, const cdp1861_device_config &_config);
+ cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-public:
DECLARE_WRITE8_MEMBER( dma_w );
DECLARE_WRITE_LINE_MEMBER( disp_on_w );
DECLARE_WRITE_LINE_MEMBER( disp_off_w );
@@ -140,6 +117,7 @@ public:
protected:
// device-level overrides
+ virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
@@ -167,8 +145,6 @@ private:
emu_timer *m_dma_timer; // DMA timer
cpu_device *m_cpu;
-
- const cdp1861_device_config &m_config;
};
diff --git a/src/emu/video/cdp1862.c b/src/emu/video/cdp1862.c
index bdc4dab6cd8..5f8d8cfe139 100644
--- a/src/emu/video/cdp1862.c
+++ b/src/emu/video/cdp1862.c
@@ -20,6 +20,9 @@
#include "machine/devhelpr.h"
+// device type definition
+const device_type CDP1862 = &device_creator<cdp1862_device>;
+
//**************************************************************************
// MACROS / CONSTANTS
@@ -30,46 +33,6 @@ static const int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-// devices
-const device_type CDP1862 = cdp1862_device_config::static_alloc_device_config;
-
-
-
-//**************************************************************************
-// DEVICE CONFIGURATION
-//**************************************************************************
-
-GENERIC_DEVICE_CONFIG_SETUP(cdp1862, "CDP1862")
-
-
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void cdp1862_device_config::device_config_complete()
-{
- // inherit a copy of the static data
- const cdp1862_interface *intf = reinterpret_cast<const cdp1862_interface *>(static_config());
- if (intf != NULL)
- *static_cast<cdp1862_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_in_rd_func, 0, sizeof(m_in_rd_func));
- memset(&m_in_bd_func, 0, sizeof(m_in_bd_func));
- memset(&m_in_gd_func, 0, sizeof(m_in_gd_func));
- }
-}
-
-
-
-//**************************************************************************
// INLINE HELPERS
//**************************************************************************
@@ -81,12 +44,12 @@ inline void cdp1862_device::initialize_palette()
{
int i;
- double res_total = m_config.m_chr_r + m_config.m_chr_g + m_config.m_chr_b + m_config.m_chr_bkg;
+ double res_total = m_chr_r + m_chr_g + m_chr_b + m_chr_bkg;
- int weight_r = (m_config.m_chr_r / res_total) * 100;
- int weight_g = (m_config.m_chr_g / res_total) * 100;
- int weight_b = (m_config.m_chr_b / res_total) * 100;
- int weight_bkg = (m_config.m_chr_bkg / res_total) * 100;
+ int weight_r = (m_chr_r / res_total) * 100;
+ int weight_g = (m_chr_g / res_total) * 100;
+ int weight_b = (m_chr_b / res_total) * 100;
+ int weight_bkg = (m_chr_bkg / res_total) * 100;
for (i = 0; i < 16; i++)
{
@@ -117,26 +80,48 @@ inline void cdp1862_device::initialize_palette()
// cdp1862_device - constructor
//-------------------------------------------------
-cdp1862_device::cdp1862_device(running_machine &_machine, const cdp1862_device_config &config)
- : device_t(_machine, config),
- m_config(config)
+cdp1862_device::cdp1862_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, CDP1862, "CDP1862", tag, owner, clock)
{
}
//-------------------------------------------------
+// device_config_complete - perform any
+// operations now that the configuration is
+// complete
+//-------------------------------------------------
+
+void cdp1862_device::device_config_complete()
+{
+ // inherit a copy of the static data
+ const cdp1862_interface *intf = reinterpret_cast<const cdp1862_interface *>(static_config());
+ if (intf != NULL)
+ *static_cast<cdp1862_interface *>(this) = *intf;
+
+ // or initialize to defaults if none provided
+ else
+ {
+ memset(&m_in_rd_cb, 0, sizeof(m_in_rd_cb));
+ memset(&m_in_bd_cb, 0, sizeof(m_in_bd_cb));
+ memset(&m_in_gd_cb, 0, sizeof(m_in_gd_cb));
+ }
+}
+
+
+//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void cdp1862_device::device_start()
{
// resolve callbacks
- devcb_resolve_read_line(&m_in_rd_func, &m_config.m_in_rd_func, this);
- devcb_resolve_read_line(&m_in_bd_func, &m_config.m_in_bd_func, this);
- devcb_resolve_read_line(&m_in_gd_func, &m_config.m_in_gd_func, this);
+ devcb_resolve_read_line(&m_in_rd_func, &m_in_rd_cb, this);
+ devcb_resolve_read_line(&m_in_bd_func, &m_in_bd_cb, this);
+ devcb_resolve_read_line(&m_in_gd_func, &m_in_gd_cb, this);
// find devices
- m_screen = machine().device<screen_device>(m_config.m_screen_tag);
+ m_screen = machine().device<screen_device>(m_screen_tag);
m_bitmap = auto_bitmap_alloc(machine(), m_screen->width(), m_screen->height(), m_screen->format());
// init palette
diff --git a/src/emu/video/cdp1862.h b/src/emu/video/cdp1862.h
index a43c7d892c5..b95dee24cbc 100644
--- a/src/emu/video/cdp1862.h
+++ b/src/emu/video/cdp1862.h
@@ -64,9 +64,9 @@ struct cdp1862_interface
{
const char *m_screen_tag;
- devcb_read_line m_in_rd_func;
- devcb_read_line m_in_bd_func;
- devcb_read_line m_in_gd_func;
+ devcb_read_line m_in_rd_cb;
+ devcb_read_line m_in_bd_cb;
+ devcb_read_line m_in_gd_cb;
double m_lum_r; // red luminance resistor value
double m_lum_b; // blue luminance resistor value
@@ -81,38 +81,15 @@ struct cdp1862_interface
-// ======================> cdp1862_device_config
-
-class cdp1862_device_config : public device_config,
- public cdp1862_interface
-{
- friend class cdp1862_device;
-
- // construction/destruction
- cdp1862_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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
-};
-
-
-
// ======================> cdp1862_device
-class cdp1862_device : public device_t
+class cdp1862_device : public device_t,
+ public cdp1862_interface
{
- friend class cdp1862_device_config;
-
+public:
// construction/destruction
- cdp1862_device(running_machine &_machine, const cdp1862_device_config &_config);
+ cdp1862_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-public:
DECLARE_WRITE8_MEMBER( dma_w );
DECLARE_WRITE_LINE_MEMBER( bkg_w );
DECLARE_WRITE_LINE_MEMBER( con_w );
@@ -121,6 +98,7 @@ public:
protected:
// device-level overrides
+ virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
@@ -136,8 +114,6 @@ private:
int m_bgcolor; // background color
int m_con; // color on
-
- const cdp1862_device_config &m_config;
};
diff --git a/src/emu/video/crt9007.c b/src/emu/video/crt9007.c
index be7632ef461..0a2b68c2582 100644
--- a/src/emu/video/crt9007.c
+++ b/src/emu/video/crt9007.c
@@ -36,6 +36,9 @@
#include "crt9007.h"
+// device type definition
+const device_type CRT9007 = &device_creator<crt9007_device>;
+
//**************************************************************************
// MACROS / CONSTANTS
@@ -211,10 +214,6 @@ const int STATUS_FRAME_TIMER_OCCURRED = 0x01;
// GLOBAL VARIABLES
//**************************************************************************
-// devices
-const device_type CRT9007 = crt9007_device_config::static_alloc_device_config;
-
-
// default address map
static ADDRESS_MAP_START( crt9007, AS_0, 8 )
AM_RANGE(0x0000, 0x3fff) AM_RAM
@@ -223,85 +222,6 @@ ADDRESS_MAP_END
//**************************************************************************
-// DEVICE CONFIGURATION
-//**************************************************************************
-
-//-------------------------------------------------
-// crt9007_device_config - constructor
-//-------------------------------------------------
-
-crt9007_device_config::crt9007_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
- : device_config(mconfig, static_alloc_device_config, "SMC CRT9007", tag, owner, clock),
- device_config_memory_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(crt9007))
-{
-}
-
-
-//-------------------------------------------------
-// static_alloc_device_config - allocate a new
-// configuration object
-//-------------------------------------------------
-
-device_config *crt9007_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
-{
- return global_alloc(crt9007_device_config(mconfig, tag, owner, clock));
-}
-
-
-//-------------------------------------------------
-// alloc_device - allocate a new device object
-//-------------------------------------------------
-
-device_t *crt9007_device_config::alloc_device(running_machine &machine) const
-{
- return auto_alloc(machine, crt9007_device(machine, *this));
-}
-
-
-//-------------------------------------------------
-// memory_space_config - return a description of
-// any address spaces owned by this device
-//-------------------------------------------------
-
-const address_space_config *crt9007_device_config::memory_space_config(address_spacenum spacenum) const
-{
- return (spacenum == AS_0) ? &m_space_config : NULL;
-}
-
-
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void crt9007_device_config::device_config_complete()
-{
- // inherit a copy of the static data
- const crt9007_interface *intf = reinterpret_cast<const crt9007_interface *>(static_config());
- if (intf != NULL)
- *static_cast<crt9007_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&out_int_func, 0, sizeof(out_int_func));
- memset(&out_dmar_func, 0, sizeof(out_dmar_func));
- memset(&out_vs_func, 0, sizeof(out_vs_func));
- memset(&out_hs_func, 0, sizeof(out_hs_func));
- memset(&out_vlt_func, 0, sizeof(out_vlt_func));
- memset(&out_curs_func, 0, sizeof(out_curs_func));
- memset(&out_drb_func, 0, sizeof(out_drb_func));
- memset(&out_cblank_func, 0, sizeof(out_cblank_func));
- memset(&out_slg_func, 0, sizeof(out_slg_func));
- memset(&out_sld_func, 0, sizeof(out_sld_func));
- }
-}
-
-
-
-//**************************************************************************
// INLINE HELPERS
//**************************************************************************
@@ -529,10 +449,10 @@ inline void crt9007_device::recompute_parameters()
// crt9007_device - constructor
//-------------------------------------------------
-crt9007_device::crt9007_device(running_machine &_machine, const crt9007_device_config &config)
- : device_t(_machine, config),
- device_memory_interface(_machine, config, *this),
- m_config(config)
+crt9007_device::crt9007_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, CRT9007, "SMC CRT9007", tag, owner, clock),
+ device_memory_interface(mconfig, *this),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(crt9007))
{
for (int i = 0; i < 0x3d; i++)
m_reg[i] = 0;
@@ -540,6 +460,36 @@ crt9007_device::crt9007_device(running_machine &_machine, const crt9007_device_c
//-------------------------------------------------
+// device_config_complete - perform any
+// operations now that the configuration is
+// complete
+//-------------------------------------------------
+
+void crt9007_device::device_config_complete()
+{
+ // inherit a copy of the static data
+ const crt9007_interface *intf = reinterpret_cast<const crt9007_interface *>(static_config());
+ if (intf != NULL)
+ *static_cast<crt9007_interface *>(this) = *intf;
+
+ // or initialize to defaults if none provided
+ else
+ {
+ memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
+ memset(&m_out_dmar_cb, 0, sizeof(m_out_dmar_cb));
+ memset(&m_out_vs_cb, 0, sizeof(m_out_vs_cb));
+ memset(&m_out_hs_cb, 0, sizeof(m_out_hs_cb));
+ memset(&m_out_vlt_cb, 0, sizeof(m_out_vlt_cb));
+ memset(&m_out_curs_cb, 0, sizeof(m_out_curs_cb));
+ memset(&m_out_drb_cb, 0, sizeof(m_out_drb_cb));
+ memset(&m_out_cblank_cb, 0, sizeof(m_out_cblank_cb));
+ memset(&m_out_slg_cb, 0, sizeof(m_out_slg_cb));
+ memset(&m_out_sld_cb, 0, sizeof(m_out_sld_cb));
+ }
+}
+
+
+//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -554,23 +504,23 @@ void crt9007_device::device_start()
m_dma_timer = timer_alloc(TIMER_DMA);
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_config.out_int_func, this);
- devcb_resolve_write_line(&m_out_dmar_func, &m_config.out_dmar_func, this);
- devcb_resolve_write_line(&m_out_hs_func, &m_config.out_hs_func, this);
- devcb_resolve_write_line(&m_out_vs_func, &m_config.out_vs_func, this);
- devcb_resolve_write_line(&m_out_vlt_func, &m_config.out_vlt_func, this);
- devcb_resolve_write_line(&m_out_curs_func, &m_config.out_curs_func, this);
- devcb_resolve_write_line(&m_out_drb_func, &m_config.out_drb_func, this);
- devcb_resolve_write_line(&m_out_cblank_func, &m_config.out_cblank_func, this);
- devcb_resolve_write_line(&m_out_slg_func, &m_config.out_slg_func, this);
- devcb_resolve_write_line(&m_out_sld_func, &m_config.out_sld_func, this);
+ devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
+ devcb_resolve_write_line(&m_out_dmar_func, &m_out_dmar_cb, this);
+ devcb_resolve_write_line(&m_out_hs_func, &m_out_hs_cb, this);
+ devcb_resolve_write_line(&m_out_vs_func, &m_out_vs_cb, this);
+ devcb_resolve_write_line(&m_out_vlt_func, &m_out_vlt_cb, this);
+ devcb_resolve_write_line(&m_out_curs_func, &m_out_curs_cb, this);
+ devcb_resolve_write_line(&m_out_drb_func, &m_out_drb_cb, this);
+ devcb_resolve_write_line(&m_out_cblank_func, &m_out_cblank_cb, this);
+ devcb_resolve_write_line(&m_out_slg_func, &m_out_slg_cb, this);
+ devcb_resolve_write_line(&m_out_sld_func, &m_out_sld_cb, this);
// get the screen device
- m_screen = machine().device<screen_device>(m_config.screen_tag);
+ m_screen = machine().device<screen_device>(m_screen_tag);
assert(m_screen != NULL);
// set horizontal pixels per column
- m_hpixels_per_column = m_config.hpixels_per_column;
+ m_hpixels_per_column = m_hpixels_per_column;
// register for state saving
// state_save_register_device_item(this, 0, );
@@ -726,6 +676,17 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
//-------------------------------------------------
+// memory_space_config - return a description of
+// any address spaces owned by this device
+//-------------------------------------------------
+
+const address_space_config *crt9007_device::memory_space_config(address_spacenum spacenum) const
+{
+ return (spacenum == AS_0) ? &m_space_config : NULL;
+}
+
+
+//-------------------------------------------------
// read - register read
//-------------------------------------------------
diff --git a/src/emu/video/crt9007.h b/src/emu/video/crt9007.h
index 36aefa043cb..5ad55924861 100644
--- a/src/emu/video/crt9007.h
+++ b/src/emu/video/crt9007.h
@@ -70,51 +70,21 @@
struct crt9007_interface
{
- const char *screen_tag; /* screen we are acting on */
- int hpixels_per_column; /* number of pixels per video memory address */
+ const char *m_screen_tag; /* screen we are acting on */
- devcb_write_line out_int_func;
- devcb_write_line out_dmar_func;
+ devcb_write_line m_out_int_cb;
+ devcb_write_line m_out_dmar_cb;
- devcb_write_line out_vs_func;
- devcb_write_line out_hs_func;
+ devcb_write_line m_out_vs_cb;
+ devcb_write_line m_out_hs_cb;
- devcb_write_line out_vlt_func;
- devcb_write_line out_curs_func;
- devcb_write_line out_drb_func;
- devcb_write_line out_cblank_func;
+ devcb_write_line m_out_vlt_cb;
+ devcb_write_line m_out_curs_cb;
+ devcb_write_line m_out_drb_cb;
+ devcb_write_line m_out_cblank_cb;
- devcb_write_line out_slg_func;
- devcb_write_line out_sld_func;
-};
-
-
-
-// ======================> crt9007_device_config
-
-class crt9007_device_config : public device_config,
- public device_config_memory_interface,
- public crt9007_interface
-{
- friend class crt9007_device;
-
- // construction/destruction
- crt9007_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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
-
- // device_config_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
-
- // address space configurations
- const address_space_config m_space_config;
+ devcb_write_line m_out_slg_cb;
+ devcb_write_line m_out_sld_cb;
};
@@ -122,14 +92,13 @@ protected:
// ======================> crt9007_device
class crt9007_device : public device_t,
- public device_memory_interface
+ public device_memory_interface,
+ public crt9007_interface
{
- friend class crt9007_device_config;
-
+public:
// construction/destruction
- crt9007_device(running_machine &_machine, const crt9007_device_config &_config);
+ crt9007_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-public:
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( ack_w );
@@ -141,11 +110,15 @@ public:
protected:
// device-level overrides
+ virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void device_clock_changed();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+ // device_memory_interface overrides
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
+
private:
static const device_timer_id TIMER_HSYNC = 0;
static const device_timer_id TIMER_VSYNC = 1;
@@ -221,7 +194,8 @@ private:
emu_timer *m_drb_timer;
emu_timer *m_dma_timer;
- const crt9007_device_config &m_config;
+ // address space configurations
+ const address_space_config m_space_config;
};
diff --git a/src/emu/video/crt9021.c b/src/emu/video/crt9021.c
index 66fad0b45b5..5f82c8579e2 100644
--- a/src/emu/video/crt9021.c
+++ b/src/emu/video/crt9021.c
@@ -41,6 +41,9 @@
#include "crt9021.h"
+// device type definition
+const device_type CRT9021 = &device_creator<crt9021_device>;
+
//**************************************************************************
// MACROS / CONSTANTS
@@ -63,47 +66,24 @@ enum
};
+
//**************************************************************************
-// GLOBAL VARIABLES
+// INLINE HELPERS
//**************************************************************************
-// devices
-const device_type CRT9021 = crt9021_device_config::static_alloc_device_config;
-
//**************************************************************************
-// DEVICE CONFIGURATION
+// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
-// crt9021_device_config - constructor
-//-------------------------------------------------
-
-crt9021_device_config::crt9021_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
- : device_config(mconfig, static_alloc_device_config, "SMC CRT9021", tag, owner, clock)
-{
-}
-
-
-//-------------------------------------------------
-// static_alloc_device_config - allocate a new
-// configuration object
-//-------------------------------------------------
-
-device_config *crt9021_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
-{
- return global_alloc(crt9021_device_config(mconfig, tag, owner, clock));
-}
-
-
-//-------------------------------------------------
-// alloc_device - allocate a new device object
+// crt9021_device - constructor
//-------------------------------------------------
-device_t *crt9021_device_config::alloc_device(running_machine &machine) const
+crt9021_device::crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, CRT9021, "SMC CRT9021", tag, owner, clock)
{
- return auto_alloc(machine, crt9021_device(machine, *this));
}
@@ -113,7 +93,7 @@ device_t *crt9021_device_config::alloc_device(running_machine &machine) const
// complete
//-------------------------------------------------
-void crt9021_device_config::device_config_complete()
+void crt9021_device::device_config_complete()
{
// inherit a copy of the static data
const crt9021_interface *intf = reinterpret_cast<const crt9021_interface *>(static_config());
@@ -123,35 +103,13 @@ void crt9021_device_config::device_config_complete()
// or initialize to defaults if none provided
else
{
- memset(&in_data_func, 0, sizeof(in_data_func));
- memset(&in_attr_func, 0, sizeof(in_attr_func));
- memset(&in_atten_func, 0, sizeof(in_atten_func));
+ memset(&in_data_cb, 0, sizeof(in_data_cb));
+ memset(&in_attr_cb, 0, sizeof(in_attr_cb));
+ memset(&in_atten_cb, 0, sizeof(in_atten_cb));
}
}
-
-//**************************************************************************
-// INLINE HELPERS
-//**************************************************************************
-
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// crt9021_device - constructor
-//-------------------------------------------------
-
-crt9021_device::crt9021_device(running_machine &_machine, const crt9021_device_config &config)
- : device_t(_machine, config),
- m_config(config)
-{
-}
-
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -161,12 +119,12 @@ void crt9021_device::device_start()
// allocate timers
// resolve callbacks
- devcb_resolve_read8(&m_in_data_func, &m_config.in_data_func, this);
- devcb_resolve_read8(&m_in_attr_func, &m_config.in_attr_func, this);
- devcb_resolve_read_line(&m_in_atten_func, &m_config.in_atten_func, this);
+ devcb_resolve_read8(&m_in_data_func, &in_data_cb, this);
+ devcb_resolve_read8(&m_in_attr_func, &in_attr_cb, this);
+ devcb_resolve_read_line(&m_in_atten_func, &in_atten_cb, this);
// get the screen device
- m_screen = machine().device<screen_device>(m_config.screen_tag);
+ m_screen = machine().device<screen_device>(screen_tag);
assert(m_screen != NULL);
// register for state saving
diff --git a/src/emu/video/crt9021.h b/src/emu/video/crt9021.h
index 20ff301f914..da8418fd72f 100644
--- a/src/emu/video/crt9021.h
+++ b/src/emu/video/crt9021.h
@@ -65,46 +65,23 @@ struct crt9021_interface
{
const char *screen_tag; /* screen we are acting on */
- devcb_read8 in_data_func;
- devcb_read8 in_attr_func;
+ devcb_read8 in_data_cb;
+ devcb_read8 in_attr_cb;
- devcb_read_line in_atten_func;
-};
-
-
-
-// ======================> crt9021_device_config
-
-class crt9021_device_config : public device_config,
- public crt9021_interface
-{
- friend class crt9021_device;
-
- // construction/destruction
- crt9021_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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
+ devcb_read_line in_atten_cb;
};
// ======================> crt9021_device
-class crt9021_device : public device_t
+class crt9021_device : public device_t,
+ public crt9021_interface
{
- friend class crt9021_device_config;
-
+public:
// construction/destruction
- crt9021_device(running_machine &_machine, const crt9021_device_config &_config);
+ crt9021_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-public:
DECLARE_WRITE_LINE_MEMBER( slg_w );
DECLARE_WRITE_LINE_MEMBER( sld_w );
DECLARE_WRITE_LINE_MEMBER( cursor_w );
@@ -115,6 +92,7 @@ public:
protected:
// device-level overrides
+ virtual void device_config_complete();
virtual void device_start();
virtual void device_clock_changed();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
@@ -131,8 +109,6 @@ private:
int m_cursor;
int m_retbl;
int m_vsync;
-
- const crt9021_device_config &m_config;
};
diff --git a/src/emu/video/crt9212.c b/src/emu/video/crt9212.c
index 8b6e75e5766..6ee7f95ea5a 100644
--- a/src/emu/video/crt9212.c
+++ b/src/emu/video/crt9212.c
@@ -37,46 +37,24 @@
//**************************************************************************
-// GLOBAL VARIABLES
+// INLINE HELPERS
//**************************************************************************
-// devices
-const device_type CRT9212 = crt9212_device_config::static_alloc_device_config;
-
-
//**************************************************************************
-// DEVICE CONFIGURATION
+// LIVE DEVICE
//**************************************************************************
-//-------------------------------------------------
-// crt9212_device_config - constructor
-//-------------------------------------------------
-
-crt9212_device_config::crt9212_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
- : device_config(mconfig, static_alloc_device_config, "SMC CRT9212", tag, owner, clock)
-{
-}
-
+// device type definition
+const device_type CRT9212 = &device_creator<crt9212_device>;
//-------------------------------------------------
-// static_alloc_device_config - allocate a new
-// configuration object
-//-------------------------------------------------
-
-device_config *crt9212_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
-{
- return global_alloc(crt9212_device_config(mconfig, tag, owner, clock));
-}
-
-
-//-------------------------------------------------
-// alloc_device - allocate a new device object
+// crt9212_device - constructor
//-------------------------------------------------
-device_t *crt9212_device_config::alloc_device(running_machine &machine) const
+crt9212_device::crt9212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, CRT9212, "SMC CRT9212", tag, owner, clock)
{
- return auto_alloc(machine, crt9212_device(machine, *this));
}
@@ -86,7 +64,7 @@ device_t *crt9212_device_config::alloc_device(running_machine &machine) const
// complete
//-------------------------------------------------
-void crt9212_device_config::device_config_complete()
+void crt9212_device::device_config_complete()
{
// inherit a copy of the static data
const crt9212_interface *intf = reinterpret_cast<const crt9212_interface *>(static_config());
@@ -96,36 +74,15 @@ void crt9212_device_config::device_config_complete()
// or initialize to defaults if none provided
else
{
- memset(&out_rof_func, 0, sizeof(out_rof_func));
- memset(&out_wof_func, 0, sizeof(out_wof_func));
- memset(&in_ren_func, 0, sizeof(in_ren_func));
- memset(&in_wen_func, 0, sizeof(in_wen_func));
- memset(&in_wen2_func, 0, sizeof(in_wen2_func));
+ memset(&m_out_rof_cb, 0, sizeof(m_out_rof_cb));
+ memset(&m_out_wof_cb, 0, sizeof(m_out_wof_cb));
+ memset(&m_in_ren_cb, 0, sizeof(m_in_ren_cb));
+ memset(&m_in_wen_cb, 0, sizeof(m_in_wen_cb));
+ memset(&m_in_wen2_cb, 0, sizeof(m_in_wen2_cb));
}
}
-
-//**************************************************************************
-// INLINE HELPERS
-//**************************************************************************
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// crt9212_device - constructor
-//-------------------------------------------------
-
-crt9212_device::crt9212_device(running_machine &_machine, const crt9212_device_config &config)
- : device_t(_machine, config),
- m_config(config)
-{
-}
-
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -133,11 +90,11 @@ crt9212_device::crt9212_device(running_machine &_machine, const crt9212_device_c
void crt9212_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_rof_func, &m_config.out_rof_func, this);
- devcb_resolve_write_line(&m_out_wof_func, &m_config.out_wof_func, this);
- devcb_resolve_read_line(&m_in_ren_func, &m_config.in_ren_func, this);
- devcb_resolve_read_line(&m_in_wen_func, &m_config.in_wen_func, this);
- devcb_resolve_read_line(&m_in_wen2_func, &m_config.in_wen2_func, this);
+ devcb_resolve_write_line(&m_out_rof_func, &m_out_rof_cb, this);
+ devcb_resolve_write_line(&m_out_wof_func, &m_out_wof_cb, this);
+ devcb_resolve_read_line(&m_in_ren_func, &m_in_ren_cb, this);
+ devcb_resolve_read_line(&m_in_wen_func, &m_in_wen_cb, this);
+ devcb_resolve_read_line(&m_in_wen2_func, &m_in_wen2_cb, this);
// register for state saving
save_item(NAME(m_input));
diff --git a/src/emu/video/crt9212.h b/src/emu/video/crt9212.h
index e89432176ae..f9b0e3a535e 100644
--- a/src/emu/video/crt9212.h
+++ b/src/emu/video/crt9212.h
@@ -64,47 +64,24 @@ const int CRT9212_RAM_SIZE = 135;
struct crt9212_interface
{
- devcb_write_line out_rof_func;
- devcb_write_line out_wof_func;
- devcb_read_line in_ren_func;
- devcb_read_line in_wen_func;
- devcb_read_line in_wen2_func;
-};
-
-
-
-// ======================> crt9212_device_config
-
-class crt9212_device_config : public device_config,
- public crt9212_interface
-{
- friend class crt9212_device;
-
- // construction/destruction
- crt9212_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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
+ devcb_write_line m_out_rof_cb;
+ devcb_write_line m_out_wof_cb;
+ devcb_read_line m_in_ren_cb;
+ devcb_read_line m_in_wen_cb;
+ devcb_read_line m_in_wen2_cb;
};
// ======================> crt9212_device
-class crt9212_device : public device_t
+class crt9212_device : public device_t,
+ public crt9212_interface
{
- friend class crt9212_device_config;
-
+public:
// construction/destruction
- crt9212_device(running_machine &_machine, const crt9212_device_config &_config);
+ crt9212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-public:
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( clrcnt_w );
@@ -114,6 +91,7 @@ public:
protected:
// device-level overrides
+ virtual void device_config_complete();
virtual void device_start();
private:
@@ -135,8 +113,6 @@ private:
int m_clrcnt;
int m_rclk;
int m_wclk;
-
- const crt9212_device_config &m_config;
};
diff --git a/src/emu/video/dm9368.c b/src/emu/video/dm9368.c
index 1e4073b8593..604c291d091 100644
--- a/src/emu/video/dm9368.c
+++ b/src/emu/video/dm9368.c
@@ -19,6 +19,9 @@
#define LOG 1
+// device type definition
+const device_type DM9368 = &device_creator<dm9368_device>;
+
static const UINT8 OUTPUT[16] =
{
@@ -28,45 +31,6 @@ static const UINT8 OUTPUT[16] =
//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-// devices
-const device_type DM9368 = dm9368_device_config::static_alloc_device_config;
-
-
-
-//**************************************************************************
-// DEVICE CONFIGURATION
-//**************************************************************************
-
-GENERIC_DEVICE_CONFIG_SETUP(dm9368, "DM9368")
-
-
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void dm9368_device_config::device_config_complete()
-{
- // inherit a copy of the static data
- const dm9368_interface *intf = reinterpret_cast<const dm9368_interface *>(static_config());
- if (intf != NULL)
- *static_cast<dm9368_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_in_rbi_func, 0, sizeof(m_in_rbi_func));
- memset(&m_out_rbo_func, 0, sizeof(m_out_rbo_func));
- }
-}
-
-
-
-//**************************************************************************
// INLINE HELPERS
//**************************************************************************
@@ -106,24 +70,45 @@ inline void dm9368_device::set_rbo(int state)
// dm9368_device - constructor
//-------------------------------------------------
-dm9368_device::dm9368_device(running_machine &_machine, const dm9368_device_config &config)
- : device_t(_machine, config),
+dm9368_device::dm9368_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, DM9368, "DM9368", tag, owner, clock),
m_rbi(1),
- m_rbo(1),
- m_config(config)
+ m_rbo(1)
{
}
//-------------------------------------------------
+// device_config_complete - perform any
+// operations now that the configuration is
+// complete
+//-------------------------------------------------
+
+void dm9368_device::device_config_complete()
+{
+ // inherit a copy of the static data
+ const dm9368_interface *intf = reinterpret_cast<const dm9368_interface *>(static_config());
+ if (intf != NULL)
+ *static_cast<dm9368_interface *>(this) = *intf;
+
+ // or initialize to defaults if none provided
+ else
+ {
+ memset(&m_in_rbi_cb, 0, sizeof(m_in_rbi_cb));
+ memset(&m_out_rbo_cb, 0, sizeof(m_out_rbo_cb));
+ }
+}
+
+
+//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void dm9368_device::device_start()
{
// resolve callbacks
- devcb_resolve_read_line(&m_in_rbi_func, &m_config.m_in_rbi_func, this);
- devcb_resolve_write_line(&m_out_rbo_func, &m_config.m_out_rbo_func, this);
+ devcb_resolve_read_line(&m_in_rbi_func, &m_in_rbi_cb, this);
+ devcb_resolve_write_line(&m_out_rbo_func, &m_out_rbo_cb, this);
// register for state saving
save_item(NAME(m_rbi));
@@ -143,7 +128,7 @@ void dm9368_device::a_w(UINT8 data)
if (LOG) logerror("DM9368 '%s' Blanked Rippling Zero\n", tag());
// blank rippling 0
- output_set_digit_value(m_config.m_digit, 0);
+ output_set_digit_value(m_digit, 0);
set_rbo(0);
}
@@ -151,7 +136,7 @@ void dm9368_device::a_w(UINT8 data)
{
if (LOG) logerror("DM9368 '%s' Output Data: %u = %02x\n", tag(), a, OUTPUT[a]);
- output_set_digit_value(m_config.m_digit, OUTPUT[a]);
+ output_set_digit_value(m_digit, OUTPUT[a]);
set_rbo(1);
}
diff --git a/src/emu/video/dm9368.h b/src/emu/video/dm9368.h
index 693ec783009..aa5278198cd 100644
--- a/src/emu/video/dm9368.h
+++ b/src/emu/video/dm9368.h
@@ -52,50 +52,28 @@ struct dm9368_interface
{
int m_digit;
- devcb_read_line m_in_rbi_func;
- devcb_write_line m_out_rbo_func;
-};
-
-
-
-// ======================> dm9368_device_config
-
-class dm9368_device_config : public device_config,
- public dm9368_interface
-{
- friend class dm9368_device;
-
- // construction/destruction
- dm9368_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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
+ devcb_read_line m_in_rbi_cb;
+ devcb_write_line m_out_rbo_cb;
};
// ======================> dm9368_device
-class dm9368_device : public device_t
+class dm9368_device : public device_t,
+ public dm9368_interface
{
- friend class dm9368_device_config;
-
+public:
// construction/destruction
- dm9368_device(running_machine &_machine, const dm9368_device_config &_config);
+ dm9368_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-public:
void a_w(UINT8 data);
DECLARE_WRITE_LINE_MEMBER( rbi_w );
DECLARE_READ_LINE_MEMBER( rbo_r );
protected:
// device-level overrides
+ virtual void device_config_complete();
virtual void device_start();
private:
@@ -107,8 +85,6 @@ private:
int m_rbi;
int m_rbo;
-
- const dm9368_device_config &m_config;
};
diff --git a/src/emu/video/hd44102.c b/src/emu/video/hd44102.c
index 73fb8d6e710..0caccd1bd5b 100644
--- a/src/emu/video/hd44102.c
+++ b/src/emu/video/hd44102.c
@@ -35,38 +35,8 @@
#define STATUS_RESET 0x10 /* not supported */
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-// devices
-const device_type HD44102 = hd44102_device_config::static_alloc_device_config;
-
-
-
-//**************************************************************************
-// DEVICE CONFIGURATION
-//**************************************************************************
-
-GENERIC_DEVICE_CONFIG_SETUP(hd44102, "HD44102")
-
-
-//-------------------------------------------------
-// static_set_config - configuration helper
-//-------------------------------------------------
-
-void hd44102_device_config::static_set_config(device_config *device, const char *screen_tag, int sx, int sy)
-{
- hd44102_device_config *hd44102 = downcast<hd44102_device_config *>(device);
-
- assert(screen_tag != NULL);
-
- hd44102->m_screen_tag = screen_tag;
- hd44102->m_sx = sx;
- hd44102->m_sy = sy;
-}
-
+// device type definition
+const device_type HD44102 = &device_creator<hd44102_device>;
//**************************************************************************
@@ -99,14 +69,29 @@ inline void hd44102_device::count_up_or_down()
// hd44102_device - constructor
//-------------------------------------------------
-hd44102_device::hd44102_device(running_machine &_machine, const hd44102_device_config &config)
- : device_t(_machine, config),
+hd44102_device::hd44102_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, HD44102, "HD44102", tag, owner, clock),
m_cs2(0),
m_page(0),
m_x(0),
- m_y(0),
- m_config(config)
+ m_y(0)
+{
+}
+
+
+//-------------------------------------------------
+// static_set_config - configuration helper
+//-------------------------------------------------
+
+void hd44102_device::static_set_config(device_t &device, const char *screen_tag, int sx, int sy)
{
+ hd44102_device &hd44102 = downcast<hd44102_device &>(device);
+
+ assert(screen_tag != NULL);
+
+ hd44102.m_screen_tag = screen_tag;
+ hd44102.m_sx = sx;
+ hd44102.m_sy = sy;
}
@@ -117,7 +102,7 @@ hd44102_device::hd44102_device(running_machine &_machine, const hd44102_device_c
void hd44102_device::device_start()
{
// find screen
- m_screen = machine().device<screen_device>(m_config.m_screen_tag);
+ m_screen = machine().device<screen_device>(m_screen_tag);
// register for state saving
save_item(NAME(m_ram[0]));
@@ -296,8 +281,8 @@ void hd44102_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect)
{
UINT8 data = m_ram[z / 8][y];
- int sy = m_config.m_sy + z;
- int sx = m_config.m_sx + y;
+ int sy = m_sy + z;
+ int sx = m_sx + y;
if ((sy >= cliprect->min_y) && (sy <= cliprect->max_y) && (sx >= cliprect->min_x) && (sx <= cliprect->max_x))
{
diff --git a/src/emu/video/hd44102.h b/src/emu/video/hd44102.h
index 82c0b12ce9e..ed76a10f0c5 100644
--- a/src/emu/video/hd44102.h
+++ b/src/emu/video/hd44102.h
@@ -22,7 +22,7 @@
#define MCFG_HD44102_ADD(_tag, _screen_tag, _sx, _sy) \
MCFG_DEVICE_ADD(_tag, HD44102, 0) \
- hd44102_device_config::static_set_config(device, _screen_tag, _sx, _sy);
+ hd44102_device::static_set_config(*device, _screen_tag, _sx, _sy);
@@ -30,40 +30,17 @@
// TYPE DEFINITIONS
///*************************************************************************
-// ======================> hd44102_device_config
-
-class hd44102_device_config : public device_config
-{
- friend class hd44102_device;
-
- // construction/destruction
- hd44102_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_config(device_config *device, const char *screen_tag, int sx, int sy);
-
-private:
- const char *m_screen_tag;
- int m_sx;
- int m_sy;
-};
-
-
// ======================> hd44102_device
class hd44102_device : public device_t
{
- friend class hd44102_device_config;
-
+public:
// construction/destruction
- hd44102_device(running_machine &_machine, const hd44102_device_config &_config);
+ hd44102_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // inline configuration helpers
+ static void static_set_config(device_t &device, const char *screen_tag, int sx, int sy);
-public:
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -97,7 +74,9 @@ private:
int m_x; // X address
int m_y; // Y address
- const hd44102_device_config &m_config;
+ const char *m_screen_tag;
+ int m_sx;
+ int m_sy;
};
diff --git a/src/emu/video/hd61830.c b/src/emu/video/hd61830.c
index 94c8e59ce98..b4c8155030b 100644
--- a/src/emu/video/hd61830.c
+++ b/src/emu/video/hd61830.c
@@ -53,8 +53,8 @@ const int MODE_DISPLAY_ON = 0x20;
// GLOBAL VARIABLES
//**************************************************************************
-// devices
-const device_type HD61830 = hd61830_device_config::static_alloc_device_config;
+// device type definition
+const device_type HD61830 = &device_creator<hd61830_device>;
// default address map
@@ -71,60 +71,56 @@ ROM_END
+
//**************************************************************************
-// DEVICE CONFIGURATION
+// INLINE HELPERS
//**************************************************************************
//-------------------------------------------------
-// hd61830_device_config - constructor
+// readbyte - read a byte at the given address
//-------------------------------------------------
-hd61830_device_config::hd61830_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
- : device_config(mconfig, static_alloc_device_config, "Hitachi HD61830", tag, owner, clock),
- device_config_memory_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(hd61830))
+inline UINT8 hd61830_device::readbyte(offs_t address)
{
- m_shortname = "hd61830";
+ return space()->read_byte(address);
}
//-------------------------------------------------
-// static_alloc_device_config - allocate a new
-// configuration object
+// writebyte - write a byte at the given address
//-------------------------------------------------
-device_config *hd61830_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
+inline void hd61830_device::writebyte(offs_t address, UINT8 data)
{
- return global_alloc(hd61830_device_config(mconfig, tag, owner, clock));
+ space()->write_byte(address, data);
}
-//-------------------------------------------------
-// alloc_device - allocate a new device object
-//-------------------------------------------------
-
-device_t *hd61830_device_config::alloc_device(running_machine &machine) const
-{
- return auto_alloc(machine, hd61830_device(machine, *this));
-}
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
//-------------------------------------------------
-// memory_space_config - return a description of
-// any address spaces owned by this device
+// hd61830_device - constructor
//-------------------------------------------------
-const address_space_config *hd61830_device_config::memory_space_config(address_spacenum spacenum) const
+hd61830_device::hd61830_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, HD61830, "Hitachi HD61830", tag, owner, clock),
+ device_memory_interface(mconfig, *this),
+ m_bf(false),
+ m_blink(0),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(hd61830))
{
- return (spacenum == AS_0) ? &m_space_config : NULL;
+ m_shortname = "hd61830";
}
//-------------------------------------------------
-// rom_region - device-specific ROM region
+// device_rom_region - device-specific ROM region
//-------------------------------------------------
-const rom_entry *hd61830_device_config::device_rom_region() const
+const rom_entry *hd61830_device::device_rom_region() const
{
return ROM_NAME(hd61830);
}
@@ -136,7 +132,7 @@ const rom_entry *hd61830_device_config::device_rom_region() const
// complete
//-------------------------------------------------
-void hd61830_device_config::device_config_complete()
+void hd61830_device::device_config_complete()
{
// inherit a copy of the static data
const hd61830_interface *intf = reinterpret_cast<const hd61830_interface *>(static_config());
@@ -146,56 +142,11 @@ void hd61830_device_config::device_config_complete()
// or initialize to defaults if none provided
else
{
- memset(&m_in_rd_func, 0, sizeof(m_in_rd_func));
+ memset(&m_in_rd_cb, 0, sizeof(m_in_rd_cb));
}
}
-
-//**************************************************************************
-// INLINE HELPERS
-//**************************************************************************
-
-//-------------------------------------------------
-// readbyte - read a byte at the given address
-//-------------------------------------------------
-
-inline UINT8 hd61830_device::readbyte(offs_t address)
-{
- return space()->read_byte(address);
-}
-
-
-//-------------------------------------------------
-// writebyte - write a byte at the given address
-//-------------------------------------------------
-
-inline void hd61830_device::writebyte(offs_t address, UINT8 data)
-{
- space()->write_byte(address, data);
-}
-
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// hd61830_device - constructor
-//-------------------------------------------------
-
-hd61830_device::hd61830_device(running_machine &_machine, const hd61830_device_config &config)
- : device_t(_machine, config),
- device_memory_interface(_machine, config, *this),
- m_bf(false),
- m_blink(0),
- m_config(config)
-{
-
-}
-
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -206,9 +157,9 @@ void hd61830_device::device_start()
m_busy_timer = timer_alloc();
// resolve callbacks
- devcb_resolve_read8(&m_in_rd_func, &m_config.m_in_rd_func, this);
+ devcb_resolve_read8(&m_in_rd_func, &m_in_rd_cb, this);
- m_screen = machine().device<screen_device>(m_config.screen_tag);
+ m_screen = machine().device<screen_device>(screen_tag);
// register for state saving
save_item(NAME(m_bf));
@@ -252,6 +203,17 @@ void hd61830_device::device_timer(emu_timer &timer, device_timer_id id, int para
}
+//-------------------------------------------------
+// memory_space_config - return a description of
+// any address spaces owned by this device
+//-------------------------------------------------
+
+const address_space_config *hd61830_device::memory_space_config(address_spacenum spacenum) const
+{
+ return (spacenum == AS_0) ? &m_space_config : NULL;
+}
+
+
/*-------------------------------------------------
set_busy_flag - set busy flag and arm timer
to clear it later
diff --git a/src/emu/video/hd61830.h b/src/emu/video/hd61830.h
index a49daee5467..54723e07271 100644
--- a/src/emu/video/hd61830.h
+++ b/src/emu/video/hd61830.h
@@ -47,39 +47,7 @@ struct hd61830_interface
{
const char *screen_tag;
- devcb_read8 m_in_rd_func;
-};
-
-
-
-// ======================> hd61830_device_config
-
-class hd61830_device_config : public device_config,
- public device_config_memory_interface,
- public hd61830_interface
-{
- friend class hd61830_device;
-
- // construction/destruction
- hd61830_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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
-
- // optional information overrides
- virtual const rom_entry *device_rom_region() const;
-
- // device_config_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
-
- // address space configurations
- const address_space_config m_space_config;
+ devcb_read8 m_in_rd_cb;
};
@@ -87,14 +55,13 @@ protected:
// ======================> hd61830_device
class hd61830_device : public device_t,
- public device_memory_interface
+ public device_memory_interface,
+ public hd61830_interface
{
- friend class hd61830_device_config;
-
+public:
// construction/destruction
- hd61830_device(running_machine &_machine, const hd61830_device_config &_config);
+ hd61830_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-public:
DECLARE_READ8_MEMBER( status_r );
DECLARE_WRITE8_MEMBER( control_w );
@@ -105,10 +72,15 @@ public:
protected:
// device-level overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+ // device_memory_interface overrides
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
+
inline UINT8 readbyte(offs_t address);
inline void writebyte(offs_t address, UINT8 data);
@@ -144,7 +116,8 @@ private:
int m_blink; // blink counter
int m_cursor; // cursor visible
- const hd61830_device_config &m_config;
+ // address space configurations
+ const address_space_config m_space_config;
};
diff --git a/src/emu/video/hd63484.c b/src/emu/video/hd63484.c
index 1142175b235..67aa9679455 100644
--- a/src/emu/video/hd63484.c
+++ b/src/emu/video/hd63484.c
@@ -64,7 +64,7 @@ INLINE const hd63484_interface *get_interface( device_t *device )
{
assert(device != NULL);
assert(device->type() == HD63484);
- return (const hd63484_interface *) device->baseconfig().static_config();
+ return (const hd63484_interface *) device->static_config();
}
/*****************************************************************************
diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c
index 7f38e7fc234..0dc170c9490 100644
--- a/src/emu/video/mc6845.c
+++ b/src/emu/video/mc6845.c
@@ -872,7 +872,7 @@ static void common_start(device_t *device, int device_type)
/* validate arguments */
assert(device != NULL);
- mc6845->intf = (const mc6845_interface *)device->baseconfig().static_config();
+ mc6845->intf = (const mc6845_interface *)device->static_config();
mc6845->device_type = device_type;
if (mc6845->intf != NULL)
diff --git a/src/emu/video/msm6255.c b/src/emu/video/msm6255.c
index 0b85e56cf8b..2c67e7c2a52 100644
--- a/src/emu/video/msm6255.c
+++ b/src/emu/video/msm6255.c
@@ -65,19 +65,36 @@ enum
//**************************************************************************
-// GLOBAL VARIABLES
+// INLINE HELPERS
//**************************************************************************
-// devices
-const device_type MSM6255 = msm6255_device_config::static_alloc_device_config;
+//-------------------------------------------------
+// read_video_data - read video ROM/RAM
+//-------------------------------------------------
+
+inline UINT8 msm6255_device::read_video_data(UINT16 ma, UINT8 ra)
+{
+ return m_char_ram_r(this, ma, ra);
+}
//**************************************************************************
-// DEVICE CONFIGURATION
+// LIVE DEVICE
//**************************************************************************
-GENERIC_DEVICE_CONFIG_SETUP(msm6255, "MSM6255")
+// device type definition
+const device_type MSM6255 = &device_creator<msm6255_device>;
+
+//-------------------------------------------------
+// msm6255_device - constructor
+//-------------------------------------------------
+
+msm6255_device::msm6255_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, MSM6255, "MSM6255", tag, owner, clock),
+ m_cursor(0)
+{
+}
//-------------------------------------------------
@@ -86,7 +103,7 @@ GENERIC_DEVICE_CONFIG_SETUP(msm6255, "MSM6255")
// complete
//-------------------------------------------------
-void msm6255_device_config::device_config_complete()
+void msm6255_device::device_config_complete()
{
// inherit a copy of the static data
const msm6255_interface *intf = reinterpret_cast<const msm6255_interface *>(static_config());
@@ -104,38 +121,6 @@ void msm6255_device_config::device_config_complete()
}
-
-//**************************************************************************
-// INLINE HELPERS
-//**************************************************************************
-
-//-------------------------------------------------
-// read_video_data - read video ROM/RAM
-//-------------------------------------------------
-
-inline UINT8 msm6255_device::read_video_data(UINT16 ma, UINT8 ra)
-{
- return m_config.m_char_ram_r(this, ma, ra);
-}
-
-
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// msm6255_device - constructor
-//-------------------------------------------------
-
-msm6255_device::msm6255_device(running_machine &_machine, const msm6255_device_config &config)
- : device_t(_machine, config),
- m_cursor(0),
- m_config(config)
-{
-}
-
-
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -143,7 +128,7 @@ msm6255_device::msm6255_device(running_machine &_machine, const msm6255_device_c
void msm6255_device::device_start()
{
// find screen
- m_screen = machine().device<screen_device>(m_config.m_screen_tag);
+ m_screen = machine().device<screen_device>(m_screen_tag);
// register for state saving
save_item(NAME(m_ir));
diff --git a/src/emu/video/msm6255.h b/src/emu/video/msm6255.h
index a627a188538..92af37f2d56 100644
--- a/src/emu/video/msm6255.h
+++ b/src/emu/video/msm6255.h
@@ -56,39 +56,15 @@ struct msm6255_interface
};
-// ======================> msm6255_device_config
-
-class msm6255_device_config : public device_config,
- public msm6255_interface
-{
- friend class msm6255_device;
-
- // construction/destruction
- msm6255_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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
-
- msm6255_char_ram_read_func m_char_ram_r;
-};
-
-
// ======================> msm6255_device
-class msm6255_device : public device_t
+class msm6255_device : public device_t,
+ public msm6255_interface
{
- friend class msm6255_device_config;
-
+public:
// construction/destruction
- msm6255_device(running_machine &_machine, const msm6255_device_config &_config);
+ msm6255_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-public:
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -96,6 +72,7 @@ public:
protected:
// device-level overrides
+ virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
@@ -121,8 +98,6 @@ private:
int m_cursor; // is cursor displayed
int m_frame; // frame counter
-
- const msm6255_device_config &m_config;
};
diff --git a/src/emu/video/s2636.c b/src/emu/video/s2636.c
index f261e1f36db..fa20ac6c4a2 100644
--- a/src/emu/video/s2636.c
+++ b/src/emu/video/s2636.c
@@ -126,7 +126,7 @@ INLINE const s2636_interface *get_interface( device_t *device )
{
assert(device != NULL);
assert((device->type() == S2636));
- return (const s2636_interface *) device->baseconfig().static_config();
+ return (const s2636_interface *) device->static_config();
}
diff --git a/src/emu/video/saa5050.c b/src/emu/video/saa5050.c
index d62f7ae3edd..fe301457bf7 100644
--- a/src/emu/video/saa5050.c
+++ b/src/emu/video/saa5050.c
@@ -68,7 +68,7 @@ INLINE const saa5050_interface *get_interface( device_t *device )
{
assert(device != NULL);
assert((device->type() == SAA5050));
- return (const saa5050_interface *) device->baseconfig().static_config();
+ return (const saa5050_interface *) device->static_config();
}
/*************************************
diff --git a/src/emu/video/sed1330.c b/src/emu/video/sed1330.c
index 5d82a914092..efc85354f7f 100644
--- a/src/emu/video/sed1330.c
+++ b/src/emu/video/sed1330.c
@@ -61,8 +61,8 @@
// GLOBAL VARIABLES
//**************************************************************************
-// devices
-const device_type SED1330 = sed1330_device_config::static_alloc_device_config;
+// device type definition
+const device_type SED1330 = &device_creator<sed1330_device>;
// default address map
@@ -80,80 +80,6 @@ ROM_END
//**************************************************************************
-// DEVICE CONFIGURATION
-//**************************************************************************
-
-//-------------------------------------------------
-// sed1330_device_config - constructor
-//-------------------------------------------------
-
-sed1330_device_config::sed1330_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
- : device_config(mconfig, static_alloc_device_config, "Seiko-Epson SED1330", tag, owner, clock),
- device_config_memory_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(sed1330))
-{
- m_shortname = "sed1330";
-}
-
-
-//-------------------------------------------------
-// static_alloc_device_config - allocate a new
-// configuration object
-//-------------------------------------------------
-
-device_config *sed1330_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
-{
- return global_alloc(sed1330_device_config(mconfig, tag, owner, clock));
-}
-
-
-//-------------------------------------------------
-// alloc_device - allocate a new device object
-//-------------------------------------------------
-
-device_t *sed1330_device_config::alloc_device(running_machine &machine) const
-{
- return auto_alloc(machine, sed1330_device(machine, *this));
-}
-
-
-//-------------------------------------------------
-// static_set_config - configuration helper
-//-------------------------------------------------
-
-void sed1330_device_config::static_set_config(device_config *device, const char *screen_tag)
-{
- sed1330_device_config *sed1330 = downcast<sed1330_device_config *>(device);
-
- assert(screen_tag != NULL);
-
- sed1330->m_screen_tag = screen_tag;
-}
-
-
-//-------------------------------------------------
-// memory_space_config - return a description of
-// any address spaces owned by this device
-//-------------------------------------------------
-
-const address_space_config *sed1330_device_config::memory_space_config(address_spacenum spacenum) const
-{
- return (spacenum == AS_0) ? &m_space_config : NULL;
-}
-
-
-//-------------------------------------------------
-// rom_region - device-specific ROM region
-//-------------------------------------------------
-
-const rom_entry *sed1330_device_config::device_rom_region() const
-{
- return ROM_NAME( sed1330 );
-}
-
-
-
-//**************************************************************************
// INLINE HELPERS
//**************************************************************************
@@ -213,12 +139,37 @@ inline void sed1330_device::increment_csr()
// sed1330_device - constructor
//-------------------------------------------------
-sed1330_device::sed1330_device(running_machine &_machine, const sed1330_device_config &config)
- : device_t(_machine, config),
- device_memory_interface(_machine, config, *this),
+sed1330_device::sed1330_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, SED1330, "Seiko-Epson SED1330", tag, owner, clock),
+ device_memory_interface(mconfig, *this),
m_bf(0),
- m_config(config)
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(sed1330))
+{
+ m_shortname = "sed1330";
+}
+
+
+//-------------------------------------------------
+// static_set_config - configuration helper
+//-------------------------------------------------
+
+void sed1330_device::static_set_config(device_t &device, const char *screen_tag)
{
+ sed1330_device &sed1330 = downcast<sed1330_device &>(device);
+
+ assert(screen_tag != NULL);
+
+ sed1330.m_screen_tag = screen_tag;
+}
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *sed1330_device::device_rom_region() const
+{
+ return ROM_NAME( sed1330 );
}
@@ -278,6 +229,17 @@ void sed1330_device::device_reset()
//-------------------------------------------------
+// memory_space_config - return a description of
+// any address spaces owned by this device
+//-------------------------------------------------
+
+const address_space_config *sed1330_device::memory_space_config(address_spacenum spacenum) const
+{
+ return (spacenum == AS_0) ? &m_space_config : NULL;
+}
+
+
+//-------------------------------------------------
// status_r -
//-------------------------------------------------
diff --git a/src/emu/video/sed1330.h b/src/emu/video/sed1330.h
index 4bc7dd0d37a..2925545ab58 100644
--- a/src/emu/video/sed1330.h
+++ b/src/emu/video/sed1330.h
@@ -23,7 +23,7 @@
#define MCFG_SED1330_ADD(_tag, _clock, _screen_tag, _map) \
MCFG_DEVICE_ADD(_tag, SED1330, _clock) \
MCFG_DEVICE_ADDRESS_MAP(AS_0, _map) \
- sed1330_device_config::static_set_config(device, _screen_tag);
+ sed1330_device::static_set_config(*device, _screen_tag);
@@ -31,51 +31,18 @@
// TYPE DEFINITIONS
//**************************************************************************
-// ======================> sed1330_device_config
-
-class sed1330_device_config : public device_config,
- public device_config_memory_interface
-{
- friend class sed1330_device;
-
- // construction/destruction
- sed1330_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_config(device_config *device, const char *screen_tag);
-
-protected:
- // optional information overrides
- virtual const rom_entry *device_rom_region() const;
-
- // device_config_memory_interface overrides
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
-
- // address space configurations
- const address_space_config m_space_config;
-
-private:
- const char *m_screen_tag;
-};
-
-
-
// ======================> sed1330_device
class sed1330_device : public device_t,
public device_memory_interface
{
- friend class sed1330_device_config;
-
+public:
// construction/destruction
- sed1330_device(running_machine &_machine, const sed1330_device_config &_config);
+ sed1330_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // inline configuration helpers
+ static void static_set_config(device_t &device, const char *screen_tag);
-public:
DECLARE_READ8_MEMBER( status_r );
DECLARE_WRITE8_MEMBER( command_w );
@@ -86,9 +53,13 @@ public:
protected:
// device-level overrides
+ virtual const rom_entry *device_rom_region() const;
virtual void device_start();
virtual void device_reset();
+ // device_memory_interface overrides
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
+
inline UINT8 readbyte(offs_t address);
inline void writebyte(offs_t address, UINT8 m_data);
inline void increment_csr();
@@ -146,7 +117,9 @@ private:
// devices
screen_device *m_screen;
- const sed1330_device_config &m_config;
+ // address space configurations
+ const address_space_config m_space_config;
+ const char *m_screen_tag;
};
diff --git a/src/emu/video/tlc34076.c b/src/emu/video/tlc34076.c
index cbc5d5ae148..fea2408f96c 100644
--- a/src/emu/video/tlc34076.c
+++ b/src/emu/video/tlc34076.c
@@ -262,7 +262,7 @@ WRITE8_DEVICE_HANDLER( tlc34076_w )
static DEVICE_START( tlc34076 )
{
- tlc34076_config *config = (tlc34076_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
+ tlc34076_config *config = (tlc34076_config *)downcast<const legacy_device_base *>(device)->inline_config();
tlc34076_state *state = get_safe_token(device);
state->dacbits = config->res_sel ? 8 : 6;
diff --git a/src/emu/video/tms9927.c b/src/emu/video/tms9927.c
index 9d93cbe80eb..96e6105bc39 100644
--- a/src/emu/video/tms9927.c
+++ b/src/emu/video/tms9927.c
@@ -259,7 +259,7 @@ static DEVICE_START( tms9927 )
/* validate arguments */
assert(device != NULL);
- tms->intf = (const tms9927_interface *)device->baseconfig().static_config();
+ tms->intf = (const tms9927_interface *)device->static_config();
if (tms->intf != NULL)
{
diff --git a/src/emu/video/upd3301.c b/src/emu/video/upd3301.c
index 99c7fcf4d27..37d2b408694 100644
--- a/src/emu/video/upd3301.c
+++ b/src/emu/video/upd3301.c
@@ -25,6 +25,9 @@
#include "machine/devhelpr.h"
+// device type definition
+const device_type UPD3301 = &device_creator<upd3301_device>;
+
//**************************************************************************
// MACROS / CONSTANTS
@@ -62,47 +65,6 @@ enum
//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-// devices
-const device_type UPD3301 = upd3301_device_config::static_alloc_device_config;
-
-
-
-//**************************************************************************
-// DEVICE CONFIGURATION
-//**************************************************************************
-
-GENERIC_DEVICE_CONFIG_SETUP(upd3301, "UPD3301")
-
-
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void upd3301_device_config::device_config_complete()
-{
- // inherit a copy of the static data
- const upd3301_interface *intf = reinterpret_cast<const upd3301_interface *>(static_config());
- if (intf != NULL)
- *static_cast<upd3301_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_int_func, 0, sizeof(m_out_int_func));
- memset(&m_out_drq_func, 0, sizeof(m_out_drq_func));
- memset(&m_out_hrtc_func, 0, sizeof(m_out_hrtc_func));
- memset(&m_out_vrtc_func, 0, sizeof(m_out_vrtc_func));
- }
-}
-
-
-
-//**************************************************************************
// INLINE HELPERS
//**************************************************************************
@@ -172,7 +134,7 @@ inline void upd3301_device::update_hrtc_timer(int state)
int y = m_screen->vpos();
int next_x = state ? m_h : 0;
- int next_y = state ? y : ((y + 1) % ((m_l + m_v) * m_config.m_width));
+ int next_y = state ? y : ((y + 1) % ((m_l + m_v) * m_width));
attotime duration = m_screen->time_until_pos(next_y, next_x);
@@ -200,7 +162,7 @@ inline void upd3301_device::update_vrtc_timer(int state)
inline void upd3301_device::recompute_parameters()
{
- int horiz_pix_total = (m_h + m_z) * m_config.m_width;
+ int horiz_pix_total = (m_h + m_z) * m_width;
int vert_pix_total = (m_l + m_v) * m_r;
attoseconds_t refresh = HZ_TO_ATTOSECONDS(clock()) * horiz_pix_total * vert_pix_total;
@@ -209,7 +171,7 @@ inline void upd3301_device::recompute_parameters()
visarea.min_x = 0;
visarea.min_y = 0;
- visarea.max_x = (m_h * m_config.m_width) - 1;
+ visarea.max_x = (m_h * m_width) - 1;
visarea.max_y = (m_l * m_r) - 1;
if (LOG)
@@ -234,8 +196,8 @@ inline void upd3301_device::recompute_parameters()
// upd3301_device - constructor
//-------------------------------------------------
-upd3301_device::upd3301_device(running_machine &_machine, const upd3301_device_config &config)
- : device_t(_machine, config),
+upd3301_device::upd3301_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, UPD3301, "UPD3301", tag, owner, clock),
m_status(0),
m_param_count(0),
m_data_fifo_pos(0),
@@ -245,13 +207,36 @@ upd3301_device::upd3301_device(running_machine &_machine, const upd3301_device_c
m_l(20),
m_r(10),
m_v(6),
- m_z(32),
- m_config(config)
+ m_z(32)
{
}
//-------------------------------------------------
+// device_config_complete - perform any
+// operations now that the configuration is
+// complete
+//-------------------------------------------------
+
+void upd3301_device::device_config_complete()
+{
+ // inherit a copy of the static data
+ const upd3301_interface *intf = reinterpret_cast<const upd3301_interface *>(static_config());
+ if (intf != NULL)
+ *static_cast<upd3301_interface *>(this) = *intf;
+
+ // or initialize to defaults if none provided
+ else
+ {
+ memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
+ memset(&m_out_drq_cb, 0, sizeof(m_out_drq_cb));
+ memset(&m_out_hrtc_cb, 0, sizeof(m_out_hrtc_cb));
+ memset(&m_out_vrtc_cb, 0, sizeof(m_out_vrtc_cb));
+ }
+}
+
+
+//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -263,13 +248,13 @@ void upd3301_device::device_start()
m_drq_timer = timer_alloc(TIMER_DRQ);
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_config.m_out_int_func, this);
- devcb_resolve_write_line(&m_out_drq_func, &m_config.m_out_drq_func, this);
- devcb_resolve_write_line(&m_out_hrtc_func, &m_config.m_out_hrtc_func, this);
- devcb_resolve_write_line(&m_out_vrtc_func, &m_config.m_out_vrtc_func, this);
+ devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
+ devcb_resolve_write_line(&m_out_drq_func, &m_out_drq_cb, this);
+ devcb_resolve_write_line(&m_out_hrtc_func, &m_out_hrtc_cb, this);
+ devcb_resolve_write_line(&m_out_vrtc_func, &m_out_vrtc_cb, this);
// get the screen device
- m_screen = machine().device<screen_device>(m_config.m_screen_tag);
+ m_screen = machine().device<screen_device>(m_screen_tag);
assert(m_screen != NULL);
// state saving
@@ -621,7 +606,7 @@ void upd3301_device::draw_scanline()
int csr = m_cm && m_cursor_blink && ((y / m_r) == m_cy) && (sx == m_cx);
int gpa = 0; // TODO
- m_config.m_display_func(this, m_bitmap, y, sx, cc, lc, hlgt, rvv, vsp, sl0, sl12, csr, gpa);
+ m_display_cb(this, m_bitmap, y, sx, cc, lc, hlgt, rvv, vsp, sl0, sl12, csr, gpa);
}
}
diff --git a/src/emu/video/upd3301.h b/src/emu/video/upd3301.h
index fbc522adaac..f12d5f5e763 100644
--- a/src/emu/video/upd3301.h
+++ b/src/emu/video/upd3301.h
@@ -77,48 +77,25 @@ struct upd3301_interface
const char *m_screen_tag; // screen we are acting on
int m_width; // char width in pixels
- upd3301_display_pixels_func m_display_func;
+ upd3301_display_pixels_func m_display_cb;
- devcb_write_line m_out_int_func;
- devcb_write_line m_out_drq_func;
- devcb_write_line m_out_hrtc_func;
- devcb_write_line m_out_vrtc_func;
-};
-
-
-
-// ======================> upd3301_device_config
-
-class upd3301_device_config : public device_config,
- public upd3301_interface
-{
- friend class upd3301_device;
-
- // construction/destruction
- upd3301_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;
-
-protected:
- // device_config overrides
- virtual void device_config_complete();
+ devcb_write_line m_out_int_cb;
+ devcb_write_line m_out_drq_cb;
+ devcb_write_line m_out_hrtc_cb;
+ devcb_write_line m_out_vrtc_cb;
};
// ======================> upd3301_device
-class upd3301_device : public device_t
+class upd3301_device : public device_t,
+ public upd3301_interface
{
- friend class upd3301_device_config;
-
+public:
// construction/destruction
- upd3301_device(running_machine &_machine, const upd3301_device_config &_config);
+ upd3301_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-public:
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE8_MEMBER( dack_w );
@@ -130,6 +107,7 @@ public:
protected:
// device-level overrides
+ virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void device_clock_changed();
@@ -209,8 +187,6 @@ private:
emu_timer *m_hrtc_timer;
emu_timer *m_vrtc_timer;
emu_timer *m_drq_timer;
-
- const upd3301_device_config &m_config;
};
diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c
index 25fdbff7380..d878361b1af 100644
--- a/src/emu/video/voodoo.c
+++ b/src/emu/video/voodoo.c
@@ -4477,7 +4477,7 @@ WRITE32_DEVICE_HANDLER( banshee_io_w )
static DEVICE_START( voodoo )
{
- const voodoo_config *config = (const voodoo_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
+ const voodoo_config *config = (const voodoo_config *)downcast<const legacy_device_base *>(device)->inline_config();
voodoo_state *v = get_safe_token(device);
const raster_info *info;
void *fbmem, *tmumem[2];
@@ -4485,8 +4485,8 @@ static DEVICE_START( voodoo )
int val;
/* validate some basic stuff */
- assert(device->baseconfig().static_config() == NULL);
- assert(downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config() != NULL);
+ assert(device->static_config() == NULL);
+ assert(downcast<const legacy_device_base *>(device)->inline_config() != NULL);
/* validate configuration */
assert(config->screen != NULL);
@@ -4573,7 +4573,7 @@ static DEVICE_START( voodoo )
}
/* set the type, and initialize the chip mask */
- v->index = device->machine().m_devicelist.indexof(device->type(), device->tag());
+ v->index = device->machine().devicelist().indexof(device->type(), device->tag());
v->screen = downcast<screen_device *>(device->machine().device(config->screen));
assert_always(v->screen != NULL, "Unable to find screen attached to voodoo");
v->cpu = device->machine().device(config->cputag);
@@ -4680,9 +4680,9 @@ static DEVICE_RESET( voodoo )
device definition
-------------------------------------------------*/
-INLINE const char *get_voodoo_name(const device_config *devconfig)
+INLINE const char *get_voodoo_name(const device_t *device)
{
- const voodoo_config *config = (devconfig != NULL) ? (const voodoo_config *)downcast<const legacy_device_config_base *>(devconfig)->inline_config() : NULL;
+ const voodoo_config *config = (device != NULL) ? (const voodoo_config *)downcast<const legacy_device_base *>(device)->inline_config() : NULL;
switch (config->type)
{
default: