From 221b16bcbadd642874b18546ea49aaee71ac6990 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 31 May 2018 02:59:45 +0200 Subject: tatsumi.cpp: oki status is actually reversed active wise for Cycle Warriors and Big Fight, fixes "we got em" sample playback in former [Angelo Salese] --- src/mame/drivers/tatsumi.cpp | 6 +++--- src/mame/includes/tatsumi.h | 3 ++- src/mame/machine/tatsumi.cpp | 16 +++++++++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/mame/drivers/tatsumi.cpp b/src/mame/drivers/tatsumi.cpp index d621d05b6aa..4fbf3b9fb41 100644 --- a/src/mame/drivers/tatsumi.cpp +++ b/src/mame/drivers/tatsumi.cpp @@ -286,7 +286,7 @@ void apache3_state::apache3_v20_map(address_map &map) map(0x04000, 0x04003).rw("ppi", FUNC(i8255_device::read), FUNC(i8255_device::write)); map(0x06000, 0x06001).portr("IN0"); // esw map(0x08000, 0x08001).r(this, FUNC(apache3_state::tatsumi_hack_ym2151_r)).w(m_ym2151, FUNC(ym2151_device::write)); - map(0x0a000, 0x0a000).r(this, FUNC(apache3_state::tatsumi_hack_oki_r)).w(m_oki, FUNC(okim6295_device::write)); + map(0x0a000, 0x0a000).r(m_oki, FUNC(okim6295_device::read)).w(m_oki, FUNC(okim6295_device::write)); map(0x0e000, 0x0e007).rw("adc", FUNC(adc0808_device::data_r), FUNC(adc0808_device::address_offset_start_w)); map(0xf0000, 0xfffff).rom().region("sound_rom", 0); } @@ -334,7 +334,7 @@ void roundup5_state::roundup5_z80_map(address_map &map) map(0x0000, 0xdfff).rom(); map(0xe000, 0xffef).ram(); map(0xfff0, 0xfff1).r(this, FUNC(roundup5_state::tatsumi_hack_ym2151_r)).w(m_ym2151, FUNC(ym2151_device::write)); - map(0xfff4, 0xfff4).r(this, FUNC(roundup5_state::tatsumi_hack_oki_r)).w(m_oki, FUNC(okim6295_device::write)); + map(0xfff4, 0xfff4).r(m_oki, FUNC(okim6295_device::read)).w(m_oki, FUNC(okim6295_device::write)); map(0xfff8, 0xfffb).rw("ppi", FUNC(i8255_device::read), FUNC(i8255_device::write)); map(0xfffc, 0xfffc).portr("STICKX"); } @@ -393,7 +393,7 @@ void cyclwarr_state::sound_map(address_map &map) map(0x0000, 0xdfff).rom(); map(0xe000, 0xffef).ram(); map(0xfff0, 0xfff1).r(this, FUNC(cyclwarr_state::tatsumi_hack_ym2151_r)).w(m_ym2151, FUNC(ym2151_device::write)); - map(0xfff4, 0xfff4).r(this, FUNC(cyclwarr_state::tatsumi_hack_oki_r)).w(m_oki, FUNC(okim6295_device::write)); + map(0xfff4, 0xfff4).r(this, FUNC(cyclwarr_state::oki_status_xor_r)).w(m_oki, FUNC(okim6295_device::write)); map(0xfffc, 0xfffc).r(m_soundlatch, FUNC(generic_latch_8_device::read)); map(0xfffe, 0xfffe).nopw(); } diff --git a/src/mame/includes/tatsumi.h b/src/mame/includes/tatsumi.h index 59346c83290..029e1f2e9dd 100644 --- a/src/mame/includes/tatsumi.h +++ b/src/mame/includes/tatsumi.h @@ -57,7 +57,6 @@ public: TILE_GET_INFO_MEMBER(get_text_tile_info); INTERRUPT_GEN_MEMBER(v30_interrupt); DECLARE_READ8_MEMBER(tatsumi_hack_ym2151_r); - DECLARE_READ8_MEMBER(tatsumi_hack_oki_r); DECLARE_WRITE8_MEMBER(hd6445_crt_w); void tatsumi_reset(); @@ -202,6 +201,8 @@ public: DECLARE_WRITE8_MEMBER(cyclwarr_control_w); DECLARE_WRITE8_MEMBER(cyclwarr_sound_w); DECLARE_WRITE16_MEMBER(output_w); + DECLARE_READ8_MEMBER(oki_status_xor_r); + template DECLARE_READ16_MEMBER(cyclwarr_videoram_r); template DECLARE_WRITE16_MEMBER(cyclwarr_videoram_w); diff --git a/src/mame/machine/tatsumi.cpp b/src/mame/machine/tatsumi.cpp index c0f36069405..5e2d582248c 100644 --- a/src/mame/machine/tatsumi.cpp +++ b/src/mame/machine/tatsumi.cpp @@ -316,10 +316,19 @@ READ8_MEMBER(tatsumi_state::tatsumi_hack_ym2151_r) return r; } -READ8_MEMBER(tatsumi_state::tatsumi_hack_oki_r) +READ8_MEMBER(cyclwarr_state::oki_status_xor_r) { - int r=m_oki->read(space,0); - + int r = m_oki->read(space,0); + + // Cycle Warriors and Big Fight access this with reversed activeness. + // this is particularly noticeable with the "We got em" sample played in CW at stage clear: + // gets cut too early with the old hack below. + // fwiw returning normal oki status doesn't work at all, both games don't make any sound. + // TODO: verify with HW + return (r ^ 0xff); + #ifdef UNUSED_FUNCTION + // old hack left for reference + if (m_audiocpu->pc()==0x2b70 || m_audiocpu->pc()==0x2bb5 || m_audiocpu->pc()==0x2acc || m_audiocpu->pc()==0x1c79 // BigFight @@ -330,4 +339,5 @@ READ8_MEMBER(tatsumi_state::tatsumi_hack_oki_r) || m_audiocpu->pc()==0x1cac) // BigFight return 0; return r; + #endif } -- cgit v1.2.3