summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/wd17xx.h
blob: eb66952d68c8b88b15a786a2683b3241a8b8ba72 (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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
/*********************************************************************

    wd17xx.h

    Implementations of the Western Digital 17xx and 27xx families of
    floppy disk controllers

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

#ifndef __WD17XX_H__
#define __WD17XX_H__

#include "devcb.h"


/***************************************************************************
    MACROS
***************************************************************************/

class wd1770_device : public device_t
{
public:
	wd1770_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	wd1770_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
	~wd1770_device() { global_free(m_token); }

	// access to legacy token
	void *token() const { assert(m_token != NULL); return m_token; }
protected:
	// device-level overrides
	virtual void device_config_complete();
	virtual void device_start();
	virtual void device_reset();
private:
	// internal state
	void *m_token;
};

extern const device_type WD1770;

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

extern const device_type FD1771;

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

extern const device_type FD1781;

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

extern const device_type FD1791;

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

extern const device_type FD1792;

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

extern const device_type FD1793;

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

extern const device_type FD1794;

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

extern const device_type FD1795;

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

extern const device_type FD1797;

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

extern const device_type FD1761;

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

extern const device_type FD1762;

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

extern const device_type FD1763;

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

extern const device_type FD1764;

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

extern const device_type FD1765;

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

extern const device_type FD1767;

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

extern const device_type WD2791;

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

extern const device_type WD2793;

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

extern const device_type WD2795;

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

extern const device_type WD2797;

class wd1772_device : public wd1770_device
{
public:
	wd1772_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
protected:
	// device-level overrides
	virtual void device_start();
};

extern const device_type WD1772;

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

extern const device_type WD1773;

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

extern const device_type MB8866;

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

extern const device_type MB8876;

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

extern const device_type MB8877;




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

/* Interface */
struct wd17xx_interface
{
	devcb_read_line in_dden_func;
	devcb_write_line out_intrq_func;
	devcb_write_line out_drq_func;
	const char *floppy_drive_tags[4];
};


/***************************************************************************
    FUNCTION PROTOTYPES
***************************************************************************/
void wd17xx_reset(device_t *device);

/* the following are not strictly part of the wd179x hardware/emulation
but will be put here for now until the flopdrv code has been finalised more */
void wd17xx_set_drive(device_t *device, UINT8);		/* set drive wd179x is accessing */
void wd17xx_set_side(device_t *device, UINT8);		/* set side wd179x is accessing */

void wd17xx_set_pause_time(device_t *device, int usec);       /* default is 40 usec if not set */
void wd17xx_index_pulse_callback(device_t *controller, device_t *img, int state);

DECLARE_READ8_DEVICE_HANDLER( wd17xx_status_r );
DECLARE_READ8_DEVICE_HANDLER( wd17xx_track_r );
DECLARE_READ8_DEVICE_HANDLER( wd17xx_sector_r );
DECLARE_READ8_DEVICE_HANDLER( wd17xx_data_r );

DECLARE_WRITE8_DEVICE_HANDLER( wd17xx_command_w );
DECLARE_WRITE8_DEVICE_HANDLER( wd17xx_track_w );
DECLARE_WRITE8_DEVICE_HANDLER( wd17xx_sector_w );
DECLARE_WRITE8_DEVICE_HANDLER( wd17xx_data_w );

DECLARE_READ8_DEVICE_HANDLER( wd17xx_r );
DECLARE_WRITE8_DEVICE_HANDLER( wd17xx_w );

WRITE_LINE_DEVICE_HANDLER( wd17xx_mr_w );
WRITE_LINE_DEVICE_HANDLER( wd17xx_rdy_w );
READ_LINE_DEVICE_HANDLER( wd17xx_mo_r );
WRITE_LINE_DEVICE_HANDLER( wd17xx_tr00_w );
WRITE_LINE_DEVICE_HANDLER( wd17xx_idx_w );
WRITE_LINE_DEVICE_HANDLER( wd17xx_wprt_w );
WRITE_LINE_DEVICE_HANDLER( wd17xx_dden_w );
READ_LINE_DEVICE_HANDLER( wd17xx_drq_r );
READ_LINE_DEVICE_HANDLER( wd17xx_intrq_r );

extern const wd17xx_interface default_wd17xx_interface;
extern const wd17xx_interface default_wd17xx_interface_2_drives;


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

#define MCFG_FD1771_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1771, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1781_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1781, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1791_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1791, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1792_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1792, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1793_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1793, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1794_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1794, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1795_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1795, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1797_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1797, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1761_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1761, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1762_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1762, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1763_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1763, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1764_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1764, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1765_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1765, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_FD1767_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, FD1767, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_WD2793_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, WD2793, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_WD2795_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, WD2795, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_WD2797_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, WD2797, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_WD1770_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, WD1770, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_WD1772_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, WD1772, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_WD1773_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, WD1773, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_MB8866_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, MB8866, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_MB8876_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, MB8876, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#define MCFG_MB8877_ADD(_tag, _intrf) \
	MCFG_DEVICE_ADD(_tag, MB8877, 0) \
	MCFG_DEVICE_CONFIG(_intrf)

#endif /* __WD17XX_H__ */