mirror of
https://github.com/holub/mame
synced 2025-05-19 20:29:09 +03:00
"Replaced" TMS5220 table with table extracted using PROMOUT from actual chip.
By 'Replaced', I mean documented, as the actual extracted table exactly matched the table already in MAME. Changed TMS5220C to use the same energy table as 5220 does, since my previous assumption based on the Quadravox tables was probably wrong. Updated the ranout condition code of tms5220.c to be slightly more accurate to the chip, and added TODOs. Re-enabled the timers for deactivating the READY line on /WS or /RS as this is probably slightly more accurate to hardware, but the difference is 2 or 3 clock cycles max. [Lord Nightmare]
This commit is contained in:
parent
ca0f74f334
commit
4e547ebef5
@ -196,7 +196,7 @@ static const struct tms5100_coeffs pat4403965_coeff =
|
|||||||
{ 3, 3, 3, 2, 2, 2, 1, 0 }
|
{ 3, 3, 3, 2, 2, 2, 1, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The following TMS5110A LPC coefficients were read from an actual chip by Jarek Burczynski using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still came from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it.
|
/* The following TMS5110A LPC coefficients were directly read from an actual TMS5110A chip by Jarek Burczynski using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still come from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it.
|
||||||
*/
|
*/
|
||||||
static const struct tms5100_coeffs tms5110a_coeff =
|
static const struct tms5100_coeffs tms5110a_coeff =
|
||||||
{
|
{
|
||||||
@ -259,7 +259,8 @@ static const struct tms5100_coeffs tms5110a_coeff =
|
|||||||
{ 3, 3, 3, 2, 2, 2, 1, 0 }
|
{ 3, 3, 3, 2, 2, 2, 1, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The following TMS5200/TMC0285 coefficients have been directly dumped from a real TMS5200 chip by Lord Nightmare, and can be regarded as established fact. Note that the K coefficients are VERY different from the coefficients given in the US 4,335,277 patent, which may have been for some sort of prototype or otherwise intentionally scrambled. The energy and pitch tables, however, are identical to the patent. */
|
/* The following TMS5200/TMC0285 coefficients were directly read from an actual TMS5200 chip by Lord Nightmare using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still come from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it.
|
||||||
|
Note that the K coefficients are VERY different from the coefficients given in the US 4,335,277 patent, which may have been for some sort of prototype or otherwise intentionally scrambled. The energy and pitch tables, however, are identical to the patent. */
|
||||||
static const struct tms5100_coeffs tms5200_coeff =
|
static const struct tms5100_coeffs tms5200_coeff =
|
||||||
{
|
{
|
||||||
/* subtype */
|
/* subtype */
|
||||||
@ -325,9 +326,9 @@ static const struct tms5100_coeffs tms5200_coeff =
|
|||||||
{ 3, 3, 3, 2, 2, 2, 1, 0 }
|
{ 3, 3, 3, 2, 2, 2, 1, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The following TMS5220 coefficients come from the datasheet, and its addendum, with the exception of the energy table. The energy table is copied from the TMS5110a dump and the TMS5200 patent (which are both the same for energy), as the datasheet lists it in RMS notation which doesn't help us since I(Lord Nightmare) can't figure out the proper formula TI used for converting energy to RMS (the obvious 'take all the values in the chirp ROM, multiply them by 1/2/3/4/etc, square each one, sum them up, divide by 51, which is # of ROM entries in chirp ROM, and take the square root of the result', doesn't QUITE work. It almost does, if you add 16 to the result, for the first 4 entries, but beyond that the entries become farther and farther offset).
|
/* The following TMS5220 coefficients were directly read from an actual TMS5220 chip by Lord Nightmare using the PROMOUT pin, and can be regarded as established fact. However, the chirp table and the interpolation coefficients still come from the patents as there doesn't seem to be an easy way to read those out from the chip without decapping it.
|
||||||
|
Note: The coefficients match those from the datasheet, and its addendum, with the exception of the energy table. The energy table on the datasheet (and in the QV5220.COD from qboxpro) lists it in RMS notation which doesn't help us since I(Lord Nightmare) can't figure out the proper formula TI used for converting energy to RMS (the obvious 'take all the values in the chirp ROM, multiply them by 1/2/3/4/etc, square each one, sum them up, divide by 51, which is # of ROM entries in chirp ROM, and take the square root of the result', doesn't QUITE work. It almost does, if you add 16 to the result, for the first 4 entries, but beyond that the entries become farther and farther offset).
|
||||||
Note that all the LPC K* values match the TMS5110a table exactly.
|
Note that all the LPC K* values match the TMS5110a table exactly.
|
||||||
***These values have not yet been verified against a real TMS5220***
|
|
||||||
*/
|
*/
|
||||||
static const struct tms5100_coeffs tms5220_coeff =
|
static const struct tms5100_coeffs tms5220_coeff =
|
||||||
{
|
{
|
||||||
@ -338,8 +339,8 @@ static const struct tms5100_coeffs tms5220_coeff =
|
|||||||
6,
|
6,
|
||||||
{ 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
|
{ 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
|
||||||
/* E */
|
/* E */
|
||||||
{ 0, 1, 2, 3, 4, 6, 8, 11,
|
{ 0, 1, 2, 3, 4, 6, 8, 11,
|
||||||
16, 23, 33, 47, 63, 85, 114, 511 }, /* last value is actually 0 in ROM, but 511 is stop sentinel */
|
16, 23, 33, 47, 63, 85, 114, 511 }, /* last value is actually ? in ROM, but 511 is stop sentinel */
|
||||||
/* P */
|
/* P */
|
||||||
{ 0, 15, 16, 17, 18, 19, 20, 21,
|
{ 0, 15, 16, 17, 18, 19, 20, 21,
|
||||||
22, 23, 24, 25, 26, 27, 28, 29,
|
22, 23, 24, 25, 26, 27, 28, 29,
|
||||||
@ -362,7 +363,7 @@ static const struct tms5100_coeffs tms5220_coeff =
|
|||||||
422, 435, 445, 455, 463, 470, 476, 506 },
|
422, 435, 445, 455, 463, 470, 476, 506 },
|
||||||
/* K3 */
|
/* K3 */
|
||||||
{ -441, -387, -333, -279, -225, -171, -117, -63,
|
{ -441, -387, -333, -279, -225, -171, -117, -63,
|
||||||
-9, 45, 98, 152, 206, 260, 314, 368 },
|
-9, 45, 98, 152, 206, 260, 314, 368 },
|
||||||
/* K4 */
|
/* K4 */
|
||||||
{ -328, -273, -217, -161, -106, -50, 5, 61,
|
{ -328, -273, -217, -161, -106, -50, 5, 61,
|
||||||
116, 172, 228, 283, 339, 394, 450, 506 },
|
116, 172, 228, 283, 339, 394, 450, 506 },
|
||||||
@ -371,16 +372,16 @@ static const struct tms5100_coeffs tms5220_coeff =
|
|||||||
43, 90, 136, 182, 229, 275, 322, 368 },
|
43, 90, 136, 182, 229, 275, 322, 368 },
|
||||||
/* K6 */
|
/* K6 */
|
||||||
{ -256, -212, -168, -123, -79, -35, 10, 54,
|
{ -256, -212, -168, -123, -79, -35, 10, 54,
|
||||||
98, 143, 187, 232, 276, 320, 365, 409 },
|
98, 143, 187, 232, 276, 320, 365, 409 },
|
||||||
/* K7 */
|
/* K7 */
|
||||||
{ -308, -260, -212, -164, -117, -69, -21, 27,
|
{ -308, -260, -212, -164, -117, -69, -21, 27,
|
||||||
75, 122, 170, 218, 266, 314, 361, 409 },
|
75, 122, 170, 218, 266, 314, 361, 409 },
|
||||||
/* K8 */
|
/* K8 */
|
||||||
{ -256, -161, -66, 29, 124, 219, 314, 409 },
|
{ -256, -161, -66, 29, 124, 219, 314, 409 },
|
||||||
/* K9 */
|
/* K9 */
|
||||||
{ -256, -176, -96, -15, 65, 146, 226, 307 },
|
{ -256, -176, -96, -15, 65, 146, 226, 307 },
|
||||||
/* K10 */
|
/* K10 */
|
||||||
{ -205, -132, -59, 14, 87, 160, 234, 307 },
|
{ -205, -132, -59, 14, 87, 160, 234, 307 },
|
||||||
},
|
},
|
||||||
/* Chirp table */
|
/* Chirp table */
|
||||||
{ 0, 42, -44, 50, -78, 18, 37, 20,
|
{ 0, 42, -44, 50, -78, 18, 37, 20,
|
||||||
@ -395,8 +396,7 @@ static const struct tms5100_coeffs tms5220_coeff =
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* The following TMS5220C coefficients come from the tables in QBOXPRO, a program written at least in part by George "Larry" Brantingham of Quadravox, formerly of Texas Instruments, who had laid out the silicon for the TMS5100/TMC0280/CD2801. It is the same as the TMS5220 but has a change in the energy table (is this actually correct? or is this one correct for both 5220s? or is this the wrong table and the TMS5220 one correct for both?)
|
/* The following TMS5220C coefficients come from the tables in QBOXPRO, a program written at least in part by George "Larry" Brantingham of Quadravox, formerly of Texas Instruments, who had laid out the silicon for the TMS5100/TMC0280/CD2801. It is the same as the TMS5220 but has a change in the energy table (is this actually correct? or is this one correct for both 5220s? or is this the wrong table and the TMS5220 one correct for both?)
|
||||||
Note: the energy table in QBOXPRO is also in RMS and was not used; however the energy values are offset by -1 compared to the 5220, which has been done here. the '152' is an educated guess.
|
Note: the energy table in QV5220.COD is also in RMS and was not used (it also may well be incorrect; the values in QV5220.COD have an offset by one index which looks wrong), instead the table from the 5200/5220 is used here.
|
||||||
Note: the pitch table is the same as TMS5220 but with +1 applied to each value, and the first and second values the same, as shown in QV5220.COD.
|
|
||||||
Note: the Kx tables are taken directly from QV5220.COD but with /64 added to each value as the values are stored ranging from -32768 to 32767 in QBOXPRO instead of -512 to 511 as on the real chip.
|
Note: the Kx tables are taken directly from QV5220.COD but with /64 added to each value as the values are stored ranging from -32768 to 32767 in QBOXPRO instead of -512 to 511 as on the real chip.
|
||||||
***These values have not yet been verified against a real TMS5220C, see below as for why***
|
***These values have not yet been verified against a real TMS5220C, see below as for why***
|
||||||
This has not yet been verified against a real TMS5220C, and doing so will require decapping one as the TMS5220C, unlike the TMS5220, has a nonfunctional PROMOUT pin. This makes reading the internal LPC tables out electronically (via PROMOUT) impossible.
|
This has not yet been verified against a real TMS5220C, and doing so will require decapping one as the TMS5220C, unlike the TMS5220, has a nonfunctional PROMOUT pin. This makes reading the internal LPC tables out electronically (via PROMOUT) impossible.
|
||||||
@ -410,10 +410,10 @@ static const struct tms5100_coeffs tms5220c_coeff =
|
|||||||
6,
|
6,
|
||||||
{ 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
|
{ 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
|
||||||
/* E */
|
/* E */
|
||||||
{ 0, 2, 3, 4, 6, 8, 11, 16, // first value is really 1, but must be 0 for zero energy frames to work properly
|
{ 0, 1, 2, 3, 4, 6, 8, 11,
|
||||||
23, 33, 47, 63, 85, 114, 152, 511 }, /* last value is actually 0 in ROM, but 511 is stop sentinel */
|
16, 23, 33, 47, 63, 85, 114, 511 }, /* last value is actually ? in ROM, but 511 is stop sentinel */
|
||||||
//{ 0x0d, 0x16, 0x20, 0x2d, 0x40, 0x5b, 0x81, 0xb6,
|
//{ 0x0d, 0x16, 0x20, 0x2d, 0x40, 0x5b, 0x81, 0xb6,
|
||||||
// 0x101, 0x16c, 0x202, 0x2d6, 0x402, 0x5a9, 0x7ff, 511 }, /* last value is actually 0 in ROM, but 511 is stop sentinel */
|
// 0x101, 0x16c, 0x202, 0x2d6, 0x402, 0x5a9, 0x7ff, 511 }, /* values from 5220_10.bin code for the tms50c10; last value is actually 0 in ROM, but 511 is stop sentinel */
|
||||||
/* P */
|
/* P */
|
||||||
{ 0, 16, 17, 18, 19, 20, 21, 22, // first value is 16 in QV5220.COD but must be 0 for unvoiced speech to work properly
|
{ 0, 16, 17, 18, 19, 20, 21, 22, // first value is 16 in QV5220.COD but must be 0 for unvoiced speech to work properly
|
||||||
23, 24, 25, 26, 27, 28, 29, 30,
|
23, 24, 25, 26, 27, 28, 29, 30,
|
||||||
|
@ -42,13 +42,14 @@ Note the standard naming for d* data bits with 7 as MSB and 0 as LSB is in lower
|
|||||||
TI's naming has D7 as LSB and D0 as MSB and is in uppercase
|
TI's naming has D7 as LSB and D0 as MSB and is in uppercase
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
Implement a ready callback for pc interfaces
|
* Implement a ready callback for pc interfaces
|
||||||
- this will be quite a challenge since for it to be really accurate
|
- this will be quite a challenge since for it to be really accurate
|
||||||
the whole emulation has to run in sync (lots of timers) with the
|
the whole emulation has to run in sync (lots of timers) with the
|
||||||
cpu cores.
|
cpu cores.
|
||||||
If a command is still executing, /READY will be kept high until the command has
|
* If a command is still executing, /READY will be kept high until the command has
|
||||||
finished if the next command is written.
|
finished if the next command is written.
|
||||||
tomcat has a 5220 which is not hooked up at all
|
* tomcat has a 5220 which is not hooked up at all
|
||||||
|
* the ranout: target in parse_frame isn't very accurate to hardware
|
||||||
|
|
||||||
Progress list for drivers using old vs new interface:
|
Progress list for drivers using old vs new interface:
|
||||||
starwars: uses new interface (couriersud)
|
starwars: uses new interface (couriersud)
|
||||||
@ -58,7 +59,7 @@ atarisy2: uses new interface (Lord Nightmare)
|
|||||||
atarijsa: uses new interface (Lord Nightmare)
|
atarijsa: uses new interface (Lord Nightmare)
|
||||||
firefox: uses new interface (couriersud)
|
firefox: uses new interface (couriersud)
|
||||||
mhavoc: uses old interface, and is in the machine file instead of the driver.
|
mhavoc: uses old interface, and is in the machine file instead of the driver.
|
||||||
monymony(zaccaria.c): uses new interface (couriersud)
|
monymony/jackrabt(zaccaria.c): uses new interface (couriersud)
|
||||||
victory(audio/exidy.c): uses new interface (couriersud)
|
victory(audio/exidy.c): uses new interface (couriersud)
|
||||||
looping: uses old interface
|
looping: uses old interface
|
||||||
portraits: uses *NO* interface; the i/o cpu hasn't been hooked to anything!
|
portraits: uses *NO* interface; the i/o cpu hasn't been hooked to anything!
|
||||||
@ -68,6 +69,12 @@ Notes:
|
|||||||
Looping has the tms5220 hookep up directly to the cpu. However currently the
|
Looping has the tms5220 hookep up directly to the cpu. However currently the
|
||||||
tms9900 cpu core does not support a ready line.
|
tms9900 cpu core does not support a ready line.
|
||||||
|
|
||||||
|
Pedantic detail from observation of real chip:
|
||||||
|
The 5200 and 5220 chips outputs the following coefficients over PROMOUT while
|
||||||
|
'idle' and not speaking, in this order:
|
||||||
|
e[0] p[0] k1[0] k2[0] k3[0] k4[0] k5[f] k6[f] k7[f] k8[7] k9[7] k10[7]
|
||||||
|
|
||||||
|
|
||||||
Email from Lord Nightmare having a lot more detail follows:
|
Email from Lord Nightmare having a lot more detail follows:
|
||||||
|
|
||||||
Yes, there is at least two more differences:
|
Yes, there is at least two more differences:
|
||||||
@ -1260,15 +1267,14 @@ static void parse_frame(tms5220_state *tms)
|
|||||||
#ifdef DEBUG_FRAME_ERRORS
|
#ifdef DEBUG_FRAME_ERRORS
|
||||||
logerror("Ran out of bits on a parse!\n");
|
logerror("Ran out of bits on a parse!\n");
|
||||||
#endif
|
#endif
|
||||||
|
if (tms->speak_external != 1)
|
||||||
|
fatalerror("reached ranout when not in speak_external mode! should never happen! contact MAMEDEV!");
|
||||||
/* this is an error condition; mark the buffer empty and turn off speaking */
|
/* this is an error condition; mark the buffer empty and turn off speaking */
|
||||||
tms->buffer_empty = 1;
|
// TODO: stuff here needs to be made more accurate to hardware.
|
||||||
tms->talk_status = tms->speak_external = tms->speaking_now = 0;
|
tms->new_frame_energy = COEFF_ENERGY_SENTINEL; // technically this isn't right, but should work.
|
||||||
tms->fifo_count = tms->fifo_head = tms->fifo_tail = 0;
|
tms->fifo_count = tms->fifo_head = tms->fifo_tail = 0; // remove any leftover bits in the fifo. In reality the pull should happen with any missing bits ending up as zeroes and a buffer empty speech halt occurring immediately afterward.
|
||||||
|
update_status_and_ints(tms);
|
||||||
tms->RDB_flag = FALSE;
|
tms->speaking_now = tms->speak_external = 0; // just in case. should fix glitches in jackrabt
|
||||||
|
|
||||||
/* generate an interrupt since TS went low */
|
|
||||||
set_interrupt_state(tms, 1);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1476,12 +1482,12 @@ WRITE_LINE_DEVICE_HANDLER( tms5220_rsq_w )
|
|||||||
#ifdef DEBUG_RS_WS
|
#ifdef DEBUG_RS_WS
|
||||||
logerror("Schedule write ready\n");
|
logerror("Schedule write ready\n");
|
||||||
#endif
|
#endif
|
||||||
//tms->io_ready = 1;
|
tms->io_ready = 1;
|
||||||
///* 100 nsec from data sheet */
|
/* 100 nsec from data sheet */
|
||||||
//timer_set(tms->device->machine, ATTOTIME_IN_NSEC(100), tms, 0, io_ready_cb);
|
timer_set(tms->device->machine, ATTOTIME_IN_NSEC(100), tms, 0, io_ready_cb); // goes low nearly immediately, i.e. within 3 cycles
|
||||||
tms->io_ready = 0;
|
tms->io_ready = 0;
|
||||||
/* 25 usec in datasheet, but zaccaria won't work */
|
/* 25 usec in datasheet, but zaccaria won't work */
|
||||||
timer_set(tms->device->machine, ATTOTIME_IN_USEC(100), tms, 1, io_ready_cb);
|
timer_set(tms->device->machine, ATTOTIME_IN_USEC(100), tms, 1, io_ready_cb); // this should take around 12-15 cycles to complete
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1524,10 +1530,10 @@ WRITE_LINE_DEVICE_HANDLER( tms5220_wsq_w )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
///* high to low - schedule ready cycle*/
|
///* high to low - schedule ready cycle*/
|
||||||
//tms->io_ready = 1;
|
tms->io_ready = 1;
|
||||||
//timer_set(tms->device->machine, ATTOTIME_IN_NSEC(100), tms, 0, io_ready_cb);
|
timer_set(tms->device->machine, ATTOTIME_IN_NSEC(100), tms, 0, io_ready_cb); // goes low nearly immediately, i.e. within 3 ccyles
|
||||||
tms->io_ready = 0;
|
tms->io_ready = 0;
|
||||||
timer_set(tms->device->machine, ATTOTIME_IN_USEC(25), tms, 1, io_ready_cb);
|
timer_set(tms->device->machine, ATTOTIME_IN_USEC(25), tms, 1, io_ready_cb); // this should take around 12-15 cycles to complete
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user