ay8910: reset i/o reg on port direction change (nw)

This commit is contained in:
hap 2019-04-05 14:22:08 +02:00
parent f4000a6971
commit 7769fed424
2 changed files with 10 additions and 3 deletions

View File

@ -966,6 +966,9 @@ void ay8910_device::ay8910_write_reg(int r, int v)
if ((m_last_enable == -1) || if ((m_last_enable == -1) ||
((m_last_enable & 0x40) != (m_regs[AY_ENABLE] & 0x40))) ((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 */ /* write out 0xff if port set to input */
if (!m_port_a_write_cb.isnull()) 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); 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) || if ((m_last_enable == -1) ||
((m_last_enable & 0x80) != (m_regs[AY_ENABLE] & 0x80))) ((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 */ /* write out 0xff if port set to input */
if (!m_port_b_write_cb.isnull()) 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); m_port_b_write_cb((offs_t)0, (m_regs[AY_ENABLE] & 0x80) ? m_regs[AY_PORTB] : 0xff);

View File

@ -414,9 +414,9 @@ WRITE_LINE_MEMBER(lockon_state::ym2203_irq)
WRITE8_MEMBER(lockon_state::ym2203_out_b) WRITE8_MEMBER(lockon_state::ym2203_out_b)
{ {
machine().bookkeeping().coin_counter_w(0, data & 0x80); machine().bookkeeping().coin_counter_w(0, ~data & 0x80);
machine().bookkeeping().coin_counter_w(1, data & 0x40); machine().bookkeeping().coin_counter_w(1, ~data & 0x40);
machine().bookkeeping().coin_counter_w(2, data & 0x20); machine().bookkeeping().coin_counter_w(2, ~data & 0x20);
/* 'Lock-On' lamp */ /* 'Lock-On' lamp */
m_lamp = BIT(~data, 4); 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.irq_handler().set(FUNC(lockon_state::ym2203_irq));
ymsnd.port_a_read_callback().set_ioport("YM2203"); ymsnd.port_a_read_callback().set_ioport("YM2203");
ymsnd.port_b_write_callback().set(FUNC(lockon_state::ym2203_out_b)); 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, "lspeaker", 0.40);
ymsnd.add_route(0, "rspeaker", 0.40); ymsnd.add_route(0, "rspeaker", 0.40);
ymsnd.add_route(1, "f2203.1l", 1.0); ymsnd.add_route(1, "f2203.1l", 1.0);