mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
Popeye: Implemented nmi acknowledge and TPP2 watchdog. [smf]
This commit is contained in:
parent
caf9eb6576
commit
2e332cd02f
@ -1,5 +1,5 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nicola Salmoria, Couriersud
|
||||
// copyright-holders:smf, Nicola Salmoria, Couriersud
|
||||
// thanks-to: Marc Lafontaine
|
||||
/***************************************************************************
|
||||
|
||||
@ -21,7 +21,6 @@ Notes:
|
||||
#include "machine/eepromser.h"
|
||||
#include "machine/netlist.h"
|
||||
#include "netlist/devices/net_lib.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
|
||||
@ -121,6 +120,22 @@ void tnx1_state::driver_start()
|
||||
save_item(NAME(m_prot1));
|
||||
save_item(NAME(m_prot_shift));
|
||||
save_item(NAME(m_nmi_enabled));
|
||||
|
||||
m_prot0 = 0;
|
||||
m_prot1 = 0;
|
||||
m_prot_shift = 0;
|
||||
m_nmi_enabled = false;
|
||||
}
|
||||
|
||||
void tpp2_state::driver_start()
|
||||
{
|
||||
tnx1_state::driver_start();
|
||||
|
||||
save_item(NAME(m_watchdog_enabled));
|
||||
save_item(NAME(m_watchdog_counter));
|
||||
|
||||
m_watchdog_enabled = false;
|
||||
m_watchdog_counter = 0;
|
||||
}
|
||||
|
||||
void tnx1_state::decrypt_rom()
|
||||
@ -153,7 +168,21 @@ void tpp2_state::decrypt_rom()
|
||||
|
||||
WRITE8_MEMBER(tnx1_state::refresh_w)
|
||||
{
|
||||
m_nmi_enabled = ((offset >> 8) & 1) != 0;
|
||||
const bool nmi_enabled = ((offset >> 8) & 1) != 0;
|
||||
if (m_nmi_enabled != nmi_enabled)
|
||||
{
|
||||
m_nmi_enabled = nmi_enabled;
|
||||
|
||||
if (!m_nmi_enabled)
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tpp2_state::refresh_w)
|
||||
{
|
||||
tnx1_state::refresh_w(space, offset, data, mem_mask);
|
||||
|
||||
m_watchdog_enabled = ((offset >> 9) & 1) != 0;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(tnx1_state::screen_vblank)
|
||||
@ -166,10 +195,32 @@ WRITE_LINE_MEMBER(tnx1_state::screen_vblank)
|
||||
|
||||
m_field ^= 1;
|
||||
if (m_nmi_enabled)
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(tpp2_state::screen_vblank)
|
||||
{
|
||||
tnx1_state::screen_vblank(state);
|
||||
|
||||
if (state)
|
||||
{
|
||||
uint8_t watchdog_counter = m_watchdog_counter;
|
||||
|
||||
if (m_nmi_enabled || !m_watchdog_enabled)
|
||||
watchdog_counter = 0;
|
||||
else
|
||||
watchdog_counter = (watchdog_counter + 1) & 0xf;
|
||||
|
||||
if ((watchdog_counter ^ m_watchdog_counter) & 4)
|
||||
{
|
||||
m_maincpu->set_input_line(INPUT_LINE_RESET, watchdog_counter & 4 ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_aysnd->reset();
|
||||
}
|
||||
|
||||
m_watchdog_counter = watchdog_counter;
|
||||
}
|
||||
}
|
||||
|
||||
/* the protection device simply returns the last two values written shifted left */
|
||||
/* by a variable amount. */
|
||||
|
@ -1,7 +1,8 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nicola Salmoria, Couriersud
|
||||
// copyright-holders:smf, Nicola Salmoria, Couriersud
|
||||
// thanks-to: Marc Lafontaine
|
||||
|
||||
#include "sound/ay8910.h"
|
||||
#include "video/resnet.h"
|
||||
|
||||
class tnx1_state : public driver_device
|
||||
@ -10,6 +11,7 @@ public:
|
||||
tnx1_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_aysnd(*this, "aysnd"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_dmasource(*this, "dmasource"),
|
||||
@ -24,6 +26,7 @@ public:
|
||||
|
||||
protected:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<ay8910_device> m_aysnd;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
required_shared_ptr<uint8_t> m_dmasource;
|
||||
@ -52,7 +55,7 @@ protected:
|
||||
uint8_t m_dswbit;
|
||||
bool m_nmi_enabled;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(refresh_w);
|
||||
virtual DECLARE_WRITE8_MEMBER(refresh_w);
|
||||
DECLARE_READ8_MEMBER(protection_r);
|
||||
DECLARE_WRITE8_MEMBER(protection_w);
|
||||
DECLARE_WRITE8_MEMBER(popeye_videoram_w);
|
||||
@ -64,7 +67,7 @@ protected:
|
||||
virtual void video_start() override;
|
||||
virtual DECLARE_PALETTE_INIT(palette_init);
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
|
||||
virtual DECLARE_WRITE_LINE_MEMBER(screen_vblank);
|
||||
void update_palette();
|
||||
virtual void decrypt_rom();
|
||||
virtual void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
@ -97,6 +100,12 @@ class tpp2_state : public tpp1_state
|
||||
public:
|
||||
virtual void config(machine_config &config) override;
|
||||
protected:
|
||||
bool m_watchdog_enabled;
|
||||
uint8_t m_watchdog_counter;
|
||||
|
||||
virtual void driver_start() override;
|
||||
virtual DECLARE_WRITE8_MEMBER(refresh_w) override;
|
||||
virtual DECLARE_WRITE_LINE_MEMBER(screen_vblank) override;
|
||||
virtual void maincpu_program_map(address_map &map) override;
|
||||
virtual void decrypt_rom() override;
|
||||
virtual void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nicola Salmoria, Couriersud
|
||||
// copyright-holders:smf, Nicola Salmoria, Couriersud
|
||||
// thanks-to: Marc Lafontaine
|
||||
/***************************************************************************
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user