summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Dirk Best <mail@dirk-best.de>2019-04-05 09:22:13 +0200
committer Dirk Best <mail@dirk-best.de>2019-04-05 09:22:53 +0200
commit8dc8147ab36391508829063aa87f6f12a39ffa3f (patch)
tree01297c63d67bda834b41defb1bd80c8b5d9cfab3
parent2bbf51895b73508dc363aa61f4a8b69717e971a4 (diff)
lockon: Fix coin counters (MT05374)
-rw-r--r--src/mame/drivers/lockon.cpp14
-rw-r--r--src/mame/includes/lockon.h2
2 files changed, 13 insertions, 3 deletions
diff --git a/src/mame/drivers/lockon.cpp b/src/mame/drivers/lockon.cpp
index d9474d316a1..d145b358c58 100644
--- a/src/mame/drivers/lockon.cpp
+++ b/src/mame/drivers/lockon.cpp
@@ -414,12 +414,20 @@ 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);
+ // we require that the value keeps stable for at least two writes
+ if (BIT(data, 7) == BIT(m_ym2203_port_b, 7))
+ machine().bookkeeping().coin_counter_w(0, BIT(~data, 7));
+
+ if (BIT(data, 6) == BIT(m_ym2203_port_b, 6))
+ machine().bookkeeping().coin_counter_w(1, BIT(~data, 6));
+
+ if (BIT(data, 5) == BIT(m_ym2203_port_b, 5))
+ machine().bookkeeping().coin_counter_w(2, BIT(~data, 5));
/* 'Lock-On' lamp */
m_lamp = BIT(~data, 4);
+
+ m_ym2203_port_b = data;
}
/*************************************
diff --git a/src/mame/includes/lockon.h b/src/mame/includes/lockon.h
index abdbbe9219c..d21db6256d6 100644
--- a/src/mame/includes/lockon.h
+++ b/src/mame/includes/lockon.h
@@ -36,6 +36,7 @@ public:
, m_scene_ram(*this, "scene_ram")
, m_ground_ram(*this, "ground_ram")
, m_object_ram(*this, "object_ram")
+ , m_ym2203_port_b(0xff)
, m_maincpu(*this, "maincpu")
, m_audiocpu(*this, "audiocpu")
, m_ground(*this, "ground")
@@ -97,6 +98,7 @@ private:
/* misc */
uint8_t m_ctrl_reg;
uint32_t m_main_inten;
+ uint8_t m_ym2203_port_b;
/* devices */
required_device<cpu_device> m_maincpu;