summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/taitoio.h
blob: ebd794cbceb056dc1ef6042ee99c58267e2298ce (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*************************************************************************

    taitoio.h

    Implementation of various Taito custom I/O ICs

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

#ifndef __TAITOIO_H__
#define __TAITOIO_H__

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

struct tc0220ioc_interface
{
	devcb_read8 m_read_0;
	devcb_read8 m_read_1;
	devcb_read8 m_read_2;
	devcb_read8 m_read_3;
	devcb_read8 m_read_7;
};


struct tc0510nio_interface
{
	devcb_read8 m_read_0;
	devcb_read8 m_read_1;
	devcb_read8 m_read_2;
	devcb_read8 m_read_3;
	devcb_read8 m_read_7;
};


struct tc0640fio_interface
{
	devcb_read8 m_read_0;
	devcb_read8 m_read_1;
	devcb_read8 m_read_2;
	devcb_read8 m_read_3;
	devcb_read8 m_read_7;
};

class tc0220ioc_device : public device_t,
										public tc0220ioc_interface
{
public:
	tc0220ioc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	~tc0220ioc_device() {}
	
	DECLARE_READ8_MEMBER( read );
	DECLARE_WRITE8_MEMBER( write );
	DECLARE_READ8_MEMBER( port_r );
	DECLARE_WRITE8_MEMBER( port_w );
	DECLARE_READ8_MEMBER( portreg_r );
	DECLARE_WRITE8_MEMBER( portreg_w );
	
protected:
	// device-level overrides
	virtual void device_config_complete();
	virtual void device_start();
	virtual void device_reset();

private:
	// internal state
	UINT8      m_regs[8];
	UINT8      m_port;

	devcb_resolved_read8    m_read_0_func;
	devcb_resolved_read8    m_read_1_func;
	devcb_resolved_read8    m_read_2_func;
	devcb_resolved_read8    m_read_3_func;
	devcb_resolved_read8    m_read_7_func;
};

extern const device_type TC0220IOC;

class tc0510nio_device : public device_t,
										public tc0510nio_interface
{
public:
	tc0510nio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	~tc0510nio_device() {}

	DECLARE_READ8_MEMBER( read );
	DECLARE_WRITE8_MEMBER( write );
	DECLARE_READ16_MEMBER( halfword_r );
	DECLARE_WRITE16_MEMBER( halfword_w );
	DECLARE_READ16_MEMBER( halfword_wordswap_r );
	DECLARE_WRITE16_MEMBER( halfword_wordswap_w );

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

private:
	// internal state
	UINT8   m_regs[8];

	devcb_resolved_read8    m_read_0_func;
	devcb_resolved_read8    m_read_1_func;
	devcb_resolved_read8    m_read_2_func;
	devcb_resolved_read8    m_read_3_func;
	devcb_resolved_read8    m_read_7_func;
};

extern const device_type TC0510NIO;

class tc0640fio_device : public device_t,
										public tc0640fio_interface
{
public:
	tc0640fio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	~tc0640fio_device() {}
	
	DECLARE_READ8_MEMBER( read );
	DECLARE_WRITE8_MEMBER( write );
	DECLARE_READ16_MEMBER( halfword_r );
	DECLARE_WRITE16_MEMBER( halfword_w );
	DECLARE_READ16_MEMBER( halfword_byteswap_r );
	DECLARE_WRITE16_MEMBER( halfword_byteswap_w );

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

	private:
	// internal state
	UINT8   m_regs[8];

	devcb_resolved_read8    m_read_0_func;
	devcb_resolved_read8    m_read_1_func;
	devcb_resolved_read8    m_read_2_func;
	devcb_resolved_read8    m_read_3_func;
	devcb_resolved_read8    m_read_7_func;
};

extern const device_type TC0640FIO;


/***************************************************************************
    DEVICE CONFIGURATION MACROS
***************************************************************************/

#define MCFG_TC0220IOC_ADD(_tag, _interface) \
	MCFG_DEVICE_ADD(_tag, TC0220IOC, 0) \
	MCFG_DEVICE_CONFIG(_interface)

#define MCFG_TC0510NIO_ADD(_tag, _interface) \
	MCFG_DEVICE_ADD(_tag, TC0510NIO, 0) \
	MCFG_DEVICE_CONFIG(_interface)

#define MCFG_TC0640FIO_ADD(_tag, _interface) \
	MCFG_DEVICE_ADD(_tag, TC0640FIO, 0) \
	MCFG_DEVICE_CONFIG(_interface)

	
#endif  /* __TAITOIO_H__ */