summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cam900 <dbtlrchl@naver.com>2026-04-03 02:20:44 +0900
committer GitHub <noreply@github.com>2026-04-03 04:20:44 +1100
commit447c3e75d6bf58670546bd77551927e1534dde05 (patch)
tree2e2f05d9ab4978aca01846bc377261ad04d9591e
parentc57c848c5dba0161128d18a838701f26a050f7c9 (diff)
sound/namco.cpp: Updates: (#15154)
* Use device_memory_interface for waveform memory, allow config per hardware (ex: RAM in 20pacgal.cpp). * Split Pole Position WSG into separate device. * Added address map for common 15XX/CUS30 interface. * Remove unnecessary configuration, use templated base class instead (also packed flag). * Added notes for polepos panning. * Fixed mixing. * Use logmacro.h for logging, reduced preprocessor macros, use references rather than pointers. * Split device state for per-hardware differences. * Fix allocated size for sound register area. * Made some variables const. * namco/20pacgal.cpp, namco/polepos.cpp: Corrected sound device type.
-rw-r--r--src/devices/sound/namco.cpp775
-rw-r--r--src/devices/sound/namco.h130
-rw-r--r--src/mame/namco/20pacgal.cpp13
-rw-r--r--src/mame/namco/20pacgal.h1
-rw-r--r--src/mame/namco/baraduke.cpp5
-rw-r--r--src/mame/namco/galaga.cpp20
-rw-r--r--src/mame/namco/galaga.h2
-rw-r--r--src/mame/namco/gaplus.cpp5
-rw-r--r--src/mame/namco/mappy.cpp15
-rw-r--r--src/mame/namco/namcos1.cpp7
-rw-r--r--src/mame/namco/namcos86.cpp5
-rw-r--r--src/mame/namco/pacland.cpp5
-rw-r--r--src/mame/namco/polepos.cpp28
-rw-r--r--src/mame/namco/polepos.h2
-rw-r--r--src/mame/namco/rallyx.cpp5
-rw-r--r--src/mame/namco/rallyx.h2
-rw-r--r--src/mame/namco/skykid.cpp5
-rw-r--r--src/mame/namco/tceptor.cpp5
-rw-r--r--src/mame/namco/toypop.cpp7
-rw-r--r--src/mame/pacman/jrpacman.cpp7
-rw-r--r--src/mame/pacman/pacman.cpp35
-rw-r--r--src/mame/pacman/pacman.h2
-rw-r--r--src/mame/pacman/pengo.cpp9
23 files changed, 514 insertions, 576 deletions
diff --git a/src/devices/sound/namco.cpp b/src/devices/sound/namco.cpp
index eabe6c06f35..dad6578dc3a 100644
--- a/src/devices/sound/namco.cpp
+++ b/src/devices/sound/namco.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Nicola Salmoria,Aaron Giles
/***************************************************************************
- NAMCO sound driver.
+ NAMCO WSG sound driver.
This driver handles the four known types of NAMCO wavetable sounds:
- 3-voice mono (PROM-based design: Pac-Man, Pengo, Dig Dug, etc)
@@ -29,122 +29,151 @@
#include "emu.h"
#include "namco.h"
+#include <algorithm>
-// quality parameter: internal sample rate is 192 KHz, output is 48 KHz
-#define INTERNAL_RATE 192000
+#define LOG_STREAM (1 << 1)
+
+#define VERBOSE (0)
-// 16 bits: sample bits of the stream buffer
-// 4 bits: volume
-// 4 bits: prom sample bits
-#define MIXLEVEL (1 << (16 - 4 - 4))
+#include "logmacro.h"
-// stream output level
-#define OUTPUT_LEVEL(n) ((n) * MIXLEVEL / m_voices)
+#define LOGSTREAM(...) LOGMASKED(LOG_STREAM, __VA_ARGS__)
+
+// quality parameter: internal sample rate is 192 KHz, output is 48 KHz
+static constexpr uint32_t INTERNAL_RATE = 192000;
+
+void namco_15xx_device::amap(address_map &map)
+{
+ map(0x000, 0x03f).rw(FUNC(namco_15xx_device::namco_15xx_r), FUNC(namco_15xx_device::namco_15xx_w));
+ map(0x040, 0x3ff).ram().share(m_sharedram);
+}
-// a position of waveform sample
-#define WAVEFORM_POSITION(n) (((n) >> m_f_fracbits) & 0x1f)
+void namco_cus30_device::amap(address_map &map)
+{
+ map(0x000, 0x0ff).ram().share(m_waveram);
+ map(0x100, 0x13f).rw(FUNC(namco_cus30_device::cus30_r), FUNC(namco_cus30_device::cus30_w));
+ map(0x140, 0x3ff).ram().share(m_sharedram);
+}
-DEFINE_DEVICE_TYPE(NAMCO, namco_device, "namco", "Namco")
+DEFINE_DEVICE_TYPE(NAMCO_WSG, namco_wsg_device, "namco_wsg", "Namco WSG")
+DEFINE_DEVICE_TYPE(POLEPOS_WSG, polepos_wsg_device, "polepos_wsg", "Namco Pole Position WSG")
DEFINE_DEVICE_TYPE(NAMCO_15XX, namco_15xx_device, "namco_15xx", "Namco 15xx")
DEFINE_DEVICE_TYPE(NAMCO_CUS30, namco_cus30_device, "namco_cus30", "Namco CUS30")
-namco_audio_device::namco_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+template <unsigned Voices, bool Packed>
+namco_audio_device<Voices, Packed>::namco_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_sound_interface(mconfig, *this)
+ , device_memory_interface(mconfig, *this)
+ , m_data_config("data", ENDIANNESS_BIG, 8, 8)
, m_wave_ptr(*this, DEVICE_SELF)
- , m_last_channel(nullptr)
- , m_wavedata(nullptr)
- , m_wave_size(0)
, m_sound_enable(false)
, m_stream(nullptr)
, m_namco_clock(0)
, m_sample_rate(0)
, m_f_fracbits(0)
- , m_voices(0)
- , m_stereo(false)
+ , m_soundregs(nullptr)
{
}
-namco_device::namco_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : namco_audio_device(mconfig, NAMCO, tag, owner, clock)
- , m_soundregs(nullptr)
+namco_wsg_device::namco_wsg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : namco_audio_device<3, false>(mconfig, NAMCO_WSG, tag, owner, clock)
+{
+}
+
+polepos_wsg_device::polepos_wsg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : namco_audio_device<8, false>(mconfig, POLEPOS_WSG, tag, owner, clock)
{
}
namco_15xx_device::namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : namco_audio_device(mconfig, NAMCO_15XX, tag, owner, clock)
- , m_soundregs(nullptr)
+ : namco_audio_device<8, false>(mconfig, NAMCO_15XX, tag, owner, clock)
+ , m_sharedram(*this, "sharedram")
{
}
namco_cus30_device::namco_cus30_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : namco_audio_device(mconfig, NAMCO_CUS30, tag, owner, clock)
+ : namco_audio_device<8, true>(mconfig, NAMCO_CUS30, tag, owner, clock)
+ , m_sharedram(*this, "sharedram")
+ , m_waveram(*this, "waveram")
+ , m_stereo(false)
{
}
+template <unsigned Voices, bool Packed>
+device_memory_interface::space_config_vector namco_audio_device<Voices, Packed>::memory_space_config() const
+{
+ return space_config_vector {
+ std::make_pair(0, &m_data_config)
+ };
+}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
-void namco_audio_device::device_start()
+template <unsigned Voices, bool Packed>
+void namco_audio_device<Voices, Packed>::device_start()
{
- // extract globals from the interface
- m_last_channel = m_channel_list + m_voices;
-
// build the waveform table
- build_decoded_waveform(m_wave_ptr);
+ if (!has_configured_map(0) && m_wave_ptr)
+ space(0).install_rom(0x00, 0xff, m_wave_ptr.target());
- // get stream channels
- if (m_stereo)
- m_stream = stream_alloc(0, 2, 192000);
- else
- m_stream = stream_alloc(0, 1, 192000);
+ space(0).cache(m_data);
// start with sound enabled, many games don't have a sound enable register
m_sound_enable = true;
- // register with the save state system
- if (m_wave_ptr == nullptr)
- save_pointer(NAME(m_wavedata), 0x400);
-
- save_item(NAME(m_sound_enable));
- for (int v = 0; v < MAX_VOLUME; v++)
- save_pointer(NAME(m_waveform[v]), 32 * 8 * (1+m_wave_size), v);
-
// reset all the voices
- for (sound_channel *voice = m_channel_list; voice < m_last_channel; voice++)
+ for (auto &voice : m_channel_list)
{
- voice->frequency = 0;
- voice->volume[0] = voice->volume[1] = 0;
- voice->waveform_select = 0;
- voice->counter = 0;
- voice->noise_sw = 0;
- voice->noise_state = 0;
- voice->noise_seed = 1;
- voice->noise_counter = 0;
- voice->noise_hold = 0;
+ voice.frequency = 0;
+ voice.volume[0] = voice.volume[1] = voice.volume[2] = voice.volume[3] = 0;
+ voice.waveform_select = 0;
+ voice.counter = 0;
+ voice.noise_sw = 0;
+ voice.noise_state = 0;
+ voice.noise_seed = 1;
+ voice.noise_counter = 0;
+ voice.noise_hold = 0;
}
// register with the save state system
- save_pointer(STRUCT_MEMBER(m_channel_list, frequency), m_voices);
- save_pointer(STRUCT_MEMBER(m_channel_list, counter), m_voices);
- save_pointer(STRUCT_MEMBER(m_channel_list, volume), m_voices);
- save_pointer(STRUCT_MEMBER(m_channel_list, noise_sw), m_voices);
- save_pointer(STRUCT_MEMBER(m_channel_list, noise_state), m_voices);
- save_pointer(STRUCT_MEMBER(m_channel_list, noise_seed), m_voices);
- save_pointer(STRUCT_MEMBER(m_channel_list, noise_hold), m_voices);
- save_pointer(STRUCT_MEMBER(m_channel_list, noise_counter), m_voices);
- save_pointer(STRUCT_MEMBER(m_channel_list, waveform_select), m_voices);
+ save_item(NAME(m_sound_enable));
+
+ save_item(STRUCT_MEMBER(m_channel_list, frequency));
+ save_item(STRUCT_MEMBER(m_channel_list, counter));
+ save_item(STRUCT_MEMBER(m_channel_list, volume));
+ save_item(STRUCT_MEMBER(m_channel_list, noise_sw));
+ save_item(STRUCT_MEMBER(m_channel_list, noise_state));
+ save_item(STRUCT_MEMBER(m_channel_list, noise_seed));
+ save_item(STRUCT_MEMBER(m_channel_list, noise_hold));
+ save_item(STRUCT_MEMBER(m_channel_list, noise_counter));
+ save_item(STRUCT_MEMBER(m_channel_list, waveform_select));
}
-void namco_device::device_start()
+void namco_wsg_device::device_start()
{
namco_audio_device::device_start();
- m_soundregs = make_unique_clear<uint8_t[]>(0x400);
- save_pointer(NAME(m_soundregs), 0x400);
+ // get stream channels
+ m_stream = stream_alloc(0, 1, INTERNAL_RATE);
+
+ m_soundregs = make_unique_clear<uint8_t[]>(0x20);
+ save_pointer(NAME(m_soundregs), 0x20);
+}
+
+
+void polepos_wsg_device::device_start()
+{
+ namco_audio_device::device_start();
+
+ // get stream channels
+ m_stream = stream_alloc(0, 4, INTERNAL_RATE);
+
+ m_soundregs = make_unique_clear<uint8_t[]>(0x40);
+ save_pointer(NAME(m_soundregs), 0x40);
}
@@ -152,12 +181,39 @@ void namco_15xx_device::device_start()
{
namco_audio_device::device_start();
- m_soundregs = make_unique_clear<uint8_t[]>(0x400);
- save_pointer(NAME(m_soundregs), 0x400);
+ // get stream channels
+ m_stream = stream_alloc(0, 1, INTERNAL_RATE);
+
+ // initialize
+ std::fill_n(&m_sharedram[0], m_sharedram.length(), 0);
+
+ m_soundregs = make_unique_clear<uint8_t[]>(0x40);
+ save_pointer(NAME(m_soundregs), 0x40);
+}
+
+
+void namco_cus30_device::device_start()
+{
+ // waveform RAM is internal
+ if (!has_configured_map(0))
+ space(0).install_ram(0x00, 0xff, m_waveram.target());
+
+ namco_audio_device::device_start();
+
+ // get stream channels
+ m_stream = stream_alloc(0, m_stereo ? 2 : 1, INTERNAL_RATE);
+
+ // initialize
+ std::fill_n(&m_waveram[0], m_waveram.length(), 0);
+ std::fill_n(&m_sharedram[0], m_sharedram.length(), 0);
+
+ m_soundregs = make_unique_clear<uint8_t[]>(0x40);
+ save_pointer(NAME(m_soundregs), 0x40);
}
-void namco_audio_device::device_clock_changed()
+template <unsigned Voices, bool Packed>
+void namco_audio_device<Voices, Packed>::device_clock_changed()
{
int clock_multiple;
@@ -171,73 +227,30 @@ void namco_audio_device::device_clock_changed()
// adjust output clock
m_sample_rate = m_namco_clock;
- logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", m_f_fracbits, m_namco_clock, m_sample_rate);
+ LOGSTREAM("%s: Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", machine().describe_context(), m_f_fracbits, m_namco_clock, m_sample_rate);
m_stream->set_sample_rate(m_sample_rate);
}
-
-// update the decoded waveform data
-void namco_audio_device::update_namco_waveform(int offset, uint8_t data)
+template <unsigned Voices, bool Packed>
+inline int namco_audio_device<Voices, Packed>::waveform_r(uint16_t pos)
{
- if (m_wave_size == 1)
- {
- // use full byte, first 4 high bits, then low 4 bits
- for (int v = 0; v < MAX_VOLUME; v++)
- {
- int16_t wdata = ((data >> 4) & 0x0f) - 8;
- m_waveform[v][offset * 2] = OUTPUT_LEVEL(wdata * v);
- wdata = (data & 0x0f) - 8;
- m_waveform[v][offset * 2 + 1] = OUTPUT_LEVEL(wdata * v);
- }
- }
- else
- {
- // use only low 4 bits
- for (int v = 0; v < MAX_VOLUME; v++)
- m_waveform[v][offset] = OUTPUT_LEVEL(((data & 0x0f) - 8) * v);
- }
-}
-
-
-// build the decoded waveform table
-void namco_audio_device::build_decoded_waveform(uint8_t *rgnbase)
-{
- if (rgnbase != nullptr)
- m_wavedata = rgnbase;
- else
- {
- m_waveram_alloc = make_unique_clear<uint8_t[]>(0x400);
- m_wavedata = m_waveram_alloc.get();
- }
-
- // 20pacgal has waves in RAM but old sound system
- int size;
- if (rgnbase == nullptr && m_voices != 3)
- {
- m_wave_size = 1;
- size = 32 * 16; // 32 samples, 16 waveforms
- }
- else
- {
- m_wave_size = 0;
- size = 32 * 8; // 32 samples, 8 waveforms
- }
-
- for (int v = 0; v < MAX_VOLUME; v++)
- m_waveform[v] = std::make_unique<int16_t[]>(size);
-
- for (int offset = 0; offset < 256; offset++)
- update_namco_waveform(offset, m_wavedata[offset]);
+ if (Packed) // use full byte, first 4 high bits, then low 4 bits
+ return ((m_data.read_byte((pos >> 1) & 0xff) >> (BIT(~pos, 0) << 2)) & 0x0f) - 8;
+ else // use only low 4 bits
+ return (m_data.read_byte(pos & 0xff) & 0x0f) - 8;
}
// generate sound by oversampling
-uint32_t namco_audio_device::namco_update_one(sound_stream &stream, int output, const int16_t *wave, uint32_t counter, uint32_t freq)
+template <unsigned Voices, bool Packed>
+uint32_t namco_audio_device<Voices, Packed>::namco_update_one(sound_stream &stream, int output, uint16_t select, int volume, uint32_t counter, uint32_t freq)
{
+ select <<= 5;
for (int sampindex = 0; sampindex < stream.samples(); sampindex++)
{
- stream.add_int(output, sampindex, wave[WAVEFORM_POSITION(counter)], 32768);
+ const int waveform = waveform_r(select + waveform_position(counter));
+ stream.add_int(output, sampindex, waveform * volume, MIX_RES);
counter += freq;
}
@@ -245,7 +258,8 @@ uint32_t namco_audio_device::namco_update_one(sound_stream &stream, int output,
}
-void namco_audio_device::sound_enable_w(int state)
+template <unsigned Voices, bool Packed>
+void namco_audio_device<Voices, Packed>::sound_enable_w(int state)
{
m_sound_enable = state;
}
@@ -269,9 +283,8 @@ void namco_audio_device::sound_enable_w(int state)
0x1f: ch 2 volume
*/
-void namco_device::pacman_sound_w(offs_t offset, uint8_t data)
+void namco_wsg_device::pacman_sound_w(offs_t offset, uint8_t data)
{
- sound_channel *voice;
int ch;
data &= 0x0f;
@@ -291,70 +304,15 @@ void namco_device::pacman_sound_w(offs_t offset, uint8_t data)
else
ch = (offset - 0x11) / 5;
- if (ch >= m_voices)
- return;
-
- // recompute the voice parameters
- voice = m_channel_list + ch;
- switch (offset - ch * 5)
- {
- case 0x05:
- voice->waveform_select = data & 7;
- break;
-
- case 0x10:
- case 0x11:
- case 0x12:
- case 0x13:
- case 0x14:
- // the frequency has 20 bits
- // the first voice has extra frequency bits
- voice->frequency = (ch == 0) ? m_soundregs[0x10] : 0;
- voice->frequency += (m_soundregs[ch * 5 + 0x11] << 4);
- voice->frequency += (m_soundregs[ch * 5 + 0x12] << 8);
- voice->frequency += (m_soundregs[ch * 5 + 0x13] << 12);
- voice->frequency += (m_soundregs[ch * 5 + 0x14] << 16); // always 0
- break;
-
- case 0x15:
- voice->volume[0] = data;
- break;
- }
-}
-
-void namco_cus30_device::pacman_sound_w(offs_t offset, uint8_t data)
-{
- sound_channel *voice;
- int ch;
-
- uint8_t *soundregs = &m_wavedata[0x100];
-
- data &= 0x0f;
- if (soundregs[offset] == data)
- return;
-
- // update the streams
- m_stream->update();
-
- // set the register
- soundregs[offset] = data;
-
- if (offset < 0x10)
- ch = (offset - 5) / 5;
- else if (offset == 0x10)
- ch = 0;
- else
- ch = (offset - 0x11) / 5;
-
- if (ch >= m_voices)
+ if (ch >= MAX_VOICES)
return;
// recompute the voice parameters
- voice = m_channel_list + ch;
+ sound_channel &voice = m_channel_list[ch];
switch (offset - ch * 5)
{
case 0x05:
- voice->waveform_select = data & 7;
+ voice.waveform_select = data & 7;
break;
case 0x10:
@@ -364,15 +322,15 @@ void namco_cus30_device::pacman_sound_w(offs_t offset, uint8_t data)
case 0x14:
// the frequency has 20 bits
// the first voice has extra frequency bits
- voice->frequency = (ch == 0) ? soundregs[0x10] : 0;
- voice->frequency += (soundregs[ch * 5 + 0x11] << 4);
- voice->frequency += (soundregs[ch * 5 + 0x12] << 8);
- voice->frequency += (soundregs[ch * 5 + 0x13] << 12);
- voice->frequency += (soundregs[ch * 5 + 0x14] << 16); // always 0
+ voice.frequency = (ch == 0) ? m_soundregs[0x10] : 0;
+ voice.frequency += (m_soundregs[ch * 5 + 0x11] << 4);
+ voice.frequency += (m_soundregs[ch * 5 + 0x12] << 8);
+ voice.frequency += (m_soundregs[ch * 5 + 0x13] << 12);
+ voice.frequency += (m_soundregs[ch * 5 + 0x14] << 16); // always 0
break;
case 0x15:
- voice->volume[0] = data;
+ voice.volume[0] = data;
break;
}
}
@@ -413,16 +371,13 @@ it select the 54XX/52XX outputs on those channels
0x3f ch 7
*/
-uint8_t namco_device::polepos_sound_r(offs_t offset)
+uint8_t polepos_wsg_device::polepos_sound_r(offs_t offset)
{
return m_soundregs[offset];
}
-void namco_device::polepos_sound_w(offs_t offset, uint8_t data)
+void polepos_wsg_device::polepos_sound_w(offs_t offset, uint8_t data)
{
- sound_channel *voice;
- int ch;
-
if (m_soundregs[offset] == data)
return;
@@ -432,38 +387,34 @@ void namco_device::polepos_sound_w(offs_t offset, uint8_t data)
// set the register
m_soundregs[offset] = data;
- ch = (offset & 0x1f) / 4;
+ const int ch = (offset & 0x1f) >> 2;
// recompute the voice parameters
- voice = m_channel_list + ch;
+ sound_channel &voice = m_channel_list[ch];
switch (offset & 0x23)
{
case 0x00:
case 0x01:
// the frequency has 16 bits
- voice->frequency = m_soundregs[ch * 4 + 0x00];
- voice->frequency += m_soundregs[ch * 4 + 0x01] << 8;
+ voice.frequency = m_soundregs[ch * 4 + 0x00];
+ voice.frequency += m_soundregs[ch * 4 + 0x01] << 8;
break;
case 0x23:
- voice->waveform_select = data & 7;
+ voice.waveform_select = data & 7;
[[fallthrough]];
case 0x02:
case 0x03:
- voice->volume[0] = voice->volume[1] = 0;
// front speakers ?
- voice->volume[0] += m_soundregs[ch * 4 + 0x03] >> 4;
- voice->volume[1] += m_soundregs[ch * 4 + 0x03] & 0x0f;
+ voice.volume[0] = m_soundregs[ch * 4 + 0x03] >> 4;
+ voice.volume[1] = m_soundregs[ch * 4 + 0x03] & 0x0f;
// rear speakers ?
- voice->volume[0] += m_soundregs[ch * 4 + 0x23] >> 4;
- voice->volume[1] += m_soundregs[ch * 4 + 0x02] >> 4;
-
- voice->volume[0] /= 2;
- voice->volume[1] /= 2;
+ voice.volume[2] = m_soundregs[ch * 4 + 0x23] >> 4;
+ voice.volume[3] = m_soundregs[ch * 4 + 0x02] >> 4;
// if 54XX or 52XX selected, silence this voice
if (m_soundregs[ch * 4 + 0x23] & 8)
- voice->volume[0] = voice->volume[1] = 0;
+ voice.volume[0] = voice.volume[1] = voice.volume[2] = voice.volume[3] = 0;
break;
}
}
@@ -496,9 +447,6 @@ Possibly offsets 0x00 and 0x01 can be used to set the fractional bits.
void namco_15xx_device::namco_15xx_w(offs_t offset, uint8_t data)
{
- sound_channel *voice;
- int ch;
-
if (m_soundregs[offset] == data)
return;
@@ -508,36 +456,40 @@ void namco_15xx_device::namco_15xx_w(offs_t offset, uint8_t data)
// set the register
m_soundregs[offset] = data;
- ch = offset / 8;
- if (ch >= m_voices)
+ const int ch = offset >> 3;
+ if (ch >= MAX_VOICES)
return;
// recompute the voice parameters
- voice = m_channel_list + ch;
+ sound_channel &voice = m_channel_list[ch];
switch (offset & 7)
{
case 0x02:
- voice->counter &= util::make_bitmask<uint32_t>(m_f_fracbits);
- voice->counter |= uint32_t(data & 0x1f) << m_f_fracbits;
+ voice.counter &= util::make_bitmask<uint32_t>(m_f_fracbits);
+ voice.counter |= uint32_t(data & 0x1f) << m_f_fracbits;
break;
case 0x03:
- voice->volume[0] = data & 0x0f;
+ voice.volume[0] = data & 0x0f;
break;
case 0x06:
- voice->waveform_select = (data >> 4) & 7;
+ voice.waveform_select = (data >> 4) & 7;
[[fallthrough]];
case 0x04:
case 0x05:
// the frequency has 20 bits
- voice->frequency = m_soundregs[ch * 8 + 0x04];
- voice->frequency += m_soundregs[ch * 8 + 0x05] << 8;
- voice->frequency += (m_soundregs[ch * 8 + 0x06] & 15) << 16; // high bits are from here
+ voice.frequency = m_soundregs[ch * 8 + 0x04];
+ voice.frequency += m_soundregs[ch * 8 + 0x05] << 8;
+ voice.frequency += (m_soundregs[ch * 8 + 0x06] & 15) << 16; // high bits are from here
break;
}
}
+uint8_t namco_15xx_device::namco_15xx_r(offs_t offset)
+{
+ return m_soundregs[offset];
+}
/********************************************************************************/
@@ -565,297 +517,252 @@ void namco_15xx_device::namco_15xx_w(offs_t offset, uint8_t data)
0x3c ch 0 noise sw
*/
-void namco_cus30_device::namcos1_sound_w(offs_t offset, uint8_t data)
+void namco_cus30_device::cus30_w(offs_t offset, uint8_t data)
{
- sound_channel *voice;
-
// verify the offset
if (offset > 63)
{
- logerror("NAMCOS1 sound: Attempting to write past the 64 registers segment\n");
+ logerror("%s: NAMCOS1 sound: Attempting to write past the 64 registers segment\n", machine().describe_context());
return;
}
- uint8_t *soundregs = &m_wavedata[0x100];
-
- if (soundregs[offset] == data)
+ if (m_soundregs[offset] == data)
return;
// update the streams
m_stream->update();
// set the register
- soundregs[offset] = data;
+ m_soundregs[offset] = data;
- int ch = offset / 8;
- if (ch >= m_voices)
+ const int ch = offset >> 3;
+ if (ch >= MAX_VOICES)
return;
// recompute the voice parameters
- voice = m_channel_list + ch;
+ sound_channel &voice = m_channel_list[ch];
switch (offset & 7)
{
case 0x00:
- voice->volume[0] = data & 0x0f;
+ voice.volume[0] = data & 0x0f;
break;
case 0x01:
- voice->waveform_select = (data >> 4) & 15;
+ voice.waveform_select = (data >> 4) & 15;
[[fallthrough]];
case 0x02:
case 0x03:
// the frequency has 20 bits
- voice->frequency = (soundregs[ch * 8 + 0x01] & 15) << 16; // high bits are from here
- voice->frequency += soundregs[ch * 8 + 0x02] << 8;
- voice->frequency += soundregs[ch * 8 + 0x03];
+ voice.frequency = (m_soundregs[ch * 8 + 0x01] & 15) << 16; // high bits are from here
+ voice.frequency += m_soundregs[ch * 8 + 0x02] << 8;
+ voice.frequency += m_soundregs[ch * 8 + 0x03];
break;
case 0x04:
- voice->volume[1] = data & 0x0f;
+ {
+ voice.volume[1] = data & 0x0f;
- int nssw = ((data & 0x80) >> 7);
- if (++voice == m_last_channel)
- voice = m_channel_list;
- voice->noise_sw = nssw;
+ sound_channel &voice2 = m_channel_list[(ch + 1) & 7];
+ voice2.noise_sw = BIT(data, 7);
+ }
break;
}
}
-void namco_cus30_device::namcos1_cus30_w(offs_t offset, uint8_t data)
+uint8_t namco_cus30_device::cus30_r(offs_t offset)
{
- if (offset < 0x100)
- {
- if (m_wavedata[offset] != data)
- {
- // update the streams
- m_stream->update();
-
- m_wavedata[offset] = data;
+ const int ch = offset >> 3;
+ const int reg = offset & 7;
- // update the decoded waveform table
- update_namco_waveform(offset, data);
- }
+ // reading from register 5 returns the counter (used by baraduke)
+ if (ch < MAX_VOICES && reg == 5)
+ {
+ m_stream->update();
+ return waveform_position(m_channel_list[ch].counter);
}
- else if (offset < 0x140)
- namcos1_sound_w(offset - 0x100, data);
- else
- m_wavedata[offset] = data;
+
+ return m_soundregs[offset];
}
-uint8_t namco_cus30_device::namcos1_cus30_r(offs_t offset)
+//-------------------------------------------------
+// sound_stream_update - handle a stream update
+//-------------------------------------------------
+
+template <unsigned Voices, bool Packed>
+void namco_audio_device<Voices, Packed>::sound_stream_update(sound_stream &stream)
{
- if (offset >= 0x100 && offset < 0x140)
- {
- int ch = (offset - 0x100) / 8;
- int reg = offset & 7;
+ // if no sound, we're done
+ if (!m_sound_enable)
+ return;
- // reading from register 5 returns the counter (used by baraduke)
- if (ch < m_voices && reg == 5)
+ // loop over each voice and add its contribution
+ for (auto &voice : m_channel_list)
+ {
+ const int v = voice.volume[0];
{
- m_stream->update();
- return WAVEFORM_POSITION(m_channel_list[ch].counter);
+ // only update if we have non-zero volume
+ if (v)
+ {
+ // generate sound into buffer and update the counter for this voice
+ voice.counter = namco_update_one(stream, 0, voice.waveform_select, v, voice.counter, voice.frequency);
+ }
}
}
-
- return m_wavedata[offset];
}
-uint8_t namco_15xx_device::sharedram_r(offs_t offset)
+void namco_wsg_device::sound_stream_update(sound_stream &stream)
{
- return m_soundregs[offset];
+ namco_audio_device::sound_stream_update(stream);
}
-void namco_15xx_device::sharedram_w(offs_t offset, uint8_t data)
+void polepos_wsg_device::sound_stream_update(sound_stream &stream)
{
- if (offset < 0x40)
- namco_15xx_w(offset, data);
- else
+ // if no sound, we're done
+ if (!m_sound_enable)
+ return;
+
+ // loop over each voice and add its contribution
+ for (auto &voice : m_channel_list)
{
- m_soundregs[offset] = data;
+ const int flv = voice.volume[0];
+ const int frv = voice.volume[1];
+ const int rlv = voice.volume[2];
+ const int rrv = voice.volume[3];
+
+ // save the counter for this voice
+ uint32_t c = voice.counter;
+
+ // only update if we have non-zero front left volume
+ if (flv)
+ {
+ // generate sound into the buffer
+ c = namco_update_one(stream, 0, voice.waveform_select, flv, voice.counter, voice.frequency);
+ }
+
+ // only update if we have non-zero front right volume
+ if (frv)
+ {
+ // generate sound into the buffer
+ c = namco_update_one(stream, 1, voice.waveform_select, frv, voice.counter, voice.frequency);
+ }
+
+
+ // only update if we have non-zero rear left volume
+ if (rlv)
+ {
+ // generate sound into the buffer
+ c = namco_update_one(stream, 2, voice.waveform_select, rlv, voice.counter, voice.frequency);
+ }
+
+ // only update if we have non-zero rear right volume
+ if (rrv)
+ {
+ // generate sound into the buffer
+ c = namco_update_one(stream, 3, voice.waveform_select, rrv, voice.counter, voice.frequency);
+ }
+
+ // update the counter for this voice
+ voice.counter = c;
}
}
-//-------------------------------------------------
-// sound_stream_update - handle a stream update
-//-------------------------------------------------
+void namco_15xx_device::sound_stream_update(sound_stream &stream)
+{
+ namco_audio_device::sound_stream_update(stream);
+}
-void namco_audio_device::sound_stream_update(sound_stream &stream)
+void namco_cus30_device::sound_stream_update(sound_stream &stream)
{
- if (m_stereo)
+ // if no sound, we're done
+ if (!m_sound_enable)
+ return;
+
+ // loop over each voice and add its contribution
+ for (auto &voice : m_channel_list)
{
- // if no sound, we're done
- if (!m_sound_enable)
- return;
+ const int lv = voice.volume[0];
+ const int rv = voice.volume[1];
- // loop over each voice and add its contribution
- for (sound_channel *voice = m_channel_list; voice < m_last_channel; voice++)
+ if (voice.noise_sw)
{
- int lv = voice->volume[0];
- int rv = voice->volume[1];
+ const int f = voice.frequency & 0xff;
- if (voice->noise_sw)
+ // only update if we have non-zero volume
+ if (lv || rv)
{
- int f = voice->frequency & 0xff;
-
- // only update if we have non-zero volume
- if (lv || rv)
+ const int hold_time = 1 << (m_f_fracbits - 16);
+ int hold = voice.noise_hold;
+ const uint32_t delta = f << 4;
+ uint32_t c = voice.noise_counter;
+ const int16_t l_noise_data = 0x07 * (lv >> 1);
+ const int16_t r_noise_data = m_stereo ? (0x07 * (rv >> 1)) : 0;
+
+ // add our contribution
+ for (int i = 0; i < stream.samples(); i++)
{
- int hold_time = 1 << (m_f_fracbits - 16);
- int hold = voice->noise_hold;
- uint32_t delta = f << 4;
- uint32_t c = voice->noise_counter;
- int16_t l_noise_data = OUTPUT_LEVEL(0x07 * (lv >> 1));
- int16_t r_noise_data = OUTPUT_LEVEL(0x07 * (rv >> 1));
-
- // add our contribution
- for (int i = 0; i < stream.samples(); i++)
+ if (voice.noise_state)
{
- if (voice->noise_state)
- {
- stream.add_int(0, i, l_noise_data, 32768);
- stream.add_int(1, i, r_noise_data, 32768);
- }
- else
- {
- stream.add_int(0, i, -l_noise_data, 32768);
- stream.add_int(1, i, -r_noise_data, 32768);
- }
-
- if (hold)
- {
- hold--;
- continue;
- }
-
- hold = hold_time;
-
- c += delta;
- int cnt = (c >> 12);
- c &= (1 << 12) - 1;
- for( ;cnt > 0; cnt--)
- {
- if ((voice->noise_seed + 1) & 2) voice->noise_state ^= 1;
- if (voice->noise_seed & 1) voice->noise_seed ^= 0x28000;
- voice->noise_seed >>= 1;
- }
+ stream.add_int(0, i, l_noise_data, MIX_RES);
+ if (m_stereo)
+ stream.add_int(1, i, r_noise_data, MIX_RES);
+ }
+ else
+ {
+ stream.add_int(0, i, -l_noise_data, MIX_RES);
+ if (m_stereo)
+ stream.add_int(1, i, -r_noise_data, MIX_RES);
}
- // update the counter and hold time for this voice
- voice->noise_counter = c;
- voice->noise_hold = hold;
- }
- }
- else
- {
- // save the counter for this voice
- uint32_t c = voice->counter;
-
- // only update if we have non-zero left volume
- if (lv)
- {
- const int16_t *lw = &m_waveform[lv][voice->waveform_select * 32];
-
- // generate sound into the buffer
- c = namco_update_one(stream, 0, lw, voice->counter, voice->frequency);
- }
+ if (hold)
+ {
+ hold--;
+ continue;
+ }
- // only update if we have non-zero right volume
- if (rv)
- {
- const int16_t *rw = &m_waveform[rv][voice->waveform_select * 32];
+ hold = hold_time;
- // generate sound into the buffer
- c = namco_update_one(stream, 1, rw, voice->counter, voice->frequency);
+ c += delta;
+ int cnt = (c >> 12);
+ c &= (1 << 12) - 1;
+ for ( ;cnt > 0; cnt--)
+ {
+ if ((voice.noise_seed + 1) & 2) voice.noise_state ^= 1;
+ if (voice.noise_seed & 1) voice.noise_seed ^= 0x28000;
+ voice.noise_seed >>= 1;
+ }
}
- // update the counter for this voice
- voice->counter = c;
+ // update the counter and hold time for this voice
+ voice.noise_counter = c;
+ voice.noise_hold = hold;
}
}
- }
- else
- {
- sound_channel *voice;
-
- // if no sound, we're done
- if (!m_sound_enable)
- return;
-
- // loop over each voice and add its contribution
- for (voice = m_channel_list; voice < m_last_channel; voice++)
+ else
{
- int v = voice->volume[0];
- if (voice->noise_sw)
- {
- int f = voice->frequency & 0xff;
-
- // only update if we have non-zero volume
- if (v)
- {
- int hold_time = 1 << (m_f_fracbits - 16);
- int hold = voice->noise_hold;
- uint32_t delta = f << 4;
- uint32_t c = voice->noise_counter;
- int16_t noise_data = OUTPUT_LEVEL(0x07 * (v >> 1));
-
- // add our contribution
- for (int i = 0; i < stream.samples(); i++)
- {
- if (voice->noise_state)
- stream.add_int(0, i, noise_data, 32768);
- else
- stream.add_int(0, i, -noise_data, 32768);
-
- if (hold)
- {
- hold--;
- continue;
- }
-
- hold = hold_time;
-
- c += delta;
- int cnt = (c >> 12);
- c &= (1 << 12) - 1;
- for( ;cnt > 0; cnt--)
- {
- if ((voice->noise_seed + 1) & 2) voice->noise_state ^= 1;
- if (voice->noise_seed & 1) voice->noise_seed ^= 0x28000;
- voice->noise_seed >>= 1;
- }
- }
+ // save the counter for this voice
+ uint32_t c = voice.counter;
- // update the counter and hold time for this voice
- voice->noise_counter = c;
- voice->noise_hold = hold;
- }
- }
- else
+ // only update if we have non-zero left volume
+ if (lv)
{
- // only update if we have non-zero volume
- if (v)
- {
- const int16_t *w = &m_waveform[v][voice->waveform_select * 32];
+ // generate sound into the buffer
+ c = namco_update_one(stream, 0, voice.waveform_select, lv, voice.counter, voice.frequency);
+ }
- // generate sound into buffer and update the counter for this voice
- voice->counter = namco_update_one(stream, 0, w, voice->counter, voice->frequency);
- }
+ // only update if we have non-zero right volume
+ if (rv && m_stereo)
+ {
+ // generate sound into the buffer
+ c = namco_update_one(stream, 1, voice.waveform_select, rv, voice.counter, voice.frequency);
}
+
+ // update the counter for this voice
+ voice.counter = c;
}
}
}
-void namco_device::sound_stream_update(sound_stream &stream)
-{
- namco_audio_device::sound_stream_update(stream);
-}
-
-void namco_15xx_device::sound_stream_update(sound_stream &stream)
-{
- namco_audio_device::sound_stream_update(stream);
-}
-
-void namco_cus30_device::sound_stream_update(sound_stream &stream)
-{
- namco_audio_device::sound_stream_update(stream);
-}
+// template class instantiation
+template class namco_audio_device<3, false>;
+template class namco_audio_device<8, false>;
+template class namco_audio_device<8, true>;
diff --git a/src/devices/sound/namco.h b/src/devices/sound/namco.h
index ac37d4d4aa3..0494bd69bfb 100644
--- a/src/devices/sound/namco.h
+++ b/src/devices/sound/namco.h
@@ -6,130 +6,164 @@
#pragma once
+template <unsigned Voices, bool Packed>
class namco_audio_device : public device_t,
- public device_sound_interface
+ public device_sound_interface,
+ public device_memory_interface
{
public:
// configuration
- void set_voices(int voices) { m_voices = voices; }
- void set_stereo(bool stereo) { m_stereo = stereo; }
-
void sound_enable_w(int state);
protected:
- static constexpr unsigned MAX_VOICES = 8;
- static constexpr unsigned MAX_VOLUME = 16;
+ static inline constexpr unsigned MAX_VOICES = Voices;
+ static inline constexpr unsigned MAX_VOLUME = 16;
+ static inline constexpr int32_t MIX_RES = 128 * MAX_VOICES;
// this structure defines the parameters for a channel
struct sound_channel
{
- uint32_t frequency;
- uint32_t counter;
- int32_t volume[2];
- int32_t noise_sw;
- int32_t noise_state;
- int32_t noise_seed;
- uint32_t noise_counter;
- int32_t noise_hold;
- int32_t waveform_select;
+ uint32_t frequency = 0;
+ uint32_t counter = 0;
+ int32_t volume[4]{};
+ int32_t noise_sw = 0;
+ int32_t noise_state = 0;
+ int32_t noise_seed = 1;
+ uint32_t noise_counter = 0;
+ int32_t noise_hold = 0;
+ uint16_t waveform_select = 0;
};
namco_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- // device-level overrides
+ // device_t implementation
virtual void device_start() override ATTR_COLD;
virtual void device_clock_changed() override;
+ // device_memory_interface overrides
+ virtual space_config_vector memory_space_config() const override ATTR_COLD;
+
+ virtual void sound_stream_update(sound_stream &stream) override;
+
// internal state
- void build_decoded_waveform( uint8_t *rgnbase );
- void update_namco_waveform(int offset, uint8_t data);
- uint32_t namco_update_one(sound_stream &stream, int output, const int16_t *wave, uint32_t counter, uint32_t freq);
+ void build_decoded_waveform(uint8_t *rgnbase);
+ uint32_t namco_update_one(sound_stream &stream, int output, uint16_t select, int volume, uint32_t counter, uint32_t freq);
+
+ // a position of waveform sample
+ uint8_t waveform_position(int n) const { return (n >> m_f_fracbits) & 0x1f; }
+
+ // get waveform
+ int waveform_r(uint16_t pos);
+
+ // address space
+ const address_space_config m_data_config;
+ memory_access<8, 0, 0, ENDIANNESS_BIG>::cache m_data;
// waveform region
optional_region_ptr<uint8_t> m_wave_ptr;
// data about the sound system
sound_channel m_channel_list[MAX_VOICES];
- sound_channel *m_last_channel;
- uint8_t *m_wavedata;
// global sound parameters
- int m_wave_size;
bool m_sound_enable;
sound_stream *m_stream;
- int m_namco_clock;
- int m_sample_rate;
- int m_f_fracbits;
-
- int m_voices; // number of voices
- bool m_stereo; // set to indicate stereo (e.g., System 1)
+ int32_t m_namco_clock;
+ int32_t m_sample_rate;
+ int32_t m_f_fracbits;
std::unique_ptr<uint8_t[]> m_waveram_alloc;
- // decoded waveform table
- std::unique_ptr<int16_t[]> m_waveform[MAX_VOLUME];
+ std::unique_ptr<uint8_t[]> m_soundregs;
- virtual void sound_stream_update(sound_stream &stream) override;
};
-class namco_device : public namco_audio_device
+class namco_wsg_device : public namco_audio_device<3, false>
{
public:
- namco_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ namco_wsg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void pacman_sound_w(offs_t offset, uint8_t data);
+protected:
+ // device_t implementation
+ virtual void device_start() override ATTR_COLD;
+
+ virtual void sound_stream_update(sound_stream &stream) override;
+};
+
+
+class polepos_wsg_device : public namco_audio_device<8, false>
+{
+public:
+ // unverified and/or incorrect panning?
+ static constexpr feature_type imperfect_features() { return feature::SOUND; }
+
+ polepos_wsg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
uint8_t polepos_sound_r(offs_t offset);
void polepos_sound_w(offs_t offset, uint8_t data);
protected:
- // device-level overrides
+ // device_t implementation
virtual void device_start() override ATTR_COLD;
virtual void sound_stream_update(sound_stream &stream) override;
-
-private:
- std::unique_ptr<uint8_t[]> m_soundregs;
};
-class namco_15xx_device : public namco_audio_device
+class namco_15xx_device : public namco_audio_device<8, false>
{
public:
namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ uint8_t namco_15xx_r(offs_t offset);
void namco_15xx_w(offs_t offset, uint8_t data);
- uint8_t sharedram_r(offs_t offset);
- void sharedram_w(offs_t offset, uint8_t data);
+
+ void amap(address_map &map) ATTR_COLD;
protected:
- // device-level overrides
+ // device_t implementation
virtual void device_start() override ATTR_COLD;
virtual void sound_stream_update(sound_stream &stream) override;
private:
- std::unique_ptr<uint8_t[]> m_soundregs;
+ required_shared_ptr<uint8_t> m_sharedram;
};
-class namco_cus30_device : public namco_audio_device
+class namco_cus30_device : public namco_audio_device<8, true>
{
public:
namco_cus30_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void namcos1_cus30_w(offs_t offset, uint8_t data); // wavedata + sound registers + RAM
- uint8_t namcos1_cus30_r(offs_t offset);
- void namcos1_sound_w(offs_t offset, uint8_t data);
+ // configuration
+ void set_stereo(bool stereo) { m_stereo = stereo; }
- void pacman_sound_w(offs_t offset, uint8_t data);
+ uint8_t cus30_r(offs_t offset);
+ void cus30_w(offs_t offset, uint8_t data); // wavedata + sound registers + RAM
+
+ void amap(address_map &map) ATTR_COLD;
protected:
+ // device_t implementation
+ virtual void device_start() override ATTR_COLD;
+
virtual void sound_stream_update(sound_stream &stream) override;
+
+private:
+ required_shared_ptr<uint8_t> m_sharedram;
+ required_shared_ptr<uint8_t> m_waveram;
+ bool m_stereo; // set to indicate stereo (e.g., System 1)
};
+extern template class namco_audio_device<3, false>;
+extern template class namco_audio_device<8, false>;
+extern template class namco_audio_device<8, true>;
-DECLARE_DEVICE_TYPE(NAMCO, namco_device)
+DECLARE_DEVICE_TYPE(NAMCO_WSG, namco_wsg_device)
+DECLARE_DEVICE_TYPE(POLEPOS_WSG, polepos_wsg_device)
DECLARE_DEVICE_TYPE(NAMCO_15XX, namco_15xx_device)
DECLARE_DEVICE_TYPE(NAMCO_CUS30, namco_cus30_device)
diff --git a/src/mame/namco/20pacgal.cpp b/src/mame/namco/20pacgal.cpp
index 6c88b7333fe..1129439708f 100644
--- a/src/mame/namco/20pacgal.cpp
+++ b/src/mame/namco/20pacgal.cpp
@@ -211,8 +211,8 @@ void _20pacgal_state::_20pacgal_map(address_map &map)
map(0x10000, 0x3ffff).rom();
map(0x44000, 0x447ff).ram().share("video_ram");
map(0x44800, 0x45eff).ram();
- map(0x45040, 0x4505f).w("namco", FUNC(namco_cus30_device::pacman_sound_w));
- map(0x45f00, 0x45fff).w("namco", FUNC(namco_cus30_device::namcos1_cus30_w));
+ map(0x45040, 0x4505f).w("namco", FUNC(namco_wsg_device::pacman_sound_w));
+ map(0x45f00, 0x45fff).writeonly().share("waveram");
map(0x46000, 0x46fff).writeonly().share("char_gfx_ram");
map(0x47100, 0x47100).ram(); // leftover from original Galaga code
map(0x48000, 0x49fff).bankr("mainbank").w(FUNC(_20pacgal_state::ram_48000_w)); // this should be a mirror of 08000-09fff
@@ -222,6 +222,11 @@ void _20pacgal_state::_20pacgal_map(address_map &map)
map(0x4ff00, 0x4ffff).w(FUNC(_20pacgal_state::sprite_lookup_w));
}
+void _20pacgal_state::waveram_map(address_map &map)
+{
+ map(0x00, 0xff).ram().share("waveram");
+}
+
/*************************************
*
@@ -433,8 +438,8 @@ void _20pacgal_state::_20pacgal(machine_config &config)
// sound hardware
SPEAKER(config, "speaker").front_center();
- namco_cus30_device &namco(NAMCO_CUS30(config, "namco", 73.728_MHz_XTAL / 4 / 6 / 32));
- namco.set_voices(3);
+ namco_wsg_device &namco(NAMCO_WSG(config, "namco", 73.728_MHz_XTAL / 4 / 6 / 32));
+ namco.set_addrmap(0, &_20pacgal_state::waveram_map);
namco.add_route(ALL_OUTPUTS, "speaker", 0.5);
DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.5);
diff --git a/src/mame/namco/20pacgal.h b/src/mame/namco/20pacgal.h
index e14a4e19645..c429da8c0a3 100644
--- a/src/mame/namco/20pacgal.h
+++ b/src/mame/namco/20pacgal.h
@@ -100,6 +100,7 @@ protected:
void _20pacgal_io_map(address_map &map) ATTR_COLD;
void _20pacgal_map(address_map &map) ATTR_COLD;
+ void waveram_map(address_map &map) ATTR_COLD;
};
diff --git a/src/mame/namco/baraduke.cpp b/src/mame/namco/baraduke.cpp
index 68293ce0e37..d278d14e122 100644
--- a/src/mame/namco/baraduke.cpp
+++ b/src/mame/namco/baraduke.cpp
@@ -497,7 +497,7 @@ void baraduke_state::main_map(address_map &map)
{
map(0x0000, 0x1fff).ram().w(FUNC(baraduke_state::spriteram_w)).share(m_spriteram);
map(0x2000, 0x3fff).rw(m_tilegen, FUNC(namco_cus4xtmap_device::vram_r), FUNC(namco_cus4xtmap_device::vram_w));
- map(0x4000, 0x43ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); // PSG device, shared RAM
+ map(0x4000, 0x43ff).m(m_cus30, FUNC(namco_cus30_device::amap)); // PSG device, shared RAM
map(0x4800, 0x4fff).ram().w(FUNC(baraduke_state::textram_w)).share(m_textram);
map(0x6000, 0xffff).rom();
map(0x8000, 0x8000).w("watchdog", FUNC(watchdog_timer_device::reset_w));
@@ -508,7 +508,7 @@ void baraduke_state::main_map(address_map &map)
void baraduke_state::mcu_map(address_map &map)
{
- map(0x1000, 0x13ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); // PSG device, shared RAM
+ map(0x1000, 0x13ff).m(m_cus30, FUNC(namco_cus30_device::amap)); // PSG device, shared RAM
map(0x8000, 0xbfff).rom().region("mcusub", 0); // MCU external ROM
map(0x8000, 0x8000).nopw(); // watchdog reset?
map(0x8800, 0x8800).nopw(); // IRQ acknowledge?
@@ -710,7 +710,6 @@ void baraduke_state::baraduke(machine_config &config)
SPEAKER(config, "mono").front_center();
NAMCO_CUS30(config, m_cus30, XTAL(49'152'000) / 2048);
- m_cus30->set_voices(8);
m_cus30->add_route(ALL_OUTPUTS, "mono", 1.0);
}
diff --git a/src/mame/namco/galaga.cpp b/src/mame/namco/galaga.cpp
index 28721371d54..c86195854e9 100644
--- a/src/mame/namco/galaga.cpp
+++ b/src/mame/namco/galaga.cpp
@@ -856,7 +856,7 @@ void bosco_state::bosco_map(address_map &map)
{
map(0x0000, 0x3fff).rom().nopw(); /* the only area different for each CPU */
map(0x6800, 0x6807).r(FUNC(bosco_state::bosco_dsw_r));
- map(0x6800, 0x681f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x6800, 0x681f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x6820, 0x6827).w("misclatch", FUNC(ls259_device::write_d0));
map(0x6830, 0x6830).w("watchdog", FUNC(watchdog_timer_device::reset_w));
map(0x7000, 0x70ff).rw("06xx_0", FUNC(namco_06xx_device::data_r), FUNC(namco_06xx_device::data_w));
@@ -878,7 +878,7 @@ void galaga_state::galaga_map(address_map &map)
{
map(0x0000, 0x3fff).rom().nopw(); /* the only area different for each CPU */
map(0x6800, 0x6807).r(FUNC(galaga_state::bosco_dsw_r));
- map(0x6800, 0x681f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x6800, 0x681f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x6820, 0x6827).w("misclatch", FUNC(ls259_device::write_d0));
map(0x6830, 0x6830).w("watchdog", FUNC(watchdog_timer_device::reset_w));
map(0x7000, 0x70ff).rw("06xx", FUNC(namco_06xx_device::data_r), FUNC(namco_06xx_device::data_w));
@@ -901,7 +901,7 @@ void xevious_state::xevious_map(address_map &map)
{
map(0x0000, 0x3fff).rom().nopw(); /* the only area different for each CPU */
map(0x6800, 0x6807).r(FUNC(xevious_state::bosco_dsw_r));
- map(0x6800, 0x681f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x6800, 0x681f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x6820, 0x6827).w("misclatch", FUNC(ls259_device::write_d0));
map(0x6830, 0x6830).w("watchdog", FUNC(watchdog_timer_device::reset_w));
map(0x7000, 0x70ff).rw("06xx", FUNC(namco_06xx_device::data_r), FUNC(namco_06xx_device::data_w));
@@ -922,7 +922,7 @@ void xevious_state::xevious_map(address_map &map)
void digdug_state::digdug_map(address_map &map)
{
map(0x0000, 0x3fff).rom().nopw(); /* the only area different for each CPU */
- map(0x6800, 0x681f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x6800, 0x681f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x6820, 0x6827).w("misclatch", FUNC(ls259_device::write_d0));
map(0x6830, 0x6830).w("watchdog", FUNC(watchdog_timer_device::reset_w));
map(0x7000, 0x70ff).rw("06xx", FUNC(namco_06xx_device::data_r), FUNC(namco_06xx_device::data_w));
@@ -1644,8 +1644,7 @@ void bosco_state::bosco(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- NAMCO(config, m_namco_sound, MASTER_CLOCK/6/32);
- m_namco_sound->set_voices(3);
+ NAMCO_WSG(config, m_namco_sound, MASTER_CLOCK/6/32);
m_namco_sound->add_route(ALL_OUTPUTS, "mono", 0.90 * 10.0 / 16.0);
/* discrete circuit on the 54XX outputs */
@@ -1721,8 +1720,7 @@ void galaga_state::galaga(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- NAMCO(config, m_namco_sound, MASTER_CLOCK/6/32);
- m_namco_sound->set_voices(3);
+ NAMCO_WSG(config, m_namco_sound, MASTER_CLOCK/6/32);
m_namco_sound->add_route(ALL_OUTPUTS, "mono", 0.90 * 10.0 / 16.0);
/* discrete circuit on the 54XX outputs */
@@ -1833,8 +1831,7 @@ void xevious_state::xevious(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- NAMCO(config, m_namco_sound, MASTER_CLOCK/6/32);
- m_namco_sound->set_voices(3);
+ NAMCO_WSG(config, m_namco_sound, MASTER_CLOCK/6/32);
m_namco_sound->add_route(ALL_OUTPUTS, "mono", 0.90 * 10.0 / 16.0);
/* discrete circuit on the 54XX outputs */
@@ -1951,8 +1948,7 @@ void digdug_state::digdug(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- NAMCO(config, m_namco_sound, MASTER_CLOCK/6/32);
- m_namco_sound->set_voices(3);
+ NAMCO_WSG(config, m_namco_sound, MASTER_CLOCK/6/32);
m_namco_sound->add_route(ALL_OUTPUTS, "mono", 0.90 * 10.0 / 16.0);
}
diff --git a/src/mame/namco/galaga.h b/src/mame/namco/galaga.h
index a2450fd3516..ed773503306 100644
--- a/src/mame/namco/galaga.h
+++ b/src/mame/namco/galaga.h
@@ -84,7 +84,7 @@ protected:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_subcpu2;
- required_device<namco_device> m_namco_sound;
+ required_device<namco_wsg_device> m_namco_sound;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
diff --git a/src/mame/namco/gaplus.cpp b/src/mame/namco/gaplus.cpp
index 93b87107622..2a4243ef0f9 100644
--- a/src/mame/namco/gaplus.cpp
+++ b/src/mame/namco/gaplus.cpp
@@ -267,7 +267,7 @@ void gaplus_base_state::cpu1_map(address_map &map)
{
map(0x0000, 0x07ff).ram().w(FUNC(gaplus_base_state::videoram_w)).share("videoram"); /* tilemap RAM (shared with CPU #2) */
map(0x0800, 0x1fff).ram().share("spriteram"); /* shared RAM with CPU #2 (includes sprite RAM) */
- map(0x6000, 0x63ff).rw(m_namco_15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w)); /* shared RAM with CPU #3 */
+ map(0x6000, 0x63ff).m(m_namco_15xx, FUNC(namco_15xx_device::amap)); /* shared RAM with CPU #3 */
map(0x6800, 0x680f).rw("namcoio_1", FUNC(namcoio_device::read), FUNC(namcoio_device::write)); /* custom I/O chips interface */
map(0x6810, 0x681f).rw("namcoio_2", FUNC(namcoio_device::read), FUNC(namcoio_device::write)); /* custom I/O chips interface */
map(0x6820, 0x682f).rw(FUNC(gaplus_base_state::customio_3_r), FUNC(gaplus_base_state::customio_3_w)).share("customio_3"); /* custom I/O chip #3 interface */
@@ -290,7 +290,7 @@ void gaplus_base_state::cpu2_map(address_map &map)
void gaplus_base_state::cpu3_map(address_map &map)
{
- map(0x0000, 0x03ff).rw(m_namco_15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w)); /* shared RAM with the main CPU + sound registers */
+ map(0x0000, 0x03ff).m(m_namco_15xx, FUNC(namco_15xx_device::amap)); /* shared RAM with the main CPU + sound registers */
map(0x2000, 0x3fff).rw("watchdog", FUNC(watchdog_timer_device::reset_r), FUNC(watchdog_timer_device::reset_w)); /* watchdog? */
map(0x4000, 0x7fff).w(FUNC(gaplus_base_state::irq_3_ctrl_w)); /* interrupt enable/disable */
map(0xe000, 0xffff).rom(); /* ROM */
@@ -541,7 +541,6 @@ void gaplus_base_state::gaplus_base(machine_config &config)
SPEAKER(config, "mono").front_center();
NAMCO_15XX(config, m_namco_15xx, XTAL(24'576'000) / 1024);
- m_namco_15xx->set_voices(8);
m_namco_15xx->add_route(ALL_OUTPUTS, "mono", 1.0);
SAMPLES(config, m_samples);
diff --git a/src/mame/namco/mappy.cpp b/src/mame/namco/mappy.cpp
index 3feb0ef2f8c..d4564d97243 100644
--- a/src/mame/namco/mappy.cpp
+++ b/src/mame/namco/mappy.cpp
@@ -644,7 +644,7 @@ void mappy_state::superpac_main_map(address_map &map)
map(0x0000, 0x07ff).ram().w(FUNC(mappy_state::superpac_videoram_w)).share(m_videoram);
map(0x0800, 0x1fff).ram().share(m_spriteram); // work RAM with embedded sprite RAM
map(0x2000, 0x2000).rw(FUNC(mappy_state::flipscreen_r), FUNC(mappy_state::flipscreen_w));
- map(0x4000, 0x43ff).rw(m_namco_15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w)); // shared RAM with the sound CPU
+ map(0x4000, 0x43ff).m(m_namco_15xx, FUNC(namco_15xx_device::amap)); // shared RAM with the sound CPU
map(0x4800, 0x480f).rw(m_namcoio[0], FUNC(namcoio_device::read), FUNC(namcoio_device::write)); // custom I/O chips interface
map(0x4810, 0x481f).rw(m_namcoio[1], FUNC(namcoio_device::read), FUNC(namcoio_device::write)); // custom I/O chips interface
map(0x5000, 0x500f).w("mainlatch", FUNC(ls259_device::write_a0)); // various control bits
@@ -656,7 +656,7 @@ void phozon_state::main_map(address_map &map)
{
map(0x0000, 0x07ff).ram().w(FUNC(phozon_state::superpac_videoram_w)).share(m_videoram); // video RAM
map(0x0800, 0x1fff).ram().share(m_spriteram); // shared RAM with CPU #2/sprite RAM
- map(0x4000, 0x43ff).rw(m_namco_15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w)); // shared RAM with the sound CPU
+ map(0x4000, 0x43ff).m(m_namco_15xx, FUNC(namco_15xx_device::amap)); // shared RAM with the sound CPU
map(0x4800, 0x480f).rw(m_namcoio[0], FUNC(namcoio_device::read), FUNC(namcoio_device::write)); // custom I/O chips interface
map(0x4810, 0x481f).rw(m_namcoio[1], FUNC(namcoio_device::read), FUNC(namcoio_device::write)); // custom I/O chips interface
map(0x5000, 0x500f).w("mainlatch", FUNC(ls259_device::write_a0)); // various control bits
@@ -669,7 +669,7 @@ void mappy_state::mappy_main_map(address_map &map)
map(0x0000, 0x0fff).ram().w(FUNC(mappy_state::mappy_videoram_w)).share(m_videoram);
map(0x1000, 0x27ff).ram().share(m_spriteram); // work RAM with embedded sprite RAM
map(0x3800, 0x3fff).w(FUNC(mappy_state::mappy_scroll_w)); // scroll
- map(0x4000, 0x43ff).rw(m_namco_15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w)); // shared RAM with the sound CPU
+ map(0x4000, 0x43ff).m(m_namco_15xx, FUNC(namco_15xx_device::amap)); // shared RAM with the sound CPU
map(0x4800, 0x480f).rw(m_namcoio[0], FUNC(namcoio_device::read), FUNC(namcoio_device::write)); // custom I/O chips interface
map(0x4810, 0x481f).rw(m_namcoio[1], FUNC(namcoio_device::read), FUNC(namcoio_device::write)); // custom I/O chips interface
map(0x5000, 0x500f).w("mainlatch", FUNC(ls259_device::write_a0)); // various control bits
@@ -679,14 +679,14 @@ void mappy_state::mappy_main_map(address_map &map)
void mappy_state::superpac_sub_map(address_map &map)
{
- map(0x0000, 0x03ff).rw(m_namco_15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w)); // shared RAM with the main CPU (also sound registers)
+ map(0x0000, 0x03ff).m(m_namco_15xx, FUNC(namco_15xx_device::amap)); // shared RAM with the main CPU (also sound registers)
map(0x2000, 0x200f).w("mainlatch", FUNC(ls259_device::write_a0)); // various control bits
map(0xe000, 0xffff).rom();
}
void phozon_state::sub_map(address_map &map)
{
- map(0x0000, 0x03ff).rw(m_namco_15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w)); // shared RAM with the main CPU + sound registers
+ map(0x0000, 0x03ff).m(m_namco_15xx, FUNC(namco_15xx_device::amap)); // shared RAM with the main CPU + sound registers
map(0xe000, 0xffff).rom();
}
@@ -696,7 +696,7 @@ void phozon_state::sub2_map(address_map &map)
{
map(0x0000, 0x07ff).ram().w(FUNC(phozon_state::superpac_videoram_w)).share(m_videoram);
map(0x0800, 0x1fff).ram().share(m_spriteram); // shared RAM with CPU #2/sprite RAM
- map(0x4000, 0x43ff).rw(m_namco_15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w)); // shared RAM with CPU #2
+ map(0x4000, 0x43ff).m(m_namco_15xx, FUNC(namco_15xx_device::amap)); // shared RAM with CPU #2
map(0xa000, 0xa7ff).ram();
map(0xe000, 0xffff).rom();
}
@@ -1356,7 +1356,6 @@ void mappy_state::superpac_common(machine_config &config)
SPEAKER(config, "speaker").front_center();
NAMCO_15XX(config, m_namco_15xx, MASTER_CLOCK/768);
- m_namco_15xx->set_voices(8);
m_namco_15xx->add_route(ALL_OUTPUTS, "speaker", 1.0);
}
@@ -1472,7 +1471,6 @@ void phozon_state::phozon(machine_config &config)
SPEAKER(config, "speaker").front_center();
NAMCO_15XX(config, m_namco_15xx, MASTER_CLOCK/768);
- m_namco_15xx->set_voices(8);
m_namco_15xx->add_route(ALL_OUTPUTS, "speaker", 1.0);
}
@@ -1518,7 +1516,6 @@ void mappy_state::mappy_common(machine_config &config)
SPEAKER(config, "speaker").front_center();
NAMCO_15XX(config, m_namco_15xx, MASTER_CLOCK/768);
- m_namco_15xx->set_voices(8);
m_namco_15xx->add_route(ALL_OUTPUTS, "speaker", 1.0);
}
diff --git a/src/mame/namco/namcos1.cpp b/src/mame/namco/namcos1.cpp
index f9696fc2ce3..4e16c13efd7 100644
--- a/src/mame/namco/namcos1.cpp
+++ b/src/mame/namco/namcos1.cpp
@@ -410,7 +410,7 @@ void namcos1_state::virtual_map(address_map &map)
map(0x2fc000, 0x2fc7ff).ram().share("scratchpad");
map(0x2fc800, 0x2fcfff).m(m_spritegen, FUNC(namcos1_sprite_device::spriteram_map));
map(0x2fd000, 0x2fd01f).rw(m_c123tmap, FUNC(namco_c123tmap_device::control8_r), FUNC(namco_c123tmap_device::control8_w)).mirror(0xfe0);
- map(0x2fe000, 0x2fe3ff).rw("namco", FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)).mirror(0xc00); /* PSG ( Shared ) */
+ map(0x2fe000, 0x2fe3ff).m("namco", FUNC(namco_cus30_device::amap)).mirror(0xc00); /* PSG ( Shared ) */
map(0x2ff000, 0x2ff7ff).ram().share(m_triram).mirror(0x800);
map(0x300000, 0x307fff).ram();
map(0x400000, 0x7fffff).rom().region("mainrom", 0);
@@ -421,7 +421,7 @@ void namcos1_state::sound_map(address_map &map)
{
map(0x0000, 0x3fff).bankr(m_soundbank); /* Banked ROMs */
map(0x4000, 0x4001).rw("ymsnd", FUNC(ym2151_device::status_r), FUNC(ym2151_device::write));
- map(0x5000, 0x53ff).rw("namco", FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)).mirror(0xc00); /* PSG ( Shared ) */
+ map(0x5000, 0x53ff).m("namco", FUNC(namco_cus30_device::amap)).mirror(0xc00); /* PSG ( Shared ) */
map(0x7000, 0x77ff).ram().share(m_triram).mirror(0x800);
map(0x8000, 0x9fff).ram(); /* Sound RAM 3 */
map(0xa000, 0xa000).nopr();
@@ -1070,8 +1070,7 @@ void namcos1_state::ns1(machine_config &config)
ymsnd.add_route(1, "speaker", 0.50, 1);
namco_cus30_device &cus30(NAMCO_CUS30(config, "namco", XTAL(49'152'000)/2048/2));
- cus30.set_voices(8);
- cus30.set_stereo(1);
+ cus30.set_stereo(true);
cus30.add_route(0, "speaker", 0.50, 0);
cus30.add_route(1, "speaker", 0.50, 1);
diff --git a/src/mame/namco/namcos86.cpp b/src/mame/namco/namcos86.cpp
index c26273e70e5..815d970e9a7 100644
--- a/src/mame/namco/namcos86.cpp
+++ b/src/mame/namco/namcos86.cpp
@@ -331,7 +331,7 @@ void namcos86_state::cpu1_map(address_map &map)
map(0x4000, 0x57ff).ram().share("sharedram");
map(0x5800, 0x5fff).m(m_spritegen, FUNC(namcos1_sprite_device::spriteram_map));
- map(0x4000, 0x43ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); // PSG device, shared RAM
+ map(0x4000, 0x43ff).m(m_cus30, FUNC(namco_cus30_device::amap)); // PSG device, shared RAM
// ROM & Voice expansion board - only some games have it
map(0x6000, 0x7fff).bankr(m_mainbank);
@@ -414,7 +414,7 @@ void namcos86_state::wndrmomo_cpu2_map(address_map &map)
void namcos86_state::common_mcu_map(address_map &map)
{
- map(0x1000, 0x13ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w));
+ map(0x1000, 0x13ff).m(m_cus30, FUNC(namco_cus30_device::amap));
map(0x1400, 0x1fff).ram();
}
@@ -1079,7 +1079,6 @@ void namcos86_state::hopmappy(machine_config &config)
ymsnd.add_route(0, "mono", 0.0).add_route(1, "mono", 0.60); // only right channel is connected
NAMCO_CUS30(config, m_cus30, 49.152_MHz_XTAL/2048);
- m_cus30->set_voices(8);
m_cus30->add_route(ALL_OUTPUTS, "mono", 0.50);
}
diff --git a/src/mame/namco/pacland.cpp b/src/mame/namco/pacland.cpp
index d387f87eb27..3e45ad2bf2d 100644
--- a/src/mame/namco/pacland.cpp
+++ b/src/mame/namco/pacland.cpp
@@ -748,7 +748,7 @@ void pacland_state::main_map(address_map &map)
map(0x3a00, 0x3a01).w(FUNC(pacland_state::scroll_w<1>));
map(0x3c00, 0x3c00).w(FUNC(pacland_state::bankswitch_w));
map(0x4000, 0x5fff).bankr(m_mainbank);
- map(0x6800, 0x6bff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); // PSG device, shared RAM
+ map(0x6800, 0x6bff).m(m_cus30, FUNC(namco_cus30_device::amap)); // PSG device, shared RAM
map(0x7000, 0x7fff).w(FUNC(pacland_state::maincpu_irq_ctrl_w));
map(0x7800, 0x7fff).r("watchdog", FUNC(watchdog_timer_device::reset_r));
map(0x8000, 0xffff).rom();
@@ -758,7 +758,7 @@ void pacland_state::main_map(address_map &map)
void pacland_state::mcu_map(address_map &map)
{
- map(0x1000, 0x13ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); // PSG device, shared RAM
+ map(0x1000, 0x13ff).m(m_cus30, FUNC(namco_cus30_device::amap)); // PSG device, shared RAM
map(0x2000, 0x3fff).w("watchdog", FUNC(watchdog_timer_device::reset_w)); // watchdog?
map(0x4000, 0x7fff).w(FUNC(pacland_state::mcu_irq_ctrl_w));
map(0x8000, 0x9fff).rom().region("mcusub", 0);
@@ -919,7 +919,6 @@ void pacland_state::pacland(machine_config &config)
SPEAKER(config, "mono").front_center();
NAMCO_CUS30(config, m_cus30, XTAL(49'152'000) / 2 / 1024);
- m_cus30->set_voices(8);
m_cus30->add_route(ALL_OUTPUTS, "mono", 1.0);
}
diff --git a/src/mame/namco/polepos.cpp b/src/mame/namco/polepos.cpp
index c0faba5c0da..0c114e3b8c1 100644
--- a/src/mame/namco/polepos.cpp
+++ b/src/mame/namco/polepos.cpp
@@ -442,7 +442,7 @@ void polepos_state::z80_map(address_map &map)
map(0x5000, 0x57ff).rw(FUNC(polepos_state::view_r), FUNC(polepos_state::view_w)); /* Background Memory */
map(0x8000, 0x83bf).mirror(0x0c00).ram(); /* Sound Memory */
- map(0x83c0, 0x83ff).mirror(0x0c00).rw(m_namco_sound, FUNC(namco_device::polepos_sound_r), FUNC(namco_device::polepos_sound_w)); /* Sound data */
+ map(0x83c0, 0x83ff).mirror(0x0c00).rw(m_namco_sound, FUNC(polepos_wsg_device::polepos_sound_r), FUNC(polepos_wsg_device::polepos_sound_w)); /* Sound data */
map(0x9000, 0x9000).mirror(0x0eff).rw("06xx", FUNC(namco_06xx_device::data_r), FUNC(namco_06xx_device::data_w));
map(0x9100, 0x9100).mirror(0x0eff).rw("06xx", FUNC(namco_06xx_device::ctrl_r), FUNC(namco_06xx_device::ctrl_w));
@@ -934,7 +934,7 @@ void polepos_state::polepos(machine_config &config)
m_latch->q_out_cb<1>().append("52xx", FUNC(namco_52xx_device::reset));
m_latch->q_out_cb<1>().append("53xx", FUNC(namco_53xx_device::reset));
m_latch->q_out_cb<1>().append("54xx", FUNC(namco_54xx_device::reset));
- m_latch->q_out_cb<2>().set(m_namco_sound, FUNC(namco_device::sound_enable_w));
+ m_latch->q_out_cb<2>().set(m_namco_sound, FUNC(polepos_wsg_device::sound_enable_w));
m_latch->q_out_cb<2>().append("engine", FUNC(polepos_sound_device::clson_w));
m_latch->q_out_cb<3>().set(FUNC(polepos_state::gasel_w));
m_latch->q_out_cb<4>().set_inputline(m_subcpu[0], INPUT_LINE_RESET).invert();
@@ -959,22 +959,27 @@ void polepos_state::polepos(machine_config &config)
/* sound hardware */
SPEAKER(config, "speaker", 2).front();
+ SPEAKER(config, "rspeaker", 2).rear();
- NAMCO(config, m_namco_sound, MASTER_CLOCK/512);
- m_namco_sound->set_voices(8);
- m_namco_sound->set_stereo(true);
+ POLEPOS_WSG(config, m_namco_sound, MASTER_CLOCK/512);
m_namco_sound->add_route(0, "speaker", 0.80, 0);
m_namco_sound->add_route(1, "speaker", 0.80, 1);
+ m_namco_sound->add_route(2, "rspeaker", 0.80, 0);
+ m_namco_sound->add_route(3, "rspeaker", 0.80, 1);
/* discrete circuit on the 54XX outputs */
discrete_sound_device &discrete(DISCRETE(config, "discrete", polepos_discrete));
discrete.add_route(ALL_OUTPUTS, "speaker", 0.90, 0);
discrete.add_route(ALL_OUTPUTS, "speaker", 0.90, 1);
+ discrete.add_route(ALL_OUTPUTS, "rspeaker", 0.90, 0);
+ discrete.add_route(ALL_OUTPUTS, "rspeaker", 0.90, 1);
/* engine sound */
polepos_sound_device &polepos(POLEPOS_SOUND(config, "engine", MASTER_CLOCK/8));
polepos.add_route(ALL_OUTPUTS, "speaker", 0.90 * 0.77, 0);
polepos.add_route(ALL_OUTPUTS, "speaker", 0.90 * 0.77, 1);
+ polepos.add_route(ALL_OUTPUTS, "rspeaker", 0.90 * 0.77, 0);
+ polepos.add_route(ALL_OUTPUTS, "rspeaker", 0.90 * 0.77, 1);
}
void polepos2_state::polepos2(machine_config &config)
@@ -1047,7 +1052,7 @@ void polepos_state::topracern(machine_config &config)
LS259(config, m_latch);
m_latch->q_out_cb<0>().set_inputline(m_maincpu, 0, CLEAR_LINE).invert();
- m_latch->q_out_cb<2>().set(m_namco_sound, FUNC(namco_device::sound_enable_w));
+ m_latch->q_out_cb<2>().set(m_namco_sound, FUNC(polepos_wsg_device::sound_enable_w));
m_latch->q_out_cb<2>().append("engine", FUNC(polepos_sound_device::clson_w));
m_latch->q_out_cb<3>().set(FUNC(polepos_state::gasel_w));
m_latch->q_out_cb<4>().set_inputline(m_subcpu[0], INPUT_LINE_RESET).invert();
@@ -1072,21 +1077,26 @@ void polepos_state::topracern(machine_config &config)
/* sound hardware */
SPEAKER(config, "speaker", 2).front();
+ SPEAKER(config, "rspeaker", 2).rear();
- NAMCO(config, m_namco_sound, MASTER_CLOCK/512);
- m_namco_sound->set_voices(8);
- m_namco_sound->set_stereo(true);
+ POLEPOS_WSG(config, m_namco_sound, MASTER_CLOCK/512);
m_namco_sound->add_route(0, "speaker", 0.80, 0);
m_namco_sound->add_route(1, "speaker", 0.80, 1);
+ m_namco_sound->add_route(2, "rspeaker", 0.80, 0);
+ m_namco_sound->add_route(3, "rspeaker", 0.80, 1);
/* engine sound */
polepos_sound_device &polepos(POLEPOS_SOUND(config, "engine", 0));
polepos.add_route(ALL_OUTPUTS, "speaker", 0.90 * 0.77, 0);
polepos.add_route(ALL_OUTPUTS, "speaker", 0.90 * 0.77, 1);
+ polepos.add_route(ALL_OUTPUTS, "rspeaker", 0.90 * 0.77, 0);
+ polepos.add_route(ALL_OUTPUTS, "rspeaker", 0.90 * 0.77, 1);
dac_4bit_r2r_device &dac(DAC_4BIT_R2R(config, "dac", 0)); // unknown resistor configuration
dac.add_route(ALL_OUTPUTS, "speaker", 0.12, 0);
dac.add_route(ALL_OUTPUTS, "speaker", 0.12, 1);
+ dac.add_route(ALL_OUTPUTS, "rspeaker", 0.12, 0);
+ dac.add_route(ALL_OUTPUTS, "rspeaker", 0.12, 1);
}
void polepos2bi_state::polepos2bi(machine_config &config)
diff --git a/src/mame/namco/polepos.h b/src/mame/namco/polepos.h
index 716ada455c7..1e10a930167 100644
--- a/src/mame/namco/polepos.h
+++ b/src/mame/namco/polepos.h
@@ -58,7 +58,7 @@ protected:
required_device<cpu_device> m_maincpu;
required_device_array<cpu_device, 2> m_subcpu;
optional_device<generic_latch_8_device> m_soundlatch;
- optional_device<namco_device> m_namco_sound;
+ optional_device<polepos_wsg_device> m_namco_sound;
required_device<ls259_device> m_latch;
required_device<adc0804_device> m_adc;
required_shared_ptr<uint16_t> m_sprite16_memory;
diff --git a/src/mame/namco/rallyx.cpp b/src/mame/namco/rallyx.cpp
index 0b040773ebe..4d840f4bb92 100644
--- a/src/mame/namco/rallyx.cpp
+++ b/src/mame/namco/rallyx.cpp
@@ -286,7 +286,7 @@ void rallyx_state::rallyx_map(address_map &map)
map(0xa100, 0xa100).portr("DSW");
map(0xa000, 0xa00f).writeonly().share(m_radarattr);
map(0xa080, 0xa080).w("watchdog", FUNC(watchdog_timer_device::reset_w));
- map(0xa100, 0xa11f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0xa100, 0xa11f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0xa130, 0xa130).w(FUNC(rallyx_state::scrollx_w));
map(0xa140, 0xa140).w(FUNC(rallyx_state::scrolly_w));
map(0xa170, 0xa170).nopw(); // ?
@@ -868,8 +868,7 @@ void rallyx_state::rallyx(machine_config &config)
// sound hardware
SPEAKER(config, "mono").front_center();
- NAMCO(config, m_namco_sound, MASTER_CLOCK/6/32); // 96 KHz
- m_namco_sound->set_voices(3);
+ NAMCO_WSG(config, m_namco_sound, MASTER_CLOCK/6/32); // 96 KHz
m_namco_sound->add_route(ALL_OUTPUTS, "mono", 1.0);
SAMPLES(config, m_samples);
diff --git a/src/mame/namco/rallyx.h b/src/mame/namco/rallyx.h
index aa93260a84e..c2e18bd852e 100644
--- a/src/mame/namco/rallyx.h
+++ b/src/mame/namco/rallyx.h
@@ -72,7 +72,7 @@ private:
// devices
required_device<cpu_device> m_maincpu;
- optional_device<namco_device> m_namco_sound;
+ optional_device<namco_wsg_device> m_namco_sound;
optional_device<samples_device> m_samples;
optional_device<timeplt_audio_device> m_timeplt_audio;
required_device<gfxdecode_device> m_gfxdecode;
diff --git a/src/mame/namco/skykid.cpp b/src/mame/namco/skykid.cpp
index dc8dd92f3cb..b234b8a4c63 100644
--- a/src/mame/namco/skykid.cpp
+++ b/src/mame/namco/skykid.cpp
@@ -443,7 +443,7 @@ void skykid_state::main_map(address_map &map)
map(0x4800, 0x5fff).ram().share(m_spriteram);
map(0x6000, 0x60ff).w(FUNC(skykid_state::scroll_y_w));
map(0x6200, 0x63ff).w(FUNC(skykid_state::scroll_x_w));
- map(0x6800, 0x6bff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); // PSG device, shared RAM
+ map(0x6800, 0x6bff).m(m_cus30, FUNC(namco_cus30_device::amap)); // PSG device, shared RAM
map(0x7000, 0x7fff).w(FUNC(skykid_state::irq_1_ctrl_w));
map(0x7800, 0x7fff).r("watchdog", FUNC(watchdog_timer_device::reset_r));
map(0x8000, 0xffff).rom();
@@ -454,7 +454,7 @@ void skykid_state::main_map(address_map &map)
void skykid_state::mcu_map(address_map &map)
{
- map(0x1000, 0x13ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w)); // PSG device, shared RAM
+ map(0x1000, 0x13ff).m(m_cus30, FUNC(namco_cus30_device::amap)); // PSG device, shared RAM
map(0x2000, 0x3fff).w("watchdog", FUNC(watchdog_timer_device::reset_w)); // ?
map(0x4000, 0x7fff).w(FUNC(skykid_state::irq_2_ctrl_w));
map(0x8000, 0x9fff).rom().region("mcusub", 0);
@@ -723,7 +723,6 @@ void skykid_state::skykid(machine_config &config)
SPEAKER(config, "mono").front_center();
NAMCO_CUS30(config, m_cus30, 49152000 / 2048);
- m_cus30->set_voices(8);
m_cus30->add_route(ALL_OUTPUTS, "mono", 1.0);
}
diff --git a/src/mame/namco/tceptor.cpp b/src/mame/namco/tceptor.cpp
index 242b38856bf..6aed431cedd 100644
--- a/src/mame/namco/tceptor.cpp
+++ b/src/mame/namco/tceptor.cpp
@@ -106,7 +106,7 @@ void tceptor_state::m6809_map(address_map &map)
map(0x1800, 0x1bff).ram().w(FUNC(tceptor_state::tceptor_tile_ram_w)).share(m_tile_ram);
map(0x1c00, 0x1fff).ram().w(FUNC(tceptor_state::tceptor_tile_attr_w)).share(m_tile_attr);
map(0x2000, 0x3fff).ram().w(FUNC(tceptor_state::tceptor_bg_ram_w)).share(m_bg_ram); // background (VIEW RAM)
- map(0x4000, 0x43ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w));
+ map(0x4000, 0x43ff).m(m_cus30, FUNC(namco_cus30_device::amap));
map(0x4800, 0x4800).w(FUNC(tceptor_state::tceptor2_shutter_w));
map(0x4f00, 0x4f07).rw("adc", FUNC(adc0808_device::data_r), FUNC(adc0808_device::address_offset_start_w));
map(0x5000, 0x5006).w(FUNC(tceptor_state::tceptor_bg_scroll_w));
@@ -155,7 +155,7 @@ void tceptor_state::m68k_map(address_map &map)
void tceptor_state::mcu_map(address_map &map)
{
- map(0x1000, 0x13ff).rw(m_cus30, FUNC(namco_cus30_device::namcos1_cus30_r), FUNC(namco_cus30_device::namcos1_cus30_w));
+ map(0x1000, 0x13ff).m(m_cus30, FUNC(namco_cus30_device::amap));
map(0x1400, 0x154d).ram();
map(0x17c0, 0x17ff).ram();
map(0x2000, 0x20ff).ram().share("mcushared");
@@ -342,7 +342,6 @@ void tceptor_state::tceptor(machine_config &config)
ym.add_route(1, "speaker", 1.0, 1);
NAMCO_CUS30(config, m_cus30, XTAL(49'152'000)/2048);
- m_cus30->set_voices(8);
m_cus30->set_stereo(true);
m_cus30->add_route(0, "speaker", 0.40, 0);
m_cus30->add_route(1, "speaker", 0.40, 1);
diff --git a/src/mame/namco/toypop.cpp b/src/mame/namco/toypop.cpp
index 8586ac43fb3..b3fbd2bd635 100644
--- a/src/mame/namco/toypop.cpp
+++ b/src/mame/namco/toypop.cpp
@@ -401,7 +401,7 @@ void namcos16_state::main_base_map(address_map &map)
void namcos16_state::liblrabl_main_map(address_map &map)
{
main_base_map(map);
- map(0x6000, 0x63ff).rw(m_namco15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w));
+ map(0x6000, 0x63ff).m(m_namco15xx, FUNC(namco_15xx_device::amap));
map(0x6800, 0x680f).rw(m_namco58xx, FUNC(namco58xx_device::read), FUNC(namco58xx_device::write));
map(0x6810, 0x681f).rw(m_namco56xx_1, FUNC(namco56xx_device::read), FUNC(namco56xx_device::write));
map(0x6820, 0x682f).rw(m_namco56xx_2, FUNC(namco56xx_device::read), FUNC(namco56xx_device::write));
@@ -414,7 +414,7 @@ void namcos16_state::toypop_main_map(address_map &map)
map(0x6000, 0x600f).rw(m_namco58xx, FUNC(namco58xx_device::read), FUNC(namco58xx_device::write));
map(0x6010, 0x601f).rw(m_namco56xx_1, FUNC(namco56xx_device::read), FUNC(namco56xx_device::write));
map(0x6020, 0x602f).rw(m_namco56xx_2, FUNC(namco56xx_device::read), FUNC(namco56xx_device::write));
- map(0x6800, 0x6bff).rw(m_namco15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w));
+ map(0x6800, 0x6bff).m(m_namco15xx, FUNC(namco_15xx_device::amap));
map(0x7000, 0x7000).rw(FUNC(namcos16_state::irq_enable_r), FUNC(namcos16_state::irq_disable_w));
}
@@ -430,7 +430,7 @@ void namcos16_state::sub_map(address_map &map)
void namcos16_state::sound_map(address_map &map)
{
- map(0x0000, 0x03ff).rw(m_namco15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w));
+ map(0x0000, 0x03ff).m(m_namco15xx, FUNC(namco_15xx_device::amap));
map(0xe000, 0xffff).rom().region("soundcpu", 0);
}
@@ -741,7 +741,6 @@ void namcos16_state::liblrabl(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
NAMCO_15XX(config, m_namco15xx, MASTER_CLOCK / 256);
- m_namco15xx->set_voices(8);
m_namco15xx->add_route(ALL_OUTPUTS, "mono", 1.0);
}
diff --git a/src/mame/pacman/jrpacman.cpp b/src/mame/pacman/jrpacman.cpp
index 6b087b94fe7..68a2079f156 100644
--- a/src/mame/pacman/jrpacman.cpp
+++ b/src/mame/pacman/jrpacman.cpp
@@ -144,7 +144,7 @@ void jrpacman_state::main_map(address_map &map)
map(0x5000, 0x503f).portr("P1");
map(0x5000, 0x5007).w("latch1", FUNC(ls259_device::write_d0));
map(0x5040, 0x507f).portr("P2");
- map(0x5040, 0x505f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).writeonly().share("spriteram2");
map(0x5070, 0x5077).w("latch2", FUNC(ls259_device::write_d0));
map(0x5080, 0x50bf).portr("DSW");
@@ -272,7 +272,7 @@ void jrpacman_state::jrpacman(machine_config &config)
ls259_device &latch1(LS259(config, "latch1")); // 5P
latch1.q_out_cb<0>().set(FUNC(jrpacman_state::irq_mask_w));
- latch1.q_out_cb<1>().set("namco", FUNC(namco_device::sound_enable_w));
+ latch1.q_out_cb<1>().set("namco", FUNC(namco_wsg_device::sound_enable_w));
latch1.q_out_cb<3>().set(FUNC(jrpacman_state::flipscreen_w));
latch1.q_out_cb<7>().set(FUNC(jrpacman_state::coin_counter_w));
@@ -303,8 +303,7 @@ void jrpacman_state::jrpacman(machine_config &config)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- NAMCO(config, m_namco_sound, 3072000/32);
- m_namco_sound->set_voices(3);
+ NAMCO_WSG(config, m_namco_sound, 3072000/32);
m_namco_sound->add_route(ALL_OUTPUTS, "mono", 1.0);
}
diff --git a/src/mame/pacman/pacman.cpp b/src/mame/pacman/pacman.cpp
index 39df34ba560..9d64e8ecb6b 100644
--- a/src/mame/pacman/pacman.cpp
+++ b/src/mame/pacman/pacman.cpp
@@ -1062,7 +1062,7 @@ void pacman_state::pacman_map(address_map &map)
map(0x4c00, 0x4fef).mirror(0xa000).ram();
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(addressable_latch_device::write_d0));
- map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
map(0x5070, 0x507f).mirror(0xaf00).nopw();
map(0x5080, 0x5080).mirror(0xaf3f).nopw();
@@ -1089,7 +1089,7 @@ void pacman_state::birdiy_map(address_map &map)
map(0x4c00, 0x4fef).mirror(0xa000).ram();
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5080, 0x509f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5080, 0x509f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x50a0, 0x50af).mirror(0xaf00).writeonly().share("spriteram2");
// map(0x5070, 0x507f).mirror(0xaf00).nopw();
// map(0x5080, 0x5080).mirror(0xaf3f).nopw();
@@ -1113,7 +1113,7 @@ void pacman_state::mspacman_map(address_map &map)
map(0x4c00, 0x4fef).mirror(0xa000).ram();
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
map(0x5070, 0x507f).mirror(0xaf00).nopw();
map(0x5080, 0x5080).mirror(0xaf3f).nopw();
@@ -1144,7 +1144,7 @@ void pacman_state::woodpek_map(address_map &map)
map(0x4c00, 0x4fef).mirror(0xa000).ram();
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
map(0x5070, 0x507f).mirror(0xaf00).nopw();
map(0x5080, 0x5080).mirror(0xaf3f).nopw();
@@ -1166,7 +1166,7 @@ void clubpacm_state::clubpacm_map(address_map &map)
map(0x4c00, 0x4fef).mirror(0xa000).ram();
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
map(0x5070, 0x507f).mirror(0xaf00).nopw();
map(0x5080, 0x5080).mirror(0xaf3f).w(m_sublatch, FUNC(generic_latch_8_device::write));
@@ -1188,7 +1188,7 @@ void mspactwin_state::mspactwin_map(address_map &map)
map(0x4c00, 0x4fef).mirror(0xa000).ram();
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0x0030).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
map(0x5070, 0x507f).mirror(0xaf00).nopw();
map(0x5080, 0x5080).mirror(0xaf3f).w(m_sublatch, FUNC(generic_latch_8_device::write));
@@ -1223,7 +1223,7 @@ void pacman_state::numcrash_map(address_map &map)
map(0x4c00, 0x4fef).ram();
map(0x4ff0, 0x4fff).ram().share("spriteram");
map(0x5000, 0x5007).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5040, 0x505f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).writeonly().share("spriteram2");
// map(0x5070, 0x507f).nopw();
// map(0x5080, 0x5080).nopw();
@@ -1271,7 +1271,7 @@ void pacman_state::dremshpr_map(address_map &map)
map(0x4800, 0x4fef).mirror(0xa000).ram();
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(ls259_device::write_d0));
-// map(0x5040, 0x505f).mirror(0xaf00).w("namco", FUNC(namco_device::pacman_sound_w));
+// map(0x5040, 0x505f).mirror(0xaf00).w("namco", FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
map(0x5070, 0x507f).mirror(0xaf00).nopw();
map(0x5080, 0x5080).mirror(0xaf3f).nopw();
@@ -1297,7 +1297,7 @@ void epospm_state::epos_map(address_map &map)
map(0x4c00, 0x4fef).mirror(0xa000).ram();
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
map(0x5070, 0x507f).mirror(0xaf00).nopw();
map(0x5080, 0x5080).mirror(0xaf3f).nopw();
@@ -1344,7 +1344,7 @@ void pacman_state::rocktrv2_map(address_map &map)
map(0x4400, 0x47ff).ram().w(FUNC(pacman_state::pacman_colorram_w)).share("colorram");
map(0x4c00, 0x4fff).ram();
map(0x5000, 0x5007).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5040, 0x505f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x50c0, 0x50c0).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
map(0x5fe0, 0x5fe3).w(FUNC(pacman_state::rocktrv2_prot_data_w)).share("rocktrv2_prot");
map(0x5ff0, 0x5ff0).w(FUNC(pacman_state::rocktrv2_question_bank_w));
@@ -1369,7 +1369,7 @@ void pacman_state::bigbucks_map(address_map &map)
map(0x4400, 0x47ff).ram().w(FUNC(pacman_state::pacman_colorram_w)).share("colorram");
map(0x4c00, 0x4fff).ram();
map(0x5000, 0x5007).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5040, 0x505f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x50c0, 0x50c0).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
map(0x5000, 0x503f).portr("IN0");
map(0x5040, 0x507f).portr("IN1");
@@ -1390,7 +1390,7 @@ void pacman_state::mschamp_map(address_map &map)
map(0x4c00, 0x4fef).mirror(0xa000).ram();
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
map(0x5070, 0x507f).mirror(0xaf00).nopw();
map(0x5080, 0x5080).mirror(0xaf3f).nopw();
@@ -1412,7 +1412,7 @@ void pacman_state::superabc_map(address_map &map)
map(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
map(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, FUNC(ls259_device::write_d0));
map(0x5002, 0x5002).mirror(0xaf3c).w(FUNC(pacman_state::superabc_bank_w));
- map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
map(0x5070, 0x507f).mirror(0xaf00).nopw();
map(0x5080, 0x5080).mirror(0xaf3f).nopw();
@@ -1459,7 +1459,7 @@ void pacman_state::pengojpm_map(address_map &map)
map(0x8c00, 0x8fef).ram();
map(0x8ff0, 0x8fff).ram().share("spriteram");
map(0x9000, 0x9007).w(m_mainlatch, FUNC(ls259_device::write_d0));
- map(0x9040, 0x905f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x9040, 0x905f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x9060, 0x906f).writeonly().share("spriteram2");
map(0x9070, 0x907f).nopw();
map(0x9080, 0x9080).nopw();
@@ -3725,7 +3725,7 @@ void pacman_state::pacman(machine_config &config, bool latch)
{
LS259(config, m_mainlatch); // 74LS259 at 8K or 4099 at 7K
m_mainlatch->q_out_cb<0>().set(FUNC(pacman_state::irq_mask_w));
- m_mainlatch->q_out_cb<1>().set("namco", FUNC(namco_device::sound_enable_w));
+ m_mainlatch->q_out_cb<1>().set("namco", FUNC(namco_wsg_device::sound_enable_w));
m_mainlatch->q_out_cb<3>().set(FUNC(pacman_state::flipscreen_w));
m_mainlatch->q_out_cb<7>().set(FUNC(pacman_state::coin_counter_w));
@@ -3755,8 +3755,7 @@ void pacman_state::pacman(machine_config &config, bool latch)
// Sound hardware
SPEAKER(config, "mono").front_center();
- NAMCO(config, m_namco_sound, MASTER_CLOCK/6/32);
- m_namco_sound->set_voices(3);
+ NAMCO_WSG(config, m_namco_sound, MASTER_CLOCK/6/32);
m_namco_sound->add_route(ALL_OUTPUTS, "mono", 1.0);
}
@@ -3900,7 +3899,7 @@ void alibaba_state::alibaba(machine_config &config)
latch1.q_out_cb<7>().set(FUNC(alibaba_state::coin_counter_w));
ls259_device &latch2(LS259(config, "latch2"));
- latch2.q_out_cb<0>().set("namco", FUNC(namco_device::sound_enable_w));
+ latch2.q_out_cb<0>().set("namco", FUNC(namco_wsg_device::sound_enable_w));
latch2.q_out_cb<1>().set(FUNC(alibaba_state::flipscreen_w));
latch2.q_out_cb<2>().set(FUNC(alibaba_state::irq_mask_w));
diff --git a/src/mame/pacman/pacman.h b/src/mame/pacman/pacman.h
index 567ea75f8df..821e72fb82b 100644
--- a/src/mame/pacman/pacman.h
+++ b/src/mame/pacman/pacman.h
@@ -71,7 +71,7 @@ protected:
required_device<cpu_device> m_maincpu;
optional_device<ls259_device> m_mainlatch;
- optional_device<namco_device> m_namco_sound;
+ optional_device<namco_wsg_device> m_namco_sound;
required_device<watchdog_timer_device> m_watchdog;
optional_shared_ptr<uint8_t> m_spriteram;
optional_shared_ptr<uint8_t> m_spriteram2;
diff --git a/src/mame/pacman/pengo.cpp b/src/mame/pacman/pengo.cpp
index 8a5d7af2535..319b4c5d834 100644
--- a/src/mame/pacman/pengo.cpp
+++ b/src/mame/pacman/pengo.cpp
@@ -149,7 +149,7 @@ void pengo_state::pengo_map(address_map &map)
map(0x8400, 0x87ff).ram().w(FUNC(pengo_state::pacman_colorram_w)).share("colorram");
map(0x8800, 0x8fef).ram().share("mainram");
map(0x8ff0, 0x8fff).ram().share("spriteram");
- map(0x9000, 0x901f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x9000, 0x901f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x9020, 0x902f).writeonly().share("spriteram2");
map(0x9000, 0x903f).portr("DSW1");
map(0x9040, 0x907f).portr("DSW0");
@@ -174,7 +174,7 @@ void pengo_state::jrpacmbl_map(address_map &map)
map(0x8000, 0x87ff).ram().w(FUNC(pengo_state::jrpacman_videoram_w)).share("videoram");
map(0x8800, 0x8fef).ram();
map(0x8ff0, 0x8fff).ram().share("spriteram");
- map(0x9000, 0x901f).w(m_namco_sound, FUNC(namco_device::pacman_sound_w));
+ map(0x9000, 0x901f).w(m_namco_sound, FUNC(namco_wsg_device::pacman_sound_w));
map(0x9020, 0x902f).writeonly().share("spriteram2");
map(0x9030, 0x9030).w(FUNC(pengo_state::jrpacman_scroll_w));
map(0x9040, 0x904f).portr("DSW");
@@ -381,7 +381,7 @@ void pengo_state::pengo(machine_config &config)
LS259(config, m_latch); // U27
m_latch->q_out_cb<0>().set(FUNC(pengo_state::irq_mask_w));
- m_latch->q_out_cb<1>().set("namco", FUNC(namco_device::sound_enable_w));
+ m_latch->q_out_cb<1>().set("namco", FUNC(namco_wsg_device::sound_enable_w));
m_latch->q_out_cb<2>().set(FUNC(pengo_state::pengo_palettebank_w));
m_latch->q_out_cb<3>().set(FUNC(pengo_state::flipscreen_w));
m_latch->q_out_cb<4>().set(FUNC(pengo_state::coin_counter_w<0>));
@@ -406,8 +406,7 @@ void pengo_state::pengo(machine_config &config)
// sound hardware
SPEAKER(config, "mono").front_center();
- NAMCO(config, m_namco_sound, MASTER_CLOCK/6/32);
- m_namco_sound->set_voices(3);
+ NAMCO_WSG(config, m_namco_sound, MASTER_CLOCK/6/32);
m_namco_sound->add_route(ALL_OUTPUTS, "mono", 1.0);
}