1 // license:BSD-3-Clause
2 // copyright-holders:Barry Rodewald
3 /*
4 * amdrum.cpp
5 *
6 * Created on: 23/08/2014
7 */
8
9 #include "emu.h"
10 #include "amdrum.h"
11
12 #include "speaker.h"
13
14
15 //**************************************************************************
16 // DEVICE DEFINITIONS
17 //**************************************************************************
18
19 DEFINE_DEVICE_TYPE(CPC_AMDRUM, cpc_amdrum_device, "cpc_amdrum", "Amdrum")
20
21
device_add_mconfig(machine_config & config)22 void cpc_amdrum_device::device_add_mconfig(machine_config &config)
23 {
24 SPEAKER(config, "speaker").front_center();
25 ZN428E(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5);
26 // no pass-through
27 }
28
29
30 //**************************************************************************
31 // LIVE DEVICE
32 //**************************************************************************
33
cpc_amdrum_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock)34 cpc_amdrum_device::cpc_amdrum_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
35 device_t(mconfig, CPC_AMDRUM, tag, owner, clock),
36 device_cpc_expansion_card_interface(mconfig, *this),
37 m_slot(nullptr),
38 m_dac(*this,"dac")
39 {
40 }
41
42 //-------------------------------------------------
43 // device_start - device-specific startup
44 //-------------------------------------------------
45
device_start()46 void cpc_amdrum_device::device_start()
47 {
48 m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
49 address_space &space = m_slot->cpu().space(AS_IO);
50 space.install_write_handler(0xff00,0xffff, write8smo_delegate(*this, FUNC(cpc_amdrum_device::dac_w)));
51 }
52
53 //-------------------------------------------------
54 // device_reset - device-specific reset
55 //-------------------------------------------------
56
device_reset()57 void cpc_amdrum_device::device_reset()
58 {
59 // TODO
60 }
61
dac_w(uint8_t data)62 void cpc_amdrum_device::dac_w(uint8_t data)
63 {
64 m_dac->write(data);
65 }
66