summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/pce_ctrl/pachinko.h
blob: 3e1808c3195069e8b6b6538977e59919ad85d3c3 (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
// license:BSD-3-Clause
// copyright-holders:kmg
/**********************************************************************

    NEC PC Engine Coconuts Japan CJPC-101 Pachinko Controller

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

#ifndef MAME_BUS_PCE_CTRL_PACHINKO_H
#define MAME_BUS_PCE_CTRL_PACHINKO_H

#pragma once


#include "pcectrl.h"



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

// ======================> pce_pachinko_device

class pce_pachinko_device : public device_t,
							public device_pce_control_port_interface
{
public:
	// construction/destruction
	pce_pachinko_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);

protected:
	// optional information overrides
	virtual ioport_constructor device_input_ports() const override ATTR_COLD;

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

	// device_pce_control_port_interface overrides
	virtual u8 peripheral_r() override;
	virtual void sel_w(int state) override;
	virtual void clr_w(int state) override;

private:
	// IO ports
	required_ioport m_buttons;
	required_ioport m_dpad;
	required_ioport m_trigger;

	// internal states
	u8 m_counter;
	bool m_prev_sel; // previous SEL pin state
	bool m_prev_clr; // previous CLR pin state
};


// device type definition
DECLARE_DEVICE_TYPE(PCE_PACHINKO, pce_pachinko_device)


#endif // MAME_BUS_PCE_CTRL_PACHINKO_H