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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes,Thomas Busse
/**********************************************************************
Spectrum Currah MicroSpeech emulation
**********************************************************************/
#include "emu.h"
#include "uspeech.h"
#include "speaker.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(SPECTRUM_USPEECH, spectrum_uspeech_device, "spectrum_uspeech", "Spectrum Currah \xC2\xB5Speech")
//-------------------------------------------------
// ROM( uspeech )
//-------------------------------------------------
ROM_START( uspeech )
ROM_REGION(0x0800, "rom", 0)
ROM_LOAD("currah.rom", 0x0000, 0x0800, CRC(ce7cf52e) SHA1(90dbba5afbf07949df9cbdcb0a8ec0b106340422))
ROM_REGION(0x10000, "sp0256", 0)
ROM_LOAD( "sp0256a-al2.bin", 0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) )
ROM_END
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
const tiny_rom_entry *spectrum_uspeech_device::device_rom_region() const
{
return ROM_NAME( uspeech );
}
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void spectrum_uspeech_device::device_add_mconfig(machine_config &config)
{
SPEAKER(config, "mono").front_center();
SP0256(config, m_nsp, 14_MHz_XTAL / 4);
m_nsp->add_route(ALL_OUTPUTS, "mono", 1.0);
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// spectrum_uspeech_device - constructor
//-------------------------------------------------
spectrum_uspeech_device::spectrum_uspeech_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, SPECTRUM_USPEECH, tag, owner, clock),
device_spectrum_expansion_interface(mconfig, *this),
m_nsp(*this, "sp0256"),
m_rom(*this, "rom")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void spectrum_uspeech_device::device_start()
{
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void spectrum_uspeech_device::device_reset()
{
m_romcs = 0;
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
READ_LINE_MEMBER(spectrum_uspeech_device::romcs)
{
return m_romcs;
}
uint8_t spectrum_uspeech_device::mreq_r(offs_t offset)
{
uint8_t data;
if (!machine().side_effects_disabled() && (offset == 0x38))
{
m_romcs = !m_romcs;
}
switch (offset)
{
case 0x1000:
data = !m_nsp->lrq_r(); // (m_nsp->lrq_r() && (m_nsp->sby_r() != 0)) ? 0x00 : 0x01;
break;
default:
data = m_rom->base()[offset & 0x7ff];
break;
}
return data;
}
void spectrum_uspeech_device::mreq_w(offs_t offset, uint8_t data)
{
switch (offset)
{
case 0x1000:
// allophone
m_nsp->ald_w(data & 0x3f);
break;
case 0x3000:
// intonation low
m_nsp->set_clock(3500000); // CK / 4 ??
break;
case 0x3001:
// intonation high
m_nsp->set_clock(3800000); // TODO: the exact frequency is unknown
break;
}
}
|