1 // license:BSD-3-Clause
2 // copyright-holders:Nigel Barnes
3 /**********************************************************************
4 
5     BBC Master Internal Modem port
6 
7 **********************************************************************/
8 
9 #include "emu.h"
10 #include "modem.h"
11 
12 
13 //**************************************************************************
14 //  DEVICE DEFINITIONS
15 //**************************************************************************
16 
17 DEFINE_DEVICE_TYPE(BBC_MODEM_SLOT, bbc_modem_slot_device, "bbc_modem_slot", "BBC Master Internal Modem port")
18 
19 
20 
21 //**************************************************************************
22 //  DEVICE BBC_MODEM PORT INTERFACE
23 //**************************************************************************
24 
25 //-------------------------------------------------
26 //  device_bbc_modem_interface - constructor
27 //-------------------------------------------------
28 
device_bbc_modem_interface(const machine_config & mconfig,device_t & device)29 device_bbc_modem_interface::device_bbc_modem_interface(const machine_config &mconfig, device_t &device) :
30 	device_interface(device, "bbcmodem")
31 {
32 	m_slot = dynamic_cast<bbc_modem_slot_device *>(device.owner());
33 }
34 
35 
36 //**************************************************************************
37 //  LIVE DEVICE
38 //**************************************************************************
39 
40 //-------------------------------------------------
41 //  bbc_modem_slot_device - constructor
42 //-------------------------------------------------
43 
bbc_modem_slot_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock)44 bbc_modem_slot_device::bbc_modem_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
45 	: device_t(mconfig, BBC_MODEM_SLOT, tag, owner, clock)
46 	, device_single_card_slot_interface<device_bbc_modem_interface>(mconfig, *this)
47 	, m_card(nullptr)
48 	, m_irq_handler(*this)
49 {
50 }
51 
52 
53 //-------------------------------------------------
54 //  device_start - device-specific startup
55 //-------------------------------------------------
56 
device_start()57 void bbc_modem_slot_device::device_start()
58 {
59 	m_card = get_card_device();
60 
61 	// resolve callbacks
62 	m_irq_handler.resolve_safe();
63 }
64 
65 
66 //-------------------------------------------------
67 //  read
68 //-------------------------------------------------
69 
read(offs_t offset)70 uint8_t bbc_modem_slot_device::read(offs_t offset)
71 {
72 	if (m_card)
73 		return m_card->read(offset & 0x0f);
74 	else
75 		return 0xfe;
76 }
77 
78 //-------------------------------------------------
79 //  write
80 //-------------------------------------------------
81 
write(offs_t offset,uint8_t data)82 void bbc_modem_slot_device::write(offs_t offset, uint8_t data)
83 {
84 	if (m_card)
85 		m_card->write(offset & 0x0f, data);
86 }
87 
88 //-------------------------------------------------
89 //  SLOT_INTERFACE( bbcm_modem_devices )
90 //-------------------------------------------------
91 
92 
93 // slot devices
94 #include "scsiaiv.h"
95 
96 
bbcm_modem_devices(device_slot_interface & device)97 void bbcm_modem_devices(device_slot_interface &device)
98 {
99 	//device.option_add("modem",      BBC_MODEM);           /* Beebug Master Modem */
100 	device.option_add("scsiaiv",    BBC_SCSIAIV);         /* Acorn AIV SCSI Host Adaptor */
101 	//device.option_add("vp415",      BBC_VP415);           /* Philips VP415 */
102 }
103