summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/acorn/atom/sid.cpp
blob: 950f4de2c5864be043c0ccce8e7d8946660c95dc (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
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    AtomSID emulation

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


#include "emu.h"
#include "sid.h"
#include "speaker.h"


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

DEFINE_DEVICE_TYPE(ATOM_SID, atom_sid_device, "atom_sid", "AtomSID")


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

void atom_sid_device::device_add_mconfig(machine_config &config)
{
	SPEAKER(config, "speaker").front_center();
	MOS6581(config, m_sid, 4_MHz_XTAL / 4);
	m_sid->add_route(ALL_OUTPUTS, "speaker", 1.0);
}


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

//-------------------------------------------------
//  atom_sid_device - constructor
//-------------------------------------------------

atom_sid_device::atom_sid_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, ATOM_SID, tag, owner, clock)
	, device_acorn_bus_interface(mconfig, *this)
	, m_sid(*this, "sid6581")
{
}


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

void atom_sid_device::device_start()
{
	address_space &space = m_bus->memspace();

	space.install_readwrite_handler(0xbdc0, 0xbddf, read8_delegate(FUNC(mos6581_device::read), m_sid.target()), write8_delegate(FUNC(mos6581_device::write), m_sid.target()));
}