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
104
|
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/***************************************************************************
AY mod (1.667 MHz clock).
Variants of the mod used 1.5 or 1.75 MHz clock.
Reads are passed through to external slot, usually occupied by
joystick interface.
***************************************************************************/
#include "emu.h"
#include "ay.h"
#include "sound/ay8910.h"
#include "speaker.h"
namespace {
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> bk_ay_device
class bk_ay_device : public device_t, public device_bk_parallel_interface
{
public:
// construction/destruction
bk_ay_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual void device_start() override ATTR_COLD {}
virtual uint16_t io_r() override;
virtual void io_w(uint16_t data, bool word) override;
private:
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
required_device<ym2149_device> m_ay;
required_device<bk_parallel_slot_device> m_up;
};
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// bk_ay_device - constructor
//-------------------------------------------------
bk_ay_device::bk_ay_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, BK_AY, tag, owner, clock)
, device_bk_parallel_interface(mconfig, *this)
, m_ay(*this, "ay")
, m_up(*this, "up")
{
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
void bk_ay_device::device_add_mconfig(machine_config &config)
{
SPEAKER(config, "speaker", 2).front();
YM2149(config, m_ay, 1667000);
m_ay->add_route(0, "speaker", 0.5, 1);
m_ay->add_route(2, "speaker", 0.5, 1);
m_ay->add_route(1, "speaker", 0.5, 0);
m_ay->add_route(2, "speaker", 0.5, 0);
BK_PARALLEL_SLOT(config, m_up, DERIVED_CLOCK(1, 1), bk_parallel_devices, nullptr);
}
uint16_t bk_ay_device::io_r()
{
return m_up->read() ^ 0xffff;
}
void bk_ay_device::io_w(uint16_t data, bool word)
{
if (word)
m_ay->address_w(data);
else
m_ay->data_w(data);
m_up->write(0, data ^ 0xffff, word);
}
} // anonymous namespace
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE_PRIVATE(BK_AY, device_bk_parallel_interface, bk_ay_device, "bk_ay", "BK Single AY Interface")
|