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
|
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/**********************************************************************
Sega Game Gear "SMS Controller Adaptor" emulation
Also known as "Master Link" cable.
**********************************************************************/
#include "emu.h"
#include "smsctrladp.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(SMS_CTRL_ADAPTOR, sms_ctrl_adaptor_device, "sms_ctrl_adaptor", "SMS Controller Adaptor")
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// sms_ctrl_adaptor_device - constructor
//-------------------------------------------------
sms_ctrl_adaptor_device::sms_ctrl_adaptor_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, SMS_CTRL_ADAPTOR, tag, owner, clock),
device_gg_ext_port_interface(mconfig, *this),
m_subctrl_port(*this, "ctrl")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void sms_ctrl_adaptor_device::device_start()
{
}
//-------------------------------------------------
// sms_peripheral_r - sms_ctrl_adaptor read
//-------------------------------------------------
uint8_t sms_ctrl_adaptor_device::peripheral_r()
{
return m_subctrl_port->port_r();
}
//-------------------------------------------------
// sms_peripheral_w - sms_ctrl_adaptor write
//-------------------------------------------------
void sms_ctrl_adaptor_device::peripheral_w(uint8_t data)
{
m_subctrl_port->port_w(data);
}
WRITE_LINE_MEMBER( sms_ctrl_adaptor_device::th_pin_w )
{
m_port->th_pin_w(state);
}
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void sms_ctrl_adaptor_device::device_add_mconfig(machine_config &config)
{
SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad");
m_subctrl_port->th_input_handler().set(FUNC(sms_ctrl_adaptor_device::th_pin_w));
}
|