summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2019-04-05 14:22:08 +0200
committer hap <happppp@users.noreply.github.com>2019-04-05 14:22:21 +0200
commit7769fed424c7bd4994210ef83fd6e4c39bc54ca8 (patch)
tree45aa3dee20ce4a382624c8a31fb64707a6e4a728 /src
parentf4000a69711ed1853af74598cdbed78da17e2a41 (diff)
ay8910: reset i/o reg on port direction change (nw)
Diffstat (limited to 'src')
-rw-r--r--src/devices/sound/ay8910.cpp6
-rw-r--r--src/mame/drivers/lockon.cpp7
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);