From a36456e507df1a2300a4608c2a571c2730c2cb1c Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 8 May 2023 16:46:55 -0400 Subject: mainevt, tmnt: Correct polarity of uPD7759 ST line writes --- src/mame/konami/mainevt.cpp | 22 +++++++++++++--------- src/mame/konami/tmnt.cpp | 10 +++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/mame/konami/mainevt.cpp b/src/mame/konami/mainevt.cpp index c2e600b6630..1c74c60d38e 100644 --- a/src/mame/konami/mainevt.cpp +++ b/src/mame/konami/mainevt.cpp @@ -61,7 +61,7 @@ namespace { class base_state : public driver_device { -public: +protected: base_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") @@ -73,10 +73,6 @@ public: , m_leds(*this, "led%u", 0U) { } - void devstors(machine_config &config); - void mainevt(machine_config &config); - -protected: virtual void machine_start() override; // devices @@ -110,6 +106,9 @@ public: void mainevt(machine_config &config); +protected: + virtual void machine_reset() override; + private: // devices required_device m_upd7759; @@ -301,15 +300,15 @@ uint8_t mainevt_state::sh_busy_r() void mainevt_state::sh_irqcontrol_w(uint8_t data) { - m_upd7759->reset_w(data & 2); - m_upd7759->start_w(data & 1); + m_upd7759->reset_w(BIT(data, 1)); + m_upd7759->start_w(!BIT(data, 0)); - m_sound_irq_mask = data & 4; + m_sound_irq_mask = BIT(data, 2); } void devstors_state::sh_irqcontrol_w(uint8_t data) { - m_sound_irq_mask = data & 4; + m_sound_irq_mask = BIT(data, 2); } void mainevt_state::sh_bankswitch_w(uint8_t data) @@ -601,6 +600,11 @@ void base_state::machine_start() save_item(NAME(m_sound_irq_mask)); } +void mainevt_state::machine_reset() +{ + sh_irqcontrol_w(0); +} + void devstors_state::machine_start() { base_state::machine_start(); diff --git a/src/mame/konami/tmnt.cpp b/src/mame/konami/tmnt.cpp index 184f724521b..a7e1cc87af3 100644 --- a/src/mame/konami/tmnt.cpp +++ b/src/mame/konami/tmnt.cpp @@ -288,10 +288,10 @@ uint8_t tmnt_state::tmnt_sres_r() void tmnt_state::tmnt_sres_w(uint8_t data) { /* bit 1 resets the UPD7795C sound chip */ - m_upd7759->reset_w(data & 2); + m_upd7759->reset_w(BIT(data, 1)); /* bit 2 plays the title music */ - if (data & 0x04) + if (BIT(data, 2)) { if (!m_samples->playing(0)) m_samples->start_raw(0, m_sampledata, 0x40000, 640000 / 32); @@ -303,7 +303,7 @@ void tmnt_state::tmnt_sres_w(uint8_t data) void tmnt_state::tmnt_upd_start_w(uint8_t data) { - m_upd7759->start_w(data & 1); + m_upd7759->start_w(!BIT(data, 0)); } uint8_t tmnt_state::tmnt_upd_busy_r() @@ -2107,8 +2107,8 @@ MACHINE_RESET_MEMBER(tmnt_state,tmnt) machine_reset(); /* the UPD7759 control flip-flops are cleared: /ST is 1, /RESET is 0 */ - m_upd7759->start_w(0); - m_upd7759->reset_w(1); + m_upd7759->start_w(1); + m_upd7759->reset_w(0); } void tmnt_state::tmnt(machine_config &config) -- cgit v1.2.3