diff --git a/src/emu/sound/namco.c b/src/emu/sound/namco.c index 658180201c1..1e4a8f78bf3 100644 --- a/src/emu/sound/namco.c +++ b/src/emu/sound/namco.c @@ -13,14 +13,8 @@ #include "emu.h" #include "namco.h" -#include "devlegcy.h" -/* 8 voices max */ -#define MAX_VOICES 8 - -#define MAX_VOLUME 16 - /* quality parameter: internal sample rate is 192 KHz, output is 48 KHz */ #define INTERNAL_RATE 192000 @@ -30,385 +24,119 @@ #define MIXLEVEL (1 << (16 - 4 - 4)) /* stream output level */ -#define OUTPUT_LEVEL(n) ((n) * MIXLEVEL / chip->num_voices) +#define OUTPUT_LEVEL(n) ((n) * MIXLEVEL / m_voices) /* a position of waveform sample */ -#define WAVEFORM_POSITION(n) (((n) >> chip->f_fracbits) & 0x1f) +#define WAVEFORM_POSITION(n) (((n) >> m_f_fracbits) & 0x1f) +const device_type NAMCO = &device_creator; +const device_type NAMCO_15XX = &device_creator; +const device_type NAMCO_CUS30 = &device_creator; -/* this structure defines the parameters for a channel */ -struct sound_channel +namco_audio_device::namco_audio_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, NAMCO, "Namco", tag, owner, clock, "namco", __FILE__), + device_sound_interface(mconfig, *this), + m_last_channel(NULL), + m_soundregs(NULL), + m_wavedata(NULL), + m_wave_size(0), + m_sound_enable(0), + m_stream(NULL), + m_namco_clock(0), + m_sample_rate(0), + m_f_fracbits(0) { - UINT32 frequency; - UINT32 counter; - INT32 volume[2]; - INT32 noise_sw; - INT32 noise_state; - INT32 noise_seed; - UINT32 noise_counter; - INT32 noise_hold; - INT32 waveform_select; -}; - - -struct namco_sound -{ - /* data about the sound system */ - sound_channel channel_list[MAX_VOICES]; - sound_channel *last_channel; - UINT8 *soundregs; - UINT8 *wavedata; - - /* global sound parameters */ - int wave_size; - INT32 num_voices; - INT32 sound_enable; - sound_stream * stream; - int namco_clock; - int sample_rate; - int f_fracbits; - int stereo; - - /* decoded waveform table */ - INT16 *waveform[MAX_VOLUME]; -}; - - -INLINE namco_sound *get_safe_token(device_t *device) -{ - assert(device != NULL); - assert(device->type() == NAMCO || - device->type() == NAMCO_15XX || - device->type() == NAMCO_CUS30); - return (namco_sound *)downcast(device)->token(); } -/* update the decoded waveform data */ -static void update_namco_waveform(namco_sound *chip, int offset, UINT8 data) +namco_device::namco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : namco_audio_device(mconfig, NAMCO, "Namco", tag, owner, clock, "namco", __FILE__) { - if (chip->wave_size == 1) - { - INT16 wdata; - int v; +} - /* use full byte, first 4 high bits, then low 4 bits */ - for (v = 0; v < MAX_VOLUME; v++) - { - wdata = ((data >> 4) & 0x0f) - 8; - chip->waveform[v][offset * 2] = OUTPUT_LEVEL(wdata * v); - wdata = (data & 0x0f) - 8; - chip->waveform[v][offset * 2 + 1] = OUTPUT_LEVEL(wdata * v); - } - } +namco_15xx_device::namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + :namco_audio_device(mconfig, NAMCO, "Namco 15XX", tag, owner, clock, "namco 15xx", __FILE__) +{ +} + +namco_cus30_device::namco_cus30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : namco_audio_device(mconfig, NAMCO, "Namco CUS30", tag, owner, clock, "namco cus30", __FILE__) +{ +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void namco_audio_device::device_config_complete() +{ + // inherit a copy of the static data + const namco_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + *static_cast(this) = *intf; + + // or initialize to defaults if none provided else { - int v; - - /* use only low 4 bits */ - for (v = 0; v < MAX_VOLUME; v++) - chip->waveform[v][offset] = OUTPUT_LEVEL(((data & 0x0f) - 8) * v); + m_voices = 0; + m_stereo = 0; } } +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- -/* build the decoded waveform table */ -static void build_decoded_waveform(running_machine &machine, namco_sound *chip, UINT8 *rgnbase) -{ - INT16 *p; - int size; - int offset; - int v; - - chip->wavedata = (rgnbase != NULL) ? rgnbase : auto_alloc_array_clear(machine, UINT8, 0x400); - - /* 20pacgal has waves in RAM but old sound system */ - if (rgnbase == NULL && chip->num_voices != 3) - { - chip->wave_size = 1; - size = 32 * 16; /* 32 samples, 16 waveforms */ - } - else - { - chip->wave_size = 0; - size = 32 * 8; /* 32 samples, 8 waveforms */ - } - - p = auto_alloc_array(machine, INT16, size * MAX_VOLUME); - - for (v = 0; v < MAX_VOLUME; v++) - { - chip->waveform[v] = p; - p += size; - } - - /* We need waveform data. It fails if region is not specified. */ - if (chip->wavedata) - { - for (offset = 0; offset < 256; offset++) - update_namco_waveform(chip, offset, chip->wavedata[offset]); - } -} - - -/* generate sound by oversampling */ -INLINE UINT32 namco_update_one(namco_sound *chip, stream_sample_t *buffer, int length, const INT16 *wave, UINT32 counter, UINT32 freq) -{ - while (length-- > 0) - { - *buffer++ += wave[WAVEFORM_POSITION(counter)]; - counter += freq; - } - - return counter; -} - - -/* generate sound to the mix buffer in mono */ -static STREAM_UPDATE( namco_update_mono ) -{ - namco_sound *chip = (namco_sound *)param; - stream_sample_t *buffer = outputs[0]; - sound_channel *voice; - - /* zap the contents of the buffer */ - memset(buffer, 0, samples * sizeof(*buffer)); - - /* if no sound, we're done */ - if (chip->sound_enable == 0) - return; - - /* loop over each voice and add its contribution */ - for (voice = chip->channel_list; voice < chip->last_channel; voice++) - { - stream_sample_t *mix = buffer; - int v = voice->volume[0]; - - if (voice->noise_sw) - { - int f = voice->frequency & 0xff; - - /* only update if we have non-zero volume and frequency */ - if (v && f) - { - int hold_time = 1 << (chip->f_fracbits - 16); - int hold = voice->noise_hold; - UINT32 delta = f << 4; - UINT32 c = voice->noise_counter; - INT16 noise_data = OUTPUT_LEVEL(0x07 * (v >> 1)); - int i; - - /* add our contribution */ - for (i = 0; i < samples; i++) - { - int cnt; - - if (voice->noise_state) - *mix++ += noise_data; - else - *mix++ -= noise_data; - - if (hold) - { - hold--; - continue; - } - - hold = hold_time; - - c += delta; - 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 and hold time for this voice */ - voice->noise_counter = c; - voice->noise_hold = hold; - } - } - else - { - /* only update if we have non-zero volume and frequency */ - if (v && voice->frequency) - { - const INT16 *w = &chip->waveform[v][voice->waveform_select * 32]; - - /* generate sound into buffer and update the counter for this voice */ - voice->counter = namco_update_one(chip, mix, samples, w, voice->counter, voice->frequency); - } - } - } -} - - -/* generate sound to the mix buffer in stereo */ -static STREAM_UPDATE( namco_update_stereo ) -{ - namco_sound *chip = (namco_sound *)param; - sound_channel *voice; - - /* zap the contents of the buffers */ - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); - - /* if no sound, we're done */ - if (chip->sound_enable == 0) - return; - - /* loop over each voice and add its contribution */ - for (voice = chip->channel_list; voice < chip->last_channel; voice++) - { - stream_sample_t *lmix = outputs[0]; - stream_sample_t *rmix = outputs[1]; - int lv = voice->volume[0]; - int rv = voice->volume[1]; - - if (voice->noise_sw) - { - int f = voice->frequency & 0xff; - - /* only update if we have non-zero volume and frequency */ - if ((lv || rv) && f) - { - int hold_time = 1 << (chip->f_fracbits - 16); - int hold = voice->noise_hold; - UINT32 delta = f << 4; - UINT32 c = voice->noise_counter; - INT16 l_noise_data = OUTPUT_LEVEL(0x07 * (lv >> 1)); - INT16 r_noise_data = OUTPUT_LEVEL(0x07 * (rv >> 1)); - int i; - - /* add our contribution */ - for (i = 0; i < samples; i++) - { - int cnt; - - if (voice->noise_state) - { - *lmix++ += l_noise_data; - *rmix++ += r_noise_data; - } - else - { - *lmix++ -= l_noise_data; - *rmix++ -= r_noise_data; - } - - if (hold) - { - hold--; - continue; - } - - hold = hold_time; - - c += delta; - 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 and hold time for this voice */ - voice->noise_counter = c; - voice->noise_hold = hold; - } - } - else - { - /* only update if we have non-zero frequency */ - if (voice->frequency) - { - /* save the counter for this voice */ - UINT32 c = voice->counter; - - /* only update if we have non-zero left volume */ - if (lv) - { - const INT16 *lw = &chip->waveform[lv][voice->waveform_select * 32]; - - /* generate sound into the buffer */ - c = namco_update_one(chip, lmix, samples, lw, voice->counter, voice->frequency); - } - - /* only update if we have non-zero right volume */ - if (rv) - { - const INT16 *rw = &chip->waveform[rv][voice->waveform_select * 32]; - - /* generate sound into the buffer */ - c = namco_update_one(chip, rmix, samples, rw, voice->counter, voice->frequency); - } - - /* update the counter for this voice */ - voice->counter = c; - } - } - } -} - - -static DEVICE_START( namco ) +void namco_audio_device::device_start() { sound_channel *voice; - const namco_interface *intf = (const namco_interface *)device->static_config(); int clock_multiple; - namco_sound *chip = get_safe_token(device); /* extract globals from the interface */ - chip->num_voices = intf->voices; - chip->last_channel = chip->channel_list + chip->num_voices; - chip->stereo = intf->stereo; - - chip->soundregs = auto_alloc_array_clear(device->machine(), UINT8, 0x400); + m_last_channel = m_channel_list + m_voices; + + m_soundregs = auto_alloc_array_clear(machine(), UINT8, 0x400); /* adjust internal clock */ - chip->namco_clock = device->clock(); - for (clock_multiple = 0; chip->namco_clock < INTERNAL_RATE; clock_multiple++) - chip->namco_clock *= 2; + m_namco_clock = clock(); + for (clock_multiple = 0; m_namco_clock < INTERNAL_RATE; clock_multiple++) + m_namco_clock *= 2; - chip->f_fracbits = clock_multiple + 15; + m_f_fracbits = clock_multiple + 15; /* adjust output clock */ - chip->sample_rate = chip->namco_clock; + m_sample_rate = m_namco_clock; - logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", chip->f_fracbits, chip->namco_clock, chip->sample_rate); + logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", m_f_fracbits, m_namco_clock, m_sample_rate); /* build the waveform table */ - build_decoded_waveform(device->machine(), chip, *device->region()); + build_decoded_waveform(*region()); /* get stream channels */ - if (intf->stereo) - chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, chip->sample_rate, chip, namco_update_stereo); + if (m_stereo) + m_stream = machine().sound().stream_alloc(*this, 0, 2, m_sample_rate, this); else - chip->stream = device->machine().sound().stream_alloc(*device, 0, 1, chip->sample_rate, chip, namco_update_mono); + m_stream = machine().sound().stream_alloc(*this, 0, 1, m_sample_rate, this); /* start with sound enabled, many games don't have a sound enable register */ - chip->sound_enable = 1; + m_sound_enable = 1; /* register with the save state system */ - device->save_pointer(NAME(chip->soundregs), 0x400); + save_pointer(NAME(m_soundregs), 0x400); - if (device->region() == NULL) - device->save_pointer(NAME(chip->wavedata), 0x400); + if (region() == NULL) + save_pointer(NAME(m_wavedata), 0x400); - device->save_item(NAME(chip->num_voices)); - device->save_item(NAME(chip->sound_enable)); - device->save_pointer(NAME(chip->waveform[0]), MAX_VOLUME * 32 * 8 * (1+chip->wave_size)); + save_item(NAME(m_voices)); + save_item(NAME(m_sound_enable)); + save_pointer(NAME(m_waveform[0]), MAX_VOLUME * 32 * 8 * (1+m_wave_size)); /* reset all the voices */ - for (voice = chip->channel_list; voice < chip->last_channel; voice++) + for (voice = m_channel_list; voice < m_last_channel; voice++) { - int voicenum = voice - chip->channel_list; + int voicenum = voice - m_channel_list; voice->frequency = 0; voice->volume[0] = voice->volume[1] = 0; @@ -421,19 +149,100 @@ static DEVICE_START( namco ) voice->noise_hold = 0; /* register with the save state system */ - device->save_item(NAME(voice->frequency), voicenum); - device->save_item(NAME(voice->counter), voicenum); - device->save_item(NAME(voice->volume), voicenum); - device->save_item(NAME(voice->noise_sw), voicenum); - device->save_item(NAME(voice->noise_state), voicenum); - device->save_item(NAME(voice->noise_seed), voicenum); - device->save_item(NAME(voice->noise_hold), voicenum); - device->save_item(NAME(voice->noise_counter), voicenum); - device->save_item(NAME(voice->waveform_select), voicenum); + save_item(NAME(voice->frequency), voicenum); + save_item(NAME(voice->counter), voicenum); + save_item(NAME(voice->volume), voicenum); + save_item(NAME(voice->noise_sw), voicenum); + save_item(NAME(voice->noise_state), voicenum); + save_item(NAME(voice->noise_seed), voicenum); + save_item(NAME(voice->noise_hold), voicenum); + save_item(NAME(voice->noise_counter), voicenum); + save_item(NAME(voice->waveform_select), voicenum); } } + +/* update the decoded waveform data */ +void namco_audio_device::update_namco_waveform(int offset, UINT8 data) +{ + if (m_wave_size == 1) + { + INT16 wdata; + int v; + + /* use full byte, first 4 high bits, then low 4 bits */ + for (v = 0; v < MAX_VOLUME; v++) + { + 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 + { + int v; + + /* use only low 4 bits */ + for (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 *rgnbase) +{ + INT16 *p; + int size; + int offset; + int v; + + m_wavedata = (rgnbase != NULL) ? rgnbase : auto_alloc_array_clear(machine(), UINT8, 0x400); + + /* 20pacgal has waves in RAM but old sound system */ + if (rgnbase == NULL && 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 */ + } + + p = auto_alloc_array(machine(), INT16, size * MAX_VOLUME); + + for (v = 0; v < MAX_VOLUME; v++) + { + m_waveform[v] = p; + p += size; + } + + /* We need waveform data. It fails if region is not specified. */ + if (m_wavedata) + { + for (offset = 0; offset < 256; offset++) + update_namco_waveform(offset, m_wavedata[offset]); + } +} + + +/* generate sound by oversampling */ +UINT32 namco_audio_device::namco_update_one(stream_sample_t *buffer, int length, const INT16 *wave, UINT32 counter, UINT32 freq) +{ + while (length-- > 0) + { + *buffer++ += wave[WAVEFORM_POSITION(counter)]; + counter += freq; + } + + return counter; +} + + /********************************************************************************/ /* pacman register map @@ -452,27 +261,25 @@ static DEVICE_START( namco ) 0x1f: ch 2 volume */ -WRITE8_DEVICE_HANDLER( pacman_sound_enable_w ) +WRITE8_MEMBER( namco_device::pacman_sound_enable_w ) { - namco_sound *chip = get_safe_token(device); - chip->sound_enable = data; + m_sound_enable = data; } -WRITE8_DEVICE_HANDLER( pacman_sound_w ) +WRITE8_MEMBER( namco_device::pacman_sound_w ) { - namco_sound *chip = get_safe_token(device); sound_channel *voice; int ch; data &= 0x0f; - if (chip->soundregs[offset] == data) + if (m_soundregs[offset] == data) return; /* update the streams */ - chip->stream->update(); + m_stream->update(); /* set the register */ - chip->soundregs[offset] = data; + m_soundregs[offset] = data; if (offset < 0x10) ch = (offset - 5) / 5; @@ -481,11 +288,11 @@ WRITE8_DEVICE_HANDLER( pacman_sound_w ) else ch = (offset - 0x11) / 5; - if (ch >= chip->num_voices) + if (ch >= m_voices) return; /* recompute the voice parameters */ - voice = chip->channel_list + ch; + voice = m_channel_list + ch; switch (offset - ch * 5) { case 0x05: @@ -499,11 +306,11 @@ WRITE8_DEVICE_HANDLER( pacman_sound_w ) case 0x14: /* the frequency has 20 bits */ /* the first voice has extra frequency bits */ - voice->frequency = (ch == 0) ? chip->soundregs[0x10] : 0; - voice->frequency += (chip->soundregs[ch * 5 + 0x11] << 4); - voice->frequency += (chip->soundregs[ch * 5 + 0x12] << 8); - voice->frequency += (chip->soundregs[ch * 5 + 0x13] << 12); - voice->frequency += (chip->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: @@ -512,6 +319,58 @@ WRITE8_DEVICE_HANDLER( pacman_sound_w ) } } +WRITE8_MEMBER( namco_cus30_device::pacman_sound_w ) +{ + sound_channel *voice; + int ch; + + data &= 0x0f; + if (m_soundregs[offset] == data) + return; + + /* update the streams */ + m_stream->update(); + + /* set the register */ + m_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) + 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; + } +} /********************************************************************************/ @@ -549,44 +408,41 @@ it select the 54XX/52XX outputs on those channels 0x3f ch 7 */ -void polepos_sound_enable(device_t *device, int enable) +void namco_device::polepos_sound_enable(int enable) { - namco_sound *chip = get_safe_token(device); - chip->sound_enable = enable; + m_sound_enable = enable; } -READ8_DEVICE_HANDLER( polepos_sound_r ) +READ8_MEMBER( namco_device::polepos_sound_r ) { - namco_sound *chip = get_safe_token(device); - return chip->soundregs[offset]; + return m_soundregs[offset]; } -WRITE8_DEVICE_HANDLER( polepos_sound_w ) +WRITE8_MEMBER( namco_device::polepos_sound_w ) { - namco_sound *chip = get_safe_token(device); sound_channel *voice; int ch; - if (chip->soundregs[offset] == data) + if (m_soundregs[offset] == data) return; /* update the streams */ - chip->stream->update(); + m_stream->update(); /* set the register */ - chip->soundregs[offset] = data; + m_soundregs[offset] = data; ch = (offset & 0x1f) / 4; /* recompute the voice parameters */ - voice = chip->channel_list + ch; + voice = m_channel_list + ch; switch (offset & 0x23) { case 0x00: case 0x01: /* the frequency has 16 bits */ - voice->frequency = chip->soundregs[ch * 4 + 0x00]; - voice->frequency += chip->soundregs[ch * 4 + 0x01] << 8; + voice->frequency = m_soundregs[ch * 4 + 0x00]; + voice->frequency += m_soundregs[ch * 4 + 0x01] << 8; break; case 0x23: @@ -596,17 +452,17 @@ WRITE8_DEVICE_HANDLER( polepos_sound_w ) case 0x03: voice->volume[0] = voice->volume[1] = 0; // front speakers ? - voice->volume[0] += chip->soundregs[ch * 4 + 0x03] >> 4; - voice->volume[1] += chip->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] += chip->soundregs[ch * 4 + 0x23] >> 4; - voice->volume[1] += chip->soundregs[ch * 4 + 0x02] >> 4; + 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; /* if 54XX or 52XX selected, silence this voice */ - if (chip->soundregs[ch * 4 + 0x23] & 8) + if (m_soundregs[ch * 4 + 0x23] & 8) voice->volume[0] = voice->volume[1] = 0; break; } @@ -633,34 +489,31 @@ WRITE8_DEVICE_HANDLER( polepos_sound_w ) 0x3e ch 7 waveform select & frequency */ -void mappy_sound_enable(device_t *device, int enable) +void namco_15xx_device::mappy_sound_enable(int enable) { - namco_sound *chip = get_safe_token(device); - chip->sound_enable = enable; + m_sound_enable = enable; } -static DECLARE_WRITE8_DEVICE_HANDLER( namco_15xx_w ); -static WRITE8_DEVICE_HANDLER( namco_15xx_w ) +WRITE8_MEMBER(namco_15xx_device::namco_15xx_w) { - namco_sound *chip = get_safe_token(device); sound_channel *voice; int ch; - if (chip->soundregs[offset] == data) + if (m_soundregs[offset] == data) return; /* update the streams */ - chip->stream->update(); + m_stream->update(); /* set the register */ - chip->soundregs[offset] = data; + m_soundregs[offset] = data; ch = offset / 8; - if (ch >= chip->num_voices) + if (ch >= m_voices) return; /* recompute the voice parameters */ - voice = chip->channel_list + ch; + voice = m_channel_list + ch; switch (offset - ch * 8) { case 0x03: @@ -672,9 +525,9 @@ static WRITE8_DEVICE_HANDLER( namco_15xx_w ) case 0x04: case 0x05: /* the frequency has 20 bits */ - voice->frequency = chip->soundregs[ch * 8 + 0x04]; - voice->frequency += chip->soundregs[ch * 8 + 0x05] << 8; - voice->frequency += (chip->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; } } @@ -706,10 +559,8 @@ static WRITE8_DEVICE_HANDLER( namco_15xx_w ) 0x3c ch 0 noise sw */ -static DECLARE_WRITE8_DEVICE_HANDLER( namcos1_sound_w ); -static WRITE8_DEVICE_HANDLER( namcos1_sound_w ) + WRITE8_MEMBER(namco_cus30_device::namcos1_sound_w) { - namco_sound *chip = get_safe_token(device); sound_channel *voice; int ch; int nssw; @@ -722,23 +573,23 @@ static WRITE8_DEVICE_HANDLER( namcos1_sound_w ) return; } - chip->soundregs = chip->wavedata + 0x100; + m_soundregs = m_wavedata + 0x100; - if (chip->soundregs[offset] == data) + if (m_soundregs[offset] == data) return; /* update the streams */ - chip->stream->update(); + m_stream->update(); /* set the register */ - chip->soundregs[offset] = data; + m_soundregs[offset] = data; ch = offset / 8; - if (ch >= chip->num_voices) + if (ch >= m_voices) return; /* recompute the voice parameters */ - voice = chip->channel_list + ch; + voice = m_channel_list + ch; switch (offset - ch * 8) { case 0x00: @@ -750,126 +601,267 @@ static WRITE8_DEVICE_HANDLER( namcos1_sound_w ) case 0x02: case 0x03: /* the frequency has 20 bits */ - voice->frequency = (chip->soundregs[ch * 8 + 0x01] & 15) << 16; /* high bits are from here */ - voice->frequency += chip->soundregs[ch * 8 + 0x02] << 8; - voice->frequency += chip->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; nssw = ((data & 0x80) >> 7); - if (++voice == chip->last_channel) - voice = chip->channel_list; + if (++voice == m_last_channel) + voice = m_channel_list; voice->noise_sw = nssw; break; } } -WRITE8_DEVICE_HANDLER( namcos1_cus30_w ) +WRITE8_MEMBER( namco_cus30_device::namcos1_cus30_w ) { - namco_sound *chip = get_safe_token(device); - if (offset < 0x100) { - if (chip->wavedata[offset] != data) + if (m_wavedata[offset] != data) { /* update the streams */ - chip->stream->update(); + m_stream->update(); - chip->wavedata[offset] = data; + m_wavedata[offset] = data; /* update the decoded waveform table */ - update_namco_waveform(chip, offset, data); + update_namco_waveform(offset, data); } } else if (offset < 0x140) - namcos1_sound_w(device, space, offset - 0x100,data); + namcos1_sound_w(space, offset - 0x100,data); else - chip->wavedata[offset] = data; + m_wavedata[offset] = data; } -READ8_DEVICE_HANDLER( namcos1_cus30_r ) +READ8_MEMBER( namco_cus30_device::namcos1_cus30_r ) { - namco_sound *chip = get_safe_token(device); - - return chip->wavedata[offset]; + return m_wavedata[offset]; } -READ8_DEVICE_HANDLER( namco_snd_sharedram_r ) +READ8_MEMBER( namco_15xx_device::sharedram_r ) { - namco_sound *chip = get_safe_token(device); - - return chip->soundregs[offset]; + return m_soundregs[offset]; } -WRITE8_DEVICE_HANDLER( namco_snd_sharedram_w ) +WRITE8_MEMBER( namco_15xx_device::sharedram_w ) { if (offset < 0x40) - namco_15xx_w(device, space, offset, data); + namco_15xx_w(space, offset, data); else { - namco_sound *chip = get_safe_token(device); - chip->soundregs[offset] = data; + m_soundregs[offset] = data; } } -const device_type NAMCO = &device_creator; - -namco_device::namco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, NAMCO, "Namco", tag, owner, clock, "namco", __FILE__), - device_sound_interface(mconfig, *this) -{ - m_token = global_alloc_clear(namco_sound); -} - -namco_device::namco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - device_sound_interface(mconfig, *this) -{ - m_token = global_alloc_clear(namco_sound); -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void namco_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void namco_device::device_start() -{ - DEVICE_START_NAME( namco )(this); -} - //------------------------------------------------- // sound_stream_update - handle a stream update //------------------------------------------------- +void namco_audio_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + if (m_stereo) + { + sound_channel *voice; + + /* zap the contents of the buffers */ + memset(outputs[0], 0, samples * sizeof(*outputs[0])); + memset(outputs[1], 0, samples * sizeof(*outputs[1])); + + /* if no sound, we're done */ + if (m_sound_enable == 0) + return; + + /* loop over each voice and add its contribution */ + for (voice = m_channel_list; voice < m_last_channel; voice++) + { + stream_sample_t *lmix = outputs[0]; + stream_sample_t *rmix = outputs[1]; + int lv = voice->volume[0]; + int rv = voice->volume[1]; + + if (voice->noise_sw) + { + int f = voice->frequency & 0xff; + + /* only update if we have non-zero volume and frequency */ + if ((lv || rv) && f) + { + int hold_time = 1 << (m_f_fracbits - 16); + int hold = voice->noise_hold; + UINT32 delta = f << 4; + UINT32 c = voice->noise_counter; + INT16 l_noise_data = OUTPUT_LEVEL(0x07 * (lv >> 1)); + INT16 r_noise_data = OUTPUT_LEVEL(0x07 * (rv >> 1)); + int i; + + /* add our contribution */ + for (i = 0; i < samples; i++) + { + int cnt; + + if (voice->noise_state) + { + *lmix++ += l_noise_data; + *rmix++ += r_noise_data; + } + else + { + *lmix++ -= l_noise_data; + *rmix++ -= r_noise_data; + } + + if (hold) + { + hold--; + continue; + } + + hold = hold_time; + + c += delta; + 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 and hold time for this voice */ + voice->noise_counter = c; + voice->noise_hold = hold; + } + } + else + { + /* only update if we have non-zero frequency */ + if (voice->frequency) + { + /* save the counter for this voice */ + UINT32 c = voice->counter; + + /* only update if we have non-zero left volume */ + if (lv) + { + const INT16 *lw = &m_waveform[lv][voice->waveform_select * 32]; + + /* generate sound into the buffer */ + c = namco_update_one(lmix, samples, lw, voice->counter, voice->frequency); + } + + /* only update if we have non-zero right volume */ + if (rv) + { + const INT16 *rw = &m_waveform[rv][voice->waveform_select * 32]; + + /* generate sound into the buffer */ + c = namco_update_one(rmix, samples, rw, voice->counter, voice->frequency); + } + + /* update the counter for this voice */ + voice->counter = c; + } + } + } + } + else + { + sound_channel *voice; + + stream_sample_t *buffer = outputs[0]; + /* zap the contents of the buffer */ + memset(buffer, 0, samples * sizeof(*buffer)); + + /* if no sound, we're done */ + + if (m_sound_enable == 0) + return; + + /* loop over each voice and add its contribution */ + for (voice = m_channel_list; voice < m_last_channel; voice++) + { + stream_sample_t *mix = buffer; + int v = voice->volume[0]; + if (voice->noise_sw) + { + int f = voice->frequency & 0xff; + /* only update if we have non-zero volume and frequency */ + if (v && f) + { + int hold_time = 1 << (m_f_fracbits - 16); + int hold = voice->noise_hold; + UINT32 delta = f << 4; + UINT32 c = voice->noise_counter; + INT16 noise_data = OUTPUT_LEVEL(0x07 * (v >> 1)); + int i; + + /* add our contribution */ + for (i = 0; i < samples; i++) + { + int cnt; + + if (voice->noise_state) + *mix++ += noise_data; + else + *mix++ -= noise_data; + + if (hold) + { + hold--; + continue; + } + + hold = hold_time; + + c += delta; + 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 and hold time for this voice */ + voice->noise_counter = c; + voice->noise_hold = hold; + } + } + else + { + /* only update if we have non-zero volume and frequency */ + if (v && voice->frequency) + { + const INT16 *w = &m_waveform[v][voice->waveform_select * 32]; + + /* generate sound into buffer and update the counter for this voice */ + voice->counter = namco_update_one(mix, samples, w, voice->counter, voice->frequency); + } + } + } + } +} + void namco_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { - // should never get here - fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); + namco_audio_device::sound_stream_update(stream, inputs, outputs, samples); } - - -const device_type NAMCO_15XX = &device_creator; - -namco_15xx_device::namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : namco_device(mconfig, NAMCO_15XX, "Namco 15XX", tag, owner, clock, "namco_15xx", __FILE__) + +void namco_15xx_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { + namco_audio_device::sound_stream_update(stream, inputs, outputs, samples); } - -const device_type NAMCO_CUS30 = &device_creator; - -namco_cus30_device::namco_cus30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : namco_device(mconfig, NAMCO_CUS30, "Namco CUS30", tag, owner, clock, "namco_cus30", __FILE__) + +void namco_cus30_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { -} + namco_audio_device::sound_stream_update(stream, inputs, outputs, samples); +} \ No newline at end of file diff --git a/src/emu/sound/namco.h b/src/emu/sound/namco.h index 98d011a5989..ec0483b0fd2 100644 --- a/src/emu/sound/namco.h +++ b/src/emu/sound/namco.h @@ -2,69 +2,122 @@ #ifndef __NAMCO_H__ #define __NAMCO_H__ + +/* 8 voices max */ +#define MAX_VOICES 8 - +#define MAX_VOLUME 16 + struct namco_interface { - int voices; /* number of voices */ - int stereo; /* set to 1 to indicate stereo (e.g., System 1) */ + int m_voices; /* number of voices */ + int m_stereo; /* set to 1 to indicate stereo (e.g., System 1) */ }; - -DECLARE_WRITE8_DEVICE_HANDLER( pacman_sound_enable_w ); -DECLARE_WRITE8_DEVICE_HANDLER( pacman_sound_w ); - -void polepos_sound_enable(device_t *device, int enable); -DECLARE_READ8_DEVICE_HANDLER( polepos_sound_r ); -DECLARE_WRITE8_DEVICE_HANDLER( polepos_sound_w ); - -void mappy_sound_enable(device_t *device, int enable); - -DECLARE_WRITE8_DEVICE_HANDLER( namcos1_cus30_w ); /* wavedata + sound registers + RAM */ -DECLARE_READ8_DEVICE_HANDLER( namcos1_cus30_r ); - -DECLARE_READ8_DEVICE_HANDLER( namco_snd_sharedram_r ); -DECLARE_WRITE8_DEVICE_HANDLER( namco_snd_sharedram_w ); - -class namco_device : public device_t, - public device_sound_interface + +/* this structure defines the parameters for a channel */ +struct sound_channel +{ + UINT32 frequency; + UINT32 counter; + INT32 volume[2]; + INT32 noise_sw; + INT32 noise_state; + INT32 noise_seed; + UINT32 noise_counter; + INT32 noise_hold; + INT32 waveform_select; +}; + +class namco_audio_device : public device_t, + public device_sound_interface, + public namco_interface { public: - namco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - namco_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); - ~namco_device() { global_free(m_token); } - - // access to legacy token - void *token() const { assert(m_token != NULL); return m_token; } -protected: - // device-level overrides - virtual void device_config_complete(); - virtual void device_start(); - - // sound stream update overrides + namco_audio_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + ~namco_audio_device() {} + + protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + + // internal state + + void build_decoded_waveform( UINT8 *rgnbase ); + void update_namco_waveform(int offset, UINT8 data); + UINT32 namco_update_one(stream_sample_t *buffer, int length, const INT16 *wave, UINT32 counter, UINT32 freq); + + /* data about the sound system */ + sound_channel m_channel_list[MAX_VOICES]; + sound_channel *m_last_channel; + UINT8 *m_soundregs; + UINT8 *m_wavedata; + + /* global sound parameters */ + int m_wave_size; + INT32 m_sound_enable; + sound_stream *m_stream; + int m_namco_clock; + int m_sample_rate; + int m_f_fracbits; + + /* decoded waveform table */ + INT16 *m_waveform[MAX_VOLUME]; + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); -private: - // internal state - void *m_token; }; - + +class namco_device : public namco_audio_device +{ +public: + namco_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE8_MEMBER( pacman_sound_enable_w ); + DECLARE_WRITE8_MEMBER( pacman_sound_w ); + + void polepos_sound_enable(int enable); + + DECLARE_READ8_MEMBER( polepos_sound_r ); + DECLARE_WRITE8_MEMBER( polepos_sound_w ); + +protected: + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + extern const device_type NAMCO; - -class namco_15xx_device : public namco_device + +class namco_15xx_device : public namco_audio_device { public: - namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE8_MEMBER( namco_15xx_w ); + DECLARE_READ8_MEMBER( sharedram_r ); + DECLARE_WRITE8_MEMBER( sharedram_w ); + + void mappy_sound_enable(int enable); + +protected: + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); }; - + extern const device_type NAMCO_15XX; - -class namco_cus30_device : public namco_device + +class namco_cus30_device : public namco_audio_device { public: - namco_cus30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + namco_cus30_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE8_MEMBER( namcos1_cus30_w ); /* wavedata + sound registers + RAM */ + DECLARE_READ8_MEMBER( namcos1_cus30_r ); + DECLARE_WRITE8_MEMBER( namcos1_sound_w ); + + DECLARE_WRITE8_MEMBER( pacman_sound_w ); + +protected: + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); }; - + extern const device_type NAMCO_CUS30; - - #endif /* __NAMCO_H__ */ diff --git a/src/mame/drivers/20pacgal.c b/src/mame/drivers/20pacgal.c index f3451693c73..8c1c944ddd4 100644 --- a/src/mame/drivers/20pacgal.c +++ b/src/mame/drivers/20pacgal.c @@ -84,7 +84,6 @@ Graphics: CY37256P160-83AC x 2 (Ultra37000 CPLD family - 160 pin TQFP, 256 Macro #include "emu.h" #include "cpu/z180/z180.h" #include "machine/eeprom.h" -#include "sound/namco.h" #include "sound/dac.h" #include "includes/20pacgal.h" @@ -227,9 +226,9 @@ static ADDRESS_MAP_START( 20pacgal_map, AS_PROGRAM, 8, _20pacgal_state ) AM_RANGE(0x0a000, 0x0ffff) AM_MIRROR(0x40000) AM_ROM AM_RANGE(0x10000, 0x3ffff) AM_ROM AM_RANGE(0x44000, 0x447ff) AM_RAM AM_SHARE("video_ram") - AM_RANGE(0x45040, 0x4505f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x45040, 0x4505f) AM_DEVWRITE("namco", namco_cus30_device, pacman_sound_w) AM_RANGE(0x44800, 0x45eff) AM_RAM - AM_RANGE(0x45f00, 0x45fff) AM_DEVWRITE_LEGACY("namco", namcos1_cus30_w) + AM_RANGE(0x45f00, 0x45fff) AM_DEVWRITE("namco", namco_cus30_device, namcos1_cus30_w) AM_RANGE(0x46000, 0x46fff) AM_WRITEONLY AM_SHARE("char_gfx_ram") AM_RANGE(0x47100, 0x47100) AM_RAM /* leftover from original Galaga code */ AM_RANGE(0x48000, 0x49fff) AM_READ_BANK("bank1") AM_WRITE(ram_48000_w) /* this should be a mirror of 08000-09ffff */ @@ -377,7 +376,7 @@ static MACHINE_CONFIG_START( 20pacgal, _20pacgal_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("namco", NAMCO, NAMCO_AUDIO_CLOCK) + MCFG_SOUND_ADD("namco", NAMCO_CUS30, NAMCO_AUDIO_CLOCK) MCFG_SOUND_CONFIG(namco_config) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/baraduke.c b/src/mame/drivers/baraduke.c index ed605c3c3c2..b4b83ef75f9 100644 --- a/src/mame/drivers/baraduke.c +++ b/src/mame/drivers/baraduke.c @@ -108,7 +108,6 @@ DIP locations verified for: #include "emu.h" #include "cpu/m6809/m6809.h" #include "cpu/m6800/m6800.h" -#include "sound/namco.h" #include "includes/baraduke.h" @@ -163,7 +162,7 @@ WRITE8_MEMBER(baraduke_state::baraduke_irq_ack_w) static ADDRESS_MAP_START( baraduke_map, AS_PROGRAM, 8, baraduke_state ) AM_RANGE(0x0000, 0x1fff) AM_READWRITE(baraduke_spriteram_r,baraduke_spriteram_w) AM_SHARE("spriteram") /* Sprite RAM */ AM_RANGE(0x2000, 0x3fff) AM_READWRITE(baraduke_videoram_r,baraduke_videoram_w) AM_SHARE("videoram") /* Video RAM */ - AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r,namcos1_cus30_w) /* PSG device, shared RAM */ + AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ AM_RANGE(0x4800, 0x4fff) AM_READWRITE(baraduke_textram_r,baraduke_textram_w) AM_SHARE("textram")/* video RAM (text layer) */ AM_RANGE(0x8000, 0x8000) AM_WRITE(watchdog_reset_w) /* watchdog reset */ AM_RANGE(0x8800, 0x8800) AM_WRITE(baraduke_irq_ack_w) /* irq acknowledge */ @@ -181,7 +180,7 @@ static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, baraduke_state ) AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r,m6801_io_w)/* internal registers */ AM_RANGE(0x0080, 0x00ff) AM_RAM /* built in RAM */ AM_RANGE(0x1105, 0x1105) AM_READ(soundkludge_r) /* cures speech */ - AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ + AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ AM_RANGE(0x8000, 0xbfff) AM_ROM /* MCU external ROM */ AM_RANGE(0x8000, 0x8000) AM_WRITENOP /* watchdog reset? */ AM_RANGE(0x8800, 0x8800) AM_WRITENOP /* irq acknoledge? */ diff --git a/src/mame/drivers/galaga.c b/src/mame/drivers/galaga.c index 75e355e6766..54e40136216 100644 --- a/src/mame/drivers/galaga.c +++ b/src/mame/drivers/galaga.c @@ -702,7 +702,6 @@ TODO: #include "machine/namco51.h" #include "machine/namco53.h" #include "includes/galaga.h" -#include "sound/namco.h" #include "audio/namco52.h" #include "machine/rescap.h" #include "sound/samples.h" @@ -911,7 +910,7 @@ MACHINE_RESET_MEMBER(xevious_state,battles) static ADDRESS_MAP_START( bosco_map, AS_PROGRAM, 8, bosco_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP /* the only area different for each CPU */ AM_RANGE(0x6800, 0x6807) AM_READ(bosco_dsw_r) - AM_RANGE(0x6800, 0x681f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x6800, 0x681f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x6820, 0x6827) AM_WRITE(bosco_latch_w) /* misc latches */ AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w) AM_RANGE(0x7000, 0x70ff) AM_DEVREADWRITE_LEGACY("06xx_0", namco_06xx_data_r, namco_06xx_data_w) @@ -933,7 +932,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( galaga_map, AS_PROGRAM, 8, galaga_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP /* the only area different for each CPU */ AM_RANGE(0x6800, 0x6807) AM_READ(bosco_dsw_r) - AM_RANGE(0x6800, 0x681f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x6800, 0x681f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x6820, 0x6827) AM_WRITE(bosco_latch_w) /* misc latches */ AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w) AM_RANGE(0x7000, 0x70ff) AM_DEVREADWRITE_LEGACY("06xx", namco_06xx_data_r, namco_06xx_data_w) @@ -950,7 +949,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( xevious_map, AS_PROGRAM, 8, xevious_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP /* the only area different for each CPU */ AM_RANGE(0x6800, 0x6807) AM_READ(bosco_dsw_r) - AM_RANGE(0x6800, 0x681f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x6800, 0x681f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x6820, 0x6827) AM_WRITE(bosco_latch_w) /* misc latches */ AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w) AM_RANGE(0x7000, 0x70ff) AM_DEVREADWRITE_LEGACY("06xx", namco_06xx_data_r, namco_06xx_data_w) @@ -970,7 +969,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( digdug_map, AS_PROGRAM, 8, digdug_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP /* the only area different for each CPU */ - AM_RANGE(0x6800, 0x681f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x6800, 0x681f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x6820, 0x6827) AM_WRITE(bosco_latch_w) /* misc latches */ AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w) AM_RANGE(0x7000, 0x70ff) AM_DEVREADWRITE_LEGACY("06xx", namco_06xx_data_r, namco_06xx_data_w) diff --git a/src/mame/drivers/gaplus.c b/src/mame/drivers/gaplus.c index 975af49cc92..f127a956096 100644 --- a/src/mame/drivers/gaplus.c +++ b/src/mame/drivers/gaplus.c @@ -152,7 +152,6 @@ TODO: #include "emu.h" #include "cpu/m6809/m6809.h" #include "machine/namco62.h" -#include "sound/namco.h" #include "sound/samples.h" #include "includes/gaplus.h" @@ -196,7 +195,7 @@ WRITE8_MEMBER(gaplus_state::gaplus_sreset_w) int bit = !BIT(offset, 11); m_subcpu->set_input_line(INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); m_subcpu2->set_input_line(INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); - mappy_sound_enable(machine().device("namco"), bit); + m_namco_15xx->mappy_sound_enable(bit); } WRITE8_MEMBER(gaplus_state::gaplus_freset_w) @@ -296,7 +295,7 @@ INTERRUPT_GEN_MEMBER(gaplus_state::gaplus_vblank_sub2_irq) static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM, 8, gaplus_state ) AM_RANGE(0x0000, 0x07ff) AM_READWRITE(gaplus_videoram_r, gaplus_videoram_w) AM_SHARE("videoram") /* tilemap RAM (shared with CPU #2) */ AM_RANGE(0x0800, 0x1fff) AM_READWRITE(gaplus_spriteram_r, gaplus_spriteram_w) AM_SHARE("spriteram") /* shared RAM with CPU #2 (includes sprite RAM) */ - AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with CPU #3 */ + AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with CPU #3 */ AM_RANGE(0x6800, 0x680f) AM_DEVREADWRITE("namcoio_1", namcoio_device, read, write) /* custom I/O chips interface */ AM_RANGE(0x6810, 0x681f) AM_DEVREADWRITE("namcoio_2", namcoio_device, read, write) /* custom I/O chips interface */ AM_RANGE(0x6820, 0x682f) AM_READWRITE(gaplus_customio_3_r, gaplus_customio_3_w) AM_SHARE("customio_3") /* custom I/O chip #3 interface */ @@ -317,7 +316,7 @@ static ADDRESS_MAP_START( cpu2_map, AS_PROGRAM, 8, gaplus_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( cpu3_map, AS_PROGRAM, 8, gaplus_state ) - AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the main CPU + sound registers */ + AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with the main CPU + sound registers */ AM_RANGE(0x2000, 0x3fff) AM_READWRITE(watchdog_reset_r, watchdog_reset_w) /* watchdog? */ AM_RANGE(0x4000, 0x7fff) AM_WRITE(gaplus_irq_3_ctrl_w) /* interrupt enable/disable */ AM_RANGE(0xe000, 0xffff) AM_ROM /* ROM */ diff --git a/src/mame/drivers/jrpacman.c b/src/mame/drivers/jrpacman.c index 2c2e6a701d1..4531efa2f17 100644 --- a/src/mame/drivers/jrpacman.c +++ b/src/mame/drivers/jrpacman.c @@ -101,7 +101,6 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "includes/pacman.h" -#include "sound/namco.h" class jrpacman_state : public pacman_state @@ -141,10 +140,10 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, jrpacman_state ) AM_RANGE(0x4ff0, 0x4fff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5000, 0x503f) AM_READ_PORT("P1") AM_RANGE(0x5000, 0x5000) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5003, 0x5003) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5040, 0x507f) AM_READ_PORT("P2") - AM_RANGE(0x5040, 0x505f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5040, 0x505f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x5060, 0x506f) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x5070, 0x5070) AM_WRITE(pengo_palettebank_w) AM_RANGE(0x5071, 0x5071) AM_WRITE(pengo_colortablebank_w) diff --git a/src/mame/drivers/mappy.c b/src/mame/drivers/mappy.c index 1bb35eedb76..6e0a15ffc42 100644 --- a/src/mame/drivers/mappy.c +++ b/src/mame/drivers/mappy.c @@ -549,7 +549,6 @@ TODO: #include "emu.h" #include "cpu/m6809/m6809.h" #include "sound/dac.h" -#include "sound/namco.h" #include "includes/mappy.h" /************************************* @@ -597,7 +596,7 @@ void mappy_state::common_latch_w(UINT32 offset) break; case 0x06: /* SOUND ON */ - mappy_sound_enable(machine().device("namco"), bit); + m_namco_15xx->mappy_sound_enable(bit); break; case 0x0a: /* SUB RESET */ @@ -955,7 +954,7 @@ static ADDRESS_MAP_START( superpac_cpu1_map, AS_PROGRAM, 8, mappy_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_SHARE("videoram") /* video RAM */ AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* work RAM with embedded sprite RAM */ AM_RANGE(0x2000, 0x2000) AM_READWRITE(superpac_flipscreen_r, superpac_flipscreen_w) - AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the sound CPU */ + AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with the sound CPU */ AM_RANGE(0x4800, 0x480f) AM_DEVREADWRITE("namcoio_1", namcoio_device, read, write) /* custom I/O chips interface */ AM_RANGE(0x4810, 0x481f) AM_DEVREADWRITE("namcoio_2", namcoio_device, read, write) /* custom I/O chips interface */ AM_RANGE(0x5000, 0x500f) AM_WRITE(superpac_latch_w) /* various control bits */ @@ -966,7 +965,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( phozon_cpu1_map, AS_PROGRAM, 8, mappy_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_SHARE("videoram") /* video RAM */ AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* shared RAM with CPU #2/sprite RAM*/ - AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the sound CPU */ + AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with the sound CPU */ AM_RANGE(0x4800, 0x480f) AM_DEVREADWRITE("namcoio_1", namcoio_device, read, write) /* custom I/O chips interface */ AM_RANGE(0x4810, 0x481f) AM_DEVREADWRITE("namcoio_2", namcoio_device, read, write) /* custom I/O chips interface */ AM_RANGE(0x5000, 0x500f) AM_WRITE(phozon_latch_w) /* various control bits */ @@ -978,7 +977,7 @@ static ADDRESS_MAP_START( mappy_cpu1_map, AS_PROGRAM, 8, mappy_state ) AM_RANGE(0x0000, 0x0fff) AM_RAM_WRITE(mappy_videoram_w) AM_SHARE("videoram") /* video RAM */ AM_RANGE(0x1000, 0x27ff) AM_RAM AM_SHARE("spriteram") /* work RAM with embedded sprite RAM */ AM_RANGE(0x3800, 0x3fff) AM_WRITE(mappy_scroll_w) /* scroll */ - AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the sound CPU */ + AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with the sound CPU */ AM_RANGE(0x4800, 0x480f) AM_DEVREADWRITE("namcoio_1", namcoio_device, read, write) /* custom I/O chips interface */ AM_RANGE(0x4810, 0x481f) AM_DEVREADWRITE("namcoio_2", namcoio_device, read, write) /* custom I/O chips interface */ AM_RANGE(0x5000, 0x500f) AM_WRITE(mappy_latch_w) /* various control bits */ @@ -987,18 +986,18 @@ static ADDRESS_MAP_START( mappy_cpu1_map, AS_PROGRAM, 8, mappy_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( superpac_cpu2_map, AS_PROGRAM, 8, mappy_state ) - AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the main CPU (also sound registers) */ + AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with the main CPU (also sound registers) */ AM_RANGE(0x2000, 0x200f) AM_WRITE(superpac_latch_w) /* various control bits */ AM_RANGE(0xe000, 0xffff) AM_ROM ADDRESS_MAP_END static ADDRESS_MAP_START( phozon_cpu2_map, AS_PROGRAM, 8, mappy_state ) - AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the main CPU + sound registers */ + AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with the main CPU + sound registers */ AM_RANGE(0xe000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END static ADDRESS_MAP_START( mappy_cpu2_map, AS_PROGRAM, 8, mappy_state ) - AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the main CPU (also sound registers) */ + AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with the main CPU (also sound registers) */ AM_RANGE(0x2000, 0x200f) AM_WRITE(mappy_latch_w) /* various control bits */ AM_RANGE(0xe000, 0xffff) AM_ROM /* ROM code */ ADDRESS_MAP_END @@ -1008,7 +1007,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( phozon_cpu3_map, AS_PROGRAM, 8, mappy_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_SHARE("videoram") /* video RAM */ AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* shared RAM with CPU #2/sprite RAM*/ - AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with CPU #2 */ + AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with CPU #2 */ AM_RANGE(0xa000, 0xa7ff) AM_RAM /* RAM */ AM_RANGE(0xe000, 0xffff) AM_ROM /* ROM */ ADDRESS_MAP_END diff --git a/src/mame/drivers/namcos1.c b/src/mame/drivers/namcos1.c index 6d2a5824251..fcb01fe23d8 100644 --- a/src/mame/drivers/namcos1.c +++ b/src/mame/drivers/namcos1.c @@ -342,7 +342,6 @@ C - uses sub board with support for player 3 and 4 controls #include "cpu/m6809/m6809.h" #include "cpu/m6800/m6800.h" #include "sound/2151intf.h" -#include "sound/namco.h" #include "sound/dac.h" #include "machine/nvram.h" #include "includes/namcos1.h" @@ -467,7 +466,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, namcos1_state ) AM_RANGE(0x0000, 0x3fff) AM_ROMBANK("bank17") /* Banked ROMs */ AM_RANGE(0x4000, 0x4001) AM_DEVREAD("ymsnd", ym2151_device, status_r) AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) - AM_RANGE(0x5000, 0x53ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) AM_MIRROR(0x400) /* PSG ( Shared ) */ + AM_RANGE(0x5000, 0x53ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) AM_MIRROR(0x400) /* PSG ( Shared ) */ AM_RANGE(0x7000, 0x77ff) AM_RAMBANK("bank18") /* TRIRAM (shared) */ AM_RANGE(0x8000, 0x9fff) AM_RAM /* Sound RAM 3 */ AM_RANGE(0xc000, 0xc001) AM_WRITE(namcos1_sound_bankswitch_w) /* ROM bank selector */ diff --git a/src/mame/drivers/namcos86.c b/src/mame/drivers/namcos86.c index 7a6d48ec758..c86ede26fd4 100644 --- a/src/mame/drivers/namcos86.c +++ b/src/mame/drivers/namcos86.c @@ -178,7 +178,6 @@ TODO: #include "cpu/m6809/m6809.h" #include "cpu/m6800/m6800.h" #include "sound/2151intf.h" -#include "sound/namco.h" #include "sound/n63701x.h" #include "includes/namcos86.h" @@ -335,7 +334,7 @@ static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM, 8, namcos86_state ) AM_RANGE(0x0000, 0x1fff) AM_READWRITE(rthunder_videoram1_r,rthunder_videoram1_w) AM_SHARE("videoram1") AM_RANGE(0x2000, 0x3fff) AM_READWRITE(rthunder_videoram2_r,rthunder_videoram2_w) AM_SHARE("videoram2") - AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ + AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ AM_RANGE(0x4000, 0x5fff) AM_READWRITE(rthunder_spriteram_r,rthunder_spriteram_w) @@ -390,7 +389,7 @@ CPU2_MEMORY( wndrmomo, 0x2000, 0x4000, 0x6000, UNUSED, UNUSED, 0xc000, 0xc800 ) static ADDRESS_MAP_START( NAME##_mcu_map, AS_PROGRAM, 8, namcos86_state ) \ AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r,m6801_io_w) \ AM_RANGE(0x0080, 0x00ff) AM_RAM \ - AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ \ + AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ \ AM_RANGE(0x1400, 0x1fff) AM_RAM \ AM_RANGE(ADDR_INPUT+0x00, ADDR_INPUT+0x01) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) \ AM_RANGE(ADDR_INPUT+0x20, ADDR_INPUT+0x20) AM_READ_PORT("IN0") \ diff --git a/src/mame/drivers/pacland.c b/src/mame/drivers/pacland.c index 06892a95557..58e1e115b31 100644 --- a/src/mame/drivers/pacland.c +++ b/src/mame/drivers/pacland.c @@ -175,7 +175,6 @@ Notes: #include "emu.h" #include "cpu/m6809/m6809.h" #include "cpu/m6800/m6800.h" -#include "sound/namco.h" #include "includes/pacland.h" WRITE8_MEMBER(pacland_state::pacland_subreset_w) @@ -243,7 +242,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, pacland_state ) AM_RANGE(0x3a00, 0x3a01) AM_WRITE(pacland_scroll1_w) AM_RANGE(0x3c00, 0x3c00) AM_WRITE(pacland_bankswitch_w) AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank1") - AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ + AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ AM_RANGE(0x7000, 0x7fff) AM_WRITE(pacland_irq_1_ctrl_w) AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r) AM_RANGE(0x8000, 0xffff) AM_ROM @@ -254,7 +253,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, pacland_state ) AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w) AM_RANGE(0x0080, 0x00ff) AM_RAM - AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ + AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ AM_RANGE(0x2000, 0x3fff) AM_WRITE(watchdog_reset_w) /* watchdog? */ AM_RANGE(0x4000, 0x7fff) AM_WRITE(pacland_irq_2_ctrl_w) AM_RANGE(0x8000, 0xbfff) AM_ROM diff --git a/src/mame/drivers/pacman.c b/src/mame/drivers/pacman.c index 3fbf126ecf9..f78e0d11407 100644 --- a/src/mame/drivers/pacman.c +++ b/src/mame/drivers/pacman.c @@ -337,7 +337,6 @@ Boards: #include "includes/pacman.h" #include "cpu/s2650/s2650.h" #include "machine/nvram.h" -#include "sound/namco.h" #include "sound/ay8910.h" #include "sound/sn76496.h" @@ -527,11 +526,11 @@ WRITE8_MEMBER(pacman_state::alibaba_sound_w) /* since the sound region in Ali Baba is not contiguous, translate the offset into the 0-0x1f range */ if (offset < 0x10) - pacman_sound_w(machine().device("namco"), space, offset, data); + m_namco_sound->pacman_sound_w(space, offset, data); else if (offset < 0x20) m_spriteram2[offset - 0x10] = data; else - pacman_sound_w(machine().device("namco"), space, offset - 0x10, data); + m_namco_sound->pacman_sound_w(space, offset - 0x10, data); } READ8_MEMBER(pacman_state::alibaba_mystery_1_r) @@ -962,13 +961,13 @@ static ADDRESS_MAP_START( pacman_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITENOP AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_leds_w) AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_coin_lockout_global_w) AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w) - AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITENOP AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITENOP @@ -990,13 +989,13 @@ static ADDRESS_MAP_START( birdiy_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_WRITE(irq_mask_w) -// AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) +// AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) // AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITENOP AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w) // AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_leds_w) // AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_coin_lockout_global_w) AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w) - AM_RANGE(0x5080, 0x509f) AM_MIRROR(0xaf00) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5080, 0x509f) AM_MIRROR(0xaf00) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x50a0, 0x50af) AM_MIRROR(0xaf00) AM_WRITEONLY AM_SHARE("spriteram2") // AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITENOP // AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITENOP @@ -1015,13 +1014,13 @@ static ADDRESS_MAP_START( mspacman_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITENOP AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_leds_w) AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_lockout_global_w) AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w) - AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITENOP AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITENOP @@ -1055,13 +1054,13 @@ static ADDRESS_MAP_START( woodpek_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITENOP AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_leds_w) AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_coin_lockout_global_w) AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w) - AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITENOP AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITENOP @@ -1090,7 +1089,7 @@ static ADDRESS_MAP_START( alibaba_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITEONLY AM_SHARE("spriteram2") /* actually at 5050-505f, here to point to free RAM */ AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITENOP AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITENOP - AM_RANGE(0x50c0, 0x50c0) AM_MIRROR(0xaf00) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x50c0, 0x50c0) AM_MIRROR(0xaf00) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x50c1, 0x50c1) AM_MIRROR(0xaf00) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x50c2, 0x50c2) AM_MIRROR(0xaf00) AM_WRITE(irq_mask_w) AM_RANGE(0x50c3, 0x50ff) AM_MIRROR(0xaf00) AM_WRITENOP @@ -1113,13 +1112,13 @@ static ADDRESS_MAP_START( dremshpr_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4800, 0x4fef) AM_MIRROR(0xa000) AM_RAM AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(irq_mask_w) -// AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) +// AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITENOP /* unknown */ AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_leds_w) AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_coin_lockout_global_w) AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w) -// AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) +// AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITENOP AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITENOP @@ -1144,13 +1143,13 @@ static ADDRESS_MAP_START( epos_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITENOP AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_leds_w) AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_coin_lockout_global_w) AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w) - AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITENOP AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITENOP @@ -1198,10 +1197,10 @@ static ADDRESS_MAP_START( rocktrv2_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4400, 0x47ff) AM_RAM_WRITE(pacman_colorram_w) AM_SHARE("colorram") AM_RANGE(0x4c00, 0x4fff) AM_RAM AM_RANGE(0x5000, 0x5000) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5003, 0x5003) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5007, 0x5007) AM_WRITE(pacman_coin_counter_w) - AM_RANGE(0x5040, 0x505f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5040, 0x505f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x50c0, 0x50c0) AM_WRITE(watchdog_reset_w) AM_RANGE(0x5fe0, 0x5fe3) AM_WRITE(rocktrv2_prot_data_w) AM_SHARE("rocktrv2_prot") AM_RANGE(0x5ff0, 0x5ff0) AM_WRITE(rocktrv2_question_bank_w) @@ -1225,10 +1224,10 @@ static ADDRESS_MAP_START( bigbucks_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4400, 0x47ff) AM_RAM_WRITE(pacman_colorram_w) AM_SHARE("colorram") AM_RANGE(0x4c00, 0x4fff) AM_RAM AM_RANGE(0x5000, 0x5000) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5003, 0x5003) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5007, 0x5007) AM_WRITENOP /*?*/ - AM_RANGE(0x5040, 0x505f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5040, 0x505f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x50c0, 0x50c0) AM_WRITE(watchdog_reset_w) AM_RANGE(0x5000, 0x503f) AM_READ_PORT("IN0") AM_RANGE(0x5040, 0x507f) AM_READ_PORT("IN1") @@ -1248,13 +1247,13 @@ static ADDRESS_MAP_START( mschamp_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITENOP AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_leds_w) AM_RANGE(0x5006, 0x5006) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_coin_lockout_global_w) AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w) - AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITENOP AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITENOP @@ -1274,12 +1273,12 @@ static ADDRESS_MAP_START( superabc_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4800, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("28c16.u17") // nvram AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf3c) AM_WRITE(superabc_bank_w) AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITE(pacman_leds_w) AM_RANGE(0x5007, 0x5007) AM_MIRROR(0xaf38) AM_WRITE(pacman_coin_counter_w) - AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x5040, 0x505f) AM_MIRROR(0xaf00) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x5060, 0x506f) AM_MIRROR(0xaf00) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x5070, 0x507f) AM_MIRROR(0xaf00) AM_WRITENOP AM_RANGE(0x5080, 0x5080) AM_MIRROR(0xaf3f) AM_WRITENOP @@ -1301,7 +1300,7 @@ static ADDRESS_MAP_START( crushs_map, AS_PROGRAM, 8, pacman_state ) AM_RANGE(0x4c00, 0x4fef) AM_MIRROR(0xa000) AM_RAM AM_RANGE(0x4ff0, 0x4fff) AM_MIRROR(0xa000) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x5000, 0x5000) AM_MIRROR(0xaf38) AM_WRITE(irq_mask_w) - AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x5001, 0x5001) AM_MIRROR(0xaf38) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x5002, 0x5002) AM_MIRROR(0xaf38) AM_WRITENOP AM_RANGE(0x5003, 0x5003) AM_MIRROR(0xaf38) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x5004, 0x5005) AM_MIRROR(0xaf38) AM_WRITENOP // AM_WRITE(pacman_leds_w) @@ -1331,13 +1330,13 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( vanvan_portmap, AS_IO, 8, pacman_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x01, 0x01) AM_DEVWRITE("namco", sn76496_device, write) + AM_RANGE(0x01, 0x01) AM_DEVWRITE("sn1", sn76496_device, write) AM_RANGE(0x02, 0x02) AM_DEVWRITE("sn2", sn76496_device, write) ADDRESS_MAP_END static ADDRESS_MAP_START( dremshpr_portmap, AS_IO, 8, pacman_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x06, 0x07) AM_DEVWRITE("namco", ay8910_device, data_address_w) + AM_RANGE(0x06, 0x07) AM_DEVWRITE("ay8910", ay8910_device, data_address_w) ADDRESS_MAP_END static ADDRESS_MAP_START( piranha_portmap, AS_IO, 8, pacman_state ) @@ -1370,7 +1369,7 @@ static ADDRESS_MAP_START( bigbucks_portmap, AS_IO, 8, pacman_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( s2650games_writeport, AS_IO, 8, pacman_state ) - AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_DEVWRITE("namco", sn76496_device, write) + AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_DEVWRITE("sn1", sn76496_device, write) ADDRESS_MAP_END static ADDRESS_MAP_START( drivfrcp_portmap, AS_IO, 8, pacman_state ) @@ -1396,7 +1395,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( crushs_portmap, AS_IO, 8, pacman_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x01) AM_DEVWRITE("namco", ay8910_device, data_address_w) + AM_RANGE(0x00, 0x01) AM_DEVWRITE("ay8912", ay8912_device, data_address_w) AM_RANGE(0x01, 0x01) AM_READ_PORT("DSW2") AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW1") ADDRESS_MAP_END @@ -3419,7 +3418,8 @@ static MACHINE_CONFIG_DERIVED( dremshpr, pacman ) MCFG_CPU_VBLANK_INT_DRIVER("screen", pacman_state, vblank_nmi) /* sound hardware */ - MCFG_SOUND_REPLACE("namco", AY8910, 14318000/8) + MCFG_DEVICE_REMOVE("namco") + MCFG_SOUND_ADD("ay8910", AY8910, 14318000/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -3461,7 +3461,8 @@ static MACHINE_CONFIG_DERIVED( vanvan, pacman ) MCFG_SCREEN_VISIBLE_AREA(2*8, 34*8-1, 0*8, 28*8-1) /* sound hardware */ - MCFG_SOUND_REPLACE("namco", SN76496, 1789750) + MCFG_DEVICE_REMOVE("namco") + MCFG_SOUND_ADD("sn1", SN76496, 1789750) MCFG_SOUND_CONFIG(psg_intf) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) MCFG_SOUND_ADD("sn2", SN76496, 1789750) @@ -3502,7 +3503,8 @@ static MACHINE_CONFIG_DERIVED( s2650games, pacman ) MCFG_VIDEO_START_OVERRIDE(pacman_state,s2650games) /* sound hardware */ - MCFG_SOUND_REPLACE("namco", SN76496, MASTER_CLOCK/6) /* 1H */ + MCFG_DEVICE_REMOVE("namco") + MCFG_SOUND_ADD("sn1", SN76496, MASTER_CLOCK/6) /* 1H */ MCFG_SOUND_CONFIG(psg_intf) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) MACHINE_CONFIG_END @@ -3595,7 +3597,7 @@ static MACHINE_CONFIG_DERIVED( crushs, pacman ) MCFG_CPU_IO_MAP(crushs_portmap) /* sound hardware */ - MCFG_SOUND_REPLACE("namco", AY8912, 1789750) + MCFG_SOUND_ADD("ay8912", AY8912, 1789750) MCFG_SOUND_CONFIG(crushs_ay8910_interface) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) MACHINE_CONFIG_END diff --git a/src/mame/drivers/pengo.c b/src/mame/drivers/pengo.c index 4c3bd0a0be0..317040e38db 100644 --- a/src/mame/drivers/pengo.c +++ b/src/mame/drivers/pengo.c @@ -65,7 +65,6 @@ #include "cpu/z80/z80.h" #include "machine/segacrpt.h" #include "includes/pacman.h" -#include "sound/namco.h" class pengo_state : public pacman_state @@ -126,12 +125,12 @@ static ADDRESS_MAP_START( pengo_map, AS_PROGRAM, 8, pengo_state ) AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pacman_colorram_w) AM_SHARE("colorram") AM_RANGE(0x8800, 0x8fef) AM_RAM AM_RANGE(0x8ff0, 0x8fff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0x9000, 0x901f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x9000, 0x901f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x9020, 0x902f) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x9000, 0x903f) AM_READ_PORT("DSW1") AM_RANGE(0x9040, 0x907f) AM_READ_PORT("DSW0") AM_RANGE(0x9040, 0x9040) AM_WRITE(irq_mask_w) - AM_RANGE(0x9041, 0x9041) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x9041, 0x9041) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x9042, 0x9042) AM_WRITE(pengo_palettebank_w) AM_RANGE(0x9043, 0x9043) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x9044, 0x9045) AM_WRITE(pengo_coin_counter_w) @@ -148,12 +147,12 @@ static ADDRESS_MAP_START( jrpacmbl_map, AS_PROGRAM, 8, pengo_state ) AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(jrpacman_videoram_w) AM_SHARE("videoram") AM_RANGE(0x8800, 0x8fef) AM_RAM AM_RANGE(0x8ff0, 0x8fff) AM_RAM AM_SHARE("spriteram") - AM_RANGE(0x9000, 0x901f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0x9000, 0x901f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0x9020, 0x902f) AM_WRITEONLY AM_SHARE("spriteram2") AM_RANGE(0x9030, 0x9030) AM_WRITE(jrpacman_scroll_w) AM_RANGE(0x9040, 0x904f) AM_READ_PORT("DSW") AM_RANGE(0x9040, 0x9040) AM_WRITE(irq_mask_w) - AM_RANGE(0x9041, 0x9041) AM_DEVWRITE_LEGACY("namco", pacman_sound_enable_w) + AM_RANGE(0x9041, 0x9041) AM_DEVWRITE("namco", namco_device, pacman_sound_enable_w) AM_RANGE(0x9042, 0x9042) AM_WRITE(pengo_palettebank_w) AM_RANGE(0x9043, 0x9043) AM_WRITE(pacman_flipscreen_w) AM_RANGE(0x9044, 0x9044) AM_WRITE(jrpacman_bgpriority_w) diff --git a/src/mame/drivers/polepos.c b/src/mame/drivers/polepos.c index 7bb3f027b78..40cdf169c76 100644 --- a/src/mame/drivers/polepos.c +++ b/src/mame/drivers/polepos.c @@ -222,7 +222,6 @@ Todo: #include "machine/namco06.h" #include "machine/namco51.h" #include "machine/namco53.h" -#include "sound/namco.h" #include "audio/namco52.h" #include "audio/namco54.h" #include "includes/polepos.h" @@ -300,7 +299,7 @@ WRITE8_MEMBER(polepos_state::polepos_latch_w) break; case 0x02: /* CLSON */ - polepos_sound_enable(machine().device("namco"),bit); + m_namco_sound->polepos_sound_enable(bit); if (!bit) { machine().device("polepos")->polepos_engine_sound_lsb_w(space, 0, 0); @@ -489,7 +488,7 @@ static ADDRESS_MAP_START( z80_map, AS_PROGRAM, 8, polepos_state ) AM_RANGE(0x5000, 0x57ff) AM_READWRITE(polepos_view_r, polepos_view_w) /* Background Memory */ AM_RANGE(0x8000, 0x83bf) AM_MIRROR(0x0c00) AM_RAM /* Sound Memory */ - AM_RANGE(0x83c0, 0x83ff) AM_MIRROR(0x0c00) AM_DEVREADWRITE_LEGACY("namco", polepos_sound_r, polepos_sound_w) /* Sound data */ + AM_RANGE(0x83c0, 0x83ff) AM_MIRROR(0x0c00) AM_DEVREADWRITE("namco", namco_device, polepos_sound_r, polepos_sound_w) /* Sound data */ AM_RANGE(0x9000, 0x9000) AM_MIRROR(0x0eff) AM_DEVREADWRITE_LEGACY("06xx", namco_06xx_data_r, namco_06xx_data_w) AM_RANGE(0x9100, 0x9100) AM_MIRROR(0x0eff) AM_DEVREADWRITE_LEGACY("06xx", namco_06xx_ctrl_r, namco_06xx_ctrl_w) diff --git a/src/mame/drivers/rallyx.c b/src/mame/drivers/rallyx.c index cc1bd88fd59..2d90aafdcf8 100644 --- a/src/mame/drivers/rallyx.c +++ b/src/mame/drivers/rallyx.c @@ -190,7 +190,6 @@ TODO: #include "emu.h" #include "cpu/z80/z80.h" -#include "sound/namco.h" #include "sound/samples.h" #include "includes/rallyx.h" @@ -236,7 +235,7 @@ WRITE8_MEMBER(rallyx_state::rallyx_latch_w) case 0x02: /* SOUND ON */ /* this doesn't work in New Rally X so I'm not supporting it */ -// pacman_sound_enable_w(machine().device("namco"), bit); +// m_namco_sound->pacman_sound_enable_w(bit); break; case 0x03: /* FLIP */ @@ -319,7 +318,7 @@ static ADDRESS_MAP_START( rallyx_map, AS_PROGRAM, 8, rallyx_state ) AM_RANGE(0xa100, 0xa100) AM_READ_PORT("DSW") AM_RANGE(0xa000, 0xa00f) AM_WRITEONLY AM_SHARE("radarattr") AM_RANGE(0xa080, 0xa080) AM_WRITE(watchdog_reset_w) - AM_RANGE(0xa100, 0xa11f) AM_DEVWRITE_LEGACY("namco", pacman_sound_w) + AM_RANGE(0xa100, 0xa11f) AM_DEVWRITE("namco", namco_device, pacman_sound_w) AM_RANGE(0xa130, 0xa130) AM_WRITE(rallyx_scrollx_w) AM_RANGE(0xa140, 0xa140) AM_WRITE(rallyx_scrolly_w) AM_RANGE(0xa170, 0xa170) AM_WRITENOP /* ? */ diff --git a/src/mame/drivers/skykid.c b/src/mame/drivers/skykid.c index fd8c8b718c4..be7527bbcaf 100644 --- a/src/mame/drivers/skykid.c +++ b/src/mame/drivers/skykid.c @@ -105,7 +105,7 @@ static ADDRESS_MAP_START( skykid_map, AS_PROGRAM, 8, skykid_state ) AM_RANGE(0x4800, 0x5fff) AM_RAM AM_SHARE("spriteram") /* RAM + Sprite RAM */ AM_RANGE(0x6000, 0x60ff) AM_WRITE(skykid_scroll_y_w) /* Y scroll register map */ AM_RANGE(0x6200, 0x63ff) AM_WRITE(skykid_scroll_x_w) /* X scroll register map */ - AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ + AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ AM_RANGE(0x7000, 0x7fff) AM_WRITE(skykid_irq_1_ctrl_w) /* IRQ control */ AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r) /* watchdog reset */ AM_RANGE(0x8000, 0xffff) AM_ROM /* ROM */ @@ -117,7 +117,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, skykid_state ) AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w) AM_RANGE(0x0080, 0x00ff) AM_RAM - AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ + AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ AM_RANGE(0x2000, 0x3fff) AM_WRITE(watchdog_reset_w) /* watchdog? */ AM_RANGE(0x4000, 0x7fff) AM_WRITE(skykid_irq_2_ctrl_w) AM_RANGE(0x8000, 0xbfff) AM_ROM diff --git a/src/mame/drivers/tceptor.c b/src/mame/drivers/tceptor.c index 0fb4c50afaf..214e10e1198 100644 --- a/src/mame/drivers/tceptor.c +++ b/src/mame/drivers/tceptor.c @@ -14,7 +14,6 @@ #include "includes/namcoic.h" #include "sound/dac.h" #include "sound/2151intf.h" -#include "sound/namco.h" #include "rendlay.h" #include "tceptor2.lh" #include "includes/tceptor.h" @@ -158,7 +157,7 @@ static ADDRESS_MAP_START( m6809_map, AS_PROGRAM, 8, tceptor_state ) AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(tceptor_tile_ram_w) AM_SHARE("tile_ram") AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(tceptor_tile_attr_w) AM_SHARE("tile_attr") AM_RANGE(0x2000, 0x3fff) AM_RAM_WRITE(tceptor_bg_ram_w) AM_SHARE("bg_ram") // background (VIEW RAM) - AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) + AM_RANGE(0x4000, 0x43ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) AM_RANGE(0x4800, 0x4800) AM_WRITENOP // 3D scope left/right? AM_RANGE(0x4f00, 0x4f00) AM_READNOP // unknown AM_RANGE(0x4f01, 0x4f01) AM_READ_PORT("PEDAL") // analog input (accel) @@ -209,7 +208,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, tceptor_state ) AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w) AM_RANGE(0x0080, 0x00ff) AM_RAM - AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE_LEGACY("namco", namcos1_cus30_r, namcos1_cus30_w) + AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) AM_RANGE(0x1400, 0x154d) AM_RAM AM_RANGE(0x17c0, 0x17ff) AM_RAM AM_RANGE(0x2000, 0x20ff) AM_RAM AM_SHARE("share3") diff --git a/src/mame/drivers/toypop.c b/src/mame/drivers/toypop.c index 71e21906f0e..9497aa92d06 100644 --- a/src/mame/drivers/toypop.c +++ b/src/mame/drivers/toypop.c @@ -32,7 +32,6 @@ TODO: #include "emu.h" #include "cpu/m6809/m6809.h" #include "cpu/m68000/m68000.h" -#include "sound/namco.h" #include "includes/toypop.h" @@ -186,7 +185,7 @@ static ADDRESS_MAP_START( liblrabl_map, AS_PROGRAM, 8, toypop_state ) AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(toypop_videoram_w) AM_SHARE("videoram") /* video RAM */ AM_RANGE(0x0800, 0x1fff) AM_RAM AM_SHARE("spriteram") /* general RAM, area 1 */ AM_RANGE(0x2800, 0x2fff) AM_RAM AM_SHARE("m68k_shared") /* shared RAM with the 68000 CPU */ - AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with sound CPU */ + AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with sound CPU */ AM_RANGE(0x6800, 0x680f) AM_DEVREADWRITE("58xx", namco58xx_device, read, write) /* custom I/O */ AM_RANGE(0x6810, 0x681f) AM_DEVREADWRITE("56xx_1", namco56xx_device, read, write) /* custom I/O */ AM_RANGE(0x6820, 0x682f) AM_DEVREADWRITE("56xx_2", namco56xx_device, read, write) /* custom I/O */ @@ -207,7 +206,7 @@ static ADDRESS_MAP_START( toypop_map, AS_PROGRAM, 8, toypop_state ) AM_RANGE(0x6000, 0x600f) AM_DEVREADWRITE("58xx", namco58xx_device, read, write) /* custom I/O */ AM_RANGE(0x6010, 0x601f) AM_DEVREADWRITE("56xx_1", namco56xx_device, read, write) /* custom I/O */ AM_RANGE(0x6020, 0x602f) AM_DEVREADWRITE("56xx_2", namco56xx_device, read, write) /* custom I/O */ - AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with sound CPU */ + AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with sound CPU */ AM_RANGE(0x7000, 0x7000) AM_READWRITE(toypop_main_interrupt_enable_r, toypop_main_interrupt_disable_w) /* disable interrupt */ AM_RANGE(0x8000, 0x8000) AM_WRITE(toypop_m68000_clear_w) /* reset 68000 */ AM_RANGE(0x8800, 0x8800) AM_WRITE(toypop_m68000_assert_w) /* reset 68000 */ @@ -225,7 +224,7 @@ ADDRESS_MAP_END *************************************/ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, toypop_state ) - AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE_LEGACY("namco", namco_snd_sharedram_r, namco_snd_sharedram_w) /* shared RAM with the main CPU + sound registers */ + AM_RANGE(0x0000, 0x03ff) AM_DEVREADWRITE("namco", namco_15xx_device, sharedram_r, sharedram_w) /* shared RAM with the main CPU + sound registers */ AM_RANGE(0x2000, 0x2000) AM_WRITE(toypop_sound_interrupt_disable_w) /* ??? toypop doesn't write here */ AM_RANGE(0x4000, 0x4000) AM_WRITE(toypop_sound_interrupt_enable_acknowledge_w) AM_RANGE(0x6000, 0x6000) AM_WRITE(watchdog_reset_w) diff --git a/src/mame/includes/20pacgal.h b/src/mame/includes/20pacgal.h index 1abda74271c..6e685f7f7bf 100644 --- a/src/mame/includes/20pacgal.h +++ b/src/mame/includes/20pacgal.h @@ -6,6 +6,7 @@ ***************************************************************************/ #include "machine/eeprom.h" +#include "sound/namco.h" class _20pacgal_state : public driver_device { diff --git a/src/mame/includes/baraduke.h b/src/mame/includes/baraduke.h index a146502f31c..3a656b0ce08 100644 --- a/src/mame/includes/baraduke.h +++ b/src/mame/includes/baraduke.h @@ -1,3 +1,5 @@ +#include "sound/namco.h" + class baraduke_state : public driver_device { public: @@ -6,13 +8,16 @@ public: m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), m_textram(*this, "textram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_cus30(*this, "namco") { } int m_inputport_selected; int m_counter; required_shared_ptr m_spriteram; required_shared_ptr m_videoram; required_shared_ptr m_textram; + required_device m_maincpu; + required_device m_cus30; tilemap_t *m_tx_tilemap; tilemap_t *m_bg_tilemap[2]; int m_xscroll[2]; @@ -44,5 +49,4 @@ public: void scroll_w(address_space &space, int layer, int offset, int data); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_priority); void set_scroll(int layer); - required_device m_maincpu; }; diff --git a/src/mame/includes/galaga.h b/src/mame/includes/galaga.h index 2c835da95ec..05c37a08b44 100644 --- a/src/mame/includes/galaga.h +++ b/src/mame/includes/galaga.h @@ -1,4 +1,5 @@ #include "sound/discrete.h" +#include "sound/namco.h" #include "sound/samples.h" class galaga_state : public driver_device @@ -13,7 +14,8 @@ public: m_galaga_starcontrol(*this, "starcontrol"), m_maincpu(*this, "maincpu"), m_subcpu(*this, "sub"), - m_subcpu2(*this, "sub2") { } + m_subcpu2(*this, "sub2"), + m_namco_sound(*this, "namco") { } /* memory pointers */ optional_shared_ptr m_videoram; @@ -21,6 +23,10 @@ public: optional_shared_ptr m_galaga_ram2; optional_shared_ptr m_galaga_ram3; optional_shared_ptr m_galaga_starcontrol; // 6 addresses + required_device m_maincpu; + required_device m_subcpu; + required_device m_subcpu2; + required_device m_namco_sound; emu_timer *m_cpu3_interrupt_timer; UINT8 m_custom_mod; @@ -74,9 +80,6 @@ public: }; static struct star m_star_seed_tab[]; - required_device m_maincpu; - required_device m_subcpu; - required_device m_subcpu2; }; class xevious_state : public galaga_state diff --git a/src/mame/includes/gaplus.h b/src/mame/includes/gaplus.h index bb3a0b6d441..fe039ca729c 100644 --- a/src/mame/includes/gaplus.h +++ b/src/mame/includes/gaplus.h @@ -1,3 +1,4 @@ +#include "sound/namco.h" #include "sound/samples.h" #include "machine/namcoio.h" @@ -29,6 +30,7 @@ public: m_maincpu(*this, "maincpu"), m_subcpu(*this, "sub"), m_subcpu2(*this, "sub2"), + m_namco_15xx(*this, "namco"), m_samples(*this, "samples") , m_customio_3(*this,"customio_3"), m_videoram(*this,"videoram"), @@ -37,6 +39,7 @@ public: required_device m_maincpu; required_device m_subcpu; required_device m_subcpu2; + required_device m_namco_15xx; required_device m_samples; required_shared_ptr m_customio_3; required_shared_ptr m_videoram; diff --git a/src/mame/includes/mappy.h b/src/mame/includes/mappy.h index 15cd3fe827b..cd9007f5741 100644 --- a/src/mame/includes/mappy.h +++ b/src/mame/includes/mappy.h @@ -1,5 +1,6 @@ #include "machine/namcoio.h" #include "sound/dac.h" +#include "sound/namco.h" class mappy_state : public driver_device { @@ -34,6 +35,7 @@ public: m_maincpu(*this, "maincpu"), m_subcpu(*this, "sub"), m_subcpu2(*this, "sub2"), + m_namco_15xx(*this, "namco"), m_dac(*this, "dac") { } required_shared_ptr m_videoram; @@ -42,6 +44,7 @@ public: required_device m_maincpu; required_device m_subcpu; optional_device m_subcpu2; + required_device m_namco_15xx; optional_device m_dac; namco56xx_device *m_namco56xx_1; diff --git a/src/mame/includes/namcos1.h b/src/mame/includes/namcos1.h index f5085a1e45e..c6d60dea731 100644 --- a/src/mame/includes/namcos1.h +++ b/src/mame/includes/namcos1.h @@ -1,4 +1,6 @@ #include "sound/dac.h" +#include "sound/namco.h" + #define NAMCOS1_MAX_BANK 0x400 /* Bank handler definitions */ @@ -19,8 +21,15 @@ public: m_audiocpu(*this, "audiocpu"), m_subcpu(*this, "sub"), m_mcu(*this, "mcu"), + m_cus30(*this, "namco"), m_dac(*this, "dac") { } + required_device m_maincpu; + required_device m_audiocpu; + required_device m_subcpu; + required_device m_mcu; + required_device m_cus30; + required_device m_dac; int m_dac0_value; int m_dac1_value; int m_dac0_gain; @@ -101,11 +110,6 @@ public: virtual void video_start(); UINT32 screen_update_namcos1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_namcos1(screen_device &screen, bool state); - required_device m_maincpu; - required_device m_audiocpu; - required_device m_subcpu; - required_device m_mcu; - required_device m_dac; private: inline void bg_get_info(tile_data &tileinfo,int tile_index,UINT8 *info_vram); diff --git a/src/mame/includes/namcos86.h b/src/mame/includes/namcos86.h index 838ac61ddc6..f3291aaaf4d 100644 --- a/src/mame/includes/namcos86.h +++ b/src/mame/includes/namcos86.h @@ -1,3 +1,5 @@ +#include "sound/namco.h" + class namcos86_state : public driver_device { public: @@ -7,7 +9,8 @@ public: m_rthunder_videoram2(*this, "videoram2"), m_rthunder_spriteram(*this, "spriteram"), m_cpu1(*this, "cpu1"), - m_cpu2(*this, "cpu2"){ } + m_cpu2(*this, "cpu2"), + m_cus30(*this, "namco") { } UINT8 *m_spriteram; int m_wdog; @@ -16,6 +19,7 @@ public: required_shared_ptr m_rthunder_spriteram; required_device m_cpu1; required_device m_cpu2; + required_device m_cus30; int m_tilebank; int m_xscroll[4]; int m_yscroll[4]; diff --git a/src/mame/includes/pacland.h b/src/mame/includes/pacland.h index 4443c0eb2fd..28023b32587 100644 --- a/src/mame/includes/pacland.h +++ b/src/mame/includes/pacland.h @@ -1,3 +1,5 @@ +#include "sound/namco.h" + class pacland_state : public driver_device { public: @@ -7,11 +9,15 @@ public: m_videoram2(*this, "videoram2"), m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), - m_mcu(*this, "mcu") { } + m_mcu(*this, "mcu"), + m_cus30(*this, "namco") { } required_shared_ptr m_videoram; required_shared_ptr m_videoram2; required_shared_ptr m_spriteram; + required_device m_maincpu; + required_device m_mcu; + required_device m_cus30; UINT8 m_palette_bank; const UINT8 *m_color_prom; tilemap_t *m_bg_tilemap; @@ -45,6 +51,4 @@ public: void switch_palette(); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int whichmask); void draw_fg(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); - required_device m_maincpu; - required_device m_mcu; }; diff --git a/src/mame/includes/pacman.h b/src/mame/includes/pacman.h index 83ba2324944..517f9471ab9 100644 --- a/src/mame/includes/pacman.h +++ b/src/mame/includes/pacman.h @@ -1,3 +1,5 @@ +#include "sound/namco.h" + /************************************************************************* Namco PuckMan @@ -10,6 +12,7 @@ public: pacman_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_namco_sound(*this, "namco"), m_spriteram(*this, "spriteram"), m_spriteram2(*this, "spriteram2"), m_s2650_spriteram(*this, "s2650_spriteram"), @@ -20,6 +23,7 @@ public: { } required_device m_maincpu; + optional_device m_namco_sound; optional_shared_ptr m_spriteram; optional_shared_ptr m_spriteram2; optional_shared_ptr m_s2650_spriteram; diff --git a/src/mame/includes/polepos.h b/src/mame/includes/polepos.h index 5306d64d33e..73a58aed78f 100644 --- a/src/mame/includes/polepos.h +++ b/src/mame/includes/polepos.h @@ -5,6 +5,7 @@ *************************************************************************/ #include "sound/filter.h" +#include "sound/namco.h" #include "sound/tms5220.h" #include "sound/discrete.h" @@ -14,15 +15,20 @@ class polepos_state : public driver_device public: polepos_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "sub"), + m_subcpu2(*this, "sub2"), + m_namco_sound(*this, "namco"), m_tms(*this, "tms"), m_sprite16_memory(*this, "sprite16_memory"), m_road16_memory(*this, "road16_memory"), m_alpha16_memory(*this, "alpha16_memory"), - m_view16_memory(*this, "view16_memory"), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_subcpu2(*this, "sub2") { } + m_view16_memory(*this, "view16_memory") { } + required_device m_maincpu; + required_device m_subcpu; + required_device m_subcpu2; + optional_device m_namco_sound; optional_device m_tms; UINT8 m_steer_last; UINT8 m_steer_delta; @@ -90,9 +96,6 @@ public: void draw_road(bitmap_ind16 &bitmap); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); void zoom_sprite(bitmap_ind16 &bitmap,int big,UINT32 code,UINT32 color,int flipx,int sx,int sy,int sizex,int sizey); - required_device m_maincpu; - required_device m_subcpu; - required_device m_subcpu2; }; diff --git a/src/mame/includes/rallyx.h b/src/mame/includes/rallyx.h index 821167857ad..f405c5d132f 100644 --- a/src/mame/includes/rallyx.h +++ b/src/mame/includes/rallyx.h @@ -1,4 +1,5 @@ #include "audio/timeplt.h" +#include "sound/namco.h" #include "sound/samples.h" struct jungler_star @@ -16,6 +17,7 @@ public: m_videoram(*this, "videoram"), m_radarattr(*this, "radarattr"), m_maincpu(*this, "maincpu"), + m_namco_sound(*this, "namco"), m_samples(*this, "samples"), m_timeplt_audio(*this, "timeplt_audio") { } @@ -41,6 +43,7 @@ public: /* devices */ required_device m_maincpu; + optional_device m_namco_sound; optional_device m_samples; optional_device m_timeplt_audio; diff --git a/src/mame/includes/skykid.h b/src/mame/includes/skykid.h index eefc00aa3c3..3682d0c2ff5 100644 --- a/src/mame/includes/skykid.h +++ b/src/mame/includes/skykid.h @@ -1,3 +1,5 @@ +#include "sound/namco.h" + class skykid_state : public driver_device { public: @@ -7,12 +9,16 @@ public: m_textram(*this, "textram"), m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), - m_mcu(*this, "mcu") { } + m_mcu(*this, "mcu"), + m_cus30(*this, "namco") { } UINT8 m_inputport_selected; required_shared_ptr m_videoram; required_shared_ptr m_textram; required_shared_ptr m_spriteram; + required_device m_maincpu; + required_device m_mcu; + required_device m_cus30; tilemap_t *m_bg_tilemap; tilemap_t *m_tx_tilemap; UINT8 m_priority; @@ -46,6 +52,4 @@ public: INTERRUPT_GEN_MEMBER(main_vblank_irq); INTERRUPT_GEN_MEMBER(mcu_vblank_irq); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - required_device m_maincpu; - required_device m_mcu; }; diff --git a/src/mame/includes/tceptor.h b/src/mame/includes/tceptor.h index b175c53e24d..4faba4887f2 100644 --- a/src/mame/includes/tceptor.h +++ b/src/mame/includes/tceptor.h @@ -1,23 +1,28 @@ #include "namcos2.h" #include "sound/dac.h" +#include "sound/namco.h" class tceptor_state : public driver_device { public: tceptor_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cus30(*this, "namco"), + m_dac(*this, "dac"), m_tile_ram(*this, "tile_ram"), m_tile_attr(*this, "tile_attr"), m_bg_ram(*this, "bg_ram"), m_m68k_shared_ram(*this, "m68k_shared_ram"), m_sprite_ram(*this, "sprite_ram"), - m_c45_road(*this, "c45_road") , - m_maincpu(*this, "maincpu"), - m_dac(*this, "dac") { } + m_c45_road(*this, "c45_road") { } UINT8 m_m6809_irq_enable; UINT8 m_m68k_irq_enable; UINT8 m_mcu_irq_enable; + required_device m_maincpu; + required_device m_cus30; + required_device m_dac; required_shared_ptr m_tile_ram; required_shared_ptr m_tile_attr; required_shared_ptr m_bg_ram; @@ -78,6 +83,4 @@ public: void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_priority); inline UINT8 fix_input0(UINT8 in1, UINT8 in2); inline UINT8 fix_input1(UINT8 in1, UINT8 in2); - required_device m_maincpu; - required_device m_dac; }; diff --git a/src/mame/includes/toypop.h b/src/mame/includes/toypop.h index affd6912d3b..bdd009ee909 100644 --- a/src/mame/includes/toypop.h +++ b/src/mame/includes/toypop.h @@ -1,4 +1,5 @@ #include "machine/namcoio.h" +#include "sound/namco.h" class toypop_state : public driver_device { @@ -17,6 +18,7 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_subcpu(*this, "sub"), + m_namco15xx(*this, "namco"), m_namco58xx(*this, "58xx"), m_namco56xx_1(*this, "56xx_1"), m_namco56xx_2(*this, "56xx_2") { } @@ -29,6 +31,7 @@ public: required_device m_maincpu; required_device m_audiocpu; required_device m_subcpu; + required_device m_namco15xx; required_device m_namco58xx; required_device m_namco56xx_1; required_device m_namco56xx_2; diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index 2f96b8b52cf..41ccb6fa81c 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -1,6 +1,5 @@ #include "emu.h" #include "sound/ym2151.h" -#include "sound/namco.h" #include "includes/namcos1.h" @@ -611,7 +610,8 @@ static READ8_HANDLER( soundram_r ) offset &= 0x3ff; /* CUS 30 */ - return namcos1_cus30_r(space.machine().device("namco"),space,offset); + + return space.machine().device("namco")->namcos1_cus30_r(space,offset); } else { @@ -630,7 +630,8 @@ static WRITE8_HANDLER( soundram_w ) offset &= 0x3ff; /* CUS 30 */ - namcos1_cus30_w(space.machine().device("namco"),space,offset,data); + + space.machine().device("namco")->namcos1_cus30_w(space,offset,data); } else {