From 988bf454047ca913f0836baa1c226ae5705851c0 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 23 Apr 2021 01:49:39 +0200 Subject: stfight: use device_array for ym2203 --- src/mame/drivers/stfight.cpp | 26 +++++++++++++------------- src/mame/includes/stfight.h | 7 ++----- src/mame/machine/stfight.cpp | 4 ++-- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/mame/drivers/stfight.cpp b/src/mame/drivers/stfight.cpp index 974ddace357..00d40f05a77 100644 --- a/src/mame/drivers/stfight.cpp +++ b/src/mame/drivers/stfight.cpp @@ -323,8 +323,8 @@ void stfight_state::cshooter_cpu1_map(address_map &map) void stfight_state::cpu2_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0xc000, 0xc001).rw("ym1", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); - map(0xc800, 0xc801).rw("ym2", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); + map(0xc000, 0xc001).rw(m_ym[0], FUNC(ym2203_device::read), FUNC(ym2203_device::write)); + map(0xc800, 0xc801).rw(m_ym[1], FUNC(ym2203_device::read), FUNC(ym2203_device::write)); map(0xd000, 0xd000).nopr(); map(0xd800, 0xd800).nopw(); map(0xe800, 0xe800).nopw(); @@ -482,17 +482,17 @@ void stfight_state::stfight_base(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); - ym2203_device &ym1(YM2203(config, m_ym1, 12_MHz_XTAL / 8)); - ym1.add_route(0, "mono", 0.15); - ym1.add_route(1, "mono", 0.15); - ym1.add_route(2, "mono", 0.15); - ym1.add_route(3, "mono", 0.10); - - ym2203_device &ym2(YM2203(config, m_ym2, 12_MHz_XTAL / 8)); - ym2.add_route(0, "mono", 0.15); - ym2.add_route(1, "mono", 0.15); - ym2.add_route(2, "mono", 0.15); - ym2.add_route(3, "mono", 0.10); + YM2203(config, m_ym[0], 12_MHz_XTAL / 8); + m_ym[0]->add_route(0, "mono", 0.15); + m_ym[0]->add_route(1, "mono", 0.15); + m_ym[0]->add_route(2, "mono", 0.15); + m_ym[0]->add_route(3, "mono", 0.10); + + YM2203(config, m_ym[1], 12_MHz_XTAL / 8); + m_ym[1]->add_route(0, "mono", 0.15); + m_ym[1]->add_route(1, "mono", 0.15); + m_ym[1]->add_route(2, "mono", 0.15); + m_ym[1]->add_route(3, "mono", 0.10); MSM5205(config, m_msm, 384_kHz_XTAL); m_msm->vck_callback().set(FUNC(stfight_state::stfight_adpcm_int)); // Interrupt function diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h index 4f60c694f94..57f8600dca9 100644 --- a/src/mame/includes/stfight.h +++ b/src/mame/includes/stfight.h @@ -21,8 +21,7 @@ public: , m_audiocpu(*this, "audiocpu") , m_mcu(*this, "mcu") , m_msm(*this, "msm") - , m_ym1(*this, "ym1") - , m_ym2(*this, "ym2") + , m_ym(*this, "ym%u", 0) , m_main_bank(*this, "mainbank") , m_samples(*this, "adpcm") , m_decrypted_opcodes(*this, "decrypted_opcodes") @@ -90,9 +89,7 @@ private: required_device m_audiocpu; required_device m_mcu; required_device m_msm; - - required_device m_ym1; - required_device m_ym2; + required_device_array m_ym; required_memory_bank m_main_bank; diff --git a/src/mame/machine/stfight.cpp b/src/mame/machine/stfight.cpp index ab2f187e008..cb8d0d848ef 100644 --- a/src/mame/machine/stfight.cpp +++ b/src/mame/machine/stfight.cpp @@ -81,8 +81,8 @@ void stfight_state::machine_start() m_int1_timer = timer_alloc(TIMER_STFIGHT_INTERRUPT_1); // Set clock prescaler FM:1/2 PSG:1/1 - m_ym1->write(0, 0x2f); - m_ym2->write(0, 0x2f); + m_ym[0]->write(0, 0x2f); + m_ym[1]->write(0, 0x2f); save_item(NAME(m_coin_state)); -- cgit v1.2.3