summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-10-16 22:07:47 -0400
committer AJR <ajrhacker@users.noreply.github.com>2021-10-16 22:07:49 -0400
commit02c66ada3a3703798a8179ff71e96b6af79195c4 (patch)
tree2c70846e0c6ba79abab1622db9e41c98b8d798ec /src/mame
parent43e25e6168e5562d165054d47e4f8325359c2a34 (diff)
marineb.cpp: Updates and fixes
- More accurate interrupt generation - Add watchdog timer - Workaround for hang after soft reset
Diffstat (limited to 'src/mame')
-rw-r--r--src/mame/drivers/marineb.cpp25
-rw-r--r--src/mame/includes/marineb.h12
2 files changed, 32 insertions, 5 deletions
diff --git a/src/mame/drivers/marineb.cpp b/src/mame/drivers/marineb.cpp
index 4ed3ad76276..93f7811bb66 100644
--- a/src/mame/drivers/marineb.cpp
+++ b/src/mame/drivers/marineb.cpp
@@ -53,6 +53,8 @@ void marineb_state::machine_reset()
{
m_palette_bank = 0;
m_column_scroll = 0;
+
+ m_maincpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero); // needed to prevent NMI from occurring on soft reset due to race condition
}
void marineb_state::machine_start()
@@ -74,6 +76,14 @@ WRITE_LINE_MEMBER(marineb_state::nmi_mask_w)
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
+uint8_t marineb_state::system_watchdog_r()
+{
+ // '161 counter is cleared by RD7, not WR7 (except on wanted and bcruzm12)
+ if (!machine().side_effects_disabled())
+ m_watchdog->reset_w();
+ return m_system->read();
+}
+
void marineb_state::marineb_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
@@ -88,7 +98,13 @@ void marineb_state::marineb_map(address_map &map)
map(0xa000, 0xa000).portr("P2");
map(0xa800, 0xa800).portr("P1");
map(0xb000, 0xb000).portr("DSW");
- map(0xb800, 0xb800).portr("SYSTEM").nopw(); /* also watchdog */
+ map(0xb800, 0xb800).r(FUNC(marineb_state::system_watchdog_r)).nopw();
+}
+
+void marineb_state::wanted_map(address_map &map)
+{
+ marineb_map(map);
+ map(0xb800, 0xb800).portr("SYSTEM").w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
}
@@ -525,13 +541,13 @@ GFXDECODE_END
WRITE_LINE_MEMBER(marineb_state::marineb_vblank_irq)
{
if (state && m_irq_mask)
- m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
+ m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
WRITE_LINE_MEMBER(marineb_state::wanted_vblank_irq)
{
if (state && m_irq_mask)
- m_maincpu->set_input_line(0, HOLD_LINE);
+ m_maincpu->set_input_line(0, ASSERT_LINE);
}
@@ -547,6 +563,8 @@ void marineb_state::marineb(machine_config &config)
m_outlatch->q_out_cb<1>().set(FUNC(marineb_state::flipscreen_y_w));
m_outlatch->q_out_cb<2>().set(FUNC(marineb_state::flipscreen_x_w));
+ WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 16);
+
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
@@ -602,6 +620,7 @@ void marineb_state::wanted(machine_config &config)
marineb(config);
/* basic machine hardware */
+ m_maincpu->set_addrmap(AS_PROGRAM, &marineb_state::wanted_map);
m_maincpu->set_addrmap(AS_IO, &marineb_state::wanted_io_map);
m_outlatch->q_out_cb<0>().set(FUNC(marineb_state::irq_mask_w));
diff --git a/src/mame/includes/marineb.h b/src/mame/includes/marineb.h
index 312b9135a1d..f5a0bec2b62 100644
--- a/src/mame/includes/marineb.h
+++ b/src/mame/includes/marineb.h
@@ -6,6 +6,7 @@
#pragma once
#include "machine/74259.h"
+#include "machine/watchdog.h"
#include "emupal.h"
#include "tilemap.h"
@@ -17,11 +18,13 @@ public:
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_colorram(*this, "colorram"),
+ m_system(*this, "SYSTEM"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_outlatch(*this, "outlatch")
+ m_outlatch(*this, "outlatch"),
+ m_watchdog(*this, "watchdog")
{ }
void springer(machine_config &config);
@@ -36,6 +39,7 @@ private:
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_colorram;
+ required_ioport m_system;
/* video-related */
tilemap_t *m_bg_tilemap;
@@ -51,6 +55,7 @@ private:
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<ls259_device> m_outlatch;
+ required_device<watchdog_timer_device> m_watchdog;
bool m_irq_mask;
DECLARE_WRITE_LINE_MEMBER(irq_mask_w);
@@ -62,6 +67,7 @@ private:
void marineb_palette_bank_1_w(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(flipscreen_x_w);
DECLARE_WRITE_LINE_MEMBER(flipscreen_y_w);
+ uint8_t system_watchdog_r();
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -75,8 +81,10 @@ private:
DECLARE_WRITE_LINE_MEMBER(marineb_vblank_irq);
DECLARE_WRITE_LINE_MEMBER(wanted_vblank_irq);
void set_tilemap_scrolly( int cols );
- void marineb_io_map(address_map &map);
+
void marineb_map(address_map &map);
+ void marineb_io_map(address_map &map);
+ void wanted_map(address_map &map);
void wanted_io_map(address_map &map);
};