tms5110.c

* added all known variants of the tms5110 as proper chips
* updated dkong, cvs and scramble to use new chips
This commit is contained in:
Couriersud 2008-01-18 22:57:47 +00:00
parent b9cbc1af47
commit 0c44c5388b
12 changed files with 172 additions and 21 deletions

View File

@ -107,7 +107,13 @@ void namco_63701x_get_info(void *token, UINT32 state, sndinfo *info);
void namcona_get_info(void *token, UINT32 state, sndinfo *info);
void tms36xx_get_info(void *token, UINT32 state, sndinfo *info);
void tms3615_get_info(void *token, UINT32 state, sndinfo *info);
void tms5100_get_info(void *token, UINT32 state, sndinfo *info);
void tms5110_get_info(void *token, UINT32 state, sndinfo *info);
void tms5110a_get_info(void *token, UINT32 state, sndinfo *info);
void cd2801_get_info(void *token, UINT32 state, sndinfo *info);
void tmc0281_get_info(void *token, UINT32 state, sndinfo *info);
void cd2802_get_info(void *token, UINT32 state, sndinfo *info);
void m58817_get_info(void *token, UINT32 state, sndinfo *info);
void tmc0285_get_info(void *token, UINT32 state, sndinfo *info);
void tms5200_get_info(void *token, UINT32 state, sndinfo *info);
void tms5220_get_info(void *token, UINT32 state, sndinfo *info);
@ -286,11 +292,26 @@ static const struct
#if (HAS_TMS3615)
{ SOUND_TMS3615, tms3615_get_info },
#endif
#if (HAS_TMS5100)
{ SOUND_TMS5100, tms5100_get_info },
#endif
#if (HAS_TMS5110)
{ SOUND_TMS5110, tms5110_get_info },
#endif
#if (HAS_TMC0285)
{ SOUND_TMC0285, tmc0285_get_info },
#if (HAS_TMS5110A)
{ SOUND_TMS5110A, tms5110a_get_info },
#endif
#if (HAS_CD2801)
{ SOUND_CD2801, cd2801_get_info },
#endif
#if (HAS_TMC0281)
{ SOUND_TMC0281, tmc0281_get_info },
#endif
#if (HAS_CD2802)
{ SOUND_CD2802, cd2802_get_info },
#endif
#if (HAS_M58817)
{ SOUND_M58817, m58817_get_info },
#endif
#if (HAS_TMS5200)
{ SOUND_TMS5200, tms5200_get_info },

View File

@ -72,7 +72,13 @@ enum _sound_type
SOUND_NAMCONA,
SOUND_TMS36XX,
SOUND_TMS3615,
SOUND_TMS5100,
SOUND_TMS5110,
SOUND_TMS5110A,
SOUND_CD2801,
SOUND_TMC0281,
SOUND_CD2802,
SOUND_M58817,
SOUND_TMC0285,
SOUND_TMS5200,
SOUND_TMS5220,

View File

