- radarsc1 uses tms5110 speech synth

- cvs games: according to PCBInfos speech chip is TMS5100.
  Changed driver to use TMS5100 and "game system operational" now sounds more natural
- removed sound/m58817.*
- added support for multiple coefficients maps to tms5110.*
- added coefficient maps for TMS5100 and M58817 from documented sources to tms5110r.c
- fixed interpolation factors (see tms5110r.c for reason)
- made lattice calculation precision 9bit
- added support for READBIT and LOADADDRESS commands to tms5110.c
- more changes in line with various patents
This commit is contained in:
Couriersud 2007-12-25 22:47:08 +00:00
parent dd82d11edb
commit bf79fa4948
16 changed files with 880 additions and 974 deletions

2
.gitattributes vendored
View File

@ -762,8 +762,6 @@ src/emu/sound/k053260.c svneol=native#text/plain
src/emu/sound/k053260.h svneol=native#text/plain
src/emu/sound/k054539.c svneol=native#text/plain
src/emu/sound/k054539.h svneol=native#text/plain
src/emu/sound/m58817.c svneol=native#text/plain
src/emu/sound/m58817.h svneol=native#text/plain
src/emu/sound/msm5205.c svneol=native#text/plain
src/emu/sound/msm5205.h svneol=native#text/plain
src/emu/sound/msm5232.c svneol=native#text/plain

View File

@ -164,7 +164,6 @@ void sid6581_get_info(void *token, UINT32 state, sndinfo *info);
void sid8580_get_info(void *token, UINT32 state, sndinfo *info);
void sp0256_get_info(void *token, UINT32 state, sndinfo *info);
void s14001a_get_info(void *token, UINT32 state, sndinfo *info);
void m58817_get_info(void *token, UINT32 state, sndinfo *info);
void filter_volume_get_info(void *token, UINT32 state, sndinfo *info);
void filter_rc_get_info(void *token, UINT32 state, sndinfo *info);
@ -445,9 +444,6 @@ static const struct
#if (HAS_SP0256)
{ SOUND_SP0256, sp0256_get_info },
#endif
#if (HAS_M58817)
{ SOUND_M58817, m58817_get_info },
#endif
{ SOUND_FILTER_VOLUME, filter_volume_get_info },
{ SOUND_FILTER_RC, filter_rc_get_info },

View File

@ -125,7 +125,6 @@ enum _sound_type
SOUND_SID8580,
SOUND_SP0256,
SOUND_S14001A,
SOUND_M58817,
/* filters start here */
SOUND_FILTER_VOLUME,

View File

@ -27,13 +27,36 @@ struct tms5110_info
const struct TMS5110interface *intf;
sound_stream *stream;
void *chip;
INT32 speech_rom_bitnum;
};
/* static function prototypes */
static void tms5110_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
static int speech_rom_read_bit(void)
{
struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
const UINT8 *table = memory_region(info->intf->rom_region);
int r;
if (info->speech_rom_bitnum<0)
r = 0;
else
r = (table[info->speech_rom_bitnum >> 3] >> (0x07 - (info->speech_rom_bitnum & 0x07))) & 1;
info->speech_rom_bitnum++;
return r;
}
static void speech_rom_set_addr(int addr)
{
struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
info->speech_rom_bitnum = addr * 8 - 1;
}
/******************************************************************************
@ -43,14 +66,14 @@ static void tms5110_update(void *param, stream_sample_t **inputs, stream_sample_
static void *tms5110_start(int sndindex, int clock, const void *config)
{
static const struct TMS5110interface dummy = { 0 };
static const struct TMS5110interface dummy = { TMS5110_IS_5110A, -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->chip = tms5110_create(sndindex, info->intf->variant);
if (!info->chip)
return NULL;
sndintrf_register_token(info);
@ -58,12 +81,21 @@ static void *tms5110_start(int sndindex, int clock, const void *config)
/* initialize a stream */
info->stream = stream_create(0, 1, clock / 80, info, tms5110_update);
if (info->intf->M0_callback==NULL)
{
logerror("\n file: 5110intf.c, tms5110_start(), line 53:\n Missing _mandatory_ 'M0_callback' function pointer in the TMS5110 interface\n This function is used by TMS5110 to call for a single bits\n needed to generate the speech\n Aborting startup...\n");
return NULL;
}
tms5110_set_M0_callback(info->chip, info->intf->M0_callback );
if (info->intf->rom_region == -1 )
{
if (info->intf->M0_callback==NULL)
{
logerror("\n file: 5110intf.c, tms5110_start(), line 53:\n Missing _mandatory_ 'M0_callback' function pointer in the TMS5110 interface\n This function is used by TMS5110 to call for a single bits\n needed to generate the speech\n Aborting startup...\n");
return NULL;
}
tms5110_set_M0_callback(info->chip, info->intf->M0_callback );
tms5110_set_load_address(info->chip, info->intf->load_address );
}
else
{
tms5110_set_M0_callback(info->chip, speech_rom_read_bit );
tms5110_set_load_address(info->chip, speech_rom_set_addr );
}
/* reset the 5110 */
tms5110_reset_chip(info->chip);

