diff options
418 files changed, 18530 insertions, 954 deletions
diff --git a/src/emu/machine/6525tpi.c b/src/emu/machine/6525tpi.c index 12a0f76f952..73595a6eb96 100644 --- a/src/emu/machine/6525tpi.c +++ b/src/emu/machine/6525tpi.c @@ -141,7 +141,7 @@ INLINE tpi6525_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == TPI6525); - return (tpi6525_state *)downcast<legacy_device_base *>(device)->token(); + return (tpi6525_state *)downcast<tpi6525_device *>(device)->token(); } @@ -619,4 +619,40 @@ UINT8 tpi6525_get_ddr_c(device_t *device) return tpi6525->ddr_c; } -DEFINE_LEGACY_DEVICE(TPI6525, tpi6525); +const device_type TPI6525 = &device_creator<tpi6525_device>; + +tpi6525_device::tpi6525_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TPI6525, "6525 TPI", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tpi6525_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tpi6525_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tpi6525_device::device_start() +{ + DEVICE_START_NAME( tpi6525 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tpi6525_device::device_reset() +{ + DEVICE_RESET_NAME( tpi6525 )(this); +} + + diff --git a/src/emu/machine/6525tpi.h b/src/emu/machine/6525tpi.h index 794e1244c88..01b42253523 100644 --- a/src/emu/machine/6525tpi.h +++ b/src/emu/machine/6525tpi.h @@ -57,7 +57,26 @@ struct _tpi6525_interface DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(TPI6525, tpi6525); +class tpi6525_device : public device_t +{ +public: + tpi6525_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tpi6525_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TPI6525; + #define MCFG_TPI6525_ADD(_tag, _intrf) \ MCFG_DEVICE_ADD(_tag, TPI6525, 0) \ diff --git a/src/emu/machine/68681.c b/src/emu/machine/68681.c index 9b06ffcdfd4..a4ff2f1dfe8 100644 --- a/src/emu/machine/68681.c +++ b/src/emu/machine/68681.c @@ -106,7 +106,7 @@ INLINE duart68681_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == DUART68681); - return (duart68681_state *)downcast<legacy_device_base *>(device)->token(); + return (duart68681_state *)downcast<duart68681_device *>(device)->token(); } static void duart68681_update_interrupts(duart68681_state *duart68681) @@ -928,4 +928,40 @@ DEVICE_GET_INFO(duart68681) } } -DEFINE_LEGACY_DEVICE(DUART68681, duart68681); +const device_type DUART68681 = &device_creator<duart68681_device>; + +duart68681_device::duart68681_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DUART68681, "DUART 68681", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(duart68681_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void duart68681_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void duart68681_device::device_start() +{ + DEVICE_START_NAME( duart68681 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void duart68681_device::device_reset() +{ + DEVICE_RESET_NAME( duart68681 )(this); +} + + diff --git a/src/emu/machine/68681.h b/src/emu/machine/68681.h index 8edaeb0c772..a8084d3b167 100644 --- a/src/emu/machine/68681.h +++ b/src/emu/machine/68681.h @@ -15,7 +15,26 @@ struct _duart68681_config INT32 ip3clk, ip4clk, ip5clk, ip6clk; }; -DECLARE_LEGACY_DEVICE(DUART68681, duart68681); +class duart68681_device : public device_t +{ +public: + duart68681_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~duart68681_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type DUART68681; + #define MCFG_DUART68681_ADD(_tag, _clock, _config) \ MCFG_DEVICE_ADD(_tag, DUART68681, _clock) \ diff --git a/src/emu/machine/74148.c b/src/emu/machine/74148.c index 856ab3cd277..5426221d562 100644 --- a/src/emu/machine/74148.c +++ b/src/emu/machine/74148.c @@ -69,7 +69,7 @@ INLINE ttl74148_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == TTL74148); - return (ttl74148_state *)downcast<legacy_device_base *>(device)->token(); + return (ttl74148_state *)downcast<ttl74148_device *>(device)->token(); } void ttl74148_update(device_t *device) @@ -229,4 +229,40 @@ DEVICE_GET_INFO(ttl74148) } } -DEFINE_LEGACY_DEVICE(TTL74148, ttl74148); +const device_type TTL74148 = &device_creator<ttl74148_device>; + +ttl74148_device::ttl74148_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TTL74148, "74148", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ttl74148_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ttl74148_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ttl74148_device::device_start() +{ + DEVICE_START_NAME( ttl74148 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ttl74148_device::device_reset() +{ + DEVICE_RESET_NAME( ttl74148 )(this); +} + + diff --git a/src/emu/machine/74148.h b/src/emu/machine/74148.h index 49da5bba82e..ac3d55a097a 100644 --- a/src/emu/machine/74148.h +++ b/src/emu/machine/74148.h @@ -65,6 +65,25 @@ int ttl74148_output_r(device_t *device); int ttl74148_output_valid_r(device_t *device); int ttl74148_enable_output_r(device_t *device); -DECLARE_LEGACY_DEVICE(TTL74148, ttl74148); +class ttl74148_device : public device_t +{ +public: + ttl74148_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ttl74148_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TTL74148; + #endif diff --git a/src/emu/machine/74153.c b/src/emu/machine/74153.c index cf143b17600..7ec0a7cea53 100644 --- a/src/emu/machine/74153.c +++ b/src/emu/machine/74153.c @@ -61,7 +61,7 @@ INLINE ttl74153_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == TTL74153); - return (ttl74153_state *)downcast<legacy_device_base *>(device)->token(); + return (ttl74153_state *)downcast<ttl74153_device *>(device)->token(); } @@ -191,4 +191,40 @@ DEVICE_GET_INFO(ttl74153) } } -DEFINE_LEGACY_DEVICE(TTL74153, ttl74153); +const device_type TTL74153 = &device_creator<ttl74153_device>; + +ttl74153_device::ttl74153_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TTL74153, "74153", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ttl74153_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ttl74153_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ttl74153_device::device_start() +{ + DEVICE_START_NAME( ttl74153 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ttl74153_device::device_reset() +{ + DEVICE_RESET_NAME( ttl74153 )(this); +} + + diff --git a/src/emu/machine/74153.h b/src/emu/machine/74153.h index cf1d2b813ae..acae556036e 100644 --- a/src/emu/machine/74153.h +++ b/src/emu/machine/74153.h @@ -61,6 +61,25 @@ void ttl74153_input_line_w(device_t *device, int section, int input_line, int da void ttl74153_enable_w(device_t *device, int section, int data); int ttl74153_output_r(device_t *device, int section); -DECLARE_LEGACY_DEVICE(TTL74153, ttl74153); +class ttl74153_device : public device_t +{ +public: + ttl74153_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ttl74153_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TTL74153; + #endif diff --git a/src/emu/machine/adc083x.c b/src/emu/machine/adc083x.c index 5a12f22bca0..b5bb54726ce 100644 --- a/src/emu/machine/adc083x.c +++ b/src/emu/machine/adc083x.c @@ -75,7 +75,7 @@ INLINE adc0831_state *get_safe_token( device_t *device ) { assert( device != NULL ); assert( ( device->type() == ADC0831 ) || ( device->type() == ADC0832 ) || ( device->type() == ADC0834 ) || ( device->type() == ADC0838 ) ); - return (adc0831_state *) downcast<legacy_device_base *>(device)->token(); + return (adc0831_state *) downcast<adc0831_device *>(device)->token(); } INLINE const adc083x_interface *get_interface( device_t *device ) @@ -550,7 +550,69 @@ DEVICE_GET_INFO(adc0838) } } -DEFINE_LEGACY_DEVICE(ADC0831, adc0831); -DEFINE_LEGACY_DEVICE(ADC0832, adc0832); -DEFINE_LEGACY_DEVICE(ADC0834, adc0834); -DEFINE_LEGACY_DEVICE(ADC0838, adc0838); +const device_type ADC0831 = &device_creator<adc0831_device>; + +adc0831_device::adc0831_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ADC0831, "A/D Converters 0831", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(adc0831_state)); +} +adc0831_device::adc0831_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(adc0831_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void adc0831_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void adc0831_device::device_start() +{ + DEVICE_START_NAME( adc0831 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void adc0831_device::device_reset() +{ + DEVICE_RESET_NAME( adc0831 )(this); +} + + +const device_type ADC0832 = &device_creator<adc0832_device>; + +adc0832_device::adc0832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : adc0831_device(mconfig, ADC0832, "A/D Converters 0832", tag, owner, clock) +{ +} + + +const device_type ADC0834 = &device_creator<adc0834_device>; + +adc0834_device::adc0834_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : adc0831_device(mconfig, ADC0834, "A/D Converters 0834", tag, owner, clock) +{ +} + + +const device_type ADC0838 = &device_creator<adc0838_device>; + +adc0838_device::adc0838_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : adc0831_device(mconfig, ADC0838, "A/D Converters 0838", tag, owner, clock) +{ +} + + diff --git a/src/emu/machine/adc083x.h b/src/emu/machine/adc083x.h index 6528e695c76..59bce8f8c9c 100644 --- a/src/emu/machine/adc083x.h +++ b/src/emu/machine/adc083x.h @@ -32,10 +32,51 @@ MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(ADC0831, adc0831); -DECLARE_LEGACY_DEVICE(ADC0832, adc0832); -DECLARE_LEGACY_DEVICE(ADC0834, adc0834); -DECLARE_LEGACY_DEVICE(ADC0838, adc0838); +class adc0831_device : public device_t +{ +public: + adc0831_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + adc0831_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~adc0831_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type ADC0831; + +class adc0832_device : public adc0831_device +{ +public: + adc0832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type ADC0832; + +class adc0834_device : public adc0831_device +{ +public: + adc0834_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type ADC0834; + +class adc0838_device : public adc0831_device +{ +public: + adc0838_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type ADC0838; + #define MCFG_ADC0831_ADD(_tag, _config) \ MCFG_DEVICE_ADD(_tag, ADC0831, 0) \ diff --git a/src/emu/machine/adc1038.c b/src/emu/machine/adc1038.c index 286ca194b1a..0628486bb54 100644 --- a/src/emu/machine/adc1038.c +++ b/src/emu/machine/adc1038.c @@ -38,7 +38,7 @@ INLINE adc1038_state *adc1038_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == ADC1038); - return (adc1038_state *)downcast<legacy_device_base *>(device)->token(); + return (adc1038_state *)downcast<adc1038_device *>(device)->token(); } INLINE const adc1038_interface *adc1038_get_interface( device_t *device ) @@ -179,4 +179,40 @@ DEVICE_GET_INFO(adc1038) } } -DEFINE_LEGACY_DEVICE(ADC1038, adc1038); +const device_type ADC1038 = &device_creator<adc1038_device>; + +adc1038_device::adc1038_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ADC1038, "A/D Converters 1038", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(adc1038_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void adc1038_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void adc1038_device::device_start() +{ + DEVICE_START_NAME( adc1038 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void adc1038_device::device_reset() +{ + DEVICE_RESET_NAME( adc1038 )(this); +} + + diff --git a/src/emu/machine/adc1038.h b/src/emu/machine/adc1038.h index 47dcee0d862..a154af090e9 100644 --- a/src/emu/machine/adc1038.h +++ b/src/emu/machine/adc1038.h @@ -31,7 +31,26 @@ struct _adc1038_interface MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(ADC1038, adc1038); +class adc1038_device : public device_t +{ +public: + adc1038_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~adc1038_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type ADC1038; + #define MCFG_ADC1038_ADD(_tag, _config) \ MCFG_DEVICE_ADD(_tag, ADC1038, 0) \ diff --git a/src/emu/machine/adc1213x.c b/src/emu/machine/adc1213x.c index 49ffa1ca5f4..cf833f471dc 100644 --- a/src/emu/machine/adc1213x.c +++ b/src/emu/machine/adc1213x.c @@ -58,7 +58,7 @@ INLINE adc12138_state *get_safe_token(device_t *device) { assert(device != NULL); assert((device->type() == ADC12130) || (device->type() == ADC12132) || (device->type() == ADC12138)); - return (adc12138_state *)downcast<legacy_device_base *>(device)->token(); + return (adc12138_state *)downcast<adc12138_device *>(device)->token(); } INLINE const adc12138_interface *get_interface(device_t *device) @@ -390,6 +390,61 @@ DEVICE_GET_INFO(adc12132) } } -DEFINE_LEGACY_DEVICE(ADC12130, adc12130); -DEFINE_LEGACY_DEVICE(ADC12132, adc12132); -DEFINE_LEGACY_DEVICE(ADC12138, adc12138); +const device_type ADC12130 = &device_creator<adc12130_device>; + +adc12130_device::adc12130_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : adc12138_device(mconfig, ADC12130, "A/D Converter 12130", tag, owner, clock) +{ +} + + +const device_type ADC12132 = &device_creator<adc12132_device>; + +adc12132_device::adc12132_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : adc12138_device(mconfig, ADC12132, "A/D Converter 12132", tag, owner, clock) +{ +} + + +const device_type ADC12138 = &device_creator<adc12138_device>; + +adc12138_device::adc12138_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ADC12138, "A/D Converter 12138", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(adc12138_state)); +} +adc12138_device::adc12138_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(adc12138_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void adc12138_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void adc12138_device::device_start() +{ + DEVICE_START_NAME( adc12138 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void adc12138_device::device_reset() +{ + DEVICE_RESET_NAME( adc12138 )(this); +} + + diff --git a/src/emu/machine/adc1213x.h b/src/emu/machine/adc1213x.h index 4bb45bb2e46..538ed54510f 100644 --- a/src/emu/machine/adc1213x.h +++ b/src/emu/machine/adc1213x.h @@ -17,9 +17,42 @@ MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(ADC12130, adc12130); -DECLARE_LEGACY_DEVICE(ADC12132, adc12132); -DECLARE_LEGACY_DEVICE(ADC12138, adc12138); +class adc12138_device : public device_t +{ +public: + adc12138_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + adc12138_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~adc12138_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type ADC12138; + +class adc12130_device : public adc12138_device +{ +public: + adc12130_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type ADC12130; + +class adc12132_device : public adc12138_device +{ +public: + adc12132_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type ADC12132; #define MCFG_ADC12130_ADD(_tag, _config) \ MCFG_DEVICE_ADD(_tag, ADC12130, 0) \ diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index 96ef0e76398..284b95df744 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -197,7 +197,7 @@ INLINE ide_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == IDE_CONTROLLER); - return (ide_state *)downcast<legacy_device_base *>(device)->token(); + return (ide_state *)downcast<ide_controller_device *>(device)->token(); } @@ -1968,7 +1968,43 @@ DEVICE_GET_INFO( ide_controller ) } -DEFINE_LEGACY_DEVICE(IDE_CONTROLLER, ide_controller); +const device_type IDE_CONTROLLER = &device_creator<ide_controller_device>; + +ide_controller_device::ide_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, IDE_CONTROLLER, "IDE Controller", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ide_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ide_controller_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ide_controller_device::device_start() +{ + DEVICE_START_NAME( ide_controller )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ide_controller_device::device_reset() +{ + DEVICE_RESET_NAME( ide_controller )(this); +} + + //************************************************************************** // IDE SLOT DEVICE diff --git a/src/emu/machine/idectrl.h b/src/emu/machine/idectrl.h index 85f46653874..61af4c81648 100644 --- a/src/emu/machine/idectrl.h +++ b/src/emu/machine/idectrl.h @@ -186,7 +186,26 @@ WRITE16_DEVICE_HANDLER( ide_controller16_w ); /* ----- device interface ----- */ -DECLARE_LEGACY_DEVICE(IDE_CONTROLLER, ide_controller); +class ide_controller_device : public device_t +{ +public: + ide_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ide_controller_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type IDE_CONTROLLER; + #endif /* __IDECTRL_H__ */ diff --git a/src/emu/machine/k053252.c b/src/emu/machine/k053252.c index 76437b56eba..5896f133244 100644 --- a/src/emu/machine/k053252.c +++ b/src/emu/machine/k053252.c @@ -82,7 +82,7 @@ INLINE k053252_state *k053252_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K053252); - return (k053252_state *)downcast<legacy_device_base *>(device)->token(); + return (k053252_state *)downcast<k053252_device *>(device)->token(); } INLINE const k053252_interface *k053252_get_interface( device_t *device ) @@ -252,5 +252,41 @@ DEVICE_GET_INFO( k053252 ) } } -DEFINE_LEGACY_DEVICE(K053252, k053252); +const device_type K053252 = &device_creator<k053252_device>; + +k053252_device::k053252_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K053252, "Konami 053252", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k053252_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k053252_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k053252_device::device_start() +{ + DEVICE_START_NAME( k053252 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k053252_device::device_reset() +{ + DEVICE_RESET_NAME( k053252 )(this); +} + + diff --git a/src/emu/machine/k053252.h b/src/emu/machine/k053252.h index c6e3ffb1e1f..1c6d526dc8e 100644 --- a/src/emu/machine/k053252.h +++ b/src/emu/machine/k053252.h @@ -7,7 +7,26 @@ #include "devlegcy.h" -DECLARE_LEGACY_DEVICE(K053252, k053252); +class k053252_device : public device_t +{ +public: + k053252_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k053252_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K053252; + diff --git a/src/emu/machine/latch8.c b/src/emu/machine/latch8.c index 84dd5b55e5e..cc260d14199 100644 --- a/src/emu/machine/latch8.c +++ b/src/emu/machine/latch8.c @@ -26,7 +26,7 @@ struct _latch8_t INLINE latch8_t *get_safe_token(device_t *device) { assert( device != NULL ); assert( device->type() == LATCH8 ); - return ( latch8_t * ) downcast<legacy_device_base *>(device)->token(); + return ( latch8_t * ) downcast<latch8_device *>(device)->token(); } static void update(device_t *device, UINT8 new_val, UINT8 mask) @@ -253,10 +253,39 @@ DEVICE_GET_INFO( latch8 ) } } -latch8_device::latch8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock) - : legacy_device_base(mconfig, type, tag, owner, clock, DEVICE_GET_INFO_NAME(latch8)) +const device_type LATCH8 = &device_creator<latch8_device>; + +latch8_device::latch8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, LATCH8, "8 bit latch", tag, owner, clock) { + m_token = global_alloc_array_clear(UINT8, sizeof(latch8_t)); memset((void*)&m_inline_config,0,sizeof(m_inline_config)); } -const device_type LATCH8 = &legacy_device_creator<latch8_device>; +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void latch8_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void latch8_device::device_start() +{ + DEVICE_START_NAME( latch8 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void latch8_device::device_reset() +{ + DEVICE_RESET_NAME( latch8 )(this); +} diff --git a/src/emu/machine/latch8.h b/src/emu/machine/latch8.h index 9a48a1a8232..7f4f0aa11cb 100644 --- a/src/emu/machine/latch8.h +++ b/src/emu/machine/latch8.h @@ -43,32 +43,40 @@ struct _latch8_config latch8_devread devread[8]; }; - -DEVICE_GET_INFO( latch8 ); - -class latch8_device : public legacy_device_base +class latch8_device : public device_t { public: - latch8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock); - - latch8_config m_inline_config; - - void set_maskout(UINT32 maskout) { m_inline_config.maskout = maskout; } - void set_xorvalue(UINT32 xorvalue) { m_inline_config.xorvalue = xorvalue; } - void set_nosync(UINT32 nosync) { m_inline_config.nosync = nosync; } - - void set_discrete_node(const char *dev_tag, int bit, UINT32 node) { m_inline_config.node_device[bit] = dev_tag; m_inline_config.node_map[bit] = node; } - void set_devread(int bit, const char *tag, read8_device_func handler, int from_bit) - { - m_inline_config.devread[bit].from_bit = from_bit; - m_inline_config.devread[bit].tag = tag; - m_inline_config.devread[bit].devread_handler = handler; - } - void set_read(int bit, read8_space_func handler, int from_bit) - { - m_inline_config.devread[bit].from_bit = from_bit; - m_inline_config.devread[bit].read_handler = handler; - } + latch8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~latch8_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } + latch8_config m_inline_config; + + void set_maskout(UINT32 maskout) { m_inline_config.maskout = maskout; } + void set_xorvalue(UINT32 xorvalue) { m_inline_config.xorvalue = xorvalue; } + void set_nosync(UINT32 nosync) { m_inline_config.nosync = nosync; } + + void set_discrete_node(const char *dev_tag, int bit, UINT32 node) { m_inline_config.node_device[bit] = dev_tag; m_inline_config.node_map[bit] = node; } + void set_devread(int bit, const char *tag, read8_device_func handler, int from_bit) + { + m_inline_config.devread[bit].from_bit = from_bit; + m_inline_config.devread[bit].tag = tag; + m_inline_config.devread[bit].devread_handler = handler; + } + void set_read(int bit, read8_space_func handler, int from_bit) + { + m_inline_config.devread[bit].from_bit = from_bit; + m_inline_config.devread[bit].read_handler = handler; + } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; }; extern const device_type LATCH8; diff --git a/src/emu/machine/mb14241.c b/src/emu/machine/mb14241.c index 1cac968bbb4..049e12cb9ed 100644 --- a/src/emu/machine/mb14241.c +++ b/src/emu/machine/mb14241.c @@ -23,7 +23,7 @@ INLINE mb14241_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == MB14241); - return (mb14241_state *)downcast<legacy_device_base *>(device)->token(); + return (mb14241_state *)downcast<mb14241_device *>(device)->token(); } /***************************************************************************** @@ -82,4 +82,40 @@ DEVICE_GET_INFO(mb14241) } } -DEFINE_LEGACY_DEVICE(MB14241, mb14241); +const device_type MB14241 = &device_creator<mb14241_device>; + +mb14241_device::mb14241_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MB14241, "MB14241", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mb14241_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mb14241_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mb14241_device::device_start() +{ + DEVICE_START_NAME( mb14241 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mb14241_device::device_reset() +{ + DEVICE_RESET_NAME( mb14241 )(this); +} + + diff --git a/src/emu/machine/mb14241.h b/src/emu/machine/mb14241.h index 120054591a8..bd39245a5c1 100644 --- a/src/emu/machine/mb14241.h +++ b/src/emu/machine/mb14241.h @@ -10,7 +10,26 @@ #include "devlegcy.h" -DECLARE_LEGACY_DEVICE(MB14241, mb14241); +class mb14241_device : public device_t +{ +public: + mb14241_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mb14241_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MB14241; + /*************************************************************************** DEVICE CONFIGURATION MACROS diff --git a/src/emu/machine/mb87078.c b/src/emu/machine/mb87078.c index a3a4290c6de..47fa5437600 100644 --- a/src/emu/machine/mb87078.c +++ b/src/emu/machine/mb87078.c @@ -116,7 +116,7 @@ INLINE mb87078_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == MB87078); - return (mb87078_state *)downcast<legacy_device_base *>(device)->token(); + return (mb87078_state *)downcast<mb87078_device *>(device)->token(); } INLINE const mb87078_interface *get_interface( device_t *device ) @@ -280,4 +280,40 @@ DEVICE_GET_INFO(mb87078) } } -DEFINE_LEGACY_DEVICE(MB87078, mb87078); +const device_type MB87078 = &device_creator<mb87078_device>; + +mb87078_device::mb87078_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MB87078, "Fujitsu MB87078", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mb87078_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mb87078_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mb87078_device::device_start() +{ + DEVICE_START_NAME( mb87078 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mb87078_device::device_reset() +{ + DEVICE_RESET_NAME( mb87078 )(this); +} + + diff --git a/src/emu/machine/mb87078.h b/src/emu/machine/mb87078.h index 7f62b44c06e..8b86a5189da 100644 --- a/src/emu/machine/mb87078.h +++ b/src/emu/machine/mb87078.h @@ -24,7 +24,26 @@ struct _mb87078_interface mb87078_gain_changed_cb gain_changed_cb; }; -DECLARE_LEGACY_DEVICE(MB87078, mb87078); +class mb87078_device : public device_t +{ +public: + mb87078_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mb87078_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MB87078; + /*************************************************************************** DEVICE CONFIGURATION MACROS diff --git a/src/emu/machine/pd4990a.c b/src/emu/machine/pd4990a.c index 726bda55b28..24d2b61e1da 100644 --- a/src/emu/machine/pd4990a.c +++ b/src/emu/machine/pd4990a.c @@ -86,7 +86,7 @@ INLINE upd4990a_state *get_safe_token(device_t *device) { assert(device != NULL); assert((device->type() == UPD4990A)); - return (upd4990a_state *)downcast<legacy_device_base *>(device)->token(); + return (upd4990a_state *)downcast<upd4990a_device *>(device)->token(); } INLINE UINT8 convert_to_bcd(int val) @@ -539,4 +539,40 @@ DEVICE_GET_INFO(upd4990a) } } -DEFINE_LEGACY_DEVICE(UPD4990A, upd4990a); +const device_type UPD4990A = &device_creator<upd4990a_device>; + +upd4990a_device::upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD4990A, "NEC uPD4990A", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(upd4990a_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void upd4990a_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd4990a_device::device_start() +{ + DEVICE_START_NAME( upd4990a )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void upd4990a_device::device_reset() +{ + DEVICE_RESET_NAME( upd4990a )(this); +} + + diff --git a/src/emu/machine/pd4990a.h b/src/emu/machine/pd4990a.h index 4dd0c1b4f0a..3772546835b 100644 --- a/src/emu/machine/pd4990a.h +++ b/src/emu/machine/pd4990a.h @@ -16,7 +16,26 @@ MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(UPD4990A, upd4990a); +class upd4990a_device : public device_t +{ +public: + upd4990a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~upd4990a_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type UPD4990A; + #define MCFG_UPD4990A_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, UPD4990A, 0) diff --git a/src/emu/machine/pic8259.c b/src/emu/machine/pic8259.c index ef7728d681d..ff663534405 100644 --- a/src/emu/machine/pic8259.c +++ b/src/emu/machine/pic8259.c @@ -77,7 +77,7 @@ struct pic8259 INLINE pic8259_t *get_safe_token(device_t *device) { assert( device != NULL ); assert( device->type() == PIC8259 ); - return ( pic8259_t *) downcast<legacy_device_base *>(device)->token(); + return ( pic8259_t *) downcast<pic8259_device *>(device)->token(); } @@ -469,4 +469,40 @@ DEVICE_GET_INFO( pic8259 ) { } -DEFINE_LEGACY_DEVICE(PIC8259, pic8259); +const device_type PIC8259 = &device_creator<pic8259_device>; + +pic8259_device::pic8259_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PIC8259, "Intel PIC8259", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pic8259_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pic8259_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pic8259_device::device_start() +{ + DEVICE_START_NAME( pic8259 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pic8259_device::device_reset() +{ + DEVICE_RESET_NAME( pic8259 )(this); +} + + diff --git a/src/emu/machine/pic8259.h b/src/emu/machine/pic8259.h index 230074880ec..99f24b62fed 100644 --- a/src/emu/machine/pic8259.h +++ b/src/emu/machine/pic8259.h @@ -28,7 +28,26 @@ #include "devlegcy.h" #include "devcb.h" -DECLARE_LEGACY_DEVICE(PIC8259, pic8259); +class pic8259_device : public device_t +{ +public: + pic8259_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~pic8259_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type PIC8259; + /*************************************************************************** TYPE DEFINITIONS diff --git a/src/emu/machine/pit8253.c b/src/emu/machine/pit8253.c index 4d2c40aadfc..8274f5c5870 100644 --- a/src/emu/machine/pit8253.c +++ b/src/emu/machine/pit8253.c @@ -107,7 +107,7 @@ INLINE pit8253_t *get_safe_token(device_t *device) assert(device != NULL); assert((device->type() == PIT8253) || (device->type() == PIT8254)); - return (pit8253_t *) downcast<legacy_device_base *>(device)->token(); + return (pit8253_t *) downcast<pit8253_device *>(device)->token(); } @@ -1188,5 +1188,62 @@ DEVICE_GET_INFO( pit8254 ) { } -DEFINE_LEGACY_DEVICE(PIT8253, pit8253); -DEFINE_LEGACY_DEVICE(PIT8254, pit8254); +const device_type PIT8253 = &device_creator<pit8253_device>; + +pit8253_device::pit8253_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PIT8253, "Intel PIT8253", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pit8253_t)); +} +pit8253_device::pit8253_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pit8253_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pit8253_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pit8253_device::device_start() +{ + DEVICE_START_NAME( pit8253 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pit8253_device::device_reset() +{ + DEVICE_RESET_NAME( pit8253 )(this); +} + + +const device_type PIT8254 = &device_creator<pit8254_device>; + +pit8254_device::pit8254_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : pit8253_device(mconfig, PIT8254, "Intel PIT8254", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pit8254_device::device_start() +{ + DEVICE_START_NAME( pit8254 )(this); +} + + diff --git a/src/emu/machine/pit8253.h b/src/emu/machine/pit8253.h index 32e05f62498..c4af119903b 100644 --- a/src/emu/machine/pit8253.h +++ b/src/emu/machine/pit8253.h @@ -37,8 +37,38 @@ struct pit8253_config } timer[3]; }; -DECLARE_LEGACY_DEVICE(PIT8253, pit8253); -DECLARE_LEGACY_DEVICE(PIT8254, pit8254); +class pit8253_device : public device_t +{ +public: + pit8253_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + pit8253_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~pit8253_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type PIT8253; + +class pit8254_device : public pit8253_device +{ +public: + pit8254_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type PIT8254; + /*************************************************************************** diff --git a/src/emu/machine/rp5h01.c b/src/emu/machine/rp5h01.c index bf0f21acb05..69a376431e3 100644 --- a/src/emu/machine/rp5h01.c +++ b/src/emu/machine/rp5h01.c @@ -48,7 +48,7 @@ INLINE rp5h01_state *get_safe_token(device_t *device) { assert(device != NULL); assert((device->type() == RP5H01)); - return (rp5h01_state *)downcast<legacy_device_base *>(device)->token(); + return (rp5h01_state *)downcast<rp5h01_device *>(device)->token(); } /*************************************************************************** @@ -240,4 +240,40 @@ DEVICE_GET_INFO(rp5h01) } } -DEFINE_LEGACY_DEVICE(RP5H01, rp5h01); +const device_type RP5H01 = &device_creator<rp5h01_device>; + +rp5h01_device::rp5h01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, RP5H01, "RP5H01", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(rp5h01_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void rp5h01_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void rp5h01_device::device_start() +{ + DEVICE_START_NAME( rp5h01 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void rp5h01_device::device_reset() +{ + DEVICE_RESET_NAME( rp5h01 )(this); +} + + diff --git a/src/emu/machine/rp5h01.h b/src/emu/machine/rp5h01.h index 78bb2426147..5e798ed780e 100644 --- a/src/emu/machine/rp5h01.h +++ b/src/emu/machine/rp5h01.h @@ -14,7 +14,26 @@ MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(RP5H01, rp5h01); +class rp5h01_device : public device_t +{ +public: + rp5h01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~rp5h01_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type RP5H01; + #define MCFG_RP5H01_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, RP5H01, 0) diff --git a/src/emu/machine/smc91c9x.c b/src/emu/machine/smc91c9x.c index 7bcf7ac0db8..274fe27dfa0 100644 --- a/src/emu/machine/smc91c9x.c +++ b/src/emu/machine/smc91c9x.c @@ -156,7 +156,7 @@ INLINE smc91c9x_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == SMC91C94 || device->type() == SMC91C96); - return (smc91c9x_state *)downcast<legacy_device_base *>(device)->token(); + return (smc91c9x_state *)downcast<smc91c9x_device *>(device)->token(); } @@ -628,7 +628,55 @@ DEVICE_GET_INFO( smc91c96 ) } } +smc91c9x_device::smc91c9x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(smc91c9x_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void smc91c9x_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void smc91c9x_device::device_start() +{ + DEVICE_START_NAME( smc91c9x )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void smc91c9x_device::device_reset() +{ + DEVICE_RESET_NAME( smc91c9x )(this); +} + + +const device_type SMC91C94 = &device_creator<smc91c94_device>; + +smc91c94_device::smc91c94_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : smc91c9x_device(mconfig, SMC91C94, "SMC91C94", tag, owner, clock) +{ +} + + +const device_type SMC91C96 = &device_creator<smc91c96_device>; + +smc91c96_device::smc91c96_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : smc91c9x_device(mconfig, SMC91C96, "SMC91C96", tag, owner, clock) +{ +} + -DEFINE_LEGACY_DEVICE(SMC91C94, smc91c94); -DEFINE_LEGACY_DEVICE(SMC91C96, smc91c96); diff --git a/src/emu/machine/smc91c9x.h b/src/emu/machine/smc91c9x.h index 29a590a3960..9f8161f32b1 100644 --- a/src/emu/machine/smc91c9x.h +++ b/src/emu/machine/smc91c9x.h @@ -50,8 +50,40 @@ WRITE16_DEVICE_HANDLER( smc91c9x_w ); /* ----- device interface ----- */ +class smc91c9x_device : public device_t +{ +public: + smc91c9x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~smc91c9x_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + + +class smc91c94_device : public smc91c9x_device +{ +public: + smc91c94_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type SMC91C94; + +class smc91c96_device : public smc91c9x_device +{ +public: + smc91c96_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type SMC91C96; -DECLARE_LEGACY_DEVICE(SMC91C94, smc91c94); -DECLARE_LEGACY_DEVICE(SMC91C96, smc91c96); #endif diff --git a/src/emu/machine/tms6100.c b/src/emu/machine/tms6100.c index 75f8a8ee113..2ea90c02f6e 100644 --- a/src/emu/machine/tms6100.c +++ b/src/emu/machine/tms6100.c @@ -107,7 +107,7 @@ INLINE tms6100_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == TMS6100 || device->type() == M58819); - return (tms6100_state *)downcast<legacy_device_base *>(device)->token(); + return (tms6100_state *)downcast<tms6100_device *>(device)->token(); } /********************************************************************************************** @@ -288,5 +288,62 @@ DEVICE_GET_INFO(m58819) } } -DEFINE_LEGACY_DEVICE(TMS6100, tms6100); -DEFINE_LEGACY_DEVICE(M58819, m58819); +const device_type TMS6100 = &device_creator<tms6100_device>; + +tms6100_device::tms6100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TMS6100, "TMS6100", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms6100_state)); +} +tms6100_device::tms6100_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms6100_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tms6100_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms6100_device::device_start() +{ + DEVICE_START_NAME( tms6100 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tms6100_device::device_reset() +{ + DEVICE_RESET_NAME( tms6100 )(this); +} + + +const device_type M58819 = &device_creator<m58819_device>; + +m58819_device::m58819_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms6100_device(mconfig, M58819, "M58819", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void m58819_device::device_start() +{ + DEVICE_START_NAME( m58819 )(this); +} + + diff --git a/src/emu/machine/tms6100.h b/src/emu/machine/tms6100.h index bd6a1919d20..512446b8e62 100644 --- a/src/emu/machine/tms6100.h +++ b/src/emu/machine/tms6100.h @@ -14,7 +14,37 @@ WRITE8_DEVICE_HANDLER( tms6100_addr_w ); READ_LINE_DEVICE_HANDLER( tms6100_data_r ); -DECLARE_LEGACY_DEVICE(TMS6100, tms6100); -DECLARE_LEGACY_DEVICE(M58819, m58819); +class tms6100_device : public device_t +{ +public: + tms6100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + tms6100_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~tms6100_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TMS6100; + +class m58819_device : public tms6100_device +{ +public: + m58819_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type M58819; + #endif /* __TMS6100_H__ */ diff --git a/src/emu/machine/upd4701.c b/src/emu/machine/upd4701.c index cef9a7d2e10..5d120bc6600 100644 --- a/src/emu/machine/upd4701.c +++ b/src/emu/machine/upd4701.c @@ -49,7 +49,7 @@ INLINE upd4701_state *get_safe_token(device_t *device) { assert(device != NULL); assert((device->type() == UPD4701)); - return (upd4701_state *)downcast<legacy_device_base *>(device)->token(); + return (upd4701_state *)downcast<upd4701_device *>(device)->token(); } @@ -319,4 +319,40 @@ DEVICE_GET_INFO(upd4701) } } -DEFINE_LEGACY_DEVICE(UPD4701, upd4701); +const device_type UPD4701 = &device_creator<upd4701_device>; + +upd4701_device::upd4701_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD4701, "NEC uPD4701 Encoder", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(upd4701_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void upd4701_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd4701_device::device_start() +{ + DEVICE_START_NAME( upd4701 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void upd4701_device::device_reset() +{ + DEVICE_RESET_NAME( upd4701 )(this); +} + + diff --git a/src/emu/machine/upd4701.h b/src/emu/machine/upd4701.h index fd4059fd983..e4a8fd519d5 100644 --- a/src/emu/machine/upd4701.h +++ b/src/emu/machine/upd4701.h @@ -15,7 +15,26 @@ MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(UPD4701, upd4701); +class upd4701_device : public device_t +{ +public: + upd4701_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~upd4701_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type UPD4701; + #define MCFG_UPD4701_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, UPD4701, 0) diff --git a/src/emu/machine/wd17xx.c b/src/emu/machine/wd17xx.c index 7cdb08437a2..6373628d3fc 100644 --- a/src/emu/machine/wd17xx.c +++ b/src/emu/machine/wd17xx.c @@ -411,7 +411,7 @@ INLINE wd1770_state *get_safe_token(device_t *device) device->type() == WD1770 || device->type() == WD1772 || device->type() == WD1773 || device->type() == MB8866 || device->type() == MB8876 || device->type() == MB8877); - return (wd1770_state *)downcast<legacy_device_base *>(device)->token(); + return (wd1770_state *)downcast<wd1770_device *>(device)->token(); } @@ -2328,27 +2328,238 @@ DEVICE_GET_INFO(mb8877) } } -DEFINE_LEGACY_DEVICE(FD1771, fd1771); -DEFINE_LEGACY_DEVICE(FD1781, fd1781); -DEFINE_LEGACY_DEVICE(FD1791, fd1791); -DEFINE_LEGACY_DEVICE(FD1792, fd1792); -DEFINE_LEGACY_DEVICE(FD1793, fd1793); -DEFINE_LEGACY_DEVICE(FD1794, fd1794); -DEFINE_LEGACY_DEVICE(FD1795, fd1795); -DEFINE_LEGACY_DEVICE(FD1797, fd1797); -DEFINE_LEGACY_DEVICE(FD1761, fd1761); -DEFINE_LEGACY_DEVICE(FD1762, fd1762); -DEFINE_LEGACY_DEVICE(FD1763, fd1763); -DEFINE_LEGACY_DEVICE(FD1764, fd1764); -DEFINE_LEGACY_DEVICE(FD1765, fd1765); -DEFINE_LEGACY_DEVICE(FD1767, fd1767); -DEFINE_LEGACY_DEVICE(WD2791, wd2791); -DEFINE_LEGACY_DEVICE(WD2793, wd2793); -DEFINE_LEGACY_DEVICE(WD2795, wd2795); -DEFINE_LEGACY_DEVICE(WD2797, wd2797); -DEFINE_LEGACY_DEVICE(WD1770, wd1770); -DEFINE_LEGACY_DEVICE(WD1772, wd1772); -DEFINE_LEGACY_DEVICE(WD1773, wd1773); -DEFINE_LEGACY_DEVICE(MB8866, mb8866); -DEFINE_LEGACY_DEVICE(MB8876, mb8876); -DEFINE_LEGACY_DEVICE(MB8877, mb8877); +const device_type FD1771 = &device_creator<fd1771_device>; + +fd1771_device::fd1771_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1771, "FD1771", tag, owner, clock) +{ +} + + +const device_type FD1781 = &device_creator<fd1781_device>; + +fd1781_device::fd1781_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1781, "FD1781", tag, owner, clock) +{ +} + + +const device_type FD1791 = &device_creator<fd1791_device>; + +fd1791_device::fd1791_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1791, "FD1791", tag, owner, clock) +{ +} + + +const device_type FD1792 = &device_creator<fd1792_device>; + +fd1792_device::fd1792_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1792, "FD1792", tag, owner, clock) +{ +} + + +const device_type FD1793 = &device_creator<fd1793_device>; + +fd1793_device::fd1793_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1793, "FD1793", tag, owner, clock) +{ +} + + +const device_type FD1794 = &device_creator<fd1794_device>; + +fd1794_device::fd1794_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1794, "FD1794", tag, owner, clock) +{ +} + + +const device_type FD1795 = &device_creator<fd1795_device>; + +fd1795_device::fd1795_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1795, "FD1795", tag, owner, clock) +{ +} + + +const device_type FD1797 = &device_creator<fd1797_device>; + +fd1797_device::fd1797_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1797, "FD1797", tag, owner, clock) +{ +} + + +const device_type FD1761 = &device_creator<fd1761_device>; + +fd1761_device::fd1761_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1761, "FD1761", tag, owner, clock) +{ +} + + +const device_type FD1762 = &device_creator<fd1762_device>; + +fd1762_device::fd1762_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1762, "FD1762", tag, owner, clock) +{ +} + + +const device_type FD1763 = &device_creator<fd1763_device>; + +fd1763_device::fd1763_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1763, "FD1763", tag, owner, clock) +{ +} + + +const device_type FD1764 = &device_creator<fd1764_device>; + +fd1764_device::fd1764_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1764, "FD1764", tag, owner, clock) +{ +} + + +const device_type FD1765 = &device_creator<fd1765_device>; + +fd1765_device::fd1765_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1765, "FD1765", tag, owner, clock) +{ +} + + +const device_type FD1767 = &device_creator<fd1767_device>; + +fd1767_device::fd1767_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, FD1767, "FD1767", tag, owner, clock) +{ +} + + +const device_type WD2791 = &device_creator<wd2791_device>; + +wd2791_device::wd2791_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, WD2791, "WD2791", tag, owner, clock) +{ +} + + +const device_type WD2793 = &device_creator<wd2793_device>; + +wd2793_device::wd2793_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, WD2793, "WD2793", tag, owner, clock) +{ +} + + +const device_type WD2795 = &device_creator<wd2795_device>; + +wd2795_device::wd2795_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, WD2795, "WD2795", tag, owner, clock) +{ +} + + +const device_type WD2797 = &device_creator<wd2797_device>; + +wd2797_device::wd2797_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, WD2797, "WD2797", tag, owner, clock) +{ +} + + +const device_type WD1770 = &device_creator<wd1770_device>; + +wd1770_device::wd1770_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, WD1770, "WD1770", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(wd1770_state)); +} +wd1770_device::wd1770_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(wd1770_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void wd1770_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void wd1770_device::device_start() +{ + DEVICE_START_NAME( wd1770 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void wd1770_device::device_reset() +{ + DEVICE_RESET_NAME( wd1770 )(this); +} + + +const device_type WD1772 = &device_creator<wd1772_device>; + +wd1772_device::wd1772_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, WD1772, "WD1772", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void wd1772_device::device_start() +{ + DEVICE_START_NAME( wd1772 )(this); +} + + +const device_type WD1773 = &device_creator<wd1773_device>; + +wd1773_device::wd1773_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, WD1773, "WD1773", tag, owner, clock) +{ +} + + +const device_type MB8866 = &device_creator<mb8866_device>; + +mb8866_device::mb8866_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, MB8866, "MB8866", tag, owner, clock) +{ +} + + +const device_type MB8876 = &device_creator<mb8876_device>; + +mb8876_device::mb8876_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, MB8876, "MB8876", tag, owner, clock) +{ +} + + +const device_type MB8877 = &device_creator<mb8877_device>; + +mb8877_device::mb8877_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : wd1770_device(mconfig, MB8877, "MB8877", tag, owner, clock) +{ +} + + diff --git a/src/emu/machine/wd17xx.h b/src/emu/machine/wd17xx.h index 4a24afe6b10..bc7add9f89d 100644 --- a/src/emu/machine/wd17xx.h +++ b/src/emu/machine/wd17xx.h @@ -17,30 +17,214 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(FD1771, fd1771); -DECLARE_LEGACY_DEVICE(FD1781, fd1781); -DECLARE_LEGACY_DEVICE(FD1791, fd1791); -DECLARE_LEGACY_DEVICE(FD1792, fd1792); -DECLARE_LEGACY_DEVICE(FD1793, fd1793); -DECLARE_LEGACY_DEVICE(FD1794, fd1794); -DECLARE_LEGACY_DEVICE(FD1795, fd1795); -DECLARE_LEGACY_DEVICE(FD1797, fd1797); -DECLARE_LEGACY_DEVICE(FD1761, fd1761); -DECLARE_LEGACY_DEVICE(FD1762, fd1762); -DECLARE_LEGACY_DEVICE(FD1763, fd1763); -DECLARE_LEGACY_DEVICE(FD1764, fd1764); -DECLARE_LEGACY_DEVICE(FD1765, fd1765); -DECLARE_LEGACY_DEVICE(FD1767, fd1767); -DECLARE_LEGACY_DEVICE(WD2791, wd2791); -DECLARE_LEGACY_DEVICE(WD2793, wd2793); -DECLARE_LEGACY_DEVICE(WD2795, wd2795); -DECLARE_LEGACY_DEVICE(WD2797, wd2797); -DECLARE_LEGACY_DEVICE(WD1770, wd1770); -DECLARE_LEGACY_DEVICE(WD1772, wd1772); -DECLARE_LEGACY_DEVICE(WD1773, wd1773); -DECLARE_LEGACY_DEVICE(MB8866, mb8866); -DECLARE_LEGACY_DEVICE(MB8876, mb8876); -DECLARE_LEGACY_DEVICE(MB8877, mb8877); +class wd1770_device : public device_t +{ +public: + wd1770_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + wd1770_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~wd1770_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type WD1770; + +class fd1771_device : public wd1770_device +{ +public: + fd1771_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1771; + +class fd1781_device : public wd1770_device +{ +public: + fd1781_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1781; + +class fd1791_device : public wd1770_device +{ +public: + fd1791_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1791; + +class fd1792_device : public wd1770_device +{ +public: + fd1792_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1792; + +class fd1793_device : public wd1770_device +{ +public: + fd1793_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1793; + +class fd1794_device : public wd1770_device +{ +public: + fd1794_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1794; + +class fd1795_device : public wd1770_device +{ +public: + fd1795_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1795; + +class fd1797_device : public wd1770_device +{ +public: + fd1797_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1797; + +class fd1761_device : public wd1770_device +{ +public: + fd1761_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1761; + +class fd1762_device : public wd1770_device +{ +public: + fd1762_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1762; + +class fd1763_device : public wd1770_device +{ +public: + fd1763_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1763; + +class fd1764_device : public wd1770_device +{ +public: + fd1764_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1764; + +class fd1765_device : public wd1770_device +{ +public: + fd1765_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1765; + +class fd1767_device : public wd1770_device +{ +public: + fd1767_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type FD1767; + +class wd2791_device : public wd1770_device +{ +public: + wd2791_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type WD2791; + +class wd2793_device : public wd1770_device +{ +public: + wd2793_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type WD2793; + +class wd2795_device : public wd1770_device +{ +public: + wd2795_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type WD2795; + +class wd2797_device : public wd1770_device +{ +public: + wd2797_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type WD2797; + +class wd1772_device : public wd1770_device +{ +public: + wd1772_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type WD1772; + +class wd1773_device : public wd1770_device +{ +public: + wd1773_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type WD1773; + +class mb8866_device : public wd1770_device +{ +public: + mb8866_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type MB8866; + +class mb8876_device : public wd1770_device +{ +public: + mb8876_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type MB8876; + +class mb8877_device : public wd1770_device +{ +public: + mb8877_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type MB8877; + diff --git a/src/emu/sound/2151intf.c b/src/emu/sound/2151intf.c index cdb49e8651f..61a236ae1da 100644 --- a/src/emu/sound/2151intf.c +++ b/src/emu/sound/2151intf.c @@ -28,7 +28,7 @@ INLINE ym2151_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YM2151); - return (ym2151_state *)downcast<legacy_device_base *>(device)->token(); + return (ym2151_state *)downcast<ym2151_device *>(device)->token(); } @@ -146,4 +146,60 @@ DEVICE_GET_INFO( ym2151 ) } -DEFINE_LEGACY_SOUND_DEVICE(YM2151, ym2151); +const device_type YM2151 = &device_creator<ym2151_device>; + +ym2151_device::ym2151_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YM2151, "YM2151", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym2151_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ym2151_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ym2151_device::device_start() +{ + DEVICE_START_NAME( ym2151 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ym2151_device::device_reset() +{ + DEVICE_RESET_NAME( ym2151 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ym2151_device::device_stop() +{ + DEVICE_STOP_NAME( ym2151 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym2151_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/2151intf.h b/src/emu/sound/2151intf.h index b568192049e..f355ec5dc9d 100644 --- a/src/emu/sound/2151intf.h +++ b/src/emu/sound/2151intf.h @@ -19,6 +19,30 @@ READ8_DEVICE_HANDLER( ym2151_status_port_r ); WRITE8_DEVICE_HANDLER( ym2151_register_port_w ); WRITE8_DEVICE_HANDLER( ym2151_data_port_w ); -DECLARE_LEGACY_SOUND_DEVICE(YM2151, ym2151); +class ym2151_device : public device_t, + public device_sound_interface +{ +public: + ym2151_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ym2151_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YM2151; + #endif /* __2151INTF_H__ */ diff --git a/src/emu/sound/2203intf.c b/src/emu/sound/2203intf.c index aa3b7eb3e75..ae929ed355f 100644 --- a/src/emu/sound/2203intf.c +++ b/src/emu/sound/2203intf.c @@ -20,7 +20,7 @@ INLINE ym2203_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YM2203); - return (ym2203_state *)downcast<legacy_device_base *>(device)->token(); + return (ym2203_state *)downcast<ym2203_device *>(device)->token(); } @@ -208,4 +208,60 @@ DEVICE_GET_INFO( ym2203 ) } -DEFINE_LEGACY_SOUND_DEVICE(YM2203, ym2203); +const device_type YM2203 = &device_creator<ym2203_device>; + +ym2203_device::ym2203_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YM2203, "YM2203", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym2203_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ym2203_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ym2203_device::device_start() +{ + DEVICE_START_NAME( ym2203 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ym2203_device::device_reset() +{ + DEVICE_RESET_NAME( ym2203 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ym2203_device::device_stop() +{ + DEVICE_STOP_NAME( ym2203 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym2203_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/2203intf.h b/src/emu/sound/2203intf.h index f4ca6e172b3..ba32f219f1a 100644 --- a/src/emu/sound/2203intf.h +++ b/src/emu/sound/2203intf.h @@ -24,6 +24,30 @@ READ8_DEVICE_HANDLER( ym2203_read_port_r ); WRITE8_DEVICE_HANDLER( ym2203_control_port_w ); WRITE8_DEVICE_HANDLER( ym2203_write_port_w ); -DECLARE_LEGACY_SOUND_DEVICE(YM2203, ym2203); +class ym2203_device : public device_t, + public device_sound_interface +{ +public: + ym2203_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ym2203_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YM2203; + #endif /* __2203INTF_H__ */ diff --git a/src/emu/sound/2413intf.c b/src/emu/sound/2413intf.c index ab4c738a1dc..6ea45579363 100644 --- a/src/emu/sound/2413intf.c +++ b/src/emu/sound/2413intf.c @@ -22,7 +22,7 @@ INLINE ym2413_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YM2413); - return (ym2413_state *)downcast<legacy_device_base *>(device)->token(); + return (ym2413_state *)downcast<ym2413_device *>(device)->token(); } @@ -142,4 +142,60 @@ DEVICE_GET_INFO( ym2413 ) } -DEFINE_LEGACY_SOUND_DEVICE(YM2413, ym2413); +const device_type YM2413 = &device_creator<ym2413_device>; + +ym2413_device::ym2413_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YM2413, "YM2413", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym2413_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ym2413_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ym2413_device::device_start() +{ + DEVICE_START_NAME( ym2413 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ym2413_device::device_reset() +{ + DEVICE_RESET_NAME( ym2413 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ym2413_device::device_stop() +{ + DEVICE_STOP_NAME( ym2413 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym2413_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/2413intf.h b/src/emu/sound/2413intf.h index 6ffaa0cc035..a6d7aa9180c 100644 --- a/src/emu/sound/2413intf.h +++ b/src/emu/sound/2413intf.h @@ -10,6 +10,30 @@ WRITE8_DEVICE_HANDLER( ym2413_w ); WRITE8_DEVICE_HANDLER( ym2413_register_port_w ); WRITE8_DEVICE_HANDLER( ym2413_data_port_w ); -DECLARE_LEGACY_SOUND_DEVICE(YM2413, ym2413); +class ym2413_device : public device_t, + public device_sound_interface +{ +public: + ym2413_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ym2413_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YM2413; + #endif /* __2413INTF_H__ */ diff --git a/src/emu/sound/2608intf.c b/src/emu/sound/2608intf.c index 85351acb165..be99536f274 100644 --- a/src/emu/sound/2608intf.c +++ b/src/emu/sound/2608intf.c @@ -32,7 +32,7 @@ INLINE ym2608_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YM2608); - return (ym2608_state *)downcast<legacy_device_base *>(device)->token(); + return (ym2608_state *)downcast<ym2608_device *>(device)->token(); } @@ -232,4 +232,60 @@ DEVICE_GET_INFO( ym2608 ) } -DEFINE_LEGACY_SOUND_DEVICE(YM2608, ym2608); +const device_type YM2608 = &device_creator<ym2608_device>; + +ym2608_device::ym2608_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YM2608, "YM2608", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym2608_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ym2608_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ym2608_device::device_start() +{ + DEVICE_START_NAME( ym2608 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ym2608_device::device_reset() +{ + DEVICE_RESET_NAME( ym2608 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ym2608_device::device_stop() +{ + DEVICE_STOP_NAME( ym2608 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym2608_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/2608intf.h b/src/emu/sound/2608intf.h index 8a8fb65dc26..1fbf0099891 100644 --- a/src/emu/sound/2608intf.h +++ b/src/emu/sound/2608intf.h @@ -29,6 +29,30 @@ WRITE8_DEVICE_HANDLER( ym2608_control_port_b_w ); WRITE8_DEVICE_HANDLER( ym2608_data_port_a_w ); WRITE8_DEVICE_HANDLER( ym2608_data_port_b_w ); -DECLARE_LEGACY_SOUND_DEVICE(YM2608, ym2608); +class ym2608_device : public device_t, + public device_sound_interface +{ +public: + ym2608_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ym2608_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YM2608; + #endif /* __2608INTF_H__ */ diff --git a/src/emu/sound/2610intf.c b/src/emu/sound/2610intf.c index cd64ee811e1..ec019e94536 100644 --- a/src/emu/sound/2610intf.c +++ b/src/emu/sound/2610intf.c @@ -32,7 +32,7 @@ INLINE ym2610_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YM2610 || device->type() == YM2610B); - return (ym2610_state *)downcast<legacy_device_base *>(device)->token(); + return (ym2610_state *)downcast<ym2610_device *>(device)->token(); } @@ -256,5 +256,84 @@ DEVICE_GET_INFO( ym2610b ) } -DEFINE_LEGACY_SOUND_DEVICE(YM2610, ym2610); -DEFINE_LEGACY_SOUND_DEVICE(YM2610B, ym2610b); +const device_type YM2610 = &device_creator<ym2610_device>; + +ym2610_device::ym2610_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YM2610, "YM2610", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym2610_state)); +} +ym2610_device::ym2610_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym2610_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ym2610_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ym2610_device::device_start() +{ + DEVICE_START_NAME( ym2610 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ym2610_device::device_reset() +{ + DEVICE_RESET_NAME( ym2610 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ym2610_device::device_stop() +{ + DEVICE_STOP_NAME( ym2610 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym2610_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type YM2610B = &device_creator<ym2610b_device>; + +ym2610b_device::ym2610b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ym2610_device(mconfig, YM2610B, "YM2610B", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym2610b_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/2610intf.h b/src/emu/sound/2610intf.h index d7a02856638..76d92a58e4d 100644 --- a/src/emu/sound/2610intf.h +++ b/src/emu/sound/2610intf.h @@ -28,7 +28,42 @@ WRITE8_DEVICE_HANDLER( ym2610_data_port_a_w ); WRITE8_DEVICE_HANDLER( ym2610_data_port_b_w ); -DECLARE_LEGACY_SOUND_DEVICE(YM2610, ym2610); -DECLARE_LEGACY_SOUND_DEVICE(YM2610B, ym2610b); +class ym2610_device : public device_t, + public device_sound_interface +{ +public: + ym2610_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ym2610_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~ym2610_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YM2610; + +class ym2610b_device : public ym2610_device +{ +public: + ym2610b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type YM2610B; + #endif /* __2610INTF_H__ */ diff --git a/src/emu/sound/2612intf.c b/src/emu/sound/2612intf.c index f6d95ad0452..f1e58eb7cdd 100644 --- a/src/emu/sound/2612intf.c +++ b/src/emu/sound/2612intf.c @@ -31,7 +31,7 @@ INLINE ym2612_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YM2612 || device->type() == YM3438); - return (ym2612_state *)downcast<legacy_device_base *>(device)->token(); + return (ym2612_state *)downcast<ym2612_device *>(device)->token(); } @@ -198,5 +198,84 @@ DEVICE_GET_INFO( ym3438 ) } -DEFINE_LEGACY_SOUND_DEVICE(YM2612, ym2612); -DEFINE_LEGACY_SOUND_DEVICE(YM3438, ym3438); +const device_type YM2612 = &device_creator<ym2612_device>; + +ym2612_device::ym2612_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YM2612, "YM2612", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym2612_state)); +} +ym2612_device::ym2612_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym2612_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ym2612_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ym2612_device::device_start() +{ + DEVICE_START_NAME( ym2612 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ym2612_device::device_reset() +{ + DEVICE_RESET_NAME( ym2612 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ym2612_device::device_stop() +{ + DEVICE_STOP_NAME( ym2612 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym2612_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type YM3438 = &device_creator<ym3438_device>; + +ym3438_device::ym3438_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ym2612_device(mconfig, YM3438, "YM3438", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym3438_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/2612intf.h b/src/emu/sound/2612intf.h index 61a9294e484..f7653a6d114 100644 --- a/src/emu/sound/2612intf.h +++ b/src/emu/sound/2612intf.h @@ -27,7 +27,32 @@ WRITE8_DEVICE_HANDLER( ym2612_data_port_a_w ); WRITE8_DEVICE_HANDLER( ym2612_data_port_b_w ); -DECLARE_LEGACY_SOUND_DEVICE(YM2612, ym2612); +class ym2612_device : public device_t, + public device_sound_interface +{ +public: + ym2612_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ym2612_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~ym2612_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YM2612; + typedef struct _ym3438_interface ym3438_interface; @@ -51,6 +76,16 @@ struct _ym3438_interface #define ym3438_data_port_b_w ym2612_data_port_b_w -DECLARE_LEGACY_SOUND_DEVICE(YM3438, ym3438); +class ym3438_device : public ym2612_device +{ +public: + ym3438_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type YM3438; + #endif /* __2612INTF_H__ */ diff --git a/src/emu/sound/262intf.c b/src/emu/sound/262intf.c index de329c7eaf9..8c257156fb4 100644 --- a/src/emu/sound/262intf.c +++ b/src/emu/sound/262intf.c @@ -25,7 +25,7 @@ INLINE ymf262_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YMF262); - return (ymf262_state *)downcast<legacy_device_base *>(device)->token(); + return (ymf262_state *)downcast<ymf262_device *>(device)->token(); } @@ -158,4 +158,60 @@ DEVICE_GET_INFO( ymf262 ) } -DEFINE_LEGACY_SOUND_DEVICE(YMF262, ymf262); +const device_type YMF262 = &device_creator<ymf262_device>; + +ymf262_device::ymf262_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YMF262, "YMF262", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ymf262_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ymf262_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ymf262_device::device_start() +{ + DEVICE_START_NAME( ymf262 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ymf262_device::device_reset() +{ + DEVICE_RESET_NAME( ymf262 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ymf262_device::device_stop() +{ + DEVICE_STOP_NAME( ymf262 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ymf262_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/262intf.h b/src/emu/sound/262intf.h index a458273ae47..0224f2e40a4 100644 --- a/src/emu/sound/262intf.h +++ b/src/emu/sound/262intf.h @@ -23,6 +23,30 @@ WRITE8_DEVICE_HANDLER( ymf262_data_a_w ); WRITE8_DEVICE_HANDLER( ymf262_data_b_w ); -DECLARE_LEGACY_SOUND_DEVICE(YMF262, ymf262); +class ymf262_device : public device_t, + public device_sound_interface +{ +public: + ymf262_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ymf262_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YMF262; + #endif /* __262INTF_H__ */ diff --git a/src/emu/sound/3526intf.c b/src/emu/sound/3526intf.c index 87909df9e4b..789a4be28e1 100644 --- a/src/emu/sound/3526intf.c +++ b/src/emu/sound/3526intf.c @@ -39,7 +39,7 @@ INLINE ym3526_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YM3526); - return (ym3526_state *)downcast<legacy_device_base *>(device)->token(); + return (ym3526_state *)downcast<ym3526_device *>(device)->token(); } @@ -171,4 +171,60 @@ DEVICE_GET_INFO( ym3526 ) } -DEFINE_LEGACY_SOUND_DEVICE(YM3526, ym3526); +const device_type YM3526 = &device_creator<ym3526_device>; + +ym3526_device::ym3526_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YM3526, "YM3526", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym3526_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ym3526_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ym3526_device::device_start() +{ + DEVICE_START_NAME( ym3526 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ym3526_device::device_reset() +{ + DEVICE_RESET_NAME( ym3526 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ym3526_device::device_stop() +{ + DEVICE_STOP_NAME( ym3526 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym3526_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/3526intf.h b/src/emu/sound/3526intf.h index c3f81ea2c88..602bb1e74a0 100644 --- a/src/emu/sound/3526intf.h +++ b/src/emu/sound/3526intf.h @@ -19,6 +19,30 @@ READ8_DEVICE_HANDLER( ym3526_read_port_r ); WRITE8_DEVICE_HANDLER( ym3526_control_port_w ); WRITE8_DEVICE_HANDLER( ym3526_write_port_w ); -DECLARE_LEGACY_SOUND_DEVICE(YM3526, ym3526); +class ym3526_device : public device_t, + public device_sound_interface +{ +public: + ym3526_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ym3526_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YM3526; + #endif /* __3526INTF_H__ */ diff --git a/src/emu/sound/3812intf.c b/src/emu/sound/3812intf.c index 25d97861131..02b5bb15dab 100644 --- a/src/emu/sound/3812intf.c +++ b/src/emu/sound/3812intf.c @@ -37,7 +37,7 @@ INLINE ym3812_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YM3812); - return (ym3812_state *)downcast<legacy_device_base *>(device)->token(); + return (ym3812_state *)downcast<ym3812_device *>(device)->token(); } @@ -167,4 +167,60 @@ DEVICE_GET_INFO( ym3812 ) } -DEFINE_LEGACY_SOUND_DEVICE(YM3812, ym3812); +const device_type YM3812 = &device_creator<ym3812_device>; + +ym3812_device::ym3812_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YM3812, "YM3812", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ym3812_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ym3812_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ym3812_device::device_start() +{ + DEVICE_START_NAME( ym3812 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ym3812_device::device_reset() +{ + DEVICE_RESET_NAME( ym3812 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ym3812_device::device_stop() +{ + DEVICE_STOP_NAME( ym3812 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym3812_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/3812intf.h b/src/emu/sound/3812intf.h index 0ef383e3416..1314c315a7f 100644 --- a/src/emu/sound/3812intf.h +++ b/src/emu/sound/3812intf.h @@ -19,6 +19,30 @@ READ8_DEVICE_HANDLER( ym3812_read_port_r ); WRITE8_DEVICE_HANDLER( ym3812_control_port_w ); WRITE8_DEVICE_HANDLER( ym3812_write_port_w ); -DECLARE_LEGACY_SOUND_DEVICE(YM3812, ym3812); +class ym3812_device : public device_t, + public device_sound_interface +{ +public: + ym3812_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ym3812_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YM3812; + #endif /* __3812INTF_H__ */ diff --git a/src/emu/sound/8950intf.c b/src/emu/sound/8950intf.c index aa75ef39a69..13c365689f5 100644 --- a/src/emu/sound/8950intf.c +++ b/src/emu/sound/8950intf.c @@ -37,7 +37,7 @@ INLINE y8950_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == Y8950); - return (y8950_state *)downcast<legacy_device_base *>(device)->token(); + return (y8950_state *)downcast<y8950_device *>(device)->token(); } @@ -200,4 +200,60 @@ DEVICE_GET_INFO( y8950 ) } -DEFINE_LEGACY_SOUND_DEVICE(Y8950, y8950); +const device_type Y8950 = &device_creator<y8950_device>; + +y8950_device::y8950_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, Y8950, "Y8950", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(y8950_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void y8950_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void y8950_device::device_start() +{ + DEVICE_START_NAME( y8950 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void y8950_device::device_reset() +{ + DEVICE_RESET_NAME( y8950 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void y8950_device::device_stop() +{ + DEVICE_STOP_NAME( y8950 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void y8950_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/8950intf.h b/src/emu/sound/8950intf.h index eab9d8208d7..3607ee96fba 100644 --- a/src/emu/sound/8950intf.h +++ b/src/emu/sound/8950intf.h @@ -24,6 +24,30 @@ READ8_DEVICE_HANDLER( y8950_read_port_r ); WRITE8_DEVICE_HANDLER( y8950_control_port_w ); WRITE8_DEVICE_HANDLER( y8950_write_port_w ); -DECLARE_LEGACY_SOUND_DEVICE(Y8950, y8950); +class y8950_device : public device_t, + public device_sound_interface +{ +public: + y8950_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~y8950_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type Y8950; + #endif /* __8950INTF_H__ */ diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c index fc35f727e00..1a1aa88b4f9 100644 --- a/src/emu/sound/aica.c +++ b/src/emu/sound/aica.c @@ -217,7 +217,7 @@ INLINE aica_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == AICA); - return (aica_state *)downcast<legacy_device_base *>(device)->token(); + return (aica_state *)downcast<aica_device *>(device)->token(); } static unsigned char DecodeSCI(aica_state *AICA, unsigned char irq) @@ -1380,4 +1380,51 @@ DEVICE_GET_INFO( aica ) -DEFINE_LEGACY_SOUND_DEVICE(AICA, aica); +const device_type AICA = &device_creator<aica_device>; + +aica_device::aica_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, AICA, "AICA", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(aica_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void aica_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void aica_device::device_start() +{ + DEVICE_START_NAME( aica )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void aica_device::device_stop() +{ + DEVICE_STOP_NAME( aica )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void aica_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/aica.h b/src/emu/sound/aica.h index cacee5de1cd..39313dcfd99 100644 --- a/src/emu/sound/aica.h +++ b/src/emu/sound/aica.h @@ -26,6 +26,29 @@ WRITE16_DEVICE_HANDLER( aica_w ); WRITE16_DEVICE_HANDLER( aica_midi_in ); READ16_DEVICE_HANDLER( aica_midi_out_r ); -DECLARE_LEGACY_SOUND_DEVICE(AICA, aica); +class aica_device : public device_t, + public device_sound_interface +{ +public: + aica_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~aica_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type AICA; + #endif /* __AICA_H__ */ diff --git a/src/emu/sound/astrocde.c b/src/emu/sound/astrocde.c index 3ae7112fb7a..dac4a27fc29 100644 --- a/src/emu/sound/astrocde.c +++ b/src/emu/sound/astrocde.c @@ -73,7 +73,7 @@ INLINE astrocade_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == ASTROCADE); - return (astrocade_state *)downcast<legacy_device_base *>(device)->token(); + return (astrocade_state *)downcast<astrocade_device *>(device)->token(); } @@ -331,4 +331,51 @@ DEVICE_GET_INFO( astrocade ) } -DEFINE_LEGACY_SOUND_DEVICE(ASTROCADE, astrocade); +const device_type ASTROCADE = &device_creator<astrocade_device>; + +astrocade_device::astrocade_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ASTROCADE, "Astrocade", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(astrocade_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void astrocade_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void astrocade_device::device_start() +{ + DEVICE_START_NAME( astrocade )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void astrocade_device::device_reset() +{ + DEVICE_RESET_NAME( astrocade )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void astrocade_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/astrocde.h b/src/emu/sound/astrocde.h index afcf03d18e1..ac3ddab5ec9 100644 --- a/src/emu/sound/astrocde.h +++ b/src/emu/sound/astrocde.h @@ -7,6 +7,29 @@ WRITE8_DEVICE_HANDLER( astrocade_sound_w ); -DECLARE_LEGACY_SOUND_DEVICE(ASTROCADE, astrocade); +class astrocade_device : public device_t, + public device_sound_interface +{ +public: + astrocade_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~astrocade_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type ASTROCADE; + #endif /* __ASTROCDE_H__ */ diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c index b70b6ddf375..78e97d5c54d 100644 --- a/src/emu/sound/ay8910.c +++ b/src/emu/sound/ay8910.c @@ -208,7 +208,7 @@ INLINE ay8910_context *get_safe_token(device_t *device) device->type() == YM3439 || device->type() == YMZ284 || device->type() == YMZ294); - return (ay8910_context *)downcast<legacy_device_base *>(device)->token(); + return (ay8910_context *)downcast<ay8910_device *>(device)->token(); } @@ -1000,7 +1000,6 @@ DEVICE_GET_INFO( ay8912 ) { switch (state) { - case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ay8910 ); break; case DEVINFO_STR_NAME: strcpy(info->s, "AY-3-8912A"); break; default: DEVICE_GET_INFO_CALL(ay8910); break; } @@ -1010,7 +1009,6 @@ DEVICE_GET_INFO( ay8913 ) { switch (state) { - case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ay8910 ); break; case DEVINFO_STR_NAME: strcpy(info->s, "AY-3-8913A"); break; default: DEVICE_GET_INFO_CALL(ay8910); break; } @@ -1020,7 +1018,6 @@ DEVICE_GET_INFO( ay8914 ) { switch (state) { - case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ay8910 ); break; case DEVINFO_STR_NAME: strcpy(info->s, "AY-3-8914"); break; default: DEVICE_GET_INFO_CALL(ay8910); break; } @@ -1030,7 +1027,6 @@ DEVICE_GET_INFO( ay8930 ) { switch (state) { - case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ay8910 ); break; case DEVINFO_STR_NAME: strcpy(info->s, "AY8930"); break; default: DEVICE_GET_INFO_CALL(ay8910); break; } @@ -1050,9 +1046,8 @@ DEVICE_GET_INFO( ym3439 ) { switch (state) { - case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2149 ); break; case DEVINFO_STR_NAME: strcpy(info->s, "YM3439"); break; - default: DEVICE_GET_INFO_CALL(ay8910); break; + default: DEVICE_GET_INFO_CALL(ym2149); break; } } @@ -1060,9 +1055,8 @@ DEVICE_GET_INFO( ymz284 ) { switch (state) { - case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2149 ); break; case DEVINFO_STR_NAME: strcpy(info->s, "YMZ284"); break; - default: DEVICE_GET_INFO_CALL(ay8910); break; + default: DEVICE_GET_INFO_CALL(ym2149); break; } } @@ -1070,9 +1064,8 @@ DEVICE_GET_INFO( ymz294 ) { switch (state) { - case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ym2149 ); break; case DEVINFO_STR_NAME: strcpy(info->s, "YMZ294"); break; - default: DEVICE_GET_INFO_CALL(ay8910); break; + default: DEVICE_GET_INFO_CALL(ym2149); break; } } @@ -1139,12 +1132,223 @@ WRITE8_DEVICE_HANDLER( ay8914_w ) -DEFINE_LEGACY_SOUND_DEVICE(AY8910, ay8910); -DEFINE_LEGACY_SOUND_DEVICE(AY8912, ay8912); -DEFINE_LEGACY_SOUND_DEVICE(AY8913, ay8913); -DEFINE_LEGACY_SOUND_DEVICE(AY8914, ay8914); -DEFINE_LEGACY_SOUND_DEVICE(AY8930, ay8930); -DEFINE_LEGACY_SOUND_DEVICE(YM2149, ym2149); -DEFINE_LEGACY_SOUND_DEVICE(YM3439, ym3439); -DEFINE_LEGACY_SOUND_DEVICE(YMZ284, ymz284); -DEFINE_LEGACY_SOUND_DEVICE(YMZ294, ymz294); +const device_type AY8910 = &device_creator<ay8910_device>; + +ay8910_device::ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, AY8910, "AY-3-8910A", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ay8910_context)); +} +ay8910_device::ay8910_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ay8910_context)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ay8910_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ay8910_device::device_start() +{ + DEVICE_START_NAME( ay8910 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ay8910_device::device_reset() +{ + DEVICE_RESET_NAME( ay8910 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void ay8910_device::device_stop() +{ + DEVICE_STOP_NAME( ay8910 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ay8910_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type AY8912 = &device_creator<ay8912_device>; + +ay8912_device::ay8912_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ay8910_device(mconfig, AY8912, "AY-3-8912A", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ay8912_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type AY8913 = &device_creator<ay8913_device>; + +ay8913_device::ay8913_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ay8910_device(mconfig, AY8913, "AY-3-8913A", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ay8913_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type AY8914 = &device_creator<ay8914_device>; + +ay8914_device::ay8914_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ay8910_device(mconfig, AY8914, "AY-3-8914", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ay8914_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type AY8930 = &device_creator<ay8930_device>; + +ay8930_device::ay8930_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ay8910_device(mconfig, AY8930, "AY8930", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ay8930_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type YM2149 = &device_creator<ym2149_device>; + +ym2149_device::ym2149_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ay8910_device(mconfig, YM2149, "YM2149", tag, owner, clock) +{ +} +ym2149_device::ym2149_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : ay8910_device(mconfig, type, name, tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ym2149_device::device_start() +{ + DEVICE_START_NAME( ym2149 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym2149_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type YM3439 = &device_creator<ym3439_device>; + +ym3439_device::ym3439_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ym2149_device(mconfig, YM3439, "YM3439", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ym3439_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type YMZ284 = &device_creator<ymz284_device>; + +ymz284_device::ymz284_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ym2149_device(mconfig, YMZ284, "YMZ284", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ymz284_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type YMZ294 = &device_creator<ymz294_device>; + +ymz294_device::ymz294_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : ym2149_device(mconfig, YMZ294, "YMZ294", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ymz294_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/ay8910.h b/src/emu/sound/ay8910.h index a6088a12a3f..7a67c1cefe0 100644 --- a/src/emu/sound/ay8910.h +++ b/src/emu/sound/ay8910.h @@ -119,14 +119,123 @@ void ay8910_set_clock_ym(void *chip, int clock); void ay8910_write_ym(void *chip, int addr, int data); int ay8910_read_ym(void *chip); -DECLARE_LEGACY_SOUND_DEVICE(AY8910, ay8910); -DECLARE_LEGACY_SOUND_DEVICE(AY8912, ay8912); -DECLARE_LEGACY_SOUND_DEVICE(AY8913, ay8913); -DECLARE_LEGACY_SOUND_DEVICE(AY8914, ay8914); -DECLARE_LEGACY_SOUND_DEVICE(AY8930, ay8930); -DECLARE_LEGACY_SOUND_DEVICE(YM2149, ym2149); -DECLARE_LEGACY_SOUND_DEVICE(YM3439, ym3439); -DECLARE_LEGACY_SOUND_DEVICE(YMZ284, ymz284); -DECLARE_LEGACY_SOUND_DEVICE(YMZ294, ymz294); +class ay8910_device : public device_t, + public device_sound_interface +{ +public: + ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ay8910_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~ay8910_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type AY8910; + +class ay8912_device : public ay8910_device +{ +public: + ay8912_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type AY8912; + +class ay8913_device : public ay8910_device +{ +public: + ay8913_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type AY8913; + +class ay8914_device : public ay8910_device +{ +public: + ay8914_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type AY8914; + +class ay8930_device : public ay8910_device +{ +public: + ay8930_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type AY8930; + +class ym2149_device : public ay8910_device +{ +public: + ym2149_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ym2149_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type YM2149; + +class ym3439_device : public ym2149_device +{ +public: + ym3439_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type YM3439; + +class ymz284_device : public ym2149_device +{ +public: + ymz284_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type YMZ284; + +class ymz294_device : public ym2149_device +{ +public: + ymz294_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type YMZ294; + #endif /* __AY8910_H__ */ diff --git a/src/emu/sound/beep.c b/src/emu/sound/beep.c index fc5f9d5e124..29844737f39 100644 --- a/src/emu/sound/beep.c +++ b/src/emu/sound/beep.c @@ -32,7 +32,7 @@ INLINE beep_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == BEEP); - return (beep_state *)downcast<legacy_device_base *>(device)->token(); + return (beep_state *)downcast<beep_device *>(device)->token(); } @@ -189,4 +189,42 @@ DEVICE_GET_INFO( beep ) } -DEFINE_LEGACY_SOUND_DEVICE(BEEP, beep); +const device_type BEEP = &device_creator<beep_device>; + +beep_device::beep_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, BEEP, "Beep", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(beep_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void beep_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void beep_device::device_start() +{ + DEVICE_START_NAME( beep )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void beep_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/beep.h b/src/emu/sound/beep.h index 62a31952554..920ce25f367 100644 --- a/src/emu/sound/beep.h +++ b/src/emu/sound/beep.h @@ -11,6 +11,28 @@ void beep_set_state(device_t *device, int on); void beep_set_frequency(device_t *device, int frequency); void beep_set_volume(device_t *device, int volume); -DECLARE_LEGACY_SOUND_DEVICE(BEEP, beep); +class beep_device : public device_t, + public device_sound_interface +{ +public: + beep_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~beep_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type BEEP; + #endif /* __BEEP_H__ */ diff --git a/src/emu/sound/c140.c b/src/emu/sound/c140.c index e91c5bea8dc..bf13c26d4a7 100644 --- a/src/emu/sound/c140.c +++ b/src/emu/sound/c140.c @@ -109,7 +109,7 @@ INLINE c140_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == C140); - return (c140_state *)downcast<legacy_device_base *>(device)->token(); + return (c140_state *)downcast<c140_device *>(device)->token(); } @@ -504,4 +504,42 @@ DEVICE_GET_INFO( c140 ) } -DEFINE_LEGACY_SOUND_DEVICE(C140, c140); +const device_type C140 = &device_creator<c140_device>; + +c140_device::c140_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, C140, "C140", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(c140_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void c140_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void c140_device::device_start() +{ + DEVICE_START_NAME( c140 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void c140_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/c140.h b/src/emu/sound/c140.h index fd90212c06e..f5942a6cbcd 100644 --- a/src/emu/sound/c140.h +++ b/src/emu/sound/c140.h @@ -24,6 +24,28 @@ struct _c140_interface { int banking_type; }; -DECLARE_LEGACY_SOUND_DEVICE(C140, c140); +class c140_device : public device_t, + public device_sound_interface +{ +public: + c140_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~c140_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type C140; + #endif /* __C140_H__ */ diff --git a/src/emu/sound/c6280.c b/src/emu/sound/c6280.c index 27b6812aa6f..59ab9e5e595 100644 --- a/src/emu/sound/c6280.c +++ b/src/emu/sound/c6280.c @@ -86,7 +86,7 @@ INLINE c6280_t *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == C6280); - return (c6280_t *)downcast<legacy_device_base *>(device)->token(); + return (c6280_t *)downcast<c6280_device *>(device)->token(); } @@ -372,4 +372,42 @@ DEVICE_GET_INFO( c6280 ) } -DEFINE_LEGACY_SOUND_DEVICE(C6280, c6280); +const device_type C6280 = &device_creator<c6280_device>; + +c6280_device::c6280_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, C6280, "HuC6280", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(c6280_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void c6280_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void c6280_device::device_start() +{ + DEVICE_START_NAME( c6280 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void c6280_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/c6280.h b/src/emu/sound/c6280.h index fe61983268c..029d2caa042 100644 --- a/src/emu/sound/c6280.h +++ b/src/emu/sound/c6280.h @@ -15,6 +15,28 @@ struct _c6280_interface WRITE8_DEVICE_HANDLER( c6280_w ); READ8_DEVICE_HANDLER( c6280_r ); -DECLARE_LEGACY_SOUND_DEVICE(C6280, c6280); +class c6280_device : public device_t, + public device_sound_interface +{ +public: + c6280_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~c6280_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type C6280; + #endif /* __C6280_H__ */ diff --git a/src/emu/sound/cdda.c b/src/emu/sound/cdda.c index 8b4a9af1118..309891154b2 100644 --- a/src/emu/sound/cdda.c +++ b/src/emu/sound/cdda.c @@ -25,7 +25,7 @@ INLINE cdda_info *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == CDDA); - return (cdda_info *)downcast<legacy_device_base *>(device)->token(); + return (cdda_info *)downcast<cdda_device *>(device)->token(); } #define MAX_SECTORS ( 4 ) @@ -339,4 +339,42 @@ DEVICE_GET_INFO( cdda ) } -DEFINE_LEGACY_SOUND_DEVICE(CDDA, cdda); +const device_type CDDA = &device_creator<cdda_device>; + +cdda_device::cdda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, CDDA, "CD/DA", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(cdda_info)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void cdda_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cdda_device::device_start() +{ + DEVICE_START_NAME( cdda )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void cdda_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/cdda.h b/src/emu/sound/cdda.h index 0c9c605978b..5535e4ffebd 100644 --- a/src/emu/sound/cdda.h +++ b/src/emu/sound/cdda.h @@ -19,6 +19,28 @@ int cdda_audio_active(device_t *device); int cdda_audio_paused(device_t *device); int cdda_audio_ended(device_t *device); -DECLARE_LEGACY_SOUND_DEVICE(CDDA, cdda); +class cdda_device : public device_t, + public device_sound_interface +{ +public: + cdda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~cdda_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type CDDA; + #endif /* __CDDA_H__ */ diff --git a/src/emu/sound/cem3394.c b/src/emu/sound/cem3394.c index c264bb8e614..388baf1e9a2 100644 --- a/src/emu/sound/cem3394.c +++ b/src/emu/sound/cem3394.c @@ -141,7 +141,7 @@ INLINE cem3394_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == CEM3394); - return (cem3394_state *)downcast<legacy_device_base *>(device)->token(); + return (cem3394_state *)downcast<cem3394_device *>(device)->token(); } @@ -586,4 +586,42 @@ DEVICE_GET_INFO( cem3394 ) } -DEFINE_LEGACY_SOUND_DEVICE(CEM3394, cem3394); +const device_type CEM3394 = &device_creator<cem3394_device>; + +cem3394_device::cem3394_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, CEM3394, "CEM3394", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(cem3394_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void cem3394_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cem3394_device::device_start() +{ + DEVICE_START_NAME( cem3394 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/cem3394.h b/src/emu/sound/cem3394.h index 450e80ef670..0382e2b96a7 100644 --- a/src/emu/sound/cem3394.h +++ b/src/emu/sound/cem3394.h @@ -45,6 +45,28 @@ void cem3394_set_voltage(device_t *device, int input, double voltage); CEM3394_FINAL_GAIN: gain, in dB */ double cem3394_get_parameter(device_t *device, int input); -DECLARE_LEGACY_SOUND_DEVICE(CEM3394, cem3394); +class cem3394_device : public device_t, + public device_sound_interface +{ +public: + cem3394_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~cem3394_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type CEM3394; + #endif /* __CEM3394_H__ */ diff --git a/src/emu/sound/digitalk.c b/src/emu/sound/digitalk.c index 3d568c64642..2410e2b052e 100644 --- a/src/emu/sound/digitalk.c +++ b/src/emu/sound/digitalk.c @@ -288,7 +288,7 @@ INLINE digitalker *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == DIGITALKER); - return (digitalker *)downcast<legacy_device_base *>(device)->token(); + return (digitalker *)downcast<digitalker_device *>(device)->token(); } @@ -705,4 +705,42 @@ WRITE8_DEVICE_HANDLER( digitalker_data_w ) } -DEFINE_LEGACY_SOUND_DEVICE(DIGITALKER, digitalker); +const device_type DIGITALKER = &device_creator<digitalker_device>; + +digitalker_device::digitalker_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DIGITALKER, "Digitalker", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(digitalker)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void digitalker_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void digitalker_device::device_start() +{ + DEVICE_START_NAME( digitalker )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void digitalker_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/digitalk.h b/src/emu/sound/digitalk.h index 0a5f232d5e9..805c245e033 100644 --- a/src/emu/sound/digitalk.h +++ b/src/emu/sound/digitalk.h @@ -9,6 +9,28 @@ void digitalker_0_wr_w(device_t *device, int line); int digitalker_0_intr_r(device_t *device); WRITE8_DEVICE_HANDLER(digitalker_data_w); -DECLARE_LEGACY_SOUND_DEVICE(DIGITALKER, digitalker); +class digitalker_device : public device_t, + public device_sound_interface +{ +public: + digitalker_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~digitalker_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type DIGITALKER; + #endif diff --git a/src/emu/sound/dmadac.c b/src/emu/sound/dmadac.c index 9a8d6613235..2d7a4c3e173 100644 --- a/src/emu/sound/dmadac.c +++ b/src/emu/sound/dmadac.c @@ -59,7 +59,7 @@ INLINE dmadac_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == DMADAC); - return (dmadac_state *)downcast<legacy_device_base *>(device)->token(); + return (dmadac_state *)downcast<dmadac_sound_device *>(device)->token(); } @@ -262,4 +262,42 @@ DEVICE_GET_INFO( dmadac_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(DMADAC, dmadac_sound); +const device_type DMADAC = &device_creator<dmadac_sound_device>; + +dmadac_sound_device::dmadac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DMADAC, "DMA-driven DAC", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(dmadac_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void dmadac_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dmadac_sound_device::device_start() +{ + DEVICE_START_NAME( dmadac )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void dmadac_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/dmadac.h b/src/emu/sound/dmadac.h index eee3ab6d792..3c6d518501f 100644 --- a/src/emu/sound/dmadac.h +++ b/src/emu/sound/dmadac.h @@ -12,7 +12,29 @@ #include "devlegcy.h" -DECLARE_LEGACY_SOUND_DEVICE(DMADAC, dmadac_sound); +class dmadac_sound_device : public device_t, + public device_sound_interface +{ +public: + dmadac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~dmadac_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type DMADAC; + void dmadac_transfer(dmadac_sound_device **devlist, UINT8 num_channels, offs_t channel_spacing, offs_t frame_spacing, offs_t total_frames, INT16 *data); void dmadac_enable(dmadac_sound_device **devlist, UINT8 num_channels, UINT8 enable); diff --git a/src/emu/sound/es5506.c b/src/emu/sound/es5506.c index 9981509ad42..d3610110d0d 100644 --- a/src/emu/sound/es5506.c +++ b/src/emu/sound/es5506.c @@ -205,7 +205,7 @@ INLINE es5506_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == ES5505 || device->type() == ES5506); - return (es5506_state *)downcast<legacy_device_base *>(device)->token(); + return (es5506_state *)downcast<es5505_device *>(device)->token(); } @@ -2207,5 +2207,117 @@ DEVICE_GET_INFO( es5506 ) } -DEFINE_LEGACY_SOUND_DEVICE(ES5505, es5505); -DEFINE_LEGACY_SOUND_DEVICE(ES5506, es5506); +const device_type ES5505 = &device_creator<es5505_device>; + +es5505_device::es5505_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ES5505, "ES5505", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(es5506_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void es5505_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void es5505_device::device_start() +{ + DEVICE_START_NAME( es5505 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void es5505_device::device_reset() +{ + DEVICE_RESET_NAME( es5505 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void es5505_device::device_stop() +{ + DEVICE_STOP_NAME( es5505 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void es5505_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type ES5506 = &device_creator<es5506_device>; + +es5506_device::es5506_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ES5506, "ES5506", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(es5506_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void es5506_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void es5506_device::device_start() +{ + DEVICE_START_NAME( es5506 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void es5506_device::device_reset() +{ + DEVICE_RESET_NAME( es5506 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void es5506_device::device_stop() +{ + DEVICE_STOP_NAME( es5506 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void es5506_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/es5506.h b/src/emu/sound/es5506.h index 502ed1e8a7a..7c7ca841837 100644 --- a/src/emu/sound/es5506.h +++ b/src/emu/sound/es5506.h @@ -25,7 +25,31 @@ READ16_DEVICE_HANDLER( es5505_r ); WRITE16_DEVICE_HANDLER( es5505_w ); void es5505_voice_bank_w(device_t *device, int voice, int bank); -DECLARE_LEGACY_SOUND_DEVICE(ES5505, es5505); +class es5505_device : public device_t, + public device_sound_interface +{ +public: + es5505_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~es5505_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type ES5505; + typedef struct _es5506_interface es5506_interface; @@ -43,6 +67,30 @@ READ8_DEVICE_HANDLER( es5506_r ); WRITE8_DEVICE_HANDLER( es5506_w ); void es5506_voice_bank_w(device_t *device, int voice, int bank); -DECLARE_LEGACY_SOUND_DEVICE(ES5506, es5506); +class es5506_device : public device_t, + public device_sound_interface +{ +public: + es5506_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~es5506_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type ES5506; + #endif /* __ES5506_H__ */ diff --git a/src/emu/sound/es8712.c b/src/emu/sound/es8712.c index 8cae3700798..191621756bf 100644 --- a/src/emu/sound/es8712.c +++ b/src/emu/sound/es8712.c @@ -51,7 +51,7 @@ INLINE es8712_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == ES8712); - return (es8712_state *)downcast<legacy_device_base *>(device)->token(); + return (es8712_state *)downcast<es8712_device *>(device)->token(); } @@ -407,4 +407,51 @@ DEVICE_GET_INFO( es8712 ) } -DEFINE_LEGACY_SOUND_DEVICE(ES8712, es8712); +const device_type ES8712 = &device_creator<es8712_device>; + +es8712_device::es8712_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ES8712, "ES8712", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(es8712_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void es8712_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void es8712_device::device_start() +{ + DEVICE_START_NAME( es8712 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void es8712_device::device_reset() +{ + DEVICE_RESET_NAME( es8712 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void es8712_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/es8712.h b/src/emu/sound/es8712.h index e21c33e801f..c57a257cefb 100644 --- a/src/emu/sound/es8712.h +++ b/src/emu/sound/es8712.h @@ -13,6 +13,29 @@ void es8712_set_frequency(device_t *device, int frequency); WRITE8_DEVICE_HANDLER( es8712_w ); -DECLARE_LEGACY_SOUND_DEVICE(ES8712, es8712); +class es8712_device : public device_t, + public device_sound_interface +{ +public: + es8712_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~es8712_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type ES8712; + #endif /* __ES8712_H__ */ diff --git a/src/emu/sound/flt_rc.c b/src/emu/sound/flt_rc.c index f17005d34c5..ed5fb61cfd6 100644 --- a/src/emu/sound/flt_rc.c +++ b/src/emu/sound/flt_rc.c @@ -15,7 +15,7 @@ INLINE filter_rc_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == FILTER_RC); - return (filter_rc_state *)downcast<legacy_device_base *>(device)->token(); + return (filter_rc_state *)downcast<filter_rc_device *>(device)->token(); } const flt_rc_config flt_rc_ac_default = {FLT_RC_AC, 10000, 0, 0, CAP_U(1)}; @@ -137,4 +137,42 @@ DEVICE_GET_INFO( filter_rc ) } -DEFINE_LEGACY_SOUND_DEVICE(FILTER_RC, filter_rc); +const device_type FILTER_RC = &device_creator<filter_rc_device>; + +filter_rc_device::filter_rc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, FILTER_RC, "RC Filter", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(filter_rc_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void filter_rc_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void filter_rc_device::device_start() +{ + DEVICE_START_NAME( filter_rc )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void filter_rc_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/flt_rc.h b/src/emu/sound/flt_rc.h index 8b109392ad0..3807f9e7d89 100644 --- a/src/emu/sound/flt_rc.h +++ b/src/emu/sound/flt_rc.h @@ -59,6 +59,28 @@ extern const flt_rc_config flt_rc_ac_default; void filter_rc_set_RC(device_t *device, int type, double R1, double R2, double R3, double C); -DECLARE_LEGACY_SOUND_DEVICE(FILTER_RC, filter_rc); +class filter_rc_device : public device_t, + public device_sound_interface +{ +public: + filter_rc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~filter_rc_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type FILTER_RC; + #endif /* __FLT_RC_H__ */ diff --git a/src/emu/sound/flt_vol.c b/src/emu/sound/flt_vol.c index 27b354be948..9f173a16c8f 100644 --- a/src/emu/sound/flt_vol.c +++ b/src/emu/sound/flt_vol.c @@ -13,7 +13,7 @@ INLINE filter_volume_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == FILTER_VOLUME); - return (filter_volume_state *)downcast<legacy_device_base *>(device)->token(); + return (filter_volume_state *)downcast<filter_volume_device *>(device)->token(); } @@ -72,4 +72,42 @@ DEVICE_GET_INFO( filter_volume ) } -DEFINE_LEGACY_SOUND_DEVICE(FILTER_VOLUME, filter_volume); +const device_type FILTER_VOLUME = &device_creator<filter_volume_device>; + +filter_volume_device::filter_volume_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, FILTER_VOLUME, "Volume Filter", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(filter_volume_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void filter_volume_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void filter_volume_device::device_start() +{ + DEVICE_START_NAME( filter_volume )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void filter_volume_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/flt_vol.h b/src/emu/sound/flt_vol.h index 921148e09b3..9f7ce598b43 100644 --- a/src/emu/sound/flt_vol.h +++ b/src/emu/sound/flt_vol.h @@ -8,6 +8,28 @@ void flt_volume_set_volume(device_t *device, float volume); -DECLARE_LEGACY_SOUND_DEVICE(FILTER_VOLUME, filter_volume); +class filter_volume_device : public device_t, + public device_sound_interface +{ +public: + filter_volume_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~filter_volume_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type FILTER_VOLUME; + #endif /* __FLT_VOL_H__ */ diff --git a/src/emu/sound/gaelco.c b/src/emu/sound/gaelco.c index 248737ab3a6..0a889cf421c 100644 --- a/src/emu/sound/gaelco.c +++ b/src/emu/sound/gaelco.c @@ -78,7 +78,7 @@ INLINE gaelco_sound_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == GAELCO_GAE1 || device->type() == GAELCO_CG1V); - return (gaelco_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (gaelco_sound_state *)downcast<gaelco_gae1_device *>(device)->token(); } /*============================================================================ @@ -339,5 +339,64 @@ DEVICE_GET_INFO( gaelco_cg1v ) } -DEFINE_LEGACY_SOUND_DEVICE(GAELCO_GAE1, gaelco_gae1); -DEFINE_LEGACY_SOUND_DEVICE(GAELCO_CG1V, gaelco_cg1v); +const device_type GAELCO_GAE1 = &device_creator<gaelco_gae1_device>; + +gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GAELCO_GAE1, "Gaelco GAE1", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(gaelco_sound_state)); +} + +gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(gaelco_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void gaelco_gae1_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gaelco_gae1_device::device_start() +{ + DEVICE_START_NAME( gaelco )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void gaelco_gae1_device::device_stop() +{ + DEVICE_STOP_NAME( gaelco )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void gaelco_gae1_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type GAELCO_CG1V = &device_creator<gaelco_cg1v_device>; + +gaelco_cg1v_device::gaelco_cg1v_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : gaelco_gae1_device(mconfig, GAELCO_CG1V, "Gaelco CG1V", tag, owner, clock) +{ +} diff --git a/src/emu/sound/gaelco.h b/src/emu/sound/gaelco.h index 0acfc044048..d6c3a9dd046 100644 --- a/src/emu/sound/gaelco.h +++ b/src/emu/sound/gaelco.h @@ -15,7 +15,38 @@ struct _gaelcosnd_interface WRITE16_DEVICE_HANDLER( gaelcosnd_w ); READ16_DEVICE_HANDLER( gaelcosnd_r ); -DECLARE_LEGACY_SOUND_DEVICE(GAELCO_GAE1, gaelco_gae1); -DECLARE_LEGACY_SOUND_DEVICE(GAELCO_CG1V, gaelco_cg1v); +class gaelco_gae1_device : public device_t, + public device_sound_interface +{ +public: + gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~gaelco_gae1_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type GAELCO_GAE1; + +class gaelco_cg1v_device : public gaelco_gae1_device +{ +public: + gaelco_cg1v_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type GAELCO_CG1V; + #endif /* __GALELCO_H__ */ diff --git a/src/emu/sound/hc55516.c b/src/emu/sound/hc55516.c index 58d4d862886..109dde9c51b 100644 --- a/src/emu/sound/hc55516.c +++ b/src/emu/sound/hc55516.c @@ -57,7 +57,7 @@ INLINE hc55516_state *get_safe_token(device_t *device) assert(device->type() == HC55516 || device->type() == MC3417 || device->type() == MC3418); - return (hc55516_state *)downcast<legacy_device_base *>(device)->token(); + return (hc55516_state *)downcast<hc55516_device *>(device)->token(); } @@ -344,6 +344,111 @@ DEVICE_GET_INFO( mc3418 ) } -DEFINE_LEGACY_SOUND_DEVICE(HC55516, hc55516); -DEFINE_LEGACY_SOUND_DEVICE(MC3417, mc3417); -DEFINE_LEGACY_SOUND_DEVICE(MC3418, mc3418); +const device_type HC55516 = &device_creator<hc55516_device>; + +hc55516_device::hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, HC55516, "HC-55516", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(hc55516_state)); +} +hc55516_device::hc55516_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(hc55516_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void hc55516_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void hc55516_device::device_start() +{ + DEVICE_START_NAME( hc55516 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void hc55516_device::device_reset() +{ + DEVICE_RESET_NAME( hc55516 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void hc55516_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type MC3417 = &device_creator<mc3417_device>; + +mc3417_device::mc3417_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : hc55516_device(mconfig, MC3417, "MC3417", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mc3417_device::device_start() +{ + DEVICE_START_NAME( mc3417 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void mc3417_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type MC3418 = &device_creator<mc3418_device>; + +mc3418_device::mc3418_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : hc55516_device(mconfig, MC3418, "MC3418", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mc3418_device::device_start() +{ + DEVICE_START_NAME( mc3418 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void mc3418_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/hc55516.h b/src/emu/sound/hc55516.h index 402d485342a..6674a43b47f 100644 --- a/src/emu/sound/hc55516.h +++ b/src/emu/sound/hc55516.h @@ -15,8 +15,58 @@ void hc55516_clock_w(device_t *device, int state); /* returns whether the clock is currently LO or HI */ int hc55516_clock_state_r(device_t *device); -DECLARE_LEGACY_SOUND_DEVICE(HC55516, hc55516); -DECLARE_LEGACY_SOUND_DEVICE(MC3417, mc3417); -DECLARE_LEGACY_SOUND_DEVICE(MC3418, mc3418); +class hc55516_device : public device_t, + public device_sound_interface +{ +public: + hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + hc55516_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~hc55516_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type HC55516; + +class mc3417_device : public hc55516_device +{ +public: + mc3417_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type MC3417; + +class mc3418_device : public hc55516_device +{ +public: + mc3418_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type MC3418; + #endif /* __HC55516_H__ */ diff --git a/src/emu/sound/iremga20.c b/src/emu/sound/iremga20.c index a92e6870fca..ac277b9d81e 100644 --- a/src/emu/sound/iremga20.c +++ b/src/emu/sound/iremga20.c @@ -60,7 +60,7 @@ INLINE ga20_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == IREMGA20); - return (ga20_state *)downcast<legacy_device_base *>(device)->token(); + return (ga20_state *)downcast<iremga20_device *>(device)->token(); } @@ -293,4 +293,51 @@ DEVICE_GET_INFO( iremga20 ) } -DEFINE_LEGACY_SOUND_DEVICE(IREMGA20, iremga20); +const device_type IREMGA20 = &device_creator<iremga20_device>; + +iremga20_device::iremga20_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, IREMGA20, "Irem GA20", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ga20_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void iremga20_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void iremga20_device::device_start() +{ + DEVICE_START_NAME( iremga20 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void iremga20_device::device_reset() +{ + DEVICE_RESET_NAME( iremga20 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void iremga20_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/iremga20.h b/src/emu/sound/iremga20.h index b0b0f9e7cc6..c069ee73a9b 100644 --- a/src/emu/sound/iremga20.h +++ b/src/emu/sound/iremga20.h @@ -13,6 +13,29 @@ WRITE8_DEVICE_HANDLER( irem_ga20_w ); READ8_DEVICE_HANDLER( irem_ga20_r ); -DECLARE_LEGACY_SOUND_DEVICE(IREMGA20, iremga20); +class iremga20_device : public device_t, + public device_sound_interface +{ +public: + iremga20_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~iremga20_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type IREMGA20; + #endif /* __IREMGA20_H__ */ diff --git a/src/emu/sound/k005289.c b/src/emu/sound/k005289.c index d8c14c66998..b70c590b844 100644 --- a/src/emu/sound/k005289.c +++ b/src/emu/sound/k005289.c @@ -64,7 +64,7 @@ INLINE k005289_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == K005289); - return (k005289_state *)downcast<legacy_device_base *>(device)->token(); + return (k005289_state *)downcast<k005289_device *>(device)->token(); } /* build a table to divide by the number of voices */ @@ -274,4 +274,42 @@ DEVICE_GET_INFO( k005289 ) } -DEFINE_LEGACY_SOUND_DEVICE(K005289, k005289); +const device_type K005289 = &device_creator<k005289_device>; + +k005289_device::k005289_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K005289, "K005289", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k005289_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k005289_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k005289_device::device_start() +{ + DEVICE_START_NAME( k005289 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void k005289_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/k005289.h b/src/emu/sound/k005289.h index b730b678da5..a51b8422116 100644 --- a/src/emu/sound/k005289.h +++ b/src/emu/sound/k005289.h @@ -12,6 +12,28 @@ WRITE8_DEVICE_HANDLER( k005289_pitch_B_w ); WRITE8_DEVICE_HANDLER( k005289_keylatch_A_w ); WRITE8_DEVICE_HANDLER( k005289_keylatch_B_w ); -DECLARE_LEGACY_SOUND_DEVICE(K005289, k005289); +class k005289_device : public device_t, + public device_sound_interface +{ +public: + k005289_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k005289_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type K005289; + #endif /* __K005289_H__ */ diff --git a/src/emu/sound/k007232.c b/src/emu/sound/k007232.c index bd0663a59f7..9d86997e9b8 100644 --- a/src/emu/sound/k007232.c +++ b/src/emu/sound/k007232.c @@ -58,7 +58,7 @@ INLINE KDAC_A_PCM *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == K007232); - return (KDAC_A_PCM *)downcast<legacy_device_base *>(device)->token(); + return (KDAC_A_PCM *)downcast<k007232_device *>(device)->token(); } @@ -473,4 +473,42 @@ DEVICE_GET_INFO( k007232 ) } -DEFINE_LEGACY_SOUND_DEVICE(K007232, k007232); +const device_type K007232 = &device_creator<k007232_device>; + +k007232_device::k007232_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K007232, "K007232", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(KDAC_A_PCM)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k007232_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k007232_device::device_start() +{ + DEVICE_START_NAME( k007232 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void k007232_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/k007232.h b/src/emu/sound/k007232.h index 548fd866bd7..4c9b43021a6 100644 --- a/src/emu/sound/k007232.h +++ b/src/emu/sound/k007232.h @@ -30,6 +30,28 @@ void k007232_set_bank( device_t *device, int chABank, int chBBank ); */ void k007232_set_volume(device_t *device,int channel,int volumeA,int volumeB); -DECLARE_LEGACY_SOUND_DEVICE(K007232, k007232); +class k007232_device : public device_t, + public device_sound_interface +{ +public: + k007232_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k007232_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type K007232; + #endif /* __K007232_H__ */ diff --git a/src/emu/sound/k051649.c b/src/emu/sound/k051649.c index fd764f4d140..ecc8a882a32 100644 --- a/src/emu/sound/k051649.c +++ b/src/emu/sound/k051649.c @@ -61,7 +61,7 @@ INLINE k051649_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == K051649); - return (k051649_state *)downcast<legacy_device_base *>(device)->token(); + return (k051649_state *)downcast<k051649_device *>(device)->token(); } /* build a table to divide by the number of voices */ @@ -310,4 +310,51 @@ DEVICE_GET_INFO( k051649 ) } -DEFINE_LEGACY_SOUND_DEVICE(K051649, k051649); +const device_type K051649 = &device_creator<k051649_device>; + +k051649_device::k051649_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K051649, "K051649", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k051649_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k051649_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k051649_device::device_start() +{ + DEVICE_START_NAME( k051649 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k051649_device::device_reset() +{ + DEVICE_RESET_NAME( k051649 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void k051649_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/k051649.h b/src/emu/sound/k051649.h index 176902ac5fb..5548b0e97e0 100644 --- a/src/emu/sound/k051649.h +++ b/src/emu/sound/k051649.h @@ -16,6 +16,29 @@ READ8_DEVICE_HANDLER ( k051649_test_r ); WRITE8_DEVICE_HANDLER( k052539_waveform_w ); READ8_DEVICE_HANDLER ( k052539_waveform_r ); -DECLARE_LEGACY_SOUND_DEVICE(K051649, k051649); +class k051649_device : public device_t, + public device_sound_interface +{ +public: + k051649_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k051649_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type K051649; + #endif /* __K051649_H__ */ diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index c9ebe0069ac..25dfa41b2ba 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -47,7 +47,7 @@ INLINE k053260_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == K053260); - return (k053260_state *)downcast<legacy_device_base *>(device)->token(); + return (k053260_state *)downcast<k053260_device *>(device)->token(); } @@ -463,4 +463,51 @@ DEVICE_GET_INFO( k053260 ) } -DEFINE_LEGACY_SOUND_DEVICE(K053260, k053260); +const device_type K053260 = &device_creator<k053260_device>; + +k053260_device::k053260_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K053260, "K053260", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k053260_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k053260_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k053260_device::device_start() +{ + DEVICE_START_NAME( k053260 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k053260_device::device_reset() +{ + DEVICE_RESET_NAME( k053260 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void k053260_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/k053260.h b/src/emu/sound/k053260.h index 658e6e52344..6b205b107b3 100644 --- a/src/emu/sound/k053260.h +++ b/src/emu/sound/k053260.h @@ -21,6 +21,29 @@ struct _k053260_interface { WRITE8_DEVICE_HANDLER( k053260_w ); READ8_DEVICE_HANDLER( k053260_r ); -DECLARE_LEGACY_SOUND_DEVICE(K053260, k053260); +class k053260_device : public device_t, + public device_sound_interface +{ +public: + k053260_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k053260_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type K053260; + #endif /* __K053260_H__ */ diff --git a/src/emu/sound/k056800.c b/src/emu/sound/k056800.c index 3892cdd529f..6a6159b77cd 100644 --- a/src/emu/sound/k056800.c +++ b/src/emu/sound/k056800.c @@ -29,7 +29,7 @@ INLINE k056800_state *k056800_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K056800); - return (k056800_state *)downcast<legacy_device_base *>(device)->token(); + return (k056800_state *)downcast<k056800_device *>(device)->token(); } INLINE const k056800_interface *k056800_get_interface( device_t *device ) @@ -179,4 +179,40 @@ DEVICE_GET_INFO(k056800) } } -DEFINE_LEGACY_DEVICE(K056800, k056800); +const device_type K056800 = &device_creator<k056800_device>; + +k056800_device::k056800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K056800, "Konami 056800 MIRAC", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k056800_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k056800_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k056800_device::device_start() +{ + DEVICE_START_NAME( k056800 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k056800_device::device_reset() +{ + DEVICE_RESET_NAME( k056800 )(this); +} + + diff --git a/src/emu/sound/k056800.h b/src/emu/sound/k056800.h index 81afa200ae3..a36f8712d80 100644 --- a/src/emu/sound/k056800.h +++ b/src/emu/sound/k056800.h @@ -23,7 +23,26 @@ struct _k056800_interface k056800_irq_cb irq_cb; }; -DECLARE_LEGACY_DEVICE(K056800, k056800); +class k056800_device : public device_t +{ +public: + k056800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k056800_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K056800; + /*************************************************************************** diff --git a/src/emu/sound/mos6560.c b/src/emu/sound/mos6560.c index 3cc30c4b18c..a78c45c4062 100644 --- a/src/emu/sound/mos6560.c +++ b/src/emu/sound/mos6560.c @@ -125,7 +125,7 @@ INLINE mos6560_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == MOS656X); - return (mos6560_state *)downcast<legacy_device_base *>(device)->token(); + return (mos6560_state *)downcast<mos6560_device *>(device)->token(); } INLINE const mos6560_interface *get_interface( device_t *device ) @@ -970,4 +970,51 @@ DEVICE_GET_INFO(mos6560) } } -DEFINE_LEGACY_SOUND_DEVICE(MOS656X, mos6560); +const device_type MOS656X = &device_creator<mos6560_device>; + +mos6560_device::mos6560_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MOS656X, "MOS 6560 / 6561 VIC", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mos6560_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mos6560_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mos6560_device::device_start() +{ + DEVICE_START_NAME( mos6560 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mos6560_device::device_reset() +{ + DEVICE_RESET_NAME( mos6560 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void mos6560_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/mos6560.h b/src/emu/sound/mos6560.h index 9892b4805a3..2ec7c785d8e 100644 --- a/src/emu/sound/mos6560.h +++ b/src/emu/sound/mos6560.h @@ -88,7 +88,30 @@ struct _mos6560_interface INFO PROTOTYPES ***************************************************************************/ -DECLARE_LEGACY_SOUND_DEVICE(MOS656X, mos6560); +class mos6560_device : public device_t, + public device_sound_interface +{ +public: + mos6560_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mos6560_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type MOS656X; + /*************************************************************************** DEVICE CONFIGURATION MACROS diff --git a/src/emu/sound/msm5205.c b/src/emu/sound/msm5205.c index 6ff6ffef440..25f5317f4ed 100644 --- a/src/emu/sound/msm5205.c +++ b/src/emu/sound/msm5205.c @@ -74,7 +74,7 @@ INLINE msm5205_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == MSM5205); - return (msm5205_state *)downcast<legacy_device_base *>(device)->token(); + return (msm5205_state *)downcast<msm5205_device *>(device)->token(); } @@ -377,5 +377,75 @@ DEVICE_GET_INFO( msm6585 ) } -DEFINE_LEGACY_SOUND_DEVICE(MSM5205, msm5205); -DEFINE_LEGACY_SOUND_DEVICE(MSM6585, msm6585); +const device_type MSM5205 = &device_creator<msm5205_device>; + +msm5205_device::msm5205_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSM5205, "MSM5205", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(msm5205_state)); +} +msm5205_device::msm5205_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(msm5205_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void msm5205_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void msm5205_device::device_start() +{ + DEVICE_START_NAME( msm5205 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void msm5205_device::device_reset() +{ + DEVICE_RESET_NAME( msm5205 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void msm5205_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type MSM6585 = &device_creator<msm6585_device>; + +msm6585_device::msm6585_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : msm5205_device(mconfig, MSM6585, "MSM6585", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void msm6585_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/msm5205.h b/src/emu/sound/msm5205.h index b84fd8eddd3..66de15e5f74 100644 --- a/src/emu/sound/msm5205.h +++ b/src/emu/sound/msm5205.h @@ -46,7 +46,41 @@ void msm5205_set_volume(device_t *device,int volume); void msm5205_change_clock_w(device_t *device, INT32 clock); -DECLARE_LEGACY_SOUND_DEVICE(MSM5205, msm5205); -DECLARE_LEGACY_SOUND_DEVICE(MSM6585, msm6585); +class msm5205_device : public device_t, + public device_sound_interface +{ +public: + msm5205_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + msm5205_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~msm5205_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type MSM5205; + +class msm6585_device : public msm5205_device +{ +public: + msm6585_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type MSM6585; + #endif /* __MSM5205_H__ */ diff --git a/src/emu/sound/msm5232.c b/src/emu/sound/msm5232.c index 6bd50975c71..6561c6f9161 100644 --- a/src/emu/sound/msm5232.c +++ b/src/emu/sound/msm5232.c @@ -78,7 +78,7 @@ INLINE msm5232_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == MSM5232); - return (msm5232_state *)downcast<legacy_device_base *>(device)->token(); + return (msm5232_state *)downcast<msm5232_device *>(device)->token(); } @@ -878,4 +878,60 @@ DEVICE_GET_INFO( msm5232 ) } -DEFINE_LEGACY_SOUND_DEVICE(MSM5232, msm5232); +const device_type MSM5232 = &device_creator<msm5232_device>; + +msm5232_device::msm5232_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSM5232, "MSM5232", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(msm5232_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void msm5232_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void msm5232_device::device_start() +{ + DEVICE_START_NAME( msm5232 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void msm5232_device::device_reset() +{ + DEVICE_RESET_NAME( msm5232 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void msm5232_device::device_stop() +{ + DEVICE_STOP_NAME( msm5232 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void msm5232_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/msm5232.h b/src/emu/sound/msm5232.h index f1dfaccc08c..174109a8702 100644 --- a/src/emu/sound/msm5232.h +++ b/src/emu/sound/msm5232.h @@ -16,6 +16,30 @@ WRITE8_DEVICE_HANDLER( msm5232_w ); void msm5232_set_clock(device_t *device, int clock); -DECLARE_LEGACY_SOUND_DEVICE(MSM5232, msm5232); +class msm5232_device : public device_t, + public device_sound_interface +{ +public: + msm5232_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~msm5232_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type MSM5232; + #endif /* __MSM5232_H__ */ diff --git a/src/emu/sound/multipcm.c b/src/emu/sound/multipcm.c index 43c7a2b3a2f..b03d1bc604b 100644 --- a/src/emu/sound/multipcm.c +++ b/src/emu/sound/multipcm.c @@ -130,7 +130,7 @@ INLINE MultiPCM *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == MULTIPCM); - return (MultiPCM *)downcast<legacy_device_base *>(device)->token(); + return (MultiPCM *)downcast<multipcm_device *>(device)->token(); } @@ -700,4 +700,42 @@ DEVICE_GET_INFO( multipcm ) } -DEFINE_LEGACY_SOUND_DEVICE(MULTIPCM, multipcm); +const device_type MULTIPCM = &device_creator<multipcm_device>; + +multipcm_device::multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MULTIPCM, "Sega/Yamaha 315-5560", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(MultiPCM)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void multipcm_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void multipcm_device::device_start() +{ + DEVICE_START_NAME( multipcm )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void multipcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/multipcm.h b/src/emu/sound/multipcm.h index f442aeb06ea..4beaa933ea0 100644 --- a/src/emu/sound/multipcm.h +++ b/src/emu/sound/multipcm.h @@ -10,6 +10,28 @@ READ8_DEVICE_HANDLER( multipcm_r ); void multipcm_set_bank(device_t *device, UINT32 leftoffs, UINT32 rightoffs); -DECLARE_LEGACY_SOUND_DEVICE(MULTIPCM, multipcm); +class multipcm_device : public device_t, + public device_sound_interface +{ +public: + multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~multipcm_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type MULTIPCM; + #endif /* __MULTIPCM_H__ */ diff --git a/src/emu/sound/n63701x.c b/src/emu/sound/n63701x.c index 0c0faae0b1b..0ab68ae368e 100644 --- a/src/emu/sound/n63701x.c +++ b/src/emu/sound/n63701x.c @@ -50,7 +50,7 @@ INLINE namco_63701x *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == NAMCO_63701X); - return (namco_63701x *)downcast<legacy_device_base *>(device)->token(); + return (namco_63701x *)downcast<namco_63701x_device *>(device)->token(); } @@ -185,4 +185,42 @@ DEVICE_GET_INFO( namco_63701x ) } -DEFINE_LEGACY_SOUND_DEVICE(NAMCO_63701X, namco_63701x); +const device_type NAMCO_63701X = &device_creator<namco_63701x_device>; + +namco_63701x_device::namco_63701x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO_63701X, "Namco 63701X", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_63701x)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_63701x_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namco_63701x_device::device_start() +{ + DEVICE_START_NAME( namco_63701x )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void namco_63701x_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/n63701x.h b/src/emu/sound/n63701x.h index c6c0f57cbc4..813c2b73263 100644 --- a/src/emu/sound/n63701x.h +++ b/src/emu/sound/n63701x.h @@ -7,6 +7,28 @@ WRITE8_DEVICE_HANDLER( namco_63701x_w ); -DECLARE_LEGACY_SOUND_DEVICE(NAMCO_63701X, namco_63701x); +class namco_63701x_device : public device_t, + public device_sound_interface +{ +public: + namco_63701x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~namco_63701x_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO_63701X; + #endif /* __N63701X_H__ */ diff --git a/src/emu/sound/namco.c b/src/emu/sound/namco.c index baf66ed1042..b255309a3d3 100644 --- a/src/emu/sound/namco.c +++ b/src/emu/sound/namco.c @@ -80,7 +80,7 @@ INLINE namco_sound *get_safe_token(device_t *device) assert(device->type() == NAMCO || device->type() == NAMCO_15XX || device->type() == NAMCO_CUS30); - return (namco_sound *)downcast<legacy_device_base *>(device)->token(); + return (namco_sound *)downcast<namco_device *>(device)->token(); } /* update the decoded waveform data */ @@ -891,6 +891,62 @@ DEVICE_GET_INFO( namco_cus30 ) } -DEFINE_LEGACY_SOUND_DEVICE(NAMCO, namco); -DEFINE_LEGACY_SOUND_DEVICE(NAMCO_15XX, namco_15xx); -DEFINE_LEGACY_SOUND_DEVICE(NAMCO_CUS30, namco_cus30); +const device_type NAMCO = &device_creator<namco_device>; + +namco_device::namco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO, "Namco", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_sound)); +} + +namco_device::namco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_sound)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namco_device::device_start() +{ + DEVICE_START_NAME( namco )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void namco_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type NAMCO_15XX = &device_creator<namco_15xx_device>; + +namco_15xx_device::namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : namco_device(mconfig, NAMCO_15XX, "Namco 15XX", tag, owner, clock) +{ +} + +const device_type NAMCO_CUS30 = &device_creator<namco_cus30_device>; + +namco_cus30_device::namco_cus30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : namco_device(mconfig, NAMCO_CUS30, "Namco CUS30", tag, owner, clock) +{ +} diff --git a/src/emu/sound/namco.h b/src/emu/sound/namco.h index 533abb06cc6..7fceb1b4fe9 100644 --- a/src/emu/sound/namco.h +++ b/src/emu/sound/namco.h @@ -27,9 +27,46 @@ READ8_DEVICE_HANDLER( namcos1_cus30_r ); READ8_DEVICE_HANDLER( namco_snd_sharedram_r ); WRITE8_DEVICE_HANDLER( namco_snd_sharedram_w ); -DECLARE_LEGACY_SOUND_DEVICE(NAMCO, namco); -DECLARE_LEGACY_SOUND_DEVICE(NAMCO_15XX, namco_15xx); -DECLARE_LEGACY_SOUND_DEVICE(NAMCO_CUS30, namco_cus30); +class namco_device : public device_t, + public device_sound_interface +{ +public: + namco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + namco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~namco_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO; + +class namco_15xx_device : public namco_device +{ +public: + namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type NAMCO_15XX; + +class namco_cus30_device : public namco_device +{ +public: + namco_cus30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type NAMCO_CUS30; + #endif /* __NAMCO_H__ */ diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c index da1576fd5d0..d42e8bfa572 100644 --- a/src/emu/sound/nes_apu.c +++ b/src/emu/sound/nes_apu.c @@ -75,7 +75,7 @@ INLINE nesapu_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == NES); - return (nesapu_state *)downcast<legacy_device_base *>(device)->token(); + return (nesapu_state *)downcast<nesapu_device *>(device)->token(); } /* INTERNAL FUNCTIONS */ @@ -792,4 +792,42 @@ DEVICE_GET_INFO( nesapu ) } -DEFINE_LEGACY_SOUND_DEVICE(NES, nesapu); +const device_type NES = &device_creator<nesapu_device>; + +nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NES, "N2A03", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(nesapu_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void nesapu_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void nesapu_device::device_start() +{ + DEVICE_START_NAME( nesapu )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void nesapu_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/nes_apu.h b/src/emu/sound/nes_apu.h index 994d3d273f8..6c767172c7a 100644 --- a/src/emu/sound/nes_apu.h +++ b/src/emu/sound/nes_apu.h @@ -46,6 +46,28 @@ struct _nes_interface READ8_DEVICE_HANDLER( nes_psg_r ); WRITE8_DEVICE_HANDLER( nes_psg_w ); -DECLARE_LEGACY_SOUND_DEVICE(NES, nesapu); +class nesapu_device : public device_t, + public device_sound_interface +{ +public: + nesapu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~nesapu_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type NES; + #endif /* __NES_APU_H__ */ diff --git a/src/emu/sound/nile.c b/src/emu/sound/nile.c index 3ef19009fdb..da61d1b6431 100644 --- a/src/emu/sound/nile.c +++ b/src/emu/sound/nile.c @@ -65,7 +65,7 @@ INLINE nile_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == NILE); - return (nile_state *)downcast<legacy_device_base *>(device)->token(); + return (nile_state *)downcast<nile_device *>(device)->token(); } @@ -258,4 +258,42 @@ DEVICE_GET_INFO( nile ) } -DEFINE_LEGACY_SOUND_DEVICE(NILE, nile); +const device_type NILE = &device_creator<nile_device>; + +nile_device::nile_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NILE, "NiLe", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(nile_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void nile_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void nile_device::device_start() +{ + DEVICE_START_NAME( nile )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void nile_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/nile.h b/src/emu/sound/nile.h index 49a96e79715..b378ba476e3 100644 --- a/src/emu/sound/nile.h +++ b/src/emu/sound/nile.h @@ -10,6 +10,28 @@ READ16_DEVICE_HANDLER( nile_snd_r ); WRITE16_DEVICE_HANDLER( nile_sndctrl_w ); READ16_DEVICE_HANDLER( nile_sndctrl_r ); -DECLARE_LEGACY_SOUND_DEVICE(NILE, nile); +class nile_device : public device_t, + public device_sound_interface +{ +public: + nile_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~nile_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type NILE; + #endif /* __NILE_H__ */ diff --git a/src/emu/sound/okim6258.c b/src/emu/sound/okim6258.c index aa939cc3fe2..2ac8ef908e9 100644 --- a/src/emu/sound/okim6258.c +++ b/src/emu/sound/okim6258.c @@ -52,7 +52,7 @@ INLINE okim6258_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == OKIM6258); - return (okim6258_state *)downcast<legacy_device_base *>(device)->token(); + return (okim6258_state *)downcast<okim6258_device *>(device)->token(); } /********************************************************************************************** @@ -381,4 +381,51 @@ DEVICE_GET_INFO( okim6258 ) } -DEFINE_LEGACY_SOUND_DEVICE(OKIM6258, okim6258); +const device_type OKIM6258 = &device_creator<okim6258_device>; + +okim6258_device::okim6258_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, OKIM6258, "OKI6258", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(okim6258_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void okim6258_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void okim6258_device::device_start() +{ + DEVICE_START_NAME( okim6258 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void okim6258_device::device_reset() +{ + DEVICE_RESET_NAME( okim6258 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void okim6258_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/okim6258.h b/src/emu/sound/okim6258.h index 37a0ef35cd3..bbed3a960ce 100644 --- a/src/emu/sound/okim6258.h +++ b/src/emu/sound/okim6258.h @@ -34,6 +34,29 @@ READ8_DEVICE_HANDLER( okim6258_status_r ); WRITE8_DEVICE_HANDLER( okim6258_data_w ); WRITE8_DEVICE_HANDLER( okim6258_ctrl_w ); -DECLARE_LEGACY_SOUND_DEVICE(OKIM6258, okim6258); +class okim6258_device : public device_t, + public device_sound_interface +{ +public: + okim6258_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~okim6258_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type OKIM6258; + #endif /* __OKIM6258_H__ */ diff --git a/src/emu/sound/okim6376.c b/src/emu/sound/okim6376.c index e5e37a2ec4f..1a63d21d220 100644 --- a/src/emu/sound/okim6376.c +++ b/src/emu/sound/okim6376.c @@ -91,7 +91,7 @@ INLINE okim6376_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == OKIM6376); - return (okim6376_state *)downcast<legacy_device_base *>(device)->token(); + return (okim6376_state *)downcast<okim6376_device *>(device)->token(); } @@ -646,4 +646,51 @@ DEVICE_GET_INFO( okim6376 ) } -DEFINE_LEGACY_SOUND_DEVICE(OKIM6376, okim6376); +const device_type OKIM6376 = &device_creator<okim6376_device>; + +okim6376_device::okim6376_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, OKIM6376, "OKI6376", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(okim6376_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void okim6376_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void okim6376_device::device_start() +{ + DEVICE_START_NAME( okim6376 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void okim6376_device::device_reset() +{ + DEVICE_RESET_NAME( okim6376 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void okim6376_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/okim6376.h b/src/emu/sound/okim6376.h index 222ee7e47a8..003bcd14fc1 100644 --- a/src/emu/sound/okim6376.h +++ b/src/emu/sound/okim6376.h @@ -10,7 +10,30 @@ READ8_DEVICE_HANDLER( okim6376_r ); WRITE8_DEVICE_HANDLER( okim6376_w ); -DECLARE_LEGACY_SOUND_DEVICE(OKIM6376, okim6376); +class okim6376_device : public device_t, + public device_sound_interface +{ +public: + okim6376_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~okim6376_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type OKIM6376; + WRITE_LINE_DEVICE_HANDLER( okim6376_st_w ); WRITE_LINE_DEVICE_HANDLER( okim6376_ch2_w ); diff --git a/src/emu/sound/qsound.c b/src/emu/sound/qsound.c index cc08776aca6..f691fdd3c22 100644 --- a/src/emu/sound/qsound.c +++ b/src/emu/sound/qsound.c @@ -91,7 +91,7 @@ INLINE qsound_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == QSOUND); - return (qsound_state *)downcast<legacy_device_base *>(device)->token(); + return (qsound_state *)downcast<qsound_device *>(device)->token(); } @@ -399,4 +399,51 @@ DEVICE_GET_INFO( qsound ) /**************** end of file ****************/ -DEFINE_LEGACY_SOUND_DEVICE(QSOUND, qsound); +const device_type QSOUND = &device_creator<qsound_device>; + +qsound_device::qsound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, QSOUND, "Q-Sound", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(qsound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void qsound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void qsound_device::device_start() +{ + DEVICE_START_NAME( qsound )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void qsound_device::device_stop() +{ + DEVICE_STOP_NAME( qsound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void qsound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/qsound.h b/src/emu/sound/qsound.h index d1a04650f55..bfc274d461a 100644 --- a/src/emu/sound/qsound.h +++ b/src/emu/sound/qsound.h @@ -16,6 +16,29 @@ WRITE8_DEVICE_HANDLER( qsound_w ); READ8_DEVICE_HANDLER( qsound_r ); -DECLARE_LEGACY_SOUND_DEVICE(QSOUND, qsound); +class qsound_device : public device_t, + public device_sound_interface +{ +public: + qsound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~qsound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type QSOUND; + #endif /* __QSOUND_H__ */ diff --git a/src/emu/sound/rf5c400.c b/src/emu/sound/rf5c400.c index 45ef99a622e..75e2d9f2217 100644 --- a/src/emu/sound/rf5c400.c +++ b/src/emu/sound/rf5c400.c @@ -97,7 +97,7 @@ INLINE rf5c400_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == RF5C400); - return (rf5c400_state *)downcast<legacy_device_base *>(device)->token(); + return (rf5c400_state *)downcast<rf5c400_device *>(device)->token(); } @@ -583,4 +583,42 @@ DEVICE_GET_INFO( rf5c400 ) } } -DEFINE_LEGACY_SOUND_DEVICE(RF5C400, rf5c400); +const device_type RF5C400 = &device_creator<rf5c400_device>; + +rf5c400_device::rf5c400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, RF5C400, "RF5C400", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(rf5c400_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void rf5c400_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void rf5c400_device::device_start() +{ + DEVICE_START_NAME( rf5c400 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void rf5c400_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/rf5c400.h b/src/emu/sound/rf5c400.h index e5db5809b76..34b5a66e3fd 100644 --- a/src/emu/sound/rf5c400.h +++ b/src/emu/sound/rf5c400.h @@ -10,6 +10,28 @@ READ16_DEVICE_HANDLER( rf5c400_r ); WRITE16_DEVICE_HANDLER( rf5c400_w ); -DECLARE_LEGACY_SOUND_DEVICE(RF5C400, rf5c400); +class rf5c400_device : public device_t, + public device_sound_interface +{ +public: + rf5c400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~rf5c400_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type RF5C400; + #endif /* __RF5C400_H__ */ diff --git a/src/emu/sound/rf5c68.c b/src/emu/sound/rf5c68.c index 40eeab04fbd..756f2b23189 100644 --- a/src/emu/sound/rf5c68.c +++ b/src/emu/sound/rf5c68.c @@ -40,7 +40,7 @@ INLINE rf5c68_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == RF5C68); - return (rf5c68_state *)downcast<legacy_device_base *>(device)->token(); + return (rf5c68_state *)downcast<rf5c68_device *>(device)->token(); } @@ -287,4 +287,42 @@ DEVICE_GET_INFO( rf5c68 ) /**************** end of file ****************/ -DEFINE_LEGACY_SOUND_DEVICE(RF5C68, rf5c68); +const device_type RF5C68 = &device_creator<rf5c68_device>; + +rf5c68_device::rf5c68_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, RF5C68, "RF5C68", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(rf5c68_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void rf5c68_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void rf5c68_device::device_start() +{ + DEVICE_START_NAME( rf5c68 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void rf5c68_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/rf5c68.h b/src/emu/sound/rf5c68.h index 9082083df8c..a738d42032b 100644 --- a/src/emu/sound/rf5c68.h +++ b/src/emu/sound/rf5c68.h @@ -22,6 +22,28 @@ struct _rf5c68_interface void (*sample_end_callback)(device_t* device, int channel); }; -DECLARE_LEGACY_SOUND_DEVICE(RF5C68, rf5c68); +class rf5c68_device : public device_t, + public device_sound_interface +{ +public: + rf5c68_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~rf5c68_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type RF5C68; + #endif /* __RF5C68_H__ */ diff --git a/src/emu/sound/s14001a.c b/src/emu/sound/s14001a.c index c75f10a3b0d..17f46bbe09a 100644 --- a/src/emu/sound/s14001a.c +++ b/src/emu/sound/s14001a.c @@ -268,7 +268,7 @@ INLINE S14001AChip *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == S14001A); - return (S14001AChip *)downcast<legacy_device_base *>(device)->token(); + return (S14001AChip *)downcast<s14001a_device *>(device)->token(); } @@ -648,4 +648,42 @@ DEVICE_GET_INFO( s14001a ) } } -DEFINE_LEGACY_SOUND_DEVICE(S14001A, s14001a); +const device_type S14001A = &device_creator<s14001a_device>; + +s14001a_device::s14001a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, S14001A, "S14001A", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(S14001AChip)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void s14001a_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void s14001a_device::device_start() +{ + DEVICE_START_NAME( s14001a )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void s14001a_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/s14001a.h b/src/emu/sound/s14001a.h index 62ebfa22eaa..70fcb5c2d11 100644 --- a/src/emu/sound/s14001a.h +++ b/src/emu/sound/s14001a.h @@ -11,7 +11,29 @@ void s14001a_rst_w(device_t *device, int data); /* write to RESET pin */ void s14001a_set_clock(device_t *device, int clock); /* set VSU-1000 clock */ void s14001a_set_volume(device_t *device, int volume); /* set VSU-1000 volume control */ -DECLARE_LEGACY_SOUND_DEVICE(S14001A, s14001a); +class s14001a_device : public device_t, + public device_sound_interface +{ +public: + s14001a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~s14001a_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type S14001A; + #endif /* __S14001A_H__ */ diff --git a/src/emu/sound/s2636.c b/src/emu/sound/s2636.c index baeb1b7f487..1fd7ad08658 100644 --- a/src/emu/sound/s2636.c +++ b/src/emu/sound/s2636.c @@ -22,7 +22,7 @@ static s2636_sound *get_token(device_t *device) { assert(device != NULL); assert(device->type() == S2636_SOUND); - return (s2636_sound *) downcast<legacy_device_base *>(device)->token(); + return (s2636_sound *) downcast<s2636_sound_device *>(device)->token(); } @@ -99,4 +99,42 @@ DEVICE_GET_INFO( s2636_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(S2636_SOUND, s2636_sound); +const device_type S2636_SOUND = &device_creator<s2636_sound_device>; + +s2636_sound_device::s2636_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, S2636_SOUND, "S2636", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(s2636_sound)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void s2636_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void s2636_sound_device::device_start() +{ + DEVICE_START_NAME( s2636_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void s2636_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/s2636.h b/src/emu/sound/s2636.h index f742660212b..3889e3c6cb6 100644 --- a/src/emu/sound/s2636.h +++ b/src/emu/sound/s2636.h @@ -9,7 +9,29 @@ -DECLARE_LEGACY_SOUND_DEVICE(S2636_SOUND, s2636_sound); +class s2636_sound_device : public device_t, + public device_sound_interface +{ +public: + s2636_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~s2636_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type S2636_SOUND; + void s2636_soundport_w (device_t *device, int mode, int data); diff --git a/src/emu/sound/saa1099.c b/src/emu/sound/saa1099.c index f93f1639247..b85a062905a 100644 --- a/src/emu/sound/saa1099.c +++ b/src/emu/sound/saa1099.c @@ -171,7 +171,7 @@ INLINE saa1099_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SAA1099); - return (saa1099_state *)downcast<legacy_device_base *>(device)->token(); + return (saa1099_state *)downcast<saa1099_device *>(device)->token(); } @@ -463,4 +463,42 @@ DEVICE_GET_INFO( saa1099 ) } -DEFINE_LEGACY_SOUND_DEVICE(SAA1099, saa1099); +const device_type SAA1099 = &device_creator<saa1099_device>; + +saa1099_device::saa1099_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SAA1099, "SAA1099", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(saa1099_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void saa1099_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void saa1099_device::device_start() +{ + DEVICE_START_NAME( saa1099 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void saa1099_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/saa1099.h b/src/emu/sound/saa1099.h index a07db979a76..e24ef538777 100644 --- a/src/emu/sound/saa1099.h +++ b/src/emu/sound/saa1099.h @@ -12,6 +12,28 @@ WRITE8_DEVICE_HANDLER( saa1099_control_w ); WRITE8_DEVICE_HANDLER( saa1099_data_w ); -DECLARE_LEGACY_SOUND_DEVICE(SAA1099, saa1099); +class saa1099_device : public device_t, + public device_sound_interface +{ +public: + saa1099_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~saa1099_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SAA1099; + #endif /* __SAA1099_H__ */ diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index f575c258be9..a324bcb0dd9 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -253,7 +253,7 @@ INLINE scsp_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SCSP); - return (scsp_state *)downcast<legacy_device_base *>(device)->token(); + return (scsp_state *)downcast<scsp_device *>(device)->token(); } static unsigned char DecodeSCI(scsp_state *scsp,unsigned char irq) @@ -1387,4 +1387,42 @@ DEVICE_GET_INFO( scsp ) } -DEFINE_LEGACY_SOUND_DEVICE(SCSP, scsp); +const device_type SCSP = &device_creator<scsp_device>; + +scsp_device::scsp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SCSP, "SCSP", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(scsp_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void scsp_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void scsp_device::device_start() +{ + DEVICE_START_NAME( scsp )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void scsp_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/scsp.h b/src/emu/sound/scsp.h index 95795f2ca8b..3fb6aed0ac6 100644 --- a/src/emu/sound/scsp.h +++ b/src/emu/sound/scsp.h @@ -29,6 +29,28 @@ READ16_DEVICE_HANDLER( scsp_midi_out_r ); extern UINT32* stv_scu; -DECLARE_LEGACY_SOUND_DEVICE(SCSP, scsp); +class scsp_device : public device_t, + public device_sound_interface +{ +public: + scsp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~scsp_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SCSP; + #endif /* __SCSP_H__ */ diff --git a/src/emu/sound/segapcm.c b/src/emu/sound/segapcm.c index 7f6f7054748..4e975f19be8 100644 --- a/src/emu/sound/segapcm.c +++ b/src/emu/sound/segapcm.c @@ -21,7 +21,7 @@ INLINE segapcm_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SEGAPCM); - return (segapcm_state *)downcast<legacy_device_base *>(device)->token(); + return (segapcm_state *)downcast<segapcm_device *>(device)->token(); } static STREAM_UPDATE( SEGAPCM_update ) @@ -176,4 +176,42 @@ DEVICE_GET_INFO( segapcm ) } -DEFINE_LEGACY_SOUND_DEVICE(SEGAPCM, segapcm); +const device_type SEGAPCM = &device_creator<segapcm_device>; + +segapcm_device::segapcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SEGAPCM, "Sega PCM", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(segapcm_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void segapcm_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void segapcm_device::device_start() +{ + DEVICE_START_NAME( segapcm )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void segapcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/segapcm.h b/src/emu/sound/segapcm.h index c3b0998ee7f..2190d6a612f 100644 --- a/src/emu/sound/segapcm.h +++ b/src/emu/sound/segapcm.h @@ -25,6 +25,28 @@ struct _sega_pcm_interface WRITE8_DEVICE_HANDLER( sega_pcm_w ); READ8_DEVICE_HANDLER( sega_pcm_r ); -DECLARE_LEGACY_SOUND_DEVICE(SEGAPCM, segapcm); +class segapcm_device : public device_t, + public device_sound_interface +{ +public: + segapcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~segapcm_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SEGAPCM; + #endif /* __SEGAPCM_H__ */ diff --git a/src/emu/sound/sid6581.c b/src/emu/sound/sid6581.c index 86089282321..d80e5ca7bbf 100644 --- a/src/emu/sound/sid6581.c +++ b/src/emu/sound/sid6581.c @@ -16,7 +16,7 @@ static _SID6581 *get_sid(device_t *device) { assert(device != NULL); assert((device->type() == SID6581) || (device->type() == SID8580)); - return (_SID6581 *) downcast<legacy_device_base *>(device)->token(); + return (_SID6581 *) downcast<sid6581_device *>(device)->token(); } @@ -125,5 +125,84 @@ DEVICE_GET_INFO( sid8580 ) } -DEFINE_LEGACY_SOUND_DEVICE(SID6581, sid6581); -DEFINE_LEGACY_SOUND_DEVICE(SID8580, sid8580); +const device_type SID6581 = &device_creator<sid6581_device>; + +sid6581_device::sid6581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SID6581, "SID6581", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(_SID6581)); +} +sid6581_device::sid6581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(_SID6581)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void sid6581_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sid6581_device::device_start() +{ + DEVICE_START_NAME( sid6581 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void sid6581_device::device_reset() +{ + DEVICE_RESET_NAME( sid )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sid6581_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type SID8580 = &device_creator<sid8580_device>; + +sid8580_device::sid8580_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sid6581_device(mconfig, SID8580, "SID8580", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sid8580_device::device_start() +{ + DEVICE_START_NAME( sid8580 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sid8580_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/sid6581.h b/src/emu/sound/sid6581.h index d73b2a43f57..ba6e74d6d7e 100644 --- a/src/emu/sound/sid6581.h +++ b/src/emu/sound/sid6581.h @@ -34,7 +34,44 @@ struct _sid6581_interface READ8_DEVICE_HANDLER ( sid6581_r ); WRITE8_DEVICE_HANDLER ( sid6581_w ); -DECLARE_LEGACY_SOUND_DEVICE(SID6581, sid6581); -DECLARE_LEGACY_SOUND_DEVICE(SID8580, sid8580); +class sid6581_device : public device_t, + public device_sound_interface +{ +public: + sid6581_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + sid6581_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~sid6581_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SID6581; + +class sid8580_device : public sid6581_device +{ +public: + sid8580_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type SID8580; + #endif /* __SID6581_H__ */ diff --git a/src/emu/sound/sn76477.c b/src/emu/sound/sn76477.c index ab38fd5a615..a893af0a0a3 100644 --- a/src/emu/sound/sn76477.c +++ b/src/emu/sound/sn76477.c @@ -264,7 +264,7 @@ INLINE sn76477_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SN76477); - return (sn76477_state *)downcast<legacy_device_base *>(device)->token(); + return (sn76477_state *)downcast<sn76477_device *>(device)->token(); } @@ -2484,4 +2484,51 @@ DEVICE_GET_INFO( sn76477 ) } -DEFINE_LEGACY_SOUND_DEVICE(SN76477, sn76477); +const device_type SN76477 = &device_creator<sn76477_device>; + +sn76477_device::sn76477_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SN76477, "SN76477", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(sn76477_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void sn76477_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sn76477_device::device_start() +{ + DEVICE_START_NAME( sn76477 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void sn76477_device::device_stop() +{ + DEVICE_STOP_NAME( sn76477 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sn76477_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/sn76477.h b/src/emu/sound/sn76477.h index 6ca57935202..e6bd30bcd2d 100644 --- a/src/emu/sound/sn76477.h +++ b/src/emu/sound/sn76477.h @@ -125,6 +125,29 @@ void sn76477_attack_decay_cap_voltage_w(device_t *device, double data); void sn76477_vco_voltage_w(device_t *device, double data); void sn76477_pitch_voltage_w(device_t *device, double data); -DECLARE_LEGACY_SOUND_DEVICE(SN76477, sn76477); +class sn76477_device : public device_t, + public device_sound_interface +{ +public: + sn76477_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~sn76477_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SN76477; + #endif/* __SN76477_H__ */ diff --git a/src/emu/sound/sn76496.c b/src/emu/sound/sn76496.c index 9aa05ef9409..722bdfa6ab9 100644 --- a/src/emu/sound/sn76496.c +++ b/src/emu/sound/sn76496.c @@ -160,7 +160,7 @@ INLINE sn76496_state *get_safe_token(device_t *device) device->type() == NCR7496 || device->type() == GAMEGEAR || device->type() == SEGAPSG); - return (sn76496_state *)downcast<legacy_device_base *>(device)->token(); + return (sn76496_state *)downcast<sn76496_device *>(device)->token(); } READ_LINE_DEVICE_HANDLER( sn76496_ready_r ) @@ -603,16 +603,294 @@ DEVICE_GET_INFO( segapsg ) } -DEFINE_LEGACY_SOUND_DEVICE(SN76496, sn76496); -DEFINE_LEGACY_SOUND_DEVICE(U8106, u8106); -DEFINE_LEGACY_SOUND_DEVICE(Y2404, y2404); -DEFINE_LEGACY_SOUND_DEVICE(SN76489, sn76489); -DEFINE_LEGACY_SOUND_DEVICE(SN76489A, sn76489a); -DEFINE_LEGACY_SOUND_DEVICE(SN76494, sn76494); -DEFINE_LEGACY_SOUND_DEVICE(SN94624, sn94624); -DEFINE_LEGACY_SOUND_DEVICE(NCR7496, ncr7496); -DEFINE_LEGACY_SOUND_DEVICE(GAMEGEAR, gamegear); -DEFINE_LEGACY_SOUND_DEVICE(SEGAPSG, segapsg); +const device_type SN76496 = &device_creator<sn76496_device>; + +sn76496_device::sn76496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SN76496, "SN76496", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(sn76496_state)); +} +sn76496_device::sn76496_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(sn76496_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void sn76496_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sn76496_device::device_start() +{ + DEVICE_START_NAME( sn76496 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sn76496_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type U8106 = &device_creator<u8106_device>; + +u8106_device::u8106_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sn76496_device(mconfig, U8106, "U8106", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void u8106_device::device_start() +{ + DEVICE_START_NAME( u8106 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void u8106_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type Y2404 = &device_creator<y2404_device>; + +y2404_device::y2404_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sn76496_device(mconfig, Y2404, "Y2404", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void y2404_device::device_start() +{ + DEVICE_START_NAME( y2404 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void y2404_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type SN76489 = &device_creator<sn76489_device>; + +sn76489_device::sn76489_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sn76496_device(mconfig, SN76489, "SN76489", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sn76489_device::device_start() +{ + DEVICE_START_NAME( sn76489 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sn76489_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type SN76489A = &device_creator<sn76489a_device>; + +sn76489a_device::sn76489a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sn76496_device(mconfig, SN76489A, "SN76489A", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sn76489a_device::device_start() +{ + DEVICE_START_NAME( sn76489a )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sn76489a_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type SN76494 = &device_creator<sn76494_device>; + +sn76494_device::sn76494_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sn76496_device(mconfig, SN76494, "SN76494", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sn76494_device::device_start() +{ + DEVICE_START_NAME( sn76494 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sn76494_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type SN94624 = &device_creator<sn94624_device>; + +sn94624_device::sn94624_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sn76496_device(mconfig, SN94624, "SN94624", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sn94624_device::device_start() +{ + DEVICE_START_NAME( sn94624 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sn94624_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type NCR7496 = &device_creator<ncr7496_device>; + +ncr7496_device::ncr7496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sn76496_device(mconfig, NCR7496, "NCR7496", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ncr7496_device::device_start() +{ + DEVICE_START_NAME( ncr7496 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ncr7496_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type GAMEGEAR = &device_creator<gamegear_device>; + +gamegear_device::gamegear_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sn76496_device(mconfig, GAMEGEAR, "Game Gear PSG", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gamegear_device::device_start() +{ + DEVICE_START_NAME( gamegear )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void gamegear_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type SEGAPSG = &device_creator<segapsg_device>; + +segapsg_device::segapsg_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sn76496_device(mconfig, SEGAPSG, "SEGA VDP PSG", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void segapsg_device::device_start() +{ + DEVICE_START_NAME( segapsg )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void segapsg_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + /***************************************************************** New class implementation diff --git a/src/emu/sound/sn76496.h b/src/emu/sound/sn76496.h index 1fa09f2a500..e42ebbc3d81 100644 --- a/src/emu/sound/sn76496.h +++ b/src/emu/sound/sn76496.h @@ -9,16 +9,156 @@ READ_LINE_DEVICE_HANDLER( sn76496_ready_r ); WRITE8_DEVICE_HANDLER( sn76496_w ); WRITE8_DEVICE_HANDLER( sn76496_stereo_w ); -DECLARE_LEGACY_SOUND_DEVICE(SN76496, sn76496); -DECLARE_LEGACY_SOUND_DEVICE(U8106, u8106); -DECLARE_LEGACY_SOUND_DEVICE(Y2404, y2404); -DECLARE_LEGACY_SOUND_DEVICE(SN76489, sn76489); -DECLARE_LEGACY_SOUND_DEVICE(SN76489A, sn76489a); -DECLARE_LEGACY_SOUND_DEVICE(SN76494, sn76494); -DECLARE_LEGACY_SOUND_DEVICE(SN94624, sn94624); -DECLARE_LEGACY_SOUND_DEVICE(NCR7496, ncr7496); -DECLARE_LEGACY_SOUND_DEVICE(GAMEGEAR, gamegear); -DECLARE_LEGACY_SOUND_DEVICE(SEGAPSG, segapsg); +class sn76496_device : public device_t, + public device_sound_interface +{ +public: + sn76496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + sn76496_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~sn76496_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SN76496; + +class u8106_device : public sn76496_device +{ +public: + u8106_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type U8106; + +class y2404_device : public sn76496_device +{ +public: + y2404_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type Y2404; + +class sn76489_device : public sn76496_device +{ +public: + sn76489_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type SN76489; + +class sn76489a_device : public sn76496_device +{ +public: + sn76489a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type SN76489A; + +class sn76494_device : public sn76496_device +{ +public: + sn76494_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type SN76494; + +class sn94624_device : public sn76496_device +{ +public: + sn94624_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type SN94624; + +class ncr7496_device : public sn76496_device +{ +public: + ncr7496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type NCR7496; + +class gamegear_device : public sn76496_device +{ +public: + gamegear_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type GAMEGEAR; + +class segapsg_device : public sn76496_device +{ +public: + segapsg_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type SEGAPSG; + /***************************************************************** New class implementation diff --git a/src/emu/sound/snkwave.c b/src/emu/sound/snkwave.c index 32d09bc167a..818af278f23 100644 --- a/src/emu/sound/snkwave.c +++ b/src/emu/sound/snkwave.c @@ -36,7 +36,7 @@ INLINE snkwave_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SNKWAVE); - return (snkwave_state *)downcast<legacy_device_base *>(device)->token(); + return (snkwave_state *)downcast<snkwave_device *>(device)->token(); } @@ -186,4 +186,42 @@ DEVICE_GET_INFO( snkwave ) } } -DEFINE_LEGACY_SOUND_DEVICE(SNKWAVE, snkwave); +const device_type SNKWAVE = &device_creator<snkwave_device>; + +snkwave_device::snkwave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SNKWAVE, "SNK Wave", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(snkwave_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void snkwave_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void snkwave_device::device_start() +{ + DEVICE_START_NAME( snkwave )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void snkwave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/snkwave.h b/src/emu/sound/snkwave.h index 44e1d163a75..2ed3a67048d 100644 --- a/src/emu/sound/snkwave.h +++ b/src/emu/sound/snkwave.h @@ -7,6 +7,28 @@ WRITE8_DEVICE_HANDLER( snkwave_w ); -DECLARE_LEGACY_SOUND_DEVICE(SNKWAVE, snkwave); +class snkwave_device : public device_t, + public device_sound_interface +{ +public: + snkwave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~snkwave_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SNKWAVE; + #endif /* __SNKWAVE_H__ */ diff --git a/src/emu/sound/sp0250.c b/src/emu/sound/sp0250.c index 32b9d06d47e..d32981c2803 100644 --- a/src/emu/sound/sp0250.c +++ b/src/emu/sound/sp0250.c @@ -60,7 +60,7 @@ INLINE sp0250_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SP0250); - return (sp0250_state *)downcast<legacy_device_base *>(device)->token(); + return (sp0250_state *)downcast<sp0250_device *>(device)->token(); } @@ -266,4 +266,42 @@ DEVICE_GET_INFO( sp0250 ) -DEFINE_LEGACY_SOUND_DEVICE(SP0250, sp0250); +const device_type SP0250 = &device_creator<sp0250_device>; + +sp0250_device::sp0250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SP0250, "SP0250", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(sp0250_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void sp0250_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sp0250_device::device_start() +{ + DEVICE_START_NAME( sp0250 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sp0250_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/sp0250.h b/src/emu/sound/sp0250.h index 4a125683d28..dba4d8dd6d5 100644 --- a/src/emu/sound/sp0250.h +++ b/src/emu/sound/sp0250.h @@ -12,6 +12,28 @@ struct sp0250_interface { WRITE8_DEVICE_HANDLER( sp0250_w ); UINT8 sp0250_drq_r(device_t *device); -DECLARE_LEGACY_SOUND_DEVICE(SP0250, sp0250); +class sp0250_device : public device_t, + public device_sound_interface +{ +public: + sp0250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~sp0250_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SP0250; + #endif /* __SP0250_H__ */ diff --git a/src/emu/sound/sp0256.c b/src/emu/sound/sp0256.c index 258623c30e3..1f5f155956b 100644 --- a/src/emu/sound/sp0256.c +++ b/src/emu/sound/sp0256.c @@ -135,7 +135,7 @@ INLINE sp0256_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SP0256); - return (sp0256_state *)downcast<legacy_device_base *>(device)->token(); + return (sp0256_state *)downcast<sp0256_device *>(device)->token(); } @@ -1390,4 +1390,51 @@ DEVICE_GET_INFO( sp0256 ) } -DEFINE_LEGACY_SOUND_DEVICE(SP0256, sp0256); +const device_type SP0256 = &device_creator<sp0256_device>; + +sp0256_device::sp0256_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SP0256, "SP0256", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(sp0256_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void sp0256_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sp0256_device::device_start() +{ + DEVICE_START_NAME( sp0256 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void sp0256_device::device_reset() +{ + DEVICE_RESET_NAME( sp0256 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sp0256_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/sp0256.h b/src/emu/sound/sp0256.h index 49f2719431d..f82dfc035b8 100644 --- a/src/emu/sound/sp0256.h +++ b/src/emu/sound/sp0256.h @@ -71,6 +71,29 @@ READ_LINE_DEVICE_HANDLER( sp0256_sby_r ); READ16_DEVICE_HANDLER( spb640_r ); WRITE16_DEVICE_HANDLER( spb640_w ); -DECLARE_LEGACY_SOUND_DEVICE(SP0256, sp0256); +class sp0256_device : public device_t, + public device_sound_interface +{ +public: + sp0256_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~sp0256_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SP0256; + #endif /* __SP0256_H__ */ diff --git a/src/emu/sound/speaker.c b/src/emu/sound/speaker.c index 25d5eb1b8be..1fae77f3b55 100644 --- a/src/emu/sound/speaker.c +++ b/src/emu/sound/speaker.c @@ -129,7 +129,7 @@ INLINE speaker_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SPEAKER_SOUND); - return (speaker_state *)downcast<legacy_device_base *>(device)->token(); + return (speaker_state *)downcast<speaker_sound_device *>(device)->token(); } @@ -444,4 +444,42 @@ DEVICE_GET_INFO( speaker_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(SPEAKER_SOUND, speaker_sound); +const device_type SPEAKER_SOUND = &device_creator<speaker_sound_device>; + +speaker_sound_device::speaker_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SPEAKER_SOUND, "Speaker", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(speaker_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void speaker_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void speaker_sound_device::device_start() +{ + DEVICE_START_NAME( speaker )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void speaker_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/speaker.h b/src/emu/sound/speaker.h index d1da4660665..2506cca15fe 100644 --- a/src/emu/sound/speaker.h +++ b/src/emu/sound/speaker.h @@ -24,6 +24,28 @@ struct _speaker_interface void speaker_level_w (device_t *device, int new_level); -DECLARE_LEGACY_SOUND_DEVICE(SPEAKER_SOUND, speaker_sound); +class speaker_sound_device : public device_t, + public device_sound_interface +{ +public: + speaker_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~speaker_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SPEAKER_SOUND; + #endif /* __SPEAKER_H__ */ diff --git a/src/emu/sound/st0016.c b/src/emu/sound/st0016.c index e67e235f9d5..739b5a6aa7d 100644 --- a/src/emu/sound/st0016.c +++ b/src/emu/sound/st0016.c @@ -22,7 +22,7 @@ INLINE st0016_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == ST0016); - return (st0016_state *)downcast<legacy_device_base *>(device)->token(); + return (st0016_state *)downcast<st0016_device *>(device)->token(); } @@ -173,4 +173,42 @@ DEVICE_GET_INFO( st0016 ) } -DEFINE_LEGACY_SOUND_DEVICE(ST0016, st0016); +const device_type ST0016 = &device_creator<st0016_device>; + +st0016_device::st0016_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ST0016, "ST0016", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(st0016_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void st0016_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void st0016_device::device_start() +{ + DEVICE_START_NAME( st0016 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void st0016_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/st0016.h b/src/emu/sound/st0016.h index 95203ffd2ba..cff9f2312e1 100644 --- a/src/emu/sound/st0016.h +++ b/src/emu/sound/st0016.h @@ -14,6 +14,28 @@ struct _st0016_interface READ8_DEVICE_HANDLER( st0016_snd_r ); WRITE8_DEVICE_HANDLER( st0016_snd_w ); -DECLARE_LEGACY_SOUND_DEVICE(ST0016, st0016); +class st0016_device : public device_t, + public device_sound_interface +{ +public: + st0016_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~st0016_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type ST0016; + #endif /* __ST0016_H__ */ diff --git a/src/emu/sound/t6w28.c b/src/emu/sound/t6w28.c index 8f03adaa0aa..ab1448c9f02 100644 --- a/src/emu/sound/t6w28.c +++ b/src/emu/sound/t6w28.c @@ -61,7 +61,7 @@ INLINE t6w28_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == T6W28); - return (t6w28_state *)downcast<legacy_device_base *>(device)->token(); + return (t6w28_state *)downcast<t6w28_device *>(device)->token(); } @@ -392,4 +392,42 @@ DEVICE_GET_INFO( t6w28 ) } -DEFINE_LEGACY_SOUND_DEVICE(T6W28, t6w28); +const device_type T6W28 = &device_creator<t6w28_device>; + +t6w28_device::t6w28_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, T6W28, "T6W28", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(t6w28_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void t6w28_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void t6w28_device::device_start() +{ + DEVICE_START_NAME( t6w28 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void t6w28_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/t6w28.h b/src/emu/sound/t6w28.h index ab73573d38c..528cd39feba 100644 --- a/src/emu/sound/t6w28.h +++ b/src/emu/sound/t6w28.h @@ -7,6 +7,28 @@ WRITE8_DEVICE_HANDLER( t6w28_w ); -DECLARE_LEGACY_SOUND_DEVICE(T6W28, t6w28); +class t6w28_device : public device_t, + public device_sound_interface +{ +public: + t6w28_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~t6w28_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type T6W28; + #endif /* __T6W28_H__ */ diff --git a/src/emu/sound/tiaintf.c b/src/emu/sound/tiaintf.c index 8c977c5c102..94114c80429 100644 --- a/src/emu/sound/tiaintf.c +++ b/src/emu/sound/tiaintf.c @@ -13,7 +13,7 @@ INLINE tia_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == TIA); - return (tia_state *)downcast<legacy_device_base *>(device)->token(); + return (tia_state *)downcast<tia_device *>(device)->token(); } @@ -76,4 +76,51 @@ DEVICE_GET_INFO( tia ) } -DEFINE_LEGACY_SOUND_DEVICE(TIA, tia); +const device_type TIA = &device_creator<tia_device>; + +tia_device::tia_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TIA, "TIA", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tia_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tia_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tia_device::device_start() +{ + DEVICE_START_NAME( tia )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void tia_device::device_stop() +{ + DEVICE_STOP_NAME( tia )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tia_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/tiaintf.h b/src/emu/sound/tiaintf.h index bb8b05cb1c1..6ce175789b4 100644 --- a/src/emu/sound/tiaintf.h +++ b/src/emu/sound/tiaintf.h @@ -7,6 +7,29 @@ WRITE8_DEVICE_HANDLER( tia_sound_w ); -DECLARE_LEGACY_SOUND_DEVICE(TIA, tia); +class tia_device : public device_t, + public device_sound_interface +{ +public: + tia_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tia_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type TIA; + #endif /* __TIAINTF_H__ */ diff --git a/src/emu/sound/tms3615.c b/src/emu/sound/tms3615.c index 5c263335fee..a051f965ae8 100644 --- a/src/emu/sound/tms3615.c +++ b/src/emu/sound/tms3615.c @@ -24,7 +24,7 @@ INLINE tms_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == TMS3615); - return (tms_state *)downcast<legacy_device_base *>(device)->token(); + return (tms_state *)downcast<tms3615_device *>(device)->token(); } @@ -120,4 +120,42 @@ DEVICE_GET_INFO( tms3615 ) } -DEFINE_LEGACY_SOUND_DEVICE(TMS3615, tms3615); +const device_type TMS3615 = &device_creator<tms3615_device>; + +tms3615_device::tms3615_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TMS3615, "TMS3615", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tms3615_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms3615_device::device_start() +{ + DEVICE_START_NAME( tms3615 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tms3615_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/tms3615.h b/src/emu/sound/tms3615.h index 294ce98c22d..c7645e00017 100644 --- a/src/emu/sound/tms3615.h +++ b/src/emu/sound/tms3615.h @@ -10,6 +10,28 @@ extern void tms3615_enable_w(device_t *device, int enable); #define TMS3615_FOOTAGE_8 0 #define TMS3615_FOOTAGE_16 1 -DECLARE_LEGACY_SOUND_DEVICE(TMS3615, tms3615); +class tms3615_device : public device_t, + public device_sound_interface +{ +public: + tms3615_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tms3615_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type TMS3615; + #endif /* __TMS3615_H__ */ diff --git a/src/emu/sound/tms36xx.c b/src/emu/sound/tms36xx.c index bf84ecb0a52..53057650aae 100644 --- a/src/emu/sound/tms36xx.c +++ b/src/emu/sound/tms36xx.c @@ -344,7 +344,7 @@ INLINE tms_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == TMS36XX); - return (tms_state *)downcast<legacy_device_base *>(device)->token(); + return (tms_state *)downcast<tms36xx_device *>(device)->token(); } @@ -552,4 +552,42 @@ DEVICE_GET_INFO( tms36xx ) } -DEFINE_LEGACY_SOUND_DEVICE(TMS36XX, tms36xx); +const device_type TMS36XX = &device_creator<tms36xx_device>; + +tms36xx_device::tms36xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TMS36XX, "TMS36XX", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tms36xx_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms36xx_device::device_start() +{ + DEVICE_START_NAME( tms36xx )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tms36xx_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/tms36xx.h b/src/emu/sound/tms36xx.h index 54baad6688b..a3cf9469820 100644 --- a/src/emu/sound/tms36xx.h +++ b/src/emu/sound/tms36xx.h @@ -28,6 +28,28 @@ extern void tms36xx_note_w(device_t *device, int octave, int note); /* TMS3617 interface functions */ extern void tms3617_enable_w(device_t *device, int enable); -DECLARE_LEGACY_SOUND_DEVICE(TMS36XX, tms36xx); +class tms36xx_device : public device_t, + public device_sound_interface +{ +public: + tms36xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tms36xx_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type TMS36XX; + #endif /* __TMS36XX_H__ */ diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c index 88e682c7895..95f209381b8 100644 --- a/src/emu/sound/tms5110.c +++ b/src/emu/sound/tms5110.c @@ -204,14 +204,14 @@ INLINE tms5110_state *get_safe_token(device_t *device) device->type() == TMC0281 || device->type() == CD2802 || device->type() == M58817); - return (tms5110_state *)downcast<legacy_device_base *>(device)->token(); + return (tms5110_state *)downcast<tms5110_device *>(device)->token(); } INLINE tmsprom_state *get_safe_token_prom(device_t *device) { assert(device != NULL); assert(device->type() == TMSPROM); - return (tmsprom_state *)downcast<legacy_device_base *>(device)->token(); + return (tmsprom_state *)downcast<tmsprom_device *>(device)->token(); } /* Static function prototypes */ @@ -1586,12 +1586,248 @@ DEVICE_GET_INFO(tmsprom) } } -DEFINE_LEGACY_SOUND_DEVICE(TMS5110, tms5110); -DEFINE_LEGACY_SOUND_DEVICE(TMS5100, tms5100); -DEFINE_LEGACY_SOUND_DEVICE(TMS5110A, tms5110a); -DEFINE_LEGACY_SOUND_DEVICE(CD2801, cd2801); -DEFINE_LEGACY_SOUND_DEVICE(TMC0281, tmc0281); -DEFINE_LEGACY_SOUND_DEVICE(CD2802, cd2802); -DEFINE_LEGACY_SOUND_DEVICE(M58817, m58817); +const device_type TMS5110 = &device_creator<tms5110_device>; + +tms5110_device::tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms5110_state)); +} +tms5110_device::tms5110_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms5110_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tms5110_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms5110_device::device_start() +{ + DEVICE_START_NAME( tms5110 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tms5110_device::device_reset() +{ + DEVICE_RESET_NAME( tms5110 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tms5110_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type TMS5100 = &device_creator<tms5100_device>; + +tms5100_device::tms5100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms5110_device(mconfig, TMS5100, "TMS5100", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms5100_device::device_start() +{ + DEVICE_START_NAME( tms5100 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tms5100_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type TMS5110A = &device_creator<tms5110a_device>; + +tms5110a_device::tms5110a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms5110_device(mconfig, TMS5110A, "TMS5110A", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms5110a_device::device_start() +{ + DEVICE_START_NAME( tms5110a )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tms5110a_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type CD2801 = &device_creator<cd2801_device>; + +cd2801_device::cd2801_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms5110_device(mconfig, CD2801, "CD2801", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cd2801_device::device_start() +{ + DEVICE_START_NAME( cd2801 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void cd2801_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type TMC0281 = &device_creator<tmc0281_device>; + +tmc0281_device::tmc0281_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms5110_device(mconfig, TMC0281, "TMC0281", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tmc0281_device::device_start() +{ + DEVICE_START_NAME( tmc0281 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tmc0281_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type CD2802 = &device_creator<cd2802_device>; + +cd2802_device::cd2802_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms5110_device(mconfig, CD2802, "CD2802", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cd2802_device::device_start() +{ + DEVICE_START_NAME( cd2802 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void cd2802_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type M58817 = &device_creator<m58817_device>; + +m58817_device::m58817_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms5110_device(mconfig, M58817, "M58817", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void m58817_device::device_start() +{ + DEVICE_START_NAME( m58817 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void m58817_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + + +const device_type TMSPROM = &device_creator<tmsprom_device>; + +tmsprom_device::tmsprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TMSPROM, "TMSPROM", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tmsprom_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tmsprom_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tmsprom_device::device_start() +{ + DEVICE_START_NAME( tmsprom )(this); +} + -DEFINE_LEGACY_DEVICE(TMSPROM, tmsprom); diff --git a/src/emu/sound/tms5110.h b/src/emu/sound/tms5110.h index 6b18ee19262..b4e5bf236ae 100644 --- a/src/emu/sound/tms5110.h +++ b/src/emu/sound/tms5110.h @@ -56,13 +56,115 @@ int tms5110_ready_r(device_t *device); void tms5110_set_frequency(device_t *device, int frequency); -DECLARE_LEGACY_SOUND_DEVICE(TMS5110, tms5110); -DECLARE_LEGACY_SOUND_DEVICE(TMS5100, tms5100); -DECLARE_LEGACY_SOUND_DEVICE(TMS5110A, tms5110a); -DECLARE_LEGACY_SOUND_DEVICE(CD2801, cd2801); -DECLARE_LEGACY_SOUND_DEVICE(TMC0281, tmc0281); -DECLARE_LEGACY_SOUND_DEVICE(CD2802, cd2802); -DECLARE_LEGACY_SOUND_DEVICE(M58817, m58817); +class tms5110_device : public device_t, + public device_sound_interface +{ +public: + tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + tms5110_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~tms5110_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type TMS5110; + +class tms5100_device : public tms5110_device +{ +public: + tms5100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type TMS5100; + +class tms5110a_device : public tms5110_device +{ +public: + tms5110a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type TMS5110A; + +class cd2801_device : public tms5110_device +{ +public: + cd2801_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type CD2801; + +class tmc0281_device : public tms5110_device +{ +public: + tmc0281_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type TMC0281; + +class cd2802_device : public tms5110_device +{ +public: + cd2802_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type CD2802; + +class m58817_device : public tms5110_device +{ +public: + m58817_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type M58817; + /* PROM controlled TMS5110 interface */ @@ -92,6 +194,24 @@ WRITE8_DEVICE_HANDLER( tmsprom_rom_csq_w ); WRITE8_DEVICE_HANDLER( tmsprom_bit_w ); WRITE_LINE_DEVICE_HANDLER( tmsprom_enable_w ); -DECLARE_LEGACY_DEVICE(TMSPROM, tmsprom); +class tmsprom_device : public device_t +{ +public: + tmsprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tmsprom_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type TMSPROM; + #endif /* __TMS5110_H__ */ diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c index d5ce8f19b05..2c8e5872c7e 100644 --- a/src/emu/sound/tms5220.c +++ b/src/emu/sound/tms5220.c @@ -472,7 +472,7 @@ INLINE tms5220_state *get_safe_token(device_t *device) device->type() == TMS5220C || device->type() == TMC0285 || device->type() == TMS5200); - return (tms5220_state *)downcast<legacy_device_base *>(device)->token(); + return (tms5220_state *)downcast<tms5220_device *>(device)->token(); } /* Static function prototypes */ @@ -2057,10 +2057,141 @@ DEVICE_GET_INFO(tms5200) } } -DEFINE_LEGACY_SOUND_DEVICE(TMS5220C, tms5220c); -DEFINE_LEGACY_SOUND_DEVICE(TMS5220, tms5220); -DEFINE_LEGACY_SOUND_DEVICE(TMC0285, tmc0285); -DEFINE_LEGACY_SOUND_DEVICE(TMS5200, tms5200); +const device_type TMS5220C = &device_creator<tms5220c_device>; + +tms5220c_device::tms5220c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms5220_device(mconfig, TMS5220C, "TMS5220C", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms5220c_device::device_start() +{ + DEVICE_START_NAME( tms5220c )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tms5220c_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type TMS5220 = &device_creator<tms5220_device>; + +tms5220_device::tms5220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TMS5220, "TMS5220", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms5220_state)); +} +tms5220_device::tms5220_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms5220_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tms5220_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms5220_device::device_start() +{ + DEVICE_START_NAME( tms5220 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tms5220_device::device_reset() +{ + DEVICE_RESET_NAME( tms5220 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tms5220_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type TMC0285 = &device_creator<tmc0285_device>; + +tmc0285_device::tmc0285_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms5220_device(mconfig, TMC0285, "TMC0285", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tmc0285_device::device_start() +{ + DEVICE_START_NAME( tmc0285 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tmc0285_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type TMS5200 = &device_creator<tms5200_device>; + +tms5200_device::tms5200_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms5220_device(mconfig, TMS5200, "TMS5200", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms5200_device::device_start() +{ + DEVICE_START_NAME( tms5200 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tms5200_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + /****************************************************************************** diff --git a/src/emu/sound/tms5220.h b/src/emu/sound/tms5220.h index cc58e663e07..dd571b7de7a 100644 --- a/src/emu/sound/tms5220.h +++ b/src/emu/sound/tms5220.h @@ -42,10 +42,73 @@ double tms5220_time_to_ready(device_t *device); void tms5220_set_frequency(device_t *device, int frequency); -DECLARE_LEGACY_SOUND_DEVICE(TMS5220C, tms5220c); -DECLARE_LEGACY_SOUND_DEVICE(TMS5220, tms5220); -DECLARE_LEGACY_SOUND_DEVICE(TMC0285, tmc0285); -DECLARE_LEGACY_SOUND_DEVICE(TMS5200, tms5200); +class tms5220_device : public device_t, + public device_sound_interface +{ +public: + tms5220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + tms5220_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~tms5220_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type TMS5220; + +class tms5220c_device : public tms5220_device +{ +public: + tms5220c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type TMS5220C; + +class tmc0285_device : public tms5220_device +{ +public: + tmc0285_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type TMC0285; + +class tms5200_device : public tms5220_device +{ +public: + tms5200_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type TMS5200; + /*************************************************************************** diff --git a/src/emu/sound/upd7759.c b/src/emu/sound/upd7759.c index 7f611dc3ef9..7061d8a2540 100644 --- a/src/emu/sound/upd7759.c +++ b/src/emu/sound/upd7759.c @@ -224,7 +224,7 @@ INLINE upd7759_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == UPD7759); - return (upd7759_state *)downcast<legacy_device_base *>(device)->token(); + return (upd7759_state *)downcast<upd7759_device *>(device)->token(); } @@ -767,4 +767,51 @@ DEVICE_GET_INFO( upd7759 ) } -DEFINE_LEGACY_SOUND_DEVICE(UPD7759, upd7759); +const device_type UPD7759 = &device_creator<upd7759_device>; + +upd7759_device::upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD7759, "UPD7759", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(upd7759_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void upd7759_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd7759_device::device_start() +{ + DEVICE_START_NAME( upd7759 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void upd7759_device::device_reset() +{ + DEVICE_RESET_NAME( upd7759 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void upd7759_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/upd7759.h b/src/emu/sound/upd7759.h index 9cae7e9b565..0e8ced82bec 100644 --- a/src/emu/sound/upd7759.h +++ b/src/emu/sound/upd7759.h @@ -25,6 +25,29 @@ void upd7759_start_w(device_t *device, UINT8 data); int upd7759_busy_r(device_t *device); WRITE8_DEVICE_HANDLER( upd7759_port_w ); -DECLARE_LEGACY_SOUND_DEVICE(UPD7759, upd7759); +class upd7759_device : public device_t, + public device_sound_interface +{ +public: + upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~upd7759_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type UPD7759; + #endif /* __UPD7759_H__ */ diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c index 05d69fc22b9..18eddd31591 100644 --- a/src/emu/sound/vlm5030.c +++ b/src/emu/sound/vlm5030.c @@ -214,7 +214,7 @@ INLINE vlm5030_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == VLM5030); - return (vlm5030_state *)downcast<legacy_device_base *>(device)->token(); + return (vlm5030_state *)downcast<vlm5030_device *>(device)->token(); } static int get_bits(vlm5030_state *chip, int sbit,int bits) @@ -715,4 +715,51 @@ DEVICE_GET_INFO( vlm5030 ) } -DEFINE_LEGACY_SOUND_DEVICE(VLM5030, vlm5030); +const device_type VLM5030 = &device_creator<vlm5030_device>; + +vlm5030_device::vlm5030_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VLM5030, "VLM5030", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(vlm5030_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vlm5030_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vlm5030_device::device_start() +{ + DEVICE_START_NAME( vlm5030 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void vlm5030_device::device_reset() +{ + DEVICE_RESET_NAME( vlm5030 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void vlm5030_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/vlm5030.h b/src/emu/sound/vlm5030.h index 2d1588f6780..f29105957b2 100644 --- a/src/emu/sound/vlm5030.h +++ b/src/emu/sound/vlm5030.h @@ -25,6 +25,29 @@ void vlm5030_vcu(device_t *device, int pin ); /* set ST pin level : set table address A0-A7 / start speech */ void vlm5030_st(device_t *device, int pin ); -DECLARE_LEGACY_SOUND_DEVICE(VLM5030, vlm5030); +class vlm5030_device : public device_t, + public device_sound_interface +{ +public: + vlm5030_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vlm5030_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type VLM5030; + #endif /* __VLM5030_H__ */ diff --git a/src/emu/sound/vrender0.c b/src/emu/sound/vrender0.c index 1584507703c..93fb3d646d9 100644 --- a/src/emu/sound/vrender0.c +++ b/src/emu/sound/vrender0.c @@ -26,7 +26,7 @@ INLINE vr0_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == VRENDER0); - return (vr0_state *)downcast<legacy_device_base *>(device)->token(); + return (vr0_state *)downcast<vrender0_device *>(device)->token(); } static void VR0_RenderAudio(vr0_state *VR0, int nsamples,stream_sample_t *l,stream_sample_t *r); @@ -267,4 +267,42 @@ DEVICE_GET_INFO( vrender0 ) } -DEFINE_LEGACY_SOUND_DEVICE(VRENDER0, vrender0); +const device_type VRENDER0 = &device_creator<vrender0_device>; + +vrender0_device::vrender0_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VRENDER0, "VRender0", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(vr0_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vrender0_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vrender0_device::device_start() +{ + DEVICE_START_NAME( vrender0 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void vrender0_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/vrender0.h b/src/emu/sound/vrender0.h index a1a16fb8c1c..af0fbe43022 100644 --- a/src/emu/sound/vrender0.h +++ b/src/emu/sound/vrender0.h @@ -17,6 +17,28 @@ void vr0_snd_set_areas(device_t *device,UINT32 *texture,UINT32 *frame); READ32_DEVICE_HANDLER( vr0_snd_read ); WRITE32_DEVICE_HANDLER( vr0_snd_write ); -DECLARE_LEGACY_SOUND_DEVICE(VRENDER0, vrender0); +class vrender0_device : public device_t, + public device_sound_interface +{ +public: + vrender0_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vrender0_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type VRENDER0; + #endif /* __VRENDER0_H__ */ diff --git a/src/emu/sound/wave.c b/src/emu/sound/wave.c index 1d879de288b..fc2b8255774 100644 --- a/src/emu/sound/wave.c +++ b/src/emu/sound/wave.c @@ -109,4 +109,41 @@ DEVICE_GET_INFO( wave ) } -DEFINE_LEGACY_SOUND_DEVICE(WAVE, wave); +const device_type WAVE = &device_creator<wave_device>; + +wave_device::wave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, WAVE, "Cassette", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void wave_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void wave_device::device_start() +{ + DEVICE_START_NAME( wave )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void wave_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/wave.h b/src/emu/sound/wave.h index 9a13ef11952..0701b0b6c96 100644 --- a/src/emu/sound/wave.h +++ b/src/emu/sound/wave.h @@ -9,7 +9,24 @@ * CassetteWave interface *****************************************************************************/ -DECLARE_LEGACY_SOUND_DEVICE(WAVE, wave); +class wave_device : public device_t, + public device_sound_interface +{ +public: + wave_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: +}; + +extern const device_type WAVE; + #define WAVE_TAG "wave" #define WAVE2_TAG "wave2" diff --git a/src/emu/sound/x1_010.c b/src/emu/sound/x1_010.c index 73b78f263eb..e5d9bfa3d32 100644 --- a/src/emu/sound/x1_010.c +++ b/src/emu/sound/x1_010.c @@ -101,7 +101,7 @@ INLINE x1_010_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == X1_010); - return (x1_010_state *)downcast<legacy_device_base *>(device)->token(); + return (x1_010_state *)downcast<x1_010_device *>(device)->token(); } @@ -311,4 +311,42 @@ DEVICE_GET_INFO( x1_010 ) } -DEFINE_LEGACY_SOUND_DEVICE(X1_010, x1_010); +const device_type X1_010 = &device_creator<x1_010_device>; + +x1_010_device::x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, X1_010, "X1-010", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(x1_010_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void x1_010_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void x1_010_device::device_start() +{ + DEVICE_START_NAME( x1_010 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void x1_010_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/x1_010.h b/src/emu/sound/x1_010.h index 06fa2600e9d..4c95ee6511f 100644 --- a/src/emu/sound/x1_010.h +++ b/src/emu/sound/x1_010.h @@ -21,6 +21,28 @@ WRITE16_DEVICE_HANDLER( seta_sound_word_w ); void seta_sound_enable_w(device_t *device, int data); -DECLARE_LEGACY_SOUND_DEVICE(X1_010, x1_010); +class x1_010_device : public device_t, + public device_sound_interface +{ +public: + x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~x1_010_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type X1_010; + #endif /* __X1_010_H__ */ diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c index f26cff955a4..2bebd6c4a76 100644 --- a/src/emu/sound/ymf271.c +++ b/src/emu/sound/ymf271.c @@ -275,7 +275,7 @@ INLINE YMF271Chip *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YMF271); - return (YMF271Chip *)downcast<legacy_device_base *>(device)->token(); + return (YMF271Chip *)downcast<ymf271_device *>(device)->token(); } @@ -1836,4 +1836,51 @@ DEVICE_GET_INFO( ymf271 ) } -DEFINE_LEGACY_SOUND_DEVICE(YMF271, ymf271); +const device_type YMF271 = &device_creator<ymf271_device>; + +ymf271_device::ymf271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YMF271, "YMF271", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(YMF271Chip)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ymf271_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ymf271_device::device_start() +{ + DEVICE_START_NAME( ymf271 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ymf271_device::device_reset() +{ + DEVICE_RESET_NAME( ymf271 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/ymf271.h b/src/emu/sound/ymf271.h index 45bb20b8a53..2bff143c667 100644 --- a/src/emu/sound/ymf271.h +++ b/src/emu/sound/ymf271.h @@ -17,6 +17,29 @@ struct _ymf271_interface READ8_DEVICE_HANDLER( ymf271_r ); WRITE8_DEVICE_HANDLER( ymf271_w ); -DECLARE_LEGACY_SOUND_DEVICE(YMF271, ymf271); +class ymf271_device : public device_t, + public device_sound_interface +{ +public: + ymf271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ymf271_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YMF271; + #endif /* __YMF271_H__ */ diff --git a/src/emu/sound/ymf278b.c b/src/emu/sound/ymf278b.c index eaa2655cc2d..5756ed926d9 100644 --- a/src/emu/sound/ymf278b.c +++ b/src/emu/sound/ymf278b.c @@ -157,7 +157,7 @@ INLINE YMF278BChip *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YMF278B); - return (YMF278BChip *)downcast<legacy_device_base *>(device)->token(); + return (YMF278BChip *)downcast<ymf278b_device *>(device)->token(); } static void ymf278b_write_memory(YMF278BChip *chip, UINT32 offset, UINT8 data) @@ -1111,4 +1111,51 @@ DEVICE_GET_INFO( ymf278b ) } -DEFINE_LEGACY_SOUND_DEVICE(YMF278B, ymf278b); +const device_type YMF278B = &device_creator<ymf278b_device>; + +ymf278b_device::ymf278b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YMF278B, "YMF278B", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(YMF278BChip)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ymf278b_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ymf278b_device::device_start() +{ + DEVICE_START_NAME( ymf278b )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ymf278b_device::device_reset() +{ + DEVICE_RESET_NAME( ymf278b )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/ymf278b.h b/src/emu/sound/ymf278b.h index e7918cbe5a5..685ba066c8e 100644 --- a/src/emu/sound/ymf278b.h +++ b/src/emu/sound/ymf278b.h @@ -17,6 +17,29 @@ struct _ymf278b_interface READ8_DEVICE_HANDLER( ymf278b_r ); WRITE8_DEVICE_HANDLER( ymf278b_w ); -DECLARE_LEGACY_SOUND_DEVICE(YMF278B, ymf278b); +class ymf278b_device : public device_t, + public device_sound_interface +{ +public: + ymf278b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ymf278b_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YMF278B; + #endif /* __YMF278B_H__ */ diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index 37d956673d0..f0e31e6bcde 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -137,7 +137,7 @@ INLINE ymz280b_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == YMZ280B); - return (ymz280b_state *)downcast<legacy_device_base *>(device)->token(); + return (ymz280b_state *)downcast<ymz280b_device *>(device)->token(); } @@ -1073,4 +1073,51 @@ DEVICE_GET_INFO( ymz280b ) } -DEFINE_LEGACY_SOUND_DEVICE(YMZ280B, ymz280b); +const device_type YMZ280B = &device_creator<ymz280b_device>; + +ymz280b_device::ymz280b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, YMZ280B, "YMZ280B", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ymz280b_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ymz280b_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ymz280b_device::device_start() +{ + DEVICE_START_NAME( ymz280b )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ymz280b_device::device_reset() +{ + DEVICE_RESET_NAME( ymz280b )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void ymz280b_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/ymz280b.h b/src/emu/sound/ymz280b.h index 18b9eec4ef0..2278d576efd 100644 --- a/src/emu/sound/ymz280b.h +++ b/src/emu/sound/ymz280b.h @@ -24,6 +24,29 @@ struct _ymz280b_interface READ8_DEVICE_HANDLER ( ymz280b_r ); WRITE8_DEVICE_HANDLER( ymz280b_w ); -DECLARE_LEGACY_SOUND_DEVICE(YMZ280B, ymz280b); +class ymz280b_device : public device_t, + public device_sound_interface +{ +public: + ymz280b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ymz280b_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type YMZ280B; + #endif /* __YMZ280B_H__ */ diff --git a/src/emu/sound/zsg2.c b/src/emu/sound/zsg2.c index fa0d05ebd24..a9494cd4933 100644 --- a/src/emu/sound/zsg2.c +++ b/src/emu/sound/zsg2.c @@ -69,7 +69,7 @@ INLINE zsg2_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == ZSG2); - return (zsg2_state *)downcast<legacy_device_base *>(device)->token(); + return (zsg2_state *)downcast<zsg2_device *>(device)->token(); } static STREAM_UPDATE( update_stereo ) @@ -257,4 +257,42 @@ DEVICE_GET_INFO( zsg2 ) } -DEFINE_LEGACY_SOUND_DEVICE(ZSG2, zsg2); +const device_type ZSG2 = &device_creator<zsg2_device>; + +zsg2_device::zsg2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ZSG2, "ZSG-2", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(zsg2_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void zsg2_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void zsg2_device::device_start() +{ + DEVICE_START_NAME( zsg2 )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void zsg2_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/emu/sound/zsg2.h b/src/emu/sound/zsg2.h index 209b20141c1..e45cbcddffd 100644 --- a/src/emu/sound/zsg2.h +++ b/src/emu/sound/zsg2.h @@ -16,6 +16,28 @@ struct _zsg2_interface const char *samplergn; }; -DECLARE_LEGACY_SOUND_DEVICE(ZSG2, zsg2); +class zsg2_device : public device_t, + public device_sound_interface +{ +public: + zsg2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~zsg2_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type ZSG2; + #endif /* __ZSG2_H__ */ diff --git a/src/emu/video/hd63484.c b/src/emu/video/hd63484.c index 82c5eefee24..c057bd86b2d 100644 --- a/src/emu/video/hd63484.c +++ b/src/emu/video/hd63484.c @@ -58,7 +58,7 @@ INLINE hd63484_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == HD63484); - return (hd63484_state *)downcast<legacy_device_base *>(device)->token(); + return (hd63484_state *)downcast<hd63484_device *>(device)->token(); } INLINE const hd63484_interface *get_interface( device_t *device ) @@ -1591,4 +1591,40 @@ DEVICE_GET_INFO(hd63484) } } -DEFINE_LEGACY_DEVICE(HD63484, hd63484); +const device_type HD63484 = &device_creator<hd63484_device>; + +hd63484_device::hd63484_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, HD63484, "HD63484", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(hd63484_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void hd63484_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void hd63484_device::device_start() +{ + DEVICE_START_NAME( hd63484 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void hd63484_device::device_reset() +{ + DEVICE_RESET_NAME( hd63484 )(this); +} + + diff --git a/src/emu/video/hd63484.h b/src/emu/video/hd63484.h index 26a5c742d89..1ef5fafbd6d 100644 --- a/src/emu/video/hd63484.h +++ b/src/emu/video/hd63484.h @@ -14,7 +14,26 @@ TYPE DEFINITIONS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(HD63484, hd63484); +class hd63484_device : public device_t +{ +public: + hd63484_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~hd63484_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type HD63484; + #define HD63484_RAM_SIZE 0x100000 diff --git a/src/emu/video/i8275.c b/src/emu/video/i8275.c index 210e6a52145..129f247c868 100644 --- a/src/emu/video/i8275.c +++ b/src/emu/video/i8275.c @@ -132,7 +132,7 @@ INLINE i8275_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == I8275); - return (i8275_t *)downcast<legacy_device_base *>(device)->token(); + return (i8275_t *)downcast<i8275_device *>(device)->token(); } @@ -609,4 +609,40 @@ DEVICE_GET_INFO( i8275 ) } } -DEFINE_LEGACY_DEVICE(I8275, i8275); +const device_type I8275 = &device_creator<i8275_device>; + +i8275_device::i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, I8275, "Intel 8275", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(i8275_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void i8275_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void i8275_device::device_start() +{ + DEVICE_START_NAME( i8275 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void i8275_device::device_reset() +{ + DEVICE_RESET_NAME( i8275 )(this); +} + + diff --git a/src/emu/video/i8275.h b/src/emu/video/i8275.h index 689a7f6b046..350b285f4de 100644 --- a/src/emu/video/i8275.h +++ b/src/emu/video/i8275.h @@ -18,7 +18,26 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(I8275, i8275); +class i8275_device : public device_t +{ +public: + i8275_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~i8275_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type I8275; + /*************************************************************************** TYPE DEFINITIONS diff --git a/src/emu/video/s2636.c b/src/emu/video/s2636.c index 73706814ae8..ed5bc615fdf 100644 --- a/src/emu/video/s2636.c +++ b/src/emu/video/s2636.c @@ -119,7 +119,7 @@ INLINE s2636_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == S2636); - return (s2636_state *)downcast<legacy_device_base *>(device)->token(); + return (s2636_state *)downcast<s2636_device *>(device)->token(); } INLINE const s2636_interface *get_interface( device_t *device ) @@ -377,4 +377,31 @@ DEVICE_GET_INFO(s2636) } } -DEFINE_LEGACY_DEVICE(S2636, s2636); +const device_type S2636 = &device_creator<s2636_device>; + +s2636_device::s2636_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, S2636, "Signetics 2636", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(s2636_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void s2636_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void s2636_device::device_start() +{ + DEVICE_START_NAME( s2636 )(this); +} + + diff --git a/src/emu/video/s2636.h b/src/emu/video/s2636.h index 1ca2bc21067..2caf7aed532 100644 --- a/src/emu/video/s2636.h +++ b/src/emu/video/s2636.h @@ -35,7 +35,25 @@ struct _s2636_interface * *************************************/ -DECLARE_LEGACY_DEVICE(S2636, s2636); +class s2636_device : public device_t +{ +public: + s2636_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~s2636_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type S2636; + #define MCFG_S2636_ADD(_tag, _interface) \ MCFG_DEVICE_ADD(_tag, S2636, 0) \ diff --git a/src/emu/video/saa5050.c b/src/emu/video/saa5050.c index 09422ce2e1b..9feb6083263 100644 --- a/src/emu/video/saa5050.c +++ b/src/emu/video/saa5050.c @@ -61,7 +61,7 @@ INLINE saa5050_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == SAA5050); - return (saa5050_state *)downcast<legacy_device_base *>(device)->token(); + return (saa5050_state *)downcast<saa5050_device *>(device)->token(); } INLINE const saa5050_interface *get_interface( device_t *device ) @@ -395,4 +395,40 @@ DEVICE_GET_INFO(saa5050) } } -DEFINE_LEGACY_DEVICE(SAA5050, saa5050); +const device_type SAA5050 = &device_creator<saa5050_device>; + +saa5050_device::saa5050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SAA5050, "SAA5050", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(saa5050_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void saa5050_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void saa5050_device::device_start() +{ + DEVICE_START_NAME( saa5050 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void saa5050_device::device_reset() +{ + DEVICE_RESET_NAME( saa5050 )(this); +} + + diff --git a/src/emu/video/saa5050.h b/src/emu/video/saa5050.h index 1f3dc816f08..88cdeca309b 100644 --- a/src/emu/video/saa5050.h +++ b/src/emu/video/saa5050.h @@ -26,7 +26,26 @@ struct _saa5050_interface int rev; }; -DECLARE_LEGACY_DEVICE(SAA5050, saa5050); +class saa5050_device : public device_t +{ +public: + saa5050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~saa5050_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type SAA5050; + /*************************************************************************** DEVICE CONFIGURATION MACROS diff --git a/src/emu/video/tlc34076.c b/src/emu/video/tlc34076.c index 2e6a3318bfe..e6dc7225d6d 100644 --- a/src/emu/video/tlc34076.c +++ b/src/emu/video/tlc34076.c @@ -52,7 +52,7 @@ INLINE tlc34076_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TLC34076); - return (tlc34076_state *)downcast<legacy_device_base *>(device)->token(); + return (tlc34076_state *)downcast<tlc34076_device *>(device)->token(); } /************************************* @@ -295,4 +295,40 @@ DEVICE_GET_INFO(tlc34076) } } -DEFINE_LEGACY_DEVICE(TLC34076, tlc34076); +const device_type TLC34076 = &device_creator<tlc34076_device>; + +tlc34076_device::tlc34076_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TLC34076, "TLC34076", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tlc34076_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tlc34076_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tlc34076_device::device_start() +{ + DEVICE_START_NAME( tlc34076 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tlc34076_device::device_reset() +{ + DEVICE_RESET_NAME( tlc34076 )(this); +} + + diff --git a/src/emu/video/tlc34076.h b/src/emu/video/tlc34076.h index 4581b4f5d4e..62d03d0d2cb 100644 --- a/src/emu/video/tlc34076.h +++ b/src/emu/video/tlc34076.h @@ -25,7 +25,26 @@ struct _tlc34076_config extern const tlc34076_config tlc34076_6_bit_intf; -DECLARE_LEGACY_DEVICE(TLC34076, tlc34076); +class tlc34076_device : public device_t +{ +public: + tlc34076_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tlc34076_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TLC34076; + /*************************************************************************** diff --git a/src/emu/video/tms9927.c b/src/emu/video/tms9927.c index e38597f0917..00c764eaca0 100644 --- a/src/emu/video/tms9927.c +++ b/src/emu/video/tms9927.c @@ -64,7 +64,7 @@ INLINE tms9927_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == TMS9927); - return (tms9927_state *)downcast<legacy_device_base *>(device)->token(); + return (tms9927_state *)downcast<tms9927_device *>(device)->token(); } @@ -357,7 +357,78 @@ DEVICE_GET_INFO( crt5057 ) } -DEFINE_LEGACY_DEVICE(TMS9927, tms9927); -DEFINE_LEGACY_DEVICE(CRT5027, crt5027); -DEFINE_LEGACY_DEVICE(CRT5037, crt5037); -DEFINE_LEGACY_DEVICE(CRT5057, crt5057); +const device_type TMS9927 = &device_creator<tms9927_device>; + +tms9927_device::tms9927_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TMS9927, "TMS9927", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms9927_state)); +} +tms9927_device::tms9927_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tms9927_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tms9927_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tms9927_device::device_start() +{ + DEVICE_START_NAME( tms9927 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tms9927_device::device_reset() +{ + DEVICE_RESET_NAME( tms9927 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void tms9927_device::device_stop() +{ + DEVICE_STOP_NAME( tms9927 )(this); +} + + +const device_type CRT5027 = &device_creator<crt5027_device>; + +crt5027_device::crt5027_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms9927_device(mconfig, CRT5027, "CRT5027", tag, owner, clock) +{ +} + + +const device_type CRT5037 = &device_creator<crt5037_device>; + +crt5037_device::crt5037_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms9927_device(mconfig, CRT5037, "CRT5037", tag, owner, clock) +{ +} + + +const device_type CRT5057 = &device_creator<crt5057_device>; + +crt5057_device::crt5057_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms9927_device(mconfig, CRT5057, "CRT5057", tag, owner, clock) +{ +} + + diff --git a/src/emu/video/tms9927.h b/src/emu/video/tms9927.h index a1eb5d014f5..63bf5d84dfd 100644 --- a/src/emu/video/tms9927.h +++ b/src/emu/video/tms9927.h @@ -13,10 +13,52 @@ #include "devlegcy.h" -DECLARE_LEGACY_DEVICE(TMS9927, tms9927); -DECLARE_LEGACY_DEVICE(CRT5027, crt5027); -DECLARE_LEGACY_DEVICE(CRT5037, crt5037); -DECLARE_LEGACY_DEVICE(CRT5057, crt5057); +class tms9927_device : public device_t +{ +public: + tms9927_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + tms9927_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~tms9927_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TMS9927; + +class crt5027_device : public tms9927_device +{ +public: + crt5027_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type CRT5027; + +class crt5037_device : public tms9927_device +{ +public: + crt5037_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type CRT5037; + +class crt5057_device : public tms9927_device +{ +public: + crt5057_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type CRT5057; + #define MCFG_TMS9927_ADD(_tag, _clock, _config) \ diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index e23667b0297..c396407eb48 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -316,7 +316,7 @@ INLINE voodoo_state *get_safe_token(device_t *device) assert(device != NULL); assert((device->type() == VOODOO_1) || (device->type() == VOODOO_2) || (device->type() == VOODOO_BANSHEE) || (device->type() == VOODOO_3)); - return (voodoo_state *)downcast<legacy_device_base *>(device)->token(); + return (voodoo_state *)downcast<voodoo_device *>(device)->token(); } @@ -5713,10 +5713,109 @@ static void dump_rasterizer_stats(voodoo_state *v) } } -DEFINE_LEGACY_DEVICE(VOODOO_1, voodoo_1); -DEFINE_LEGACY_DEVICE(VOODOO_2, voodoo_2); -DEFINE_LEGACY_DEVICE(VOODOO_BANSHEE, voodoo_banshee); -DEFINE_LEGACY_DEVICE(VOODOO_3, voodoo_3); +voodoo_device::voodoo_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(voodoo_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void voodoo_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void voodoo_device::device_reset() +{ + DEVICE_RESET_NAME( voodoo )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void voodoo_device::device_stop() +{ + DEVICE_STOP_NAME( voodoo )(this); +} + + +const device_type VOODOO_1 = &device_creator<voodoo_1_device>; + +voodoo_1_device::voodoo_1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : voodoo_device(mconfig, VOODOO_1, "3dfx Voodoo Graphics", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void voodoo_1_device::device_start() +{ + DEVICE_START_NAME( voodoo_1 )(this); +} + + +const device_type VOODOO_2 = &device_creator<voodoo_2_device>; + +voodoo_2_device::voodoo_2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : voodoo_device(mconfig, VOODOO_2, "3dfx Voodoo 2", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void voodoo_2_device::device_start() +{ + DEVICE_START_NAME( voodoo_2 )(this); +} + + +const device_type VOODOO_BANSHEE = &device_creator<voodoo_banshee_device>; + +voodoo_banshee_device::voodoo_banshee_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : voodoo_device(mconfig, VOODOO_BANSHEE, "3dfx Voodoo Banshee", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void voodoo_banshee_device::device_start() +{ + DEVICE_START_NAME( voodoo_banshee )(this); +} + + +const device_type VOODOO_3 = &device_creator<voodoo_3_device>; + +voodoo_3_device::voodoo_3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : voodoo_device(mconfig, VOODOO_3, "3dfx Voodoo 3", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void voodoo_3_device::device_start() +{ + DEVICE_START_NAME( voodoo_3 )(this); +} + + /*************************************************************************** GENERIC RASTERIZERS diff --git a/src/emu/video/voodoo.h b/src/emu/video/voodoo.h index 6187ef1e549..b6a5c18e855 100644 --- a/src/emu/video/voodoo.h +++ b/src/emu/video/voodoo.h @@ -128,8 +128,66 @@ READ32_DEVICE_HANDLER( banshee_rom_r ); /* ----- device interface ----- */ -DECLARE_LEGACY_DEVICE(VOODOO_1, voodoo_1); -DECLARE_LEGACY_DEVICE(VOODOO_2, voodoo_2); -DECLARE_LEGACY_DEVICE(VOODOO_BANSHEE, voodoo_banshee); -DECLARE_LEGACY_DEVICE(VOODOO_3, voodoo_3); +class voodoo_device : public device_t +{ +public: + voodoo_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~voodoo_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_stop(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +class voodoo_1_device : public voodoo_device +{ +public: + voodoo_1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type VOODOO_1; + +class voodoo_2_device : public voodoo_device +{ +public: + voodoo_2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type VOODOO_2; + +class voodoo_banshee_device : public voodoo_device +{ +public: + voodoo_banshee_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type VOODOO_BANSHEE; + +class voodoo_3_device : public voodoo_device +{ +public: + voodoo_3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type VOODOO_3; + #endif diff --git a/src/mame/audio/amiga.c b/src/mame/audio/amiga.c index 4fb762e563d..d04e341bb84 100644 --- a/src/mame/audio/amiga.c +++ b/src/mame/audio/amiga.c @@ -67,7 +67,7 @@ INLINE amiga_audio *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == AMIGA); - return (amiga_audio *)downcast<legacy_device_base *>(device)->token(); + return (amiga_audio *)downcast<amiga_sound_device *>(device)->token(); } /************************************* @@ -295,4 +295,42 @@ DEVICE_GET_INFO( amiga_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(AMIGA, amiga_sound); +const device_type AMIGA = &device_creator<amiga_sound_device>; + +amiga_sound_device::amiga_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, AMIGA, "Amiga Paula", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(amiga_audio)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void amiga_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void amiga_sound_device::device_start() +{ + DEVICE_START_NAME( amiga_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void amiga_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/beezer.c b/src/mame/audio/beezer.c index 208cd606c9b..591dd3434d6 100644 --- a/src/mame/audio/beezer.c +++ b/src/mame/audio/beezer.c @@ -126,7 +126,7 @@ INLINE beezer_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == BEEZER); - return (beezer_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (beezer_sound_state *)downcast<beezer_sound_device *>(device)->token(); } /************************************* @@ -395,7 +395,54 @@ static DEVICE_START( beezer_sound ) DEVICE_START_CALL(common_sh_start); } -DEFINE_LEGACY_SOUND_DEVICE(BEEZER, beezer_sound); +const device_type BEEZER = &device_creator<beezer_sound_device>; + +beezer_sound_device::beezer_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, BEEZER, "beezer SFX", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(beezer_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void beezer_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void beezer_sound_device::device_start() +{ + DEVICE_START_NAME( beezer_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- +static DEVICE_RESET( beezer_sound ); +void beezer_sound_device::device_reset() +{ + DEVICE_RESET_NAME( beezer_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void beezer_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + /************************************* * diff --git a/src/mame/audio/cps3.c b/src/mame/audio/cps3.c index 301e264f7be..65b2a2a821e 100644 --- a/src/mame/audio/cps3.c +++ b/src/mame/audio/cps3.c @@ -30,7 +30,7 @@ INLINE cps3_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == CPS3); - return (cps3_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (cps3_sound_state *)downcast<cps3_sound_device *>(device)->token(); } static STREAM_UPDATE( cps3_stream_update ) @@ -188,4 +188,42 @@ READ32_DEVICE_HANDLER( cps3_sound_r ) } -DEFINE_LEGACY_SOUND_DEVICE(CPS3, cps3_sound); +const device_type CPS3 = &device_creator<cps3_sound_device>; + +cps3_sound_device::cps3_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, CPS3, "CPS3 Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(cps3_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void cps3_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cps3_sound_device::device_start() +{ + DEVICE_START_NAME( cps3_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void cps3_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c index d40d45d3b8e..dc2ff39c47c 100644 --- a/src/mame/audio/exidy.c +++ b/src/mame/audio/exidy.c @@ -120,7 +120,7 @@ INLINE exidy_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == EXIDY || device->type() == EXIDY_VENTURE || device->type() == EXIDY_VICTORY); - return (exidy_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (exidy_sound_state *)downcast<exidy_sound_device *>(device)->token(); } /************************************* @@ -419,7 +419,63 @@ static DEVICE_START( exidy_sound ) DEVICE_START_CALL(common_sh_start); } -DEFINE_LEGACY_SOUND_DEVICE(EXIDY, exidy_sound); +const device_type EXIDY = &device_creator<exidy_sound_device>; + +exidy_sound_device::exidy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, EXIDY, "Exidy SFX", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(exidy_sound_state)); +} + +exidy_sound_device::exidy_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(exidy_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void exidy_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void exidy_sound_device::device_start() +{ + DEVICE_START_NAME( exidy_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +static DEVICE_RESET( exidy_sound ); + +void exidy_sound_device::device_reset() +{ + DEVICE_RESET_NAME( exidy_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void exidy_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + /************************************* * @@ -863,7 +919,52 @@ DEVICE_GET_INFO( venture_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(EXIDY_VENTURE, venture_sound); +const device_type EXIDY_VENTURE = &device_creator<venture_sound_device>; + +venture_sound_device::venture_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : exidy_sound_device(mconfig, EXIDY_VENTURE, "Exidy SFX+PSG", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void venture_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void venture_sound_device::device_start() +{ + DEVICE_START_NAME( venture_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void venture_sound_device::device_reset() +{ + DEVICE_RESET_NAME( venture_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void venture_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + static ADDRESS_MAP_START( venture_audio_map, AS_PROGRAM, 8, driver_device ) @@ -1102,7 +1203,52 @@ DEVICE_GET_INFO( victory_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(EXIDY_VICTORY, victory_sound); +const device_type EXIDY_VICTORY = &device_creator<victory_sound_device>; + +victory_sound_device::victory_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : exidy_sound_device(mconfig, EXIDY_VICTORY, "Exidy SFX+PSG+Speech", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void victory_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void victory_sound_device::device_start() +{ + DEVICE_START_NAME( victory_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void victory_sound_device::device_reset() +{ + DEVICE_RESET_NAME( victory_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void victory_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + static ADDRESS_MAP_START( victory_audio_map, AS_PROGRAM, 8, driver_device ) diff --git a/src/mame/audio/exidy.h b/src/mame/audio/exidy.h index ccd2d1d5bf9..429aeb6d26e 100644 --- a/src/mame/audio/exidy.h +++ b/src/mame/audio/exidy.h @@ -1,6 +1,64 @@ -DECLARE_LEGACY_SOUND_DEVICE(EXIDY, exidy_sound); -DECLARE_LEGACY_SOUND_DEVICE(EXIDY_VENTURE, venture_sound); -DECLARE_LEGACY_SOUND_DEVICE(EXIDY_VICTORY, victory_sound); +class exidy_sound_device : public device_t, + public device_sound_interface +{ +public: + exidy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + exidy_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~exidy_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type EXIDY; + +class venture_sound_device : public exidy_sound_device +{ +public: + venture_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state +}; + +extern const device_type EXIDY_VENTURE; + +class victory_sound_device : public exidy_sound_device +{ +public: + victory_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state +}; + +extern const device_type EXIDY_VICTORY; + READ8_DEVICE_HANDLER( exidy_sh6840_r ); WRITE8_DEVICE_HANDLER( exidy_sh6840_w ); diff --git a/src/mame/audio/exidy440.c b/src/mame/audio/exidy440.c index 61cc35c8861..80cc3315349 100644 --- a/src/mame/audio/exidy440.c +++ b/src/mame/audio/exidy440.c @@ -124,7 +124,30 @@ static void decode_and_filter_cvsd(device_t *device, UINT8 *data, int bytes, int static void fir_filter(device_t *device, INT32 *input, INT16 *output, int count); -DECLARE_LEGACY_SOUND_DEVICE(EXIDY440, exidy440_sound); +class exidy440_sound_device : public device_t, + public device_sound_interface +{ +public: + exidy440_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~exidy440_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type EXIDY440; + /************************************* * @@ -137,7 +160,7 @@ INLINE exidy440_audio_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == EXIDY440); - return (exidy440_audio_state *)downcast<legacy_device_base *>(device)->token(); + return (exidy440_audio_state *)downcast<exidy440_sound_device *>(device)->token(); } static DEVICE_START( exidy440_sound ) @@ -984,7 +1007,54 @@ DEVICE_GET_INFO( exidy440_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(EXIDY440, exidy440_sound); +const device_type EXIDY440 = &device_creator<exidy440_sound_device>; + +exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, EXIDY440, "Exidy 440 CVSD", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(exidy440_audio_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void exidy440_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void exidy440_sound_device::device_start() +{ + DEVICE_START_NAME( exidy440_sound )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void exidy440_sound_device::device_stop() +{ + DEVICE_STOP_NAME( exidy440_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void exidy440_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/flower.c b/src/mame/audio/flower.c index 2598a795b0d..3f0112a1872 100644 --- a/src/mame/audio/flower.c +++ b/src/mame/audio/flower.c @@ -63,7 +63,7 @@ INLINE flower_sound_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == FLOWER); - return (flower_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (flower_sound_state *)downcast<flower_sound_device *>(device)->token(); } /* build a table to divide by the number of voices; gain is specified as gain*16 */ @@ -374,4 +374,51 @@ WRITE8_DEVICE_HANDLER( flower_sound2_w ) } -DEFINE_LEGACY_SOUND_DEVICE(FLOWER, flower_sound); +const device_type FLOWER = &device_creator<flower_sound_device>; + +flower_sound_device::flower_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, FLOWER, "Flower Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(flower_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void flower_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void flower_sound_device::device_start() +{ + DEVICE_START_NAME( flower_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void flower_sound_device::device_reset() +{ + DEVICE_RESET_NAME( flower_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void flower_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/geebee.c b/src/mame/audio/geebee.c index a4b45dab655..eee82b65982 100644 --- a/src/mame/audio/geebee.c +++ b/src/mame/audio/geebee.c @@ -29,7 +29,7 @@ INLINE geebee_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == GEEBEE); - return (geebee_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (geebee_sound_state *)downcast<geebee_sound_device *>(device)->token(); } static TIMER_CALLBACK( volume_decay ) @@ -160,4 +160,42 @@ DEVICE_GET_INFO( geebee_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(GEEBEE, geebee_sound); +const device_type GEEBEE = &device_creator<geebee_sound_device>; + +geebee_sound_device::geebee_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GEEBEE, "Gee Bee Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(geebee_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void geebee_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void geebee_sound_device::device_start() +{ + DEVICE_START_NAME( geebee_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void geebee_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/gomoku.c b/src/mame/audio/gomoku.c index 99dff9de13f..c22ae8c03a6 100644 --- a/src/mame/audio/gomoku.c +++ b/src/mame/audio/gomoku.c @@ -57,7 +57,7 @@ INLINE gomoku_sound_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == GOMOKU); - return (gomoku_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (gomoku_sound_state *)downcast<gomoku_sound_device *>(device)->token(); } @@ -294,4 +294,42 @@ WRITE8_DEVICE_HANDLER( gomoku_sound2_w ) } -DEFINE_LEGACY_SOUND_DEVICE(GOMOKU, gomoku_sound); +const device_type GOMOKU = &device_creator<gomoku_sound_device>; + +gomoku_sound_device::gomoku_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GOMOKU, "Gomoku Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(gomoku_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void gomoku_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gomoku_sound_device::device_start() +{ + DEVICE_START_NAME( gomoku_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void gomoku_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/gridlee.c b/src/mame/audio/gridlee.c index 5df0408d863..132ad2bf0c0 100644 --- a/src/mame/audio/gridlee.c +++ b/src/mame/audio/gridlee.c @@ -41,7 +41,7 @@ INLINE gridlee_sound_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == GRIDLEE); - return (gridlee_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (gridlee_sound_state *)downcast<gridlee_sound_device *>(device)->token(); } static STREAM_UPDATE( gridlee_stream_update ) @@ -197,4 +197,42 @@ fclose(f); } -DEFINE_LEGACY_SOUND_DEVICE(GRIDLEE, gridlee_sound); +const device_type GRIDLEE = &device_creator<gridlee_sound_device>; + +gridlee_sound_device::gridlee_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GRIDLEE, "Gridlee Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(gridlee_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void gridlee_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gridlee_sound_device::device_start() +{ + DEVICE_START_NAME( gridlee_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void gridlee_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/hyprolyb.c b/src/mame/audio/hyprolyb.c index 1cd4b32933d..396d540295e 100644 --- a/src/mame/audio/hyprolyb.c +++ b/src/mame/audio/hyprolyb.c @@ -18,7 +18,7 @@ INLINE hyprolyb_adpcm_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == HYPROLYB_ADPCM); - return (hyprolyb_adpcm_state *)downcast<legacy_device_base *>(device)->token(); + return (hyprolyb_adpcm_state *)downcast<hyprolyb_adpcm_device *>(device)->token(); } static DEVICE_START( hyprolyb_adpcm ) @@ -153,4 +153,51 @@ DEVICE_GET_INFO(hyprolyb_adpcm) } } -DEFINE_LEGACY_SOUND_DEVICE(HYPROLYB_ADPCM, hyprolyb_adpcm); +const device_type HYPROLYB_ADPCM = &device_creator<hyprolyb_adpcm_device>; + +hyprolyb_adpcm_device::hyprolyb_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, HYPROLYB_ADPCM, "Hyper Olympics Audio", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(hyprolyb_adpcm_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void hyprolyb_adpcm_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void hyprolyb_adpcm_device::device_start() +{ + DEVICE_START_NAME( hyprolyb_adpcm )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void hyprolyb_adpcm_device::device_reset() +{ + DEVICE_RESET_NAME( hyprolyb_adpcm )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void hyprolyb_adpcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/hyprolyb.h b/src/mame/audio/hyprolyb.h index a6c69bdf56f..1e20f7f2df7 100644 --- a/src/mame/audio/hyprolyb.h +++ b/src/mame/audio/hyprolyb.h @@ -3,4 +3,27 @@ READ8_DEVICE_HANDLER( hyprolyb_adpcm_busy_r ); MACHINE_CONFIG_EXTERN( hyprolyb_adpcm ); -DECLARE_LEGACY_SOUND_DEVICE(HYPROLYB_ADPCM, hyprolyb_adpcm); +class hyprolyb_adpcm_device : public device_t, + public device_sound_interface +{ +public: + hyprolyb_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~hyprolyb_adpcm_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type HYPROLYB_ADPCM; + diff --git a/src/mame/audio/irem.c b/src/mame/audio/irem.c index 2999de56006..1f6e4a56c1f 100644 --- a/src/mame/audio/irem.c +++ b/src/mame/audio/irem.c @@ -28,7 +28,7 @@ INLINE irem_audio_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == IREM_AUDIO); - return (irem_audio_state *)downcast<legacy_device_base *>(device)->token(); + return (irem_audio_state *)downcast<irem_audio_device *>(device)->token(); } @@ -501,4 +501,42 @@ DEVICE_GET_INFO(irem_audio) } } -DEFINE_LEGACY_SOUND_DEVICE(IREM_AUDIO, irem_audio); +const device_type IREM_AUDIO = &device_creator<irem_audio_device>; + +irem_audio_device::irem_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, IREM_AUDIO, "Irem Audio", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(irem_audio_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void irem_audio_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void irem_audio_device::device_start() +{ + DEVICE_START_NAME( irem_audio )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void irem_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/irem.h b/src/mame/audio/irem.h index 6b1b75b2e39..eeb69df8f00 100644 --- a/src/mame/audio/irem.h +++ b/src/mame/audio/irem.h @@ -4,4 +4,26 @@ MACHINE_CONFIG_EXTERN( m52_sound_c_audio ); MACHINE_CONFIG_EXTERN( m52_large_audio ); MACHINE_CONFIG_EXTERN( m62_audio ); -DECLARE_LEGACY_SOUND_DEVICE(IREM_AUDIO, irem_audio); +class irem_audio_device : public device_t, + public device_sound_interface +{ +public: + irem_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~irem_audio_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type IREM_AUDIO; + diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c index e555dcba59e..dc80bdda580 100644 --- a/src/mame/audio/leland.c +++ b/src/mame/audio/leland.c @@ -230,7 +230,7 @@ INLINE leland_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == LELAND || device->type() == LELAND_80186 || device->type() == REDLINE_80186); - return (leland_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (leland_sound_state *)downcast<leland_sound_device *>(device)->token(); } static STREAM_UPDATE( leland_update ) @@ -623,9 +623,141 @@ DEVICE_GET_INFO( redline_80186_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(LELAND, leland_sound); -DEFINE_LEGACY_SOUND_DEVICE(LELAND_80186, leland_80186_sound); -DEFINE_LEGACY_SOUND_DEVICE(REDLINE_80186, redline_80186_sound); +const device_type LELAND = &device_creator<leland_sound_device>; + +leland_sound_device::leland_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, LELAND, "Leland DAC", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(leland_sound_state)); +} + +leland_sound_device::leland_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(leland_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void leland_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void leland_sound_device::device_start() +{ + DEVICE_START_NAME( leland_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void leland_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type LELAND_80186 = &device_creator<leland_80186_sound_device>; + +leland_80186_sound_device::leland_80186_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : leland_sound_device(mconfig, LELAND_80186, "Leland 80186 DAC", tag, owner, clock) +{ +} + +leland_80186_sound_device::leland_80186_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : leland_sound_device(mconfig, type, name, tag, owner, clock) +{ +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void leland_80186_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void leland_80186_sound_device::device_start() +{ + DEVICE_START_NAME( leland_80186_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void leland_80186_sound_device::device_reset() +{ + DEVICE_RESET_NAME( leland_80186_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void leland_80186_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type REDLINE_80186 = &device_creator<redline_80186_sound_device>; + +redline_80186_sound_device::redline_80186_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : leland_80186_sound_device(mconfig, REDLINE_80186, "Redline Racer 80186 DAC", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void redline_80186_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void redline_80186_sound_device::device_start() +{ + DEVICE_START_NAME( redline_80186_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void redline_80186_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + static void leland_80186_reset(device_t *device) diff --git a/src/mame/audio/m72.c b/src/mame/audio/m72.c index a3832631e03..42fdf7706c7 100644 --- a/src/mame/audio/m72.c +++ b/src/mame/audio/m72.c @@ -83,7 +83,7 @@ INLINE m72_audio_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == M72); - return (m72_audio_state *)downcast<legacy_device_base *>(device)->token(); + return (m72_audio_state *)downcast<m72_audio_device *>(device)->token(); } @@ -271,4 +271,51 @@ DEVICE_GET_INFO( m72_audio ) } } -DEFINE_LEGACY_SOUND_DEVICE(M72, m72_audio); +const device_type M72 = &device_creator<m72_audio_device>; + +m72_audio_device::m72_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, M72, "M72 Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(m72_audio_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void m72_audio_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void m72_audio_device::device_start() +{ + DEVICE_START_NAME( m72_audio )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void m72_audio_device::device_reset() +{ + DEVICE_RESET_NAME( m72_audio )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void m72_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/m72.h b/src/mame/audio/m72.h index 15e8e74cfc3..5713dd3f4b2 100644 --- a/src/mame/audio/m72.h +++ b/src/mame/audio/m72.h @@ -18,4 +18,27 @@ WRITE8_DEVICE_HANDLER( shisen_sample_addr_w ); WRITE8_DEVICE_HANDLER( rtype2_sample_addr_w ); WRITE8_DEVICE_HANDLER( poundfor_sample_addr_w ); -DECLARE_LEGACY_SOUND_DEVICE(M72, m72_audio); +class m72_audio_device : public device_t, + public device_sound_interface +{ +public: + m72_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~m72_audio_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type M72; + diff --git a/src/mame/audio/micro3d.c b/src/mame/audio/micro3d.c index 4c78f158143..92ec8bfacf6 100644 --- a/src/mame/audio/micro3d.c +++ b/src/mame/audio/micro3d.c @@ -185,7 +185,7 @@ void micro3d_noise_sh_w(running_machine &machine, UINT8 data) if (~data & 8) { device_t *device = machine.device(data & 4 ? "noise_2" : "noise_1"); - noise_state *nstate = (noise_state *)downcast<legacy_device_base *>(device)->token(); + noise_state *nstate = (noise_state *)downcast<micro3d_sound_device *>(device)->token(); if (state->m_dac_data != nstate->dac[data & 3]) { @@ -214,7 +214,7 @@ INLINE noise_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == MICRO3D); - return (noise_state *)downcast<legacy_device_base *>(device)->token(); + return (noise_state *)downcast<micro3d_sound_device *>(device)->token(); } static STREAM_UPDATE( micro3d_stream_update ) @@ -419,4 +419,51 @@ WRITE8_DEVICE_HANDLER( micro3d_upd7759_w ) } -DEFINE_LEGACY_SOUND_DEVICE(MICRO3D, micro3d_sound); +const device_type MICRO3D = &device_creator<micro3d_sound_device>; + +micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MICRO3D, "Microprose Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(noise_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void micro3d_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void micro3d_sound_device::device_start() +{ + DEVICE_START_NAME( micro3d_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void micro3d_sound_device::device_reset() +{ + DEVICE_RESET_NAME( micro3d_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void micro3d_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/namco52.c b/src/mame/audio/namco52.c index 0e80ffe2089..93418de6458 100644 --- a/src/mame/audio/namco52.c +++ b/src/mame/audio/namco52.c @@ -66,7 +66,7 @@ INLINE namco_52xx_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == NAMCO_52XX); - return (namco_52xx_state *)downcast<legacy_device_base *>(device)->token(); + return (namco_52xx_state *)downcast<namco_52xx_device *>(device)->token(); } @@ -246,4 +246,52 @@ DEVICE_GET_INFO(namco_52xx) } } -DEFINE_LEGACY_DEVICE(NAMCO_52XX, namco_52xx); +const device_type NAMCO_52XX = &device_creator<namco_52xx_device>; + +namco_52xx_device::namco_52xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO_52XX, "Namco 52xx", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_52xx_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_52xx_device::device_config_complete() +{ + m_shortname = "namco52"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namco_52xx_device::device_start() +{ + DEVICE_START_NAME( namco_52xx )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor namco_52xx_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( namco_52xx ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *namco_52xx_device::device_rom_region() const +{ + return ROM_NAME(namco_52xx ); +} + + diff --git a/src/mame/audio/namco52.h b/src/mame/audio/namco52.h index 251be86ee96..9bec1e9f2c4 100644 --- a/src/mame/audio/namco52.h +++ b/src/mame/audio/namco52.h @@ -25,7 +25,27 @@ struct _namco_52xx_interface WRITE8_DEVICE_HANDLER( namco_52xx_write ); -DECLARE_LEGACY_DEVICE(NAMCO_52XX, namco_52xx); +class namco_52xx_device : public device_t +{ +public: + namco_52xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~namco_52xx_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO_52XX; + /* discrete nodes */ diff --git a/src/mame/audio/namco54.c b/src/mame/audio/namco54.c index 98c12440156..6e2ebea19fa 100644 --- a/src/mame/audio/namco54.c +++ b/src/mame/audio/namco54.c @@ -65,7 +65,7 @@ INLINE namco_54xx_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == NAMCO_54XX); - return (namco_54xx_state *)downcast<legacy_device_base *>(device)->token(); + return (namco_54xx_state *)downcast<namco_54xx_device *>(device)->token(); } @@ -203,4 +203,52 @@ DEVICE_GET_INFO(namco_54xx) } } -DEFINE_LEGACY_DEVICE(NAMCO_54XX, namco_54xx); +const device_type NAMCO_54XX = &device_creator<namco_54xx_device>; + +namco_54xx_device::namco_54xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO_54XX, "Namco 54xx", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_54xx_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_54xx_device::device_config_complete() +{ + m_shortname = "namco54"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namco_54xx_device::device_start() +{ + DEVICE_START_NAME( namco_54xx )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor namco_54xx_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( namco_54xx ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *namco_54xx_device::device_rom_region() const +{ + return ROM_NAME(namco_54xx ); +} + + diff --git a/src/mame/audio/namco54.h b/src/mame/audio/namco54.h index 78326fd34a2..51e55ba0077 100644 --- a/src/mame/audio/namco54.h +++ b/src/mame/audio/namco54.h @@ -21,7 +21,27 @@ struct _namco_54xx_config WRITE8_DEVICE_HANDLER( namco_54xx_write ); -DECLARE_LEGACY_DEVICE(NAMCO_54XX, namco_54xx); +class namco_54xx_device : public device_t +{ +public: + namco_54xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~namco_54xx_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO_54XX; + /* discrete nodes */ diff --git a/src/mame/audio/phoenix.c b/src/mame/audio/phoenix.c index 9d4773b2d2f..18a024006df 100644 --- a/src/mame/audio/phoenix.c +++ b/src/mame/audio/phoenix.c @@ -78,7 +78,7 @@ INLINE phoenix_sound_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == PHOENIX); - return (phoenix_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (phoenix_sound_state *)downcast<phoenix_sound_device *>(device)->token(); } INLINE int update_c24(phoenix_sound_state *state, int samplerate) @@ -588,4 +588,42 @@ DEVICE_GET_INFO( phoenix_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(PHOENIX, phoenix_sound); +const device_type PHOENIX = &device_creator<phoenix_sound_device>; + +phoenix_sound_device::phoenix_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PHOENIX, "Phoenix Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(phoenix_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void phoenix_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void phoenix_sound_device::device_start() +{ + DEVICE_START_NAME( phoenix_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void phoenix_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/pleiads.c b/src/mame/audio/pleiads.c index b2d5a8e2117..e64ad079adf 100644 --- a/src/mame/audio/pleiads.c +++ b/src/mame/audio/pleiads.c @@ -75,7 +75,7 @@ INLINE pleiads_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == PLEIADS || device->type() == POPFLAME || device->type() == NAUGHTYB); - return (pleiads_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (pleiads_sound_state *)downcast<pleiads_sound_device *>(device)->token(); } @@ -731,6 +731,123 @@ DEVICE_GET_INFO( popflame_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(PLEIADS, pleiads_sound); -DEFINE_LEGACY_SOUND_DEVICE(NAUGHTYB, naughtyb_sound); -DEFINE_LEGACY_SOUND_DEVICE(POPFLAME, popflame_sound); +const device_type PLEIADS = &device_creator<pleiads_sound_device>; + +pleiads_sound_device::pleiads_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PLEIADS, "Pleiads Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pleiads_sound_state)); +} + +pleiads_sound_device::pleiads_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pleiads_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pleiads_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pleiads_sound_device::device_start() +{ + DEVICE_START_NAME( pleiads_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void pleiads_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type NAUGHTYB = &device_creator<naughtyb_sound_device>; + +naughtyb_sound_device::naughtyb_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : pleiads_sound_device(mconfig, NAUGHTYB, "Naughty Boy Custom", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void naughtyb_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void naughtyb_sound_device::device_start() +{ + DEVICE_START_NAME( naughtyb_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void naughtyb_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type POPFLAME = &device_creator<popflame_sound_device>; + +popflame_sound_device::popflame_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : pleiads_sound_device(mconfig, POPFLAME, "Pop Flamer Custom", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void popflame_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void popflame_sound_device::device_start() +{ + DEVICE_START_NAME( popflame_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void popflame_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/pleiads.h b/src/mame/audio/pleiads.h index eea76d9d66a..460727b9ef4 100644 --- a/src/mame/audio/pleiads.h +++ b/src/mame/audio/pleiads.h @@ -2,6 +2,61 @@ WRITE8_DEVICE_HANDLER( pleiads_sound_control_a_w ); WRITE8_DEVICE_HANDLER( pleiads_sound_control_b_w ); WRITE8_DEVICE_HANDLER( pleiads_sound_control_c_w ); -DECLARE_LEGACY_SOUND_DEVICE(PLEIADS, pleiads_sound); -DECLARE_LEGACY_SOUND_DEVICE(NAUGHTYB, naughtyb_sound); -DECLARE_LEGACY_SOUND_DEVICE(POPFLAME, popflame_sound); +class pleiads_sound_device : public device_t, + public device_sound_interface +{ +public: + pleiads_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + pleiads_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~pleiads_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type PLEIADS; + +class naughtyb_sound_device : public pleiads_sound_device +{ +public: + naughtyb_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state +}; + +extern const device_type NAUGHTYB; + +class popflame_sound_device : public pleiads_sound_device +{ +public: + popflame_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state +}; + +extern const device_type POPFLAME; + diff --git a/src/mame/audio/polepos.c b/src/mame/audio/polepos.c index cc098f60f52..33f0a5bb500 100644 --- a/src/mame/audio/polepos.c +++ b/src/mame/audio/polepos.c @@ -51,7 +51,7 @@ INLINE polepos_sound_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == POLEPOS); - return (polepos_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (polepos_sound_state *)downcast<polepos_sound_device *>(device)->token(); } /************************************/ @@ -369,4 +369,51 @@ DISCRETE_SOUND_START(polepos) DISCRETE_SOUND_END -DEFINE_LEGACY_SOUND_DEVICE(POLEPOS, polepos_sound); +const device_type POLEPOS = &device_creator<polepos_sound_device>; + +polepos_sound_device::polepos_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, POLEPOS, "Pole Position Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(polepos_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void polepos_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void polepos_sound_device::device_start() +{ + DEVICE_START_NAME( polepos_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void polepos_sound_device::device_reset() +{ + DEVICE_RESET_NAME( polepos_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void polepos_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/redbaron.c b/src/mame/audio/redbaron.c index c32135d3bca..b3d5eec94ed 100644 --- a/src/mame/audio/redbaron.c +++ b/src/mame/audio/redbaron.c @@ -50,7 +50,7 @@ INLINE redbaron_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == REDBARON); - return (redbaron_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (redbaron_sound_state *)downcast<redbaron_sound_device *>(device)->token(); } @@ -244,4 +244,42 @@ DEVICE_GET_INFO( redbaron_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(REDBARON, redbaron_sound); +const device_type REDBARON = &device_creator<redbaron_sound_device>; + +redbaron_sound_device::redbaron_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, REDBARON, "Red Baron Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(redbaron_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void redbaron_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void redbaron_sound_device::device_start() +{ + DEVICE_START_NAME( redbaron_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void redbaron_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/segag80r.c b/src/mame/audio/segag80r.c index 579f7ac48c6..6c09bf82682 100644 --- a/src/mame/audio/segag80r.c +++ b/src/mame/audio/segag80r.c @@ -29,8 +29,63 @@ DEVICE_GET_INFO( sega005_sound ); -DECLARE_LEGACY_SOUND_DEVICE(SEGA005, sega005_sound); -DEFINE_LEGACY_SOUND_DEVICE(SEGA005, sega005_sound); +class sega005_sound_device : public device_t, + public device_sound_interface +{ +public: + sega005_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state +}; + +extern const device_type SEGA005; + +const device_type SEGA005 = &device_creator<sega005_sound_device>; + +sega005_sound_device::sega005_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SEGA005, "005 Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void sega005_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +static DEVICE_START( sega005_sound ); +void sega005_sound_device::device_start() +{ + DEVICE_START_NAME( sega005_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void sega005_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/segasnd.c b/src/mame/audio/segasnd.c index 563944a10ec..0b3118e40e1 100644 --- a/src/mame/audio/segasnd.c +++ b/src/mame/audio/segasnd.c @@ -141,14 +141,36 @@ INLINE double step_cr_filter(filter_state *state, double input) SPEECH BOARD ***************************************************************************/ -DECLARE_LEGACY_SOUND_DEVICE(SEGASPEECH, speech_sound); +class speech_sound_device : public device_t, + public device_sound_interface +{ +public: + speech_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~speech_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SEGASPEECH; + INLINE speech_state *get_safe_speech(device_t *device) { assert(device != NULL); assert(device->type() == SEGASPEECH); - return (speech_state *)downcast<legacy_device_base *>(device)->token(); + return (speech_state *)downcast<speech_sound_device *>(device)->token(); } static DEVICE_START( speech_sound ) @@ -175,7 +197,45 @@ DEVICE_GET_INFO( speech_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(SEGASPEECH, speech_sound); +const device_type SEGASPEECH = &device_creator<speech_sound_device>; + +speech_sound_device::speech_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SEGASPEECH, "Sega Speech Sound Board", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(speech_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void speech_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void speech_sound_device::device_start() +{ + DEVICE_START_NAME( speech_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void speech_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + @@ -348,14 +408,37 @@ MACHINE_CONFIG_END UNIVERSAL SOUND BOARD ***************************************************************************/ -static DECLARE_LEGACY_SOUND_DEVICE(SEGAUSB, usb_sound); +class usb_sound_device : public device_t, + public device_sound_interface +{ +public: + usb_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~usb_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SEGAUSB; + INLINE usb_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SEGAUSB); - return (usb_state *)downcast<legacy_device_base *>(device)->token(); + return (usb_state *)downcast<usb_sound_device *>(device)->token(); } /************************************* @@ -817,7 +900,7 @@ static DEVICE_START( usb_sound ) } -static DEVICE_GET_INFO( usb_sound ) +DEVICE_GET_INFO( usb_sound ) { switch (state) { @@ -834,7 +917,54 @@ static DEVICE_GET_INFO( usb_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(SEGAUSB, usb_sound); +const device_type SEGAUSB = &device_creator<usb_sound_device>; + +usb_sound_device::usb_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SEGAUSB, "Sega Universal Sound Board", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(usb_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void usb_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void usb_sound_device::device_start() +{ + DEVICE_START_NAME( usb_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void usb_sound_device::device_reset() +{ + DEVICE_RESET_NAME( usb_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void usb_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/seibu.c b/src/mame/audio/seibu.c index 1b1f1c20c16..f97dd4d4d6f 100644 --- a/src/mame/audio/seibu.c +++ b/src/mame/audio/seibu.c @@ -183,7 +183,7 @@ static STREAM_UPDATE( seibu_adpcm_callback ) static DEVICE_START( seibu_adpcm ) { running_machine &machine = device->machine(); - seibu_adpcm_state *state = (seibu_adpcm_state *)downcast<legacy_device_base *>(device)->token(); + seibu_adpcm_state *state = (seibu_adpcm_state *)downcast<seibu_adpcm_device *>(device)->token(); const seibu_adpcm_interface *intf; intf = (const seibu_adpcm_interface *)device->static_config(); @@ -229,7 +229,7 @@ void seibu_adpcm_decrypt(running_machine &machine, const char *region) WRITE8_DEVICE_HANDLER( seibu_adpcm_adr_w ) { - seibu_adpcm_state *state = (seibu_adpcm_state *)downcast<legacy_device_base *>(device)->token(); + seibu_adpcm_state *state = (seibu_adpcm_state *)downcast<seibu_adpcm_device *>(device)->token(); if (state->m_stream) state->m_stream->update(); @@ -246,7 +246,7 @@ WRITE8_DEVICE_HANDLER( seibu_adpcm_adr_w ) WRITE8_DEVICE_HANDLER( seibu_adpcm_ctl_w ) { - seibu_adpcm_state *state = (seibu_adpcm_state *)downcast<legacy_device_base *>(device)->token(); + seibu_adpcm_state *state = (seibu_adpcm_state *)downcast<seibu_adpcm_device *>(device)->token(); // sequence is 00 02 01 each time. if (state->m_stream) @@ -619,4 +619,42 @@ ADDRESS_MAP_START( seibu3_adpcm_sound_map, AS_PROGRAM, 8, driver_device ) ADDRESS_MAP_END -DEFINE_LEGACY_SOUND_DEVICE(SEIBU_ADPCM, seibu_adpcm); +const device_type SEIBU_ADPCM = &device_creator<seibu_adpcm_device>; + +seibu_adpcm_device::seibu_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SEIBU_ADPCM, "Seibu ADPCM", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(seibu_adpcm_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void seibu_adpcm_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void seibu_adpcm_device::device_start() +{ + DEVICE_START_NAME( seibu_adpcm )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void seibu_adpcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h index 4b898bd750e..31027b925e1 100644 --- a/src/mame/audio/seibu.h +++ b/src/mame/audio/seibu.h @@ -63,7 +63,29 @@ void seibu_adpcm_decrypt(running_machine &machine, const char *region); WRITE8_DEVICE_HANDLER( seibu_adpcm_adr_w ); WRITE8_DEVICE_HANDLER( seibu_adpcm_ctl_w ); -DECLARE_LEGACY_SOUND_DEVICE(SEIBU_ADPCM, seibu_adpcm); +class seibu_adpcm_device : public device_t, + public device_sound_interface +{ +public: + seibu_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~seibu_adpcm_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SEIBU_ADPCM; + extern const ym3812_interface seibu_ym3812_interface; extern const ym2151_interface seibu_ym2151_interface; diff --git a/src/mame/audio/snes_snd.c b/src/mame/audio/snes_snd.c index 5d1e8dfb3aa..aa90bdbe205 100644 --- a/src/mame/audio/snes_snd.c +++ b/src/mame/audio/snes_snd.c @@ -238,7 +238,7 @@ INLINE snes_sound_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == SNES); - return (snes_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (snes_sound_state *)downcast<snes_sound_device *>(device)->token(); } /***************************************************************************** @@ -1377,4 +1377,51 @@ DEVICE_GET_INFO(snes_sound) } } -DEFINE_LEGACY_SOUND_DEVICE(SNES, snes_sound); +const device_type SNES = &device_creator<snes_sound_device>; + +snes_sound_device::snes_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SNES, "SNES Custom DSP (SPC700)", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(snes_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void snes_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void snes_sound_device::device_start() +{ + DEVICE_START_NAME( snes_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void snes_sound_device::device_reset() +{ + DEVICE_RESET_NAME( snes_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void snes_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/snes_snd.h b/src/mame/audio/snes_snd.h index 1d69c58ec37..35eec3b058e 100644 --- a/src/mame/audio/snes_snd.h +++ b/src/mame/audio/snes_snd.h @@ -16,7 +16,30 @@ DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_SOUND_DEVICE(SNES, snes_sound); +class snes_sound_device : public device_t, + public device_sound_interface +{ +public: + snes_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~snes_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SNES; + /*************************************************************************** diff --git a/src/mame/audio/snk6502.c b/src/mame/audio/snk6502.c index beede4e6b17..38cb1687037 100644 --- a/src/mame/audio/snk6502.c +++ b/src/mame/audio/snk6502.c @@ -386,7 +386,7 @@ INLINE snk6502_sound_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == SNK6502); - return (snk6502_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (snk6502_sound_state *)downcast<snk6502_sound_device *>(device)->token(); } INLINE void validate_tone_channel(snk6502_sound_state *state, int channel) @@ -1266,4 +1266,42 @@ WRITE8_HANDLER( fantasy_speech_w ) } -DEFINE_LEGACY_SOUND_DEVICE(SNK6502, snk6502_sound); +const device_type SNK6502 = &device_creator<snk6502_sound_device>; + +snk6502_sound_device::snk6502_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SNK6502, "snk6502 Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(snk6502_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void snk6502_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void snk6502_sound_device::device_start() +{ + DEVICE_START_NAME( snk6502_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void snk6502_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/taitosnd.c b/src/mame/audio/taitosnd.c index b25f1c8c021..13db082dc48 100644 --- a/src/mame/audio/taitosnd.c +++ b/src/mame/audio/taitosnd.c @@ -39,7 +39,7 @@ INLINE tc0140syt_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0140SYT); - return (tc0140syt_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0140syt_state *)downcast<tc0140syt_device *>(device)->token(); } INLINE const tc0140syt_interface *get_interface( device_t *device ) @@ -327,4 +327,40 @@ DEVICE_GET_INFO(tc0140syt) } } -DEFINE_LEGACY_DEVICE(TC0140SYT, tc0140syt); +const device_type TC0140SYT = &device_creator<tc0140syt_device>; + +tc0140syt_device::tc0140syt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0140SYT, "Taito TC0140SYT", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0140syt_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0140syt_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0140syt_device::device_start() +{ + DEVICE_START_NAME( tc0140syt )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0140syt_device::device_reset() +{ + DEVICE_RESET_NAME( tc0140syt )(this); +} + + diff --git a/src/mame/audio/taitosnd.h b/src/mame/audio/taitosnd.h index 8d4c0969a25..5adb58b9391 100644 --- a/src/mame/audio/taitosnd.h +++ b/src/mame/audio/taitosnd.h @@ -15,7 +15,26 @@ struct _tc0140syt_interface const char *slave; }; -DECLARE_LEGACY_DEVICE(TC0140SYT, tc0140syt); +class tc0140syt_device : public device_t +{ +public: + tc0140syt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0140syt_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0140SYT; + /*************************************************************************** DEVICE CONFIGURATION MACROS diff --git a/src/mame/audio/tiamc1.c b/src/mame/audio/tiamc1.c index 7dac127017b..f979e3e4ad8 100644 --- a/src/mame/audio/tiamc1.c +++ b/src/mame/audio/tiamc1.c @@ -75,7 +75,7 @@ INLINE tiamc1_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == TIAMC1); - return (tiamc1_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (tiamc1_sound_state *)downcast<tiamc1_sound_device *>(device)->token(); } @@ -348,4 +348,42 @@ DEVICE_GET_INFO( tiamc1_sound ) -DEFINE_LEGACY_SOUND_DEVICE(TIAMC1, tiamc1_sound); +const device_type TIAMC1 = &device_creator<tiamc1_sound_device>; + +tiamc1_sound_device::tiamc1_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TIAMC1, "TIA-MC1 Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tiamc1_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tiamc1_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tiamc1_sound_device::device_start() +{ + DEVICE_START_NAME( tiamc1_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tiamc1_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/timeplt.c b/src/mame/audio/timeplt.c index 1d1fc1c36a0..f9e7caf5091 100644 --- a/src/mame/audio/timeplt.c +++ b/src/mame/audio/timeplt.c @@ -38,7 +38,7 @@ INLINE timeplt_audio_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TIMEPLT_AUDIO); - return (timeplt_audio_state *)downcast<legacy_device_base *>(device)->token(); + return (timeplt_audio_state *)downcast<timeplt_audio_device *>(device)->token(); } @@ -273,4 +273,42 @@ DEVICE_GET_INFO(timeplt_audio) } } -DEFINE_LEGACY_SOUND_DEVICE(TIMEPLT_AUDIO, timeplt_audio); +const device_type TIMEPLT_AUDIO = &device_creator<timeplt_audio_device>; + +timeplt_audio_device::timeplt_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TIMEPLT_AUDIO, "Time Pilot Audio", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(timeplt_audio_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void timeplt_audio_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void timeplt_audio_device::device_start() +{ + DEVICE_START_NAME( timeplt_audio )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void timeplt_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/timeplt.h b/src/mame/audio/timeplt.h index 96eb7c2e698..32b60f581f4 100644 --- a/src/mame/audio/timeplt.h +++ b/src/mame/audio/timeplt.h @@ -3,4 +3,26 @@ WRITE8_HANDLER( timeplt_sh_irqtrigger_w ); MACHINE_CONFIG_EXTERN( timeplt_sound ); MACHINE_CONFIG_EXTERN( locomotn_sound ); -DECLARE_LEGACY_SOUND_DEVICE(TIMEPLT_AUDIO, timeplt_audio); +class timeplt_audio_device : public device_t, + public device_sound_interface +{ +public: + timeplt_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~timeplt_audio_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type TIMEPLT_AUDIO; + diff --git a/src/mame/audio/trackfld.c b/src/mame/audio/trackfld.c index 59d4f084707..b432ef782b8 100644 --- a/src/mame/audio/trackfld.c +++ b/src/mame/audio/trackfld.c @@ -26,7 +26,7 @@ INLINE trackfld_audio_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TRACKFLD_AUDIO); - return (trackfld_audio_state *)downcast<legacy_device_base *>(device)->token(); + return (trackfld_audio_state *)downcast<trackfld_audio_device *>(device)->token(); } @@ -175,4 +175,51 @@ DEVICE_GET_INFO(trackfld_audio) } } -DEFINE_LEGACY_SOUND_DEVICE(TRACKFLD_AUDIO, trackfld_audio); +const device_type TRACKFLD_AUDIO = &device_creator<trackfld_audio_device>; + +trackfld_audio_device::trackfld_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TRACKFLD_AUDIO, "Track And Field Audio", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(trackfld_audio_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void trackfld_audio_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void trackfld_audio_device::device_start() +{ + DEVICE_START_NAME( trackfld_audio )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void trackfld_audio_device::device_reset() +{ + DEVICE_RESET_NAME( trackfld_audio )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void trackfld_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/trackfld.h b/src/mame/audio/trackfld.h index 1fc8b09f034..342e1b90ad5 100644 --- a/src/mame/audio/trackfld.h +++ b/src/mame/audio/trackfld.h @@ -7,4 +7,27 @@ WRITE8_DEVICE_HANDLER( hyperspt_sound_w ); WRITE8_HANDLER( konami_SN76496_latch_w ); WRITE8_DEVICE_HANDLER( konami_SN76496_w ); -DECLARE_LEGACY_SOUND_DEVICE(TRACKFLD_AUDIO, trackfld_audio); +class trackfld_audio_device : public device_t, + public device_sound_interface +{ +public: + trackfld_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~trackfld_audio_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type TRACKFLD_AUDIO; + diff --git a/src/mame/audio/tx1.c b/src/mame/audio/tx1.c index 37091a02503..508fb74f615 100644 --- a/src/mame/audio/tx1.c +++ b/src/mame/audio/tx1.c @@ -72,7 +72,7 @@ INLINE tx1_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == TX1 || device->type() == BUGGYBOY); - return (tx1_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (tx1_sound_state *)downcast<tx1_sound_device *>(device)->token(); } WRITE8_DEVICE_HANDLER( tx1_pit8253_w ) @@ -608,5 +608,99 @@ DEVICE_GET_INFO( buggyboy_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(BUGGYBOY, buggyboy_sound); -DEFINE_LEGACY_SOUND_DEVICE(TX1, tx1_sound); +const device_type BUGGYBOY = &device_creator<buggyboy_sound_device>; + +buggyboy_sound_device::buggyboy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, BUGGYBOY, "Buggy Boy Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tx1_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void buggyboy_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void buggyboy_sound_device::device_start() +{ + DEVICE_START_NAME( buggyboy_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void buggyboy_sound_device::device_reset() +{ + DEVICE_RESET_NAME( buggyboy_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void buggyboy_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type TX1 = &device_creator<tx1_sound_device>; + +tx1_sound_device::tx1_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TX1, "TX-1 Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tx1_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tx1_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tx1_sound_device::device_start() +{ + DEVICE_START_NAME( tx1_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tx1_sound_device::device_reset() +{ + DEVICE_RESET_NAME( tx1_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void tx1_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/warpwarp.c b/src/mame/audio/warpwarp.c index 22093fe774d..0f3d13379ad 100644 --- a/src/mame/audio/warpwarp.c +++ b/src/mame/audio/warpwarp.c @@ -40,7 +40,7 @@ INLINE warpwarp_sound_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == WARPWARP); - return (warpwarp_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (warpwarp_sound_state *)downcast<warpwarp_sound_device *>(device)->token(); } static TIMER_CALLBACK( sound_volume_decay ) @@ -258,4 +258,42 @@ DEVICE_GET_INFO( warpwarp_sound ) } -DEFINE_LEGACY_SOUND_DEVICE(WARPWARP, warpwarp_sound); +const device_type WARPWARP = &device_creator<warpwarp_sound_device>; + +warpwarp_sound_device::warpwarp_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, WARPWARP, "Warp Warp Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(warpwarp_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void warpwarp_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void warpwarp_sound_device::device_start() +{ + DEVICE_START_NAME( warpwarp_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void warpwarp_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/wiping.c b/src/mame/audio/wiping.c index ee4a664f5e4..d5fc35f3d44 100644 --- a/src/mame/audio/wiping.c +++ b/src/mame/audio/wiping.c @@ -61,7 +61,7 @@ INLINE wiping_sound_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == WIPING); - return (wiping_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (wiping_sound_state *)downcast<wiping_sound_device *>(device)->token(); } /* build a table to divide by the number of voices; gain is specified as gain*16 */ @@ -278,4 +278,42 @@ WRITE8_DEVICE_HANDLER( wiping_sound_w ) } -DEFINE_LEGACY_SOUND_DEVICE(WIPING, wiping_sound); +const device_type WIPING = &device_creator<wiping_sound_device>; + +wiping_sound_device::wiping_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, WIPING, "Wiping Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(wiping_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void wiping_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void wiping_sound_device::device_start() +{ + DEVICE_START_NAME( wiping_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void wiping_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mame/audio/wiping.h b/src/mame/audio/wiping.h index c3e61a2fee1..d7ab3f23b73 100644 --- a/src/mame/audio/wiping.h +++ b/src/mame/audio/wiping.h @@ -1,3 +1,25 @@ -DECLARE_LEGACY_SOUND_DEVICE(WIPING, wiping_sound); +class wiping_sound_device : public device_t, + public device_sound_interface +{ +public: + wiping_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~wiping_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type WIPING; + WRITE8_DEVICE_HANDLER( wiping_sound_w ); diff --git a/src/mame/drivers/mjkjidai.c b/src/mame/drivers/mjkjidai.c index 8ca3d5c0656..790a2a9ad9d 100644 --- a/src/mame/drivers/mjkjidai.c +++ b/src/mame/drivers/mjkjidai.c @@ -27,6 +27,29 @@ TODO: #include "sound/okiadpcm.h" #include "includes/mjkjidai.h" +class mjkjidai_adpcm_device : public device_t, + public device_sound_interface +{ +public: + mjkjidai_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mjkjidai_adpcm_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type MJKJIDAI; + /* Start of ADPCM custom chip code */ typedef struct _mjkjidai_adpcm_state mjkjidai_adpcm_state; struct _mjkjidai_adpcm_state @@ -70,7 +93,7 @@ static STREAM_UPDATE( mjkjidai_adpcm_callback ) static DEVICE_START( mjkjidai_adpcm ) { running_machine &machine = device->machine(); - mjkjidai_adpcm_state *state = (mjkjidai_adpcm_state *)downcast<legacy_device_base *>(device)->token(); + mjkjidai_adpcm_state *state = (mjkjidai_adpcm_state *)downcast<mjkjidai_adpcm_device *>(device)->token(); state->m_playing = 0; state->m_stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock(), state, mjkjidai_adpcm_callback); @@ -93,8 +116,45 @@ DEVICE_GET_INFO( mjkjidai_adpcm ) } } -DECLARE_LEGACY_SOUND_DEVICE(MJKJIDAI, mjkjidai_adpcm); -DEFINE_LEGACY_SOUND_DEVICE(MJKJIDAI, mjkjidai_adpcm); +const device_type MJKJIDAI = &device_creator<mjkjidai_adpcm_device>; + +mjkjidai_adpcm_device::mjkjidai_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MJKJIDAI, "Custom ADPCM", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mjkjidai_adpcm_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mjkjidai_adpcm_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mjkjidai_adpcm_device::device_start() +{ + DEVICE_START_NAME( mjkjidai_adpcm )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void mjkjidai_adpcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + static void mjkjidai_adpcm_play (mjkjidai_adpcm_state *state, int offset, int length) @@ -108,7 +168,7 @@ static void mjkjidai_adpcm_play (mjkjidai_adpcm_state *state, int offset, int le WRITE8_MEMBER(mjkjidai_state::adpcm_w) { device_t *device = machine().device("adpcm"); - mjkjidai_adpcm_state *state = (mjkjidai_adpcm_state *)downcast<legacy_device_base *>(device)->token(); + mjkjidai_adpcm_state *state = (mjkjidai_adpcm_state *)downcast<mjkjidai_adpcm_device *>(device)->token(); mjkjidai_adpcm_play (state, (data & 0x07) * 0x1000, 0x1000 * 2); } /* End of ADPCM custom chip code */ diff --git a/src/mame/drivers/ninjaw.c b/src/mame/drivers/ninjaw.c index 2a877e50c4d..504fed57373 100644 --- a/src/mame/drivers/ninjaw.c +++ b/src/mame/drivers/ninjaw.c @@ -686,8 +686,68 @@ static DEVICE_GET_INFO( subwoofer ) } } -DECLARE_LEGACY_SOUND_DEVICE(SUBWOOFER, subwoofer); -DEFINE_LEGACY_SOUND_DEVICE(SUBWOOFER, subwoofer); +class subwoofer_device : public device_t, + public device_sound_interface +{ +public: + subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~subwoofer_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SUBWOOFER; + +const device_type SUBWOOFER = &device_creator<subwoofer_device>; + +subwoofer_device::subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SUBWOOFER, "Subwoofer", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof()); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void subwoofer_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void subwoofer_device::device_start() +{ + DEVICE_START_NAME( subwoofer )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void subwoofer_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + #endif diff --git a/src/mame/drivers/renegade.c b/src/mame/drivers/renegade.c index 9aed459b1a9..f744476eb35 100644 --- a/src/mame/drivers/renegade.c +++ b/src/mame/drivers/renegade.c @@ -123,14 +123,36 @@ struct _renegade_adpcm_state UINT8 *m_base; } _renegade_adpcm_state_dummy; -DECLARE_LEGACY_SOUND_DEVICE(RENEGADE_ADPCM, renegade_adpcm); +class renegade_adpcm_device : public device_t, + public device_sound_interface +{ +public: + renegade_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~renegade_adpcm_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type RENEGADE_ADPCM; + INLINE renegade_adpcm_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == RENEGADE_ADPCM); - return (renegade_adpcm_state *)downcast<legacy_device_base *>(device)->token(); + return (renegade_adpcm_state *)downcast<renegade_adpcm_device *>(device)->token(); } static STREAM_UPDATE( renegade_adpcm_callback ) @@ -185,7 +207,45 @@ DEVICE_GET_INFO( renegade_adpcm ) } } -DEFINE_LEGACY_SOUND_DEVICE(RENEGADE_ADPCM, renegade_adpcm); +const device_type RENEGADE_ADPCM = &device_creator<renegade_adpcm_device>; + +renegade_adpcm_device::renegade_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, RENEGADE_ADPCM, "Renegade Custom ADPCM", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(renegade_adpcm_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void renegade_adpcm_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void renegade_adpcm_device::device_start() +{ + DEVICE_START_NAME( renegade_adpcm )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void renegade_adpcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + WRITE8_MEMBER(renegade_state::adpcm_play_w) diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index 853581ef294..1556dc9ec80 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -466,7 +466,29 @@ const amiga_machine_interface *amiga_get_interface(running_machine &machine); /*----------- defined in audio/amiga.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(AMIGA, amiga_sound); +class amiga_sound_device : public device_t, + public device_sound_interface +{ +public: + amiga_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~amiga_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type AMIGA; + void amiga_audio_update(device_t *device); void amiga_audio_data_w(device_t *device, int which, UINT16 data); diff --git a/src/mame/includes/beezer.h b/src/mame/includes/beezer.h index 0db2de0d25b..d309c912aaa 100644 --- a/src/mame/includes/beezer.h +++ b/src/mame/includes/beezer.h @@ -27,7 +27,30 @@ extern const via6522_interface b_via_1_interface; /*----------- defined in audio/beezer.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(BEEZER, beezer_sound); +class beezer_sound_device : public device_t, + public device_sound_interface +{ +public: + beezer_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~beezer_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type BEEZER; + READ8_DEVICE_HANDLER( beezer_sh6840_r ); WRITE8_DEVICE_HANDLER( beezer_sh6840_w ); diff --git a/src/mame/includes/bzone.h b/src/mame/includes/bzone.h index ae7a94a54ba..69352a887ad 100644 --- a/src/mame/includes/bzone.h +++ b/src/mame/includes/bzone.h @@ -37,4 +37,26 @@ MACHINE_CONFIG_EXTERN( bzone_audio ); WRITE8_DEVICE_HANDLER( redbaron_sounds_w ); -DECLARE_LEGACY_SOUND_DEVICE(REDBARON, redbaron_sound); +class redbaron_sound_device : public device_t, + public device_sound_interface +{ +public: + redbaron_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~redbaron_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type REDBARON; + diff --git a/src/mame/includes/cd32.h b/src/mame/includes/cd32.h index 623efa022fc..23ff02786cf 100644 --- a/src/mame/includes/cd32.h +++ b/src/mame/includes/cd32.h @@ -46,6 +46,26 @@ public: READ32_DEVICE_HANDLER( amiga_akiko32_r ); WRITE32_DEVICE_HANDLER( amiga_akiko32_w ); -DECLARE_LEGACY_DEVICE(AKIKO, akiko); +class akiko_device : public device_t +{ +public: + akiko_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~akiko_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type AKIKO; + #endif /* __CUBOCD32_H__ */ diff --git a/src/mame/includes/cps3.h b/src/mame/includes/cps3.h index 9381f85b3ac..51672666992 100644 --- a/src/mame/includes/cps3.h +++ b/src/mame/includes/cps3.h @@ -108,7 +108,29 @@ public: /*----------- defined in audio/cps3.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(CPS3, cps3_sound); +class cps3_sound_device : public device_t, + public device_sound_interface +{ +public: + cps3_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~cps3_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type CPS3; + WRITE32_DEVICE_HANDLER( cps3_sound_w ); READ32_DEVICE_HANDLER( cps3_sound_r ); diff --git a/src/mame/includes/flower.h b/src/mame/includes/flower.h index f91eb817fd9..f7626e4f7aa 100644 --- a/src/mame/includes/flower.h +++ b/src/mame/includes/flower.h @@ -43,7 +43,30 @@ public: WRITE8_DEVICE_HANDLER( flower_sound1_w ); WRITE8_DEVICE_HANDLER( flower_sound2_w ); -DECLARE_LEGACY_SOUND_DEVICE(FLOWER, flower_sound); +class flower_sound_device : public device_t, + public device_sound_interface +{ +public: + flower_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~flower_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type FLOWER; + /*----------- defined in video/flower.c -----------*/ diff --git a/src/mame/includes/gomoku.h b/src/mame/includes/gomoku.h index ba24bea8ed4..d8a8ee2db06 100644 --- a/src/mame/includes/gomoku.h +++ b/src/mame/includes/gomoku.h @@ -30,7 +30,29 @@ public: WRITE8_DEVICE_HANDLER( gomoku_sound1_w ); WRITE8_DEVICE_HANDLER( gomoku_sound2_w ); -DECLARE_LEGACY_SOUND_DEVICE(GOMOKU, gomoku_sound); +class gomoku_sound_device : public device_t, + public device_sound_interface +{ +public: + gomoku_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~gomoku_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type GOMOKU; + /*----------- defined in video/gomoku.c -----------*/ diff --git a/src/mame/includes/gridlee.h b/src/mame/includes/gridlee.h index 07b1ffb7475..a642efea617 100644 --- a/src/mame/includes/gridlee.h +++ b/src/mame/includes/gridlee.h @@ -58,7 +58,29 @@ public: WRITE8_DEVICE_HANDLER( gridlee_sound_w ); -DECLARE_LEGACY_SOUND_DEVICE(GRIDLEE, gridlee_sound); +class gridlee_sound_device : public device_t, + public device_sound_interface +{ +public: + gridlee_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~gridlee_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type GRIDLEE; + /*----------- defined in video/gridlee.c -----------*/ diff --git a/src/mame/includes/leland.h b/src/mame/includes/leland.h index 68f0e7fe165..e1e0bbafc70 100644 --- a/src/mame/includes/leland.h +++ b/src/mame/includes/leland.h @@ -188,9 +188,66 @@ void leland_rotate_memory(running_machine &machine, const char *cpuname); /*----------- defined in audio/leland.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(LELAND, leland_sound); -DECLARE_LEGACY_SOUND_DEVICE(LELAND_80186, leland_80186_sound); -DECLARE_LEGACY_SOUND_DEVICE(REDLINE_80186, redline_80186_sound); +class leland_sound_device : public device_t, + public device_sound_interface +{ +public: + leland_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + leland_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~leland_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type LELAND; + +class leland_80186_sound_device : public leland_sound_device +{ +public: + leland_80186_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + leland_80186_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state +}; + +extern const device_type LELAND_80186; + +class redline_80186_sound_device : public leland_80186_sound_device +{ +public: + redline_80186_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state +}; + +extern const device_type REDLINE_80186; + void leland_dac_update(device_t *device, int dacnum, UINT8 sample); diff --git a/src/mame/includes/micro3d.h b/src/mame/includes/micro3d.h index de094051a8f..dfcb903b967 100644 --- a/src/mame/includes/micro3d.h +++ b/src/mame/includes/micro3d.h @@ -135,7 +135,30 @@ WRITE8_DEVICE_HANDLER( micro3d_upd7759_w ); void micro3d_noise_sh_w(running_machine &machine, UINT8 data); -DECLARE_LEGACY_SOUND_DEVICE(MICRO3D, micro3d_sound); +class micro3d_sound_device : public device_t, + public device_sound_interface +{ +public: + micro3d_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~micro3d_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type MICRO3D; + /*----------- defined in video/micro3d.c -----------*/ diff --git a/src/mame/includes/phoenix.h b/src/mame/includes/phoenix.h index 5f4a51d36c0..a72eb273c9a 100644 --- a/src/mame/includes/phoenix.h +++ b/src/mame/includes/phoenix.h @@ -51,7 +51,29 @@ DISCRETE_SOUND_EXTERN( phoenix ); WRITE8_DEVICE_HANDLER( phoenix_sound_control_a_w ); WRITE8_DEVICE_HANDLER( phoenix_sound_control_b_w ); -DECLARE_LEGACY_SOUND_DEVICE(PHOENIX, phoenix_sound); +class phoenix_sound_device : public device_t, + public device_sound_interface +{ +public: + phoenix_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~phoenix_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type PHOENIX; + /*----------- defined in video/phoenix.c -----------*/ diff --git a/src/mame/includes/polepos.h b/src/mame/includes/polepos.h index 474e1649f13..192d6dec523 100644 --- a/src/mame/includes/polepos.h +++ b/src/mame/includes/polepos.h @@ -79,7 +79,30 @@ public: /*----------- defined in audio/polepos.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(POLEPOS, polepos_sound); +class polepos_sound_device : public device_t, + public device_sound_interface +{ +public: + polepos_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~polepos_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type POLEPOS; + WRITE8_DEVICE_HANDLER( polepos_engine_sound_lsb_w ); WRITE8_DEVICE_HANDLER( polepos_engine_sound_msb_w ); diff --git a/src/mame/includes/snk6502.h b/src/mame/includes/snk6502.h index 73a9630f32f..f1424107282 100644 --- a/src/mame/includes/snk6502.h +++ b/src/mame/includes/snk6502.h @@ -70,7 +70,29 @@ extern WRITE8_HANDLER( vanguard_speech_w ); extern WRITE8_HANDLER( fantasy_sound_w ); extern WRITE8_HANDLER( fantasy_speech_w ); -DECLARE_LEGACY_SOUND_DEVICE(SNK6502, snk6502_sound); +class snk6502_sound_device : public device_t, + public device_sound_interface +{ +public: + snk6502_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~snk6502_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SNK6502; + void snk6502_set_music_clock(running_machine &machine, double clock_time); void snk6502_set_music_freq(running_machine &machine, int freq); diff --git a/src/mame/includes/tiamc1.h b/src/mame/includes/tiamc1.h index 1bc06158e12..1086dd2b32a 100644 --- a/src/mame/includes/tiamc1.h +++ b/src/mame/includes/tiamc1.h @@ -33,7 +33,29 @@ public: /*----------- defined in audio/tiamc1.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(TIAMC1, tiamc1_sound); +class tiamc1_sound_device : public device_t, + public device_sound_interface +{ +public: + tiamc1_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tiamc1_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type TIAMC1; + WRITE8_DEVICE_HANDLER( tiamc1_timer0_w ); WRITE8_DEVICE_HANDLER( tiamc1_timer1_w ); diff --git a/src/mame/includes/tx1.h b/src/mame/includes/tx1.h index 2ac98c96f8f..46a0f4f0428 100644 --- a/src/mame/includes/tx1.h +++ b/src/mame/includes/tx1.h @@ -178,12 +178,58 @@ WRITE8_DEVICE_HANDLER( bb_ym1_a_w ); WRITE8_DEVICE_HANDLER( bb_ym2_a_w ); WRITE8_DEVICE_HANDLER( bb_ym2_b_w ); -DECLARE_LEGACY_SOUND_DEVICE(BUGGYBOY, buggyboy_sound); +class buggyboy_sound_device : public device_t, + public device_sound_interface +{ +public: + buggyboy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~buggyboy_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type BUGGYBOY; + WRITE8_DEVICE_HANDLER( tx1_ay8910_a_w ); WRITE8_DEVICE_HANDLER( tx1_ay8910_b_w ); -DECLARE_LEGACY_SOUND_DEVICE(TX1, tx1_sound); +class tx1_sound_device : public device_t, + public device_sound_interface +{ +public: + tx1_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tx1_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type TX1; + /*----------- defined in video/tx1.c -----------*/ diff --git a/src/mame/includes/warpwarp.h b/src/mame/includes/warpwarp.h index 311b65b783c..f2ef631e58e 100644 --- a/src/mame/includes/warpwarp.h +++ b/src/mame/includes/warpwarp.h @@ -54,7 +54,29 @@ SCREEN_UPDATE_IND16( geebee ); WRITE8_DEVICE_HANDLER( geebee_sound_w ); -DECLARE_LEGACY_SOUND_DEVICE(GEEBEE, geebee_sound); +class geebee_sound_device : public device_t, + public device_sound_interface +{ +public: + geebee_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~geebee_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type GEEBEE; + /*----------- defined in audio/warpwarp.c -----------*/ @@ -63,4 +85,26 @@ WRITE8_DEVICE_HANDLER( warpwarp_sound_w ); WRITE8_DEVICE_HANDLER( warpwarp_music1_w ); WRITE8_DEVICE_HANDLER( warpwarp_music2_w ); -DECLARE_LEGACY_SOUND_DEVICE(WARPWARP, warpwarp_sound); +class warpwarp_sound_device : public device_t, + public device_sound_interface +{ +public: + warpwarp_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~warpwarp_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type WARPWARP; + diff --git a/src/mame/machine/buggychl.c b/src/mame/machine/buggychl.c index df208f1d70e..af5363fa498 100644 --- a/src/mame/machine/buggychl.c +++ b/src/mame/machine/buggychl.c @@ -27,7 +27,7 @@ INLINE buggychl_mcu_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == BUGGYCHL_MCU); - return (buggychl_mcu_state *)downcast<legacy_device_base *>(device)->token(); + return (buggychl_mcu_state *)downcast<buggychl_mcu_device *>(device)->token(); } /*************************************************************************** @@ -254,4 +254,40 @@ DEVICE_GET_INFO(buggychl_mcu) } } -DEFINE_LEGACY_DEVICE(BUGGYCHL_MCU, buggychl_mcu); +const device_type BUGGYCHL_MCU = &device_creator<buggychl_mcu_device>; + +buggychl_mcu_device::buggychl_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, BUGGYCHL_MCU, "BuggyChl MCU", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(buggychl_mcu_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void buggychl_mcu_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void buggychl_mcu_device::device_start() +{ + DEVICE_START_NAME( buggychl_mcu )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void buggychl_mcu_device::device_reset() +{ + DEVICE_RESET_NAME( buggychl_mcu )(this); +} + + diff --git a/src/mame/machine/buggychl.h b/src/mame/machine/buggychl.h index 8ff41049115..4ed33f5bb73 100644 --- a/src/mame/machine/buggychl.h +++ b/src/mame/machine/buggychl.h @@ -4,4 +4,23 @@ WRITE8_DEVICE_HANDLER( buggychl_mcu_w ); READ8_DEVICE_HANDLER( buggychl_mcu_r ); READ8_DEVICE_HANDLER( buggychl_mcu_status_r ); -DECLARE_LEGACY_DEVICE(BUGGYCHL_MCU, buggychl_mcu); +class buggychl_mcu_device : public device_t +{ +public: + buggychl_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~buggychl_mcu_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type BUGGYCHL_MCU; + diff --git a/src/mame/machine/cd32.c b/src/mame/machine/cd32.c index b3e052b365f..d4b9767e27e 100644 --- a/src/mame/machine/cd32.c +++ b/src/mame/machine/cd32.c @@ -81,7 +81,7 @@ INLINE akiko_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == AKIKO); - return (akiko_state *)downcast<legacy_device_base *>(device)->token(); + return (akiko_state *)downcast<akiko_device *>(device)->token(); } static DEVICE_STOP( akiko ) @@ -933,4 +933,49 @@ DEVICE_GET_INFO(akiko) } } -DEFINE_LEGACY_DEVICE(AKIKO, akiko); +const device_type AKIKO = &device_creator<akiko_device>; + +akiko_device::akiko_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, AKIKO, "Akiko", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(akiko_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void akiko_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void akiko_device::device_start() +{ + DEVICE_START_NAME( akiko )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void akiko_device::device_reset() +{ + DEVICE_RESET_NAME( akiko )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void akiko_device::device_stop() +{ + DEVICE_STOP_NAME( akiko )(this); +} + + diff --git a/src/mame/machine/decocass.c b/src/mame/machine/decocass.c index 24d7893271e..759dbd5dda2 100644 --- a/src/mame/machine/decocass.c +++ b/src/mame/machine/decocass.c @@ -1966,7 +1966,7 @@ INLINE tape_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == DECOCASS_TAPE); - return (tape_state *)downcast<legacy_device_base *>(device)->token(); + return (tape_state *)downcast<decocass_tape_device *>(device)->token(); } @@ -2305,4 +2305,40 @@ DEVICE_GET_INFO( decocass_tape ) } -DEFINE_LEGACY_DEVICE(DECOCASS_TAPE, decocass_tape); +const device_type DECOCASS_TAPE = &device_creator<decocass_tape_device>; + +decocass_tape_device::decocass_tape_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DECOCASS_TAPE, "DECO Cassette Tape", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tape_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void decocass_tape_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void decocass_tape_device::device_start() +{ + DEVICE_START_NAME( decocass_tape )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void decocass_tape_device::device_reset() +{ + DEVICE_RESET_NAME( decocass_tape )(this); +} + + diff --git a/src/mame/machine/decocass.h b/src/mame/machine/decocass.h index b7a59867438..d13c981ff35 100644 --- a/src/mame/machine/decocass.h +++ b/src/mame/machine/decocass.h @@ -8,7 +8,26 @@ #define LOG(n,x) do { if (LOGLEVEL >= n) logerror x; } while (0) -DECLARE_LEGACY_DEVICE(DECOCASS_TAPE, decocass_tape); +class decocass_tape_device : public device_t +{ +public: + decocass_tape_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~decocass_tape_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type DECOCASS_TAPE; + #define MCFG_DECOCASS_TAPE_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, DECOCASS_TAPE, 0) diff --git a/src/mame/machine/gaelco3d.c b/src/mame/machine/gaelco3d.c index 6db65950c75..25493573b50 100644 --- a/src/mame/machine/gaelco3d.c +++ b/src/mame/machine/gaelco3d.c @@ -208,14 +208,14 @@ INLINE gaelco_serial_state *get_token(device_t *device) { assert(device != NULL); assert(device->type() == GAELCO_SERIAL); - return (gaelco_serial_state *) downcast<legacy_device_base *>(device)->token(); + return (gaelco_serial_state *) downcast<gaelco_serial_device *>(device)->token(); } INLINE const gaelco_serial_interface *get_interface(device_t *device) { assert(device != NULL); assert(device->type() == GAELCO_SERIAL); - return (gaelco_serial_interface *) downcast<legacy_device_base *>(device)->static_config(); + return (gaelco_serial_interface *) downcast<gaelco_serial_device *>(device)->static_config(); } INLINE void shmem_lock(shmem_t *shmem) @@ -520,4 +520,49 @@ DEVICE_GET_INFO( gaelco_serial ) } -DEFINE_LEGACY_DEVICE(GAELCO_SERIAL, gaelco_serial); +const device_type GAELCO_SERIAL = &device_creator<gaelco_serial_device>; + +gaelco_serial_device::gaelco_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GAELCO_SERIAL, "gaelco_serial", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(gaelco_serial_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void gaelco_serial_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gaelco_serial_device::device_start() +{ + DEVICE_START_NAME( gaelco_serial )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void gaelco_serial_device::device_reset() +{ + DEVICE_RESET_NAME( gaelco_serial )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void gaelco_serial_device::device_stop() +{ + DEVICE_STOP_NAME( gaelco_serial )(this); +} + + diff --git a/src/mame/machine/gaelco3d.h b/src/mame/machine/gaelco3d.h index 459cb704522..0b7086e522c 100644 --- a/src/mame/machine/gaelco3d.h +++ b/src/mame/machine/gaelco3d.h @@ -68,6 +68,26 @@ WRITE8_DEVICE_HANDLER( gaelco_serial_irq_enable ); /* ----- device interface ----- */ -DECLARE_LEGACY_DEVICE(GAELCO_SERIAL, gaelco_serial); +class gaelco_serial_device : public device_t +{ +public: + gaelco_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~gaelco_serial_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type GAELCO_SERIAL; + //DEVICE_GET_INFO( gaelco_serial ); diff --git a/src/mame/machine/mathbox.c b/src/mame/machine/mathbox.c index b1363ecb47a..01323775554 100644 --- a/src/mame/machine/mathbox.c +++ b/src/mame/machine/mathbox.c @@ -55,7 +55,7 @@ INLINE mathbox_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == MATHBOX); - return (mathbox_state *)downcast<legacy_device_base *>(device)->token(); + return (mathbox_state *)downcast<mathbox_device *>(device)->token(); } @@ -360,4 +360,40 @@ DEVICE_GET_INFO( mathbox ) } -DEFINE_LEGACY_DEVICE(MATHBOX, mathbox); +const device_type MATHBOX = &device_creator<mathbox_device>; + +mathbox_device::mathbox_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MATHBOX, "MATHBOX", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mathbox_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mathbox_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mathbox_device::device_start() +{ + DEVICE_START_NAME( mathbox )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mathbox_device::device_reset() +{ + DEVICE_RESET_NAME( mathbox )(this); +} + + diff --git a/src/mame/machine/mathbox.h b/src/mame/machine/mathbox.h index 231bd2deb46..5c0cdf5581c 100644 --- a/src/mame/machine/mathbox.h +++ b/src/mame/machine/mathbox.h @@ -26,4 +26,23 @@ READ8_DEVICE_HANDLER( mathbox_lo_r ); READ8_DEVICE_HANDLER( mathbox_hi_r ); /* ----- device interface ----- */ -DECLARE_LEGACY_DEVICE(MATHBOX, mathbox); +class mathbox_device : public device_t +{ +public: + mathbox_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mathbox_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MATHBOX; + diff --git a/src/mame/machine/namco06.c b/src/mame/machine/namco06.c index 01b27c56629..0361c8a3367 100644 --- a/src/mame/machine/namco06.c +++ b/src/mame/machine/namco06.c @@ -110,7 +110,7 @@ INLINE namco_06xx_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == NAMCO_06XX); - return (namco_06xx_state *)downcast<legacy_device_base *>(device)->token(); + return (namco_06xx_state *)downcast<namco_06xx_device *>(device)->token(); } @@ -309,4 +309,41 @@ DEVICE_GET_INFO(namco_06xx) } } -DEFINE_LEGACY_DEVICE(NAMCO_06XX, namco_06xx); +const device_type NAMCO_06XX = &device_creator<namco_06xx_device>; + +namco_06xx_device::namco_06xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO_06XX, "Namco 06xx", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_06xx_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_06xx_device::device_config_complete() +{ + m_shortname = "namco06xx"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namco_06xx_device::device_start() +{ + DEVICE_START_NAME( namco_06xx )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void namco_06xx_device::device_reset() +{ + DEVICE_RESET_NAME( namco_06xx )(this); +} + + diff --git a/src/mame/machine/namco06.h b/src/mame/machine/namco06.h index 326c177a412..fe040a7ef3c 100644 --- a/src/mame/machine/namco06.h +++ b/src/mame/machine/namco06.h @@ -27,7 +27,26 @@ WRITE8_DEVICE_HANDLER( namco_06xx_ctrl_w ); /* device get info callback */ -DECLARE_LEGACY_DEVICE(NAMCO_06XX, namco_06xx); +class namco_06xx_device : public device_t +{ +public: + namco_06xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~namco_06xx_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO_06XX; + #endif diff --git a/src/mame/machine/namco50.c b/src/mame/machine/namco50.c index 5b7c1d74a65..24b34333098 100644 --- a/src/mame/machine/namco50.c +++ b/src/mame/machine/namco50.c @@ -149,7 +149,7 @@ INLINE namco_50xx_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == NAMCO_50XX); - return (namco_50xx_state *)downcast<legacy_device_base *>(device)->token(); + return (namco_50xx_state *)downcast<namco_50xx_device *>(device)->token(); } @@ -314,4 +314,52 @@ DEVICE_GET_INFO(namco_50xx) } } -DEFINE_LEGACY_DEVICE(NAMCO_50XX, namco_50xx); +const device_type NAMCO_50XX = &device_creator<namco_50xx_device>; + +namco_50xx_device::namco_50xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO_50XX, "Namco 50xx", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_50xx_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_50xx_device::device_config_complete() +{ + m_shortname = "namco50"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namco_50xx_device::device_start() +{ + DEVICE_START_NAME( namco_50xx )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor namco_50xx_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( namco_50xx ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *namco_50xx_device::device_rom_region() const +{ + return ROM_NAME(namco_50xx ); +} + + diff --git a/src/mame/machine/namco50.h b/src/mame/machine/namco50.h index 86039462639..da6a61f3909 100644 --- a/src/mame/machine/namco50.h +++ b/src/mame/machine/namco50.h @@ -14,7 +14,27 @@ WRITE8_DEVICE_HANDLER( namco_50xx_write ); /* device get info callback */ -DECLARE_LEGACY_DEVICE(NAMCO_50XX, namco_50xx); +class namco_50xx_device : public device_t +{ +public: + namco_50xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~namco_50xx_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO_50XX; + #endif /* NAMCO50_H */ diff --git a/src/mame/machine/namco51.c b/src/mame/machine/namco51.c index 6ee5c040c4b..d1cad09d93a 100644 --- a/src/mame/machine/namco51.c +++ b/src/mame/machine/namco51.c @@ -90,7 +90,7 @@ INLINE namco_51xx_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == NAMCO_51XX); - return (namco_51xx_state *)downcast<legacy_device_base *>(device)->token(); + return (namco_51xx_state *)downcast<namco_51xx_device *>(device)->token(); } @@ -465,4 +465,61 @@ DEVICE_GET_INFO(namco_51xx) } } -DEFINE_LEGACY_DEVICE(NAMCO_51XX, namco_51xx); +const device_type NAMCO_51XX = &device_creator<namco_51xx_device>; + +namco_51xx_device::namco_51xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO_51XX, "Namco 51xx", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_51xx_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_51xx_device::device_config_complete() +{ + m_shortname = "namco51"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namco_51xx_device::device_start() +{ + DEVICE_START_NAME( namco_51xx )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void namco_51xx_device::device_reset() +{ + DEVICE_RESET_NAME( namco_51xx )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor namco_51xx_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( namco_51xx ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *namco_51xx_device::device_rom_region() const +{ + return ROM_NAME(namco_51xx ); +} + + diff --git a/src/mame/machine/namco51.h b/src/mame/machine/namco51.h index 93e8d1083e4..29608519d26 100644 --- a/src/mame/machine/namco51.h +++ b/src/mame/machine/namco51.h @@ -21,7 +21,28 @@ READ8_DEVICE_HANDLER( namco_51xx_read ); WRITE8_DEVICE_HANDLER( namco_51xx_write ); -DECLARE_LEGACY_DEVICE(NAMCO_51XX, namco_51xx); +class namco_51xx_device : public device_t +{ +public: + namco_51xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~namco_51xx_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO_51XX; + #endif /* NAMCO51_H */ diff --git a/src/mame/machine/namco53.c b/src/mame/machine/namco53.c index afd65bfb89b..2bde8e8599c 100644 --- a/src/mame/machine/namco53.c +++ b/src/mame/machine/namco53.c @@ -76,7 +76,7 @@ INLINE namco_53xx_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == NAMCO_53XX); - return (namco_53xx_state *)downcast<legacy_device_base *>(device)->token(); + return (namco_53xx_state *)downcast<namco_53xx_device *>(device)->token(); } @@ -214,4 +214,52 @@ DEVICE_GET_INFO(namco_53xx) } } -DEFINE_LEGACY_DEVICE(NAMCO_53XX, namco_53xx); +const device_type NAMCO_53XX = &device_creator<namco_53xx_device>; + +namco_53xx_device::namco_53xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO_53XX, "Namco 53xx", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_53xx_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_53xx_device::device_config_complete() +{ + m_shortname = "namco53"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namco_53xx_device::device_start() +{ + DEVICE_START_NAME( namco_53xx )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor namco_53xx_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( namco_53xx ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *namco_53xx_device::device_rom_region() const +{ + return ROM_NAME(namco_53xx ); +} + + diff --git a/src/mame/machine/namco53.h b/src/mame/machine/namco53.h index d09ba4c2d20..abf1805dd48 100644 --- a/src/mame/machine/namco53.h +++ b/src/mame/machine/namco53.h @@ -22,7 +22,27 @@ void namco_53xx_read_request(device_t *device); READ8_DEVICE_HANDLER( namco_53xx_read ); -DECLARE_LEGACY_DEVICE(NAMCO_53XX, namco_53xx); +class namco_53xx_device : public device_t +{ +public: + namco_53xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~namco_53xx_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO_53XX; + #endif /* NAMCO53_H */ diff --git a/src/mame/machine/namco62.c b/src/mame/machine/namco62.c index 79405f30875..c4a1b528136 100644 --- a/src/mame/machine/namco62.c +++ b/src/mame/machine/namco62.c @@ -29,7 +29,7 @@ INLINE namco_62xx_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == NAMCO_62XX); - return (namco_62xx_state *)downcast<legacy_device_base *>(device)->token(); + return (namco_62xx_state *)downcast<namco_62xx_device *>(device)->token(); } @@ -107,4 +107,52 @@ DEVICE_GET_INFO(namco_62xx) } } -DEFINE_LEGACY_DEVICE(NAMCO_62XX, namco_62xx); +const device_type NAMCO_62XX = &device_creator<namco_62xx_device>; + +namco_62xx_device::namco_62xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO_62XX, "Namco 62xx", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namco_62xx_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_62xx_device::device_config_complete() +{ + m_shortname = "namco62"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namco_62xx_device::device_start() +{ + DEVICE_START_NAME( namco_62xx )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor namco_62xx_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( namco_62xx ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *namco_62xx_device::device_rom_region() const +{ + return ROM_NAME(namco_62xx ); +} + + diff --git a/src/mame/machine/namco62.h b/src/mame/machine/namco62.h index 6ce390fd6f5..082a49e345d 100644 --- a/src/mame/machine/namco62.h +++ b/src/mame/machine/namco62.h @@ -21,7 +21,27 @@ READ8_DEVICE_HANDLER( namco_62xx_read ); WRITE8_DEVICE_HANDLER( namco_62xx_write ); -DECLARE_LEGACY_DEVICE(NAMCO_62XX, namco_62xx); +class namco_62xx_device : public device_t +{ +public: + namco_62xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~namco_62xx_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO_62XX; + #endif /* NAMCO62_H */ diff --git a/src/mame/machine/namcoio.c b/src/mame/machine/namcoio.c index 08c9bcc17c2..beb6ef2fa65 100644 --- a/src/mame/machine/namcoio.c +++ b/src/mame/machine/namcoio.c @@ -144,7 +144,7 @@ INLINE namcoio_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == NAMCO56XX || device->type() == NAMCO58XX || device->type() == NAMCO59XX); - return (namcoio_state *)downcast<legacy_device_base *>(device)->token(); + return (namcoio_state *)downcast<namcoio_device *>(device)->token(); } INLINE const namcoio_interface *get_interface( device_t *device ) @@ -558,4 +558,40 @@ DEVICE_GET_INFO(namcoio) } } -DEFINE_LEGACY_DEVICE(NAMCO56XX, namcoio); +const device_type NAMCO56XX = &device_creator<namcoio_device>; + +namcoio_device::namcoio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NAMCO56XX, "Namco 56xx, 58xx & 59xx", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(namcoio_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namcoio_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void namcoio_device::device_start() +{ + DEVICE_START_NAME( namcoio )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void namcoio_device::device_reset() +{ + DEVICE_RESET_NAME( namcoio )(this); +} + + diff --git a/src/mame/machine/namcoio.h b/src/mame/machine/namcoio.h index 373e41cfc0b..14f547a99d5 100644 --- a/src/mame/machine/namcoio.h +++ b/src/mame/machine/namcoio.h @@ -16,7 +16,26 @@ struct _namcoio_interface device_t *device; }; -DECLARE_LEGACY_DEVICE(NAMCO56XX, namcoio); +class namcoio_device : public device_t +{ +public: + namcoio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~namcoio_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type NAMCO56XX; + #define NAMCO58XX NAMCO56XX #define NAMCO59XX NAMCO56XX diff --git a/src/mame/machine/nmk112.c b/src/mame/machine/nmk112.c index dc2b34a644f..2639ff59263 100644 --- a/src/mame/machine/nmk112.c +++ b/src/mame/machine/nmk112.c @@ -34,7 +34,7 @@ INLINE nmk112_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == NMK112); - return (nmk112_state *)downcast<legacy_device_base *>(device)->token(); + return (nmk112_state *)downcast<nmk112_device *>(device)->token(); } INLINE const nmk112_interface *get_interface( device_t *device ) @@ -171,4 +171,40 @@ DEVICE_GET_INFO(nmk112) } } -DEFINE_LEGACY_DEVICE(NMK112, nmk112); +const device_type NMK112 = &device_creator<nmk112_device>; + +nmk112_device::nmk112_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NMK112, "NMK 112", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(nmk112_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void nmk112_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void nmk112_device::device_start() +{ + DEVICE_START_NAME( nmk112 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void nmk112_device::device_reset() +{ + DEVICE_RESET_NAME( nmk112 )(this); +} + + diff --git a/src/mame/machine/nmk112.h b/src/mame/machine/nmk112.h index 1a98fdc7a79..20897bc2f33 100644 --- a/src/mame/machine/nmk112.h +++ b/src/mame/machine/nmk112.h @@ -20,7 +20,26 @@ struct _nmk112_interface UINT8 disable_page_mask; }; -DECLARE_LEGACY_DEVICE(NMK112, nmk112); +class nmk112_device : public device_t +{ +public: + nmk112_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~nmk112_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type NMK112; + /*************************************************************************** DEVICE CONFIGURATION MACROS diff --git a/src/mame/machine/taitoio.c b/src/mame/machine/taitoio.c index f2326516cd8..d031a72ef76 100644 --- a/src/mame/machine/taitoio.c +++ b/src/mame/machine/taitoio.c @@ -74,7 +74,7 @@ INLINE tc0220ioc_state *tc0220ioc_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0220IOC); - return (tc0220ioc_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0220ioc_state *)downcast<tc0220ioc_device *>(device)->token(); } INLINE const tc0220ioc_interface *tc0220ioc_get_interface( device_t *device ) @@ -231,7 +231,7 @@ INLINE tc0510nio_state *tc0510nio_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0510NIO); - return (tc0510nio_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0510nio_state *)downcast<tc0510nio_device *>(device)->token(); } INLINE const tc0510nio_interface *tc0510nio_get_interface( device_t *device ) @@ -382,7 +382,7 @@ INLINE tc0640fio_state *tc0640fio_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0640FIO); - return (tc0640fio_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0640fio_state *)downcast<tc0640fio_device *>(device)->token(); } INLINE const tc0640fio_interface *tc0640fio_get_interface( device_t *device ) @@ -574,6 +574,114 @@ DEVICE_GET_INFO( tc0640fio ) } -DEFINE_LEGACY_DEVICE(TC0220IOC, tc0220ioc); -DEFINE_LEGACY_DEVICE(TC0510NIO, tc0510nio); -DEFINE_LEGACY_DEVICE(TC0640FIO, tc0640fio); +const device_type TC0220IOC = &device_creator<tc0220ioc_device>; + +tc0220ioc_device::tc0220ioc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0220IOC, "Taito TC0220IOC", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0220ioc_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0220ioc_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0220ioc_device::device_start() +{ + DEVICE_START_NAME( tc0220ioc )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0220ioc_device::device_reset() +{ + DEVICE_RESET_NAME( tc0220ioc )(this); +} + + +const device_type TC0510NIO = &device_creator<tc0510nio_device>; + +tc0510nio_device::tc0510nio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0510NIO, "Taito TC0510NIO", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0510nio_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0510nio_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0510nio_device::device_start() +{ + DEVICE_START_NAME( tc0510nio )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0510nio_device::device_reset() +{ + DEVICE_RESET_NAME( tc0510nio )(this); +} + + +const device_type TC0640FIO = &device_creator<tc0640fio_device>; + +tc0640fio_device::tc0640fio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0640FIO, "Taito TC0640FIO", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0640fio_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0640fio_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0640fio_device::device_start() +{ + DEVICE_START_NAME( tc0640fio )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0640fio_device::device_reset() +{ + DEVICE_RESET_NAME( tc0640fio )(this); +} + + diff --git a/src/mame/machine/taitoio.h b/src/mame/machine/taitoio.h index 4516cf4d488..7903e865748 100644 --- a/src/mame/machine/taitoio.h +++ b/src/mame/machine/taitoio.h @@ -47,9 +47,66 @@ struct _tc0640fio_interface devcb_read8 read_7; }; -DECLARE_LEGACY_DEVICE(TC0220IOC, tc0220ioc); -DECLARE_LEGACY_DEVICE(TC0510NIO, tc0510nio); -DECLARE_LEGACY_DEVICE(TC0640FIO, tc0640fio); +class tc0220ioc_device : public device_t +{ +public: + tc0220ioc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0220ioc_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0220IOC; + +class tc0510nio_device : public device_t +{ +public: + tc0510nio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0510nio_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0510NIO; + +class tc0640fio_device : public device_t +{ +public: + tc0640fio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0640fio_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0640FIO; + /*************************************************************************** DEVICE CONFIGURATION MACROS diff --git a/src/mame/video/atarirle.c b/src/mame/video/atarirle.c index 14787981b15..f397c20dfb8 100644 --- a/src/mame/video/atarirle.c +++ b/src/mame/video/atarirle.c @@ -151,7 +151,7 @@ INLINE atarirle_data *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == ATARIRLE); - return (atarirle_data *)downcast<legacy_device_base *>(device)->token(); + return (atarirle_data *)downcast<atarirle_device *>(device)->token(); } @@ -390,7 +390,34 @@ DEVICE_GET_INFO( atarirle ) } } -DEFINE_LEGACY_DEVICE(ATARIRLE, atarirle); +const device_type ATARIRLE = &device_creator<atarirle_device>; + +atarirle_device::atarirle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ATARIRLE, "Atari RLE", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(atarirle_data)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void atarirle_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void atarirle_device::device_start() +{ + DEVICE_START_NAME( atarirle )(this); +} + + /*--------------------------------------------------------------- atarirle_control_w: Write handler for MO control bits. diff --git a/src/mame/video/atarirle.h b/src/mame/video/atarirle.h index cf3886641db..f01d1a9edb7 100644 --- a/src/mame/video/atarirle.h +++ b/src/mame/video/atarirle.h @@ -70,7 +70,25 @@ struct atarirle_desc FUNCTION PROTOTYPES ***************************************************************************/ -DECLARE_LEGACY_DEVICE(ATARIRLE, atarirle); +class atarirle_device : public device_t +{ +public: + atarirle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~atarirle_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type ATARIRLE; + #define MCFG_ATARIRLE_ADD(_tag, _interface) \ MCFG_DEVICE_ADD(_tag, ATARIRLE, 0) \ MCFG_DEVICE_CONFIG(_interface) diff --git a/src/mame/video/deco16ic.c b/src/mame/video/deco16ic.c index e454258b1b3..ea23a94be2f 100644 --- a/src/mame/video/deco16ic.c +++ b/src/mame/video/deco16ic.c @@ -201,7 +201,7 @@ INLINE deco16ic_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == DECO16IC); - return (deco16ic_state *)downcast<legacy_device_base *>(device)->token(); + return (deco16ic_state *)downcast<deco16ic_device *>(device)->token(); } INLINE const deco16ic_interface *get_interface( device_t *device ) @@ -1010,4 +1010,40 @@ DEVICE_GET_INFO( deco16ic ) } -DEFINE_LEGACY_DEVICE(DECO16IC, deco16ic); +const device_type DECO16IC = &device_creator<deco16ic_device>; + +deco16ic_device::deco16ic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DECO16IC, "Data East IC 55 / 56 / 74 / 141", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(deco16ic_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void deco16ic_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void deco16ic_device::device_start() +{ + DEVICE_START_NAME( deco16ic )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void deco16ic_device::device_reset() +{ + DEVICE_RESET_NAME( deco16ic )(this); +} + + diff --git a/src/mame/video/deco16ic.h b/src/mame/video/deco16ic.h index f8e1f6b292a..fc178491bda 100644 --- a/src/mame/video/deco16ic.h +++ b/src/mame/video/deco16ic.h @@ -35,7 +35,26 @@ struct _deco16ic_interface int _8x8_gfxregion, _16x16_gfxregion; }; -DECLARE_LEGACY_DEVICE(DECO16IC, deco16ic); +class deco16ic_device : public device_t +{ +public: + deco16ic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~deco16ic_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type DECO16IC; + /*************************************************************************** diff --git a/src/mame/video/decocomn.c b/src/mame/video/decocomn.c index 639dc440a10..af063fd21c9 100644 --- a/src/mame/video/decocomn.c +++ b/src/mame/video/decocomn.c @@ -26,7 +26,7 @@ INLINE decocomn_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == DECOCOMN); - return (decocomn_state *)downcast<legacy_device_base *>(device)->token(); + return (decocomn_state *)downcast<decocomn_device *>(device)->token(); } INLINE const decocomn_interface *get_interface( device_t *device ) @@ -162,4 +162,40 @@ DEVICE_GET_INFO( decocomn ) } -DEFINE_LEGACY_DEVICE(DECOCOMN, decocomn); +const device_type DECOCOMN = &device_creator<decocomn_device>; + +decocomn_device::decocomn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DECOCOMN, "Data East Common Video Functions", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(decocomn_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void decocomn_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void decocomn_device::device_start() +{ + DEVICE_START_NAME( decocomn )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void decocomn_device::device_reset() +{ + DEVICE_RESET_NAME( decocomn )(this); +} + + diff --git a/src/mame/video/decocomn.h b/src/mame/video/decocomn.h index 75734d404a5..7fdec47f40e 100644 --- a/src/mame/video/decocomn.h +++ b/src/mame/video/decocomn.h @@ -22,7 +22,26 @@ struct _decocomn_interface const char *screen; }; -DECLARE_LEGACY_DEVICE(DECOCOMN, decocomn); +class decocomn_device : public device_t +{ +public: + decocomn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~decocomn_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type DECOCOMN; + /*************************************************************************** diff --git a/src/mame/video/kan_pand.c b/src/mame/video/kan_pand.c index fad451769e1..1a1624a8ead 100644 --- a/src/mame/video/kan_pand.c +++ b/src/mame/video/kan_pand.c @@ -71,7 +71,7 @@ INLINE kaneko_pandora_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == KANEKO_PANDORA); - return (kaneko_pandora_state *)downcast<legacy_device_base *>(device)->token(); + return (kaneko_pandora_state *)downcast<kaneko_pandora_device *>(device)->token(); } INLINE const kaneko_pandora_interface *get_interface( device_t *device ) @@ -339,4 +339,40 @@ DEVICE_GET_INFO(kaneko_pandora) } } -DEFINE_LEGACY_DEVICE(KANEKO_PANDORA, kaneko_pandora); +const device_type KANEKO_PANDORA = &device_creator<kaneko_pandora_device>; + +kaneko_pandora_device::kaneko_pandora_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, KANEKO_PANDORA, "Kaneko Pandora - PX79C480FP-3", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(kaneko_pandora_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void kaneko_pandora_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void kaneko_pandora_device::device_start() +{ + DEVICE_START_NAME( kaneko_pandora )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void kaneko_pandora_device::device_reset() +{ + DEVICE_RESET_NAME( kaneko_pandora )(this); +} + + diff --git a/src/mame/video/kan_pand.h b/src/mame/video/kan_pand.h index bebd61ebdce..66ab0e76bb1 100644 --- a/src/mame/video/kan_pand.h +++ b/src/mame/video/kan_pand.h @@ -24,7 +24,26 @@ struct _kaneko_pandora_interface int y; }; -DECLARE_LEGACY_DEVICE(KANEKO_PANDORA, kaneko_pandora); +class kaneko_pandora_device : public device_t +{ +public: + kaneko_pandora_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~kaneko_pandora_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type KANEKO_PANDORA; + /*************************************************************************** DEVICE CONFIGURATION MACROS diff --git a/src/mame/video/konicdev.c b/src/mame/video/konicdev.c index 70ef3857e1e..01ead405994 100644 --- a/src/mame/video/konicdev.c +++ b/src/mame/video/konicdev.c @@ -1349,7 +1349,7 @@ INLINE k007121_state *k007121_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K007121); - return (k007121_state *)downcast<legacy_device_base *>(device)->token(); + return (k007121_state *)downcast<k007121_device *>(device)->token(); } /***************************************************************************** @@ -1612,7 +1612,7 @@ INLINE k007342_state *k007342_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K007342); - return (k007342_state *)downcast<legacy_device_base *>(device)->token(); + return (k007342_state *)downcast<k007342_device *>(device)->token(); } INLINE const k007342_interface *k007342_get_interface( device_t *device ) @@ -1896,7 +1896,7 @@ INLINE k007420_state *k007420_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K007420); - return (k007420_state *)downcast<legacy_device_base *>(device)->token(); + return (k007420_state *)downcast<k007420_device *>(device)->token(); } INLINE const k007420_interface *k007420_get_interface( device_t *device ) @@ -2173,7 +2173,7 @@ INLINE k052109_state *k052109_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K052109); - return (k052109_state *)downcast<legacy_device_base *>(device)->token(); + return (k052109_state *)downcast<k052109_device *>(device)->token(); } INLINE const k052109_interface *k052109_get_interface( device_t *device ) @@ -2807,7 +2807,7 @@ INLINE k051960_state *k051960_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K051960); - return (k051960_state *)downcast<legacy_device_base *>(device)->token(); + return (k051960_state *)downcast<k051960_device *>(device)->token(); } INLINE const k051960_interface *k051960_get_interface( device_t *device ) @@ -3349,7 +3349,7 @@ INLINE k05324x_state *k05324x_get_safe_token( device_t *device ) assert(device != NULL); assert((device->type() == K053244 || device->type() == K053245)); - return (k05324x_state *)downcast<legacy_device_base *>(device)->token(); + return (k05324x_state *)downcast<k05324x_device *>(device)->token(); } INLINE const k05324x_interface *k05324x_get_interface( device_t *device ) @@ -4139,7 +4139,7 @@ INLINE k053247_state *k053247_get_safe_token( device_t *device ) assert(device != NULL); assert((device->type() == K053246 || device->type() == K053247 || device->type() == K055673)); - return (k053247_state *)downcast<legacy_device_base *>(device)->token(); + return (k053247_state *)downcast<k053247_device *>(device)->token(); } INLINE const k053247_interface *k053247_get_interface( device_t *device ) @@ -5137,7 +5137,7 @@ INLINE k051316_state *k051316_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K051316); - return (k051316_state *)downcast<legacy_device_base *>(device)->token(); + return (k051316_state *)downcast<k051316_device *>(device)->token(); } INLINE const k051316_interface *k051316_get_interface( device_t *device ) @@ -5425,7 +5425,7 @@ INLINE k053936_state *k053936_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K053936); - return (k053936_state *)downcast<legacy_device_base *>(device)->token(); + return (k053936_state *)downcast<k053936_device *>(device)->token(); } INLINE const k053936_interface *k053936_get_interface( device_t *device ) @@ -5650,7 +5650,7 @@ INLINE k053251_state *k053251_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K053251); - return (k053251_state *)downcast<legacy_device_base *>(device)->token(); + return (k053251_state *)downcast<k053251_device *>(device)->token(); } /***************************************************************************** @@ -5801,7 +5801,7 @@ INLINE k054000_state *k054000_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K054000); - return (k054000_state *)downcast<legacy_device_base *>(device)->token(); + return (k054000_state *)downcast<k054000_device *>(device)->token(); } /***************************************************************************** @@ -5913,7 +5913,7 @@ INLINE k051733_state *k051733_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K051733); - return (k051733_state *)downcast<legacy_device_base *>(device)->token(); + return (k051733_state *)downcast<k051733_device *>(device)->token(); } /***************************************************************************** @@ -6119,7 +6119,7 @@ INLINE k056832_state *k056832_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K056832); - return (k056832_state *)downcast<legacy_device_base *>(device)->token(); + return (k056832_state *)downcast<k056832_device *>(device)->token(); } INLINE const k056832_interface *k056832_get_interface( device_t *device ) @@ -8032,7 +8032,7 @@ INLINE k055555_state *k055555_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K055555); - return (k055555_state *)downcast<legacy_device_base *>(device)->token(); + return (k055555_state *)downcast<k055555_device *>(device)->token(); } /***************************************************************************** @@ -8159,7 +8159,7 @@ INLINE k054338_state *k054338_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K054338); - return (k054338_state *)downcast<legacy_device_base *>(device)->token(); + return (k054338_state *)downcast<k054338_device *>(device)->token(); } INLINE const k054338_interface *k054338_get_interface( device_t *device ) @@ -8471,7 +8471,7 @@ INLINE k001006_state *k001006_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K001006); - return (k001006_state *)downcast<legacy_device_base *>(device)->token(); + return (k001006_state *)downcast<k001006_device *>(device)->token(); } INLINE const k001006_interface *k001006_get_interface( device_t *device ) @@ -8681,7 +8681,7 @@ INLINE k001005_state *k001005_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K001005); - return (k001005_state *)downcast<legacy_device_base *>(device)->token(); + return (k001005_state *)downcast<k001005_device *>(device)->token(); } INLINE const k001005_interface *k001005_get_interface( device_t *device ) @@ -9574,7 +9574,7 @@ INLINE k001604_state *k001604_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K001604); - return (k001604_state *)downcast<legacy_device_base *>(device)->token(); + return (k001604_state *)downcast<k001604_device *>(device)->token(); } INLINE const k001604_interface *k001604_get_interface( device_t *device ) @@ -9987,7 +9987,7 @@ INLINE k037122_state *k037122_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == K037122); - return (k037122_state *)downcast<legacy_device_base *>(device)->token(); + return (k037122_state *)downcast<k037122_device *>(device)->token(); } INLINE const k037122_interface *k037122_get_interface( device_t *device ) @@ -10710,23 +10710,743 @@ DEVICE_GET_INFO( k037122 ) } -DEFINE_LEGACY_DEVICE(K007121, k007121); -DEFINE_LEGACY_DEVICE(K007342, k007342); -DEFINE_LEGACY_DEVICE(K007420, k007420); -DEFINE_LEGACY_DEVICE(K052109, k052109); -DEFINE_LEGACY_DEVICE(K051960, k051960); -DEFINE_LEGACY_DEVICE(K053244, k05324x); -DEFINE_LEGACY_DEVICE(K053246, k053247); -DEFINE_LEGACY_DEVICE(K055673, k055673); -DEFINE_LEGACY_DEVICE(K051316, k051316); -DEFINE_LEGACY_DEVICE(K053936, k053936); -DEFINE_LEGACY_DEVICE(K053251, k053251); -DEFINE_LEGACY_DEVICE(K054000, k054000); -DEFINE_LEGACY_DEVICE(K051733, k051733); -DEFINE_LEGACY_DEVICE(K056832, k056832); -DEFINE_LEGACY_DEVICE(K055555, k055555); -DEFINE_LEGACY_DEVICE(K054338, k054338); -DEFINE_LEGACY_DEVICE(K001006, k001006); -DEFINE_LEGACY_DEVICE(K001005, k001005); -DEFINE_LEGACY_DEVICE(K001604, k001604); -DEFINE_LEGACY_DEVICE(K037122, k037122); +const device_type K007121 = &device_creator<k007121_device>; + +k007121_device::k007121_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K007121, "Konami 007121", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k007121_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k007121_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k007121_device::device_start() +{ + DEVICE_START_NAME( k007121 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k007121_device::device_reset() +{ + DEVICE_RESET_NAME( k007121 )(this); +} + + +const device_type K007342 = &device_creator<k007342_device>; + +k007342_device::k007342_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K007342, "Konami 007342", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k007342_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k007342_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k007342_device::device_start() +{ + DEVICE_START_NAME( k007342 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k007342_device::device_reset() +{ + DEVICE_RESET_NAME( k007342 )(this); +} + + +const device_type K007420 = &device_creator<k007420_device>; + +k007420_device::k007420_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K007420, "Konami 007420", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k007420_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k007420_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k007420_device::device_start() +{ + DEVICE_START_NAME( k007420 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k007420_device::device_reset() +{ + DEVICE_RESET_NAME( k007420 )(this); +} + + +const device_type K052109 = &device_creator<k052109_device>; + +k052109_device::k052109_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K052109, "Konami 052109", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k052109_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k052109_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k052109_device::device_start() +{ + DEVICE_START_NAME( k052109 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k052109_device::device_reset() +{ + DEVICE_RESET_NAME( k052109 )(this); +} + + +const device_type K051960 = &device_creator<k051960_device>; + +k051960_device::k051960_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K051960, "Konami 051960", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k051960_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k051960_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k051960_device::device_start() +{ + DEVICE_START_NAME( k051960 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k051960_device::device_reset() +{ + DEVICE_RESET_NAME( k051960 )(this); +} + + +const device_type K053244 = &device_creator<k05324x_device>; + +k05324x_device::k05324x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K053244, "Konami 053244 & 053245", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k05324x_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k05324x_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k05324x_device::device_start() +{ + DEVICE_START_NAME( k05324x )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k05324x_device::device_reset() +{ + DEVICE_RESET_NAME( k05324x )(this); +} + + +const device_type K053246 = &device_creator<k053247_device>; + +k053247_device::k053247_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K053246, "Konami 053246 & 053247", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k053247_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k053247_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k053247_device::device_start() +{ + DEVICE_START_NAME( k053247 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k053247_device::device_reset() +{ + DEVICE_RESET_NAME( k053247 )(this); +} + + +const device_type K055673 = &device_creator<k055673_device>; + +k055673_device::k055673_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K055673, "Konami 055673", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k053247_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k055673_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k055673_device::device_start() +{ + DEVICE_START_NAME( k055673 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k055673_device::device_reset() +{ + DEVICE_RESET_NAME( k053247 )(this); +} + + +const device_type K051316 = &device_creator<k051316_device>; + +k051316_device::k051316_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K051316, "Konami 051316", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k051316_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k051316_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k051316_device::device_start() +{ + DEVICE_START_NAME( k051316 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k051316_device::device_reset() +{ + DEVICE_RESET_NAME( k051316 )(this); +} + + +const device_type K053936 = &device_creator<k053936_device>; + +k053936_device::k053936_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K053936, "Konami 053936", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k053936_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k053936_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k053936_device::device_start() +{ + DEVICE_START_NAME( k053936 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k053936_device::device_reset() +{ + DEVICE_RESET_NAME( k053936 )(this); +} + + +const device_type K053251 = &device_creator<k053251_device>; + +k053251_device::k053251_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K053251, "Konami 053251", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k053251_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k053251_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k053251_device::device_start() +{ + DEVICE_START_NAME( k053251 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k053251_device::device_reset() +{ + DEVICE_RESET_NAME( k053251 )(this); +} + + +const device_type K054000 = &device_creator<k054000_device>; + +k054000_device::k054000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K054000, "Konami 054000", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k054000_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k054000_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k054000_device::device_start() +{ + DEVICE_START_NAME( k054000 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k054000_device::device_reset() +{ + DEVICE_RESET_NAME( k054000 )(this); +} + + +const device_type K051733 = &device_creator<k051733_device>; + +k051733_device::k051733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K051733, "Konami 051733", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k051733_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k051733_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k051733_device::device_start() +{ + DEVICE_START_NAME( k051733 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k051733_device::device_reset() +{ + DEVICE_RESET_NAME( k051733 )(this); +} + + +const device_type K056832 = &device_creator<k056832_device>; + +k056832_device::k056832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K056832, "Konami 056832", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k056832_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k056832_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k056832_device::device_start() +{ + DEVICE_START_NAME( k056832 )(this); +} + + +const device_type K055555 = &device_creator<k055555_device>; + +k055555_device::k055555_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K055555, "Konami 055555", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k055555_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k055555_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k055555_device::device_start() +{ + DEVICE_START_NAME( k055555 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k055555_device::device_reset() +{ + DEVICE_RESET_NAME( k055555 )(this); +} + + +const device_type K054338 = &device_creator<k054338_device>; + +k054338_device::k054338_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K054338, "Konami 054338", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k054338_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k054338_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k054338_device::device_start() +{ + DEVICE_START_NAME( k054338 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k054338_device::device_reset() +{ + DEVICE_RESET_NAME( k054338 )(this); +} + + +const device_type K001006 = &device_creator<k001006_device>; + +k001006_device::k001006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K001006, "Konami 001006", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k001006_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k001006_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k001006_device::device_start() +{ + DEVICE_START_NAME( k001006 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k001006_device::device_reset() +{ + DEVICE_RESET_NAME( k001006 )(this); +} + + +const device_type K001005 = &device_creator<k001005_device>; + +k001005_device::k001005_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K001005, "Konami 001005", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k001005_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k001005_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k001005_device::device_start() +{ + DEVICE_START_NAME( k001005 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k001005_device::device_reset() +{ + DEVICE_RESET_NAME( k001005 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void k001005_device::device_stop() +{ + DEVICE_STOP_NAME( k001005 )(this); +} + + +const device_type K001604 = &device_creator<k001604_device>; + +k001604_device::k001604_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K001604, "Konami 001604", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k001604_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k001604_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k001604_device::device_start() +{ + DEVICE_START_NAME( k001604 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k001604_device::device_reset() +{ + DEVICE_RESET_NAME( k001604 )(this); +} + + +const device_type K037122 = &device_creator<k037122_device>; + +k037122_device::k037122_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K037122, "Konami 0371222", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(k037122_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k037122_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k037122_device::device_start() +{ + DEVICE_START_NAME( k037122 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k037122_device::device_reset() +{ + DEVICE_RESET_NAME( k037122 )(this); +} + + diff --git a/src/mame/video/konicdev.h b/src/mame/video/konicdev.h index ce01c42942c..8460bba99a0 100644 --- a/src/mame/video/konicdev.h +++ b/src/mame/video/konicdev.h @@ -158,28 +158,408 @@ struct _k037122_interface int gfx_index; }; -DECLARE_LEGACY_DEVICE(K007121, k007121); -DECLARE_LEGACY_DEVICE(K007342, k007342); -DECLARE_LEGACY_DEVICE(K007420, k007420); -DECLARE_LEGACY_DEVICE(K052109, k052109); -DECLARE_LEGACY_DEVICE(K051960, k051960); -DECLARE_LEGACY_DEVICE(K053244, k05324x); +class k007121_device : public device_t +{ +public: + k007121_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k007121_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K007121; + +class k007342_device : public device_t +{ +public: + k007342_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k007342_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K007342; + +class k007420_device : public device_t +{ +public: + k007420_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k007420_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K007420; + +class k052109_device : public device_t +{ +public: + k052109_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k052109_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K052109; + +class k051960_device : public device_t +{ +public: + k051960_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k051960_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K051960; + +class k05324x_device : public device_t +{ +public: + k05324x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k05324x_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K053244; + #define K053245 K053244 -DECLARE_LEGACY_DEVICE(K053246, k053247); +class k053247_device : public device_t +{ +public: + k053247_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k053247_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K053246; + #define K053247 K053246 -DECLARE_LEGACY_DEVICE(K055673, k055673); -DECLARE_LEGACY_DEVICE(K051316, k051316); -DECLARE_LEGACY_DEVICE(K053936, k053936); -DECLARE_LEGACY_DEVICE(K053251, k053251); -DECLARE_LEGACY_DEVICE(K054000, k054000); -DECLARE_LEGACY_DEVICE(K051733, k051733); -DECLARE_LEGACY_DEVICE(K056832, k056832); -DECLARE_LEGACY_DEVICE(K055555, k055555); -DECLARE_LEGACY_DEVICE(K054338, k054338); -DECLARE_LEGACY_DEVICE(K001006, k001006); -DECLARE_LEGACY_DEVICE(K001005, k001005); -DECLARE_LEGACY_DEVICE(K001604, k001604); -DECLARE_LEGACY_DEVICE(K037122, k037122); +class k055673_device : public device_t +{ +public: + k055673_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k055673_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K055673; + +class k051316_device : public device_t +{ +public: + k051316_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k051316_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K051316; + +class k053936_device : public device_t +{ +public: + k053936_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k053936_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K053936; + +class k053251_device : public device_t +{ +public: + k053251_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k053251_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K053251; + +class k054000_device : public device_t +{ +public: + k054000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k054000_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K054000; + +class k051733_device : public device_t +{ +public: + k051733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k051733_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K051733; + +class k056832_device : public device_t +{ +public: + k056832_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k056832_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type K056832; + +class k055555_device : public device_t +{ +public: + k055555_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k055555_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K055555; + +class k054338_device : public device_t +{ +public: + k054338_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k054338_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K054338; + +class k001006_device : public device_t +{ +public: + k001006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k001006_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K001006; + +class k001005_device : public device_t +{ +public: + k001005_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k001005_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K001005; + +class k001604_device : public device_t +{ +public: + k001604_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k001604_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K001604; + +class k037122_device : public device_t +{ +public: + k037122_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~k037122_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K037122; + /*************************************************************************** diff --git a/src/mame/video/taitoic.c b/src/mame/video/taitoic.c index 4065c29dcce..1638023dfbd 100644 --- a/src/mame/video/taitoic.c +++ b/src/mame/video/taitoic.c @@ -572,7 +572,7 @@ INLINE pc080sn_state *pc080sn_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == PC080SN); - return (pc080sn_state *)downcast<legacy_device_base *>(device)->token(); + return (pc080sn_state *)downcast<pc080sn_device *>(device)->token(); } INLINE const pc080sn_interface *pc080sn_get_interface( device_t *device ) @@ -1064,7 +1064,7 @@ INLINE pc090oj_state *pc090oj_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == PC090OJ); - return (pc090oj_state *)downcast<legacy_device_base *>(device)->token(); + return (pc090oj_state *)downcast<pc090oj_device *>(device)->token(); } INLINE const pc090oj_interface *pc090oj_get_interface( device_t *device ) @@ -1272,7 +1272,7 @@ INLINE tc0080vco_state *tc0080vco_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0080VCO); - return (tc0080vco_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0080vco_state *)downcast<tc0080vco_device *>(device)->token(); } INLINE const tc0080vco_interface *tc0080vco_get_interface( device_t *device ) @@ -1955,7 +1955,7 @@ INLINE tc0100scn_state *tc0100scn_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0100SCN); - return (tc0100scn_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0100scn_state *)downcast<tc0100scn_device *>(device)->token(); } INLINE const tc0100scn_interface *tc0100scn_get_interface( device_t *device ) @@ -2559,7 +2559,7 @@ INLINE tc0280grd_state *tc0280grd_get_safe_token( device_t *device ) assert(device != NULL); assert((device->type() == TC0280GRD) || (device->type() == TC0430GRW)); - return (tc0280grd_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0280grd_state *)downcast<tc0280grd_device *>(device)->token(); } INLINE const tc0280grd_interface *tc0280grd_get_interface( device_t *device ) @@ -2729,7 +2729,7 @@ INLINE tc0360pri_state *tc0360pri_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0360PRI); - return (tc0360pri_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0360pri_state *)downcast<tc0360pri_device *>(device)->token(); } /***************************************************************************** @@ -2821,7 +2821,7 @@ INLINE tc0480scp_state *tc0480scp_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0480SCP); - return (tc0480scp_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0480scp_state *)downcast<tc0480scp_device *>(device)->token(); } INLINE const tc0480scp_interface *tc0480scp_get_interface( device_t *device ) @@ -3762,7 +3762,7 @@ INLINE tc0150rod_state *tc0150rod_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0150ROD); - return (tc0150rod_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0150rod_state *)downcast<tc0150rod_device *>(device)->token(); } INLINE const tc0150rod_interface *tc0150rod_get_interface( device_t *device ) @@ -4574,7 +4574,7 @@ INLINE tc0110pcr_state *tc0110pcr_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0110PCR); - return (tc0110pcr_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0110pcr_state *)downcast<tc0110pcr_device *>(device)->token(); } INLINE const tc0110pcr_interface *tc0110pcr_get_interface( device_t *device ) @@ -4805,7 +4805,7 @@ INLINE tc0180vcu_state *tc0180vcu_get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == TC0180VCU); - return (tc0180vcu_state *)downcast<legacy_device_base *>(device)->token(); + return (tc0180vcu_state *)downcast<tc0180vcu_device *>(device)->token(); } INLINE const tc0180vcu_interface *tc0180vcu_get_interface( device_t *device ) @@ -5340,13 +5340,346 @@ DEVICE_GET_INFO( tc0180vcu ) } -DEFINE_LEGACY_DEVICE(PC080SN, pc080sn); -DEFINE_LEGACY_DEVICE(PC090OJ, pc090oj); -DEFINE_LEGACY_DEVICE(TC0080VCO, tc0080vco); -DEFINE_LEGACY_DEVICE(TC0100SCN, tc0100scn); -DEFINE_LEGACY_DEVICE(TC0280GRD, tc0280grd); -DEFINE_LEGACY_DEVICE(TC0360PRI, tc0360pri); -DEFINE_LEGACY_DEVICE(TC0480SCP, tc0480scp); -DEFINE_LEGACY_DEVICE(TC0150ROD, tc0150rod); -DEFINE_LEGACY_DEVICE(TC0110PCR, tc0110pcr); -DEFINE_LEGACY_DEVICE(TC0180VCU, tc0180vcu); +const device_type PC080SN = &device_creator<pc080sn_device>; + +pc080sn_device::pc080sn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PC080SN, "Taito PC080SN", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pc080sn_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pc080sn_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc080sn_device::device_start() +{ + DEVICE_START_NAME( pc080sn )(this); +} + + +const device_type PC090OJ = &device_creator<pc090oj_device>; + +pc090oj_device::pc090oj_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PC090OJ, "Taito PC090OJ", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pc090oj_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pc090oj_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc090oj_device::device_start() +{ + DEVICE_START_NAME( pc090oj )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc090oj_device::device_reset() +{ + DEVICE_RESET_NAME( pc090oj )(this); +} + + +const device_type TC0080VCO = &device_creator<tc0080vco_device>; + +tc0080vco_device::tc0080vco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0080VCO, "Taito TC0080VCO", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0080vco_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0080vco_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0080vco_device::device_start() +{ + DEVICE_START_NAME( tc0080vco )(this); +} + + +const device_type TC0100SCN = &device_creator<tc0100scn_device>; + +tc0100scn_device::tc0100scn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0100SCN, "Taito TC0100SCN", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0100scn_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0100scn_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0100scn_device::device_start() +{ + DEVICE_START_NAME( tc0100scn )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0100scn_device::device_reset() +{ + DEVICE_RESET_NAME( tc0100scn )(this); +} + + +const device_type TC0280GRD = &device_creator<tc0280grd_device>; + +tc0280grd_device::tc0280grd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0280GRD, "Taito TC0280GRD & TC0430GRW", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0280grd_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0280grd_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0280grd_device::device_start() +{ + DEVICE_START_NAME( tc0280grd )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0280grd_device::device_reset() +{ + DEVICE_RESET_NAME( tc0280grd )(this); +} + + +const device_type TC0360PRI = &device_creator<tc0360pri_device>; + +tc0360pri_device::tc0360pri_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0360PRI, "Taito TC0360PRI", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0360pri_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0360pri_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0360pri_device::device_start() +{ + DEVICE_START_NAME( tc0360pri )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0360pri_device::device_reset() +{ + DEVICE_RESET_NAME( tc0360pri )(this); +} + + +const device_type TC0480SCP = &device_creator<tc0480scp_device>; + +tc0480scp_device::tc0480scp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0480SCP, "Taito TC0480SCP", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0480scp_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0480scp_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0480scp_device::device_start() +{ + DEVICE_START_NAME( tc0480scp )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0480scp_device::device_reset() +{ + DEVICE_RESET_NAME( tc0480scp )(this); +} + + +const device_type TC0150ROD = &device_creator<tc0150rod_device>; + +tc0150rod_device::tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0150ROD, "Taito TC0150ROD", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0150rod_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0150rod_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0150rod_device::device_start() +{ + DEVICE_START_NAME( tc0150rod )(this); +} + + +const device_type TC0110PCR = &device_creator<tc0110pcr_device>; + +tc0110pcr_device::tc0110pcr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0110PCR, "Taito TC0110PCR", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0110pcr_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0110pcr_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0110pcr_device::device_start() +{ + DEVICE_START_NAME( tc0110pcr )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0110pcr_device::device_reset() +{ + DEVICE_RESET_NAME( tc0110pcr )(this); +} + + +const device_type TC0180VCU = &device_creator<tc0180vcu_device>; + +tc0180vcu_device::tc0180vcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TC0180VCU, "Taito TC0180VCU", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tc0180vcu_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tc0180vcu_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tc0180vcu_device::device_start() +{ + DEVICE_START_NAME( tc0180vcu )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tc0180vcu_device::device_reset() +{ + DEVICE_RESET_NAME( tc0180vcu )(this); +} + + diff --git a/src/mame/video/taitoic.h b/src/mame/video/taitoic.h index e5f5f878e01..acdbe1a25a0 100644 --- a/src/mame/video/taitoic.h +++ b/src/mame/video/taitoic.h @@ -106,17 +106,204 @@ struct _tc0180vcu_interface int tx_color_base; }; -DECLARE_LEGACY_DEVICE(PC080SN, pc080sn); -DECLARE_LEGACY_DEVICE(PC090OJ, pc090oj); -DECLARE_LEGACY_DEVICE(TC0080VCO, tc0080vco); -DECLARE_LEGACY_DEVICE(TC0100SCN, tc0100scn); -DECLARE_LEGACY_DEVICE(TC0280GRD, tc0280grd); +class pc080sn_device : public device_t +{ +public: + pc080sn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~pc080sn_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type PC080SN; + +class pc090oj_device : public device_t +{ +public: + pc090oj_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~pc090oj_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type PC090OJ; + +class tc0080vco_device : public device_t +{ +public: + tc0080vco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0080vco_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0080VCO; + +class tc0100scn_device : public device_t +{ +public: + tc0100scn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0100scn_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0100SCN; + +class tc0280grd_device : public device_t +{ +public: + tc0280grd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0280grd_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0280GRD; + #define TC0430GRW TC0280GRD -DECLARE_LEGACY_DEVICE(TC0360PRI, tc0360pri); -DECLARE_LEGACY_DEVICE(TC0480SCP, tc0480scp); -DECLARE_LEGACY_DEVICE(TC0150ROD, tc0150rod); -DECLARE_LEGACY_DEVICE(TC0110PCR, tc0110pcr); -DECLARE_LEGACY_DEVICE(TC0180VCU, tc0180vcu); +class tc0360pri_device : public device_t +{ +public: + tc0360pri_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0360pri_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0360PRI; + +class tc0480scp_device : public device_t +{ +public: + tc0480scp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0480scp_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0480SCP; + +class tc0150rod_device : public device_t +{ +public: + tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0150rod_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0150ROD; + +class tc0110pcr_device : public device_t +{ +public: + tc0110pcr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0110pcr_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0110PCR; + +class tc0180vcu_device : public device_t +{ +public: + tc0180vcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tc0180vcu_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type TC0180VCU; + /*************************************************************************** DEVICE CONFIGURATION MACROS diff --git a/src/mame/video/vrender0.c b/src/mame/video/vrender0.c index 3a05da0c01d..b66043e107e 100644 --- a/src/mame/video/vrender0.c +++ b/src/mame/video/vrender0.c @@ -95,7 +95,7 @@ INLINE vr0video_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == VIDEO_VRENDER0); - return (vr0video_state *)downcast<legacy_device_base *>(device)->token(); + return (vr0video_state *)downcast<vr0video_device *>(device)->token(); } INLINE const vr0video_interface *get_interface( device_t *device ) @@ -614,4 +614,40 @@ DEVICE_GET_INFO(vr0video) case DEVINFO_STR_NAME: strcpy(info->s, "VRender0"); break; } } -DEFINE_LEGACY_DEVICE(VIDEO_VRENDER0, vr0video); +const device_type VIDEO_VRENDER0 = &device_creator<vr0video_device>; + +vr0video_device::vr0video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VIDEO_VRENDER0, "VRender0", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(vr0video_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vr0video_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vr0video_device::device_start() +{ + DEVICE_START_NAME( vr0video )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void vr0video_device::device_reset() +{ + DEVICE_RESET_NAME( vr0video )(this); +} + + diff --git a/src/mame/video/vrender0.h b/src/mame/video/vrender0.h index c4873516eb6..e276dfd730a 100644 --- a/src/mame/video/vrender0.h +++ b/src/mame/video/vrender0.h @@ -17,7 +17,26 @@ struct _vr0video_interface DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(VIDEO_VRENDER0, vr0video); +class vr0video_device : public device_t +{ +public: + vr0video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vr0video_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type VIDEO_VRENDER0; + #define MCFG_VIDEO_VRENDER0_ADD(_tag, _interface) \ MCFG_DEVICE_ADD(_tag, VIDEO_VRENDER0, 0) \ diff --git a/src/mess/audio/channelf.c b/src/mess/audio/channelf.c index e72884205da..e6eb25af5c3 100644 --- a/src/mess/audio/channelf.c +++ b/src/mess/audio/channelf.c @@ -20,7 +20,7 @@ INLINE channelf_sound_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == CHANNELF); - return (channelf_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (channelf_sound_state *)downcast<channelf_sound_device *>(device)->token(); } void channelf_sound_w(device_t *device, int mode) @@ -149,4 +149,42 @@ DEVICE_GET_INFO( channelf_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(CHANNELF, channelf_sound); +const device_type CHANNELF = &device_creator<channelf_sound_device>; + +channelf_sound_device::channelf_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, CHANNELF, "Channel F", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(channelf_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void channelf_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void channelf_sound_device::device_start() +{ + DEVICE_START_NAME( channelf_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void channelf_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/dave.c b/src/mess/audio/dave.c index 023927c358d..29bbe1b2c5a 100644 --- a/src/mess/audio/dave.c +++ b/src/mess/audio/dave.c @@ -100,7 +100,7 @@ INLINE dave_t *get_token(device_t *device) { assert(device != NULL); assert(device->type() == DAVE); - return (dave_t *) downcast<legacy_device_base *>(device)->token(); + return (dave_t *) downcast<dave_sound_device *>(device)->token(); } @@ -834,4 +834,51 @@ DEVICE_GET_INFO( dave_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(DAVE, dave_sound); +const device_type DAVE = &device_creator<dave_sound_device>; + +dave_sound_device::dave_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DAVE, "Dave", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(dave_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void dave_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dave_sound_device::device_start() +{ + DEVICE_START_NAME( dave_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dave_sound_device::device_reset() +{ + DEVICE_RESET_NAME( dave_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void dave_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/dave.h b/src/mess/audio/dave.h index dfe56b9e705..af5da4949c7 100644 --- a/src/mess/audio/dave.h +++ b/src/mess/audio/dave.h @@ -14,7 +14,30 @@ MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_SOUND_DEVICE(DAVE, dave_sound); +class dave_sound_device : public device_t, + public device_sound_interface +{ +public: + dave_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~dave_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type DAVE; + #define DAVE_INT_SELECTABLE 0 #define DAVE_INT_1KHZ_50HZ_TG 1 diff --git a/src/mess/audio/gb.c b/src/mess/audio/gb.c index ba037c4c10e..bb2ab554f3c 100644 --- a/src/mess/audio/gb.c +++ b/src/mess/audio/gb.c @@ -180,7 +180,7 @@ INLINE gb_sound_t *get_token(device_t *device) { assert(device != NULL); assert(device->type() == GAMEBOY); - return (gb_sound_t *) downcast<legacy_device_base *>(device)->token(); + return (gb_sound_t *) downcast<gameboy_sound_device *>(device)->token(); } @@ -772,4 +772,42 @@ DEVICE_GET_INFO( gameboy_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(GAMEBOY, gameboy_sound); +const device_type GAMEBOY = &device_creator<gameboy_sound_device>; + +gameboy_sound_device::gameboy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GAMEBOY, "LR35902", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(gb_sound_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void gameboy_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gameboy_sound_device::device_start() +{ + DEVICE_START_NAME( gameboy_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void gameboy_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/gb.h b/src/mess/audio/gb.h index 983d228b577..c162126b47c 100644 --- a/src/mess/audio/gb.h +++ b/src/mess/audio/gb.h @@ -1,4 +1,26 @@ -DECLARE_LEGACY_SOUND_DEVICE(GAMEBOY, gameboy_sound); +class gameboy_sound_device : public device_t, + public device_sound_interface +{ +public: + gameboy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~gameboy_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type GAMEBOY; + READ8_DEVICE_HANDLER( gb_sound_r ); WRITE8_DEVICE_HANDLER( gb_sound_w ); diff --git a/src/mess/audio/gmaster.c b/src/mess/audio/gmaster.c index deb7edb8b04..b558637111a 100644 --- a/src/mess/audio/gmaster.c +++ b/src/mess/audio/gmaster.c @@ -19,7 +19,7 @@ static gmaster_sound *get_token(device_t *device) { assert(device != NULL); assert(device->type() == GMASTER); - return (gmaster_sound *) downcast<legacy_device_base *>(device)->token(); + return (gmaster_sound *) downcast<gmaster_sound_device *>(device)->token(); } @@ -83,4 +83,42 @@ DEVICE_GET_INFO( gmaster_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(GMASTER, gmaster_sound); +const device_type GMASTER = &device_creator<gmaster_sound_device>; + +gmaster_sound_device::gmaster_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GMASTER, "Game Master Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(gmaster_sound)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void gmaster_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void gmaster_sound_device::device_start() +{ + DEVICE_START_NAME( gmaster_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void gmaster_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/lynx.c b/src/mess/audio/lynx.c index c0f134e46f8..349b2637018 100644 --- a/src/mess/audio/lynx.c +++ b/src/mess/audio/lynx.c @@ -115,7 +115,7 @@ INLINE lynx_sound_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == LYNX || device->type() == LYNX2); - return (lynx_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (lynx_sound_state *)downcast<lynx_sound_device *>(device)->token(); } static void lynx_audio_reset_channel(LYNX_AUDIO *This) @@ -536,5 +536,81 @@ DEVICE_GET_INFO( lynx2_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(LYNX, lynx_sound); -DEFINE_LEGACY_SOUND_DEVICE(LYNX2, lynx2_sound); +const device_type LYNX = &device_creator<lynx_sound_device>; + +lynx_sound_device::lynx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, LYNX, "Mikey", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(lynx_sound_state)); +} + +lynx_sound_device::lynx_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(lynx_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void lynx_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void lynx_sound_device::device_start() +{ + DEVICE_START_NAME( lynx_sound )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void lynx_sound_device::device_reset() +{ + DEVICE_RESET_NAME( lynx_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void lynx_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + +const device_type LYNX2 = &device_creator<lynx2_sound_device>; + +lynx2_sound_device::lynx2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : lynx_sound_device(mconfig, LYNX2, "Mikey (Lynx II)", tag, owner, clock) +{ +} + +void lynx2_sound_device::device_start() +{ + DEVICE_START_NAME( lynx2_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void lynx2_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/mac.c b/src/mess/audio/mac.c index 620c64c471a..c9bad8a6617 100644 --- a/src/mess/audio/mac.c +++ b/src/mess/audio/mac.c @@ -52,7 +52,7 @@ INLINE mac_sound *get_token(device_t *device) { assert(device != NULL); assert(device->type() == MAC_SOUND); - return (mac_sound *) downcast<legacy_device_base *>(device)->token(); + return (mac_sound *) downcast<mac_sound_device *>(device)->token(); } @@ -204,4 +204,42 @@ DEVICE_GET_INFO( mac_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(MAC_SOUND, mac_sound); +const device_type MAC_SOUND = &device_creator<mac_sound_device>; + +mac_sound_device::mac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MAC_SOUND, "Mac Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mac_sound)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mac_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mac_sound_device::device_start() +{ + DEVICE_START_NAME( mac_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void mac_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/mea8000.c b/src/mess/audio/mea8000.c index b0651ab8e66..b7c67cacd8c 100644 --- a/src/mess/audio/mea8000.c +++ b/src/mess/audio/mea8000.c @@ -126,7 +126,7 @@ INLINE mea8000_t* get_safe_token( device_t *device ) { assert( device != NULL ); assert( device->type() == MEA8000); - return (mea8000_t*) downcast<legacy_device_base *>(device)->token(); + return (mea8000_t*) downcast<mea8000_device *>(device)->token(); } @@ -722,4 +722,40 @@ DEVICE_GET_INFO( mea8000 ) { } } -DEFINE_LEGACY_DEVICE(MEA8000, mea8000); +const device_type MEA8000 = &device_creator<mea8000_device>; + +mea8000_device::mea8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MEA8000, "Philips / Signetics MEA 8000 speech synthesizer", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mea8000_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mea8000_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mea8000_device::device_start() +{ + DEVICE_START_NAME( mea8000 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mea8000_device::device_reset() +{ + DEVICE_RESET_NAME( mea8000 )(this); +} + + diff --git a/src/mess/audio/mea8000.h b/src/mess/audio/mea8000.h index b1bbbdf5e49..bdeac8f5dd9 100644 --- a/src/mess/audio/mea8000.h +++ b/src/mess/audio/mea8000.h @@ -11,7 +11,26 @@ #include "devlegcy.h" -DECLARE_LEGACY_DEVICE(MEA8000, mea8000); +class mea8000_device : public device_t +{ +public: + mea8000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mea8000_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MEA8000; + /* ---------- configuration ------------ */ diff --git a/src/mess/audio/socrates.c b/src/mess/audio/socrates.c index 1fde923d002..5d8480f2633 100644 --- a/src/mess/audio/socrates.c +++ b/src/mess/audio/socrates.c @@ -27,7 +27,7 @@ INLINE SocratesASIC *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SOCRATES); - return (SocratesASIC *)downcast<legacy_device_base *>(device)->token(); + return (SocratesASIC *)downcast<socrates_snd_device *>(device)->token(); } static const UINT8 volumeLUT[16] = @@ -162,4 +162,42 @@ DEVICE_GET_INFO( socrates_snd ) } } -DEFINE_LEGACY_SOUND_DEVICE(SOCRATES, socrates_snd); +const device_type SOCRATES = &device_creator<socrates_snd_device>; + +socrates_snd_device::socrates_snd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SOCRATES, "Socrates Sound", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(SocratesASIC)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void socrates_snd_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void socrates_snd_device::device_start() +{ + DEVICE_START_NAME( socrates_snd )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void socrates_snd_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/socrates.h b/src/mess/audio/socrates.h index cdd353785d4..7237d325244 100644 --- a/src/mess/audio/socrates.h +++ b/src/mess/audio/socrates.h @@ -9,7 +9,29 @@ void socrates_snd_reg2_w(device_t *device, int data); void socrates_snd_reg3_w(device_t *device, int data); void socrates_snd_reg4_w(device_t *device, int data); -DECLARE_LEGACY_SOUND_DEVICE(SOCRATES, socrates_snd); +class socrates_snd_device : public device_t, + public device_sound_interface +{ +public: + socrates_snd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~socrates_snd_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SOCRATES; + #endif /* __SOCR_SND_H__ */ diff --git a/src/mess/audio/special.c b/src/mess/audio/special.c index 2edafe514ea..4ca9f626705 100644 --- a/src/mess/audio/special.c +++ b/src/mess/audio/special.c @@ -22,7 +22,7 @@ INLINE specimx_sound_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SPECIMX); - return (specimx_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (specimx_sound_state *)downcast<specimx_sound_device *>(device)->token(); } static DEVICE_START(specimx_sound) @@ -88,4 +88,42 @@ DEVICE_GET_INFO( specimx_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(SPECIMX, specimx_sound); +const device_type SPECIMX = &device_creator<specimx_sound_device>; + +specimx_sound_device::specimx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SPECIMX, "Specialist MX Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(specimx_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void specimx_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void specimx_sound_device::device_start() +{ + DEVICE_START_NAME( specimx_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void specimx_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/svision.c b/src/mess/audio/svision.c index 3cb3715c768..9a678e36e85 100644 --- a/src/mess/audio/svision.c +++ b/src/mess/audio/svision.c @@ -59,7 +59,7 @@ INLINE svision_sound_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == SVISION); - return (svision_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (svision_sound_state *)downcast<svision_sound_device *>(device)->token(); } int *svision_dma_finished(device_t *device) @@ -315,4 +315,42 @@ DEVICE_GET_INFO( svision_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(SVISION, svision_sound); +const device_type SVISION = &device_creator<svision_sound_device>; + +svision_sound_device::svision_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SVISION, "Super Vision Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(svision_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void svision_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void svision_sound_device::device_start() +{ + DEVICE_START_NAME( svision_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void svision_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/t6721.c b/src/mess/audio/t6721.c index 2d0f111c0e2..e3b7a56173f 100644 --- a/src/mess/audio/t6721.c +++ b/src/mess/audio/t6721.c @@ -103,7 +103,7 @@ INLINE t6721_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == T6721); - return (t6721_state *)downcast<legacy_device_base *>(device)->token(); + return (t6721_state *)downcast<t6721_device *>(device)->token(); } /***************************************************************************** @@ -303,4 +303,40 @@ DEVICE_GET_INFO(t6721) } } -DEFINE_LEGACY_DEVICE(T6721, t6721); +const device_type T6721 = &device_creator<t6721_device>; + +t6721_device::t6721_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, T6721, "Toshiba 6721A", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(t6721_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void t6721_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void t6721_device::device_start() +{ + DEVICE_START_NAME( t6721 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void t6721_device::device_reset() +{ + DEVICE_RESET_NAME( t6721 )(this); +} + + diff --git a/src/mess/audio/t6721.h b/src/mess/audio/t6721.h index 50f2fb4672a..d10de292616 100644 --- a/src/mess/audio/t6721.h +++ b/src/mess/audio/t6721.h @@ -12,7 +12,26 @@ DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(T6721, t6721); +class t6721_device : public device_t +{ +public: + t6721_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~t6721_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type T6721; + #define MCFG_T6721_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, T6721, 0) \ diff --git a/src/mess/audio/upd1771.c b/src/mess/audio/upd1771.c index 36879a6bbdf..a082db8fdd2 100644 --- a/src/mess/audio/upd1771.c +++ b/src/mess/audio/upd1771.c @@ -159,7 +159,7 @@ INLINE upd1771_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == UPD1771C); - return (upd1771_state *)downcast<legacy_device_base *>(device)->token(); + return (upd1771_state *)downcast<upd1771c_device *>(device)->token(); } @@ -480,5 +480,61 @@ DEVICE_GET_INFO( upd1771c ) } } -DEFINE_LEGACY_SOUND_DEVICE(UPD1771C, upd1771c); +const device_type UPD1771C = &device_creator<upd1771c_device>; + +upd1771c_device::upd1771c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD1771C, "NEC uPD1771C 017", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(upd1771_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void upd1771c_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd1771c_device::device_start() +{ + DEVICE_START_NAME( upd1771c )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void upd1771c_device::device_reset() +{ + DEVICE_RESET_NAME( upd1771c )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void upd1771c_device::device_stop() +{ + DEVICE_STOP_NAME( upd1771c )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void upd1771c_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/upd1771.h b/src/mess/audio/upd1771.h index ed0f3f947ab..d7ae7dae91f 100644 --- a/src/mess/audio/upd1771.h +++ b/src/mess/audio/upd1771.h @@ -24,7 +24,31 @@ struct _upd1771_interface MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_SOUND_DEVICE(UPD1771C, upd1771c); +class upd1771c_device : public device_t, + public device_sound_interface +{ +public: + upd1771c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~upd1771c_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type UPD1771C; + /*************************************************************************** diff --git a/src/mess/audio/vc4000.c b/src/mess/audio/vc4000.c index 4ec802adbdf..ed8a4bc06ed 100644 --- a/src/mess/audio/vc4000.c +++ b/src/mess/audio/vc4000.c @@ -22,7 +22,7 @@ static vc4000_sound *get_token(device_t *device) { assert(device != NULL); assert(device->type() == VC4000); - return (vc4000_sound *) downcast<legacy_device_base *>(device)->token(); + return (vc4000_sound *) downcast<vc4000_sound_device *>(device)->token(); } @@ -99,4 +99,42 @@ DEVICE_GET_INFO( vc4000_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(VC4000, vc4000_sound); +const device_type VC4000 = &device_creator<vc4000_sound_device>; + +vc4000_sound_device::vc4000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VC4000, "VC 4000 Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(vc4000_sound)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vc4000_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vc4000_sound_device::device_start() +{ + DEVICE_START_NAME( vc4000_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void vc4000_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/audio/wswan.c b/src/mess/audio/wswan.c index 03d7b5ce3a4..bde1f6f612d 100644 --- a/src/mess/audio/wswan.c +++ b/src/mess/audio/wswan.c @@ -52,7 +52,7 @@ INLINE wswan_sound_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == WSWAN); - return (wswan_sound_state *)downcast<legacy_device_base *>(device)->token(); + return (wswan_sound_state *)downcast<wswan_sound_device *>(device)->token(); } static void wswan_ch_set_freq( running_machine &machine, struct CHAN *ch, UINT16 freq ) @@ -265,4 +265,42 @@ DEVICE_GET_INFO( wswan_sound ) } } -DEFINE_LEGACY_SOUND_DEVICE(WSWAN, wswan_sound); +const device_type WSWAN = &device_creator<wswan_sound_device>; + +wswan_sound_device::wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, WSWAN, "WonderSwan Custom", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(wswan_sound_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void wswan_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void wswan_sound_device::device_start() +{ + DEVICE_START_NAME( wswan_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void wswan_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/drivers/pv1000.c b/src/mess/drivers/pv1000.c index 8ac813d6a62..3caf4df7086 100644 --- a/src/mess/drivers/pv1000.c +++ b/src/mess/drivers/pv1000.c @@ -9,8 +9,62 @@ #include "imagedev/cartslot.h" -DECLARE_LEGACY_SOUND_DEVICE(PV1000,pv1000_sound); -DEFINE_LEGACY_SOUND_DEVICE(PV1000,pv1000_sound); +class pv1000_sound_device : public device_t, + public device_sound_interface +{ +public: + pv1000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state +}; + +extern const device_type PV1000; + +const device_type PV1000 = &device_creator<pv1000_sound_device>; + +pv1000_sound_device::pv1000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PV1000, "NEC D65010G031", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pv1000_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- +static DEVICE_START( pv1000_sound ); +void pv1000_sound_device::device_start() +{ + DEVICE_START_NAME( pv1000_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void pv1000_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + class pv1000_state : public driver_device diff --git a/src/mess/includes/apollo.h b/src/mess/includes/apollo.h index b6ed9de93b7..363a867bc04 100644 --- a/src/mess/includes/apollo.h +++ b/src/mess/includes/apollo.h @@ -293,10 +293,37 @@ typedef int (*apollo_netserver_transmit)(device_t *, const UINT8 *, int); void apollo_netserver_init(const char *root_path, apollo_netserver_transmit tx_data); /*----------- video/apollo.c -----------*/ +class apollo_mono_device : public device_t +{ +public: + apollo_mono_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~apollo_mono_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +private: + // internal state + void *m_token; +}; + #define APOLLO_SCREEN_TAG "apollo_screen" -DECLARE_LEGACY_DEVICE(APOLLO_MONO19I, apollo_mono19i); +class apollo_mono19i_device : public apollo_mono_device +{ +public: + apollo_mono19i_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state +}; + +extern const device_type APOLLO_MONO19I; + #define MCFG_APOLLO_MONO19I_ADD(_tag) \ MCFG_FRAGMENT_ADD(apollo_mono19i) \ @@ -306,7 +333,21 @@ DEVICE_GET_INFO( apollo_mono19i ); MACHINE_CONFIG_EXTERN( apollo_mono19i ); -DECLARE_LEGACY_DEVICE(APOLLO_MONO15I, apollo_mono15i); +class apollo_mono15i_device : public apollo_mono_device +{ +public: + apollo_mono15i_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state +}; + +extern const device_type APOLLO_MONO15I; + #define MCFG_APOLLO_MONO15I_ADD( _tag) \ MCFG_FRAGMENT_ADD(apollo_mono15i) \ diff --git a/src/mess/includes/channelf.h b/src/mess/includes/channelf.h index 70ca1a62a8b..efd10e9cfb4 100644 --- a/src/mess/includes/channelf.h +++ b/src/mess/includes/channelf.h @@ -60,7 +60,29 @@ SCREEN_UPDATE_IND16( channelf ); /*----------- defined in audio/channelf.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(CHANNELF, channelf_sound); +class channelf_sound_device : public device_t, + public device_sound_interface +{ +public: + channelf_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~channelf_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type CHANNELF; + void channelf_sound_w(device_t *device, int mode); diff --git a/src/mess/includes/gmaster.h b/src/mess/includes/gmaster.h index 8f50e752a9e..04171abb95f 100644 --- a/src/mess/includes/gmaster.h +++ b/src/mess/includes/gmaster.h @@ -35,7 +35,29 @@ public: /*----------- defined in audio/gmaster.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(GMASTER, gmaster_sound); +class gmaster_sound_device : public device_t, + public device_sound_interface +{ +public: + gmaster_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~gmaster_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type GMASTER; + int gmaster_io_callback(device_t *device, int ioline, int state); diff --git a/src/mess/includes/lynx.h b/src/mess/includes/lynx.h index 6fbca456403..1f643b23610 100644 --- a/src/mess/includes/lynx.h +++ b/src/mess/includes/lynx.h @@ -158,8 +158,46 @@ MACHINE_CONFIG_EXTERN( lynx_cartslot ); /*----------- defined in audio/lynx.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(LYNX, lynx_sound); -DECLARE_LEGACY_SOUND_DEVICE(LYNX2, lynx2_sound); +class lynx_sound_device : public device_t, + public device_sound_interface +{ +public: + lynx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + lynx_sound_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~lynx_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type LYNX; + +class lynx2_sound_device : public lynx_sound_device +{ +public: + lynx2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type LYNX2; + void lynx_audio_write(device_t *device, int offset, UINT8 data); UINT8 lynx_audio_read(device_t *device, int offset); diff --git a/src/mess/includes/mac.h b/src/mess/includes/mac.h index 8bafd7417d2..76724055c13 100644 --- a/src/mess/includes/mac.h +++ b/src/mess/includes/mac.h @@ -177,7 +177,29 @@ PALETTE_INIT( macgsc ); /*----------- defined in audio/mac.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(MAC_SOUND, mac_sound); +class mac_sound_device : public device_t, + public device_sound_interface +{ +public: + mac_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mac_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type MAC_SOUND; + void mac_enable_sound( device_t *device, int on ); void mac_set_sound_buffer( device_t *device, int buffer ); diff --git a/src/mess/includes/mc68328.h b/src/mess/includes/mc68328.h index 77265833789..5b4ed9a59c7 100644 --- a/src/mess/includes/mc68328.h +++ b/src/mess/includes/mc68328.h @@ -160,7 +160,26 @@ void mc68328_set_port_d_lines(device_t *device, UINT8 state, int bit); DEVICE INTERFACE ***************************************************************************/ -DECLARE_LEGACY_DEVICE(MC68328, mc68328); +class mc68328_device : public device_t +{ +public: + mc68328_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mc68328_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MC68328; + /*----------- defined in video/mc68328.c -----------*/ diff --git a/src/mess/includes/odyssey2.h b/src/mess/includes/odyssey2.h index 12019e19f58..d0d389d071a 100644 --- a/src/mess/includes/odyssey2.h +++ b/src/mess/includes/odyssey2.h @@ -127,7 +127,24 @@ STREAM_UPDATE( odyssey2_sh_update ); void odyssey2_ef9341_w( running_machine &machine, int command, int b, UINT8 data ); UINT8 odyssey2_ef9341_r( running_machine &machine, int command, int b ); -DECLARE_LEGACY_SOUND_DEVICE(ODYSSEY2, odyssey2_sound); +class odyssey2_sound_device : public device_t, + public device_sound_interface +{ +public: + odyssey2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state +}; + +extern const device_type ODYSSEY2; + /*----------- defined in machine/odyssey2.c -----------*/ diff --git a/src/mess/includes/special.h b/src/mess/includes/special.h index d9853b72c15..4c0d0268d4d 100644 --- a/src/mess/includes/special.h +++ b/src/mess/includes/special.h @@ -115,7 +115,29 @@ extern const rgb_t specimx_palette[16]; /*----------- defined in audio/special.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(SPECIMX, specimx_sound); +class specimx_sound_device : public device_t, + public device_sound_interface +{ +public: + specimx_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~specimx_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SPECIMX; + void specimx_set_input(device_t *device, int index, int state); diff --git a/src/mess/includes/svision.h b/src/mess/includes/svision.h index 0b72f109de7..621c1d4fba9 100644 --- a/src/mess/includes/svision.h +++ b/src/mess/includes/svision.h @@ -59,7 +59,29 @@ void svision_irq( running_machine &machine ); /*----------- defined in audio/svision.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(SVISION, svision_sound); +class svision_sound_device : public device_t, + public device_sound_interface +{ +public: + svision_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~svision_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type SVISION; + int *svision_dma_finished(device_t *device); void svision_sound_decrement(device_t *device); diff --git a/src/mess/includes/vc4000.h b/src/mess/includes/vc4000.h index c8c44e0d025..ee141dcb2bb 100644 --- a/src/mess/includes/vc4000.h +++ b/src/mess/includes/vc4000.h @@ -106,7 +106,29 @@ extern SCREEN_UPDATE_IND16( vc4000 ); /*----------- defined in audio/vc4000.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(VC4000, vc4000_sound); +class vc4000_sound_device : public device_t, + public device_sound_interface +{ +public: + vc4000_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vc4000_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type VC4000; + void vc4000_soundport_w (device_t *device, int mode, int data); diff --git a/src/mess/includes/wswan.h b/src/mess/includes/wswan.h index 39c34fb7066..f6907dc7610 100644 --- a/src/mess/includes/wswan.h +++ b/src/mess/includes/wswan.h @@ -171,7 +171,29 @@ void wswan_refresh_scanline( running_machine &machine ); /*----------- defined in audio/wswan.c -----------*/ -DECLARE_LEGACY_SOUND_DEVICE(WSWAN, wswan_sound); +class wswan_sound_device : public device_t, + public device_sound_interface +{ +public: + wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~wswan_sound_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +private: + // internal state + void *m_token; +}; + +extern const device_type WSWAN; + WRITE8_DEVICE_HANDLER( wswan_sound_port_w ); diff --git a/src/mess/machine/990_tap.c b/src/mess/machine/990_tap.c index 1475b81b392..27c3fda5a7b 100644 --- a/src/mess/machine/990_tap.c +++ b/src/mess/machine/990_tap.c @@ -127,7 +127,7 @@ INLINE tap_990_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == TI990_TAPE_CTRL); - return (tap_990_t *)downcast<legacy_device_base *>(device)->token(); + return (tap_990_t *)downcast<tap_990_device *>(device)->token(); } @@ -1089,4 +1089,41 @@ DEVICE_GET_INFO( tap_990 ) } } -DEFINE_LEGACY_DEVICE(TI990_TAPE_CTRL, tap_990); +const device_type TI990_TAPE_CTRL = &device_creator<tap_990_device>; + +tap_990_device::tap_990_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TI990_TAPE_CTRL, "Generic TI990 Tape Controller", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tap_990_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tap_990_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tap_990_device::device_start() +{ + DEVICE_START_NAME( tap_990 )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor tap_990_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( tap_990 ); +} + + diff --git a/src/mess/machine/990_tap.h b/src/mess/machine/990_tap.h index 8f3b4dc187a..8f705ecde3f 100644 --- a/src/mess/machine/990_tap.h +++ b/src/mess/machine/990_tap.h @@ -17,7 +17,26 @@ struct _ti990_tpc_interface MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(TI990_TAPE_CTRL, tap_990); +class tap_990_device : public device_t +{ +public: + tap_990_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tap_990_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type TI990_TAPE_CTRL; + #define MCFG_TI990_TAPE_CTRL_ADD(_tag, _intrf) \ MCFG_DEVICE_ADD((_tag), TI990_TAPE_CTRL, 0)\ diff --git a/src/mess/machine/apollo.c b/src/mess/machine/apollo.c index 199317a285b..fb0e7779bf0 100644 --- a/src/mess/machine/apollo.c +++ b/src/mess/machine/apollo.c @@ -150,7 +150,7 @@ static DEVICE_RESET(apollo_config) device get info callback -------------------------------------------------*/ -static DEVICE_GET_INFO(apollo_config) +DEVICE_GET_INFO(apollo_config) { switch (state) { @@ -167,9 +167,58 @@ static DEVICE_GET_INFO(apollo_config) } } -static DECLARE_LEGACY_DEVICE(APOLLO_CONF, apollo_config); +class apollo_config_device : public device_t +{ +public: + apollo_config_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state +}; + +extern const device_type APOLLO_CONF; + + +const device_type APOLLO_CONF = &device_creator<apollo_config_device>; + +apollo_config_device::apollo_config_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, APOLLO_CONF, "Apollo Configuration", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void apollo_config_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apollo_config_device::device_start() +{ + DEVICE_START_NAME( apollo_config )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apollo_config_device::device_reset() +{ + DEVICE_RESET_NAME( apollo_config )(this); +} + -DEFINE_LEGACY_DEVICE(APOLLO_CONF, apollo_config); //########################################################################## // machine/apollo_csr.c - APOLLO DS3500 CPU Control and Status registers diff --git a/src/mess/machine/applefdc.c b/src/mess/machine/applefdc.c index 97cfa0ec5fb..28fb4b468b4 100644 --- a/src/mess/machine/applefdc.c +++ b/src/mess/machine/applefdc.c @@ -165,7 +165,7 @@ INLINE void assert_is_applefdc(device_t *device) INLINE applefdc_token *get_token(device_t *device) { assert_is_applefdc(device); - return (applefdc_token *) downcast<legacy_device_base *>(device)->token(); + return (applefdc_token *) downcast<applefdc_base_device *>(device)->token(); } @@ -857,6 +857,80 @@ DEVICE_GET_INFO(swim) } } -DEFINE_LEGACY_DEVICE(APPLEFDC, applefdc); -DEFINE_LEGACY_DEVICE(IWM, iwm); -DEFINE_LEGACY_DEVICE(SWIM, swim); +applefdc_base_device::applefdc_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(applefdc_token)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void applefdc_base_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void applefdc_base_device::device_reset() +{ + DEVICE_RESET_NAME( applefdc )(this); +} + + +const device_type APPLEFDC = &device_creator<applefdc_device>; + +applefdc_device::applefdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : applefdc_base_device(mconfig, APPLEFDC, "Apple FDC", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void applefdc_device::device_start() +{ + DEVICE_START_NAME( oldfdc )(this); +} + + +const device_type IWM = &device_creator<iwm_device>; + +iwm_device::iwm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : applefdc_base_device(mconfig, IWM, "Apple IWM (Integrated Woz Machine)", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void iwm_device::device_start() +{ + DEVICE_START_NAME( iwm )(this); +} + + +const device_type SWIM = &device_creator<swim_device>; + +swim_device::swim_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : applefdc_base_device(mconfig, SWIM, "Apple SWIM (Steve Woz Integrated Machine)", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void swim_device::device_start() +{ + DEVICE_START_NAME( swim )(this); +} + + diff --git a/src/mess/machine/applefdc.h b/src/mess/machine/applefdc.h index 04f8f1da776..e7df5345d47 100644 --- a/src/mess/machine/applefdc.h +++ b/src/mess/machine/applefdc.h @@ -28,9 +28,57 @@ #define APPLEFDC_PH2 0x04 #define APPLEFDC_PH3 0x08 -DECLARE_LEGACY_DEVICE(APPLEFDC, applefdc); -DECLARE_LEGACY_DEVICE(IWM, iwm); -DECLARE_LEGACY_DEVICE(SWIM, swim); +class applefdc_base_device : public device_t +{ +public: + applefdc_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~applefdc_base_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start() { } + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +class applefdc_device : public applefdc_base_device +{ +public: + applefdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type APPLEFDC; + +class iwm_device : public applefdc_base_device +{ +public: + iwm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type IWM; + +class swim_device : public applefdc_base_device +{ +public: + swim_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type SWIM; + diff --git a/src/mess/machine/at45dbxx.c b/src/mess/machine/at45dbxx.c index 7a48078d06c..49fe9ef76a1 100644 --- a/src/mess/machine/at45dbxx.c +++ b/src/mess/machine/at45dbxx.c @@ -81,7 +81,7 @@ INLINE at45dbxx_t *get_token(device_t *device) assert(device != NULL); assert(device->type() == AT45DB041 || device->type() == AT45DB081 || device->type() == AT45DB161); - return (at45dbxx_t *) downcast<legacy_device_base *>(device)->token(); + return (at45dbxx_t *) downcast<at45db041_device *>(device)->token(); } @@ -467,6 +467,79 @@ DEVICE_GET_INFO( at45db161 ) } } -DEFINE_LEGACY_DEVICE(AT45DB041, at45db041); -DEFINE_LEGACY_DEVICE(AT45DB081, at45db081); -DEFINE_LEGACY_DEVICE(AT45DB161, at45db161); +const device_type AT45DB041 = &device_creator<at45db041_device>; + +at45db041_device::at45db041_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, AT45DB041, "AT45DB041", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(at45dbxx_t)); +} +at45db041_device::at45db041_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(at45dbxx_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void at45db041_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void at45db041_device::device_start() +{ + DEVICE_START_NAME( at45db041 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void at45db041_device::device_reset() +{ + DEVICE_RESET_NAME( at45dbxx )(this); +} + + +const device_type AT45DB081 = &device_creator<at45db081_device>; + +at45db081_device::at45db081_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : at45db041_device(mconfig, AT45DB081, "AT45DB081", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void at45db081_device::device_start() +{ + DEVICE_START_NAME( at45db081 )(this); +} + + +const device_type AT45DB161 = &device_creator<at45db161_device>; + +at45db161_device::at45db161_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : at45db041_device(mconfig, AT45DB161, "AT45DB161", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void at45db161_device::device_start() +{ + DEVICE_START_NAME( at45db161 )(this); +} + + diff --git a/src/mess/machine/at45dbxx.h b/src/mess/machine/at45dbxx.h index 6bd1ff8abcd..d8f5ec81e33 100644 --- a/src/mess/machine/at45dbxx.h +++ b/src/mess/machine/at45dbxx.h @@ -20,17 +20,57 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(AT45DB041, at45db041); +class at45db041_device : public device_t +{ +public: + at45db041_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + at45db041_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~at45db041_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type AT45DB041; + #define MCFG_AT45DB041_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, AT45DB041, 0) \ -DECLARE_LEGACY_DEVICE(AT45DB081, at45db081); +class at45db081_device : public at45db041_device +{ +public: + at45db081_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type AT45DB081; + #define MCFG_AT45DB081_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, AT45DB081, 0) \ -DECLARE_LEGACY_DEVICE(AT45DB161, at45db161); +class at45db161_device : public at45db041_device +{ +public: + at45db161_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type AT45DB161; + #define MCFG_AT45DB161_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, AT45DB161, 0) \ diff --git a/src/mess/machine/ataridev.h b/src/mess/machine/ataridev.h index 01803329509..56d173c2323 100644 --- a/src/mess/machine/ataridev.h +++ b/src/mess/machine/ataridev.h @@ -38,7 +38,27 @@ DEVICE_IMAGE_UNLOAD( xegs_cart ); MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(ATARI_FDC, atari_fdc); +class atari_fdc_device : public device_t +{ +public: + atari_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~atari_fdc_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type ATARI_FDC; + #define MCFG_ATARI_FDC_ADD(_tag) \ MCFG_DEVICE_ADD((_tag), ATARI_FDC, 0) diff --git a/src/mess/machine/atarifdc.c b/src/mess/machine/atarifdc.c index c44777e2634..457ba5aa1f7 100644 --- a/src/mess/machine/atarifdc.c +++ b/src/mess/machine/atarifdc.c @@ -74,7 +74,7 @@ INLINE atari_fdc_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == ATARI_FDC); - return (atari_fdc_t *)downcast<legacy_device_base *>(device)->token(); + return (atari_fdc_t *)downcast<atari_fdc_device *>(device)->token(); } /***************************************************************************** @@ -840,4 +840,50 @@ DEVICE_GET_INFO( atari_fdc ) } } -DEFINE_LEGACY_DEVICE(ATARI_FDC, atari_fdc); +const device_type ATARI_FDC = &device_creator<atari_fdc_device>; + +atari_fdc_device::atari_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ATARI_FDC, "Atari FDC", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(atari_fdc_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void atari_fdc_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void atari_fdc_device::device_start() +{ + DEVICE_START_NAME( atari_fdc )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void atari_fdc_device::device_reset() +{ + DEVICE_RESET_NAME( atari_fdc )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor atari_fdc_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( atari_fdc ); +} + + diff --git a/src/mess/machine/ay31015.c b/src/mess/machine/ay31015.c index 4542d195dcb..d35e2e4f727 100644 --- a/src/mess/machine/ay31015.c +++ b/src/mess/machine/ay31015.c @@ -141,7 +141,7 @@ INLINE ay31015_t *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == AY31015); - return (ay31015_t *) downcast<legacy_device_base *>(device)->token(); + return (ay31015_t *) downcast<ay31015_device *>(device)->token(); } @@ -742,4 +742,40 @@ DEVICE_GET_INFO( ay31015 ) } } -DEFINE_LEGACY_DEVICE(AY31015, ay31015); +const device_type AY31015 = &device_creator<ay31015_device>; + +ay31015_device::ay31015_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, AY31015, "AY-3-1015", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ay31015_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ay31015_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ay31015_device::device_start() +{ + DEVICE_START_NAME( ay31015 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void ay31015_device::device_reset() +{ + DEVICE_RESET_NAME( ay31015 )(this); +} + + diff --git a/src/mess/machine/ay31015.h b/src/mess/machine/ay31015.h index 8284c7eb27f..bd22c72be6a 100644 --- a/src/mess/machine/ay31015.h +++ b/src/mess/machine/ay31015.h @@ -104,5 +104,24 @@ void ay31015_set_transmit_data( device_t *device, UINT8 data ); DEVICE INTERFACE ***************************************************************************/ -DECLARE_LEGACY_DEVICE(AY31015, ay31015); +class ay31015_device : public device_t +{ +public: + ay31015_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ay31015_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type AY31015; + #endif diff --git a/src/mess/machine/beta.c b/src/mess/machine/beta.c index 48b90c5a6ab..33fd2538695 100644 --- a/src/mess/machine/beta.c +++ b/src/mess/machine/beta.c @@ -35,7 +35,7 @@ INLINE beta_disk_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == BETA_DISK); - return (beta_disk_state *)downcast<legacy_device_base *>(device)->token(); + return (beta_disk_state *)downcast<beta_disk_device *>(device)->token(); } @@ -358,4 +358,61 @@ DEVICE_GET_INFO( beta_disk ) } } -DEFINE_LEGACY_DEVICE(BETA_DISK, beta_disk); +const device_type BETA_DISK = &device_creator<beta_disk_device>; + +beta_disk_device::beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, BETA_DISK, "Beta Disk Interface", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(beta_disk_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void beta_disk_device::device_config_complete() +{ + m_shortname = "betadisk"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void beta_disk_device::device_start() +{ + DEVICE_START_NAME( beta_disk )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void beta_disk_device::device_reset() +{ + DEVICE_RESET_NAME( beta_disk )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor beta_disk_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( beta_disk ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *beta_disk_device::device_rom_region() const +{ + return ROM_NAME(beta_disk ); +} + + diff --git a/src/mess/machine/beta.h b/src/mess/machine/beta.h index 82b6df43c98..d8e390adccc 100644 --- a/src/mess/machine/beta.h +++ b/src/mess/machine/beta.h @@ -18,7 +18,28 @@ void betadisk_clear_status(device_t *device); #define BETA_DISK_TAG "beta" -DECLARE_LEGACY_DEVICE(BETA_DISK, beta_disk); +class beta_disk_device : public device_t +{ +public: + beta_disk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~beta_disk_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type BETA_DISK; + #define MCFG_BETA_DISK_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, BETA_DISK, 0) diff --git a/src/mess/machine/ds1315.c b/src/mess/machine/ds1315.c index 5fd49f700ed..75bf04fdbff 100644 --- a/src/mess/machine/ds1315.c +++ b/src/mess/machine/ds1315.c @@ -65,7 +65,7 @@ INLINE ds1315_t *get_token(device_t *device) { assert(device != NULL); assert(device->type() == DS1315); - return (ds1315_t *) downcast<legacy_device_base *>(device)->token(); + return (ds1315_t *) downcast<ds1315_device *>(device)->token(); } @@ -264,4 +264,31 @@ DEVICE_GET_INFO( ds1315 ) } } -DEFINE_LEGACY_DEVICE(DS1315, ds1315); +const device_type DS1315 = &device_creator<ds1315_device>; + +ds1315_device::ds1315_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DS1315, "Dallas Semiconductor DS1315", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(ds1315_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ds1315_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ds1315_device::device_start() +{ + DEVICE_START_NAME( ds1315 )(this); +} + + diff --git a/src/mess/machine/ds1315.h b/src/mess/machine/ds1315.h index 29cd248a46c..969f109eaa0 100644 --- a/src/mess/machine/ds1315.h +++ b/src/mess/machine/ds1315.h @@ -18,7 +18,25 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(DS1315, ds1315); +class ds1315_device : public device_t +{ +public: + ds1315_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ds1315_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type DS1315; + diff --git a/src/mess/machine/e05a03.c b/src/mess/machine/e05a03.c index 3e394d83171..5a8ea7a5ca0 100644 --- a/src/mess/machine/e05a03.c +++ b/src/mess/machine/e05a03.c @@ -56,7 +56,7 @@ INLINE e05a03_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == E05A03); - return (e05a03_state *)downcast<legacy_device_base *>(device)->token(); + return (e05a03_state *)downcast<e05a03_device *>(device)->token(); } @@ -238,4 +238,40 @@ WRITE_LINE_DEVICE_HANDLER( e05a03_init_w ) e05a03_resi_w(device, state); } -DEFINE_LEGACY_DEVICE(E05A03, e05a03); +const device_type E05A03 = &device_creator<e05a03_device>; + +e05a03_device::e05a03_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, E05A03, "E05A03", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(e05a03_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void e05a03_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void e05a03_device::device_start() +{ + DEVICE_START_NAME( e05a03 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void e05a03_device::device_reset() +{ + DEVICE_RESET_NAME( e05a03 )(this); +} + + diff --git a/src/mess/machine/e05a03.h b/src/mess/machine/e05a03.h index 37c39e0a1d5..15f1d847eae 100644 --- a/src/mess/machine/e05a03.h +++ b/src/mess/machine/e05a03.h @@ -44,7 +44,26 @@ WRITE_LINE_DEVICE_HANDLER( e05a03_init_w ); /* centronics init */ DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(E05A03, e05a03); +class e05a03_device : public device_t +{ +public: + e05a03_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~e05a03_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type E05A03; + #define MCFG_E05A03_ADD(_tag, _intf) \ MCFG_DEVICE_ADD(_tag, E05A03, 0) \ diff --git a/src/mess/machine/er59256.c b/src/mess/machine/er59256.c index 379a4bd7543..e319ffdd6da 100644 --- a/src/mess/machine/er59256.c +++ b/src/mess/machine/er59256.c @@ -61,7 +61,7 @@ static void decode_command(er59256_t *er59256); INLINE er59256_t *get_token(device_t *device) { assert(device->type() == ER59256); - return (er59256_t *) downcast<legacy_device_base *>(device)->token(); + return (er59256_t *) downcast<er59256_device *>(device)->token(); } @@ -248,4 +248,40 @@ DEVICE_GET_INFO( er59256 ) } } -DEFINE_LEGACY_DEVICE(ER59256, er59256); +const device_type ER59256 = &device_creator<er59256_device>; + +er59256_device::er59256_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ER59256, "Microchip ER59256 serial eeprom.", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(er59256_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void er59256_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void er59256_device::device_start() +{ + DEVICE_START_NAME( er59256 )(this); +} + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void er59256_device::device_stop() +{ + DEVICE_STOP_NAME( er59256 )(this); +} + + diff --git a/src/mess/machine/er59256.h b/src/mess/machine/er59256.h index 4a81e6809ce..395c3af0fac 100644 --- a/src/mess/machine/er59256.h +++ b/src/mess/machine/er59256.h @@ -14,7 +14,26 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(ER59256, er59256); +class er59256_device : public device_t +{ +public: + er59256_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~er59256_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_stop(); +private: + // internal state + void *m_token; +}; + +extern const device_type ER59256; + #define MCFG_ER59256_ADD(_tag) \ MCFG_DEVICE_ADD((_tag), ER59256, 0) diff --git a/src/mess/machine/hd63450.c b/src/mess/machine/hd63450.c index b82d7cdc889..7a40d5162c7 100644 --- a/src/mess/machine/hd63450.c +++ b/src/mess/machine/hd63450.c @@ -53,7 +53,7 @@ INLINE hd63450_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == HD63450); - return (hd63450_t *)downcast<legacy_device_base *>(device)->token(); + return (hd63450_t *)downcast<hd63450_device *>(device)->token(); } static DEVICE_START(hd63450) @@ -485,4 +485,31 @@ DEVICE_GET_INFO(hd63450) READ16_DEVICE_HANDLER(hd63450_r) { return hd63450_read(device,offset,mem_mask); } WRITE16_DEVICE_HANDLER(hd63450_w) { hd63450_write(device,offset,data,mem_mask); } -DEFINE_LEGACY_DEVICE(HD63450, hd63450); +const device_type HD63450 = &device_creator<hd63450_device>; + +hd63450_device::hd63450_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, HD63450, "Hitachi HD63450", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(hd63450_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void hd63450_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void hd63450_device::device_start() +{ + DEVICE_START_NAME( hd63450 )(this); +} + + diff --git a/src/mess/machine/hd63450.h b/src/mess/machine/hd63450.h index c5fba6a9ad8..f1b42525e57 100644 --- a/src/mess/machine/hd63450.h +++ b/src/mess/machine/hd63450.h @@ -24,7 +24,25 @@ void hd63450_set_timer(device_t* device, int channel, attotime tm); int hd63450_get_vector(device_t* device, int channel); int hd63450_get_error_vector(device_t* device, int channel); -DECLARE_LEGACY_DEVICE(HD63450, hd63450); +class hd63450_device : public device_t +{ +public: + hd63450_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~hd63450_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type HD63450; + #define MCFG_HD63450_ADD(_tag, _config) \ MCFG_DEVICE_ADD(_tag, HD63450, 0) \ diff --git a/src/mess/machine/i8271.c b/src/mess/machine/i8271.c index 18e5a98e5c3..5bc1871324b 100644 --- a/src/mess/machine/i8271.c +++ b/src/mess/machine/i8271.c @@ -183,7 +183,7 @@ INLINE i8271_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == I8271); - return (i8271_t *)downcast<legacy_device_base *>(device)->token(); + return (i8271_t *)downcast<i8271_device *>(device)->token(); } @@ -1596,4 +1596,40 @@ DEVICE_GET_INFO( i8271 ) } } -DEFINE_LEGACY_DEVICE(I8271, i8271); +const device_type I8271 = &device_creator<i8271_device>; + +i8271_device::i8271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, I8271, "Intel 8271", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(i8271_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void i8271_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void i8271_device::device_start() +{ + DEVICE_START_NAME( i8271 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void i8271_device::device_reset() +{ + DEVICE_RESET_NAME( i8271 )(this); +} + + diff --git a/src/mess/machine/i8271.h b/src/mess/machine/i8271.h index 226a9055b7d..3030b5eca13 100644 --- a/src/mess/machine/i8271.h +++ b/src/mess/machine/i8271.h @@ -11,7 +11,26 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(I8271, i8271); +class i8271_device : public device_t +{ +public: + i8271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~i8271_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type I8271; + /*************************************************************************** TYPE DEFINITIONS diff --git a/src/mess/machine/kr2376.c b/src/mess/machine/kr2376.c index ac89987cbf9..8130e78c76e 100644 --- a/src/mess/machine/kr2376.c +++ b/src/mess/machine/kr2376.c @@ -88,7 +88,7 @@ INLINE kr2376_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == KR2376); - return (kr2376_t *)downcast<legacy_device_base *>(device)->token(); + return (kr2376_t *)downcast<kr2376_device *>(device)->token(); } /*------------------------------------------------- @@ -393,4 +393,31 @@ DEVICE_GET_INFO( kr2376 ) } } -DEFINE_LEGACY_DEVICE(KR2376, kr2376); +const device_type KR2376 = &device_creator<kr2376_device>; + +kr2376_device::kr2376_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, KR2376, "SMC KR2376", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(kr2376_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void kr2376_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void kr2376_device::device_start() +{ + DEVICE_START_NAME( kr2376 )(this); +} + + diff --git a/src/mess/machine/kr2376.h b/src/mess/machine/kr2376.h index 6c5073ae7da..07c65fa5638 100644 --- a/src/mess/machine/kr2376.h +++ b/src/mess/machine/kr2376.h @@ -36,7 +36,25 @@ typedef void (*kr2376_on_strobe_changed_func) (device_t *device, int level); #define KR2376_ON_STROBE_CHANGED(name) void name(device_t *device, int level) -DECLARE_LEGACY_DEVICE(KR2376, kr2376); +class kr2376_device : public device_t +{ +public: + kr2376_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~kr2376_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type KR2376; + #define MCFG_KR2376_ADD(_tag, _intrf) \ MCFG_DEVICE_ADD(_tag, KR2376, 0) \ diff --git a/src/mess/machine/mc68328.c b/src/mess/machine/mc68328.c index 6f2e9550b21..74e6daf723a 100644 --- a/src/mess/machine/mc68328.c +++ b/src/mess/machine/mc68328.c @@ -2829,4 +2829,40 @@ DEVICE_GET_INFO( mc68328 ) } } -DEFINE_LEGACY_DEVICE(MC68328, mc68328); +const device_type MC68328 = &device_creator<mc68328_device>; + +mc68328_device::mc68328_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MC68328, "Motorola MC68328 (DragonBall) Integrated Processor", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mc68328_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mc68328_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mc68328_device::device_start() +{ + DEVICE_START_NAME( mc68328 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mc68328_device::device_reset() +{ + DEVICE_RESET_NAME( mc68328 )(this); +} + + diff --git a/src/mess/machine/mc68328.h b/src/mess/machine/mc68328.h index 8ddee5c8907..86163504517 100644 --- a/src/mess/machine/mc68328.h +++ b/src/mess/machine/mc68328.h @@ -535,7 +535,7 @@ INLINE mc68328_t* mc68328_get_safe_token( device_t *device ) { assert( device != NULL ); assert( device->type() == MC68328 ); - return (mc68328_t*) downcast<legacy_device_base *>(device)->token(); + return (mc68328_t*) downcast<mc68328_device *>(device)->token(); } #endif // __MC68328_PRIVATE_H_ diff --git a/src/mess/machine/mc6843.c b/src/mess/machine/mc6843.c index ca16b31d8dc..7ebf42461f2 100644 --- a/src/mess/machine/mc6843.c +++ b/src/mess/machine/mc6843.c @@ -111,7 +111,7 @@ INLINE mc6843_t* get_safe_token( device_t *device ) { assert( device != NULL ); assert( device->type() == MC6843 ); - return (mc6843_t*) downcast<legacy_device_base *>(device)->token(); + return (mc6843_t*) downcast<mc6843_device *>(device)->token(); } @@ -851,5 +851,41 @@ DEVICE_GET_INFO( mc6843 ) { } } -DEFINE_LEGACY_DEVICE(MC6843, mc6843); +const device_type MC6843 = &device_creator<mc6843_device>; + +mc6843_device::mc6843_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MC6843, "Motorola MC6843 floppy controller", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mc6843_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mc6843_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mc6843_device::device_start() +{ + DEVICE_START_NAME( mc6843 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mc6843_device::device_reset() +{ + DEVICE_RESET_NAME( mc6843 )(this); +} + + diff --git a/src/mess/machine/mc6843.h b/src/mess/machine/mc6843.h index 876dff50974..8bd25d3d32a 100644 --- a/src/mess/machine/mc6843.h +++ b/src/mess/machine/mc6843.h @@ -9,7 +9,26 @@ #ifndef MC6843_H #define MC6843_H -DECLARE_LEGACY_DEVICE(MC6843, mc6843); +class mc6843_device : public device_t +{ +public: + mc6843_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mc6843_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MC6843; + /* ---------- configuration ------------ */ diff --git a/src/mess/machine/mc6846.c b/src/mess/machine/mc6846.c index 33cc21bf219..993e74e5696 100644 --- a/src/mess/machine/mc6846.c +++ b/src/mess/machine/mc6846.c @@ -87,7 +87,7 @@ INLINE mc6846_t* get_safe_token( device_t *device ) { assert( device != NULL ); assert( device->type() == MC6846 ); - return (mc6846_t*) downcast<legacy_device_base *>(device)->token(); + return (mc6846_t*) downcast<mc6846_device *>(device)->token(); } @@ -631,4 +631,40 @@ DEVICE_GET_INFO( mc6846 ) { } } -DEFINE_LEGACY_DEVICE(MC6846, mc6846); +const device_type MC6846 = &device_creator<mc6846_device>; + +mc6846_device::mc6846_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MC6846, "Motorola MC6846 programmable timer", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mc6846_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mc6846_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mc6846_device::device_start() +{ + DEVICE_START_NAME( mc6846 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mc6846_device::device_reset() +{ + DEVICE_RESET_NAME( mc6846 )(this); +} + + diff --git a/src/mess/machine/mc6846.h b/src/mess/machine/mc6846.h index 7373543f1a2..892340ef78e 100644 --- a/src/mess/machine/mc6846.h +++ b/src/mess/machine/mc6846.h @@ -9,7 +9,26 @@ #ifndef MC6846_H #define MC6846_H -DECLARE_LEGACY_DEVICE(MC6846, mc6846); +class mc6846_device : public device_t +{ +public: + mc6846_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mc6846_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MC6846; + /* ---------- configuration ------------ */ diff --git a/src/mess/machine/mc6854.c b/src/mess/machine/mc6854.c index fcc62aaac1a..da808f12c4b 100644 --- a/src/mess/machine/mc6854.c +++ b/src/mess/machine/mc6854.c @@ -225,7 +225,7 @@ INLINE mc6854_t* get_safe_token( device_t *device ) { assert( device != NULL ); assert( device->type() == MC6854 ); - return (mc6854_t*) downcast<legacy_device_base *>(device)->token(); + return (mc6854_t*) downcast<mc6854_device *>(device)->token(); } @@ -1061,4 +1061,40 @@ DEVICE_GET_INFO( mc6854 ) { } } -DEFINE_LEGACY_DEVICE(MC6854, mc6854); +const device_type MC6854 = &device_creator<mc6854_device>; + +mc6854_device::mc6854_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MC6854, "Motorola MC6854 ADLC", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mc6854_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mc6854_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mc6854_device::device_start() +{ + DEVICE_START_NAME( mc6854 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mc6854_device::device_reset() +{ + DEVICE_RESET_NAME( mc6854 )(this); +} + + diff --git a/src/mess/machine/mc6854.h b/src/mess/machine/mc6854.h index e0b13373625..a7a44cb8c7c 100644 --- a/src/mess/machine/mc6854.h +++ b/src/mess/machine/mc6854.h @@ -9,7 +9,26 @@ #ifndef MC6854_H #define MC6854_H -DECLARE_LEGACY_DEVICE(MC6854, mc6854); +class mc6854_device : public device_t +{ +public: + mc6854_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mc6854_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MC6854; + /* we provide two interfaces: - a bit-based interface: out_tx, set_rx diff --git a/src/mess/machine/micropolis.c b/src/mess/machine/micropolis.c index f529aa250a2..6518df301a9 100644 --- a/src/mess/machine/micropolis.c +++ b/src/mess/machine/micropolis.c @@ -113,7 +113,7 @@ INLINE micropolis_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == MICROPOLIS); - return (micropolis_state *)downcast<legacy_device_base *>(device)->token(); + return (micropolis_state *)downcast<micropolis_device *>(device)->token(); } @@ -396,4 +396,40 @@ DEVICE_GET_INFO(micropolis) } } -DEFINE_LEGACY_DEVICE(MICROPOLIS, micropolis); +const device_type MICROPOLIS = &device_creator<micropolis_device>; + +micropolis_device::micropolis_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MICROPOLIS, "MICROPOLIS", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(micropolis_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void micropolis_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void micropolis_device::device_start() +{ + DEVICE_START_NAME( micropolis )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void micropolis_device::device_reset() +{ + DEVICE_RESET_NAME( micropolis )(this); +} + + diff --git a/src/mess/machine/micropolis.h b/src/mess/machine/micropolis.h index d9b7c4bc1cd..90ddf72fd11 100644 --- a/src/mess/machine/micropolis.h +++ b/src/mess/machine/micropolis.h @@ -17,7 +17,26 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(MICROPOLIS, micropolis); +class micropolis_device : public device_t +{ +public: + micropolis_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~micropolis_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MICROPOLIS; + diff --git a/src/mess/machine/mm58274c.c b/src/mess/machine/mm58274c.c index d7898544424..7298d95c62e 100644 --- a/src/mess/machine/mm58274c.c +++ b/src/mess/machine/mm58274c.c @@ -78,7 +78,7 @@ INLINE mm58274c_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == MM58274C); - return (mm58274c_t *)downcast<legacy_device_base *>(device)->token(); + return (mm58274c_t *)downcast<mm58274c_device *>(device)->token(); } static attotime interrupt_period_table(int val) @@ -538,4 +538,40 @@ DEVICE_GET_INFO( mm58274c ) } } -DEFINE_LEGACY_DEVICE(MM58274C, mm58274c); +const device_type MM58274C = &device_creator<mm58274c_device>; + +mm58274c_device::mm58274c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MM58274C, "National Semiconductor MM58274C", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mm58274c_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mm58274c_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mm58274c_device::device_start() +{ + DEVICE_START_NAME( mm58274c )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mm58274c_device::device_reset() +{ + DEVICE_RESET_NAME( mm58274c )(this); +} + + diff --git a/src/mess/machine/mm58274c.h b/src/mess/machine/mm58274c.h index c17e1eb1332..12dcb83fec1 100644 --- a/src/mess/machine/mm58274c.h +++ b/src/mess/machine/mm58274c.h @@ -5,7 +5,26 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(MM58274C, mm58274c); +class mm58274c_device : public device_t +{ +public: + mm58274c_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mm58274c_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MM58274C; + /*************************************************************************** FUNCTION PROTOTYPES diff --git a/src/mess/machine/mos6530.c b/src/mess/machine/mos6530.c index 771f4f9b0e0..a36dcf3830c 100644 --- a/src/mess/machine/mos6530.c +++ b/src/mess/machine/mos6530.c @@ -82,7 +82,7 @@ INLINE mos6530_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == MOS6530); - return (mos6530_state *)downcast<legacy_device_base *>(device)->token(); + return (mos6530_state *)downcast<mos6530_device *>(device)->token(); } @@ -455,4 +455,40 @@ DEVICE_GET_INFO( mos6530 ) } } -DEFINE_LEGACY_DEVICE(MOS6530, mos6530); +const device_type MOS6530 = &device_creator<mos6530_device>; + +mos6530_device::mos6530_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MOS6530, "MOS6530", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(mos6530_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void mos6530_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mos6530_device::device_start() +{ + DEVICE_START_NAME( mos6530 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mos6530_device::device_reset() +{ + DEVICE_RESET_NAME( mos6530 )(this); +} + + diff --git a/src/mess/machine/mos6530.h b/src/mess/machine/mos6530.h index 3c34917d950..653c1be9c01 100644 --- a/src/mess/machine/mos6530.h +++ b/src/mess/machine/mos6530.h @@ -37,7 +37,26 @@ MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(MOS6530, mos6530); +class mos6530_device : public device_t +{ +public: + mos6530_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~mos6530_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type MOS6530; + #define MCFG_MOS6530_ADD(_tag, _clock, _config) \ MCFG_DEVICE_ADD((_tag), MOS6530, _clock) \ diff --git a/src/mess/machine/omti8621.c b/src/mess/machine/omti8621.c index d262b0e90ed..e6227e61c0b 100644 --- a/src/mess/machine/omti8621.c +++ b/src/mess/machine/omti8621.c @@ -199,7 +199,7 @@ struct _omti8621_state { INLINE omti8621_state *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == OMTI8621); - return (omti8621_state *) downcast<legacy_device_base *>(device)->token(); + return (omti8621_state *) downcast<omti8621_device *>(device)->token(); } /*************************************************************************** @@ -1359,4 +1359,40 @@ DEVICE_GET_INFO( omti8621 ) } } -DEFINE_LEGACY_DEVICE(OMTI8621, omti8621); +const device_type OMTI8621 = &device_creator<omti8621_device>; + +omti8621_device::omti8621_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, OMTI8621, "OMTI 8621", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(omti8621_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void omti8621_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void omti8621_device::device_start() +{ + DEVICE_START_NAME( omti8621 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void omti8621_device::device_reset() +{ + DEVICE_RESET_NAME( omti8621 )(this); +} + + diff --git a/src/mess/machine/omti8621.h b/src/mess/machine/omti8621.h index 7d85a8c2cb8..aa1cc3c7602 100644 --- a/src/mess/machine/omti8621.h +++ b/src/mess/machine/omti8621.h @@ -50,7 +50,26 @@ UINT32 omti8621_get_sector(device_t *device, INT32 diskaddr, UINT8 *data_buffer, /* ----- device interface ----- */ -DECLARE_LEGACY_DEVICE(OMTI8621, omti8621); +class omti8621_device : public device_t +{ +public: + omti8621_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~omti8621_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type OMTI8621; + MACHINE_CONFIG_EXTERN( omti_disk ); //###############################################################NEWNEW diff --git a/src/mess/machine/pc_lpt.c b/src/mess/machine/pc_lpt.c index 97d56041526..7bf4be57c4f 100644 --- a/src/mess/machine/pc_lpt.c +++ b/src/mess/machine/pc_lpt.c @@ -72,7 +72,7 @@ INLINE pc_lpt_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == PC_LPT); - return (pc_lpt_state *)downcast<legacy_device_base *>(device)->token(); + return (pc_lpt_state *)downcast<pc_lpt_device *>(device)->token(); } @@ -252,7 +252,53 @@ WRITE8_DEVICE_HANDLER( pc_lpt_w ) } } -DEFINE_LEGACY_DEVICE(PC_LPT, pc_lpt); +const device_type PC_LPT = &device_creator<pc_lpt_device>; + +pc_lpt_device::pc_lpt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PC_LPT, "PC-LPT", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pc_lpt_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pc_lpt_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc_lpt_device::device_start() +{ + DEVICE_START_NAME( pc_lpt )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc_lpt_device::device_reset() +{ + DEVICE_RESET_NAME( pc_lpt )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor pc_lpt_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pc_lpt ); +} + + static WRITE_LINE_DEVICE_HANDLER(pc_cpu_line) { diff --git a/src/mess/machine/pc_lpt.h b/src/mess/machine/pc_lpt.h index d04c027d8d1..3c623f78294 100644 --- a/src/mess/machine/pc_lpt.h +++ b/src/mess/machine/pc_lpt.h @@ -39,7 +39,27 @@ WRITE8_DEVICE_HANDLER( pc_lpt_control_w ); DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(PC_LPT, pc_lpt); +class pc_lpt_device : public device_t +{ +public: + pc_lpt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~pc_lpt_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type PC_LPT; + #define MCFG_PC_LPT_ADD(_tag, _intf) \ MCFG_DEVICE_ADD(_tag, PC_LPT, 0) \ diff --git a/src/mess/machine/pcf8593.c b/src/mess/machine/pcf8593.c index 388757561b0..b68d89ac7a0 100644 --- a/src/mess/machine/pcf8593.c +++ b/src/mess/machine/pcf8593.c @@ -72,7 +72,7 @@ INLINE pcf8593_t *get_token(device_t *device) assert(device != NULL); assert(device->type() == PCF8593); - return (pcf8593_t *) downcast<legacy_device_base *>(device)->token(); + return (pcf8593_t *) downcast<pcf8593_device *>(device)->token(); } @@ -470,4 +470,40 @@ DEVICE_GET_INFO( pcf8593 ) } } -DEFINE_LEGACY_DEVICE(PCF8593, pcf8593); +const device_type PCF8593 = &device_creator<pcf8593_device>; + +pcf8593_device::pcf8593_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PCF8593, "PCF8593 RTC", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pcf8593_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pcf8593_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pcf8593_device::device_start() +{ + DEVICE_START_NAME( pcf8593 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pcf8593_device::device_reset() +{ + DEVICE_RESET_NAME( pcf8593 )(this); +} + + diff --git a/src/mess/machine/pcf8593.h b/src/mess/machine/pcf8593.h index 23be2198bb4..e2fc8fc6206 100644 --- a/src/mess/machine/pcf8593.h +++ b/src/mess/machine/pcf8593.h @@ -16,7 +16,26 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(PCF8593, pcf8593); +class pcf8593_device : public device_t +{ +public: + pcf8593_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~pcf8593_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type PCF8593; + #define MCFG_PCF8593_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, PCF8593, 0) \ diff --git a/src/mess/machine/pf10.c b/src/mess/machine/pf10.c index 646185b14db..15f5c71260c 100644 --- a/src/mess/machine/pf10.c +++ b/src/mess/machine/pf10.c @@ -34,7 +34,7 @@ INLINE pf10_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == PF10); - return (pf10_state *)downcast<legacy_device_base *>(device)->token(); + return (pf10_state *)downcast<pf10_device *>(device)->token(); } @@ -158,4 +158,60 @@ WRITE_LINE_DEVICE_HANDLER( pf10_rxd2_w ) logerror("%s: pf10_rxd2_w %u\n", device->machine().describe_context(), state); } -DEFINE_LEGACY_DEVICE(PF10, pf10); +const device_type PF10 = &device_creator<pf10_device>; + +pf10_device::pf10_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PF10, "PF-10", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(pf10_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pf10_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pf10_device::device_start() +{ + DEVICE_START_NAME( pf10 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pf10_device::device_reset() +{ + DEVICE_RESET_NAME( pf10 )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor pf10_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pf10 ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *pf10_device::device_rom_region() const +{ + return ROM_NAME(pf10 ); +} + + diff --git a/src/mess/machine/pf10.h b/src/mess/machine/pf10.h index 5f901bce042..8e9b532dd5d 100644 --- a/src/mess/machine/pf10.h +++ b/src/mess/machine/pf10.h @@ -40,7 +40,28 @@ WRITE_LINE_DEVICE_HANDLER( pf10_rxd2_w ); DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(PF10, pf10); +class pf10_device : public device_t +{ +public: + pf10_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~pf10_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type PF10; + #define MCFG_PF10_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, PF10, 0) \ diff --git a/src/mess/machine/s3c44b0.c b/src/mess/machine/s3c44b0.c index 0650458645f..c49449f0ad6 100644 --- a/src/mess/machine/s3c44b0.c +++ b/src/mess/machine/s3c44b0.c @@ -56,7 +56,7 @@ static void s3c44b0_bdma_request_iis( device_t *device); INLINE s3c44b0_t *get_token( device_t *device) { assert(device != NULL); - return (s3c44b0_t *)downcast<legacy_device_base *>(device)->token(); + return (s3c44b0_t *)downcast<s3c44b0_device *>(device)->token(); } /*************************************************************************** @@ -2054,4 +2054,40 @@ DEVICE_GET_INFO( s3c44b0 ) } } -DEFINE_LEGACY_DEVICE(S3C44B0, s3c44b0); +const device_type S3C44B0 = &device_creator<s3c44b0_device>; + +s3c44b0_device::s3c44b0_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, S3C44B0, "Samsung S3C44B0", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(s3c44b0_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void s3c44b0_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void s3c44b0_device::device_start() +{ + DEVICE_START_NAME( s3c44b0 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void s3c44b0_device::device_reset() +{ + DEVICE_RESET_NAME( s3c44b0 )(this); +} + + diff --git a/src/mess/machine/s3c44b0.h b/src/mess/machine/s3c44b0.h index a60afd7fd13..0a89ff79e4a 100644 --- a/src/mess/machine/s3c44b0.h +++ b/src/mess/machine/s3c44b0.h @@ -35,7 +35,26 @@ enum S3C44B0_GPIO_PORT_G }; -DECLARE_LEGACY_DEVICE(S3C44B0, s3c44b0); +class s3c44b0_device : public device_t +{ +public: + s3c44b0_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~s3c44b0_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type S3C44B0; + /******************************************************************************* TYPE DEFINITIONS diff --git a/src/mess/machine/sst39vfx.c b/src/mess/machine/sst39vfx.c index 87317210772..34a801c96f2 100644 --- a/src/mess/machine/sst39vfx.c +++ b/src/mess/machine/sst39vfx.c @@ -41,7 +41,7 @@ INLINE sst39vfx_t *get_token(device_t *device) assert(device != NULL); assert(device->type() == SST39VF020 || device->type() == SST39VF400A); - return (sst39vfx_t *) downcast<legacy_device_base *>(device)->token(); + return (sst39vfx_t *) downcast<sst39vf020_device *>(device)->token(); } INLINE const sst39vfx_config *get_config(device_t *device) @@ -218,5 +218,53 @@ DEVICE_GET_INFO( sst39vf400a ) } } -DEFINE_LEGACY_DEVICE(SST39VF020, sst39vf020); -DEFINE_LEGACY_DEVICE(SST39VF400A, sst39vf400a); +const device_type SST39VF020 = &device_creator<sst39vf020_device>; + +sst39vf020_device::sst39vf020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SST39VF020, "SST39VF020", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(sst39vfx_t)); +} +sst39vf020_device::sst39vf020_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(sst39vfx_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void sst39vf020_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sst39vf020_device::device_start() +{ + DEVICE_START_NAME( sst39vf020 )(this); +} + + +const device_type SST39VF400A = &device_creator<sst39vf400a_device>; + +sst39vf400a_device::sst39vf400a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : sst39vf020_device(mconfig, SST39VF400A, "SST39VF400A", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sst39vf400a_device::device_start() +{ + DEVICE_START_NAME( sst39vf400a )(this); +} + + diff --git a/src/mess/machine/sst39vfx.h b/src/mess/machine/sst39vfx.h index c4e9d10ecbe..59fdf3ed75b 100644 --- a/src/mess/machine/sst39vfx.h +++ b/src/mess/machine/sst39vfx.h @@ -29,7 +29,26 @@ struct _sst39vfx_config MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(SST39VF020, sst39vf020); +class sst39vf020_device : public device_t +{ +public: + sst39vf020_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + sst39vf020_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~sst39vf020_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type SST39VF020; + #define MCFG_SST39VF020_ADD(_tag, _config) \ MCFG_DEVICE_ADD(_tag, SST39VF020, 0) \ @@ -38,7 +57,17 @@ DECLARE_LEGACY_DEVICE(SST39VF020, sst39vf020); #define MCFG_SST39VF020_REMOVE(_tag) \ MCFG_DEVICE_REMOVE(_tag) -DECLARE_LEGACY_DEVICE(SST39VF400A, sst39vf400a); +class sst39vf400a_device : public sst39vf020_device +{ +public: + sst39vf400a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type SST39VF400A; + #define MCFG_SST39VF400A_ADD(_tag,_config) \ MCFG_DEVICE_ADD(_tag, SST39VF400A, 0) \ diff --git a/src/mess/machine/strata.c b/src/mess/machine/strata.c index ad458d9d473..64c46e8f976 100644 --- a/src/mess/machine/strata.c +++ b/src/mess/machine/strata.c @@ -74,7 +74,7 @@ INLINE strata_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == STRATAFLASH); - return (strata_t *)downcast<legacy_device_base *>(device)->token(); + return (strata_t *)downcast<strataflash_device *>(device)->token(); } static DEVICE_START( strataflash ) @@ -118,7 +118,34 @@ DEVICE_GET_INFO( strataflash ) } } -DEFINE_LEGACY_DEVICE(STRATAFLASH, strataflash); +const device_type STRATAFLASH = &device_creator<strataflash_device>; + +strataflash_device::strataflash_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, STRATAFLASH, "Intel 28F640J5", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(strata_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void strataflash_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void strataflash_device::device_start() +{ + DEVICE_START_NAME( strataflash )(this); +} + + /* load the FEEPROM contents from file diff --git a/src/mess/machine/strata.h b/src/mess/machine/strata.h index b4ada71c80c..f5a2534f369 100644 --- a/src/mess/machine/strata.h +++ b/src/mess/machine/strata.h @@ -2,7 +2,25 @@ strata.h: header file for strata.c */ -DECLARE_LEGACY_DEVICE(STRATAFLASH, strataflash); +class strataflash_device : public device_t +{ +public: + strataflash_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~strataflash_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type STRATAFLASH; + #define MCFG_STRATAFLASH_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, STRATAFLASH, 0) diff --git a/src/mess/machine/tf20.c b/src/mess/machine/tf20.c index bbaa7f04f1a..bec571fbbb9 100644 --- a/src/mess/machine/tf20.c +++ b/src/mess/machine/tf20.c @@ -50,7 +50,7 @@ INLINE tf20_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == TF20); - return (tf20_state *)downcast<legacy_device_base *>(device)->token(); + return (tf20_state *)downcast<tf20_device *>(device)->token(); } @@ -384,4 +384,61 @@ DEVICE_GET_INFO( tf20 ) } } -DEFINE_LEGACY_DEVICE(TF20, tf20); +const device_type TF20 = &device_creator<tf20_device>; + +tf20_device::tf20_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, TF20, "TF-20", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(tf20_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void tf20_device::device_config_complete() +{ + m_shortname = "tf20"; +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tf20_device::device_start() +{ + DEVICE_START_NAME( tf20 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tf20_device::device_reset() +{ + DEVICE_RESET_NAME( tf20 )(this); +} + +//------------------------------------------------- +// device_mconfig_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor tf20_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( tf20 ); +} + +//------------------------------------------------- +// device_rom_region - return a pointer to the +// the device's ROM definitions +//------------------------------------------------- + +const rom_entry *tf20_device::device_rom_region() const +{ + return ROM_NAME(tf20 ); +} + + diff --git a/src/mess/machine/tf20.h b/src/mess/machine/tf20.h index f083e848a84..f31e0058b49 100644 --- a/src/mess/machine/tf20.h +++ b/src/mess/machine/tf20.h @@ -49,7 +49,28 @@ INPUT_PORTS_EXTERN( tf20 ); DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(TF20, tf20); +class tf20_device : public device_t +{ +public: + tf20_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~tf20_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; +private: + // internal state + void *m_token; +}; + +extern const device_type TF20; + #define MCFG_TF20_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, TF20, 0) \ diff --git a/src/mess/machine/upd7002.c b/src/mess/machine/upd7002.c index 77c93f8de5c..07cb4d4268e 100644 --- a/src/mess/machine/upd7002.c +++ b/src/mess/machine/upd7002.c @@ -60,7 +60,7 @@ INLINE uPD7002_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == UPD7002); - return (uPD7002_t *)downcast<legacy_device_base *>(device)->token(); + return (uPD7002_t *)downcast<uPD7002_device *>(device)->token(); } READ8_DEVICE_HANDLER ( uPD7002_EOC_r ) @@ -230,4 +230,40 @@ DEVICE_GET_INFO( uPD7002 ) } } -DEFINE_LEGACY_DEVICE(UPD7002, uPD7002); +const device_type UPD7002 = &device_creator<uPD7002_device>; + +uPD7002_device::uPD7002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD7002, "uPD7002", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(uPD7002_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void uPD7002_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void uPD7002_device::device_start() +{ + DEVICE_START_NAME( uPD7002 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void uPD7002_device::device_reset() +{ + DEVICE_RESET_NAME( uPD7002 )(this); +} + + diff --git a/src/mess/machine/upd7002.h b/src/mess/machine/upd7002.h index 615b2cbf485..82b7cc1eacb 100644 --- a/src/mess/machine/upd7002.h +++ b/src/mess/machine/upd7002.h @@ -15,7 +15,26 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(UPD7002, uPD7002); +class uPD7002_device : public device_t +{ +public: + uPD7002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~uPD7002_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type UPD7002; + /*************************************************************************** TYPE DEFINITIONS diff --git a/src/mess/machine/upd71071.c b/src/mess/machine/upd71071.c index e5a3b1ccab0..637e26a0814 100644 --- a/src/mess/machine/upd71071.c +++ b/src/mess/machine/upd71071.c @@ -116,7 +116,7 @@ INLINE upd71071_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == UPD71071); - return (upd71071_t*)downcast<legacy_device_base *>(device)->token(); + return (upd71071_t*)downcast<upd71071_device *>(device)->token(); } static TIMER_CALLBACK(dma_transfer_timer) @@ -441,4 +441,31 @@ DEVICE_GET_INFO(upd71071) READ8_DEVICE_HANDLER(upd71071_r) { return upd71071_read(device,offset); } WRITE8_DEVICE_HANDLER(upd71071_w) { upd71071_write(device,offset,data); } -DEFINE_LEGACY_DEVICE(UPD71071, upd71071); +const device_type UPD71071 = &device_creator<upd71071_device>; + +upd71071_device::upd71071_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD71071, "NEC uPD71071", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(upd71071_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void upd71071_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd71071_device::device_start() +{ + DEVICE_START_NAME( upd71071 )(this); +} + + diff --git a/src/mess/machine/upd71071.h b/src/mess/machine/upd71071.h index a5b644a557f..fad69044281 100644 --- a/src/mess/machine/upd71071.h +++ b/src/mess/machine/upd71071.h @@ -14,7 +14,25 @@ struct _upd71071_interface int upd71071_dmarq(device_t* device,int state,int channel); -DECLARE_LEGACY_DEVICE(UPD71071, upd71071); +class upd71071_device : public device_t +{ +public: + upd71071_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~upd71071_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type UPD71071; + #define MCFG_UPD71071_ADD(_tag, _config) \ MCFG_DEVICE_ADD(_tag, UPD71071, 0) \ diff --git a/src/mess/machine/upd765.c b/src/mess/machine/upd765.c index 48825ba27e8..3d5ad35cc45 100644 --- a/src/mess/machine/upd765.c +++ b/src/mess/machine/upd765.c @@ -171,7 +171,7 @@ INLINE upd765_t *get_safe_token(device_t *device) assert(device->type() == UPD765A || device->type() == UPD765B || device->type() == SMC37C78 || device->type() == UPD72065); - return (upd765_t *)downcast<legacy_device_base *>(device)->token(); + return (upd765_t *)downcast<upd765a_device *>(device)->token(); } static device_t *current_image(device_t *device) @@ -2540,7 +2540,96 @@ DEVICE_GET_INFO( upd72065 ) } } -DEFINE_LEGACY_DEVICE(UPD765A, upd765a); -DEFINE_LEGACY_DEVICE(UPD765B, upd765b); -DEFINE_LEGACY_DEVICE(SMC37C78, smc37c78); -DEFINE_LEGACY_DEVICE(UPD72065, upd72065); +const device_type UPD765A = &device_creator<upd765a_device>; + +upd765a_device::upd765a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD765A, "UPD765A", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(upd765_t)); +} +upd765a_device::upd765a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(upd765_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void upd765a_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd765a_device::device_start() +{ + DEVICE_START_NAME( upd765a )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void upd765a_device::device_reset() +{ + DEVICE_RESET_NAME( upd765 )(this); +} + + +const device_type UPD765B = &device_creator<upd765b_device>; + +upd765b_device::upd765b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : upd765a_device(mconfig, UPD765B, "UPD765B", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd765b_device::device_start() +{ + DEVICE_START_NAME( upd765b )(this); +} + + +const device_type SMC37C78 = &device_creator<smc37c78_device>; + +smc37c78_device::smc37c78_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : upd765a_device(mconfig, SMC37C78, "SMC37C78", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void smc37c78_device::device_start() +{ + DEVICE_START_NAME( smc37c78 )(this); +} + + +const device_type UPD72065 = &device_creator<upd72065_device>; + +upd72065_device::upd72065_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : upd765a_device(mconfig, UPD72065, "UPD72065", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd72065_device::device_start() +{ + DEVICE_START_NAME( upd72065 )(this); +} + + diff --git a/src/mess/machine/upd765.h b/src/mess/machine/upd765.h index 3b15fae150e..d9de40de007 100644 --- a/src/mess/machine/upd765.h +++ b/src/mess/machine/upd765.h @@ -18,10 +18,60 @@ MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(UPD765A, upd765a); -DECLARE_LEGACY_DEVICE(UPD765B, upd765b); -DECLARE_LEGACY_DEVICE(SMC37C78, smc37c78); -DECLARE_LEGACY_DEVICE(UPD72065, upd72065); +class upd765a_device : public device_t +{ +public: + upd765a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + upd765a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~upd765a_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type UPD765A; + +class upd765b_device : public upd765a_device +{ +public: + upd765b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type UPD765B; + +class smc37c78_device : public upd765a_device +{ +public: + smc37c78_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type SMC37C78; + +class upd72065_device : public upd765a_device +{ +public: + upd72065_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type UPD72065; + /*************************************************************************** TYPE DEFINITIONS diff --git a/src/mess/video/733_asr.c b/src/mess/video/733_asr.c index dbc66b14da8..0a5740bb0ba 100644 --- a/src/mess/video/733_asr.c +++ b/src/mess/video/733_asr.c @@ -167,7 +167,7 @@ INLINE asr_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == ASR733); - return (asr_t *)downcast<legacy_device_base *>(device)->token(); + return (asr_t *)downcast<asr733_device *>(device)->token(); } static DEVICE_START( asr733 ) @@ -236,7 +236,43 @@ DEVICE_GET_INFO( asr733 ) } } -DEFINE_LEGACY_DEVICE(ASR733, asr733); +const device_type ASR733 = &device_creator<asr733_device>; + +asr733_device::asr733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ASR733, "733 ASR", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(asr_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void asr733_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void asr733_device::device_start() +{ + DEVICE_START_NAME( asr733 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void asr733_device::device_reset() +{ + DEVICE_RESET_NAME( asr733 )(this); +} + + /* write a single char on screen */ static void asr_draw_char(device_t *device, int character, int x, int y, int color) diff --git a/src/mess/video/733_asr.h b/src/mess/video/733_asr.h index 643cdca3a05..0a349102d80 100644 --- a/src/mess/video/733_asr.h +++ b/src/mess/video/733_asr.h @@ -19,7 +19,26 @@ GFXDECODE_EXTERN( asr733 ); PALETTE_INIT( asr733 ); void asr733_init(running_machine &machine); -DECLARE_LEGACY_DEVICE(ASR733, asr733); +class asr733_device : public device_t +{ +public: + asr733_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~asr733_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type ASR733; + #define MCFG_ASR733_VIDEO_ADD(_tag, _intf) \ MCFG_DEVICE_ADD(_tag, ASR733, 0) \ diff --git a/src/mess/video/911_vdt.c b/src/mess/video/911_vdt.c index 409f785424d..32bf93eaf06 100644 --- a/src/mess/video/911_vdt.c +++ b/src/mess/video/911_vdt.c @@ -239,7 +239,7 @@ INLINE vdt_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == VDT911); - return (vdt_t *)downcast<legacy_device_base *>(device)->token(); + return (vdt_t *)downcast<vdt911_device *>(device)->token(); } /* @@ -287,7 +287,34 @@ DEVICE_GET_INFO( vdt911 ) } } -DEFINE_LEGACY_DEVICE(VDT911, vdt911); +const device_type VDT911 = &device_creator<vdt911_device>; + +vdt911_device::vdt911_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VDT911, "911 VDT", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(vdt_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vdt911_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vdt911_device::device_start() +{ + DEVICE_START_NAME( vdt911 )(this); +} + + /* timer callback to toggle blink state diff --git a/src/mess/video/911_vdt.h b/src/mess/video/911_vdt.h index 781565fad0e..91230cb5693 100644 --- a/src/mess/video/911_vdt.h +++ b/src/mess/video/911_vdt.h @@ -43,7 +43,25 @@ typedef struct vdt911_init_params_t PALETTE_INIT( vdt911 ); void vdt911_init(running_machine &machine); -DECLARE_LEGACY_DEVICE(VDT911, vdt911); +class vdt911_device : public device_t +{ +public: + vdt911_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vdt911_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type VDT911; + #define MCFG_VDT911_VIDEO_ADD(_tag, _intf) \ MCFG_DEVICE_ADD(_tag, VDT911, 0) \ diff --git a/src/mess/video/apollo.c b/src/mess/video/apollo.c index 65757433011..a43c82fde56 100644 --- a/src/mess/video/apollo.c +++ b/src/mess/video/apollo.c @@ -113,7 +113,7 @@ struct _screen_data { INLINE screen_data_t *get_safe_token(device_t *device) { assert(device != NULL); assert(device->type() == APOLLO_MONO15I || device->type() == APOLLO_MONO19I ); - return (screen_data_t *)downcast<legacy_device_base *>(device)->token(); + return (screen_data_t *)downcast<apollo_mono15i_device *>(device)->token(); } /*************************************************************************** @@ -876,5 +876,81 @@ DEVICE_GET_INFO( apollo_mono15i ) { } } -DEFINE_LEGACY_DEVICE(APOLLO_MONO19I, apollo_mono19i); -DEFINE_LEGACY_DEVICE(APOLLO_MONO15I, apollo_mono15i); +apollo_mono_device::apollo_mono_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(screen_data_t)); +} + +const device_type APOLLO_MONO19I = &device_creator<apollo_mono19i_device>; + +apollo_mono19i_device::apollo_mono19i_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : apollo_mono_device(mconfig, APOLLO_MONO19I, "Apollo 19\" Monochrome Screen", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void apollo_mono19i_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apollo_mono19i_device::device_start() +{ + DEVICE_START_NAME( apollo_mono19i )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apollo_mono19i_device::device_reset() +{ + DEVICE_RESET_NAME( apollo_mono19i )(this); +} + + +const device_type APOLLO_MONO15I = &device_creator<apollo_mono15i_device>; + +apollo_mono15i_device::apollo_mono15i_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : apollo_mono_device(mconfig, APOLLO_MONO15I, "Apollo 15\" Monochrome Screen", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void apollo_mono15i_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apollo_mono15i_device::device_start() +{ + DEVICE_START_NAME( apollo_mono15i )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void apollo_mono15i_device::device_reset() +{ + DEVICE_RESET_NAME( apollo_mono15i )(this); +} + + diff --git a/src/mess/video/crt.c b/src/mess/video/crt.c index 2618d0d1ed0..22d7aac6403 100644 --- a/src/mess/video/crt.c +++ b/src/mess/video/crt.c @@ -64,7 +64,7 @@ INLINE crt_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == CRT); - return (crt_t *)downcast<legacy_device_base *>(device)->token(); + return (crt_t *)downcast<crt_device *>(device)->token(); } static DEVICE_START( crt ) @@ -118,7 +118,34 @@ DEVICE_GET_INFO( crt ) } } -DEFINE_LEGACY_DEVICE(CRT, crt); +const device_type CRT = &device_creator<crt_device>; + +crt_device::crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, CRT, "CRT Video", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(crt_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void crt_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void crt_device::device_start() +{ + DEVICE_START_NAME( crt )(this); +} + + /* crt_plot diff --git a/src/mess/video/crt.h b/src/mess/video/crt.h index fab211c9865..4131b48eb95 100644 --- a/src/mess/video/crt.h +++ b/src/mess/video/crt.h @@ -24,7 +24,25 @@ void crt_plot(device_t *device, int x, int y); void crt_eof(device_t *device); void crt_update(device_t *device, bitmap_ind16 &bitmap); -DECLARE_LEGACY_DEVICE(CRT, crt); +class crt_device : public device_t +{ +public: + crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~crt_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type CRT; + #define MCFG_CRT_ADD(_tag, _interface) \ MCFG_DEVICE_ADD(_tag, CRT, 0) \ diff --git a/src/mess/video/dl1416.c b/src/mess/video/dl1416.c index 43f9538dd42..ef086263165 100644 --- a/src/mess/video/dl1416.c +++ b/src/mess/video/dl1416.c @@ -116,7 +116,7 @@ INLINE dl1416_state *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == DL1416B || device->type() == DL1416T); - return (dl1416_state *)downcast<legacy_device_base *>(device)->token(); + return (dl1416_state *)downcast<dl1416_device *>(device)->token(); } @@ -335,5 +335,54 @@ WRITE8_DEVICE_HANDLER( dl1416_data_w ) } } -DEFINE_LEGACY_DEVICE(DL1416B, dl1416b); -DEFINE_LEGACY_DEVICE(DL1416T, dl1416t); +dl1416_device::dl1416_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(dl1416_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void dl1416_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dl1416_device::device_start() +{ + DEVICE_START_NAME( dl1416 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dl1416_device::device_reset() +{ + DEVICE_RESET_NAME( dl1416 )(this); +} + + +const device_type DL1416B = &device_creator<dl1416b_device>; + +dl1416b_device::dl1416b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : dl1416_device(mconfig, DL1416B, "DL1416B", tag, owner, clock) +{ +} + + +const device_type DL1416T = &device_creator<dl1416t_device>; + +dl1416t_device::dl1416t_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : dl1416_device(mconfig, DL1416T, "DL1416T", tag, owner, clock) +{ +} + + diff --git a/src/mess/video/dl1416.h b/src/mess/video/dl1416.h index 85169cba8aa..a0fd4766bc7 100644 --- a/src/mess/video/dl1416.h +++ b/src/mess/video/dl1416.h @@ -53,7 +53,39 @@ WRITE_LINE_DEVICE_HANDLER( dl1416_cu_w ); /* cursor enable */ WRITE8_DEVICE_HANDLER( dl1416_data_w ); /* device get info callback */ -DECLARE_LEGACY_DEVICE(DL1416B, dl1416b); -DECLARE_LEGACY_DEVICE(DL1416T, dl1416t); +class dl1416_device : public device_t +{ +public: + dl1416_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~dl1416_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +class dl1416b_device : public dl1416_device +{ +public: + dl1416b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type DL1416B; + +class dl1416t_device : public dl1416_device +{ +public: + dl1416t_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + +extern const device_type DL1416T; + #endif /* DL1416_H_ */ diff --git a/src/mess/video/k1ge.c b/src/mess/video/k1ge.c index eacdfec879c..0ac86acf7c0 100644 --- a/src/mess/video/k1ge.c +++ b/src/mess/video/k1ge.c @@ -63,7 +63,7 @@ INLINE k1ge_t *get_safe_token( device_t *device ) assert( device != NULL ); assert( device->type() == K1GE || device->type() == K2GE ); - return ( k1ge_t *) downcast<legacy_device_base *>(device)->token(); + return ( k1ge_t *) downcast<k1ge_device *>(device)->token(); } @@ -923,5 +923,63 @@ DEVICE_GET_INFO( k2ge ) } } -DEFINE_LEGACY_DEVICE(K1GE, k1ge); -DEFINE_LEGACY_DEVICE(K2GE, k2ge); +const device_type K1GE = &device_creator<k1ge_device>; + +k1ge_device::k1ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, K1GE, "", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof( k1ge_t )); +} + +k1ge_device::k1ge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof( k1ge_t )); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void k1ge_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k1ge_device::device_start() +{ + DEVICE_START_NAME( k1ge )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void k1ge_device::device_reset() +{ + DEVICE_RESET_NAME( k1ge )(this); +} + + +const device_type K2GE = &device_creator<k2ge_device>; + +k2ge_device::k2ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : k1ge_device(mconfig, K2GE, "", tag, owner, clock) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void k2ge_device::device_start() +{ + DEVICE_START_NAME( k2ge )(this); +} + + diff --git a/src/mess/video/k1ge.h b/src/mess/video/k1ge.h index 26446f6f0cf..60e4ea0833d 100644 --- a/src/mess/video/k1ge.h +++ b/src/mess/video/k1ge.h @@ -8,8 +8,38 @@ #define K1GE_SCREEN_HEIGHT 199 -DECLARE_LEGACY_DEVICE(K1GE, k1ge); -DECLARE_LEGACY_DEVICE(K2GE, k2ge); +class k1ge_device : public device_t +{ +public: + k1ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + k1ge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + ~k1ge_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type K1GE; + +class k2ge_device : public k1ge_device +{ +public: + k2ge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +protected: + // device-level overrides + virtual void device_start(); +}; + +extern const device_type K2GE; + #define MCFG_K1GE_ADD(_tag, _clock, _config ) \ diff --git a/src/mess/video/odyssey2.c b/src/mess/video/odyssey2.c index f166ac37b60..6ca1b97b1df 100644 --- a/src/mess/video/odyssey2.c +++ b/src/mess/video/odyssey2.c @@ -824,4 +824,41 @@ UINT8 odyssey2_ef9341_r( running_machine &machine, int command, int b ) } #endif -DEFINE_LEGACY_SOUND_DEVICE(ODYSSEY2, odyssey2_sound); +const device_type ODYSSEY2 = &device_creator<odyssey2_sound_device>; + +odyssey2_sound_device::odyssey2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, ODYSSEY2, "P8244/P8245", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void odyssey2_sound_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void odyssey2_sound_device::device_start() +{ + DEVICE_START_NAME( odyssey2_sound )(this); +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void odyssey2_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} + + diff --git a/src/mess/video/saa505x.c b/src/mess/video/saa505x.c index d6004436ab2..d19de1e7d87 100644 --- a/src/mess/video/saa505x.c +++ b/src/mess/video/saa505x.c @@ -3394,7 +3394,7 @@ INLINE teletext_t *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == SAA505X); - return (teletext_t *)downcast<legacy_device_base *>(device)->token(); + return (teletext_t *)downcast<saa505x_device *>(device)->token(); } static DEVICE_START( saa505x ) @@ -3425,7 +3425,34 @@ DEVICE_GET_INFO( saa505x ) } } -DEFINE_LEGACY_DEVICE(SAA505X, saa505x); +const device_type SAA505X = &device_creator<saa505x_device>; + +saa505x_device::saa505x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SAA505X, "SAA505x Video", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(teletext_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void saa505x_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void saa505x_device::device_start() +{ + DEVICE_START_NAME( saa505x )(this); +} + + void teletext_data_w(device_t *device, int offset, int data) { diff --git a/src/mess/video/saa505x.h b/src/mess/video/saa505x.h index 7597cbf28ad..d7fc9610687 100644 --- a/src/mess/video/saa505x.h +++ b/src/mess/video/saa505x.h @@ -20,7 +20,25 @@ void teletext_LOSE_w(device_t *device, int offset, int data); void teletext_data_w(device_t *device, int offset, int data); void teletext_F1(device_t *device); -DECLARE_LEGACY_DEVICE(SAA505X, saa505x); +class saa505x_device : public device_t +{ +public: + saa505x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~saa505x_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +private: + // internal state + void *m_token; +}; + +extern const device_type SAA505X; + #define MCFG_SAA505X_VIDEO_ADD(_tag, _intf) \ MCFG_DEVICE_ADD(_tag, SAA505X, 0) \ diff --git a/src/mess/video/vdc8563.c b/src/mess/video/vdc8563.c index e9e6cce35c4..653153f37b5 100644 --- a/src/mess/video/vdc8563.c +++ b/src/mess/video/vdc8563.c @@ -162,7 +162,7 @@ INLINE vdc8563_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == VDC8563); - return (vdc8563_state *)downcast<legacy_device_base *>(device)->token(); + return (vdc8563_state *)downcast<vdc8563_device *>(device)->token(); } INLINE const vdc8563_interface *get_interface( device_t *device ) @@ -676,4 +676,40 @@ DEVICE_GET_INFO(vdc8563) } } -DEFINE_LEGACY_DEVICE(VDC8563, vdc8563); +const device_type VDC8563 = &device_creator<vdc8563_device>; + +vdc8563_device::vdc8563_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VDC8563, "8563 / 8568 VDC", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(vdc8563_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vdc8563_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vdc8563_device::device_start() +{ + DEVICE_START_NAME( vdc8563 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void vdc8563_device::device_reset() +{ + DEVICE_RESET_NAME( vdc8563 )(this); +} + + diff --git a/src/mess/video/vdc8563.h b/src/mess/video/vdc8563.h index 5462e8de8ba..96a182ca9c2 100644 --- a/src/mess/video/vdc8563.h +++ b/src/mess/video/vdc8563.h @@ -29,7 +29,26 @@ struct _vdc8563_interface DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(VDC8563, vdc8563); +class vdc8563_device : public device_t +{ +public: + vdc8563_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vdc8563_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type VDC8563; + #define MCFG_VDC8563_ADD(_tag, _interface) \ MCFG_DEVICE_ADD(_tag, VDC8563, 0) \ diff --git a/src/mess/video/vic4567.c b/src/mess/video/vic4567.c index 04175513e55..146f982b64c 100644 --- a/src/mess/video/vic4567.c +++ b/src/mess/video/vic4567.c @@ -229,7 +229,7 @@ INLINE vic3_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == VIC3); - return (vic3_state *)downcast<legacy_device_base *>(device)->token(); + return (vic3_state *)downcast<vic3_device *>(device)->token(); } INLINE const vic3_interface *get_interface( device_t *device ) @@ -2168,4 +2168,40 @@ DEVICE_GET_INFO(vic3) } } -DEFINE_LEGACY_DEVICE(VIC3, vic3); +const device_type VIC3 = &device_creator<vic3_device>; + +vic3_device::vic3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VIC3, "4567 VIC III", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(vic3_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vic3_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vic3_device::device_start() +{ + DEVICE_START_NAME( vic3 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void vic3_device::device_reset() +{ + DEVICE_RESET_NAME( vic3 )(this); +} + + diff --git a/src/mess/video/vic4567.h b/src/mess/video/vic4567.h index 4dc36dd5b09..fd0f53a39c3 100644 --- a/src/mess/video/vic4567.h +++ b/src/mess/video/vic4567.h @@ -137,7 +137,26 @@ struct _vic3_interface DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(VIC3, vic3); +class vic3_device : public device_t +{ +public: + vic3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vic3_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type VIC3; + #define MCFG_VIC3_ADD(_tag, _interface) \ MCFG_DEVICE_ADD(_tag, VIC3, 0) \ diff --git a/src/mess/video/vic6567.c b/src/mess/video/vic6567.c index 56a1c7c0cf7..c9713a6d9c2 100644 --- a/src/mess/video/vic6567.c +++ b/src/mess/video/vic6567.c @@ -269,7 +269,7 @@ INLINE vic2_state *get_safe_token( device_t *device ) assert(device != NULL); assert(device->type() == VIC2); - return (vic2_state *)downcast<legacy_device_base *>(device)->token(); + return (vic2_state *)downcast<vic2_device *>(device)->token(); } INLINE const vic2_interface *get_interface( device_t *device ) @@ -2818,4 +2818,40 @@ DEVICE_GET_INFO(vic2) } } -DEFINE_LEGACY_DEVICE(VIC2, vic2); +const device_type VIC2 = &device_creator<vic2_device>; + +vic2_device::vic2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VIC2, "6567 / 6569 VIC II", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(vic2_state)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vic2_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vic2_device::device_start() +{ + DEVICE_START_NAME( vic2 )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void vic2_device::device_reset() +{ + DEVICE_RESET_NAME( vic2 )(this); +} + + diff --git a/src/mess/video/vic6567.h b/src/mess/video/vic6567.h index f54a676e299..c9f1885f5bd 100644 --- a/src/mess/video/vic6567.h +++ b/src/mess/video/vic6567.h @@ -136,7 +136,26 @@ struct _vic2_interface DEVICE CONFIGURATION MACROS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(VIC2, vic2); +class vic2_device : public device_t +{ +public: + vic2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vic2_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type VIC2; + #define MCFG_VIC2_ADD(_tag, _interface) \ MCFG_DEVICE_ADD(_tag, VIC2, 0) \ diff --git a/src/mess/video/vtvideo.c b/src/mess/video/vtvideo.c index e004d3b0929..b162766d914 100644 --- a/src/mess/video/vtvideo.c +++ b/src/mess/video/vtvideo.c @@ -58,7 +58,7 @@ INLINE vt_video_t *get_safe_token(device_t *device) assert(device != NULL); assert(device->type() == VT100_VIDEO); - return (vt_video_t *)downcast<legacy_device_base *>(device)->token(); + return (vt_video_t *)downcast<vt100_video_device *>(device)->token(); } INLINE const vt_video_interface *get_interface(device_t *device) @@ -473,4 +473,40 @@ DEVICE_GET_INFO( vt100_video ) } } -DEFINE_LEGACY_DEVICE(VT100_VIDEO, vt100_video); +const device_type VT100_VIDEO = &device_creator<vt100_video_device>; + +vt100_video_device::vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VT100_VIDEO, "VT100 Video", tag, owner, clock) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(vt_video_t)); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vt100_video_device::device_config_complete() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vt100_video_device::device_start() +{ + DEVICE_START_NAME( vt_video )(this); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void vt100_video_device::device_reset() +{ + DEVICE_RESET_NAME( vt_video )(this); +} + + diff --git a/src/mess/video/vtvideo.h b/src/mess/video/vtvideo.h index 422e816300b..18af46122dc 100644 --- a/src/mess/video/vtvideo.h +++ b/src/mess/video/vtvideo.h @@ -20,7 +20,26 @@ MACROS / CONSTANTS ***************************************************************************/ -DECLARE_LEGACY_DEVICE(VT100_VIDEO, vt100_video); +class vt100_video_device : public device_t +{ +public: + vt100_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~vt100_video_device() { global_free(m_token); } + + // access to legacy token + void *token() const { assert(m_token != NULL); return m_token; } +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + virtual void device_reset(); +private: + // internal state + void *m_token; +}; + +extern const device_type VT100_VIDEO; + #define MCFG_VT100_VIDEO_ADD(_tag, _intrf) \ MCFG_DEVICE_ADD(_tag, VT100_VIDEO, 0) \ |