static void vck_callback(const device_config *device) { /* only play back if we have data remaining */ if (sample_count != 0xff) { UINT8 data = memory_region(device->machine, "adpcm")[sample_offset >> 1]; /* write the next nibble and advance */ msm5205_data_w(device, (data >> (4 * (~sample_offset & 1))) & 0x0f); sample_offset++; /* every 256 clocks, we decrement the length */ if (!(sample_offset & 0xff)) { sample_count--; /* if we hit 0xff, automatically turn off playback */ if (sample_count == 0xff) msm5205_reset_w(device, 1); } }
static void appoooh_adpcm_int(device_t *device) { appoooh_state *state = device->machine().driver_data<appoooh_state>(); if (state->m_adpcm_address != 0xffffffff) { if (state->m_adpcm_data == 0xffffffff) { UINT8 *RAM = state->memregion("adpcm")->base(); state->m_adpcm_data = RAM[state->m_adpcm_address++]; msm5205_data_w(device, state->m_adpcm_data >> 4); if (state->m_adpcm_data == 0x70) { state->m_adpcm_address = 0xffffffff; msm5205_reset_w(device, 1); } } else {
static WRITE8_DEVICE_HANDLER( opwolf_adpcm_c_w ) { opwolf_state *state = device->machine().driver_data<opwolf_state>(); int start; int end; state->m_adpcm_c[offset] = data; if (offset == 0x04) //trigger ? { start = state->m_adpcm_c[0] + state->m_adpcm_c[1] * 256; end = state->m_adpcm_c[2] + state->m_adpcm_c[3] * 256; start *= 16; end *= 16; state->m_adpcm_pos[1] = start; state->m_adpcm_end[1] = end; msm5205_reset_w(device, 0); } // logerror("CPU #1 c00%i-data=%2x pc=%4x\n",offset,data,cpu_get_pc(&space->device()) ); }
static void spd_adpcm_int(device_t *device) { spdodgeb_state *state = device->machine().driver_data<spdodgeb_state>(); int chip = (strcmp(device->tag(), ":msm1") == 0) ? 0 : 1; if (state->m_adpcm_pos[chip] >= state->m_adpcm_end[chip] || state->m_adpcm_pos[chip] >= 0x10000) { state->m_adpcm_idle[chip] = 1; msm5205_reset_w(device,1); } else if (state->m_adpcm_data[chip] != -1) { msm5205_data_w(device,state->m_adpcm_data[chip] & 0x0f); state->m_adpcm_data[chip] = -1; } else { UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base() + 0x10000 * chip; state->m_adpcm_data[chip] = ROM[state->m_adpcm_pos[chip]++]; msm5205_data_w(device,state->m_adpcm_data[chip] >> 4); } }
static void vck_callback( device_t *device ) { crgolf_state *state = device->machine().driver_data<crgolf_state>(); /* only play back if we have data remaining */ if (state->m_sample_count != 0xff) { UINT8 data = state->memregion("adpcm")->base()[state->m_sample_offset >> 1]; /* write the next nibble and advance */ msm5205_data_w(device, (data >> (4 * (~state->m_sample_offset & 1))) & 0x0f); state->m_sample_offset++; /* every 256 clocks, we decrement the length */ if (!(state->m_sample_offset & 0xff)) { state->m_sample_count--; /* if we hit 0xff, automatically turn off playback */ if (state->m_sample_count == 0xff) msm5205_reset_w(device, 1); } }
static void kfr_adpcm2_int(device_t *device) { kungfur_state *state = device->machine().driver_data<kungfur_state>(); if (state->m_adpcm_pos[1] >= 0x10000 || state->m_adpcm_idle[1]) { msm5205_reset_w(device->machine().device("adpcm2"),1); state->m_trigger2 = 0; } else { UINT8 *ROM = device->machine().region("adpcm2")->base(); state->m_adpcm_data2 = ((state->m_trigger2 ? (ROM[state->m_adpcm_pos[1]] & 0x0f) : (ROM[state->m_adpcm_pos[1]] & 0xf0)>>4) ); msm5205_data_w(device->machine().device("adpcm2"), state->m_adpcm_data2 & 0xf); state->m_trigger2 ^= 1; if(state->m_trigger2 == 0) { state->m_adpcm_pos[1]++; if((ROM[state->m_adpcm_pos[1]] & 0xff) == 0xff) state->m_adpcm_idle[1] = 1; } } }
static WRITE8_DEVICE_HANDLER( adpcm_reset_inv_w ) { msm5205_reset_w(device, ~data & 1); }
static WRITE8_DEVICE_HANDLER( mastboy_msm5205_reset_w ) { mastboy_m5205_part = 0; msm5205_reset_w(device,data&1); }
static WRITE8_HANDLER( firetrap_sound_2400_w ) { firetrap_state *state = space->machine().driver_data<firetrap_state>(); msm5205_reset_w(state->m_msm, ~data & 0x01); state->m_sound_irq_enable = data & 0x02; }
static WRITE8_DEVICE_HANDLER( mastboy_msm5205_reset_w ) { mastboy_state *state = device->machine().driver_data<mastboy_state>(); state->m_m5205_part = 0; msm5205_reset_w(device,data&1); }
static WRITE8_DEVICE_HANDLER( rastan_msm5205_stop_w ) { msm5205_reset_w(device, 1); adpcm_pos &= 0xff00; }
static MACHINE_RESET( hnayayoi ) { /* start with the MSM5205 reset */ msm5205_reset_w(devtag_get_device(machine, "msm"),1); }
static WRITE8_DEVICE_HANDLER( rastan_msm5205_start_w ) { msm5205_reset_w(device, 0); }
static WRITE8_HANDLER( firetrap_sound_2400_w ) { firetrap_state *state = (firetrap_state *)space->machine->driver_data; msm5205_reset_w(state->msm, ~data & 0x01); state->irq_enable = data & 0x02; }
static WRITE8_DEVICE_HANDLER( rastan_msm5205_stop_w ) { rastan_state *state = device->machine().driver_data<rastan_state>(); msm5205_reset_w(device, 1); state->m_adpcm_pos &= 0xff00; }
static WRITE8_DEVICE_HANDLER( topspeed_msm5205_address_w ) { topspeed_state *state = device->machine->driver_data<topspeed_state>(); state->adpcm_pos = (state->adpcm_pos & 0x00ff) | (data << 8); msm5205_reset_w(device, 0); }
static WRITE8_DEVICE_HANDLER( topspeed_msm5205_stop_w ) { topspeed_state *state = device->machine->driver_data<topspeed_state>(); msm5205_reset_w(device, 1); state->adpcm_pos &= 0xff00; }
static WRITE8_DEVICE_HANDLER( battlera_adpcm_reset_w ) { msm5205_reset_w(device, 0); }