summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2022-08-27 11:58:53 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2022-08-27 11:58:53 +1000
commit554bfeca29ce54dcf6ac4c859c48d56d2b8119b0 (patch)
treedfcf825423c56007f55e586c28c142e3fb4f168c /src
parent35fb63c8c35703ebe91ecedf7e7c825842a3d079 (diff)
zerohour: added sound via samples
Diffstat (limited to 'src')
-rw-r--r--src/mame/universal/redclash.cpp50
-rw-r--r--src/mame/universal/redclash.h6
2 files changed, 54 insertions, 2 deletions
diff --git a/src/mame/universal/redclash.cpp b/src/mame/universal/redclash.cpp
index ae49d687a34..81752ffdc70 100644
--- a/src/mame/universal/redclash.cpp
+++ b/src/mame/universal/redclash.cpp
@@ -30,10 +30,37 @@ TODO:
#include "cpu/z80/z80.h"
#include "machine/74259.h"
-#include "sound/sn76496.h"
+//#include "sound/sn76496.h"
#include "screen.h"
#include "speaker.h"
+static const char *const sample_names[] =
+{
+ "*zerohour",
+ "zh0",
+ "zh1",
+ "zh2",
+ "zh3",
+ "zh4",
+ "zh5",
+ "zh6",
+ "zh7",
+ "zh8",
+ "zh9",
+ "zh10",
+ nullptr
+};
+
+WRITE_LINE_MEMBER(redclash_state::sound_w)
+{
+ m_allow = state;
+}
+
+template <unsigned S> WRITE_LINE_MEMBER(redclash_state::sample_w)
+{
+ if (m_allow && state)
+ m_samples->start(S, S);
+}
void redclash_state::irqack_w(uint8_t data)
{
@@ -334,6 +361,7 @@ GFXDECODE_END
void redclash_state::machine_start()
{
save_item(NAME(m_gfxbank));
+ save_item(NAME(m_allow));
m_gfxbank = 0;
}
@@ -344,10 +372,22 @@ void redclash_state::zerohour(machine_config &config)
Z80(config, m_maincpu, 4_MHz_XTAL); /* 4 MHz */
m_maincpu->set_addrmap(AS_PROGRAM, &redclash_state::zerohour_map);
- LS259(config, "outlatch1"); // C1 (CS10 decode)
+ ls259_device &outlatch1(LS259(config, "outlatch1")); // C1 (CS10 decode)
+ outlatch1.q_out_cb<0>().set(FUNC(redclash_state::sample_w<0>));
+ outlatch1.q_out_cb<1>().set(FUNC(redclash_state::sample_w<1>));
+ outlatch1.q_out_cb<2>().set(FUNC(redclash_state::sample_w<2>));
+ outlatch1.q_out_cb<3>().set(FUNC(redclash_state::sample_w<3>));
+ outlatch1.q_out_cb<4>().set(FUNC(redclash_state::sample_w<4>));
+ outlatch1.q_out_cb<5>().set(FUNC(redclash_state::sample_w<5>));
+ outlatch1.q_out_cb<6>().set(FUNC(redclash_state::sample_w<6>));
+ outlatch1.q_out_cb<7>().set(FUNC(redclash_state::sample_w<7>));
ls259_device &outlatch2(LS259(config, "outlatch2")); // C2 (CS11 decode)
outlatch2.q_out_cb<0>().set(FUNC(redclash_state::star_w<0>));
+ outlatch2.q_out_cb<1>().set(FUNC(redclash_state::sample_w<8>));
+ outlatch2.q_out_cb<2>().set(FUNC(redclash_state::sound_w));
+ outlatch2.q_out_cb<3>().set(FUNC(redclash_state::sample_w<9>));
+ outlatch2.q_out_cb<4>().set(FUNC(redclash_state::sample_w<10>));
outlatch2.q_out_cb<5>().set(FUNC(redclash_state::star_w<1>));
outlatch2.q_out_cb<6>().set(FUNC(redclash_state::star_w<2>));
outlatch2.q_out_cb<7>().set(FUNC(redclash_state::flipscreen_w));
@@ -365,6 +405,12 @@ void redclash_state::zerohour(machine_config &config)
ZEROHOUR_STARS(config, m_stars, 0);
/* sound hardware */
+ SPEAKER(config, "mono").front_center();
+
+ SAMPLES(config, m_samples);
+ m_samples->set_channels(11);
+ m_samples->set_samples_names(sample_names);
+ m_samples->add_route(ALL_OUTPUTS, "mono", 0.50);
}
diff --git a/src/mame/universal/redclash.h b/src/mame/universal/redclash.h
index f35f08c7cba..67af9acbd08 100644
--- a/src/mame/universal/redclash.h
+++ b/src/mame/universal/redclash.h
@@ -13,6 +13,7 @@
#include "ladybug_v.h"
#include "emupal.h"
#include "tilemap.h"
+#include "sound/samples.h"
// redclash/zerohour
@@ -27,6 +28,7 @@ public:
, m_palette(*this, "palette")
, m_gfxdecode(*this, "gfxdecode")
, m_stars(*this, "stars")
+ , m_samples(*this, "samples")
{ }
void redclash(machine_config &config);
@@ -49,6 +51,8 @@ private:
void irqack_w(uint8_t data);
void star_reset_w(uint8_t data);
template <unsigned B> DECLARE_WRITE_LINE_MEMBER(star_w);
+ template <unsigned S> DECLARE_WRITE_LINE_MEMBER(sample_w);
+ DECLARE_WRITE_LINE_MEMBER(sound_w);
void palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(get_fg_tile_info);
@@ -65,8 +69,10 @@ private:
required_device<palette_device> m_palette;
required_device<gfxdecode_device> m_gfxdecode;
required_device<zerohour_stars_device> m_stars;
+ required_device<samples_device> m_samples;
tilemap_t *m_fg_tilemap = nullptr;
+ bool m_allow = false;
int m_gfxbank = 0; // redclash only
};