From 7769fed424c7bd4994210ef83fd6e4c39bc54ca8 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 5 Apr 2019 14:22:08 +0200 Subject: ay8910: reset i/o reg on port direction change (nw) --- src/devices/sound/ay8910.cpp | 6 ++++++ src/mame/drivers/lockon.cpp | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp index 9ee02834f67..efe54b2c048 100644 --- a/src/devices/sound/ay8910.cpp +++ b/src/devices/sound/ay8910.cpp @@ -966,6 +966,9 @@ void ay8910_device::ay8910_write_reg(int r, int v) if ((m_last_enable == -1) || ((m_last_enable & 0x40) != (m_regs[AY_ENABLE] & 0x40))) { + if (!m_port_a_read_cb.isnull()) + m_regs[AY_PORTA] = m_port_a_read_cb(0); + /* write out 0xff if port set to input */ if (!m_port_a_write_cb.isnull()) m_port_a_write_cb((offs_t)0, (m_regs[AY_ENABLE] & 0x40) ? m_regs[AY_PORTA] : 0xff); @@ -974,6 +977,9 @@ void ay8910_device::ay8910_write_reg(int r, int v) if ((m_last_enable == -1) || ((m_last_enable & 0x80) != (m_regs[AY_ENABLE] & 0x80))) { + if (!m_port_b_read_cb.isnull()) + m_regs[AY_PORTB] = m_port_b_read_cb(0); + /* write out 0xff if port set to input */ if (!m_port_b_write_cb.isnull()) m_port_b_write_cb((offs_t)0, (m_regs[AY_ENABLE] & 0x80) ? m_regs[AY_PORTB] : 0xff); diff --git a/src/mame/drivers/lockon.cpp b/src/mame/drivers/lockon.cpp index d9474d316a1..23830a5f669 100644 --- a/src/mame/drivers/lockon.cpp +++ b/src/mame/drivers/lockon.cpp @@ -414,9 +414,9 @@ WRITE_LINE_MEMBER(lockon_state::ym2203_irq) WRITE8_MEMBER(lockon_state::ym2203_out_b) { - machine().bookkeeping().coin_counter_w(0, data & 0x80); - machine().bookkeeping().coin_counter_w(1, data & 0x40); - machine().bookkeeping().coin_counter_w(2, data & 0x20); + machine().bookkeeping().coin_counter_w(0, ~data & 0x80); + machine().bookkeeping().coin_counter_w(1, ~data & 0x40); + machine().bookkeeping().coin_counter_w(2, ~data & 0x20); /* 'Lock-On' lamp */ m_lamp = BIT(~data, 4); @@ -511,6 +511,7 @@ void lockon_state::lockon(machine_config &config) ymsnd.irq_handler().set(FUNC(lockon_state::ym2203_irq)); ymsnd.port_a_read_callback().set_ioport("YM2203"); ymsnd.port_b_write_callback().set(FUNC(lockon_state::ym2203_out_b)); + ymsnd.port_b_read_callback().set_constant(0xff); ymsnd.add_route(0, "lspeaker", 0.40); ymsnd.add_route(0, "rspeaker", 0.40); ymsnd.add_route(1, "f2203.1l", 1.0); -- cgit v1.2.3