summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-09-05 09:25:18 -0400
committer AJR <ajrhacker@users.noreply.github.com>2017-09-05 09:25:18 -0400
commite13a1461d5b99d903671d79a94de5b728a32c079 (patch)
tree442f8a6e9eb81a24e44f1b29f9b21cd51ee9aeb7
parent319e2a25bbd984e34fd493db80126079c16b76a7 (diff)
suprridr: Soundlatch modernization (nw)
-rw-r--r--src/mame/drivers/suprridr.cpp48
-rw-r--r--src/mame/includes/suprridr.h10
2 files changed, 17 insertions, 41 deletions
diff --git a/src/mame/drivers/suprridr.cpp b/src/mame/drivers/suprridr.cpp
index 736cb3eed48..ac47f4aefe0 100644
--- a/src/mame/drivers/suprridr.cpp
+++ b/src/mame/drivers/suprridr.cpp
@@ -96,7 +96,11 @@
void suprridr_state::machine_start()
{
save_item(NAME(m_nmi_enable));
- save_item(NAME(m_sound_data));
+}
+
+void suprridr_state::machine_reset()
+{
+ m_soundlatch->acknowledge_w(machine().dummy_space(), 0, 0);
}
/*************************************
@@ -121,38 +125,6 @@ INTERRUPT_GEN_MEMBER(suprridr_state::main_nmi_gen)
/*************************************
*
- * Sound CPU communication
- *
- *************************************/
-
-TIMER_CALLBACK_MEMBER(suprridr_state::delayed_sound_w)
-{
- m_sound_data = param;
- m_audiocpu->set_input_line(0, ASSERT_LINE);
-}
-
-
-WRITE8_MEMBER(suprridr_state::sound_data_w)
-{
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(suprridr_state::delayed_sound_w),this), data);
-}
-
-
-READ8_MEMBER(suprridr_state::sound_data_r)
-{
- return m_sound_data;
-}
-
-
-WRITE8_MEMBER(suprridr_state::sound_irq_ack_w)
-{
- m_audiocpu->set_input_line(0, CLEAR_LINE);
-}
-
-
-
-/*************************************
- *
* Misc handlers
*
*************************************/
@@ -185,7 +157,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, suprridr_state )
AM_RANGE(0xb002, 0xb003) AM_WRITE(coin_lock_w)
AM_RANGE(0xb006, 0xb006) AM_WRITE(flipx_w)
AM_RANGE(0xb007, 0xb007) AM_WRITE(flipy_w)
- AM_RANGE(0xb800, 0xb800) AM_WRITE(sound_data_w)
+ AM_RANGE(0xb800, 0xb800) AM_DEVWRITE("soundlatch", generic_latch_8_device, write)
AM_RANGE(0xc801, 0xc801) AM_WRITE(fgdisable_w)
AM_RANGE(0xc802, 0xc802) AM_WRITE(fgscrolly_w)
AM_RANGE(0xc804, 0xc804) AM_WRITE(bgscrolly_w)
@@ -214,7 +186,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, suprridr_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x00, 0x00) AM_WRITE(sound_irq_ack_w)
+ AM_RANGE(0x00, 0x00) AM_DEVWRITE("soundlatch", generic_latch_8_device, acknowledge_w)
AM_RANGE(0x8c, 0x8d) AM_DEVWRITE("ay1", ay8910_device, address_data_w)
AM_RANGE(0x8d, 0x8d) AM_DEVREAD("ay1", ay8910_device, data_r)
AM_RANGE(0x8e, 0x8f) AM_DEVWRITE("ay2", ay8910_device, address_data_w)
@@ -379,8 +351,12 @@ static MACHINE_CONFIG_START( suprridr )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_SOUND_ADD("ay2", AY8910, XTAL_49_152MHz/32)
- MCFG_AY8910_PORT_A_READ_CB(READ8(suprridr_state, sound_data_r))
+ MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+
+ MCFG_GENERIC_LATCH_8_ADD("soundlatch")
+ MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", 0))
+ MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true)
MACHINE_CONFIG_END
diff --git a/src/mame/includes/suprridr.h b/src/mame/includes/suprridr.h
index 3bdf99fa460..1c7f5e9cfb3 100644
--- a/src/mame/includes/suprridr.h
+++ b/src/mame/includes/suprridr.h
@@ -6,6 +6,8 @@
**************************************************************************/
+#include "machine/gen_latch.h"
+
class suprridr_state : public driver_device
{
public:
@@ -13,6 +15,7 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
+ m_soundlatch(*this, "soundlatch"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_fgram(*this, "fgram"),
@@ -21,6 +24,7 @@ public:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
+ required_device<generic_latch_8_device> m_soundlatch;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
@@ -29,7 +33,6 @@ public:
required_shared_ptr<uint8_t> m_spriteram;
uint8_t m_nmi_enable;
- uint8_t m_sound_data;
tilemap_t *m_fg_tilemap;
tilemap_t *m_bg_tilemap;
tilemap_t *m_bg_tilemap_noscroll;
@@ -37,8 +40,6 @@ public:
uint8_t m_flipy;
DECLARE_WRITE8_MEMBER(nmi_enable_w);
- DECLARE_WRITE8_MEMBER(sound_data_w);
- DECLARE_WRITE8_MEMBER(sound_irq_ack_w);
DECLARE_WRITE8_MEMBER(coin_lock_w);
DECLARE_WRITE8_MEMBER(flipx_w);
DECLARE_WRITE8_MEMBER(flipy_w);
@@ -47,7 +48,6 @@ public:
DECLARE_WRITE8_MEMBER(bgscrolly_w);
DECLARE_WRITE8_MEMBER(bgram_w);
DECLARE_WRITE8_MEMBER(fgram_w);
- DECLARE_READ8_MEMBER(sound_data_r);
DECLARE_CUSTOM_INPUT_MEMBER(control_r);
@@ -55,9 +55,9 @@ public:
TILE_GET_INFO_MEMBER(get_tile_info2);
INTERRUPT_GEN_MEMBER(main_nmi_gen);
- TIMER_CALLBACK_MEMBER(delayed_sound_w);
virtual void machine_start() override;
+ virtual void machine_reset() override;
virtual void video_start() override;
DECLARE_PALETTE_INIT(suprridr);