summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound/tms5110.h
blob: a6a3e095e6b9e40a513237839d33de75b084388d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once

#ifndef __TMS5110_H__
#define __TMS5110_H__

/* TMS5110 commands */
                                     /* CTL8  CTL4  CTL2  CTL1  |   PDC's  */
                                     /* (MSB)             (LSB) | required */
#define TMS5110_CMD_RESET        (0) /*    0     0     0     x  |     1    */
#define TMS5110_CMD_LOAD_ADDRESS (2) /*    0     0     1     x  |     2    */
#define TMS5110_CMD_OUTPUT       (4) /*    0     1     0     x  |     3    */
#define TMS5110_CMD_SPKSLOW      (6) /*    0     1     1     x  |     1    | Note: this command is undocumented on the datasheets, it only appears on the patents. It might not actually work properly on some of the real chips as manufactured. Acts the same as CMD_SPEAK, but makes the interpolator take two A cycles whereever it would normally only take one, effectively making speech of any given word take about twice as long as normal. */
#define TMS5110_CMD_READ_BIT     (8) /*    1     0     0     x  |     1    */
#define TMS5110_CMD_SPEAK       (10) /*    1     0     1     x  |     1    */
#define TMS5110_CMD_READ_BRANCH (12) /*    1     1     0     x  |     1    */
#define TMS5110_CMD_TEST_TALK   (14) /*    1     1     1     x  |     3    */

/* clock rate = 80 * output sample rate,     */
/* usually 640000 for 8000 Hz sample rate or */
/* usually 800000 for 10000 Hz sample rate.  */

typedef struct _tms5110_interface tms5110_interface;
struct _tms5110_interface
{
	/* legacy interface */
	int (*M0_callback)(running_device *device);	/* function to be called when chip requests another bit */
	void (*load_address)(running_device *device, int addr);	/* speech ROM load address callback */
	/* new rom controller interface */
	devcb_write_line m0_func;		/* the M0 line */
	devcb_write_line m1_func;		/* the M1 line */
	devcb_write8 address_func;		/* Write to ADD1,2,4,8 - 4 address bits */
	devcb_read_line data_func;		/* Read one bit from ADD8/Data - voice data */
	/* on a real chip rom_clk is running all the time
	 * Here, we only use it to properly emulate the protocol.
	 * Do not rely on it to be a timed signal.
	 */
	devcb_write_line rom_clk_func;	/* rom_clk - Only used to drive the data lines */
};

WRITE8_DEVICE_HANDLER( tms5110_ctl_w );
READ8_DEVICE_HANDLER( tms5110_ctl_r );
WRITE8_DEVICE_HANDLER( tms5110_pdc_w );

/* this is only used by cvs.c
 * it is not related at all to the speech generation
 * and conflicts with the new rom controller interface.
 */
READ8_DEVICE_HANDLER( tms5110_romclk_hack_r );

/* m58817 status line */
READ8_DEVICE_HANDLER( m58817_status_r );

int tms5110_ready_r(running_device *device);

void tms5110_set_frequency(running_device *device, int frequency);

DEVICE_GET_INFO( tms5110 );
DEVICE_GET_INFO( tms5100 );
DEVICE_GET_INFO( tms5110a );
DEVICE_GET_INFO( cd2801 );
DEVICE_GET_INFO( tmc0281 );
DEVICE_GET_INFO( cd2802 );
DEVICE_GET_INFO( m58817 );

#define SOUND_TMS5110 DEVICE_GET_INFO_NAME( tms5110 )
#define SOUND_TMS5100 DEVICE_GET_INFO_NAME( tms5100 )
#define SOUND_TMS5110A DEVICE_GET_INFO_NAME( tms5110a )
#define SOUND_CD2801 DEVICE_GET_INFO_NAME( cd2801 )
#define SOUND_TMC0281 DEVICE_GET_INFO_NAME( tmc0281 )
#define SOUND_CD2802 DEVICE_GET_INFO_NAME( cd2802 )
#define SOUND_M58817 DEVICE_GET_INFO_NAME( m58817 )


#endif /* __TMS5110_H__ */