diff --git a/src/emu/video/mb_vcu.c b/src/emu/video/mb_vcu.c index de2d0fdad88..4c92bb62b7c 100644 --- a/src/emu/video/mb_vcu.c +++ b/src/emu/video/mb_vcu.c @@ -156,33 +156,11 @@ mb_vcu_device::mb_vcu_device(const machine_config &mconfig, const char *tag, dev device_video_interface(mconfig, *this), m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 19, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_vram)), m_paletteram_space_config("palram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_pal_ram)), + m_cpu(*this), m_palette(*this) { } -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void mb_vcu_device::device_config_complete() -{ - // inherit a copy of the static data - const mb_vcu_interface *intf = reinterpret_cast(static_config()); - if (intf != NULL) - { - *static_cast(this) = *intf; - } - - // or initialize to defaults if none provided - else - { - m_cpu_tag = NULL; - //m_screen_tag = NULL; - } -} - //------------------------------------------------- // device_validity_check - perform validity checks // on this device @@ -200,7 +178,6 @@ void mb_vcu_device::device_validity_check(validity_checker &valid) const void mb_vcu_device::device_start() { // TODO: m_screen_tag - m_cpu = machine().device(m_cpu_tag); m_ram = auto_alloc_array_clear(machine(), UINT8, 0x800); m_palram = auto_alloc_array_clear(machine(), UINT8, 0x100); diff --git a/src/emu/video/mb_vcu.h b/src/emu/video/mb_vcu.h index 6c079c2ff45..9b8a7827b2a 100644 --- a/src/emu/video/mb_vcu.h +++ b/src/emu/video/mb_vcu.h @@ -1,44 +1,20 @@ // license: ? // copyright-holders: Angelo Salese -/*************************************************************************** - -Template for skeleton device - -***************************************************************************/ - #pragma once #ifndef __MB_VCUDEV_H__ #define __MB_VCUDEV_H__ - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_MB_VCU_ADD(_tag,_freq,_config, _palette_tag) \ - MCFG_DEVICE_ADD(_tag, MB_VCU, _freq) \ - MCFG_DEVICE_CONFIG(_config) \ - mb_vcu_device::static_set_palette_tag(*device, "^" _palette_tag); - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** -// ======================> mb_vcu_interface - -struct mb_vcu_interface -{ - const char *m_cpu_tag; -}; - // ======================> mb_vcu_device class mb_vcu_device : public device_t, public device_memory_interface, - public device_video_interface, - public mb_vcu_interface + public device_video_interface { public: // construction/destruction @@ -46,6 +22,7 @@ public: // static configuration static void static_set_palette_tag(device_t &device, const char *tag); + static void set_cpu_tag(device_t &device, const char *tag) { downcast(device).m_cpu.set_tag(tag); } // I/O operations DECLARE_WRITE8_MEMBER( write_vregs ); @@ -65,7 +42,6 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_validity_check(validity_checker &valid) const; virtual void device_start(); virtual void device_reset(); @@ -81,7 +57,6 @@ private: UINT8 m_status; UINT8 *m_ram; UINT8 *m_palram; - cpu_device *m_cpu; UINT16 m_param_offset_latch; INT16 m_xpos, m_ypos; @@ -95,6 +70,7 @@ private: double m_weights_r[2]; double m_weights_g[3]; double m_weights_b[3]; + required_device m_cpu; required_device m_palette; }; @@ -103,11 +79,14 @@ private: extern const device_type MB_VCU; - //************************************************************************** -// GLOBAL VARIABLES +// INTERFACE CONFIGURATION MACROS //************************************************************************** +#define MCFG_MB_VCU_CPU(_tag) \ + mb_vcu_device::set_cpu_tag(*device, "^"_tag); +#define MCFG_MB_VCU_PALETTE(_palette_tag) \ + mb_vcu_device::static_set_palette_tag(*device, "^" _palette_tag); #endif diff --git a/src/mame/drivers/mazerbla.c b/src/mame/drivers/mazerbla.c index 7dc96cfac2a..74f20cc242e 100644 --- a/src/mame/drivers/mazerbla.c +++ b/src/mame/drivers/mazerbla.c @@ -1466,11 +1466,6 @@ void mazerbla_state::machine_reset() m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(mazerbla_state::irq_callback),this)); } -static const mb_vcu_interface vcu_interface = -{ - "sub2" -}; - static MACHINE_CONFIG_START( mazerbla, mazerbla_state ) /* basic machine hardware */ @@ -1493,7 +1488,9 @@ static MACHINE_CONFIG_START( mazerbla, mazerbla_state ) MCFG_CPU_VBLANK_INT_DRIVER("screen", mazerbla_state, irq0_line_hold) /* synchronization forced on the fly */ - MCFG_MB_VCU_ADD("vcu",SOUND_CLOCK/4,vcu_interface,"palette") + MCFG_DEVICE_ADD("vcu", MB_VCU, SOUND_CLOCK/4) + MCFG_MB_VCU_CPU("sub2") + MCFG_MB_VCU_PALETTE("palette") /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1530,7 +1527,9 @@ static MACHINE_CONFIG_START( greatgun, mazerbla_state ) */ MCFG_CPU_VBLANK_INT_DRIVER("screen", mazerbla_state, irq0_line_hold) - MCFG_MB_VCU_ADD("vcu",SOUND_CLOCK/4,vcu_interface,"palette") + MCFG_DEVICE_ADD("vcu", MB_VCU, SOUND_CLOCK/4) + MCFG_MB_VCU_CPU("sub2") + MCFG_MB_VCU_PALETTE("palette") /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER)