summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/tanbus/bullsnd.cpp
blob: 937113f2a6523dc2f6e63680cd50d4c011db180a (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
101
102
103
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    Microtan Bulldog Sound Generator Board

    http://www.microtan.ukpc.net/pageProducts.html#SOUND

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


#include "emu.h"
#include "bullsnd.h"
#include "speaker.h"


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

DEFINE_DEVICE_TYPE(TANBUS_BULLSND, tanbus_bullsnd_device, "tanbus_bullsnd", "Microtan Bulldog Sound Generator Board")

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

void tanbus_bullsnd_device::device_add_mconfig(machine_config &config)
{
	SPEAKER(config, "speaker").front_center();
	AY8910(config, m_ay8910[0], DERIVED_CLOCK(1, 8)).add_route(ALL_OUTPUTS, "speaker", 0.5);
	AY8910(config, m_ay8910[1], DERIVED_CLOCK(1, 8)).add_route(ALL_OUTPUTS, "speaker", 0.5);
}


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

//-------------------------------------------------
//  tanbus_bullsnd_device - constructor
//-------------------------------------------------

tanbus_bullsnd_device::tanbus_bullsnd_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock)
	: device_t(mconfig, TANBUS_BULLSND, tag, owner, clock)
	, device_tanbus_interface(mconfig, *this)
	, m_ay8910(*this, "ay8910%u", 0)
{
}


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

void tanbus_bullsnd_device::device_start()
{
}


//-------------------------------------------------
//  read - card read
//-------------------------------------------------

uint8_t tanbus_bullsnd_device::read(offs_t offset, int inhrom, int inhram, int be)
{
	uint8_t data = 0xff;

	switch (offset)
	{
	case 0xbc01:
		data = m_ay8910[0]->data_r();
		break;
	case 0xbc03:
		data = m_ay8910[1]->data_r();
		break;
	}

	return data;
}


//-------------------------------------------------
//  write - card write
//-------------------------------------------------

void tanbus_bullsnd_device::write(offs_t offset, uint8_t data, int inhrom, int inhram, int be)
{
	switch (offset)
	{
	case 0xbc00:
		m_ay8910[0]->address_w(data);
		break;
	case 0xbc01:
		m_ay8910[0]->data_w(data);
		break;
	case 0xbc02:
		m_ay8910[1]->address_w(data);
		break;
	case 0xbc03:
		m_ay8910[1]->data_w(data);
		break;
	}
}