summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/electron/voxbox.cpp
blob: 15cdb09437f32413613cab8b61a9798bdab5dd8b (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
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
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    Millsgrade Voxbox Speech Synthesiser

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

#include "emu.h"
#include "voxbox.h"
#include "speaker.h"


//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE(ELECTRON_VOXBOX, electron_voxbox_device, "electron_voxbox", "Millsgrade Voxbox Speech Synthesiser")


//-------------------------------------------------
//  ROM( voxbox )
//-------------------------------------------------

ROM_START( voxbox )
	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 *electron_voxbox_device::device_rom_region() const
{
	return ROM_NAME( voxbox );
}


//-------------------------------------------------
//  device_add_mconfig - add device configuration
//-------------------------------------------------

void electron_voxbox_device::device_add_mconfig(machine_config &config)
{
	SPEAKER(config, "mono").front_center();
	SP0256(config, m_nsp, DERIVED_CLOCK(1, 4));
	m_nsp->data_request_callback().set(FUNC(electron_voxbox_device::lrq_cb));
	m_nsp->add_route(ALL_OUTPUTS, "mono", 1.0);
}


//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  electron_voxbox_device - constructor
//-------------------------------------------------

electron_voxbox_device::electron_voxbox_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, ELECTRON_VOXBOX, tag, owner, clock)
	, device_electron_expansion_interface(mconfig, *this)
	, m_nsp(*this, "sp0256")
	, m_nmi(1)
{
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void electron_voxbox_device::device_start()
{
	save_item(NAME(m_nmi));
}


//-------------------------------------------------
//  expbus_w - expansion data write
//-------------------------------------------------

void electron_voxbox_device::expbus_w(offs_t offset, uint8_t data)
{
	if ((offset & 0xff00) == 0xc000)
	{
		m_nsp->ald_w(offset & 0x3f);
	}
}

void electron_voxbox_device::lrq_cb(int state)
{
	if (state != m_nmi)
	{
		m_nmi = state;
		m_slot->nmi_w(state);
	}
}