From a851bee1a7eb6e1f79984b18ba50e392dc042008 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sun, 31 Mar 2019 00:51:10 +0900 Subject: [PATCH] tmnt.cpp : Device'fied prmrsocr exclusive K054986A interface (#4591) k054321.cpp : fix synchronizing maincpu-soundcpu communication issue --- src/devices/machine/k054321.cpp | 21 ++++++++++++++++++--- src/devices/machine/k054321.h | 4 ++++ src/mame/drivers/tmnt.cpp | 13 ++++--------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/devices/machine/k054321.cpp b/src/devices/machine/k054321.cpp index 592bc74582a..be7fed6d438 100644 --- a/src/devices/machine/k054321.cpp +++ b/src/devices/machine/k054321.cpp @@ -86,6 +86,21 @@ void k054321_device::device_start() save_item(NAME(m_active)); } +TIMER_CALLBACK_MEMBER(k054321_device::write_main1) +{ + m_main1 = param; +} + +TIMER_CALLBACK_MEMBER(k054321_device::write_main2) +{ + m_main2 = param; +} + +TIMER_CALLBACK_MEMBER(k054321_device::write_sound1) +{ + m_sound1 = param; +} + READ8_MEMBER( k054321_device::main1_r) { return m_main1; @@ -93,7 +108,7 @@ READ8_MEMBER( k054321_device::main1_r) WRITE8_MEMBER(k054321_device::main1_w) { - m_main1 = data; + machine().scheduler().synchronize(timer_expired_delegate(FUNC(k054321_device::write_main1), this), data & 0xff); } READ8_MEMBER( k054321_device::main2_r) @@ -103,7 +118,7 @@ READ8_MEMBER( k054321_device::main2_r) WRITE8_MEMBER(k054321_device::main2_w) { - m_main2 = data; + machine().scheduler().synchronize(timer_expired_delegate(FUNC(k054321_device::write_main2), this), data & 0xff); } READ8_MEMBER( k054321_device::sound1_r) @@ -113,7 +128,7 @@ READ8_MEMBER( k054321_device::sound1_r) WRITE8_MEMBER(k054321_device::sound1_w) { - m_sound1 = data; + machine().scheduler().synchronize(timer_expired_delegate(FUNC(k054321_device::write_sound1), this), data & 0xff); } WRITE8_MEMBER(k054321_device::volume_reset_w) diff --git a/src/devices/machine/k054321.h b/src/devices/machine/k054321.h index 2fe51758d26..d108b6563c5 100644 --- a/src/devices/machine/k054321.h +++ b/src/devices/machine/k054321.h @@ -54,6 +54,10 @@ private: DECLARE_READ8_MEMBER(busy_r); DECLARE_WRITE8_MEMBER(dummy_w); + + TIMER_CALLBACK_MEMBER(write_main1); + TIMER_CALLBACK_MEMBER(write_main2); + TIMER_CALLBACK_MEMBER(write_sound1); }; DECLARE_DEVICE_TYPE(K054321, k054321_device) diff --git a/src/mame/drivers/tmnt.cpp b/src/mame/drivers/tmnt.cpp index 9666c5ee16d..c7421c65bbc 100644 --- a/src/mame/drivers/tmnt.cpp +++ b/src/mame/drivers/tmnt.cpp @@ -61,6 +61,7 @@ Updates: #include "cpu/z80/z80.h" #include "machine/eepromser.h" #include "machine/gen_latch.h" +#include "machine/k054321.h" #include "machine/nvram.h" #include "machine/watchdog.h" #include "sound/k054539.h" @@ -658,9 +659,7 @@ void tmnt_state::prmrsocr_main_map(address_map &map) map(0x11c000, 0x11c01f).w(m_k053251, FUNC(k053251_device::msb_w)); map(0x120000, 0x120001).portr("P1/COINS"); map(0x120002, 0x120003).portr("P2/EEPROM"); - map(0x12100d, 0x12100d).w("soundlatch", FUNC(generic_latch_8_device::write)); - map(0x12100f, 0x12100f).w("soundlatch2", FUNC(generic_latch_8_device::write)); - map(0x121015, 0x121015).r("soundlatch3", FUNC(generic_latch_8_device::read)); + map(0x121000, 0x12101f).m("k054321", FUNC(k054321_device::main_map)).umask16(0x00ff); map(0x122000, 0x122001).w(FUNC(tmnt_state::prmrsocr_eeprom_w)); /* EEPROM + video control */ map(0x123000, 0x123001).w(FUNC(tmnt_state::prmrsocr_sound_irq_w)); map(0x200000, 0x207fff).rw(FUNC(tmnt_state::k052109_word_noA12_r), FUNC(tmnt_state::k052109_word_noA12_w)); @@ -1080,9 +1079,7 @@ void tmnt_state::prmrsocr_audio_map(address_map &map) map(0xe000, 0xe12f).lrw8("k054539_rw", [this](offs_t offset) { return m_k054539->read(((offset & 0x100) << 1) | (offset & 0xff)); }, [this](offs_t offset, u8 data) { m_k054539->write(((offset & 0x100) << 1) | (offset & 0xff), data); }); - map(0xf000, 0xf000).w("soundlatch3", FUNC(generic_latch_8_device::write)); - map(0xf002, 0xf002).r("soundlatch", FUNC(generic_latch_8_device::read)); - map(0xf003, 0xf003).r("soundlatch2", FUNC(generic_latch_8_device::read)); + map(0xf000, 0xf003).m("k054321", FUNC(k054321_device::sound_map)); map(0xf800, 0xf800).w(FUNC(tmnt_state::prmrsocr_audio_bankswitch_w)); } @@ -2373,9 +2370,7 @@ void tmnt_state::prmrsocr(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - GENERIC_LATCH_8(config, "soundlatch"); - GENERIC_LATCH_8(config, "soundlatch2"); - GENERIC_LATCH_8(config, "soundlatch3"); + K054321(config, "k054321", "lspeaker", "rspeaker"); K054539(config, m_k054539, XTAL(18'432'000)); m_k054539->timer_handler().set_inputline("audiocpu", INPUT_LINE_NMI);