summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/psx/multitap.h
blob: bfbcac17a04be65aabc7b54b7c7f45a97976e3ea (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
#ifndef PSXMULTITAP_H_
#define PSXMULTITAP_H_

#include "ctlrport.h"

SLOT_INTERFACE_EXTERN(psx_controllers_nomulti);

class psx_multitap_device : public device_t,
							public device_psx_controller_interface
{
public:
	psx_multitap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	virtual machine_config_constructor device_mconfig_additions() const;

protected:
	virtual void device_start();
	virtual void device_stop() { device_psx_controller_interface::m_owner->disable_card(false); }
	virtual void device_reset() { device_psx_controller_interface::m_owner->disable_card(true); }
	virtual void device_config_complete() { m_shortname = "psx_multitap"; }
	virtual void interface_pre_reset();

private:
	virtual bool get_pad(int count, UINT8 *odata, UINT8 idata);
	virtual void do_pad();
	void ack();
	void set_tx_line(bool tx, int port);
	bool get_rx_line(int port);

	int m_activeport;
	bool m_cack[4];
	bool m_singlemode, m_nextmode, m_tapmc;
	UINT8 m_data[3][8]; // port a is passed though
	required_device<psx_controller_port_device> m_porta;
	required_device<psx_controller_port_device> m_portb;
	required_device<psx_controller_port_device> m_portc;
	required_device<psx_controller_port_device> m_portd;
};

extern const device_type PSX_MULTITAP;

#endif /* PSXMULTITAP_H_ */