diff options
Diffstat (limited to 'src/mame/audio/exidy.c')
-rw-r--r-- | src/mame/audio/exidy.c | 128 |
1 files changed, 75 insertions, 53 deletions
diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c index ddd4de6890b..75a89dee399 100644 --- a/src/mame/audio/exidy.c +++ b/src/mame/audio/exidy.c @@ -13,7 +13,6 @@ #include "machine/6532riot.h" #include "sound/hc55516.h" #include "sound/5220intf.h" -#include "sound/custom.h" #include "exidy.h" @@ -377,7 +376,7 @@ static STREAM_UPDATE( exidy_stream_update ) * *************************************/ -static void *common_sh_start(const device_config *device, int clock, const custom_sound_interface *config) +static DEVICE_START( common_sh_start ) { int sample_rate = SH8253_CLOCK; @@ -387,29 +386,26 @@ static void *common_sh_start(const device_config *device, int clock, const custo exidy_stream = stream_create(device, 0, 1, sample_rate, NULL, exidy_stream_update); sh6840_register_state_globals(device->machine); - - return auto_malloc(1); } -CUSTOM_START( exidy_sh6840_sh_start ) +DEVICE_START( exidy_sound ) { /* indicate no additional hardware */ has_sh8253 = FALSE; has_tms5220 = FALSE; has_mc3417 = FALSE; - return common_sh_start(device, clock, config); + DEVICE_START_CALL(common_sh_start); } - /************************************* * * Audio reset routines * *************************************/ -static void common_sh_reset(void *token) +static DEVICE_RESET( common_sh_reset ) { /* 6840 */ memset(sh6840_timer, 0, sizeof(sh6840_timer)); @@ -428,12 +424,26 @@ static void common_sh_reset(void *token) sh6840_LFSR_3 = 0xffffffff; } -CUSTOM_RESET( exidy_sh6840_sh_reset ) +static DEVICE_RESET( exidy_sound ) { - common_sh_reset(token); + DEVICE_RESET_CALL(common_sh_reset); } +DEVICE_GET_INFO( exidy_sound ) +{ + switch (state) + { + /* --- the following bits of info are returned as pointers to data or functions --- */ + case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(exidy_sound); break; + case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(exidy_sound); break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case DEVINFO_STR_NAME: strcpy(info->s, "Exidy SFX"); break; + case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; + } +} + /************************************* * @@ -457,18 +467,18 @@ static void r6532_porta_w(const device_config *device, UINT8 newdata, UINT8 oldd static void r6532_portb_w(const device_config *device, UINT8 newdata, UINT8 olddata) { - const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - if (has_tms5220) + const device_config *tms = devtag_get_device(device->machine, SOUND, "tms"); + if (device != NULL) { if ((olddata & 0x01) && !(newdata & 0x01)) { - riot6532_porta_in_set(riot, tms5220_status_r(space, 0), 0xff); - logerror("(%f)%s:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), tms5220_status_r(space, 0)); + riot6532_porta_in_set(riot, tms5220_status_r(tms, 0), 0xff); + logerror("(%f)%s:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), tms5220_status_r(tms, 0)); } if ((olddata & 0x02) && !(newdata & 0x02)) { logerror("(%f)%s:TMS5220 data write = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), riot6532_porta_out_get(riot)); - tms5220_data_w(space, 0, riot6532_porta_out_get(riot)); + tms5220_data_w(tms, 0, riot6532_porta_out_get(riot)); } } } @@ -479,9 +489,10 @@ static UINT8 r6532_portb_r(const device_config *device, UINT8 olddata) UINT8 newdata = olddata; if (has_tms5220) { + const device_config *tms = devtag_get_device(device->machine, SOUND, "tms"); newdata &= ~0x0c; - if (!tms5220_ready_r()) newdata |= 0x04; - if (!tms5220_int_r()) newdata |= 0x08; + if (!tms5220_ready_r(tms)) newdata |= 0x04; + if (!tms5220_int_r(tms)) newdata |= 0x08; } return newdata; } @@ -703,49 +714,41 @@ static const pia6821_interface venture_pia_1_intf = }; -static void *venture_common_sh_start(const device_config *device, int clock, const custom_sound_interface *config, int _has_tms5220) +static DEVICE_START( venture_common_sh_start ) { running_machine *machine = device->machine; - int i; - void *ret = common_sh_start(device, clock, config); + DEVICE_START_CALL(common_sh_start); riot = device_list_find_by_tag(machine->config->devicelist, RIOT6532, "riot"); has_sh8253 = TRUE; - has_tms5220 = _has_tms5220; + has_tms5220 = FALSE; /* determine which sound hardware is installed */ - has_mc3417 = FALSE; - for (i = 0; i < MAX_SOUND; i++) - { - if (machine->config->sound[i].type == SOUND_MC3417) - has_mc3417 = TRUE; - } + has_mc3417 = (devtag_get_device(device->machine, SOUND, "cvsd") != NULL); /* 8253 */ freq_to_step = (double)(1 << 24) / (double)SH8253_CLOCK; state_save_register_global(machine, riot_irq_state); sh8253_register_state_globals(device->machine); - - return ret; } -static CUSTOM_START( venture_sh_start ) +static DEVICE_START( venture_sound ) { running_machine *machine = device->machine; pia_config(machine, 0, &venture_pia_0_intf); pia_config(machine, 1, &venture_pia_1_intf); - return venture_common_sh_start(device, clock, config, FALSE); + DEVICE_START_CALL(venture_common_sh_start); } -static CUSTOM_RESET( venture_sh_reset ) +static DEVICE_RESET( venture_sound ) { - common_sh_reset(token); + DEVICE_RESET_CALL(common_sh_reset); /* PIA */ pia_reset(); @@ -758,12 +761,22 @@ static CUSTOM_RESET( venture_sh_reset ) } -static const custom_sound_interface venture_custom_interface = +static DEVICE_GET_INFO( venture_sound ) { - venture_sh_start, - 0, - venture_sh_reset -}; + switch (state) + { + /* --- the following bits of info are returned as pointers to data or functions --- */ + case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(venture_sound); break; + case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(venture_sound); break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case DEVINFO_STR_NAME: strcpy(info->s, "Exidy SFX+PSG"); break; + case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; + } +} + + +#define SOUND_EXIDY_VENTURE DEVICE_GET_INFO_NAME( venture_sound ) static ADDRESS_MAP_START( venture_audio_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -788,8 +801,7 @@ MACHINE_DRIVER_START( venture_audio ) MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_SOUND_ADD("custom", CUSTOM, 0) - MDRV_SOUND_CONFIG(venture_custom_interface) + MDRV_SOUND_ADD("custom", EXIDY_VENTURE, 0) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_DRIVER_END @@ -804,7 +816,7 @@ MACHINE_DRIVER_END static WRITE8_HANDLER( mtrap_voiceio_w ) { if (!(offset & 0x10)) - hc55516_digit_w(0, data & 1); + hc55516_digit_w(devtag_get_device(space->machine, SOUND, "cvsd"), data & 1); if (!(offset & 0x20)) riot6532_portb_in_set(riot, data & 1, 0xff); @@ -823,7 +835,7 @@ static READ8_HANDLER( mtrap_voiceio_r ) } if (!(offset & 0x40)) - return hc55516_clock_state_r(0) << 7; + return hc55516_clock_state_r(devtag_get_device(space->machine, SOUND, "cvsd")) << 7; return 0; } @@ -930,20 +942,21 @@ static const pia6821_interface victory_pia_e5_intf = }; -static CUSTOM_START( victory_sh_start ) +static DEVICE_START( victory_sound ) { running_machine *machine = device->machine; pia_config(machine, 1, &victory_pia_e5_intf); state_save_register_global(machine, victory_sound_response_ack_clk); - return venture_common_sh_start(device, clock, config, TRUE); + DEVICE_START_CALL(venture_common_sh_start); + has_tms5220 = TRUE; } -static CUSTOM_RESET( victory_sh_reset ) +static DEVICE_RESET( victory_sound ) { - common_sh_reset(token); + DEVICE_RESET_CALL(common_sh_reset); pia_reset(); device_reset(riot); memset(sh8253_timer, 0, sizeof(sh8253_timer)); @@ -959,12 +972,22 @@ static CUSTOM_RESET( victory_sh_reset ) } -static const custom_sound_interface victory_custom_interface = +static DEVICE_GET_INFO( victory_sound ) { - victory_sh_start, - 0, - victory_sh_reset, -}; + switch (state) + { + /* --- the following bits of info are returned as pointers to data or functions --- */ + case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(victory_sound); break; + case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(victory_sound); break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case DEVINFO_STR_NAME: strcpy(info->s, "Exidy SFX+PSG+Speech"); break; + case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; + } +} + + +#define SOUND_EXIDY_VICTORY DEVICE_GET_INFO_NAME( victory_sound ) static ADDRESS_MAP_START( victory_audio_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -989,8 +1012,7 @@ MACHINE_DRIVER_START( victory_audio ) MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_SOUND_ADD("custom", CUSTOM, 0) - MDRV_SOUND_CONFIG(victory_custom_interface) + MDRV_SOUND_ADD("custom", EXIDY_VICTORY, 0) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MDRV_SOUND_ADD("tms", TMS5220, 640000) |