summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/bbc/userport/userport.cpp
blob: f466c84a3955351b69f33a5c5e0e0a2c921af95a (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
99
100
101
102
103
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    BBC User Port emulation

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

#include "emu.h"
#include "userport.h"


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

const device_type BBC_USERPORT_SLOT = &device_creator<bbc_userport_device>;



//**************************************************************************
//  DEVICE BBC_USERPORT INTERFACE
//**************************************************************************

//-------------------------------------------------
//  device_bbc_userport_interface - constructor
//-------------------------------------------------

device_bbc_userport_interface::device_bbc_userport_interface(const machine_config &mconfig, device_t &device)
	: device_slot_card_interface(mconfig, device)
{
	m_slot = dynamic_cast<bbc_userport_device *>(device.owner());
}


//-------------------------------------------------
//  ~device_bbc_userport_interface - destructor
//-------------------------------------------------

device_bbc_userport_interface::~device_bbc_userport_interface()
{
}



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

//-------------------------------------------------
//  bbc_userport_slot_device - constructor
//-------------------------------------------------

bbc_userport_device::bbc_userport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
		device_t(mconfig, BBC_USERPORT_SLOT, "BBC Micro User port", tag, owner, clock, "bbc_userport_slot", __FILE__),
		device_slot_interface(mconfig, *this), m_device(nullptr)
{
}


//-------------------------------------------------
//  ~bbc_userport_slot_device - destructor
//-------------------------------------------------

//bbc_userport_device::~bbc_userport_device()
//{
//}


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

void bbc_userport_device::device_start()
{
	m_device = dynamic_cast<device_bbc_userport_interface *>(get_card_device());
}


uint8_t bbc_userport_device::read_portb()
{
	uint8_t data = 0xff;
	if (m_device)
		data |= m_device->read_portb();
	return data;
}


//-------------------------------------------------
//  SLOT_INTERFACE( bbc_userport_devices )
//-------------------------------------------------


// slot devices
//#include "amxmouse.h"
//#include "tracker.h"


SLOT_INTERFACE_START( bbc_userport_devices )
//  SLOT_INTERFACE("amxmouse",  BBC_AMXMOUSE)       /* AMX Mouse */
//  SLOT_INTERFACE("tracker",   BBC_TRACKER)         /* Acorn Tracker Ball */
//  SLOT_INTERFACE("music4000", BBC_MUSIC4000)       /* Hybrid Music 4000 Keyboard */
SLOT_INTERFACE_END