mainevt, tmnt: Correct polarity of uPD7759 ST line writes

This commit is contained in:
AJR 2023-05-08 16:46:55 -04:00
parent e2035e416b
commit a36456e507
2 changed files with 18 additions and 14 deletions

View File

@ -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<upd7759_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();

View File

@ -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)