View File

@ -7,8 +7,10 @@
struct TMS5110interface
{
void (*irq)(int state); /* IRQ callback function */
int (*M0_callback)(void); /* function to be called when chip requests another bit*/
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 */
};
WRITE8_HANDLER( tms5110_CTL_w );

View File

@ -1,365 +0,0 @@
/******************************************************************************
M58817 interface
Written for MAME by couriersud
- structure from TMS5110 interface
- this is a wrapper around the TMS5110 interface
- M58817 & TMS5110 seem to be similar, however it is very probable
that they use different "coding" tables for energy, pitch
- Speech is understandable, but off
- This driver supports to use a "sample" interface instead as well
******************************************************************************/
#include <math.h>
#include "sndintrf.h"
#include "streams.h"
#include "tms5110.h"
#include "m58817.h"
#include "sound/samples.h"
#define MAX_SAMPLE_CHUNK 10000
enum {
WAIT_CMD,
WAIT_WRITE,
WAIT_DONE1,
WAIT_DONE2
} m58817_states;
/* the state of the streamed output */
struct m58817_info
{
const struct M58817interface *intf;
sound_stream *stream;
void *chip;
UINT8 state;
UINT8 drq;
UINT8 nibbles[4];
UINT8 command_latch;
INT32 count;
INT32 address;
INT32 speech_rom_bitnum;
};
/* static function prototypes */
static void m58817_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
static int speech_rom_read_bit(void)
{
struct m58817_info *info = sndti_token(SOUND_M58817, 0);
const UINT8 *table = memory_region(info->intf->rom_region);
int r;
if (info->speech_rom_bitnum<0)
r = 0;
else
r = (table[info->speech_rom_bitnum >> 3] >> (0x07 - (info->speech_rom_bitnum & 0x07))) & 1;
//r = (table[speech_rom_bitnum >> 3] >> ((speech_rom_bitnum & 0x07))) & 1;
info->speech_rom_bitnum++;
//printf("Byte: 0x%02x\n", speech_rom_bitnum>>3);
return r;
}
/******************************************************************************
m58817_state_loop -- process commands
******************************************************************************/
static void m58817_state_loop(void *chip, int data)
{
struct m58817_info *info = chip;
int i;
switch (info->state)
{
case WAIT_CMD:
switch (data)
{
case 0x00: // reset ????
info->count=0;
/*To be extremely accurate there should be a delays between each of
the function calls below. In real they happen with the frequency of 160 kHz.
*/
if (info->intf->rom_region != -1)
{
tms5110_CTL_set(info->chip, TMS5110_CMD_RESET);
tms5110_PDC_set(info->chip, 0);
tms5110_PDC_set(info->chip, 1);
tms5110_PDC_set(info->chip, 0);
tms5110_PDC_set(info->chip, 0);
tms5110_PDC_set(info->chip, 1);
tms5110_PDC_set(info->chip, 0);
tms5110_PDC_set(info->chip, 0);
tms5110_PDC_set(info->chip, 1);
tms5110_PDC_set(info->chip, 0);
info->speech_rom_bitnum = 0x0;
}
break;
case 0x02: // latch next nibbel
info->state=WAIT_WRITE;
break;
case 0x08: // play ????
info->state=WAIT_DONE1;
break;
default:
logerror("m58817: unknown cmd : 0x%02x\n", data);
}
break;
case WAIT_WRITE:
info->nibbles[info->count++] = data & 0x0f;
info->state=WAIT_CMD;
break;
case WAIT_DONE1:
if (data != 0x0A)
logerror("m58817: expected 0x0A got 0x%02x\n", data);
info->address = 0;
for (i=0;i<info->count;i++)
{
info->address |= (info->nibbles[i] << (i*4));
}
logerror("m58817: address: 0x%04x\n", info->address);
if (info->intf->rom_region != -1)
{
info->speech_rom_bitnum = info->address * 8 - 1;
tms5110_CTL_set(info->chip, TMS5110_CMD_SPEAK);
tms5110_PDC_set(info->chip, 0);
tms5110_PDC_set(info->chip, 1);
tms5110_PDC_set(info->chip, 0);
}
else
{
for (i=0;i<M58817_MAX_SAMPLES;i++)
if (info->intf->sample_addr[i] == info->address)
{
sample_start(0,i,0);
break;
}
}
info->state=WAIT_CMD;
break;
}
}
/******************************************************************************
m58817_start -- allocate buffers and reset the 5110
******************************************************************************/
static void *m58817_start(int sndindex, int clock, const void *config)
{
static const struct M58817interface dummy = { 0 };
struct m58817_info *info;
info = auto_malloc(sizeof(*info));
memset(info, 0, sizeof(*info));
info->intf = config ? config : &dummy;
if (info->intf->rom_region != -1)
{
info->chip = tms5110_create(sndindex);
if (!info->chip)
return NULL;
}
sndintrf_register_token(info);
/* initialize a stream */
if (info->intf->rom_region != -1)
{
info->stream = stream_create(0, 1, clock / 80, info, m58817_update);
tms5110_set_M0_callback(info->chip, speech_rom_read_bit );
/* reset the 58817 */
tms5110_reset_chip(info->chip);
}
state_save_register_item("m58817", sndindex, info->state);
state_save_register_item("m58817", sndindex, info->drq);
state_save_register_item_array("m58817", sndindex, info->nibbles);
state_save_register_item("m58817", sndindex, info->count);
state_save_register_item("m58817", sndindex, info->address);
state_save_register_item("m58817", sndindex, info->speech_rom_bitnum);
/* request a sound channel */
return info;
}
/******************************************************************************
m58817_stop -- free buffers
******************************************************************************/
static void m58817_stop(void *chip)
{
struct m58817_info *info = chip;
if (info->intf->rom_region != -1)
tms5110_destroy(info->chip);
}
static void m58817_reset(void *chip)
{
struct m58817_info *info = chip;
if (info->intf->rom_region != -1)
tms5110_reset_chip(info->chip);
info->state = WAIT_CMD;
info->drq = 0;
info->command_latch = 0;
info->count=0;
}
/******************************************************************************
m58817_CTL_w -- write Control Command to the sound chip
commands like Speech, Reset, etc., are loaded into the chip via the CTL pins
******************************************************************************/
WRITE8_HANDLER( m58817_CTL_w )
{
struct m58817_info *info = sndti_token(SOUND_M58817, 0);
/* bring up to date first */
//stream_update(info->stream);
info->command_latch = data & 0x0f;
}
/******************************************************************************
m58817_DRQ_w -- write to DRQ pin on the sound chip
******************************************************************************/
WRITE8_HANDLER( m58817_DRQ_w )
{
struct m58817_info *info = sndti_token(SOUND_M58817, 0);
/* bring up to date first */
if (info->intf->rom_region != -1)
stream_update(info->stream);
if (!data & info->drq)
m58817_state_loop(info, info->command_latch);
info->drq = data;
}
/******************************************************************************
m58817_status_r -- read status from the sound chip
******************************************************************************/
READ8_HANDLER( m58817_status_r )
{
struct m58817_info *info = sndti_token(SOUND_M58817, 0);
/* bring up to date first */
if (info->intf->rom_region != -1)
stream_update(info->stream);
if (info->intf->rom_region != -1)
return tms5110_status_read(info->chip);
else
return sample_playing(0);
}
/******************************************************************************
m58817_update -- update the sound chip so that it is in sync with CPU execution
******************************************************************************/
static void m58817_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
{
struct m58817_info *info = param;
INT16 sample_data[MAX_SAMPLE_CHUNK];
stream_sample_t *buffer = _buffer[0];
/* loop while we still have samples to generate */
while (length)
{
int samples = (length > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : length;
int index;
/* generate the samples and copy to the target buffer */
tms5110_process(info->chip, sample_data, samples);
for (index = 0; index < samples; index++)
*buffer++ = sample_data[index];
/* account for the samples */
length -= samples;
}
}
/******************************************************************************
m58817_set_frequency -- adjusts the playback frequency
******************************************************************************/
void m58817_set_frequency(int frequency)
{
struct m58817_info *info = sndti_token(SOUND_M58817, 0);
stream_set_sample_rate(info->stream, frequency / 80);
}
/**************************************************************************
* Generic get_info
**************************************************************************/
static void m58817_set_info(void *token, UINT32 state, sndinfo *info)
{
switch (state)
{
/* no parameters to set */
}
}
void m58817_get_info(void *token, UINT32 state, sndinfo *info)
{
switch (state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
/* --- the following bits of info are returned as pointers to data or functions --- */
case SNDINFO_PTR_SET_INFO: info->set_info = m58817_set_info; break;
case SNDINFO_PTR_START: info->start = m58817_start; break;
case SNDINFO_PTR_STOP: info->stop = m58817_stop; break;
case SNDINFO_PTR_RESET: info->reset = m58817_reset; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
case SNDINFO_STR_NAME: info->s = "M58817"; break;
case SNDINFO_STR_CORE_FAMILY: info->s = "Mitsubishi Speech"; break;
case SNDINFO_STR_CORE_VERSION: info->s = "1.0"; break;
case SNDINFO_STR_CORE_FILE: info->s = __FILE__; break;
case SNDINFO_STR_CORE_CREDITS: info->s = "Copyright (c) 2007, The MAME Team"; break;
}
}

View File

@ -1,24 +0,0 @@
#ifndef m58817_h
#define m58817_h
/* clock rate = 80 * output sample rate, */
/* usually 640000 for 8000 Hz sample rate or */
/* usually 800000 for 10000 Hz sample rate. */
#define M58817_MAX_SAMPLES 20
struct M58817interface
{
int rom_region; /* set to -1 to use samples */
int sample_addr[M58817_MAX_SAMPLES];
};
WRITE8_HANDLER( m58817_CTL_w );
WRITE8_HANDLER( m58817_DRQ_w );
READ8_HANDLER( m58817_status_r );
void m58817_set_frequency(int frequency);
#endif

View File

@ -593,18 +593,6 @@ endif
#-------------------------------------------------
# Mitsubishi M58817 speech synthesizer
#-------------------------------------------------
SOUNDDEFS += -DHAS_M58817=$(if $(filter M58817,$(SOUNDS)),1,0)
ifneq ($(filter M58817,$(SOUNDS)),)
SOUNDOBJS += $(SOUNDOBJ)/m58817.o
endif
#-------------------------------------------------
# VLM5030 speech synthesizer
#-------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -13,12 +13,19 @@
#define TMS5110_CMD_READ_BRANCH (12) /* 1 1 0 x | 1 */
#define TMS5110_CMD_TEST_TALK (14) /* 1 1 1 x | 3 */
/* Variants */
void *tms5110_create(int index);
#define TMS5110_IS_5110A (1)
#define TMS5110_IS_5100 (2)
#define TMS5110_IS_M58817 (3)
void *tms5110_create(int index, int variant);
void tms5110_destroy(void *chip);
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));
void tms5110_CTL_set(void *chip, int data);
void tms5110_PDC_set(void *chip, int data);

