static WRITE_HANDLER( dd_adpcm_w ) { int chip = offset & 1; switch (offset/2) { case 3: adpcm_idle[chip] = 1; MSM5205_reset_w(chip,1); break; case 2: adpcm_pos[chip] = (data & 0x7f) * 0x200; break; case 1: adpcm_end[chip] = (data & 0x7f) * 0x200; break; case 0: adpcm_idle[chip] = 0; MSM5205_reset_w(chip,0); break; } }
static WRITE8_HANDLER( idsoccer_adpcm_w ) { if (data & 0x80) { adpcm_idle = 1; MSM5205_reset_w(0, 1); } else { adpcm_pos = (data & 0x7f) * 0x200; adpcm_idle = 0; MSM5205_reset_w(0, 0); } }
static void tecmo_adpcm_int() { #if 0 static int adpcm_data = -1; if (adpcm_pos >= adpcm_end || adpcm_pos >= get_region_size(REGION_SOUND1)) MSM5205_reset_w(0,1); else if (adpcm_data != -1) { MSM5205_data_w(0,adpcm_data & 0x0f); adpcm_data = -1; } else { unsigned char *ROM = load_region[REGION_SOUND1]; adpcm_data = ROM[adpcm_pos++]; MSM5205_data_w(0,adpcm_data >> 4); } #else if (adpcm_end > adpcm_pos) { live_msm_decode(adpcm_pos,adpcm_end-adpcm_pos-1); adpcm_pos++; } #endif }
static WRITE8_HANDLER( rjammer_voice_startstop_w ) { /* bit 0 of data selects voice start/stop (reset pin on MSM5205)*/ // 0 -stop; 1-start MSM5205_reset_w (0, (data&1)^1 ); return; }
static WRITE8_HANDLER( adpcm_control_w ) { int bankaddress; UINT8 *RAM = memory_region(REGION_CPU2); /* the code writes either 2 or 3 in the bottom two bits */ bankaddress = 0x10000 + (data & 0x01) * 0x4000; memory_set_bankptr(3,&RAM[bankaddress]); MSM5205_reset_w(0,data & 0x08); }
void toki_adpcm_control_w(int offset,int data) { int bankaddress; unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[1].memory_region]; /* the code writes either 2 or 3 in the bottom two bits */ bankaddress = 0x10000 + (data & 0x01) * 0x4000; cpu_setbank(1,&RAM[bankaddress]); MSM5205_reset_w(0,data & 0x08); }
static WRITE_HANDLER( toki_adpcm_control_w ) { int bankaddress; unsigned char *RAM = memory_region(REGION_CPU2); /* the code writes either 2 or 3 in the bottom two bits */ bankaddress = 0x10000 + (data & 0x01) * 0x4000; cpu_setbank(1,&RAM[bankaddress]); MSM5205_reset_w(0,data & 0x08); }
static void appoooh_adpcm_int (int num) { if( adpcmptr ) { if( appoooh_adpcm_data==-1) { appoooh_adpcm_data = *adpcmptr++; MSM5205_data_w(0,appoooh_adpcm_data >> 4); if(appoooh_adpcm_data==0x70) { adpcmptr = 0; MSM5205_reset_w(0,1); } }else{
ADDRESS_MAP_END /* Sound CPU */ static WRITE8_HANDLER( adpcm_control_w ) { int bankaddress; unsigned char *RAM = memory_region(REGION_CPU2); /* the code writes either 2 or 3 in the bottom two bits */ bankaddress = 0x10000 + (data & 0x01) * 0x4000; memory_set_bankptr(1,&RAM[bankaddress]); MSM5205_reset_w(0,data & 0x08); }
void stfight_adpcm_int( int data ) { static int toggle; UINT8 *SAMPLES = memory_region(REGION_SOUND1); int adpcm_data = SAMPLES[adpcm_data_offs & 0x7fff]; // finished playing sample? if( adpcm_data_offs == adpcm_data_end ) { MSM5205_reset_w( 0, 1 ); return; } if( toggle == 0 ) MSM5205_data_w( 0, ( adpcm_data >> 4 ) & 0x0f ); else {
static void opwolf_msm5205_vck(int chip) { static int adpcm_data[2] = { -1, -1 }; if (adpcm_data[chip] != -1) { MSM5205_data_w(chip, adpcm_data[chip] & 0x0f); adpcm_data[chip] = -1; if (adpcm_pos[chip] == adpcm_end[chip]) MSM5205_reset_w(chip, 1); } else { adpcm_data[chip] = memory_region(REGION_SOUND1)[adpcm_pos[chip]]; adpcm_pos[chip] = (adpcm_pos[chip] + 1) & 0x7ffff; MSM5205_data_w(chip, adpcm_data[chip] >> 4); } }
static void tecmo_adpcm_int(int num) { static int adpcm_data = -1; if (adpcm_pos >= adpcm_end || adpcm_pos >= memory_region_length(REGION_SOUND1)) MSM5205_reset_w(0,1); else if (adpcm_data != -1) { MSM5205_data_w(0,adpcm_data & 0x0f); adpcm_data = -1; } else { unsigned char *ROM = memory_region(REGION_SOUND1); adpcm_data = ROM[adpcm_pos++]; MSM5205_data_w(0,adpcm_data >> 4); } }
static void tbowl_adpcm_int(int num) { static int adpcm_data[2] = { -1, -1 }; if (adpcm_pos[num] >= adpcm_end[num] || adpcm_pos[num] >= memory_region_length(REGION_SOUND1)/2) MSM5205_reset_w(num,1); else if (adpcm_data[num] != -1) { MSM5205_data_w(num,adpcm_data[num] & 0x0f); adpcm_data[num] = -1; } else { unsigned char *ROM = memory_region(REGION_SOUND1) + 0x10000 * num; adpcm_data[num] = ROM[adpcm_pos[num]++]; MSM5205_data_w(num,adpcm_data[num] >> 4); } }
static WRITE8_HANDLER( opwolf_adpcm_c_w ) { int start; int end; adpcm_c[offset] = data; if (offset==0x04) //trigger ? { start = adpcm_c[0] + adpcm_c[1]*256; end = adpcm_c[2] + adpcm_c[3]*256; start *=16; end *=16; adpcm_pos[1] = start; adpcm_end[1] = end; MSM5205_reset_w(1, 0); } // logerror("CPU #1 c00%i-data=%2x pc=%4x\n",offset,data,activecpu_get_pc() ); }
static void idsoccer_adpcm_int(int chip) { static int adpcm_data = -1; if (adpcm_pos >= memory_region_length(REGION_SOUND1)) { adpcm_idle = 1; MSM5205_reset_w(0, 1); } else if (adpcm_data != -1) { MSM5205_data_w(0, adpcm_data & 0x0f); adpcm_data = -1; } else { adpcm_data = memory_region(REGION_SOUND1)[adpcm_pos++]; MSM5205_data_w(0, adpcm_data >> 4); } }
static void vck_callback(int data) { /* only play back if we have data remaining */ if (sample_count != 0xff) { UINT8 data = memory_region(REGION_SOUND1)[sample_offset >> 1]; /* write the next nibble and advance */ MSM5205_data_w(0, (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(0, 1); } }
static void dd_adpcm_int(int chip) { static int adpcm_data[2] = { -1, -1 }; if (adpcm_pos[chip] >= adpcm_end[chip] || adpcm_pos[chip] >= 0x10000) { adpcm_idle[chip] = 1; MSM5205_reset_w(chip,1); } else if (adpcm_data[chip] != -1) { MSM5205_data_w(chip,adpcm_data[chip] & 0x0f); adpcm_data[chip] = -1; } else { unsigned char *ROM = memory_region(REGION_SOUND1) + 0x10000 * chip; adpcm_data[chip] = ROM[adpcm_pos[chip]++]; MSM5205_data_w(chip,adpcm_data[chip] >> 4); } }
static WRITE8_HANDLER( ml_msm5205_start_w ) { MSM5205_reset_w(0, 0); }
static WRITE8_HANDLER( topspeed_msm5205_stop_w ) { MSM5205_reset_w(0, 1); adpcm_pos &= 0xff00; }
static WRITE8_HANDLER( topspeed_msm5205_address_w ) { adpcm_pos = (adpcm_pos & 0x00ff) | (data << 8); MSM5205_reset_w(0, 0); }
static MACHINE_RESET( opwolf ) { MSM5205_reset_w(0, 1); MSM5205_reset_w(1, 1); }
static WRITE8_HANDLER( tbowl_adpcm_start_w ) { adpcm_pos[offset & 1] = data << 8; MSM5205_reset_w(offset & 1,0); }
static WRITE8_HANDLER(writeA) { if (data == 0xff) return; // this gets called at 8910 startup with 0xff before the 5205 exists, causing a crash MSM5205_reset_w(0, !(data & 0x01)); }
static WRITE_HANDLER( battlera_adpcm_reset_w ) { MSM5205_reset_w(0,0); }
static WRITE8_HANDLER( adpcm_reset_inv_w ) { MSM5205_reset_w(0,~data & 1); }
static void firetrap_sound_2400_w(int offset,int data) { MSM5205_reset_w(offset,~data & 0x01); firetrap_irq_enable = data & 0x02; }
static MACHINE_RESET( hnayayoi ) { /* start with the MSM5205 reset */ MSM5205_reset_w(0,1); }
static WRITE8_HANDLER( tecmo_adpcm_start_w ) { adpcm_pos = data << 8; MSM5205_reset_w(0,0); }
static WRITE_HANDLER( adpcm_reset_w ) { MSM5205_reset_w(0,data & 1); }