diff --git a/src/mame/drivers/williams.c b/src/mame/drivers/williams.c index cad9bdd3ebf..9042d0e66ae 100644 --- a/src/mame/drivers/williams.c +++ b/src/mame/drivers/williams.c @@ -1690,7 +1690,7 @@ static MACHINE_CONFIG_DERIVED( tshoot, williams2 ) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( joust2, williams2 ) +static MACHINE_CONFIG_DERIVED_CLASS( joust2, williams2, joust2_state ) /* basic machine hardware */ MCFG_WILLIAMS_CVSD_SOUND_ADD("cvsd") diff --git a/src/mame/includes/williams.h b/src/mame/includes/williams.h index bbde5597db1..74c7f8ec087 100644 --- a/src/mame/includes/williams.h +++ b/src/mame/includes/williams.h @@ -13,7 +13,6 @@ class williams_state : public driver_device public: williams_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_cvsd_sound(*this, "cvsd"), m_nvram(*this, "nvram"), m_videoram(*this, "videoram"), m_blaster_palette_0(*this, "blaster_pal0"), @@ -21,8 +20,6 @@ public: m_williams2_tileram(*this, "williams2_tile") { } - optional_device m_cvsd_sound; - required_shared_ptr m_nvram; UINT8 *m_mayday_protection; required_shared_ptr m_videoram; @@ -78,6 +75,16 @@ public: }; +class joust2_state : public williams_state +{ +public: + joust2_state(const machine_config &mconfig, device_type type, const char *tag) + : williams_state(mconfig, type, tag), + m_cvsd_sound(*this, "cvsd") { } + + required_device m_cvsd_sound; +}; + /*----------- defined in drivers/williams.c -----------*/ void defender_install_io_space(address_space *space); diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c index 3921eccc8bc..b10cc4a00cd 100644 --- a/src/mame/machine/williams.c +++ b/src/mame/machine/williams.c @@ -985,7 +985,7 @@ static WRITE8_DEVICE_HANDLER( tshoot_lamp_w ) MACHINE_START( joust2 ) { - williams_state *state = machine.driver_data(); + joust2_state *state = machine.driver_data(); MACHINE_START_CALL(williams2); state_save_register_global(machine, state->m_joust2_current_sound_data); } @@ -1006,7 +1006,7 @@ static TIMER_CALLBACK( joust2_deferred_snd_cmd_w ) static WRITE8_DEVICE_HANDLER( joust2_pia_3_cb1_w ) { - williams_state *state = device->machine().driver_data(); + joust2_state *state = device->machine().driver_data(); state->m_joust2_current_sound_data = (state->m_joust2_current_sound_data & ~0x100) | ((data << 8) & 0x100); state->m_cvsd_sound->write(*device->machine().memory().first_space(), 0, state->m_joust2_current_sound_data); } @@ -1014,7 +1014,7 @@ static WRITE8_DEVICE_HANDLER( joust2_pia_3_cb1_w ) static WRITE8_DEVICE_HANDLER( joust2_snd_cmd_w ) { - williams_state *state = device->machine().driver_data(); + joust2_state *state = device->machine().driver_data(); state->m_joust2_current_sound_data = (state->m_joust2_current_sound_data & ~0xff) | (data & 0xff); state->m_cvsd_sound->write(*device->machine().memory().first_space(), 0, state->m_joust2_current_sound_data); device->machine().scheduler().synchronize(FUNC(joust2_deferred_snd_cmd_w), state->m_joust2_current_sound_data);