summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/spectrum/specdrum.cpp
blob: 9c809a1b36a731b0872a7d0e6a7c433af8349bdf (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
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    Cheetah Marketing SpecDrum emulation

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

#include "emu.h"
#include "specdrum.h"
#include "sound/volt_reg.h"
#include "speaker.h"


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

DEFINE_DEVICE_TYPE(SPECTRUM_SPECDRUM, spectrum_specdrum_device, "spectrum_specdrum", "SpecDrum")


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

void spectrum_specdrum_device::device_add_mconfig(machine_config &config)
{
	SPEAKER(config, "speaker").front_center();
	ZN428E(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5);
	voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
	vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
	vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
}


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

//-------------------------------------------------
//  spectrum_specdrum_device - constructor
//-------------------------------------------------

spectrum_specdrum_device::spectrum_specdrum_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, SPECTRUM_SPECDRUM, tag, owner, clock)
	, device_spectrum_expansion_interface(mconfig, *this)
	, m_dac(*this, "dac")
{
}


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

void spectrum_specdrum_device::device_start()
{
}


//**************************************************************************
//  IMPLEMENTATION
//**************************************************************************

void spectrum_specdrum_device::iorq_w(offs_t offset, uint8_t data)
{
	switch (offset & 0x00ff)
	{
	case 0xdf:
		m_dac->write(data);
		break;
	}
}