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
|
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/**********************************************************************
SNK Neo Geo Controller Port emulation
**********************************************************************/
#include "ctrl.h"
// slot devices
#include "joystick.h"
#include "mahjong.h"
#include "dial.h"
#include "kizuna4p.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type NEOGEO_CONTROL_PORT = &device_creator<neogeo_control_port_device>;
//**************************************************************************
// CARD INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_neogeo_control_port_interface - constructor
//-------------------------------------------------
device_neogeo_control_port_interface::device_neogeo_control_port_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig,device)
{
m_port = dynamic_cast<neogeo_control_port_device *>(device.owner());
}
//-------------------------------------------------
// ~device_neogeo_control_port_interface - destructor
//-------------------------------------------------
device_neogeo_control_port_interface::~device_neogeo_control_port_interface()
{
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// neogeo_control_port_device - constructor
//-------------------------------------------------
neogeo_control_port_device::neogeo_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, NEOGEO_CONTROL_PORT, "SNK Neo Geo control port", tag, owner, clock, "neogeo_control_port", __FILE__),
device_slot_interface(mconfig, *this), m_device(nullptr)
{
}
//-------------------------------------------------
// ~neogeo_control_port_device - destructor
//-------------------------------------------------
neogeo_control_port_device::~neogeo_control_port_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void neogeo_control_port_device::device_start()
{
m_device = dynamic_cast<device_neogeo_control_port_interface *>(get_card_device());
}
UINT8 neogeo_control_port_device::read_ctrl()
{
UINT8 data = 0;
if (m_device)
data |= m_device->read_ctrl();
return data;
}
UINT8 neogeo_control_port_device::read_start_sel()
{
UINT8 data = 0;
if (m_device)
data |= m_device->read_start_sel();
return data;
}
void neogeo_control_port_device::write_ctrlsel(UINT8 data)
{
if (m_device)
m_device->write_ctrlsel(data);
}
//-------------------------------------------------
// SLOT_INTERFACE( neogeo_control_port_devices )
//-------------------------------------------------
SLOT_INTERFACE_START( neogeo_controls )
SLOT_INTERFACE("joy", NEOGEO_JOY)
SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL)
SLOT_INTERFACE_END
SLOT_INTERFACE_START( neogeo_arc_ctrls )
SLOT_INTERFACE("joy", NEOGEO_JOY_AC)
SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL_AC)
SLOT_INTERFACE("dial", NEOGEO_DIAL)
SLOT_INTERFACE_END
SLOT_INTERFACE_START( neogeo_kiz4p )
SLOT_INTERFACE("kiz4p", NEOGEO_KIZ4P)
SLOT_INTERFACE_END
|