Previous 15994 Revisions Next

r7597 Thursday 18th March, 2010 at 10:52:44 UTC by Fabio Priuli
[SNES] fixed dsp init procedure (Chrono Trigger works again)
[src/mame/audio]snes_snd.c

src/mame/audio/snes_snd.c
r7596r7597
10781078
10791079   if (offset == 0x7c)
10801080   {
1081      /* Writes to register 0x7c (ENDX) works as follows */
1081      /* Writes to register 0x7c (ENDX) clear ALL bits no matter which value is written */
10821082      spc700->dsp_regs[offset] = 0;
10831083   }
10841084   else
r7596r7597
11771177         break;
11781178      case 0x2:      /* Register address */
11791179         break;
1180      case 0x3:      /* Register data */
1181         snes_dsp_io_w(device, spc700->ram[0xf2], data);
1180      case 0x3:      /* Register data - 0x80-0xff is a read-only mirror of 0x00-0x7f */
1181         if (!(spc700->ram[0xf2] & 0x80))
1182            snes_dsp_io_w(device, spc700->ram[0xf2] & 0x7f, data);
11821183         break;
11831184      case 0x4:      /* Port 0 */
11841185      case 0x5:      /* Port 1 */
r7596r7597
13091310   snes_sound_state *spc700 = get_safe_token(device);
13101311   running_machine *machine = device->machine;
13111312
1312   state_register(device);
1313
13141313   spc700->channel = stream_create(device, 0, 2, 32000, 0, snes_sh_update);
13151314
13161315   spc700->ram = auto_alloc_array_clear(device->machine, UINT8, SNES_SPCRAM_SIZE);
1317   state_save_register_device_item_pointer(device, 0, spc700->ram, SNES_SPCRAM_SIZE);
13181316
13191317   /* default to ROM visible */
13201318   spc700->ram[0xf1] = 0x80;
13211319
1320   /* put IPL image at the top of RAM */
1321   memcpy(spc700->ipl_region, memory_region(machine, "user5"), 64);
1322
13221323   /* Initialize the timers */
13231324   spc700->timer[0] = timer_alloc(machine, snes_spc_timer, spc700);
13241325   timer_adjust_periodic(spc700->timer[0], ATTOTIME_IN_HZ(8000),  0, ATTOTIME_IN_HZ(8000));
r7596r7597
13291330   spc700->timer[2] = timer_alloc(machine, snes_spc_timer, spc700);
13301331   timer_adjust_periodic(spc700->timer[2], ATTOTIME_IN_HZ(64000), 2, ATTOTIME_IN_HZ(64000));
13311332   timer_enable(spc700->timer[2], 0);
1333
1334   state_register(device);
1335   state_save_register_device_item_pointer(device, 0, spc700->ram, SNES_SPCRAM_SIZE);
13321336}
13331337
13341338static DEVICE_RESET( snes_sound )
13351339{
13361340   snes_sound_state *spc700 = get_safe_token(device);
1337   running_machine *machine = device->machine;
13381341   int ii;
13391342
1340   /* put IPL image at the top of RAM */
1341   memcpy(spc700->ipl_region, memory_region(machine, "user5"), 64);
1342
13431343   /* Sort out the ports */
13441344   for (ii = 0; ii < 4; ii++)
13451345   {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team