From 41c4341eac0f6d6f11acc0d827e6d09d9ba61df1 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 13 Mar 2023 14:13:28 +0100 Subject: vgmplay: workaround for 7759 md pin write --- src/mame/virtual/vgmplay.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/mame/virtual/vgmplay.cpp b/src/mame/virtual/vgmplay.cpp index e5e2e35ef87..24965086b06 100644 --- a/src/mame/virtual/vgmplay.cpp +++ b/src/mame/virtual/vgmplay.cpp @@ -430,6 +430,7 @@ public: DECLARE_INPUT_CHANGED_MEMBER(key_pressed); template void upd7759_reset_w(uint8_t data); + template void upd7759_start_w(uint8_t data); template void upd7759_data_w(uint8_t data); template DECLARE_WRITE_LINE_MEMBER(upd7759_drq_w); template void okim6258_clock_w(offs_t offset, uint8_t data, uint8_t mem_mask = ~0); @@ -2955,8 +2956,6 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state::load_file) setup_device(*m_upd7759[1], 1, CT_UPD7759, 0x8c, 0x161); m_upd7759_md[0] = r32(0x8c) & 0x80000000 ? 0 : 1; m_upd7759_md[1] = r32(0x8c) & 0x80000000 ? 0 : 1; - m_upd7759[0]->md_w(m_upd7759_md[0]); - m_upd7759[1]->md_w(m_upd7759_md[1]); setup_device(*m_okim6258[0], 0, CT_OKIM6258, 0x90, 0x161); setup_device(*m_okim6258[1], 1, CT_OKIM6258, 0x90, 0x161); @@ -3124,6 +3123,18 @@ void vgmplay_state::upd7759_reset_w(uint8_t data) } } +template +void vgmplay_state::upd7759_start_w(uint8_t data) +{ + int start = data != 0; + + // substitute ST with MD when in slave mode + if (m_upd7759_md[Index]) + m_upd7759[Index]->start_w(start); + else + m_upd7759[Index]->md_w(!start); +} + template void vgmplay_state::upd7759_data_w(uint8_t data) { @@ -3392,11 +3403,11 @@ void vgmplay_state::soundchips_map(address_map &map) map(vgmplay_device::A_MULTIPCM_1 + 4, vgmplay_device::A_MULTIPCM_1 + 7).w("vgmplay", FUNC(vgmplay_device::multipcm_bank_hi_w<1>)); map(vgmplay_device::A_MULTIPCM_1 + 8, vgmplay_device::A_MULTIPCM_1 + 11).w("vgmplay", FUNC(vgmplay_device::multipcm_bank_lo_w<1>)); map(vgmplay_device::A_UPD7759_0 + 0, vgmplay_device::A_UPD7759_0 + 0).w(FUNC(vgmplay_state::upd7759_reset_w<0>)); - map(vgmplay_device::A_UPD7759_0 + 1, vgmplay_device::A_UPD7759_0 + 1).lw8(NAME([this](uint8_t data) {m_upd7759[0]->start_w(data != 0); })); + map(vgmplay_device::A_UPD7759_0 + 1, vgmplay_device::A_UPD7759_0 + 1).w(FUNC(vgmplay_state::upd7759_start_w<0>)); map(vgmplay_device::A_UPD7759_0 + 2, vgmplay_device::A_UPD7759_0 + 2).w(FUNC(vgmplay_state::upd7759_data_w<0>)); map(vgmplay_device::A_UPD7759_0 + 3, vgmplay_device::A_UPD7759_0 + 3).w("vgmplay", FUNC(vgmplay_device::upd7759_bank_w<0>)); map(vgmplay_device::A_UPD7759_1 + 0, vgmplay_device::A_UPD7759_1 + 0).w(FUNC(vgmplay_state::upd7759_reset_w<1>)); - map(vgmplay_device::A_UPD7759_1 + 1, vgmplay_device::A_UPD7759_1 + 1).lw8(NAME([this](uint8_t data) {m_upd7759[1]->start_w(data != 0); })); + map(vgmplay_device::A_UPD7759_1 + 1, vgmplay_device::A_UPD7759_1 + 1).w(FUNC(vgmplay_state::upd7759_start_w<1>)); map(vgmplay_device::A_UPD7759_1 + 2, vgmplay_device::A_UPD7759_1 + 2).w(FUNC(vgmplay_state::upd7759_data_w<1>)); map(vgmplay_device::A_UPD7759_1 + 3, vgmplay_device::A_UPD7759_1 + 3).w("vgmplay", FUNC(vgmplay_device::upd7759_bank_w<1>)); map(vgmplay_device::A_OKIM6258_0 + 0x0, vgmplay_device::A_OKIM6258_0 + 0x0).w(m_okim6258[0], FUNC(okim6258_device::ctrl_w)); -- cgit v1.2.3