src/mess/machine/msx_slot.c
| r4283 | r4284 | |
| 341 | 341 | return 0xff; |
| 342 | 342 | } |
| 343 | 343 | else { |
| 344 | | return k051649_waveform_r (devtag_get_device(space->machine, SOUND_K051649, "k051649"), offset & 0x7f); |
| 344 | return k051649_waveform_r (devtag_get_device(space->machine, SOUND, "k051649"), offset & 0x7f); |
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
| r4283 | r4284 | |
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | else if (state->cart.scc.active && addr >= 0x9800 && addr < 0xa000) { |
| 397 | | const device_config *k051649 = devtag_get_device(space->machine, SOUND_K051649, "k051649"); |
| 397 | const device_config *k051649 = devtag_get_device(space->machine, SOUND, "k051649"); |
| 398 | 398 | int offset = addr & 0xff; |
| 399 | 399 | |
| 400 | 400 | if (offset < 0x80) { |
| r4283 | r4284 | |
| 1999 | 1999 | reg = offset & 0xff; |
| 2000 | 2000 | |
| 2001 | 2001 | if (reg < 0x80) { |
| 2002 | | return k051649_waveform_r (devtag_get_device(space->machine, SOUND_K051649, "k051649"), reg); |
| 2002 | return k051649_waveform_r (devtag_get_device(space->machine, SOUND, "k051649"), reg); |
| 2003 | 2003 | } |
| 2004 | 2004 | else if (reg < 0xa0) { |
| 2005 | 2005 | /* nothing */ |
| 2006 | 2006 | } |
| 2007 | 2007 | else if (reg < 0xc0) { |
| 2008 | 2008 | /* read wave 5 */ |
| 2009 | | return k051649_waveform_r (devtag_get_device(space->machine, SOUND_K051649, "k051649"), 0x80 + (reg & 0x1f)); |
| 2009 | return k051649_waveform_r (devtag_get_device(space->machine, SOUND, "k051649"), 0x80 + (reg & 0x1f)); |
| 2010 | 2010 | } |
| 2011 | 2011 | #if 0 |
| 2012 | 2012 | else if (reg < 0xe0) { |
| r4283 | r4284 | |
| 2029 | 2029 | reg = offset & 0xff; |
| 2030 | 2030 | |
| 2031 | 2031 | if (reg < 0xa0) { |
| 2032 | | return k051649_waveform_r (devtag_get_device(space->machine, SOUND_K051649, "k051649"), reg); |
| 2032 | return k051649_waveform_r (devtag_get_device(space->machine, SOUND, "k051649"), reg); |
| 2033 | 2033 | } |
| 2034 | 2034 | #if 0 |
| 2035 | 2035 | else if (reg >= 0xc0 && reg < 0xe0) { |
| r4283 | r4284 | |
| 2117 | 2117 | } |
| 2118 | 2118 | } |
| 2119 | 2119 | else if (addr >= 0x9800 && state->cart.sccp.scc_active) { |
| 2120 | | const device_config *k051649 = devtag_get_device(space->machine, SOUND_K051649, "k051649"); |
| 2120 | const device_config *k051649 = devtag_get_device(space->machine, SOUND, "k051649"); |
| 2121 | 2121 | int offset = addr & 0xff; |
| 2122 | 2122 | |
| 2123 | 2123 | if (offset < 0x80) { |
| r4283 | r4284 | |
| 2158 | 2158 | } |
| 2159 | 2159 | } |
| 2160 | 2160 | else if (addr >= 0xb800 && state->cart.sccp.sccp_active) { |
| 2161 | | const device_config *k051649 = devtag_get_device(space->machine, SOUND_K051649, "k051649"); |
| 2161 | const device_config *k051649 = devtag_get_device(space->machine, SOUND, "k051649"); |
| 2162 | 2162 | int offset = addr & 0xff; |
| 2163 | 2163 | |
| 2164 | 2164 | if (offset < 0xa0) { |
src/mess/machine/gb.c
| r4283 | r4284 | |
| 273 | 273 | break; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | | gb_sound_w(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), 0x16, 0x00 ); /* Initialize sound hardware */ |
| 276 | gb_sound_w(devtag_get_device(space->machine, SOUND, "custom"), 0x16, 0x00 ); /* Initialize sound hardware */ |
| 277 | 277 | |
| 278 | 278 | /* Allocate the serial timer, and disable it */ |
| 279 | 279 | gb_serial_timer = timer_alloc(machine, gb_serial_timer_proc , NULL); |
| r4283 | r4284 | |
| 317 | 317 | memset( sgb_tile_data, 0, 0x2000 ); |
| 318 | 318 | |
| 319 | 319 | /* Initialize the Sound Registers */ |
| 320 | | gb_sound_w(devtag_get_device(machine, SOUND_GAMEBOY, "custom"), 0x16,0xF0); /* F0 for SGB */ |
| 321 | | gb_sound_w(devtag_get_device(machine, SOUND_GAMEBOY, "custom"), 0x15,0xF3); |
| 322 | | gb_sound_w(devtag_get_device(machine, SOUND_GAMEBOY, "custom"), 0x14,0x77); |
| 320 | gb_sound_w(devtag_get_device(machine, SOUND, "custom"), 0x16,0xF0); /* F0 for SGB */ |
| 321 | gb_sound_w(devtag_get_device(machine, SOUND, "custom"), 0x15,0xF3); |
| 322 | gb_sound_w(devtag_get_device(machine, SOUND, "custom"), 0x14,0x77); |
| 323 | 323 | |
| 324 | 324 | sgb_window_mask = 0; |
| 325 | 325 | memset( sgb_pal_map, 0, sizeof(sgb_pal_map) ); |
| r4283 | r4284 | |
| 349 | 349 | gb_init_regs(machine); |
| 350 | 350 | |
| 351 | 351 | /* Initialize the Sound registers */ |
| 352 | | gb_sound_w(devtag_get_device(machine, SOUND_GAMEBOY, "custom"), 0x16,0x80); |
| 353 | | gb_sound_w(devtag_get_device(machine, SOUND_GAMEBOY, "custom"), 0x15,0xF3); |
| 354 | | gb_sound_w(devtag_get_device(machine, SOUND_GAMEBOY, "custom"), 0x14,0x77); |
| 352 | gb_sound_w(devtag_get_device(machine, SOUND, "custom"), 0x16,0x80); |
| 353 | gb_sound_w(devtag_get_device(machine, SOUND, "custom"), 0x15,0xF3); |
| 354 | gb_sound_w(devtag_get_device(machine, SOUND, "custom"), 0x14,0x77); |
| 355 | 355 | |
| 356 | 356 | /* Enable BIOS rom if we have one */ |
| 357 | 357 | memory_set_bankptr(machine, 5, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank ); |
| r4283 | r4284 | |
| 371 | 371 | gb_init_regs(machine); |
| 372 | 372 | |
| 373 | 373 | /* Initialize the Sound registers */ |
| 374 | | gb_sound_w(devtag_get_device(machine, SOUND_GAMEBOY, "custom"), 0x16, 0x80); |
| 375 | | gb_sound_w(devtag_get_device(machine, SOUND_GAMEBOY, "custom"), 0x15, 0xF3); |
| 376 | | gb_sound_w(devtag_get_device(machine, SOUND_GAMEBOY, "custom"), 0x14, 0x77); |
| 374 | gb_sound_w(devtag_get_device(machine, SOUND, "custom"), 0x16, 0x80); |
| 375 | gb_sound_w(devtag_get_device(machine, SOUND, "custom"), 0x15, 0xF3); |
| 376 | gb_sound_w(devtag_get_device(machine, SOUND, "custom"), 0x14, 0x77); |
| 377 | 377 | |
| 378 | 378 | memory_set_bankptr(machine, 5, ROMMap[ROMBank00] ? ROMMap[ROMBank00] : gb_dummy_rom_bank ); |
| 379 | 379 | memory_set_bankptr(machine, 10, ROMMap[ROMBank00] ? ROMMap[ROMBank00] + 0x0100 : gb_dummy_rom_bank + 0x0100); |
| r4283 | r4284 | |
| 1988 | 1988 | |
| 1989 | 1989 | WRITE8_HANDLER( megaduck_sound_w1 ) |
| 1990 | 1990 | { |
| 1991 | | gb_sound_w(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), megaduck_sound_offsets[offset], data ); |
| 1991 | gb_sound_w(devtag_get_device(space->machine, SOUND, "custom"), megaduck_sound_offsets[offset], data ); |
| 1992 | 1992 | } |
| 1993 | 1993 | |
| 1994 | 1994 | READ8_HANDLER( megaduck_sound_r1 ) |
| 1995 | 1995 | { |
| 1996 | | return gb_sound_r( devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), megaduck_sound_offsets[offset] ); |
| 1996 | return gb_sound_r( devtag_get_device(space->machine, SOUND, "custom"), megaduck_sound_offsets[offset] ); |
| 1997 | 1997 | } |
| 1998 | 1998 | |
| 1999 | 1999 | WRITE8_HANDLER( megaduck_sound_w2 ) |
| 2000 | 2000 | { |
| 2001 | 2001 | switch(offset) { |
| 2002 | | case 0x00: gb_sound_w(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), 0x10, data ); break; |
| 2003 | | case 0x01: gb_sound_w(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), 0x12, data ); break; |
| 2004 | | case 0x02: gb_sound_w(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), 0x11, data ); break; |
| 2005 | | case 0x03: gb_sound_w(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), 0x13, data ); break; |
| 2006 | | case 0x04: gb_sound_w(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), 0x14, data ); break; |
| 2007 | | case 0x05: gb_sound_w(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), 0x16, data ); break; |
| 2008 | | case 0x06: gb_sound_w(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), 0x15, data ); break; |
| 2002 | case 0x00: gb_sound_w(devtag_get_device(space->machine, SOUND, "custom"), 0x10, data ); break; |
| 2003 | case 0x01: gb_sound_w(devtag_get_device(space->machine, SOUND, "custom"), 0x12, data ); break; |
| 2004 | case 0x02: gb_sound_w(devtag_get_device(space->machine, SOUND, "custom"), 0x11, data ); break; |
| 2005 | case 0x03: gb_sound_w(devtag_get_device(space->machine, SOUND, "custom"), 0x13, data ); break; |
| 2006 | case 0x04: gb_sound_w(devtag_get_device(space->machine, SOUND, "custom"), 0x14, data ); break; |
| 2007 | case 0x05: gb_sound_w(devtag_get_device(space->machine, SOUND, "custom"), 0x16, data ); break; |
| 2008 | case 0x06: gb_sound_w(devtag_get_device(space->machine, SOUND, "custom"), 0x15, data ); break; |
| 2009 | 2009 | case 0x07: |
| 2010 | 2010 | case 0x08: |
| 2011 | 2011 | case 0x09: |
| r4283 | r4284 | |
| 2021 | 2021 | |
| 2022 | 2022 | READ8_HANDLER( megaduck_sound_r2 ) |
| 2023 | 2023 | { |
| 2024 | | return gb_sound_r(devtag_get_device(space->machine, SOUND_GAMEBOY, "custom"), 0x10 + megaduck_sound_offsets[offset]); |
| 2024 | return gb_sound_r(devtag_get_device(space->machine, SOUND, "custom"), 0x10 + megaduck_sound_offsets[offset]); |
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | 2027 | WRITE8_HANDLER( megaduck_rom_bank_select_type1 ) |
src/mess/machine/geneve.c
| r4283 | r4284 | |
| 319 | 319 | { |
| 320 | 320 | cpu_adjust_icount(space->machine->cpu[0],-8); /* this is just a minimum, it can be more */ |
| 321 | 321 | |
| 322 | | return tms5220_status_r(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"), offset); |
| 322 | return tms5220_status_r(devtag_get_device(space->machine, SOUND, "tms5220"), offset); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | #if 0 |
| 326 | 326 | |
| 327 | 327 | static void speech_kludge_callback(int dummy) |
| 328 | 328 | { |
| 329 | | if (! tms5220_ready_r(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"))) |
| 329 | if (! tms5220_ready_r(devtag_get_device(space->machine, SOUND, "tms5220"))) |
| 330 | 330 | { |
| 331 | 331 | /* Weirdly enough, we are always seeing some problems even though |
| 332 | 332 | everything is working fine. */ |
| r4283 | r4284 | |
| 350 | 350 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the |
| 351 | 351 | case, we would need to store the value on the bus, which would be more |
| 352 | 352 | complex. */ |
| 353 | | if (! tms5220_ready_r(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"))) |
| 353 | if (! tms5220_ready_r(devtag_get_device(space->machine, SOUND, "tms5220"))) |
| 354 | 354 | { |
| 355 | | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"))); |
| 355 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, SOUND, "tms5220"))); |
| 356 | 356 | int cycles_to_ready = ceil(cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready)); |
| 357 | 357 | |
| 358 | 358 | logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready); |
| r4283 | r4284 | |
| 362 | 362 | } |
| 363 | 363 | #endif |
| 364 | 364 | |
| 365 | | tms5220_data_w(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"), offset, data); |
| 365 | tms5220_data_w(devtag_get_device(space->machine, SOUND, "tms5220"), offset, data); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | READ8_HANDLER ( geneve_r ) |
| r4283 | r4284 | |
| 663 | 663 | return*/ |
| 664 | 664 | |
| 665 | 665 | case 0xf120: |
| 666 | | sn76496_w(devtag_get_device(space->machine, SOUND_SN76489, "sn76496"), 0, data); |
| 666 | sn76496_w(devtag_get_device(space->machine, SOUND, "sn76496"), 0, data); |
| 667 | 667 | break; |
| 668 | 668 | |
| 669 | 669 | case 0xf130: |
| r4283 | r4284 | |
| 747 | 747 | { |
| 748 | 748 | case 1: |
| 749 | 749 | /* sound write */ |
| 750 | | sn76496_w(devtag_get_device(space->machine, SOUND_SN76489, "sn76496"), 0, data); |
| 750 | sn76496_w(devtag_get_device(space->machine, SOUND, "sn76496"), 0, data); |
| 751 | 751 | return; |
| 752 | 752 | |
| 753 | 753 | case 3: |
src/mess/machine/ti99_4x.c
| r4283 | r4284 | |
| 1082 | 1082 | { |
| 1083 | 1083 | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 1084 | 1084 | |
| 1085 | | sn76496_w(devtag_get_device(space->machine, SOUND_SN76489, "sn76496"), offset, (data >> 8) & 0xff); |
| 1085 | sn76496_w(devtag_get_device(space->machine, SOUND, "sn76496"), offset, (data >> 8) & 0xff); |
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | /* |
| r4283 | r4284 | |
| 1171 | 1171 | { |
| 1172 | 1172 | cpu_adjust_icount(space->machine->cpu[0],-(18+3)); /* this is just a minimum, it can be more */ |
| 1173 | 1173 | |
| 1174 | | return ((int) tms5220_status_r(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"), offset)) << 8; |
| 1174 | return ((int) tms5220_status_r(devtag_get_device(space->machine, SOUND, "tms5220"), offset)) << 8; |
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | 1177 | #if 0 |
| r4283 | r4284 | |
| 1202 | 1202 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the |
| 1203 | 1203 | case, we would need to store the value on the bus, which would be more |
| 1204 | 1204 | complex. */ |
| 1205 | | if (! tms5220_ready_r(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"))) |
| 1205 | if (! tms5220_ready_r(devtag_get_device(space->machine, SOUND, "tms5220"))) |
| 1206 | 1206 | { |
| 1207 | | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"))); |
| 1207 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, SOUND, "tms5220"))); |
| 1208 | 1208 | int cycles_to_ready = cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready); |
| 1209 | 1209 | |
| 1210 | 1210 | logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready); |
| r4283 | r4284 | |
| 1214 | 1214 | } |
| 1215 | 1215 | #endif |
| 1216 | 1216 | |
| 1217 | | tms5220_data_w(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"), offset, (data >> 8) & 0xff); |
| 1217 | tms5220_data_w(devtag_get_device(space->machine, SOUND, "tms5220"), offset, (data >> 8) & 0xff); |
| 1218 | 1218 | } |
| 1219 | 1219 | |
| 1220 | 1220 | /* |
| r4283 | r4284 | |
| 1394 | 1394 | if (! (offset & 1)) |
| 1395 | 1395 | { |
| 1396 | 1396 | cpu_adjust_icount(space->machine->cpu[0],-16*4); /* this is just a minimum, it can be more */ |
| 1397 | | reply = tms5220_status_r(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"), 0); |
| 1397 | reply = tms5220_status_r(devtag_get_device(space->machine, SOUND, "tms5220"), 0); |
| 1398 | 1398 | } |
| 1399 | 1399 | break; |
| 1400 | 1400 | |
| r4283 | r4284 | |
| 1505 | 1505 | case 1: |
| 1506 | 1506 | /* sound write + RAM */ |
| 1507 | 1507 | if (offset < 0x8410) |
| 1508 | | sn76496_w(devtag_get_device(space->machine, SOUND_SN76489, "sn76496"), offset, data); |
| 1508 | sn76496_w(devtag_get_device(space->machine, SOUND, "sn76496"), offset, data); |
| 1509 | 1509 | else |
| 1510 | 1510 | sRAM_ptr_8[offset & 0x1fff] = data; |
| 1511 | 1511 | break; |
| r4283 | r4284 | |
| 1563 | 1563 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the |
| 1564 | 1564 | case, we would need to store the value on the bus, which would be more |
| 1565 | 1565 | complex. */ |
| 1566 | | if (! tms5220_ready_r(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"))) |
| 1566 | if (! tms5220_ready_r(devtag_get_device(space->machine, SOUND, "tms5220"))) |
| 1567 | 1567 | { |
| 1568 | | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"))); |
| 1568 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, SOUND, "tms5220"))); |
| 1569 | 1569 | double d = ceil(cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready)); |
| 1570 | 1570 | int cycles_to_ready = ((int) (d + 3)) & ~3; |
| 1571 | 1571 | |
| r4283 | r4284 | |
| 1576 | 1576 | timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL); |
| 1577 | 1577 | } |
| 1578 | 1578 | |
| 1579 | | tms5220_data_w(devtag_get_device(space->machine, SOUND_TMS5220, "tms5220"), offset, data); |
| 1579 | tms5220_data_w(devtag_get_device(space->machine, SOUND, "tms5220"), offset, data); |
| 1580 | 1580 | } |
| 1581 | 1581 | break; |
| 1582 | 1582 | |