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

    JCB Sound Extension Module

    http://archive.worldofdragon.org/index.php?title=Dragon_32_Sound_Extension_Module

    The Dragon 32 Sound Extension Module is a cartridge by J.C.B. (Microsystems),
    that contains a General Instruments AY-3-8910 sound chip. This allows the
    Dragon to play interesting sound effects and complex chiptunes without
    taking all processor time.
    The cartridge also adds two 8-bit I/O ports (provided also by the AY-3-8910).
    The sound chip can be operated via the new commands in BASIC provided in
    the cartridge ROM, or via the 0xFEFE and 0xFEFF addresses.

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

#include "emu.h"
#include "dragon_jcbsnd.h"
#include "speaker.h"


ROM_START( dragon_jcbsnd )
	ROM_REGION(0x1000, "eprom", ROMREGION_ERASE00)
	ROM_LOAD("d32sem.rom", 0x0000, 0x1000, CRC(4cd0f30b) SHA1(d07bb9272e3d3928059853730ff656905a80b68e))
ROM_END

//**************************************************************************
//  GLOBAL VARIABLES
//**************************************************************************

DEFINE_DEVICE_TYPE(DRAGON_JCBSND, dragon_jcbsnd_device, "dragon_jcbsnd", "Dragon Sound Extension Module")

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

//-------------------------------------------------
//  dragon_jcbsnd_device - constructor
//-------------------------------------------------

dragon_jcbsnd_device::dragon_jcbsnd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, DRAGON_JCBSND, tag, owner, clock)
	, device_cococart_interface(mconfig, *this )
	, m_ay8910(*this, "ay8910")
{
}

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

void dragon_jcbsnd_device::device_start()
{
	install_write_handler(0xfefe, 0xfefe, write8_delegate(FUNC(ay8910_device::address_w), (ay8910_device *)m_ay8910));
	install_readwrite_handler(0xfeff, 0xfeff, read8_delegate(FUNC(ay8910_device::data_r), (ay8910_device *)m_ay8910), write8_delegate(FUNC(ay8910_device::data_w), (ay8910_device *)m_ay8910));

	set_line_value(line::CART, line_value::Q);
}

//-------------------------------------------------
//  dragon_jcbsnd_device::get_cart_base
//-------------------------------------------------

uint8_t* dragon_jcbsnd_device::get_cart_base()
{
	return memregion("eprom")->base();
}

//-------------------------------------------------
//  dragon_jcbsnd_device::get_cart_memregion
//-------------------------------------------------

memory_region* dragon_jcbsnd_device::get_cart_memregion()
{
	return memregion("eprom");
}

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

void dragon_jcbsnd_device::device_add_mconfig(machine_config &config)
{
	SPEAKER(config, "mono").front_center();
	AY8910(config, m_ay8910, DERIVED_CLOCK(1, 1)); /* AY-3-8910 - clock not verified */
	m_ay8910->add_route(ALL_OUTPUTS, "mono", 1.00);
}

//-------------------------------------------------
//  rom_region - device-specific ROM region
//-------------------------------------------------

const tiny_rom_entry *dragon_jcbsnd_device::device_rom_region() const
{
	return ROM_NAME( dragon_jcbsnd );
}