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
|
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/***************************************************************************
Mono Covox interface with passthrough for loopback cart
(used by "In Your Space" demo.)
***************************************************************************/
#include "emu.h"
#include "covox.h"
#include "sound/dac.h"
#include "speaker.h"
namespace {
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> bk_covox_device
class bk_covox_device : public device_t, public device_bk_parallel_interface
{
public:
// construction/destruction
bk_covox_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<dac_byte_interface> m_dac;
required_device<bk_parallel_slot_device> m_up;
};
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// bk_covox_device - constructor
//-------------------------------------------------
bk_covox_device::bk_covox_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, BK_COVOX, tag, owner, clock)
, device_bk_parallel_interface(mconfig, *this)
, m_dac(*this, "dac")
, m_up(*this, "up")
{
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
void bk_covox_device::device_add_mconfig(machine_config &config)
{
SPEAKER(config, "covox").front_center();
DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "covox", 0.5); // unknown DAC
BK_PARALLEL_SLOT(config, m_up, DERIVED_CLOCK(1, 1), bk_parallel_devices, nullptr);
}
uint16_t bk_covox_device::io_r()
{
return m_up->read() ^ 0xffff;
}
void bk_covox_device::io_w(uint16_t data, bool word)
{
m_dac->write(data);
m_up->write(0, data ^ 0xffff, word);
}
} // anonymous namespace
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE_PRIVATE(BK_COVOX, device_bk_parallel_interface, bk_covox_device, "bk_covox", "BK Mono Covox Interface")
|