summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/einstein/userport/userport.cpp
blob: 419c24d94d4dc998384d97e3fdc2e1b9087d0c91 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// license: GPL-2.0+
// copyright-holders: Dirk Best
/***************************************************************************

    Einstein User Port

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

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

// supported devices
#include "mouse.h"
#include "speech.h"


//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE(EINSTEIN_USERPORT, einstein_userport_device, "einstein_userport", "Einstein User Port")


//**************************************************************************
//  SLOT DEVICE
//**************************************************************************

//-------------------------------------------------
//  einstein_userport_device - constructor
//-------------------------------------------------

einstein_userport_device::einstein_userport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	device_t(mconfig, EINSTEIN_USERPORT, tag, owner, clock),
	device_slot_interface(mconfig, *this),
	m_card(nullptr),
	m_bstb_handler(*this)
{
}

//-------------------------------------------------
//  einstein_userport_device - destructor
//-------------------------------------------------

einstein_userport_device::~einstein_userport_device()
{
}

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

void einstein_userport_device::device_start()
{
	// resolve callbacks
	m_bstb_handler.resolve_safe();

	m_card = dynamic_cast<device_einstein_userport_interface *>(get_card_device());
}

//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void einstein_userport_device::device_reset()
{
}


//**************************************************************************
//  I/O PORTS
//**************************************************************************

READ8_MEMBER( einstein_userport_device::read )
{
	if (m_card)
		return m_card->read();
	else
		return 0xff;
}

WRITE8_MEMBER( einstein_userport_device::write )
{
	if (m_card)
		m_card->write(data);
}

WRITE_LINE_MEMBER( einstein_userport_device::brdy_w )
{
	if (m_card)
		m_card->brdy_w(state);
}


//**************************************************************************
//  CARTRIDGE INTERFACE
//**************************************************************************

//-------------------------------------------------
//  device_einstein_userport_interface - constructor
//-------------------------------------------------

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

//-------------------------------------------------
//  ~device_einstein_userport_interface - destructor
//-------------------------------------------------

device_einstein_userport_interface::~device_einstein_userport_interface()
{
}


//**************************************************************************
//  SLOT INTERFACE
//**************************************************************************

void einstein_userport_cards(device_slot_interface &device)
{
	device.option_add("mouse", EINSTEIN_MOUSE);
	device.option_add("speech", EINSTEIN_SPEECH);
}