@ -66,14 +66,14 @@ static void speech_rom_set_addr(int addr)
static void *tms5110_start(int sndindex, int clock, const void *config)
{
static const struct TMS5110interface dummy = { TMS5110_IS_5110A, -1 };
static const struct TMS5110interface dummy = { -1 };
struct tms5110_info *info;
info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info));
info->intf = config ? config : &dummy;
info->chip = tms5110_create(sndindex, info->intf->variant);
info->chip = tms5110_create(sndindex, TMS5110_IS_5110A);
if (!info->chip)
return NULL;
sndintrf_register_token(info);
@ -104,6 +104,47 @@ static void *tms5110_start(int sndindex, int clock, const void *config)
return info;
}
static void *tms5100_start(int sndindex, int clock, const void *config)
{
struct tms5110_info *info = tms5110_start(sndindex, clock, config);
tms5110_set_variant(info->chip, TMS5110_IS_5100);
return info;
}
static void *tms5110a_start(int sndindex, int clock, const void *config)
{
struct tms5110_info *info = tms5110_start(sndindex, clock, config);
tms5110_set_variant(info->chip, TMS5110_IS_5110A);
return info;
}
static void *cd2801_start(int sndindex, int clock, const void *config)
{
struct tms5110_info *info = tms5110_start(sndindex, clock, config);
tms5110_set_variant(info->chip, TMS5110_IS_CD2801);
return info;
}
static void *tmc0281_start(int sndindex, int clock, const void *config)
{
struct tms5110_info *info = tms5110_start(sndindex, clock, config);
tms5110_set_variant(info->chip, TMS5110_IS_TMC0281);
return info;
}
static void *cd2802_start(int sndindex, int clock, const void *config)
{
struct tms5110_info *info = tms5110_start(sndindex, clock, config);
tms5110_set_variant(info->chip, TMS5110_IS_CD2802);
return info;
}
static void *m58817_start(int sndindex, int clock, const void *config)
{
struct tms5110_info *info = tms5110_start(sndindex, clock, config);
tms5110_set_variant(info->chip, TMS5110_IS_M58817);
return info;
}
/******************************************************************************
@ -251,12 +292,12 @@ static void tms5110_set_info(void *token, UINT32 state, sndinfo *info)
}
}
void tms5110_get_info(void *token, UINT32 state, sndinfo *info)
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
case SNDINFO_INT_ALIAS: info->i = SOUND_TMS5110; break;
/* --- the following bits of info are returned as pointers to data or functions --- */
case SNDINFO_PTR_SET_INFO: info->set_info = tms5110_set_info; break;
@ -273,3 +314,65 @@ void tms5110_get_info(void *token, UINT32 state, sndinfo *info)
}
}
void tms5100_get_info(void *token, UINT32 state, sndinfo *info)
{
switch (state)
{
case SNDINFO_PTR_START: info->start = tms5100_start; break;
case SNDINFO_STR_NAME: info->s = "TMS5100"; break;
default: tms5110_get_info(token, state, info); break;
}
}
void tms5110a_get_info(void *token, UINT32 state, sndinfo *info)
{
switch (state)
{
case SNDINFO_PTR_START: info->start = tms5110a_start; break;
case SNDINFO_STR_NAME: info->s = "TMS5100A"; break;
default: tms5110_get_info(token, state, info); break;
}
}
void cd2801_get_info(void *token, UINT32 state, sndinfo *info)
{
switch (state)
{
case SNDINFO_PTR_START: info->start = cd2801_start; break;
case SNDINFO_STR_NAME: info->s = "CD2801"; break;
default: tms5110_get_info(token, state, info); break;
}
}
void tmc0281_get_info(void *token, UINT32 state, sndinfo *info)
{
switch (state)
{
case SNDINFO_PTR_START: info->start = tmc0281_start; break;
case SNDINFO_STR_NAME: info->s = "TMS5100"; break;
default: tms5110_get_info(token, state, info); break;
}
}
void cd2802_get_info(void *token, UINT32 state, sndinfo *info)
{
switch (state)
{
case SNDINFO_PTR_START: info->start = cd2802_start; break;
case SNDINFO_STR_NAME: info->s = "CD2802"; break;
default: tms5110_get_info(token, state, info); break;
}
}
void m58817_get_info(void *token, UINT32 state, sndinfo *info)
{
switch (state)
{
case SNDINFO_PTR_START: info->start = m58817_start; break;
case SNDINFO_STR_NAME: info->s = "M58817"; break;
default: tms5110_get_info(token, state, info); break;
}
}

View File

