summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/coco/coco_fdc.h
blob: a9d1dac8eab0ee7cbc425184479cb67832c41043 (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
#pragma once

#ifndef __COCO_FDC_H__
#define __COCO_FDC_H__

#include "emu.h"
#include "cococart.h"
#include "machine/msm6242.h"
#include "machine/ds1315.h"
#include "machine/wd17xx.h"


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

// ======================> coco_rtc_type_t

enum coco_rtc_type_t
{
	RTC_DISTO   = 0x00,
	RTC_CLOUD9  = 0x01,

	RTC_NONE    = 0xFF
};

// ======================> coco_fdc_device

class coco_fdc_device :
		public device_t,
		public device_cococart_interface
{
public:
		// construction/destruction
		coco_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
		coco_fdc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);

		// optional information overrides
		virtual machine_config_constructor device_mconfig_additions() const;
		virtual const rom_entry *device_rom_region() const;

		virtual UINT8* get_cart_base();

		virtual void update_lines();
		virtual void dskreg_w(UINT8 data);

		void set_intrq(UINT8 val) { m_intrq = val; }
		void set_drq(UINT8 val) { m_drq = val; }

		DECLARE_WRITE_LINE_MEMBER(fdc_intrq_w);
		DECLARE_WRITE_LINE_MEMBER(fdc_drq_w);
protected:
		// device-level overrides
		virtual void device_start();
		virtual DECLARE_READ8_MEMBER(read);
		virtual DECLARE_WRITE8_MEMBER(write);

		coco_rtc_type_t real_time_clock();

		// internal state
		cococart_slot_device *m_owner;

		UINT8 m_dskreg;
		UINT8 m_drq : 1;
		UINT8 m_intrq : 1;

		optional_device<wd1773_device> m_wd17xx;              /* WD17xx */
		optional_device<wd2797_device> m_wd2797;              /* WD2797 */
		optional_device<ds1315_device> m_ds1315;         /* DS1315 */

		/* Disto RTC */
		optional_device<msm6242_device> m_disto_msm6242;        /* 6242 RTC on Disto interface */

		offs_t m_msm6242_rtc_address;
};


// device type definition
extern const device_type COCO_FDC;

// ======================> coco_fdc_v11_device

class coco_fdc_v11_device :
		public coco_fdc_device
{
public:
		// construction/destruction
		coco_fdc_v11_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

		// optional information overrides
		virtual const rom_entry *device_rom_region() const;
};


// device type definition
extern const device_type COCO_FDC_V11;

// ======================> coco3_hdb1_device

class coco3_hdb1_device :
		public coco_fdc_device
{
public:
		// construction/destruction
		coco3_hdb1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

		// optional information overrides
		virtual const rom_entry *device_rom_region() const;
};


// device type definition
extern const device_type COCO3_HDB1;

// ======================> cp400_fdc_device

class cp400_fdc_device :
		public coco_fdc_device
{
public:
		// construction/destruction
		cp400_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

		// optional information overrides
		virtual const rom_entry *device_rom_region() const;
};


// device type definition
extern const device_type CP400_FDC;

// ======================> dragon_fdc_device

class dragon_fdc_device :
		public coco_fdc_device
{
public:
		// construction/destruction
		dragon_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
		dragon_fdc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);

		// optional information overrides
		virtual machine_config_constructor device_mconfig_additions() const;
		virtual const rom_entry *device_rom_region() const;
		virtual void update_lines();
		virtual void dskreg_w(UINT8 data);
protected:
		// device-level overrides
		virtual void device_start();
		virtual DECLARE_READ8_MEMBER(read);
		virtual DECLARE_WRITE8_MEMBER(write);
private:
};


// device type definition
extern const device_type DRAGON_FDC;

// ======================> sdtandy_fdc_device

class sdtandy_fdc_device :
		public dragon_fdc_device
{
public:
		// construction/destruction
		sdtandy_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

		// optional information overrides
		virtual const rom_entry *device_rom_region() const;
};


// device type definition
extern const device_type SDTANDY_FDC;

#endif  /* __COCO_FDC_H__ */