summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/neogeo_ctrl/ctrl.h
blob: 437dc8addd33bf526a186249baafa06a14c34d5d (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
126
127
128
129
130
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/**********************************************************************

   SNK Neo Geo controller port emulation

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


#pragma once

#ifndef __NEOGEO_CONTROL_PORT__
#define __NEOGEO_CONTROL_PORT__

#include "emu.h"

//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

class neogeo_control_port_device;
class neogeo_ctrl_edge_port_device;

// ======================> device_neogeo_control_port_interface

class device_neogeo_control_port_interface : public device_slot_card_interface
{
public:
	// construction/destruction
	device_neogeo_control_port_interface(const machine_config &mconfig, device_t &device);
	virtual ~device_neogeo_control_port_interface();

	virtual UINT8 read_ctrl() { return 0xff; };
	virtual UINT8 read_start_sel() { return 0xff; };
	virtual void write_ctrlsel(UINT8 data) { };

protected:
	neogeo_control_port_device *m_port;
};

// ======================> neogeo_control_port_device

class neogeo_control_port_device : public device_t,
								public device_slot_interface
{
public:
	// construction/destruction
	neogeo_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	virtual ~neogeo_control_port_device();

    UINT8 read_ctrl();
	UINT8 read_start_sel();
	void write_ctrlsel(UINT8 data);
	DECLARE_READ8_MEMBER( ctrl_r ) { return read_ctrl(); }

protected:
	// device-level overrides
	virtual void device_start() override;

	device_neogeo_control_port_interface *m_device;
};


// ======================> device_neogeo_ctrl_edge_interface

class device_neogeo_ctrl_edge_interface : public device_slot_card_interface
{
public:
	// construction/destruction
	device_neogeo_ctrl_edge_interface(const machine_config &mconfig, device_t &device);
	virtual ~device_neogeo_ctrl_edge_interface();
	
	virtual UINT8 read_start_sel() { return 0xff; }
	virtual DECLARE_READ8_MEMBER( in0_r ) { return 0xff; }
	virtual DECLARE_READ8_MEMBER( in1_r ) { return 0xff; }
	virtual void write_ctrlsel(UINT8 data) { }
	
protected:
	neogeo_ctrl_edge_port_device *m_port;
};

// ======================> neogeo_ctrl_edge_port_device

class neogeo_ctrl_edge_port_device : public device_t,
										public device_slot_interface
{
public:
	// construction/destruction
	neogeo_ctrl_edge_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	virtual ~neogeo_ctrl_edge_port_device();
	
	UINT8 read_start_sel();
	DECLARE_READ8_MEMBER( in0_r );
	DECLARE_READ8_MEMBER( in1_r );
	void write_ctrlsel(UINT8 data);

protected:
	// device-level overrides
	virtual void device_start() override;
	
	device_neogeo_ctrl_edge_interface *m_device;
};


// device type definition
extern const device_type NEOGEO_CONTROL_PORT;
extern const device_type NEOGEO_CTRL_EDGE_CONNECTOR;


//**************************************************************************
//  INTERFACE CONFIGURATION MACROS
//**************************************************************************

#define MCFG_NEOGEO_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot, _fixed) \
	MCFG_DEVICE_ADD(_tag, NEOGEO_CONTROL_PORT, 0) \
	MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)

#define MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD(_tag, _slot_intf, _def_slot, _fixed) \
	MCFG_DEVICE_ADD(_tag, NEOGEO_CTRL_EDGE_CONNECTOR, 0) \
	MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)



SLOT_INTERFACE_EXTERN( neogeo_controls );
SLOT_INTERFACE_EXTERN( neogeo_arc_edge );
SLOT_INTERFACE_EXTERN( neogeo_arc_edge_fixed );
SLOT_INTERFACE_EXTERN( neogeo_arc_pin15 );


#endif