diff options
Diffstat (limited to 'trunk/src/mame/audio/suna8.c')
-rw-r--r-- | trunk/src/mame/audio/suna8.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/trunk/src/mame/audio/suna8.c b/trunk/src/mame/audio/suna8.c new file mode 100644 index 00000000000..a4ab8e220c9 --- /dev/null +++ b/trunk/src/mame/audio/suna8.c @@ -0,0 +1,60 @@ +/* + + SunA 8 Bit Games samples + + Format: PCM unsigned 8 bit mono 4Khz + +*/ + +#include "emu.h" +#include "sound/samples.h" +#include "includes/suna8.h" + + +WRITE8_DEVICE_HANDLER( suna8_play_samples_w ) +{ + suna8_state *state = device->machine().driver_data<suna8_state>(); + if( data ) + { + if( ~data & 0x10 ) + { + sample_start_raw(device, 0, &state->m_samplebuf[0x800*state->m_sample], 0x0800, 4000, 0); + } + else if( ~data & 0x08 ) + { + state->m_sample &= 3; + sample_start_raw(device, 0, &state->m_samplebuf[0x800*(state->m_sample+7)], 0x0800, 4000, 0); + } + } +} + +WRITE8_DEVICE_HANDLER( rranger_play_samples_w ) +{ + suna8_state *state = device->machine().driver_data<suna8_state>(); + if( data ) + { + if(( state->m_sample != 0 ) && ( ~data & 0x30 )) // don't play state->m_sample zero when the bit is active + { + sample_start_raw(device, 0, &state->m_samplebuf[0x800*state->m_sample], 0x0800, 4000, 0); + } + } +} + +WRITE8_DEVICE_HANDLER( suna8_samples_number_w ) +{ + suna8_state *state = device->machine().driver_data<suna8_state>(); + state->m_sample = data & 0xf; +} + +SAMPLES_START( suna8_sh_start ) +{ + suna8_state *state = device->machine().driver_data<suna8_state>(); + running_machine &machine = device->machine(); + int i, len = machine.region("samples")->bytes(); + UINT8 *ROM = machine.region("samples")->base(); + + state->m_samplebuf = auto_alloc_array(machine, INT16, len); + + for(i=0;i<len;i++) + state->m_samplebuf[i] = (INT8)(ROM[i] ^ 0x80) * 256; +} |