summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/ti99/speech8.h
blob: ffcfabb89af3ef339385a3fa04f617616d2882ca (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
// license:MAME|LGPL-2.1+
// copyright-holders:Michael Zapf
/****************************************************************************

    TI-99/8 Speech Synthesizer
    See speech8.c for documentation

    Michael Zapf
    October 2010
    February 2012: Rewritten as class

*****************************************************************************/

#ifndef __TISPEECH8__
#define __TISPEECH8__

#include "emu.h"
#include "ti99defs.h"
#include "sound/tms5220.h"

extern const device_type TI99_SPEECH8;

#define MCFG_SPEECH8_READY_CALLBACK(_write) \
	devcb = &ti998_spsyn_device::set_ready_wr_callback(*device, DEVCB2_##_write);

class ti998_spsyn_device : public bus8z_device
{
public:
	ti998_spsyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	
	template<class _Object> static devcb2_base &set_ready_wr_callback(device_t &device, _Object object) { return downcast<ti998_spsyn_device &>(device).m_ready.set_callback(object); }

	DECLARE_READ8Z_MEMBER(readz);
	DECLARE_WRITE8_MEMBER(write);

	DECLARE_READ8Z_MEMBER(crureadz) { };
	DECLARE_WRITE8_MEMBER(cruwrite) { };

	DECLARE_WRITE_LINE_MEMBER( speech8_ready );

	DECLARE_READ8_MEMBER( spchrom_read );
	DECLARE_WRITE8_MEMBER( spchrom_load_address );
	DECLARE_WRITE8_MEMBER( spchrom_read_and_branch );

protected:
	virtual void    device_start();
	virtual void    device_reset(void);
	virtual const rom_entry *device_rom_region() const;
	virtual machine_config_constructor device_mconfig_additions() const;

private:
	tms5220_device  *m_vsp;
//  UINT8           *m_speechrom;           // pointer to speech ROM data
//  int             m_load_pointer;         // which 4-bit nibble will be affected by load address
//  int             m_rombits_count;        // current bit position in ROM
//  UINT32          m_sprom_address;        // 18 bit pointer in ROM
//  UINT32          m_sprom_length;         // length of data pointed by speechrom_data, from 0 to 2^18

	// Ready line to the CPU
	devcb2_write_line m_ready;
};

#define MCFG_TISPEECH8_ADD(_tag, _conf)     \
	MCFG_DEVICE_ADD(_tag, TI99_SPEECH8, 0)  \
	MCFG_DEVICE_CONFIG(_conf)

#endif