View File

@ -1,136 +1,234 @@
/* TMS5110 ROM Tables */
/* Note: all the tables in this file were read from the real TMS5110A chip, except
/* Kx is (5-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
/* The following table is assumed to be for TMS5100
*
* US Patent 4209836
* 4331836
* 4304964
* 4234761
* 4189779
* 4449233
*
* All patents give interpolation coefficients
* { 8, 8, 8, 4, 4, 2, 2, 1 }
* This sequence will not calculate the published
* fractions:
* 1 8 0.125
* 2 8 0.234
* 3 8 0.330
* 4 4 0.498
* 5 4 0.623
* 6 2 0.717
* 7 2 0.859
* 0 1 1.000
*
* Instead, { 8, 8, 8, 4, 4, 4, 2, 1 }
* will calculate those coefficients and this has been used below.
*/
static const struct tms5100_coeffs pat4209836_coeff =
{
/* subtype */
SUBTYPE_TMS5100,
10,
4,
5,
{ 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
/* E */
{ 0, 0, 1, 1, 2, 3, 5, 7, 10, 15, 21, 31, 43, 61, 86, 511 },
/* P */
{ 0, 41, 43, 45, 47, 49, 51, 53,
55, 58, 60, 63, 66, 70, 73, 76,
79, 83, 87, 90, 94, 99, 103, 104,
112, 118, 120, 129, 134, 140, 147, 153 },
{
/* K1 */
{ -504, -497, -493, -488, -471, -471, -460, -446,
-427, -405, -378, -344, -501, -259, -206, -148,
-86, -5, 45, 110, 168, 131, 277, 320,
357, 388, 413, 434, 451, 464, 474, 482 },
/* K2 */
{ -349, -376, -305, -264, -252, -223, -192, -158,
-124, -88, -51, -14, 23, 60, 97, 133,
167, 215, 230, 259, 286, 310, 333, 354,
372, 389, 404, 417, 429, 439, 449, 506 },
/* K3 */
{ -397, -365, -327, -266, -229, -170, -104, -36,
35, 104, 169, 228, 281, 326, 364, 396 },
/* K4 */
{ -369, -334, -296, -246, -191, -131, -67, -1,
64, 128, 188, 243, 291, 332, 367, 397 },
/* K5 */
{ -319, -286, -250, -211, -168, -122, -74, -25,
24, 73, 121, 167, 210, 249, 285, 318 },
/* K6 */
{ -290, -252, -209, -163, -114, -62, -9, 44,
97, 147, 194, 255, 278, 313, 344, 371 },
/* K7 */
{ -291, -256, -216, -174, -128, -96, -31, 19,
69, 117, 163, 206, 246, 280, 316, 345 },
/* K8 */
{ -218, -133, -38, 56, 152, 251, 305, 361 },
/* K9 */
{ -225, -157, -82, -3, 76, 151, 220, 280 },
/* K10 */
{ -179, -122, -61, 1, 62, 123, 179, 247 },
},
/* Chirptable */
{ 0, 42, -44, 50, -78, 18, 37, 20,
2, -31, -59, 2, 95, 90, 5, 15,
38, -4, -91,-91, -42,-35,-36, -4,
37, 43, 34, 33, 15, -1, -8,-18,
-19,-17, -9,-10, -6, 0, 3, 2,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0 },
/* interpolation coefficients */
{ 8, 8, 8, 4, 4, 4, 2, 1 }
};
/*
* This table is from patent 4403965
* also listed in 4331836
* also listed in 4946391
*
* Works best with M58817 ...
*/
static const struct tms5100_coeffs pat4403965_coeff =
{
/* subtype */
SUBTYPE_M58817,
10,
4,
5,
{ 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
/* E */
{ 0,1,2,3,4,6,8,11,16,23,33,47,63,85,114,511, },
/* P */
{ 0,41,43,45,47,49,51,53,55,58,60,63,66,70,73,76,79,83,87,90,94,99,103,107,112,118,123,129,134,140,147,153,
},
{
/* K1 */
{
-501,-498,-495,-490,-485,-478,-469,-459,-446,-431,-412,-389,-362,-331,-295,-253,-207,-156,-102,-45,13,70,126,179,228,272,311,345,374,399,420,437,
},
/* K2 */
{
-376,-357,-335,-312,-286,-258,-227,-195,-161,-124,-87,-49,-10,29,68,106,143,178,212,243,272,299,324,346,366,384,400,414,427,438,448,506,
},
/* K3 */
{
-407,-381,-349,-311,-268,-218,-162,-102,-39,25,89,149,206,257,302,341,
},
/* K4 */
{
-290,-252,-209,-163,-114,-62,-9,44,97,147,194,238,278,313,344,371,
},
/* K5 */
{
-318,-283,-245,-202,-156,-107,-56,-3,49,101,150,196,239,278,313,344,
},
/* K6 */
{
-193,-152,-109,-65,-20,26,71,115,158,198,235,270,301,330,355,377,
},
/* K7 */
{
-254,-218,-180,-140,-97,-53,-8,36,81,124,165,204,240,274,304,332,
},
/* K8 */
{
-205,-112,-10,92,187,269,336,387,
},
/* K9 */
{
-249,-183,-110,-19,48,126,198,261,
},
/* K10 */
{
-190,-133,-73,-10,53,115,173,227,
},
},
/* Chirptable */
{ 0,43,-44,51,-77,18,37,20,
2,-30,-58,3,96,91,5,15,
38,-4,-90,-91,-42,-35,-35,-3,
37,43,35,34,15,-1,-8,-17,
-19,-17,-9,-9,-6,1,4,3,
1,0,0,0,0,0,0,0,
0,0,0
},
/* interpolation coefficients */
{ 8, 8, 8, 4, 4, 4, 2, 1 }
};
/* Note: the following tables in this file were read from the real TMS5110A chip, except
for the chirptable and the interp_coeff
*/
/* This is the energy lookup table (4-bits -> 10-bits) */
const static unsigned short energytable[0x10] = {
0*2, 1*2, 2*2, 3*2,
4*2, 6*2, 8*2, 11*2,
16*2, 23*2, 33*2, 47*2,
63*2, 85*2, 114*2, 511 }; /*note: the last value (511) is not a true energy value, it's just a stop-sentinel */
/* This is the tms5110 pitchtable */
const static unsigned short pitchtable [0x20]={
0, 15, 16, 17,
19, 21, 22, 25,
26, 29, 32, 36,
40, 42, 46, 50,
55, 60, 64, 68,
72, 76, 80, 84,
86, 93, 101, 110,
120, 132, 144, 159 };
/* These are the reflection coefficient lookup tables */
/* K1 is (5-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k1table[0x20] = {
-501*64, -498*64, -497*64, -495*64,
-493*64, -491*64, -488*64, -482*64,
-478*64, -474*64, -469*64, -464*64,
-459*64, -452*64, -445*64, -437*64,
-412*64, -380*64, -339*64, -288*64,
-227*64, -158*64, -81*64, -1*64,
80*64, 157*64, 226*64, 287*64,
337*64, 379*64, 411*64, 436*64 };
/* K2 is (5-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k2table[0x20] = {
-328*64, -303*64, -274*64, -244*64,
-211*64, -175*64, -138*64, -99*64,
-59*64, -18*64, 24*64, 64*64,
105*64, 143*64, 180*64, 215*64,
248*64, 278*64, 306*64, 331*64,
354*64, 374*64, 392*64, 408*64,
422*64, 435*64, 445*64, 455*64,
463*64, 470*64, 476*64, 506*64 };
/* K3 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k3table[0x10] = {
-441*64, -387*64, -333*64, -279*64,
-225*64, -171*64, -117*64, -63*64,
-9*64, 45*64, 98*64, 152*64,
206*64, 260*64, 314*64, 368*64 };
/* K4 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k4table[0x10] = {
-328*64, -273*64, -217*64, -161*64,
-106*64, -50*64, 5*64, 61*64,
116*64, 172*64, 228*64, 283*64,
339*64, 394*64, 450*64, 506*64 };
/* K5 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k5table[0x10] = {
-328*64, -282*64, -235*64, -189*64,
-142*64, -96*64, -50*64, -3*64,
43*64, 90*64, 136*64, 182*64,
229*64, 275*64, 322*64, 368*64 };
/* K6 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k6table[0x10] = {
-256*64, -212*64, -168*64, -123*64,
-79*64, -35*64, 10*64, 54*64,
98*64, 143*64, 187*64, 232*64,
276*64, 320*64, 365*64, 409*64 };
/* K7 is (4-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k7table[0x10] = {
-308*64, -260*64, -212*64, -164*64,
-117*64, -69*64, -21*64, 27*64,
75*64, 122*64, 170*64, 218*64,
266*64, 314*64, 361*64, 409*64 };
/* K8 is (3-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k8table[0x08] = {
-256*64, -161*64, -66*64, 29*64,
124*64, 219*64, 314*64, 409*64 };
/* K9 is (3-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k9table[0x08] = {
-256*64, -176*64, -96*64, -15*64,
65*64, 146*64, 226*64, 307*64 };
/* K10 is (3-bits -> 9 bits+sign, 2's comp. fractional (-1 < x < 1) */
const static int k10table[0x08] = {
-205*64, -132*64, -59*64, 14*64,
87*64, 160*64, 234*64, 307*64 };
/* chirp table */
const static signed char chirptable[51] = {
0x00, 0x2a, (char)0xd4, 0x32,
(char)0xb2, 0x12, 0x25, 0x14,
0x02, (char)0xe1, (char)0xc5, 0x02,
0x5f, 0x5a, 0x05, 0x0f,
0x26, (char)0xfc, (char)0xa5, (char)0xa5,
(char)0xd6, (char)0xdd, (char)0xdc, (char)0xfc,
0x25, 0x2b, 0x22, 0x21,
0x0f, (char)0xff, (char)0xf8, (char)0xee,
(char)0xed, (char)0xef, (char)0xf7, (char)0xf6,
(char)0xfa, 0x00, 0x03, 0x02,
0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00
static const struct tms5100_coeffs tms5110_coeff =
{
/* subtype */
SUBTYPE_TMS5110,
10,
4,
5,
{ 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
/* E */
{ 0, 1, 2, 3, 4, 6, 8, 11,
16, 23, 33, 47, 63, 85, 114, 511 },
/* P */
{ 0, 15, 16, 17, 19, 21, 22, 25,
26, 29, 32, 36, 40, 42, 46, 50,
55, 60, 64, 68, 72, 76, 80, 84,
86, 93, 101, 110, 120, 132, 144, 159 },
{
/* K1 */
{ -501, -498, -497, -495, -493, -491, -488, -482,
-478, -474, -469, -464, -459, -452, -445, -437,
-412, -380, -339, -288, -227, -158, -81, -1,
80, 157, 226, 287, 337, 379, 411, 436 },
/* K2 */
{ -328, -303, -274, -244, -211, -175, -138, -99,
-59, -18, 24, 64, 105, 143, 180, 215,
248, 278, 306, 331, 354, 374, 392, 408,
422, 435, 445, 455, 463, 470, 476, 506 },
/* K3 */
{ -441, -387, -333, -279, -225, -171, -117, -63,
-9, 45, 98, 152, 206, 260, 314, 368 },
/* K4 */
{ -328, -273, -217, -161, -106, -50, 5, 61,
116, 172, 228, 283, 339, 394, 450, 506 },
/* K5 */
{ -328, -282, -235, -189, -142, -96, -50, -3,
43, 90, 136, 182, 229, 275, 322, 368 },
/* K6 */
{ -256, -212, -168, -123, -79, -35, 10, 54,
98, 143, 187, 232, 276, 320, 365, 409 },
/* K7 */
{ -308, -260, -212, -164, -117, -69, -21, 27,
75, 122, 170, 218, 266, 314, 361, 409 },
/* K8 */
{ -256, -161, -66, 29, 124, 219, 314, 409 },
/* K9 */
{ -256, -176, -96, -15, 65, 146, 226, 307 },
/* K10 */
{ -205, -132, -59, 14, 87, 160, 234, 307 },
},
/* Chirptable */
{ 0, 42, -44, 50, -78, 18, 37, 20,
2, -31, -59, 2, 95, 90, 5, 15,
38, -4, -91,-91, -42,-35,-36, -4,
37, 43, 34, 33, 15, -1, -8,-18,
-19,-17, -9,-10, -6, 0, 3, 2,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0 },
/* interpolation coefficients */
{ 8, 8, 8, 4, 4, 4, 2, 1 }
};
/* interpolation coefficients */
const static char interp_coeff[8] = {
8, 8, 8, 4, 4, 2, 2, 1
};

View File

@ -6,7 +6,8 @@
#include "sound/discrete.h"
#include "sound/dac.h"
#include "sound/m58817.h"
#include "sound/tms5110.h"
#include "sound/5110intf.h"
#include "includes/dkong.h"
@ -16,13 +17,6 @@
*
****************************************************************/
/* Set to 1 to use speech synthesizer instead of samples.
* Disabled by default since M58817 emulation is not
* complete due to missing information about coefficients.
*/
#define RADARSC1_USE_M58817 (0)
#define ACTIVELOW_PORT_BIT(P,A,D) (((P) & (~(1 << (A)))) | (((D) ^ 1) << (A)))
/* Needed for dkongjr ... FIXME */
@ -80,7 +74,7 @@
/* General defines */
#define DK_1N5553_V 0.4 // from datasheet at 1mA
#define DK_1N5553_V 0.4 /* from datasheet at 1mA */
#define DK_SUP_V 5.0
#define NE555_INTERNAL_R RES_K(5)
@ -730,7 +724,8 @@ static SOUND_RESET( dkongjr )
http://www.freepatentsonline.com/4633500.html
@0x510, cpu2
Addresses found at @0x510, cpu2
10: 0000 00 00000000 ... 50 53 01010000 01010011 "scramble"
12: 007a 44 01000100 ... 00 0f 00000000 00001111 "all pilots climb up"
14: 018b 13 00010011 ... dc f0 11011100 11110000
@ -762,14 +757,61 @@ http://www.freepatentsonline.com/4633500.html
5: 10 10 10 trouble, trouble, trouble
6: 12 12 all pilots climb up
7: 20 engine trouble
PA5 ==> CS 28
PA4 ==> PDC 2
PA0 ==> CTL1 25
PA1 ==> CTL2 23
PA2 ==> CTL4 20
PA3 ==> CTL8 27
M1 19 ==> PA6 M1 on TMS5100
12,13 Speaker
7,8 Xin, Xout (5100: RC-OSC, T11)
24 A0 (5100: ADD1)
22 A1 (5100: ADD2)
22 A2 (5100: ADD4)
26 A3 (5100: ADD8)
16 C0 (5100: NC)
18 C1 (5100: NC)
3 CLK (5100: ROM-CK)
For documentation purposes:
Addresses
{ 0x0000, 0x007a, 0x018b, 0x0320, 0x036c, 0x03c4, 0x041c, 0x0520, 0x063e }
and related samples interface
static const char *const radarsc1_sample_names[] =
{
"*radarsc1",
"10.wav",
"12.wav",
"14.wav",
"16.wav",
"18.wav",
"1A.wav",
"1C.wav",
"1E.wav",
"20.wav",
0
};
static const struct Samplesinterface radarsc1_samples_interface =
{
8,
radarsc1_sample_names
};
*/
static WRITE8_HANDLER( M58817_command_w )
{
logerror("PA Write %x\n", data);
m58817_CTL_w(0, data & 0x0f);
m58817_DRQ_w(0, (data>>4) & 0x01); // FIXME 0x20 ??
tms5110_CTL_w(0, data & 0x0f);
tms5110_PDC_w(0, (data>>4) & 0x01);
// FIXME 0x20 is CS
}
/****************************************************************
@ -803,12 +845,15 @@ static READ8_HANDLER( dkong_sh_tune_r )
dkong_state *state = Machine->driver_data;
UINT8 *SND = memory_region(REGION_CPU2);
if ( state->page & 0x40 )
if ( state->page & 0x40 )
{
return soundlatch_r(0) & 0x0F;
}
else
{
printf("rom access at pc = %4x\n",activecpu_get_pc());
return (SND[0x1000+(state->page & 7)*256+offset]);
}
}
static READ8_HANDLER( dkongjr_sh_tune_r )
@ -840,7 +885,7 @@ static READ8_HANDLER( radarsc1_sh_p1_r )
{
int r;
r = (I8035_P1_R() & 0x80) | (m58817_status_r(0)<<6);
r = (I8035_P1_R() & 0x80) | (tms5110_status_r(0)<<6);
return r;
}
@ -982,22 +1027,22 @@ WRITE8_HANDLER( dkongjr_snd_w1 )
case 3: /* Port 3 write ==> PB 5 */
I8035_P2_W_AL(5,data & 1);
break;
#if 0 // above verified from schematics
#if 0 // above verified from schematics
case 3: /* roar */
if (data)
sample_start (7,2,0);
break;
#endif
case 4: /* Port 4 write */
I8035_T_W_AL(1, data & 1);
I8035_T_W_AL(1, data & 1);
break;
case 5: /* Port 5 write */
I8035_T_W_AL(0, data & 1);
I8035_T_W_AL(0, data & 1);
break;
case 6: /* Port 6 write ==> PB 4 */
I8035_P2_W_AL(4,data & 1);
break;
#if 0 // above verified from schematics
#if 0 // above verified from schematics
case 6: /* snapjaw */
if (data)
sample_stop (7);
@ -1022,7 +1067,7 @@ WRITE8_HANDLER( dkongjr_snd_w2 )
case 0:
dkong_audio_irq_w(0, data & 1);
break;
#if 0 // above verified from schematics
#if 0 // above verified from schematics
case 0: /* death */
if (data)
sample_stop (7);
@ -1038,8 +1083,6 @@ WRITE8_HANDLER( dkongjr_snd_w2 )
}
}
/*************************************
*
* Sound CPU memory handlers
@ -1123,42 +1166,16 @@ static const struct Samplesinterface dkongjr_samples_interface =
dkongjr_sample_names
};
#if !RADARSC1_USE_M58817
static const char *const radarsc1_sample_names[] =
{
"*radarsc1",
"10.wav",
"12.wav",
"14.wav",
"16.wav",
"18.wav",
"1A.wav",
"1C.wav",
"1E.wav",
"20.wav",
0 /* end of array */
};
static const struct Samplesinterface radarsc1_samples_interface =
{
8, /* 8 channels */
radarsc1_sample_names
};
#endif
static const struct NESinterface nes_interface_1 = { REGION_CPU2 };
static const struct NESinterface nes_interface_2 = { REGION_CPU3 };
static const struct M58817interface m58817_interface =
static struct TMS5110interface tms5110_interface =
{
#if !RADARSC1_USE_M58817
-1,
#else
TMS5110_IS_M58817,
REGION_SOUND1, /* Sample Rom */
#endif
{ 0x0000, 0x007a, 0x018b, 0x0320, 0x036c, 0x03c4, 0x041c, 0x0520, 0x063e } /* sample address map */
NULL,
NULL
};
/*************************************
*
* Machine driver
@ -1186,7 +1203,7 @@ MACHINE_DRIVER_START( radarscp_audio )
MDRV_IMPORT_FROM( dkong2b_audio )
MDRV_SOUND_MODIFY("discrete")
MDRV_SOUND_CONFIG_DISCRETE(radarscp)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.7)
MACHINE_DRIVER_END
@ -1199,15 +1216,9 @@ MACHINE_DRIVER_START( radarsc1_audio )
MDRV_SOUND_START(radarsc1)
MDRV_SOUND_ADD(M58817, 640000)
MDRV_SOUND_CONFIG(m58817_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.7)
#if !RADARSC1_USE_M58817
MDRV_SOUND_ADD(SAMPLES, 0)
MDRV_SOUND_CONFIG(radarsc1_samples_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 3.0)
#endif
MDRV_SOUND_ADD(TMS5110, 640000)
MDRV_SOUND_CONFIG(tms5110_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END

View File

@ -555,7 +555,8 @@ static const struct AY8910interface ay8910_interface =
static const struct TMS5110interface tms5110_interface =
{
0, /*irq callback function*/
TMS5110_IS_5110A,
-1, /* ROM_REGION */
bagman_speech_rom_read_bit /*M0 callback function. Called whenever chip requests a single bit of data*/
};

View File

@ -221,7 +221,9 @@ static READ8_HANDLER( cvs_393hz_Clock_r )
static const struct TMS5110interface tms5110_interface =
{
0, /*irq callback function*/
//TMS5110_IS_5110A,
TMS5110_IS_5100,
-1, /* ROM Region */
cvs_speech_rom_read_bit /*M0 callback function. Called whenever chip requests a single bit of data*/
};

View File

@ -1975,7 +1975,8 @@ static const struct AY8910interface triplep_ay8910_interface =
static const struct TMS5110interface tms5110_interface =
{
0, /* irq callback function */
TMS5110_IS_5110A,
-1, /* rom_region */
ad2083_speech_rom_read_bit /* M0 callback function. Called whenever chip requests a single bit of data */
};

View File

@ -287,7 +287,6 @@ SOUNDS += RF5C400
SOUNDS += SPEAKER
SOUNDS += CDP1869
SOUNDS += S14001A
SOUNDS += M58817
SOUNDS += BEEP
#SOUNDS += WAVE
#SOUNDS += SID6581