summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/emu/sound/k053260.c651
-rw-r--r--src/emu/sound/k053260.h103
-rw-r--r--src/mame/drivers/asterix.c9
-rw-r--r--src/mame/drivers/overdriv.c19
-rw-r--r--src/mame/drivers/parodius.c9
-rw-r--r--src/mame/drivers/rollerg.c11
-rw-r--r--src/mame/drivers/simpsons.c4
-rw-r--r--src/mame/drivers/tmnt.c42
-rw-r--r--src/mame/drivers/vendetta.c17
-rw-r--r--src/mame/includes/asterix.h4
-rw-r--r--src/mame/includes/overdriv.h5
-rw-r--r--src/mame/includes/parodius.h4
-rw-r--r--src/mame/includes/rollerg.h7
-rw-r--r--src/mame/includes/simpsons.h4
-rw-r--r--src/mame/includes/tmnt.h1
-rw-r--r--src/mame/includes/vendetta.h6
-rw-r--r--src/mame/machine/simpsons.c6
17 files changed, 445 insertions, 457 deletions
diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c
index d115bfa84d1..ed5b636527c 100644
--- a/src/emu/sound/k053260.c
+++ b/src/emu/sound/k053260.c
@@ -1,17 +1,62 @@
/*********************************************************
- Konami 053260 PCM Sound Chip
+ Konami 053260 KDSC
+
+ The 053260 is a four voice PCM/ADPCM sound chip that
+ also incorporates four 8-bit ports for communication
+ between a main CPU and audio CPU. The chip's output
+ is compatible with a YM3012 DAC, and it has a digital
+ auxiliary input compatible with the output of a YM2151.
+ Some games (e.g. Simpsons) only connect one channel of
+ the YM2151, but others (e.g. Thunder Cross II) connect
+ both channels for stereo mixing.
+
+ The 053260 has a 21-bit address bus and 8-bit data bus
+ to ROM, allowing it to access up to 2 megabytes of
+ sample data. Sample data can be either signed 8-bit
+ PCM or a custom 4-bit ADPCM format. It is possible for
+ two 053260 chips to share access to the same ROMs
+ (used by Over Drive)
+
+ The 053260 has separate address and data buses to the
+ audio CPU controlling it and to the main CPU. Both data
+ buses are 8 bit. The audio CPU address bus has 6 lines
+ (64 addressable registers, but fewer than 48 are
+ actually used) while the main CPU "bus" has only 1 line
+ (2 addressable registers). All registers on the audio
+ CPU side seem to be either read-only or write-only,
+ although some games write 0 to all the registers in a
+ loop at startup (including otherwise read-only or
+ entirely unused registers).
+ On the main CPU side, reads and writes to the same
+ address access different communication ports.
+
+ The sound data ROMs of Simpsons and Vendetta have
+ "headers" listing all the samples in the ROM, their
+ formats ("PCM" or "KADPCM"), start and end addresses.
+ The header data doesn't seem to be used by the hardware
+ (none of the other games have headers) but provides
+ useful information about the chip.
+
+ 2004-02-28 (Oliver Achten)
+ Fixed ADPCM decoding. Games sound much better now.
+
+ 2014-10-06 (Alex W. Jackson)
+ Rewrote from scratch in C++; implemented communication
+ ports properly; used the actual up counters instead of
+ converting to fractional sample position; fixed ADPCM
+ decoding bugs; added documentation.
+
*********************************************************/
#include "emu.h"
#include "k053260.h"
-/* 2004-02-28: Fixed PPCM decoding. Games sound much better now.*/
-
#define LOG 0
-#define BASE_SHIFT 16
+#define CLOCKS_PER_SAMPLE 32
+
// device type definition
@@ -27,16 +72,16 @@ const device_type K053260 = &device_creator<k053260_device>;
//-------------------------------------------------
k053260_device::k053260_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, K053260, "K053260 PCM", tag, owner, clock, "k053260", __FILE__),
+ : device_t(mconfig, K053260, "K053260 KDSC", tag, owner, clock, "k053260", __FILE__),
device_sound_interface(mconfig, *this),
- m_channel(NULL),
- m_mode(0),
+ m_rgnoverride(NULL),
+ m_stream(NULL),
m_rom(NULL),
m_rom_size(0),
- m_delta_table(NULL),
- m_rgnoverride(NULL)
+ m_keyon(0),
+ m_mode(0)
{
- memset(m_regs, 0, sizeof(int)*0x30);
+ memset(m_portdata, 0, sizeof(m_portdata));
}
@@ -46,43 +91,19 @@ k053260_device::k053260_device(const machine_config &mconfig, const char *tag, d
void k053260_device::device_start()
{
- int rate = clock() / 32;
-
- m_mode = 0;
-
- memory_region *region = (m_rgnoverride) ? memregion(m_rgnoverride) : this->region();
- m_rom = *region;
- m_rom_size = region->bytes();
-
- device_reset();
-
- for (int i = 0; i < 0x30; i++)
- m_regs[i] = 0;
-
- m_delta_table = auto_alloc_array( machine(), UINT32, 0x1000 );
-
- m_channel = stream_alloc( 0, 2, rate );
+ memory_region *ROM = (m_rgnoverride) ? owner()->memregion(m_rgnoverride) : region();
+ m_rom = *ROM;
+ m_rom_size = ROM->bytes();
- InitDeltaTable( rate, clock() );
+ m_stream = stream_alloc( 0, 2, clock() / CLOCKS_PER_SAMPLE );
/* register with the save state system */
+ save_item(NAME(m_portdata));
+ save_item(NAME(m_keyon));
save_item(NAME(m_mode));
- save_item(NAME(m_regs));
for (int i = 0; i < 4; i++)
- {
- save_item(NAME(m_channels[i].rate), i);
- save_item(NAME(m_channels[i].size), i);
- save_item(NAME(m_channels[i].start), i);
- save_item(NAME(m_channels[i].bank), i);
- save_item(NAME(m_channels[i].volume), i);
- save_item(NAME(m_channels[i].play), i);
- save_item(NAME(m_channels[i].pan), i);
- save_item(NAME(m_channels[i].pos), i);
- save_item(NAME(m_channels[i].loop), i);
- save_item(NAME(m_channels[i].ppcm), i);
- save_item(NAME(m_channels[i].ppcm_data), i);
- }
+ m_voice[i].voice_start(*this, i);
}
@@ -93,323 +114,359 @@ void k053260_device::device_start()
void k053260_device::device_reset()
{
for (int i = 0; i < 4; i++)
- {
- m_channels[i].rate = 0;
- m_channels[i].size = 0;
- m_channels[i].start = 0;
- m_channels[i].bank = 0;
- m_channels[i].volume = 0;
- m_channels[i].play = 0;
- m_channels[i].pan = 0;
- m_channels[i].pos = 0;
- m_channels[i].loop = 0;
- m_channels[i].ppcm = 0;
- m_channels[i].ppcm_data = 0;
- }
+ m_voice[i].voice_reset();
}
-INLINE int limit( int val, int max, int min )
+READ8_MEMBER( k053260_device::main_read )
{
- if ( val > max )
- val = max;
- else if ( val < min )
- val = min;
-
- return val;
+ // sub-to-main ports
+ return m_portdata[2 + (offset & 1)];
}
-#define MAXOUT 0x7fff
-#define MINOUT -0x8000
-//-------------------------------------------------
-// sound_stream_update - handle a stream update
-//-------------------------------------------------
+WRITE8_MEMBER( k053260_device::main_write )
+{
+ // main-to-sub ports
+ m_portdata[offset & 1] = data;
+}
-void k053260_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+
+READ8_MEMBER( k053260_device::read )
{
- static const INT8 dpcmcnv[] = { 0,1,2,4,8,16,32,64, -128, -64, -32, -16, -8, -4, -2, -1};
-
- int lvol[4], rvol[4], play[4], loop[4], ppcm[4];
- UINT8 *rom[4];
- UINT32 delta[4], end[4], pos[4];
- INT8 ppcm_data[4];
- int dataL, dataR;
- INT8 d;
-
- /* precache some values */
- for ( int i = 0; i < 4; i++ ) {
- rom[i]= &m_rom[m_channels[i].start + ( m_channels[i].bank << 16 )];
- delta[i] = m_delta_table[m_channels[i].rate];
- lvol[i] = m_channels[i].volume * m_channels[i].pan;
- rvol[i] = m_channels[i].volume * ( 8 - m_channels[i].pan );
- end[i] = m_channels[i].size;
- pos[i] = m_channels[i].pos;
- play[i] = m_channels[i].play;
- loop[i] = m_channels[i].loop;
- ppcm[i] = m_channels[i].ppcm;
- ppcm_data[i] = m_channels[i].ppcm_data;
- if ( ppcm[i] )
- delta[i] /= 2;
- }
+ offset &= 0x3f;
+ UINT8 ret = 0;
- for ( int j = 0; j < samples; j++ ) {
- dataL = dataR = 0;
-
- for ( int i = 0; i < 4; i++ ) {
- /* see if the voice is on */
- if ( play[i] ) {
- /* see if we're done */
- if ( ( pos[i] >> BASE_SHIFT ) >= end[i] ) {
- ppcm_data[i] = 0;
- if ( loop[i] )
- pos[i] = 0;
- else {
- play[i] = 0;
- continue;
- }
- }
-
- if ( ppcm[i] ) { /* Packed PCM */
- /* we only update the signal if we're starting or a real sound sample has gone by */
- /* this is all due to the dynamic sample rate convertion */
- if ( pos[i] == 0 || ( ( pos[i] ^ ( pos[i] - delta[i] ) ) & 0x8000 ) == 0x8000 )
-
- {
- int newdata;
- if ( pos[i] & 0x8000 ){
- newdata = ((rom[i][pos[i] >> BASE_SHIFT]) >> 4) & 0x0f; /*high nybble*/
- }
- else{
- newdata = ( ( rom[i][pos[i] >> BASE_SHIFT] ) ) & 0x0f; /*low nybble*/
- }
-
- ppcm_data[i] += dpcmcnv[newdata];
- }
-
-
-
- d = ppcm_data[i];
-
- pos[i] += delta[i];
- } else { /* PCM */
- d = rom[i][pos[i] >> BASE_SHIFT];
-
- pos[i] += delta[i];
- }
-
- if ( m_mode & 2 ) {
- dataL += ( d * lvol[i] ) >> 2;
- dataR += ( d * rvol[i] ) >> 2;
- }
- }
- }
+ switch (offset)
+ {
+ case 0x00: // main-to-sub ports
+ case 0x01:
+ ret = m_portdata[offset];
+ break;
- outputs[1][j] = limit( dataL, MAXOUT, MINOUT );
- outputs[0][j] = limit( dataR, MAXOUT, MINOUT );
- }
+ case 0x29: // voice status
+ m_stream->update();
+ for (int i = 0; i < 4; i++)
+ ret |= m_voice[i].playing() << i;
+ break;
- /* update the regs now */
- for ( int i = 0; i < 4; i++ ) {
- m_channels[i].pos = pos[i];
- m_channels[i].play = play[i];
- m_channels[i].ppcm_data = ppcm_data[i];
+ case 0x2e: // read ROM
+ if (m_mode & 1)
+ ret = m_voice[0].read_rom();
+ else
+ logerror("%s: Attempting to read K053260 ROM without mode bit set\n", machine().describe_context());
+ break;
+
+ default:
+ logerror("%s: Read from unknown K053260 register %02x\n", machine().describe_context(), offset);
}
+ return ret;
}
-void k053260_device::InitDeltaTable( int rate, int clock )
+WRITE8_MEMBER( k053260_device::write )
{
- int i;
- double base = ( double )rate;
- double max = (double)(clock); /* Hz */
- UINT32 val;
-
- for( i = 0; i < 0x1000; i++ ) {
- double v = ( double )( 0x1000 - i );
- double target = (max) / v;
- double fixed = ( double )( 1 << BASE_SHIFT );
-
- if ( target && base ) {
- target = fixed / ( base / target );
- val = ( UINT32 )target;
- if ( val == 0 )
- val = 1;
- } else
- val = 1;
-
- m_delta_table[i] = val;
+ offset &= 0x3f;
+
+ m_stream->update();
+
+ // per voice registers
+ if ((offset >= 0x08) && (offset <= 0x27))
+ {
+ m_voice[(offset - 8) / 8].set_register(offset, data);
+ return;
}
-}
+ switch (offset)
+ {
+ // 0x00 and 0x01 are read registers
-void k053260_device::check_bounds( int channel )
-{
- int channel_start = ( m_channels[channel].bank << 16 ) + m_channels[channel].start;
- int channel_end = channel_start + m_channels[channel].size - 1;
+ case 0x02: // sub-to-main ports
+ case 0x03:
+ m_portdata[offset] = data;
+ break;
- if ( channel_start > m_rom_size ) {
- logerror("K053260: Attempting to start playing past the end of the ROM ( start = %06x, end = %06x ).\n", channel_start, channel_end );
+ // 0x04 through 0x07 seem to be unused
- m_channels[channel].play = 0;
+ case 0x28: // key on/off
+ {
+ UINT8 rising_edge = data & ~m_keyon;
- return;
- }
+ for (int i = 0; i < 4; i++)
+ {
+ if (rising_edge & (1 << i))
+ m_voice[i].key_on();
+ else if (!(data & (1 << i)))
+ m_voice[i].key_off();
+ }
+ m_keyon = data;
+ break;
+ }
- if ( channel_end > m_rom_size ) {
- logerror("K53260: Attempting to play past the end of the ROM ( start = %06x, end = %06x ).\n", channel_start, channel_end );
+ // 0x29 is a read register
- m_channels[channel].size = m_rom_size - channel_start;
+ case 0x2a: // loop and pcm/adpcm select
+ for (int i = 0; i < 4; i++)
+ {
+ m_voice[i].set_loop_kadpcm(data);
+ data >>= 1;
+ }
+ break;
+
+ // 0x2b seems to be unused
+
+ case 0x2c: // pan, voices 0 and 1
+ m_voice[0].set_pan(data);
+ m_voice[1].set_pan(data >> 3);
+ break;
+
+ case 0x2d: // pan, voices 2 and 3
+ m_voice[2].set_pan(data);
+ m_voice[3].set_pan(data >> 3);
+ break;
+
+ // 0x2e is a read register
+
+ case 0x2f: // control
+ m_mode = data;
+ // bit 0 = enable ROM read from register 0x2e
+ // bit 1 = enable sound output
+ // bit 2 = enable aux input?
+ // (set by all games except Golfing Greats and Rollergames, both of which
+ // don't have a YM2151. Over Drive only sets it on one of the two chips)
+ // bit 3 = aux input or ROM sharing related?
+ // (only set by Over Drive, and only on the same chip that bit 2 is set on)
+ break;
+
+ default:
+ logerror("%s: Write to unknown K053260 register %02x (data = %02x)\n",
+ machine().describe_context(), offset, data);
}
- if (LOG) logerror("K053260: Sample Start = %06x, Sample End = %06x, Sample rate = %04x, PPCM = %s\n", channel_start, channel_end, m_channels[channel].rate, m_channels[channel].ppcm ? "yes" : "no" );
}
-WRITE8_MEMBER( k053260_device::k053260_w )
+INLINE int limit( int val, int max, int min )
{
- int i, t;
- int r = offset;
- int v = data;
+ if ( val > max )
+ val = max;
+ else if ( val < min )
+ val = min;
- if ( r > 0x2f ) {
- logerror("K053260: Writing past registers\n" );
- return;
- }
+ return val;
+}
+
+#define MAXOUT 0x7fff
+#define MINOUT -0x8000
+
+//-------------------------------------------------
+// sound_stream_update - handle a stream update
+//-------------------------------------------------
+
+void k053260_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+{
+ if (m_mode & 2)
+ {
+ for ( int j = 0; j < samples; j++ )
+ {
+ stream_sample_t buffer[2] = {0, 0};
- m_channel->update();
-
- /* before we update the regs, we need to check for a latched reg */
- if ( r == 0x28 ) {
- t = m_regs[r] ^ v;
-
- for ( i = 0; i < 4; i++ ) {
- if ( t & ( 1 << i ) ) {
- if ( v & ( 1 << i ) ) {
- m_channels[i].play = 1;
- m_channels[i].pos = 0;
- m_channels[i].ppcm_data = 0;
- check_bounds( i );
- } else
- m_channels[i].play = 0;
+ for (int i = 0; i < 4; i++)
+ {
+ KDSC_Voice &voice = m_voice[i];
+ if (voice.playing())
+ voice.play(buffer);
}
- }
- m_regs[r] = v;
- return;
+ outputs[0][j] = limit( buffer[0] >> 1, MAXOUT, MINOUT );
+ outputs[1][j] = limit( buffer[1] >> 1, MAXOUT, MINOUT );
+ }
+ }
+ else
+ {
+ memset( outputs[0], 0, samples * sizeof(*outputs[0]));
+ memset( outputs[1], 0, samples * sizeof(*outputs[1]));
}
+}
- /* update regs */
- m_regs[r] = v;
- /* communication registers */
- if ( r < 8 )
- return;
+//**************************************************************************
+// KDSC_Voice - one of the four voices
+//**************************************************************************
- /* channel setup */
- if ( r < 0x28 ) {
- int channel = ( r - 8 ) / 8;
+void k053260_device::KDSC_Voice::voice_start(k053260_device &device, int index)
+{
+ m_device = &device;
+
+ voice_reset();
+
+ device.save_item(NAME(m_position), index);
+ device.save_item(NAME(m_pan_volume), index);
+ device.save_item(NAME(m_counter), index);
+ device.save_item(NAME(m_output), index);
+ device.save_item(NAME(m_playing), index);
+ device.save_item(NAME(m_start), index);
+ device.save_item(NAME(m_length), index);
+ device.save_item(NAME(m_pitch), index);
+ device.save_item(NAME(m_volume), index);
+ device.save_item(NAME(m_pan), index);
+ device.save_item(NAME(m_loop), index);
+ device.save_item(NAME(m_kadpcm), index);
+}
- switch ( ( r - 8 ) & 0x07 ) {
- case 0: /* sample rate low */
- m_channels[channel].rate &= 0x0f00;
- m_channels[channel].rate |= v;
- break;
+void k053260_device::KDSC_Voice::voice_reset()
+{
+ m_position = 0;
+ m_counter = 0;
+ m_output = 0;
+ m_playing = false;
+ m_start = 0;
+ m_length = 0;
+ m_pitch = 0;
+ m_volume = 0;
+ m_pan = 0;
+ m_loop = false;
+ m_kadpcm = false;
+ update_pan_volume();
+}
- case 1: /* sample rate high */
- m_channels[channel].rate &= 0x00ff;
- m_channels[channel].rate |= ( v & 0x0f ) << 8;
+void k053260_device::KDSC_Voice::set_register(offs_t offset, UINT8 data)
+{
+ switch (offset & 0x7)
+ {
+ case 0: // pitch, lower 8 bits
+ m_pitch = (m_pitch & 0x0f00) | data;
break;
-
- case 2: /* size low */
- m_channels[channel].size &= 0xff00;
- m_channels[channel].size |= v;
+ case 1: // pitch, upper 4 bits
+ m_pitch = (m_pitch & 0x00ff) | ((data << 8) & 0x0f00);
break;
-
- case 3: /* size high */
- m_channels[channel].size &= 0x00ff;
- m_channels[channel].size |= v << 8;
+ case 2: // length, lower 8 bits
+ m_length = (m_length & 0xff00) | data;
break;
-
- case 4: /* start low */
- m_channels[channel].start &= 0xff00;
- m_channels[channel].start |= v;
+ case 3: // length, upper 8 bits
+ m_length = (m_length & 0x00ff) | (data << 8);
break;
-
- case 5: /* start high */
- m_channels[channel].start &= 0x00ff;
- m_channels[channel].start |= v << 8;
+ case 4: // start, lower 8 bits
+ m_start = (m_start & 0x1fff00) | data;
break;
-
- case 6: /* bank */
- m_channels[channel].bank = v & 0xff;
+ case 5: // start, middle 8 bits
+ m_start = (m_start & 0x1f00ff) | (data << 8);
break;
-
- case 7: /* volume is 7 bits. Convert to 8 bits now. */
- m_channels[channel].volume = ( ( v & 0x7f ) << 1 ) | ( v & 1 );
+ case 6: // start, upper 5 bits
+ m_start = (m_start & 0x00ffff) | ((data << 16) & 0x1f0000);
break;
- }
-
- return;
+ case 7: // volume, 7 bits
+ m_volume = data & 0x7f;
+ update_pan_volume();
}
+}
- switch( r ) {
- case 0x2a: /* loop, ppcm */
- for ( i = 0; i < 4; i++ )
- m_channels[i].loop = ( v & ( 1 << i ) ) != 0;
-
- for ( i = 4; i < 8; i++ )
- m_channels[i-4].ppcm = ( v & ( 1 << i ) ) != 0;
- break;
-
- case 0x2c: /* pan */
- m_channels[0].pan = v & 7;
- m_channels[1].pan = ( v >> 3 ) & 7;
- break;
-
- case 0x2d: /* more pan */
- m_channels[2].pan = v & 7;
- m_channels[3].pan = ( v >> 3 ) & 7;
- break;
-
- case 0x2f: /* control */
- m_mode = v & 7;
- /* bit 0 = read ROM */
- /* bit 1 = enable sound output */
- /* bit 2 = unknown */
- break;
+void k053260_device::KDSC_Voice::set_loop_kadpcm(UINT8 data)
+{
+ m_loop = BIT(data, 0);
+ m_kadpcm = BIT(data, 4);
+}
+
+void k053260_device::KDSC_Voice::set_pan(UINT8 data)
+{
+ m_pan = data & 0x7;
+ update_pan_volume();
+}
+
+void k053260_device::KDSC_Voice::update_pan_volume()
+{
+ m_pan_volume[0] = m_volume * (8 - m_pan);
+ m_pan_volume[1] = m_volume * m_pan;
+}
+
+void k053260_device::KDSC_Voice::key_on()
+{
+ if (m_start >= m_device->m_rom_size)
+ logerror("K053260: Attempting to start playing past the end of the ROM ( start = %06x, length = %06x )\n", m_start, m_length);
+
+ else if (m_start + m_length >= m_device->m_rom_size)
+ logerror("K053260: Attempting to play past the end of the ROM ( start = %06x, length = %06x )\n",
+ m_start, m_length);
+
+ else
+ {
+ m_position = m_kadpcm; // for kadpcm low bit is nybble offset, so must start at 1 due to preincrement
+ m_counter = 0x1000 - CLOCKS_PER_SAMPLE; // force update on next sound_stream_update
+ m_output = 0;
+ m_playing = true;
+ if (LOG) logerror("K053260: start = %06x, length = %06x, pitch = %04x, vol = %02x, loop = %s, %s\n",
+ m_start, m_length, m_pitch, m_volume, m_loop ? "yes" : "no", m_kadpcm ? "KADPCM" : "PCM" );
}
}
-READ8_MEMBER( k053260_device::k053260_r )
+void k053260_device::KDSC_Voice::key_off()
{
- switch ( offset ) {
- case 0x29: /* channel status */
- {
- int i, status = 0;
+ m_position = 0;
+ m_output = 0;
+ m_playing = false;
+}
- for ( i = 0; i < 4; i++ )
- status |= m_channels[i].play << i;
+void k053260_device::KDSC_Voice::play(stream_sample_t *outputs)
+{
+ m_counter += CLOCKS_PER_SAMPLE;
- return status;
+ while (m_counter >= 0x1000)
+ {
+ m_counter = m_counter - 0x1000 + m_pitch;
+
+ UINT32 bytepos = ++m_position >> m_kadpcm;
+ /*
+ Yes, _pre_increment. Playback must start 1 byte position after the
+ start address written to the register, or else ADPCM sounds will
+ have DC offsets (e.g. TMNT2 theme song) or will overflow and be
+ distorted (e.g. various Vendetta sound effects)
+ The "headers" in the Simpsons and Vendetta sound ROMs provide
+ further evidence of this quirk (the start addresses listed in the
+ ROM header are all 1 greater than the addresses the CPU writes
+ into the register)
+ */
+ if (bytepos > m_length)
+ {
+ if (m_loop)
+ {
+ m_position = m_output = bytepos = 0;
}
-
- case 0x2e: /* read ROM */
- if ( m_mode & 1 )
+ else
{
- UINT32 offs = m_channels[0].start + ( m_channels[0].pos >> BASE_SHIFT ) + ( m_channels[0].bank << 16 );
+ m_playing = false;
+ return;
+ }
+ }
- m_channels[0].pos += ( 1 << 16 );
+ UINT8 romdata = m_device->m_rom[m_start + bytepos];
- if ( offs > m_rom_size ) {
- logerror("%s: K53260: Attempting to read past ROM size in ROM Read Mode (offs = %06x, size = %06x).\n", machine().describe_context(),offs,m_rom_size );
+ if (m_kadpcm)
+ {
+ if (m_position & 1) romdata >>= 4; // decode low nybble, then high nybble
+ static const INT8 kadpcm_table[] = {0,1,2,4,8,16,32,64,-128,-64,-32,-16,-8,-4,-2,-1};
+ m_output += kadpcm_table[romdata & 0xf];
+ }
+ else
+ {
+ m_output = romdata;
+ }
+ }
- return 0;
- }
+ outputs[0] += m_output * m_pan_volume[0];
+ outputs[1] += m_output * m_pan_volume[1];
+}
- return m_rom[offs];
- }
- break;
+UINT8 k053260_device::KDSC_Voice::read_rom()
+{
+ UINT32 offs = m_start + m_position;
+
+ m_position = (m_position + 1) & 0xffff;
+
+ if (offs >= m_device->m_rom_size)
+ {
+ logerror("%s: K053260: Attempting to read past the end of the ROM (offs = %06x, size = %06x)\n",
+ m_device->machine().describe_context(), offs, m_device->m_rom_size);
+ return 0;
}
- return m_regs[offset];
+ return m_device->m_rom[offs];
}
diff --git a/src/emu/sound/k053260.h b/src/emu/sound/k053260.h
index 6aa1bbd0db1..8e2e4731d29 100644
--- a/src/emu/sound/k053260.h
+++ b/src/emu/sound/k053260.h
@@ -1,6 +1,6 @@
/*********************************************************
- Konami 053260 PCM/ADPCM Sound Chip
+ Konami 053260 KDSC
*********************************************************/
@@ -27,35 +27,6 @@
// TYPE DEFINITIONS
//**************************************************************************
-struct k053260_channel
-{
- k053260_channel() :
- rate(0),
- size(0),
- start(0),
- bank(0),
- volume(0),
- play(0),
- pan(0),
- pos(0),
- loop(0),
- ppcm(0),
- ppcm_data(0) {}
-
- UINT32 rate;
- UINT32 size;
- UINT32 start;
- UINT32 bank;
- UINT32 volume;
- int play;
- UINT32 pan;
- UINT32 pos;
- int loop;
- int ppcm; /* packed PCM ( 4 bit signed ) */
- int ppcm_data;
-};
-
-
// ======================> k053260_device
class k053260_device : public device_t,
@@ -67,6 +38,11 @@ public:
static void set_region_tag(device_t &device, const char *tag) { downcast<k053260_device &>(device).m_rgnoverride = tag; }
+ DECLARE_READ8_MEMBER( main_read );
+ DECLARE_WRITE8_MEMBER( main_write );
+ DECLARE_READ8_MEMBER( read );
+ DECLARE_WRITE8_MEMBER( write );
+
protected:
// device-level overrides
virtual void device_start();
@@ -75,22 +51,59 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
-public:
- DECLARE_WRITE8_MEMBER( k053260_w );
- DECLARE_READ8_MEMBER( k053260_r );
-
private:
- void InitDeltaTable( int rate, int clock );
- void check_bounds( int channel );
-
- sound_stream * m_channel;
- int m_mode;
- int m_regs[0x30];
- UINT8 *m_rom;
- int m_rom_size;
- UINT32 *m_delta_table;
- k053260_channel m_channels[4];
- const char *m_rgnoverride;
+ // configuration
+ const char * m_rgnoverride;
+
+ sound_stream * m_stream;
+ UINT8 * m_rom;
+ UINT32 m_rom_size;
+
+ // live state
+ UINT8 m_portdata[4];
+ UINT8 m_keyon;
+ UINT8 m_mode;
+
+ // per voice state
+ class KDSC_Voice
+ {
+ public:
+ inline void voice_start(k053260_device &device, int index);
+ inline void voice_reset();
+ inline void set_register(offs_t offset, UINT8 data);
+ inline void set_loop_kadpcm(UINT8 data);
+ inline void set_pan(UINT8 data);
+ inline void update_pan_volume();
+ inline void key_on();
+ inline void key_off();
+ inline void play(stream_sample_t *outputs);
+ inline bool playing() { return m_playing; }
+ inline UINT8 read_rom();
+
+ private:
+ // pointer to owning device
+ k053260_device *m_device;
+
+ // live state
+ UINT32 m_position;
+ UINT16 m_pan_volume[2];
+ UINT16 m_counter;
+ INT8 m_output;
+ bool m_playing;
+
+ // per voice registers
+ UINT32 m_start;
+ UINT16 m_length;
+ UINT16 m_pitch;
+ UINT8 m_volume;
+
+ // bit packed registers
+ UINT8 m_pan;
+ bool m_loop;
+ bool m_kadpcm;
+ } m_voice[4];
+
+ friend class k053260_device::KDSC_Voice;
};
extern const device_type K053260;
diff --git a/src/mame/drivers/asterix.c b/src/mame/drivers/asterix.c
index ffa97ace3b6..30b0335d67a 100644
--- a/src/mame/drivers/asterix.c
+++ b/src/mame/drivers/asterix.c
@@ -50,11 +50,6 @@ INTERRUPT_GEN_MEMBER(asterix_state::asterix_interrupt)
device.execute().set_input_line(5, HOLD_LINE); /* ??? All irqs have the same vector, and the mask used is 0 or 7 */
}
-READ8_MEMBER(asterix_state::asterix_sound_r)
-{
- return m_k053260->k053260_r(space, 2 + offset);
-}
-
void asterix_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
@@ -170,7 +165,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, asterix_state )
AM_RANGE(0x380000, 0x380001) AM_READ_PORT("IN0")
AM_RANGE(0x380002, 0x380003) AM_READ_PORT("IN1")
AM_RANGE(0x380100, 0x380101) AM_WRITE(control2_w)
- AM_RANGE(0x380200, 0x380203) AM_READ8(asterix_sound_r, 0x00ff) AM_DEVWRITE8("k053260", k053260_device, k053260_w, 0x00ff)
+ AM_RANGE(0x380200, 0x380203) AM_DEVREADWRITE8("k053260", k053260_device, main_read, main_write, 0x00ff)
AM_RANGE(0x380300, 0x380301) AM_WRITE(sound_irq_w)
AM_RANGE(0x380400, 0x380401) AM_WRITE(asterix_spritebank_w)
AM_RANGE(0x380500, 0x38051f) AM_DEVWRITE("k053251", k053251_device, lsb_w)
@@ -186,7 +181,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, asterix_state )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf801, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_device, status_r, data_w)
- AM_RANGE(0xfa00, 0xfa2f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xfa00, 0xfa2f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(sound_arm_nmi_w)
AM_RANGE(0xfe00, 0xfe00) AM_DEVWRITE("ymsnd", ym2151_device, register_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/overdriv.c b/src/mame/drivers/overdriv.c
index 447b41ea4d2..0ab432139c0 100644
--- a/src/mame/drivers/overdriv.c
+++ b/src/mame/drivers/overdriv.c
@@ -123,17 +123,6 @@ WRITE16_MEMBER(overdriv_state::cpuB_ctrl_w)
}
}
-
-READ8_MEMBER(overdriv_state::overdriv_1_sound_r)
-{
- return m_k053260_1->k053260_r(space, 2 + offset);
-}
-
-READ8_MEMBER(overdriv_state::overdriv_2_sound_r)
-{
- return m_k053260_2->k053260_r(space, 2 + offset);
-}
-
WRITE16_MEMBER(overdriv_state::overdriv_soundirq_w)
{
m_audiocpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE);
@@ -162,8 +151,8 @@ static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16, overdriv_state )
AM_RANGE(0x1c0000, 0x1c001f) AM_DEVWRITE8("k051316_1", k051316_device, ctrl_w, 0xff00)
AM_RANGE(0x1c8000, 0x1c801f) AM_DEVWRITE8("k051316_2", k051316_device, ctrl_w, 0xff00)
AM_RANGE(0x1d0000, 0x1d001f) AM_DEVWRITE("k053251", k053251_device, msb_w)
- AM_RANGE(0x1d8000, 0x1d8003) AM_READ8(overdriv_1_sound_r, 0x00ff) AM_DEVWRITE8("k053260_1", k053260_device, k053260_w, 0x00ff) /* K053260 */
- AM_RANGE(0x1e0000, 0x1e0003) AM_READ8(overdriv_2_sound_r, 0x00ff) AM_DEVWRITE8("k053260_2", k053260_device, k053260_w, 0x00ff) /* K053260 */
+ AM_RANGE(0x1d8000, 0x1d8003) AM_DEVREADWRITE8("k053260_1", k053260_device, main_read, main_write, 0x00ff)
+ AM_RANGE(0x1e0000, 0x1e0003) AM_DEVREADWRITE8("k053260_2", k053260_device, main_read, main_write, 0x00ff)
AM_RANGE(0x1e8000, 0x1e8001) AM_WRITE(overdriv_soundirq_w)
AM_RANGE(0x1f0000, 0x1f0001) AM_WRITE(cpuA_ctrl_w) /* halt cpu B, coin counter, start lamp, other? */
AM_RANGE(0x1f8000, 0x1f8001) AM_WRITE(eeprom_w)
@@ -218,8 +207,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( overdriv_sound_map, AS_PROGRAM, 8, overdriv_state )
AM_RANGE(0x0200, 0x0201) AM_DEVREADWRITE("ymsnd", ym2151_device,read,write)
- AM_RANGE(0x0400, 0x042f) AM_DEVREADWRITE("k053260_1", k053260_device, k053260_r, k053260_w)
- AM_RANGE(0x0600, 0x062f) AM_DEVREADWRITE("k053260_2", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0x0400, 0x042f) AM_DEVREADWRITE("k053260_1", k053260_device, read, write)
+ AM_RANGE(0x0600, 0x062f) AM_DEVREADWRITE("k053260_2", k053260_device, read, write)
AM_RANGE(0x0800, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0xffff) AM_ROM
ADDRESS_MAP_END
diff --git a/src/mame/drivers/parodius.c b/src/mame/drivers/parodius.c
index 4144e214094..985798ddc8f 100644
--- a/src/mame/drivers/parodius.c
+++ b/src/mame/drivers/parodius.c
@@ -53,11 +53,6 @@ WRITE8_MEMBER(parodius_state::parodius_3fc0_w)
/* other bits unknown */
}
-READ8_MEMBER(parodius_state::parodius_sound_r)
-{
- return m_k053260->k053260_r(space, 2 + offset);
-}
-
WRITE8_MEMBER(parodius_state::parodius_sh_irqtrigger_w)
{
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff);
@@ -105,7 +100,7 @@ static ADDRESS_MAP_START( parodius_map, AS_PROGRAM, 8, parodius_state )
AM_RANGE(0x3fc0, 0x3fc0) AM_READ(watchdog_reset_r) AM_WRITE(parodius_3fc0_w)
AM_RANGE(0x3fc4, 0x3fc4) AM_WRITE(parodius_videobank_w)
AM_RANGE(0x3fc8, 0x3fc8) AM_WRITE(parodius_sh_irqtrigger_w)
- AM_RANGE(0x3fcc, 0x3fcd) AM_READ(parodius_sound_r) AM_DEVWRITE("k053260", k053260_device, k053260_w) /* K053260 */
+ AM_RANGE(0x3fcc, 0x3fcd) AM_DEVREADWRITE("k053260", k053260_device, main_read, main_write)
AM_RANGE(0x2000, 0x27ff) AM_DEVICE("bank2000", address_map_bank_device, amap8)
AM_RANGE(0x2000, 0x5fff) AM_DEVREADWRITE("k052109", k052109_device, read, write)
AM_RANGE(0x6000, 0x9fff) AM_ROMBANK("bank1") /* banked ROM */
@@ -127,7 +122,7 @@ static ADDRESS_MAP_START( parodius_sound_map, AS_PROGRAM, 8, parodius_state )
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_device,read,write)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(sound_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/rollerg.c b/src/mame/drivers/rollerg.c
index b204e3e5449..0324a633aa0 100644
--- a/src/mame/drivers/rollerg.c
+++ b/src/mame/drivers/rollerg.c
@@ -42,13 +42,6 @@ READ8_MEMBER(rollerg_state::rollerg_k051316_r)
return m_k051316->read(space, offset);
}
-READ8_MEMBER(rollerg_state::rollerg_sound_r)
-{
- /* If the sound CPU is running, read the status, otherwise
- just make it pass the test */
- return m_k053260->k053260_r(space, 2 + offset);
-}
-
WRITE8_MEMBER(rollerg_state::soundirq_w)
{
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff);
@@ -80,7 +73,7 @@ READ8_MEMBER(rollerg_state::pip_r)
static ADDRESS_MAP_START( rollerg_map, AS_PROGRAM, 8, rollerg_state )
AM_RANGE(0x0010, 0x0010) AM_WRITE(rollerg_0010_w)
AM_RANGE(0x0020, 0x0020) AM_READWRITE(watchdog_reset_r,watchdog_reset_w)
- AM_RANGE(0x0030, 0x0031) AM_READ(rollerg_sound_r) AM_DEVWRITE("k053260", k053260_device, k053260_w) /* K053260 */
+ AM_RANGE(0x0030, 0x0031) AM_DEVREADWRITE("k053260", k053260_device, main_read, main_write)
AM_RANGE(0x0040, 0x0040) AM_WRITE(soundirq_w)
AM_RANGE(0x0050, 0x0050) AM_READ_PORT("P1")
AM_RANGE(0x0051, 0x0051) AM_READ_PORT("P2")
@@ -102,7 +95,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( rollerg_sound_map, AS_PROGRAM, 8, rollerg_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
- AM_RANGE(0xa000, 0xa02f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xa000, 0xa02f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE("ymsnd", ym3812_device, read, write)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(sound_arm_nmi_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/simpsons.c b/src/mame/drivers/simpsons.c
index 27f5c5635e4..9dcd200aab4 100644
--- a/src/mame/drivers/simpsons.c
+++ b/src/mame/drivers/simpsons.c
@@ -124,7 +124,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, simpsons_state )
AM_RANGE(0x1fc0, 0x1fc0) AM_WRITE(simpsons_coin_counter_w)
AM_RANGE(0x1fc2, 0x1fc2) AM_WRITE(simpsons_eeprom_w)
AM_RANGE(0x1fc4, 0x1fc4) AM_READ(simpsons_sound_interrupt_r)
- AM_RANGE(0x1fc6, 0x1fc7) AM_READ(simpsons_sound_r) AM_DEVWRITE("k053260", k053260_device, k053260_w)
+ AM_RANGE(0x1fc6, 0x1fc7) AM_DEVREADWRITE("k053260", k053260_device, main_read, main_write)
AM_RANGE(0x1fc8, 0x1fc9) AM_DEVREAD("k053246", k053247_device, k053246_r)
AM_RANGE(0x1fca, 0x1fca) AM_READ(watchdog_reset_r)
AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE("k052109", k052109_device, read, write)
@@ -188,7 +188,7 @@ static ADDRESS_MAP_START( z80_map, AS_PROGRAM, 8, simpsons_state )
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(z80_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
AM_RANGE(0xfe00, 0xfe00) AM_WRITE(z80_bankswitch_w)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c
index 6a45512b35c..1605fcabe84 100644
--- a/src/mame/drivers/tmnt.c
+++ b/src/mame/drivers/tmnt.c
@@ -59,7 +59,6 @@ Updates:
#include "sound/2151intf.h"
#include "sound/okim6295.h"
#include "sound/samples.h"
-#include "sound/k053260.h"
#include "sound/k054539.h"
#include "machine/nvram.h"
#include "includes/tmnt.h"
@@ -163,16 +162,9 @@ INTERRUPT_GEN_MEMBER(tmnt_state::lgtnfght_interrupt)
device.execute().set_input_line(M68K_IRQ_5, HOLD_LINE);
}
-READ8_MEMBER(tmnt_state::punkshot_sound_r)
-{
- /* If the sound CPU is running, read the status, otherwise
- just make it pass the test */
- return m_k053260->k053260_r(space, 2 + offset);
-}
-
WRITE8_MEMBER(tmnt_state::glfgreat_sound_w)
{
- m_k053260->k053260_w(space, offset, data);
+ m_k053260->main_write(space, offset, data);
if (offset)
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff);
@@ -543,8 +535,7 @@ static ADDRESS_MAP_START( punkshot_main_map, AS_PROGRAM, 16, tmnt_state )
AM_RANGE(0x0a0004, 0x0a0005) AM_READ_PORT("P3/P4")
AM_RANGE(0x0a0006, 0x0a0007) AM_READ_PORT("P1/P2")
AM_RANGE(0x0a0020, 0x0a0021) AM_WRITE(punkshot_0a0020_w)
- AM_RANGE(0x0a0040, 0x0a0043) AM_READ8(punkshot_sound_r, 0x00ff) /* K053260 */
- AM_RANGE(0x0a0040, 0x0a0041) AM_DEVWRITE8("k053260", k053260_device, k053260_w, 0x00ff)
+ AM_RANGE(0x0a0040, 0x0a0043) AM_DEVREADWRITE8("k053260", k053260_device, main_read, main_write, 0x00ff)
AM_RANGE(0x0a0060, 0x0a007f) AM_DEVWRITE("k053251", k053251_device, lsb_w)
AM_RANGE(0x0a0080, 0x0a0081) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x100000, 0x107fff) AM_READWRITE(k052109_word_noA12_r, punkshot_k052109_word_noA12_w)
@@ -565,8 +556,7 @@ static ADDRESS_MAP_START( lgtnfght_main_map, AS_PROGRAM, 16, tmnt_state )
AM_RANGE(0x0a0008, 0x0a0009) AM_READ_PORT("DSW2")
AM_RANGE(0x0a0010, 0x0a0011) AM_READ_PORT("DSW3")
AM_RANGE(0x0a0018, 0x0a0019) AM_WRITE(lgtnfght_0a0018_w)
- AM_RANGE(0x0a0020, 0x0a0023) AM_READ8(punkshot_sound_r, 0x00ff) /* K053260 */
- AM_RANGE(0x0a0020, 0x0a0021) AM_DEVWRITE8("k053260", k053260_device, k053260_w, 0x00ff)
+ AM_RANGE(0x0a0020, 0x0a0023) AM_DEVREADWRITE8("k053260", k053260_device, main_read, main_write, 0x00ff)
AM_RANGE(0x0a0028, 0x0a0029) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x0b0000, 0x0b3fff) AM_READWRITE(k053245_scattered_word_r, k053245_scattered_word_w) AM_SHARE("spriteram")
AM_RANGE(0x0c0000, 0x0c001f) AM_READWRITE(k053244_word_noA1_r, k053244_word_noA1_w)
@@ -595,9 +585,8 @@ static ADDRESS_MAP_START( blswhstl_main_map, AS_PROGRAM, 16, tmnt_state )
AM_RANGE(0x700006, 0x700007) AM_READ_PORT("EEPROM")
AM_RANGE(0x700200, 0x700201) AM_WRITE(blswhstl_eeprom_w)
AM_RANGE(0x700300, 0x700301) AM_WRITE(blswhstl_700300_w)
- AM_RANGE(0x700400, 0x700401) AM_WRITE(watchdog_reset16_w)
- AM_RANGE(0x780600, 0x780603) AM_READ8(punkshot_sound_r, 0x00ff) /* K053260 */
- AM_RANGE(0x780600, 0x780601) AM_DEVWRITE8("k053260", k053260_device, k053260_w, 0x00ff)
+ AM_RANGE(0x700400, 0x700401) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w)
+ AM_RANGE(0x780600, 0x780603) AM_DEVREADWRITE8("k053260", k053260_device, main_read, main_write, 0x00ff)
AM_RANGE(0x780604, 0x780605) AM_WRITE(ssriders_soundkludge_w)
AM_RANGE(0x780700, 0x78071f) AM_DEVWRITE("k053251", k053251_device, lsb_w)
ADDRESS_MAP_END
@@ -642,7 +631,7 @@ static ADDRESS_MAP_START( glfgreat_main_map, AS_PROGRAM, 16, tmnt_state )
AM_RANGE(0x121000, 0x121001) AM_READ(glfgreat_ball_r) /* returns the color of the center pixel of the roz layer */
AM_RANGE(0x122000, 0x122001) AM_WRITE(glfgreat_122000_w)
AM_RANGE(0x124000, 0x124001) AM_WRITE(watchdog_reset16_w)
- AM_RANGE(0x125000, 0x125003) AM_READWRITE8(punkshot_sound_r, glfgreat_sound_w, 0xff00) /* K053260 */
+ AM_RANGE(0x125000, 0x125003) AM_DEVREAD8("k053260", k053260_device, main_read, 0xff00) AM_WRITE8(glfgreat_sound_w, 0xff00)
AM_RANGE(0x200000, 0x207fff) AM_READWRITE(k052109_word_noA12_r, k052109_word_noA12_w)
AM_RANGE(0x300000, 0x3fffff) AM_READ(glfgreat_rom_r)
ADDRESS_MAP_END
@@ -926,8 +915,7 @@ static ADDRESS_MAP_START( tmnt2_main_map, AS_PROGRAM, 16, tmnt_state )
// AM_RANGE(0x1c0800, 0x1c0801) AM_READ(ssriders_protection_r) /* protection device */
AM_RANGE(0x1c0800, 0x1c081f) AM_WRITE(tmnt2_1c0800_w) AM_SHARE("tmnt2_1c0800") /* protection device */
AM_RANGE(0x5a0000, 0x5a001f) AM_READWRITE(k053244_word_noA1_r, k053244_word_noA1_w)
- AM_RANGE(0x5c0600, 0x5c0603) AM_READ8(punkshot_sound_r, 0x00ff) /* K053260 */
- AM_RANGE(0x5c0600, 0x5c0601) AM_DEVWRITE8("k053260", k053260_device, k053260_w, 0x00ff)
+ AM_RANGE(0x5c0600, 0x5c0603) AM_DEVREADWRITE8("k053260", k053260_device, main_read, main_write, 0x00ff)
AM_RANGE(0x5c0604, 0x5c0605) AM_WRITE(ssriders_soundkludge_w)
AM_RANGE(0x5c0700, 0x5c071f) AM_DEVWRITE("k053251", k053251_device, lsb_w)
AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE("k052109", k052109_device, word_r, word_w)
@@ -952,8 +940,7 @@ static ADDRESS_MAP_START( ssriders_main_map, AS_PROGRAM, 16, tmnt_state )
AM_RANGE(0x1c0800, 0x1c0801) AM_READ(ssriders_protection_r)
AM_RANGE(0x1c0800, 0x1c0803) AM_WRITE(ssriders_protection_w)
AM_RANGE(0x5a0000, 0x5a001f) AM_READWRITE(k053244_word_noA1_r, k053244_word_noA1_w)
- AM_RANGE(0x5c0600, 0x5c0603) AM_READ8(punkshot_sound_r, 0x00ff) /* K053260 */
- AM_RANGE(0x5c0600, 0x5c0601) AM_DEVWRITE8("k053260", k053260_device, k053260_w, 0x00ff)
+ AM_RANGE(0x5c0600, 0x5c0603) AM_DEVREADWRITE8("k053260", k053260_device, main_read, main_write, 0x00ff)
AM_RANGE(0x5c0604, 0x5c0605) AM_WRITE(ssriders_soundkludge_w)
AM_RANGE(0x5c0700, 0x5c071f) AM_DEVWRITE("k053251", k053251_device, lsb_w)
AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE("k052109", k052109_device, word_r, word_w)
@@ -991,8 +978,7 @@ static ADDRESS_MAP_START( thndrx2_main_map, AS_PROGRAM, 16, tmnt_state )
AM_RANGE(0x100000, 0x103fff) AM_RAM /* main RAM */
AM_RANGE(0x200000, 0x200fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x300000, 0x30001f) AM_DEVWRITE("k053251", k053251_device, lsb_w)
- AM_RANGE(0x400000, 0x400003) AM_READ8(punkshot_sound_r, 0x00ff) /* K053260 */
- AM_RANGE(0x400000, 0x400001) AM_DEVWRITE8("k053260", k053260_device, k053260_w, 0x00ff)
+ AM_RANGE(0x400000, 0x400003) AM_DEVREADWRITE8("k053260", k053260_device, main_read, main_write, 0x00ff)
AM_RANGE(0x500000, 0x50003f) AM_DEVREADWRITE("k054000", k054000_device, lsb_r, lsb_w)
AM_RANGE(0x500100, 0x500101) AM_WRITE(thndrx2_eeprom_w)
AM_RANGE(0x500200, 0x500201) AM_READ_PORT("P1/COINS")
@@ -1032,7 +1018,7 @@ static ADDRESS_MAP_START( punkshot_audio_map, AS_PROGRAM, 8, tmnt_state )
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(sound_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
ADDRESS_MAP_END
@@ -1040,14 +1026,14 @@ static ADDRESS_MAP_START( lgtnfght_audio_map, AS_PROGRAM, 8, tmnt_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
- AM_RANGE(0xc000, 0xc02f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xc000, 0xc02f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
ADDRESS_MAP_END
static ADDRESS_MAP_START( glfgreat_audio_map, AS_PROGRAM, 8, tmnt_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
- AM_RANGE(0xf800, 0xf82f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xf800, 0xf82f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(sound_arm_nmi_w)
ADDRESS_MAP_END
@@ -1056,7 +1042,7 @@ static ADDRESS_MAP_START( ssriders_audio_map, AS_PROGRAM, 8, tmnt_state )
AM_RANGE(0x0000, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
- AM_RANGE(0xfa00, 0xfa2f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xfa00, 0xfa2f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(sound_arm_nmi_w)
ADDRESS_MAP_END
@@ -1066,7 +1052,7 @@ static ADDRESS_MAP_START( thndrx2_audio_map, AS_PROGRAM, 8, tmnt_state )
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf801) AM_MIRROR(0x0010) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(sound_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
ADDRESS_MAP_END
diff --git a/src/mame/drivers/vendetta.c b/src/mame/drivers/vendetta.c
index 33ddeeb42fa..2dedbe36293 100644
--- a/src/mame/drivers/vendetta.c
+++ b/src/mame/drivers/vendetta.c
@@ -203,17 +203,12 @@ WRITE8_MEMBER(vendetta_state::z80_irq_w)
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff);
}
-READ8_MEMBER(vendetta_state::vendetta_sound_interrupt_r)
+READ8_MEMBER(vendetta_state::z80_irq_r)
{
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff);
return 0x00;
}
-READ8_MEMBER(vendetta_state::vendetta_sound_r)
-{
- return m_k053260->k053260_r(space, 2 + offset);
-}
-
/********************************************/
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, vendetta_state )
@@ -230,8 +225,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, vendetta_state )
AM_RANGE(0x5fd1, 0x5fd1) AM_READ_PORT("SERVICE")
AM_RANGE(0x5fe0, 0x5fe0) AM_WRITE(vendetta_5fe0_w)
AM_RANGE(0x5fe2, 0x5fe2) AM_WRITE(vendetta_eeprom_w)
- AM_RANGE(0x5fe4, 0x5fe4) AM_READWRITE(vendetta_sound_interrupt_r, z80_irq_w)
- AM_RANGE(0x5fe6, 0x5fe7) AM_READ(vendetta_sound_r) AM_DEVWRITE("k053260", k053260_device, k053260_w)
+ AM_RANGE(0x5fe4, 0x5fe4) AM_READWRITE(z80_irq_r, z80_irq_w)
+ AM_RANGE(0x5fe6, 0x5fe7) AM_DEVREADWRITE("k053260", k053260_device, main_read, main_write)
AM_RANGE(0x5fe8, 0x5fe9) AM_DEVREAD("k053246", k053247_device, k053246_r)
AM_RANGE(0x5fea, 0x5fea) AM_READ(watchdog_reset_r)
/* what is the desired effect of overlapping these memory regions anyway? */
@@ -254,8 +249,8 @@ static ADDRESS_MAP_START( esckids_map, AS_PROGRAM, 8, vendetta_state )
AM_RANGE(0x3fc0, 0x3fcf) AM_DEVREADWRITE("k053252", k053252_device, read, write) // Not Emulated (053252 ???)
AM_RANGE(0x3fd0, 0x3fd0) AM_WRITE(vendetta_5fe0_w) // Coin Counter, 052109 RMRD, 053246 OBJCHA
AM_RANGE(0x3fd2, 0x3fd2) AM_WRITE(vendetta_eeprom_w) // EEPROM, Video banking
- AM_RANGE(0x3fd4, 0x3fd4) AM_READWRITE(vendetta_sound_interrupt_r, z80_irq_w) // Sound
- AM_RANGE(0x3fd6, 0x3fd7) AM_READ(vendetta_sound_r) AM_DEVWRITE("k053260", k053260_device, k053260_w) // Sound
+ AM_RANGE(0x3fd4, 0x3fd4) AM_READWRITE(z80_irq_r, z80_irq_w) // Sound
+ AM_RANGE(0x3fd6, 0x3fd7) AM_DEVREADWRITE("k053260", k053260_device, main_read, main_write) // Sound
AM_RANGE(0x3fd8, 0x3fd9) AM_DEVREAD("k053246", k053247_device, k053246_r) // 053246 (Sprite)
AM_RANGE(0x3fda, 0x3fda) AM_WRITENOP // Not Emulated (Watchdog ???)
/* what is the desired effect of overlapping these memory regions anyway? */
@@ -272,7 +267,7 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, vendetta_state )
AM_RANGE(0xf000, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0xfa00, 0xfa00) AM_WRITE(z80_arm_nmi_w)
- AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, k053260_r, k053260_w)
+ AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_device, read, write)
ADDRESS_MAP_END
diff --git a/src/mame/includes/asterix.h b/src/mame/includes/asterix.h
index 6efc33d2d07..2ac7913ec1f 100644
--- a/src/mame/includes/asterix.h
+++ b/src/mame/includes/asterix.h
@@ -3,7 +3,6 @@
Asterix
*************************************************************************/
-#include "sound/k053260.h"
#include "video/k053251.h"
#include "video/k054156_k054157_k056832.h"
#include "video/k053244_k053245.h"
@@ -21,7 +20,6 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
- m_k053260(*this, "k053260"),
m_k056832(*this, "k056832"),
m_k053244(*this, "k053244"),
m_k053251(*this, "k053251") { }
@@ -44,7 +42,6 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
- required_device<k053260_device> m_k053260;
required_device<k056832_device> m_k056832;
required_device<k05324x_device> m_k053244;
required_device<k053251_device> m_k053251;
@@ -54,7 +51,6 @@ public:
DECLARE_WRITE16_MEMBER(sound_irq_w);
DECLARE_WRITE16_MEMBER(protection_w);
DECLARE_WRITE16_MEMBER(asterix_spritebank_w);
- DECLARE_READ8_MEMBER(asterix_sound_r);
DECLARE_DRIVER_INIT(asterix);
virtual void machine_start();
virtual void machine_reset();
diff --git a/src/mame/includes/overdriv.h b/src/mame/includes/overdriv.h
index df1461be3b6..87ee0c2c6d6 100644
--- a/src/mame/includes/overdriv.h
+++ b/src/mame/includes/overdriv.h
@@ -3,7 +3,6 @@
Over Drive
*************************************************************************/
-#include "sound/k053260.h"
#include "machine/k053252.h"
#include "video/k051316.h"
#include "video/k053246_k053247_k055673.h"
@@ -18,8 +17,6 @@ public:
m_maincpu(*this, "maincpu"),
m_subcpu(*this, "sub"),
m_audiocpu(*this, "audiocpu"),
- m_k053260_1(*this, "k053260_1"),
- m_k053260_2(*this, "k053260_2"),
m_k051316_1(*this, "k051316_1"),
m_k051316_2(*this, "k051316_2"),
m_k053246(*this, "k053246"),
@@ -44,8 +41,6 @@ public:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_audiocpu;
- required_device<k053260_device> m_k053260_1;
- required_device<k053260_device> m_k053260_2;
required_device<k051316_device> m_k051316_1;
required_device<k051316_device> m_k051316_2;
required_device<k053247_device> m_k053246;
diff --git a/src/mame/includes/parodius.h b/src/mame/includes/parodius.h
index 46d8d7c6c3e..2ce1376f7d4 100644
--- a/src/mame/includes/parodius.h
+++ b/src/mame/includes/parodius.h
@@ -5,7 +5,6 @@
*************************************************************************/
#include "machine/bankdev.h"
-#include "sound/k053260.h"
#include "video/k053244_k053245.h"
#include "video/k052109.h"
#include "video/k053251.h"
@@ -25,7 +24,6 @@ public:
m_audiocpu(*this, "audiocpu"),
m_bank0000(*this, "bank0000"),
m_bank2000(*this, "bank2000"),
- m_k053260(*this, "k053260"),
m_k052109(*this, "k052109"),
m_k053245(*this, "k053245"),
m_k053251(*this, "k053251") { }
@@ -43,7 +41,6 @@ public:
required_device<cpu_device> m_audiocpu;
required_device<address_map_bank_device> m_bank0000;
required_device<address_map_bank_device> m_bank2000;
- required_device<k053260_device> m_k053260;
required_device<k052109_device> m_k052109;
required_device<k05324x_device> m_k053245;
required_device<k053251_device> m_k053251;
@@ -51,7 +48,6 @@ public:
DECLARE_WRITE8_MEMBER(parodius_3fc0_w);
DECLARE_WRITE8_MEMBER(parodius_sh_irqtrigger_w);
DECLARE_WRITE8_MEMBER(sound_arm_nmi_w);
- DECLARE_READ8_MEMBER(parodius_sound_r);
virtual void machine_start();
virtual void machine_reset();
UINT32 screen_update_parodius(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/rollerg.h b/src/mame/includes/rollerg.h
index 4111ef264b4..1393f50ba73 100644
--- a/src/mame/includes/rollerg.h
+++ b/src/mame/includes/rollerg.h
@@ -3,7 +3,6 @@
Rollergames
*************************************************************************/
-#include "sound/k053260.h"
#include "machine/k053252.h"
#include "video/k051316.h"
#include "video/konami_helper.h"
@@ -21,15 +20,11 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
- m_k053260(*this, "k053260"),
m_k053244(*this, "k053244"),
m_k051316(*this, "k051316"),
m_k053252(*this, "k053252")
{ }
- /* memory pointers */
-// UINT8 * m_paletteram; // currently this uses generic palette handling
-
/* video-related */
int m_sprite_colorbase;
int m_zoom_colorbase;
@@ -40,7 +35,6 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
- required_device<k053260_device> m_k053260;
required_device<k05324x_device> m_k053244;
required_device<k051316_device> m_k051316;
required_device<k053252_device> m_k053252;
@@ -49,7 +43,6 @@ public:
DECLARE_WRITE8_MEMBER(soundirq_w);
DECLARE_WRITE8_MEMBER(sound_arm_nmi_w);
DECLARE_READ8_MEMBER(pip_r);
- DECLARE_READ8_MEMBER(rollerg_sound_r);
DECLARE_WRITE_LINE_MEMBER(rollerg_irq_ack_w);
virtual void machine_start();
virtual void machine_reset();
diff --git a/src/mame/includes/simpsons.h b/src/mame/includes/simpsons.h
index 22740423399..aa9866d2060 100644
--- a/src/mame/includes/simpsons.h
+++ b/src/mame/includes/simpsons.h
@@ -1,5 +1,4 @@
#include "machine/bankdev.h"
-#include "sound/k053260.h"
#include "video/k053246_k053247_k055673.h"
#include "video/k052109.h"
#include "video/k053251.h"
@@ -20,7 +19,6 @@ public:
m_audiocpu(*this, "audiocpu"),
m_bank0000(*this, "bank0000"),
m_bank2000(*this, "bank2000"),
- m_k053260(*this, "k053260"),
m_k052109(*this, "k052109"),
m_k053246(*this, "k053246"),
m_k053251(*this, "k053251") { }
@@ -42,7 +40,6 @@ public:
required_device<cpu_device> m_audiocpu;
required_device<address_map_bank_device> m_bank0000;
required_device<address_map_bank_device> m_bank2000;
- required_device<k053260_device> m_k053260;
required_device<k052109_device> m_k052109;
required_device<k053247_device> m_k053246;
required_device<k053251_device> m_k053251;
@@ -61,7 +58,6 @@ public:
INTERRUPT_GEN_MEMBER(simpsons_irq);
TIMER_CALLBACK_MEMBER(nmi_callback);
TIMER_CALLBACK_MEMBER(dmaend_callback);
- DECLARE_READ8_MEMBER(simpsons_sound_r);
void simpsons_video_banking(int bank);
void sound_nmi_callback(int param);
void simpsons_objdma();
diff --git a/src/mame/includes/tmnt.h b/src/mame/includes/tmnt.h
index 7450efcb13b..c5032cd3a06 100644
--- a/src/mame/includes/tmnt.h
+++ b/src/mame/includes/tmnt.h
@@ -134,7 +134,6 @@ public:
DECLARE_READ16_MEMBER(prmrsocr_rom_r);
DECLARE_WRITE16_MEMBER(tmnt_priority_w);
DECLARE_READ16_MEMBER(glfgreat_ball_r);
- DECLARE_READ8_MEMBER(punkshot_sound_r);
DECLARE_WRITE8_MEMBER(glfgreat_sound_w);
DECLARE_WRITE8_MEMBER(tmnt_upd_start_w);
DECLARE_READ8_MEMBER(tmnt_upd_busy_r);
diff --git a/src/mame/includes/vendetta.h b/src/mame/includes/vendetta.h
index 777011e1eaf..ee0a15601d2 100644
--- a/src/mame/includes/vendetta.h
+++ b/src/mame/includes/vendetta.h
@@ -3,7 +3,6 @@
Vendetta
*************************************************************************/
-#include "sound/k053260.h"
#include "machine/k053252.h"
#include "video/k053246_k053247_k055673.h"
#include "video/k054000.h"
@@ -23,7 +22,6 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
- m_k053260(*this, "k053260"),
m_k052109(*this, "k052109"),
m_k053246(*this, "k053246"),
m_k053251(*this, "k053251"),
@@ -46,7 +44,6 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
- required_device<k053260_device> m_k053260;
required_device<k052109_device> m_k052109;
required_device<k053247_device> m_k053246;
required_device<k053251_device> m_k053251;
@@ -59,8 +56,7 @@ public:
DECLARE_WRITE8_MEMBER(vendetta_5fe0_w);
DECLARE_WRITE8_MEMBER(z80_arm_nmi_w);
DECLARE_WRITE8_MEMBER(z80_irq_w);
- DECLARE_READ8_MEMBER(vendetta_sound_interrupt_r);
- DECLARE_READ8_MEMBER(vendetta_sound_r);
+ DECLARE_READ8_MEMBER(z80_irq_r);
DECLARE_DRIVER_INIT(vendetta);
DECLARE_DRIVER_INIT(esckids);
virtual void machine_start();
diff --git a/src/mame/machine/simpsons.c b/src/mame/machine/simpsons.c
index 598485980c7..da998ffe30c 100644
--- a/src/mame/machine/simpsons.c
+++ b/src/mame/machine/simpsons.c
@@ -2,7 +2,6 @@
#include "cpu/m6809/konami.h"
#include "machine/eepromser.h"
-#include "sound/k053260.h"
#include "includes/simpsons.h"
/***************************************************************************
@@ -48,11 +47,6 @@ READ8_MEMBER(simpsons_state::simpsons_sound_interrupt_r)
return 0x00;
}
-READ8_MEMBER(simpsons_state::simpsons_sound_r)
-{
- return m_k053260->k053260_r(space, 2 + offset);
-}
-
/***************************************************************************