From e5ae9d5b2075db498fda4844e3c9104984993b1a Mon Sep 17 00:00:00 2001 From: sasuke-arcade <58130089+sasuke-arcade@users.noreply.github.com> Date: Fri, 23 Apr 2021 08:40:22 +0900 Subject: [PATCH] stfight.cpp: Remove YM2203 frequency hack, and set prescaler at machine_start (#7992) --- src/mame/drivers/stfight.cpp | 14 ++++++-------- src/mame/includes/stfight.h | 6 ++++++ src/mame/machine/stfight.cpp | 4 ++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/mame/drivers/stfight.cpp b/src/mame/drivers/stfight.cpp index 22ea429237d..974ddace357 100644 --- a/src/mame/drivers/stfight.cpp +++ b/src/mame/drivers/stfight.cpp @@ -245,11 +245,10 @@ conventional RAM. See the memory map for sprite data format. TODO: - handle transparency in text layer properly (how?) - second bank of sf02 is this used? (probably NOT) -- stfight/empcity YM2203s should be clocked at 1.5MHz but this results in - the sound and music being 1/3 of the pitch they should be. The game never - writes the YM2203s' divider registers yet other games (e.g. Lock-On) - suggest the default values are correct. - cshootert however, sounds too high-pitched at 1.5MHz*3. +- empcity/stfight never writes the YM2203s' divider registers but it expects + 0x2f, there's a workaround for it in machine_start +- empcity/stfight has an NMI handler, but it's not hooked up in MAME, missing + comms somewhere? - Each version of empcity/stfight has a different protection code stored in the MCU (at $1D2) so each 68705 will need to be dumped. We currently use hacked versions of the empcityu MCU for each different set. @@ -483,14 +482,13 @@ void stfight_state::stfight_base(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); - // YM2203_PITCH_HACK - These should be clocked at 1.5Mhz (see TODO list) - ym2203_device &ym1(YM2203(config, "ym1", 12_MHz_XTAL / 8 * 3)); + 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, "ym2", 12_MHz_XTAL / 8 * 3)); + 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); diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h index a2fb44092bc..4f60c694f94 100644 --- a/src/mame/includes/stfight.h +++ b/src/mame/includes/stfight.h @@ -6,6 +6,7 @@ #pragma once #include "cpu/m6805/m68705.h" +#include "sound/ym2203.h" #include "sound/msm5205.h" #include "video/stfight_dev.h" #include "video/airraid_dev.h" @@ -20,6 +21,8 @@ public: , m_audiocpu(*this, "audiocpu") , m_mcu(*this, "mcu") , m_msm(*this, "msm") + , m_ym1(*this, "ym1") + , m_ym2(*this, "ym2") , m_main_bank(*this, "mainbank") , m_samples(*this, "adpcm") , m_decrypted_opcodes(*this, "decrypted_opcodes") @@ -88,6 +91,9 @@ private: required_device m_mcu; required_device m_msm; + required_device m_ym1; + required_device m_ym2; + required_memory_bank m_main_bank; required_region_ptr m_samples; diff --git a/src/mame/machine/stfight.cpp b/src/mame/machine/stfight.cpp index 9869440ff42..ab2f187e008 100644 --- a/src/mame/machine/stfight.cpp +++ b/src/mame/machine/stfight.cpp @@ -80,6 +80,10 @@ 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); + save_item(NAME(m_coin_state)); save_item(NAME(m_fm_data));