@ -7,7 +7,6 @@
struct TMS5110interface
{
int variant; /* Variant of the 5110 - see tms5110.h */
int rom_region; /* set to -1 to specifiy callbacks below */
int (*M0_callback)(void); /* function to be called when chip requests another bit */
void (*load_address)(int addr); /* speech ROM load address callback */

View File

@ -580,6 +580,13 @@ endif
# Texas Instruments TMS5110 speech synthesizers
#-------------------------------------------------
SOUNDDEFS += -DHAS_TMS5100=$(if $(filter TMS5100,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_TMS5110=$(if $(filter TMS5110,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_TMS5110A=$(if $(filter TMS5110A,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_CD2801=$(if $(filter CD2801,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_TMC0281=$(if $(filter TMC0281,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_CD2802=$(if $(filter CD2802,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_M58817=$(if $(filter M58817,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_TMS5110=$(if $(filter TMS5110,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_TMC0285=$(if $(filter TMC0285,$(SOUNDS)),1,0)
SOUNDDEFS += -DHAS_TMS5200=$(if $(filter TMS5200,$(SOUNDS)),1,0)

View File

@ -84,8 +84,12 @@ struct tms5100_coeffs
struct tms5110
{
/* coefficient tables */
int variant; /* Variant of the 5110 - see tms5110.h */
/* coefficient tables */
const struct tms5100_coeffs *coeff;
/* these contain data that describes the 64 bits FIFO */
UINT8 fifo[FIFO_SIZE];
UINT8 fifo_head;
@ -149,13 +153,9 @@ static void parse_frame(struct tms5110 *tms);
#define DEBUG_5110 0
void *tms5110_create(int index, int variant)
void tms5110_set_variant(void *chip, int variant)
{
struct tms5110 *tms;
tms = malloc_or_die(sizeof(*tms));
memset(tms, 0, sizeof(*tms));
struct tms5110 *tms = chip;
switch (variant)
{
@ -172,6 +172,18 @@ void *tms5110_create(int index, int variant)
fatalerror("Unknown variant in tms5110_create\n");
}
tms->variant = variant;
}
void *tms5110_create(int index, int variant)
{
struct tms5110 *tms;
tms = malloc_or_die(sizeof(*tms));
memset(tms, 0, sizeof(*tms));
tms5110_set_variant(tms, variant);
state_save_register_item_array("tms5110", index, tms->fifo);
state_save_register_item("tms5110", index, tms->fifo_head);
state_save_register_item("tms5110", index, tms->fifo_tail);

View File

@ -28,6 +28,8 @@
void *tms5110_create(int index, int variant);
void tms5110_destroy(void *chip);
void tms5110_set_variant(void *chip, int variant);
void tms5110_reset_chip(void *chip);
void tms5110_set_M0_callback(void *chip, int (*func)(void));
void tms5110_set_load_address(void *chip, void (*func)(int));

View File

@ -1273,7 +1273,6 @@ static const struct NESinterface nes_interface_2 = { REGION_CPU3 };
static struct TMS5110interface tms5110_interface =
{
TMS5110_IS_M58817,
REGION_SOUND1, /* Sample Rom */
NULL,
NULL
@ -1317,7 +1316,7 @@ MACHINE_DRIVER_START( radarsc1_audio )
MDRV_CPU_MODIFY("sound")
MDRV_CPU_IO_MAP(radarsc1_sound_io_map, 0)
MDRV_SOUND_ADD(TMS5110, XTAL_640kHz)
MDRV_SOUND_ADD(M58817, XTAL_640kHz)
MDRV_SOUND_CONFIG(tms5110_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)

View File

@ -395,7 +395,6 @@ static WRITE8_HANDLER( ad2083_tms5110_ctrl_w )
static const struct TMS5110interface ad2083_tms5110_interface =
{
TMS5110_IS_5110A,
-1, /* rom_region */
ad2083_speech_rom_read_bit /* M0 callback function. Called whenever chip requests a single bit of data */
};
@ -455,7 +454,7 @@ MACHINE_DRIVER_START( ad2083_audio )
MDRV_SOUND_CONFIG(ad2083_ay8910_interface_2)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33)
MDRV_SOUND_ADD(TMS5110, AD2083_TMS5110_CLOCK)
MDRV_SOUND_ADD(TMS5110A, AD2083_TMS5110_CLOCK)
MDRV_SOUND_CONFIG(ad2083_tms5110_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END

View File

@ -555,7 +555,6 @@ static const struct AY8910interface ay8910_interface =
static const struct TMS5110interface tms5110_interface =
{
TMS5110_IS_5110A,
-1, /* ROM_REGION */
bagman_speech_rom_read_bit /*M0 callback function. Called whenever chip requests a single bit of data*/
};
@ -592,7 +591,7 @@ static MACHINE_DRIVER_START( bagman )
MDRV_SOUND_CONFIG(ay8910_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
MDRV_SOUND_ADD(TMS5110, 640000)
MDRV_SOUND_ADD(TMS5110A, 640000)
MDRV_SOUND_CONFIG(tms5110_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END

View File

@ -430,8 +430,6 @@ static int speech_rom_read_bit(void)
static const struct TMS5110interface tms5100_interface =
{
//TMS5110_IS_5110A,
TMS5110_IS_5100,
-1, /* ROM region */
speech_rom_read_bit, /* M0 callback function. Called whenever chip requests a single bit of data */
NULL
@ -707,7 +705,7 @@ static MACHINE_DRIVER_START( cvs )
MDRV_SOUND_ADD(DAC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD(TMS5110, 640000)
MDRV_SOUND_ADD(TMS5100, 640000)
MDRV_SOUND_CONFIG(tms5100_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END

View File

@ -243,7 +243,13 @@ SOUNDS += NAMCO_63701X
SOUNDS += NAMCONA
SOUNDS += TMS36XX
SOUNDS += TMS3615
SOUNDS += TMS5100
SOUNDS += TMS5110
SOUNDS += TMS5110A
SOUNDS += CD2801
SOUNDS += TMC0281
SOUNDS += CD2802
SOUNDS += M58817
SOUNDS += TMC0285
SOUNDS += TMS5200
SOUNDS += TMS5220