diff --git a/src/emu/machine/devhelpr.h b/src/emu/machine/devhelpr.h index 42f72925023..96f5a1b281e 100644 --- a/src/emu/machine/devhelpr.h +++ b/src/emu/machine/devhelpr.h @@ -8,6 +8,16 @@ #ifndef __DEVHELPR_H__ #define __DEVHELPR_H__ +#define READ32_DEVICE_HANDLER_TRAMPOLINE(devname, funcname) \ + READ32_DEVICE_HANDLER( funcname ) \ + { return downcast(device)->funcname(offset); } \ + UINT32 devname##_device::funcname(UINT32 offset) + +#define WRITE32_DEVICE_HANDLER_TRAMPOLINE(devname, funcname) \ + WRITE32_DEVICE_HANDLER( funcname ) \ + { downcast(device)->funcname(offset, data, mem_mask); } \ + void devname##_device::funcname(UINT32 offset, UINT32 data, UINT32 mem_mask) + #define READ8_DEVICE_HANDLER_TRAMPOLINE(devname, funcname) \ READ8_DEVICE_HANDLER( funcname ) \ { return downcast(device)->funcname(offset); } \ @@ -39,5 +49,24 @@ device_t *devname##_device_config::alloc_device(running_machine &machine) const \ { return auto_alloc(&machine, devname##_device(machine, *this)); } +#define GENERIC_DEVICE_DERIVED_CONFIG(basename, devname) \ + class devname##_device_config : public basename##_device_config \ + { \ + friend class devname##_device; \ + devname##_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); \ + public: \ + 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; \ + }; \ + \ + class devname##_device : public basename##_device \ + { \ + friend class basename##_device; \ + friend class devname##_device_config; \ + devname##_device(running_machine &_machine, const devname##_device_config &config); \ + protected: \ + virtual void device_start(); \ + virtual void device_reset(); \ + }; #endif // __DEVHELPR_H__ \ No newline at end of file diff --git a/src/emu/machine/k033906.c b/src/emu/machine/k033906.c index eae724bb235..67934af906d 100644 --- a/src/emu/machine/k033906.c +++ b/src/emu/machine/k033906.c @@ -7,72 +7,97 @@ #include "emu.h" #include "k033906.h" #include "video/voodoo.h" +#include "devhelpr.h" -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ -typedef struct _k033906_state k033906_state; -struct _k033906_state +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +GENERIC_DEVICE_CONFIG_SETUP(k033906, "K033906") + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k033906_device_config::device_config_complete() { - UINT32 * reg; - UINT32 * ram; + // inherit a copy of the static data + const k033906_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + { + *static_cast(this) = *intf; + } - int reg_set; // 1 = access reg / 0 = access ram - - running_device *voodoo; -}; - -/***************************************************************************** - INLINE FUNCTIONS -*****************************************************************************/ - -INLINE k033906_state *k033906_get_safe_token( running_device *device ) -{ - assert(device != NULL); - assert(device->type() == K033906); - - return (k033906_state *)downcast(device)->token(); + // or initialize to defaults if none provided + else + { + m_voodoo_tag = NULL; + } } -INLINE const k033906_interface *k033906_get_interface( running_device *device ) + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +const device_type K033906 = k033906_device_config::static_alloc_device_config; + +//------------------------------------------------- +// k033906_device - constructor +//------------------------------------------------- + +k033906_device::k033906_device(running_machine &_machine, const k033906_device_config &config) + : device_t(_machine, config), + m_config(config) { - assert(device != NULL); - assert((device->type() == K033906)); - return (const k033906_interface *) device->baseconfig().static_config(); + } -/***************************************************************************** - DEVICE HANDLERS -*****************************************************************************/ +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- -WRITE_LINE_DEVICE_HANDLER( k033906_set_reg ) +void k033906_device::device_start() { - k033906_state *k033906 = k033906_get_safe_token(device); - k033906->reg_set = state & 1; + m_voodoo = m_machine.device(m_config.m_voodoo_tag); + + m_reg = auto_alloc_array(&m_machine, UINT32, 256); + m_ram = auto_alloc_array(&m_machine, UINT32, 32768); + + m_reg_set = 0; + + state_save_register_device_item_pointer(this, 0, m_reg, 256); + state_save_register_device_item_pointer(this, 0, m_ram, 32768); + state_save_register_device_item(this, 0, m_reg_set); } -static UINT32 k033906_reg_r( running_device *device, int reg ) -{ - k033906_state *k033906 = k033906_get_safe_token(device); +WRITE_LINE_DEVICE_HANDLER_TRAMPOLINE(k033906, k033906_set_reg) +{ + m_reg_set = state & 1; +} + +UINT32 k033906_device::k033906_reg_r(int reg) +{ switch (reg) { case 0x00: return 0x0001121a; // PCI Vendor ID (0x121a = 3dfx), Device ID (0x0001 = Voodoo) case 0x02: return 0x04000000; // Revision ID - case 0x04: return k033906->reg[0x04]; // memBaseAddr - case 0x0f: return k033906->reg[0x0f]; // interrupt_line, interrupt_pin, min_gnt, max_lat + case 0x04: return m_reg[0x04]; // memBaseAddr + case 0x0f: return m_reg[0x0f]; // interrupt_line, interrupt_pin, min_gnt, max_lat default: - fatalerror("%s: k033906_reg_r: %08X", cpuexec_describe_context(device->machine), reg); + fatalerror("%s: k033906_reg_r: %08X", cpuexec_describe_context(&m_machine), reg); } return 0; } -static void k033906_reg_w( running_device *device, int reg, UINT32 data ) +void k033906_device::k033906_reg_w(int reg, UINT32 data) { - k033906_state *k033906 = k033906_get_safe_token(device); - switch (reg) { case 0x00: @@ -84,21 +109,25 @@ static void k033906_reg_w( running_device *device, int reg, UINT32 data ) case 0x04: // memBaseAddr { if (data == 0xffffffff) - k033906->reg[0x04] = 0xff000000; + { + m_reg[0x04] = 0xff000000; + } else - k033906->reg[0x04] = data & 0xff000000; + { + m_reg[0x04] = data & 0xff000000; + } break; } case 0x0f: // interrupt_line, interrupt_pin, min_gnt, max_lat { - k033906->reg[0x0f] = data; + m_reg[0x0f] = data; break; } case 0x10: // initEnable { - voodoo_set_init_enable(k033906->voodoo, data); + voodoo_set_init_enable(m_voodoo, data); break; } @@ -110,63 +139,30 @@ static void k033906_reg_w( running_device *device, int reg, UINT32 data ) break; default: - fatalerror("%s:K033906_w: %08X, %08X", cpuexec_describe_context(device->machine), data, reg); + fatalerror("%s:K033906_w: %08X, %08X", cpuexec_describe_context(&m_machine), data, reg); } } -READ32_DEVICE_HANDLER( k033906_r ) +READ32_DEVICE_HANDLER_TRAMPOLINE(k033906, k033906_r) { - k033906_state *k033906 = k033906_get_safe_token(device); - - if (k033906->reg_set) - return k033906_reg_r(device, offset); + if(m_reg_set) + { + return k033906_reg_r(offset); + } else - return k033906->ram[offset]; + { + return m_ram[offset]; + } } -WRITE32_DEVICE_HANDLER( k033906_w ) +WRITE32_DEVICE_HANDLER_TRAMPOLINE(k033906, k033906_w) { - k033906_state *k033906 = k033906_get_safe_token(device); - - if (k033906->reg_set) - k033906_reg_w(device, offset, data); + if(m_reg_set) + { + k033906_reg_w(offset, data); + } else - k033906->ram[offset] = data; + { + m_ram[offset] = data; + } } - - -/***************************************************************************** - DEVICE INTERFACE -*****************************************************************************/ - -static DEVICE_START( k033906 ) -{ - k033906_state *k033906 = k033906_get_safe_token(device); - const k033906_interface *intf = k033906_get_interface(device); - - k033906->voodoo = device->machine->device(intf->voodoo); - - k033906->reg = auto_alloc_array(device->machine, UINT32, 256); - k033906->ram = auto_alloc_array(device->machine, UINT32, 32768); - - k033906->reg_set = 0; - - state_save_register_device_item_pointer(device, 0, k033906->reg, 256); - state_save_register_device_item_pointer(device, 0, k033906->ram, 32768); - state_save_register_device_item(device, 0, k033906->reg_set); -} - -/*------------------------------------------------- - device definition --------------------------------------------------*/ - -static const char DEVTEMPLATE_SOURCE[] = __FILE__; - -#define DEVTEMPLATE_ID( p, s ) p##k033906##s -#define DEVTEMPLATE_FEATURES DT_HAS_START -#define DEVTEMPLATE_NAME "Konami 033906" -#define DEVTEMPLATE_FAMILY "Konami PCI Bridge 033906" -#include "devtempl.h" - - -DEFINE_LEGACY_DEVICE(K033906, k033906); diff --git a/src/emu/machine/k033906.h b/src/emu/machine/k033906.h index 42fc29afa61..2f0a6183341 100644 --- a/src/emu/machine/k033906.h +++ b/src/emu/machine/k033906.h @@ -4,27 +4,17 @@ ***************************************************************************/ +#pragma once + #ifndef __K033906_H__ #define __K033906_H__ -#include "devlegcy.h" +#include "emu.h" + /*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -typedef struct _k033906_interface k033906_interface; -struct _k033906_interface -{ - const char *voodoo; -}; - -DECLARE_LEGACY_DEVICE(K033906, k033906); - - -/*************************************************************************** - MACROS / CONSTANTS + DEVICE CONFIGURATION MACROS ***************************************************************************/ #define MDRV_K033906_ADD(_tag, _config) \ @@ -33,7 +23,87 @@ DECLARE_LEGACY_DEVICE(K033906, k033906); /*************************************************************************** - DEVICE I/O FUNCTIONS + TYPE DEFINITIONS +***************************************************************************/ + + +// ======================> k033906_interface + +struct k033906_interface +{ + const char *m_voodoo_tag; +}; + + + +// ======================> k033906_device_config + +class k033906_device_config : public device_config, + public k033906_interface +{ + friend class k033906_device; + + // construction/destruction + k033906_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(); +}; + + + +// ======================> k033906_device + +class k033906_device : public device_t +{ + friend class k033906_device_config; + + // construction/destruction + k033906_device(running_machine &_machine, const k033906_device_config &_config); + +public: + + UINT32 k033906_r(UINT32 offset); + void k033906_w(UINT32 offset, UINT32 data, UINT32 mem_mask); + void k033906_set_reg(UINT8 state); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset() { } + virtual void device_post_load() { } + virtual void device_clock_changed() { } + +private: + + UINT32 k033906_reg_r(int reg); + void k033906_reg_w(int reg, UINT32 data); + + /* i/o lines */ + UINT32 * m_reg; + UINT32 * m_ram; + + int m_reg_set; // 1 = access reg / 0 = access ram + + running_device *m_voodoo; + + const k033906_device_config &m_config; +}; + + +// device type definition +extern const device_type K033906; + + + +/*************************************************************************** + PROTOTYPES ***************************************************************************/ extern READ32_DEVICE_HANDLER( k033906_r ); diff --git a/src/emu/machine/k056230.c b/src/emu/machine/k056230.c index f5a5dbbed32..88b77604031 100644 --- a/src/emu/machine/k056230.c +++ b/src/emu/machine/k056230.c @@ -6,44 +6,81 @@ #include "emu.h" #include "k056230.h" +#include "devhelpr.h" -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ -typedef struct _k056230_state k056230_state; -struct _k056230_state +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +GENERIC_DEVICE_CONFIG_SETUP(k056230, "K056230") + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k056230_device_config::device_config_complete() { - UINT32 * ram; - int is_thunderh; + // inherit a copy of the static data + const k056230_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + { + *static_cast(this) = *intf; + } - running_device *cpu; -}; - -/***************************************************************************** - INLINE FUNCTIONS -*****************************************************************************/ - -INLINE k056230_state *k056230_get_safe_token( running_device *device ) -{ - assert(device != NULL); - assert(device->type() == K056230); - - return (k056230_state *)downcast(device)->token(); + // or initialize to defaults if none provided + else + { + m_cpu = NULL; + m_is_thunderh = 0; + } } -INLINE const k056230_interface *k056230_get_interface( running_device *device ) + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +const device_type K056230 = k056230_device_config::static_alloc_device_config; + +//------------------------------------------------- +// k056230_device - constructor +//------------------------------------------------- + +k056230_device::k056230_device(running_machine &_machine, const k056230_device_config &config) + : device_t(_machine, config), + m_config(config) { - assert(device != NULL); - assert((device->type() == K056230)); - return (const k056230_interface *) device->baseconfig().static_config(); + } -/***************************************************************************** - DEVICE HANDLERS -*****************************************************************************/ +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- -READ8_DEVICE_HANDLER( k056230_r ) +void k056230_device::device_start() +{ + if(m_config.m_cpu) + { + m_cpu = m_machine.device(m_config.m_cpu); + } + else + { + m_cpu = NULL; + } + + m_is_thunderh = m_config.m_is_thunderh; + + m_ram = auto_alloc_array(&m_machine, UINT32, 0x2000); + + state_save_register_device_item_pointer(this, 0, m_ram, 0x2000); +} + + +READ8_DEVICE_HANDLER_TRAMPOLINE(k056230, k056230_r) { switch (offset) { @@ -58,17 +95,23 @@ READ8_DEVICE_HANDLER( k056230_r ) return 0; } -static TIMER_CALLBACK( network_irq_clear ) +TIMER_CALLBACK( k056230_device::network_irq_clear_callback ) { - k056230_state *k056230 = (k056230_state *)ptr; - cpu_set_input_line(k056230->cpu, INPUT_LINE_IRQ2, CLEAR_LINE); + reinterpret_cast(ptr)->network_irq_clear(); } -WRITE8_DEVICE_HANDLER( k056230_w ) +void k056230_device::network_irq_clear() { - k056230_state *k056230 = k056230_get_safe_token(device); + if(m_cpu) + { + cpu_set_input_line(m_cpu, INPUT_LINE_IRQ2, CLEAR_LINE); + } +} - switch (offset) + +WRITE8_DEVICE_HANDLER_TRAMPOLINE(k056230, k056230_w) +{ + switch(offset) { case 0: // Mode register { @@ -76,13 +119,16 @@ WRITE8_DEVICE_HANDLER( k056230_w ) } case 1: // Control register { - if (data & 0x20) + if(data & 0x20) { // Thunder Hurricane breaks otherwise... - if (!k056230->is_thunderh) + if(!m_is_thunderh) { - cpu_set_input_line(k056230->cpu, INPUT_LINE_IRQ2, ASSERT_LINE); - timer_set(device->machine, ATTOTIME_IN_USEC(10), k056230, 0, network_irq_clear); + if(m_cpu) + { + cpu_set_input_line(m_cpu, INPUT_LINE_IRQ2, ASSERT_LINE); + } + timer_set(&m_machine, ATTOTIME_IN_USEC(10), (void*)this, 0, network_irq_clear_callback); } } // else @@ -97,50 +143,14 @@ WRITE8_DEVICE_HANDLER( k056230_w ) // mame_printf_debug("k056230_w: %d, %02X at %08X\n", offset, data, cpu_get_pc(space->cpu)); } -READ32_DEVICE_HANDLER( lanc_ram_r ) +READ32_DEVICE_HANDLER_TRAMPOLINE(k056230, lanc_ram_r) { - k056230_state *k056230 = k056230_get_safe_token(device); - //mame_printf_debug("LANC_RAM_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(space->cpu)); - return k056230->ram[offset & 0x7ff]; + return m_ram[offset & 0x7ff]; } -WRITE32_DEVICE_HANDLER( lanc_ram_w ) +WRITE32_DEVICE_HANDLER_TRAMPOLINE(k056230, lanc_ram_w) { - k056230_state *k056230 = k056230_get_safe_token(device); - //mame_printf_debug("LANC_RAM_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(space->cpu)); - COMBINE_DATA(k056230->ram + (offset & 0x7ff)); + COMBINE_DATA(m_ram + (offset & 0x7ff)); } - -/***************************************************************************** - DEVICE INTERFACE -*****************************************************************************/ - -static DEVICE_START( k056230 ) -{ - k056230_state *k056230 = k056230_get_safe_token(device); - const k056230_interface *intf = k056230_get_interface(device); - - k056230->cpu = device->machine->device(intf->cpu); - k056230->is_thunderh = intf->is_thunderh; - - k056230->ram = auto_alloc_array(device->machine, UINT32, 0x2000); - - state_save_register_device_item_pointer(device, 0, k056230->ram, 0x2000); -} - -/*------------------------------------------------- - device definition --------------------------------------------------*/ - -static const char DEVTEMPLATE_SOURCE[] = __FILE__; - -#define DEVTEMPLATE_ID( p, s ) p##k056230##s -#define DEVTEMPLATE_FEATURES DT_HAS_START -#define DEVTEMPLATE_NAME "Konami 056230" -#define DEVTEMPLATE_FAMILY "Konami Network Board 056230" -#include "devtempl.h" - - -DEFINE_LEGACY_DEVICE(K056230, k056230); diff --git a/src/emu/machine/k056230.h b/src/emu/machine/k056230.h index 092b517c239..44b4f00c2f2 100644 --- a/src/emu/machine/k056230.h +++ b/src/emu/machine/k056230.h @@ -4,37 +4,107 @@ ***************************************************************************/ +#pragma once + #ifndef __K056230_H__ #define __K056230_H__ -#include "devlegcy.h" +#include "emu.h" + + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS +***************************************************************************/ + +#define MDRV_K056230_ADD(_tag, _config) \ + MDRV_DEVICE_ADD(_tag, K0506230, 0) \ + MDRV_DEVICE_CONFIG(_config) /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ -typedef struct _k056230_interface k056230_interface; -struct _k056230_interface + +// ======================> k056230_interface + +struct k056230_interface { - const char *cpu; - int is_thunderh; + const char *m_cpu; + int m_is_thunderh; }; -DECLARE_LEGACY_DEVICE(K056230, k056230); + + +// ======================> k056230_device_config + +class k056230_device_config : public device_config, + public k056230_interface +{ + friend class k056230_device; + + // construction/destruction + k056230_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(); +}; + + + +// ======================> k056230_device + +class k056230_device : public device_t +{ + friend class k056230_device_config; + + // construction/destruction + k056230_device(running_machine &_machine, const k056230_device_config &_config); + +public: + + UINT32 lanc_ram_r(UINT32 offset); + void lanc_ram_w(UINT32 offset, UINT32 data, UINT32 mem_mask); + + UINT8 k056230_r(UINT32 offset); + void k056230_w(UINT32 offset, UINT8 data); + + static TIMER_CALLBACK( network_irq_clear_callback ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset() { } + virtual void device_post_load() { } + virtual void device_clock_changed() { } + +private: + + void network_irq_clear(); + + UINT32 *m_ram; + int m_is_thunderh; + + running_device *m_cpu; + + const k056230_device_config &m_config; +}; + + +// device type definition +extern const device_type K056230; + /*************************************************************************** - MACROS / CONSTANTS -***************************************************************************/ - -#define MDRV_K056230_ADD(_tag, _config) \ - MDRV_DEVICE_ADD(_tag, K056230, 0) \ - MDRV_DEVICE_CONFIG(_config) - - -/*************************************************************************** - DEVICE I/O FUNCTIONS + PROTOTYPES ***************************************************************************/ extern READ32_DEVICE_HANDLER( lanc_ram_r ); diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c index f356f8daccc..7a774f0d46d 100644 --- a/src/emu/machine/timekpr.c +++ b/src/emu/machine/timekpr.c @@ -67,9 +67,6 @@ TIMEKPR_DEVCFG_DERIVED_STATIC_ALLOC(devtype) \ TIMEKPR_DEVCFG_DERIVED_DEV_ALLOC(devtype) -//************************************************************************** -// STATIC DATA -//************************************************************************** //************************************************************************** // DEVICE CONFIGURATION @@ -307,11 +304,11 @@ void mk48t08_device::device_start() // device_reset - device-specific reset //------------------------------------------------- -void timekeeper_device::device_reset() -{ - -} - +void timekeeper_device::device_reset() { } +void m48t02_device::device_reset() { } +void m48t35_device::device_reset() { } +void m48t58_device::device_reset() { } +void mk48t08_device::device_reset() { } void timekeeper_device::counters_to_ram() { diff --git a/src/emu/machine/timekpr.h b/src/emu/machine/timekpr.h index 1bc98902449..e62919ed325 100644 --- a/src/emu/machine/timekpr.h +++ b/src/emu/machine/timekpr.h @@ -16,6 +16,7 @@ #define __TIMEKPR_H__ #include "emu.h" +#include "devhelpr.h" @@ -137,130 +138,10 @@ private: int m_offset_flags; }; - -// ======================> m48t02_device_config - -class m48t02_device_config : public timekeeper_device_config -{ - friend class mt48t02_device; - - m48t02_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; -}; - - -// ======================> m48t02_device - -class m48t02_device : public timekeeper_device -{ - friend class timekeeper_device; - friend class m48t02_device_config; - - // construction/destruction - m48t02_device(running_machine &_machine, const m48t02_device_config &config); - -protected: - // device-level overrides - virtual void device_start(); -}; - - -// ======================> m48t35_device_config - -class m48t35_device_config : public timekeeper_device_config -{ - friend class m48t35_device; - friend class timekeeper_device_config; - - m48t35_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; -}; - - -// ======================> m48t35_device - -class m48t35_device : public timekeeper_device -{ - friend class m48t35_device_config; - - // construction/destruction - m48t35_device(running_machine &_machine, const m48t35_device_config &config); - -protected: - // device-level overrides - virtual void device_start(); -}; - - -// ======================> m48t58_device_config - -class m48t58_device_config : public timekeeper_device_config -{ - friend class m48t58_device; - friend class timekeeper_device_config; - - m48t58_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; -}; - - -// ======================> m48t58_device - -class m48t58_device : public timekeeper_device -{ - friend class m48t58_device_config; - - // construction/destruction - m48t58_device(running_machine &_machine, const m48t58_device_config &config); - -protected: - // device-level overrides - virtual void device_start(); -}; - - -// ======================> mk48t08_device_config - -class mk48t08_device_config : public timekeeper_device_config -{ - friend class mk48t08_device; - friend class timekeeper_device_config; - - mk48t08_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; -}; - - -// ======================> mk48t08_device - -class mk48t08_device : public timekeeper_device -{ - friend class mk48t08_device_config; - - // construction/destruction - mk48t08_device(running_machine &_machine, const mk48t08_device_config &config); - -protected: - // device-level overrides - virtual void device_start(); -}; - +GENERIC_DEVICE_DERIVED_CONFIG(timekeeper, m48t02) +GENERIC_DEVICE_DERIVED_CONFIG(timekeeper, m48t35) +GENERIC_DEVICE_DERIVED_CONFIG(timekeeper, m48t58) +GENERIC_DEVICE_DERIVED_CONFIG(timekeeper, mk48t08) // device type definition extern const device_type M48T02;