src/mame/audio/snes_snd.c
| r7596 | r7597 | |
| 1078 | 1078 | |
| 1079 | 1079 | if (offset == 0x7c) |
| 1080 | 1080 | { |
| 1081 | | /* Writes to register 0x7c (ENDX) works as follows */ |
| 1081 | /* Writes to register 0x7c (ENDX) clear ALL bits no matter which value is written */ |
| 1082 | 1082 | spc700->dsp_regs[offset] = 0; |
| 1083 | 1083 | } |
| 1084 | 1084 | else |
| r7596 | r7597 | |
| 1177 | 1177 | break; |
| 1178 | 1178 | case 0x2: /* Register address */ |
| 1179 | 1179 | 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); |
| 1182 | 1183 | break; |
| 1183 | 1184 | case 0x4: /* Port 0 */ |
| 1184 | 1185 | case 0x5: /* Port 1 */ |
| r7596 | r7597 | |
| 1309 | 1310 | snes_sound_state *spc700 = get_safe_token(device); |
| 1310 | 1311 | running_machine *machine = device->machine; |
| 1311 | 1312 | |
| 1312 | | state_register(device); |
| 1313 | | |
| 1314 | 1313 | spc700->channel = stream_create(device, 0, 2, 32000, 0, snes_sh_update); |
| 1315 | 1314 | |
| 1316 | 1315 | 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); |
| 1318 | 1316 | |
| 1319 | 1317 | /* default to ROM visible */ |
| 1320 | 1318 | spc700->ram[0xf1] = 0x80; |
| 1321 | 1319 | |
| 1320 | /* put IPL image at the top of RAM */ |
| 1321 | memcpy(spc700->ipl_region, memory_region(machine, "user5"), 64); |
| 1322 | |
| 1322 | 1323 | /* Initialize the timers */ |
| 1323 | 1324 | spc700->timer[0] = timer_alloc(machine, snes_spc_timer, spc700); |
| 1324 | 1325 | timer_adjust_periodic(spc700->timer[0], ATTOTIME_IN_HZ(8000), 0, ATTOTIME_IN_HZ(8000)); |
| r7596 | r7597 | |
| 1329 | 1330 | spc700->timer[2] = timer_alloc(machine, snes_spc_timer, spc700); |
| 1330 | 1331 | timer_adjust_periodic(spc700->timer[2], ATTOTIME_IN_HZ(64000), 2, ATTOTIME_IN_HZ(64000)); |
| 1331 | 1332 | 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); |
| 1332 | 1336 | } |
| 1333 | 1337 | |
| 1334 | 1338 | static DEVICE_RESET( snes_sound ) |
| 1335 | 1339 | { |
| 1336 | 1340 | snes_sound_state *spc700 = get_safe_token(device); |
| 1337 | | running_machine *machine = device->machine; |
| 1338 | 1341 | int ii; |
| 1339 | 1342 | |
| 1340 | | /* put IPL image at the top of RAM */ |
| 1341 | | memcpy(spc700->ipl_region, memory_region(machine, "user5"), 64); |
| 1342 | | |
| 1343 | 1343 | /* Sort out the ports */ |
| 1344 | 1344 | for (ii = 0; ii < 4; ii++) |
| 1345 | 1345 | { |