summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/ep64/exdos.cpp
blob: eb5b61229c99275289443f6d50d614cda3afea9e (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
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************

    Intelligent Software EXDOS Disk Controller Module emulation

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

/*

Floppy Drive Controller PCB Layout
----------------------------------

INTELLIGENT SOFTWARE LTD DISK CONTROLLER
ISS1
 |--------------------------------------------|
 |                                            |
 |                                            |
|-|  7438  74LS273             WD1770         |
|I|                                           |
|D|                                           |
|C|                                  EPROM.IC2|
|3|           74LS32  74LS02  74LS266         |
|4|  7438                                     |
|-|      74LS126  74LS10  74LS245  74LS266    |
 |                                            |
 |                                            |
 |----------------------------|||||||||||||||||
                              |---------------|
Notes: (All IC's shown)

This PCB plugs into the external expansion connector on the right side of the mainboard

      EPROM.IC2 - 16k x8-bit EPROM labelled 'EXDOS V1.0 P/N 08-60' (DIP28)
         WD1770 - Western Digital WD1770 Floppy Drive Controller (DIP28)
         74LS02 - Quad 2-Input NOR Gate (DIP14)
         74LS10 - Triple 3-input NAND Gate (DIP14)
         74LS32 - Quad 2-Input Positive OR Gate (DIP14)
           7438 - Quad 2-input NAND Buffer (DIP14)
        74LS126 - Quad Bus Buffer (DIP14)
        74LS245 - Octal Bus Tranceiver with Tri-State Outputs (DIP20)
        74LS266 - Quad EXCLUSIVE-NOR Gate (DIP14)
        74LS273 - Octal D-Type Flip-Flop With Clear (DIP20)
          IDC34 - IDC 34-way flat cable connector for floppy drive data cable

*/

#include "emu.h"
#include "exdos.h"



//**************************************************************************
//  MACROS/CONSTANTS
//**************************************************************************

#define WD1770_TAG  "u1"



//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE(EP64_EXDOS, ep64_exdos_device, "ep64_exdos", "EP64 EXDOS")


//-------------------------------------------------
//  ROM( ep64_exdos )
//-------------------------------------------------

ROM_START( ep64_exdos )
	ROM_REGION( 0x8000, "rom", 0 )
	ROM_LOAD( "exdos13.rom", 0x0000, 0x8000, CRC(d1d7e157) SHA1(31c8be089526aa8aa019c380cdf51ddd3ee76454) )
ROM_END


//-------------------------------------------------
//  rom_region - device-specific ROM region
//-------------------------------------------------

const tiny_rom_entry *ep64_exdos_device::device_rom_region() const
{
	return ROM_NAME( ep64_exdos );
}


//-------------------------------------------------
//  SLOT_INTERFACE( ep64_exdos_floppies )
//-------------------------------------------------

FLOPPY_FORMATS_MEMBER( ep64_exdos_device::floppy_formats )
	FLOPPY_EP64_FORMAT
FLOPPY_FORMATS_END

static SLOT_INTERFACE_START( ep64_exdos_floppies )
	SLOT_INTERFACE( "35dd", FLOPPY_35_DD )
SLOT_INTERFACE_END


//-------------------------------------------------
//  device_add_mconfig - add device configuration
//-------------------------------------------------

MACHINE_CONFIG_START(ep64_exdos_device::device_add_mconfig)
	MCFG_WD1770_ADD(WD1770_TAG, XTAL(8'000'000))

	MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", ep64_exdos_floppies, "35dd", ep64_exdos_device::floppy_formats)
	MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":1", ep64_exdos_floppies, nullptr,  ep64_exdos_device::floppy_formats)
	MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":2", ep64_exdos_floppies, nullptr,  ep64_exdos_device::floppy_formats)
	MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":3", ep64_exdos_floppies, nullptr,  ep64_exdos_device::floppy_formats)
MACHINE_CONFIG_END


//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  ep64_exdos_device - constructor
//-------------------------------------------------

ep64_exdos_device::ep64_exdos_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	device_t(mconfig, EP64_EXDOS, tag, owner, clock),
	device_ep64_expansion_bus_card_interface(mconfig, *this),
	m_fdc(*this, WD1770_TAG),
	m_floppy0(*this, WD1770_TAG":0"),
	m_floppy1(*this, WD1770_TAG":1"),
	m_floppy2(*this, WD1770_TAG":2"),
	m_floppy3(*this, WD1770_TAG":3"),
	m_floppy(nullptr),
	m_rom(*this, "rom")
{
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void ep64_exdos_device::device_start()
{
	m_slot->program().install_rom(0x080000, 0x087fff, m_rom->base());

	m_slot->io().install_readwrite_handler(0x10, 0x13, 0, 0x04, 0, READ8_DEVICE_DELEGATE(m_fdc, wd_fdc_device_base, read), WRITE8_DEVICE_DELEGATE(m_fdc, wd_fdc_device_base, write));
	m_slot->io().install_readwrite_handler(0x18, 0x18, 0, 0x04, 0, READ8_DELEGATE(ep64_exdos_device, read), WRITE8_DELEGATE(ep64_exdos_device, write));
}


//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void ep64_exdos_device::device_reset()
{
	m_fdc->reset();

	m_floppy = nullptr;
	m_fdc->set_floppy(m_floppy);
	m_fdc->dden_w(0);
}


//-------------------------------------------------
//  read -
//-------------------------------------------------

READ8_MEMBER( ep64_exdos_device::read )
{
	/*

	    bit     description

	    0
	    1       INTRQ
	    2
	    3
	    4
	    5
	    6       DCHG
	    7       DRQ

	*/

	uint8_t data = 0;

	data |= m_fdc->intrq_r() << 1;
	data |= m_fdc->drq_r() << 7;

	data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 6;

	return data;
}


//-------------------------------------------------
//  write -
//-------------------------------------------------

WRITE8_MEMBER( ep64_exdos_device::write )
{
	/*

	    bit     description

	    0       SELECT 0
	    1       SELECT 1
	    2       SELECT 2
	    3       SELECT 3
	    4       SIDE 1
	    5       _DDEN
	    6       DISK CHANGE RESET
	    7       IN USE

	*/

	m_floppy = nullptr;

	if (BIT(data, 0)) m_floppy = m_floppy0->get_device();
	if (BIT(data, 1)) m_floppy = m_floppy1->get_device();
	if (BIT(data, 2)) m_floppy = m_floppy2->get_device();
	if (BIT(data, 3)) m_floppy = m_floppy3->get_device();

	m_fdc->set_floppy(m_floppy);

	if (m_floppy)
	{
		m_floppy->ss_w(BIT(data, 4));
	}

	m_fdc->dden_w(BIT(data, 5));
}