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
|
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
#ifndef MAME_BUS_ASTROCDE_CTRL_H
#define MAME_BUS_ASTROCDE_CTRL_H
#pragma once
/***************************************************************************
FORWARD DECLARATIONS
***************************************************************************/
class astrocade_ctrl_port_device;
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// ======================> device_astrocade_ctrl_interface
class device_astrocade_ctrl_interface : public device_interface
{
public:
virtual ~device_astrocade_ctrl_interface();
virtual uint8_t read_handle() { return 0; }
virtual uint8_t read_knob() { return 0; }
protected:
device_astrocade_ctrl_interface(machine_config const &mconfig, device_t &device);
// device_interface implementation
virtual void interface_validity_check(validity_checker &valid) const override ATTR_COLD;
virtual void interface_pre_start() override;
DECLARE_WRITE_LINE_MEMBER( write_ltpen );
private:
astrocade_ctrl_port_device *const m_port;
friend class astrocade_ctrl_port_device;
};
// ======================> astrocade_ctrl_port_device
class astrocade_ctrl_port_device : public device_t, public device_single_card_slot_interface<device_astrocade_ctrl_interface>
{
public:
// construction/destruction
template <typename T>
astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
: astrocade_ctrl_port_device(mconfig, tag, owner)
{
option_reset();
opts(*this);
set_default_option(dflt);
set_fixed(false);
}
astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, const XTAL &clock = XTAL());
virtual ~astrocade_ctrl_port_device();
auto ltpen_handler() { return m_ltpen_handler.bind(); }
uint8_t read_handle() { return m_device ? m_device->read_handle() : 0; }
uint8_t read_knob() { return m_device ? m_device->read_knob() : 0; }
protected:
// device_t implementation
virtual void device_resolve_objects() override;
virtual void device_start() override;
int m_ltpen;
devcb_write_line m_ltpen_handler;
private:
device_astrocade_ctrl_interface *m_device;
friend class device_astrocade_ctrl_interface;
};
/***************************************************************************
FUNCTIONS
***************************************************************************/
void astrocade_controllers(device_slot_interface &device);
/***************************************************************************
DEVICE TYPES
***************************************************************************/
DECLARE_DEVICE_TYPE(ASTROCADE_CTRL_PORT, astrocade_ctrl_port_device)
#endif // MAME_BUS_ASTROCDE_CTRL_H
|