summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/pc_joy_sw.h
blob: 041ab8ad3dc8f0575b82796d419eb30ef3a5238e (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
#ifndef PC_JOY_SW_H_
#define PC_JOY_SW_H_

#include "machine/pc_joy.h"

class pc_mssw_pad_device :  public device_t,
							public device_pc_joy_interface
{
public:
	pc_mssw_pad_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	virtual ioport_constructor device_input_ports() const;

	virtual UINT8 btn() { return m_state; }
	// timing is guessed, calibrated for at486
	virtual void port_write() { if(!m_active) { m_timer->adjust(attotime::from_usec(50), 0, attotime::from_usec(5)); m_active = true; } }

protected:
	virtual void device_start();
	virtual void device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr);
	virtual void device_reset();

private:
	required_ioport m_btn1;
	required_ioport m_btn2;
	required_ioport m_btn3;
	required_ioport m_btn4;
	required_ioport m_conf;
	emu_timer *m_timer;
	int m_count;
	UINT8 m_state;
	bool m_active;
};

extern const device_type PC_MSSW_PAD;

#endif /* PC_JOY_SW_H_ */