mirror of
https://github.com/holub/mame
synced 2025-04-26 10:13:37 +03:00
Collapse pc_fdc device hierarchy (nw)
- pc_fdc_interface has been eliminated. The XT and AT hookups have been moved into the ISA devices. - pc_fdc_xt_device remains for now only because two drivers depend on it. - europc still prints "disk error" on boot. It should still be possible to fix this.
This commit is contained in:
parent
20f8b011c5
commit
2dbbbfca73
@ -1,5 +1,5 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Miodrag Milanovic
|
||||
// copyright-holders:Miodrag Milanovic, Wilbert Pol
|
||||
/**********************************************************************
|
||||
|
||||
ISA 8 bit Floppy Disk Controller
|
||||
@ -9,11 +9,13 @@
|
||||
#include "emu.h"
|
||||
#include "fdc.h"
|
||||
#include "machine/busmouse.h"
|
||||
#include "machine/pc_fdc.h"
|
||||
#include "formats/pc_dsk.h"
|
||||
#include "formats/naslite_dsk.h"
|
||||
#include "formats/ibmxdf_dsk.h"
|
||||
|
||||
#define VERBOSE 0
|
||||
#include "logmacro.h"
|
||||
|
||||
|
||||
FLOPPY_FORMATS_MEMBER( isa8_fdc_device::floppy_formats )
|
||||
FLOPPY_PC_FORMAT,
|
||||
@ -43,13 +45,6 @@ isa8_fdc_device::isa8_fdc_device(const machine_config &mconfig, device_type type
|
||||
{
|
||||
}
|
||||
|
||||
void isa8_fdc_device::device_start()
|
||||
{
|
||||
set_isa_device();
|
||||
m_isa->install_device(0x03f0, 0x03f7, *m_fdc, &pc_fdc_interface::map);
|
||||
m_isa->set_dma_channel(2, this, true);
|
||||
}
|
||||
|
||||
void isa8_fdc_device::device_reset()
|
||||
{
|
||||
}
|
||||
@ -85,33 +80,177 @@ void isa8_fdc_device::eop_w(int state)
|
||||
}
|
||||
|
||||
|
||||
isa8_fdc_xt_device::isa8_fdc_xt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : isa8_fdc_device(mconfig, ISA8_FDC_XT, tag, owner, clock)
|
||||
isa8_upd765_fdc_device::isa8_upd765_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : isa8_fdc_device(mconfig, type, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
void isa8_upd765_fdc_device::device_start()
|
||||
{
|
||||
for(int i=0; i<4; i++) {
|
||||
char name[2] = {static_cast<char>('0'+i), 0};
|
||||
floppy_connector *conn = subdevice<floppy_connector>(name);
|
||||
floppy[i] = conn ? conn->get_device() : nullptr;
|
||||
}
|
||||
|
||||
irq = drq = false;
|
||||
fdc_irq = fdc_drq = false;
|
||||
dor = 0x00;
|
||||
}
|
||||
|
||||
// Bits 0-1 select one of the 4 drives, but only if the associated
|
||||
// motor bit is on
|
||||
|
||||
// Bit 2 is tied to the upd765 reset line
|
||||
|
||||
// Bit 3 enables the irq and drq lines
|
||||
|
||||
// Bit 4-7 control the drive motors
|
||||
|
||||
void isa8_upd765_fdc_device::dor_w(uint8_t data)
|
||||
{
|
||||
LOG("dor = %02x\n", data);
|
||||
uint8_t pdor = dor;
|
||||
dor = data;
|
||||
|
||||
for(int i=0; i<4; i++)
|
||||
if(floppy[i])
|
||||
floppy[i]->mon_w(!(dor & (0x10 << i)));
|
||||
|
||||
int fid = dor & 3;
|
||||
if(dor & (0x10 << fid))
|
||||
m_fdc->set_floppy(floppy[fid]);
|
||||
else
|
||||
m_fdc->set_floppy(nullptr);
|
||||
|
||||
check_irq();
|
||||
check_drq();
|
||||
if((pdor^dor) & 4)
|
||||
m_fdc->soft_reset();
|
||||
}
|
||||
|
||||
uint8_t isa8_upd765_fdc_device::dor_r()
|
||||
{
|
||||
return dor;
|
||||
}
|
||||
|
||||
void isa8_upd765_fdc_device::ccr_w(uint8_t data)
|
||||
{
|
||||
static const int rates[4] = { 500000, 300000, 250000, 1000000 };
|
||||
LOG("ccr = %02x\n", data);
|
||||
m_fdc->set_rate(rates[data & 3]);
|
||||
}
|
||||
|
||||
uint8_t isa8_upd765_fdc_device::dir_r()
|
||||
{
|
||||
if(floppy[dor & 3])
|
||||
return floppy[dor & 3]->dskchg_r() ? 0x00 : 0x80;
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(isa8_upd765_fdc_device::fdc_irq_w)
|
||||
{
|
||||
fdc_irq = state;
|
||||
check_irq();
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(isa8_upd765_fdc_device::fdc_drq_w)
|
||||
{
|
||||
fdc_drq = state;
|
||||
check_drq();
|
||||
}
|
||||
|
||||
void isa8_upd765_fdc_device::check_irq()
|
||||
{
|
||||
bool pirq = irq;
|
||||
irq = fdc_irq && (dor & 4) && (dor & 8);
|
||||
if(irq != pirq) {
|
||||
LOG("pc_irq = %d\n", irq);
|
||||
irq_w(irq);
|
||||
}
|
||||
}
|
||||
|
||||
void isa8_upd765_fdc_device::check_drq()
|
||||
{
|
||||
bool pdrq = drq;
|
||||
drq = fdc_drq && (dor & 4) && (dor & 8);
|
||||
if(drq != pdrq)
|
||||
drq_w(drq);
|
||||
}
|
||||
|
||||
|
||||
isa8_fdc_xt_device::isa8_fdc_xt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : isa8_fdc_xt_device(mconfig, ISA8_FDC_XT, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
isa8_fdc_xt_device::isa8_fdc_xt_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : isa8_upd765_fdc_device(mconfig, type, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
void isa8_fdc_xt_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
pc_fdc_xt_device &pc_fdc_xt(PC_FDC_XT(config, m_fdc, 0));
|
||||
pc_fdc_xt.intrq_wr_callback().set(FUNC(isa8_fdc_device::irq_w));
|
||||
pc_fdc_xt.drq_wr_callback().set(FUNC(isa8_fdc_device::drq_w));
|
||||
upd765a_device &upd765a(UPD765A(config, m_fdc, 8'000'000, false, false));
|
||||
upd765a.intrq_wr_callback().set(FUNC(isa8_fdc_xt_device::fdc_irq_w));
|
||||
upd765a.drq_wr_callback().set(FUNC(isa8_fdc_xt_device::fdc_drq_w));
|
||||
FLOPPY_CONNECTOR(config, "fdc:0", pc_dd_floppies, "525dd", isa8_fdc_device::floppy_formats);
|
||||
FLOPPY_CONNECTOR(config, "fdc:1", pc_dd_floppies, "525dd", isa8_fdc_device::floppy_formats);
|
||||
}
|
||||
|
||||
void isa8_fdc_xt_device::device_start()
|
||||
{
|
||||
set_isa_device();
|
||||
m_isa->install_device(0x03f0, 0x03f7, *this, &isa8_fdc_xt_device::map);
|
||||
m_isa->set_dma_channel(2, this, true);
|
||||
|
||||
isa8_fdc_at_device::isa8_fdc_at_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : isa8_fdc_device(mconfig, ISA8_FDC_AT, tag, owner, clock)
|
||||
isa8_upd765_fdc_device::device_start();
|
||||
}
|
||||
|
||||
// The schematics show address decoding is minimal
|
||||
void isa8_fdc_xt_device::map(address_map &map)
|
||||
{
|
||||
map(0x0, 0x0).r(m_fdc, FUNC(upd765a_device::msr_r)).w(FUNC(isa8_fdc_xt_device::dor_w));
|
||||
map(0x1, 0x1).r(m_fdc, FUNC(upd765a_device::fifo_r)).w(FUNC(isa8_fdc_xt_device::dor_fifo_w));
|
||||
map(0x2, 0x2).w(FUNC(isa8_fdc_xt_device::dor_w));
|
||||
map(0x3, 0x3).w(FUNC(isa8_fdc_xt_device::dor_w));
|
||||
map(0x4, 0x5).m(m_fdc, FUNC(upd765a_device::map));
|
||||
}
|
||||
|
||||
void isa8_fdc_xt_device::dor_fifo_w(uint8_t data)
|
||||
{
|
||||
m_fdc->fifo_w(data);
|
||||
dor_w(data);
|
||||
}
|
||||
|
||||
|
||||
isa8_fdc_at_device::isa8_fdc_at_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : isa8_upd765_fdc_device(mconfig, ISA8_FDC_AT, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
void isa8_fdc_at_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
pc_fdc_at_device &pc_fdc_at(PC_FDC_AT(config, m_fdc, 0));
|
||||
pc_fdc_at.intrq_wr_callback().set(FUNC(isa8_fdc_device::irq_w));
|
||||
pc_fdc_at.drq_wr_callback().set(FUNC(isa8_fdc_device::drq_w));
|
||||
upd765a_device &upd765a(UPD765A(config, m_fdc, 8'000'000, false, false));
|
||||
upd765a.intrq_wr_callback().set(FUNC(isa8_fdc_at_device::fdc_irq_w));
|
||||
upd765a.drq_wr_callback().set(FUNC(isa8_fdc_at_device::fdc_drq_w));
|
||||
FLOPPY_CONNECTOR(config, "fdc:0", pc_hd_floppies, "35hd", isa8_fdc_device::floppy_formats);
|
||||
FLOPPY_CONNECTOR(config, "fdc:1", pc_hd_floppies, "35hd", isa8_fdc_device::floppy_formats);
|
||||
}
|
||||
|
||||
// Decoding is through a PAL, so presumably complete
|
||||
void isa8_fdc_at_device::map(address_map &map)
|
||||
{
|
||||
map(0x2, 0x2).rw(FUNC(isa8_fdc_at_device::dor_r), FUNC(isa8_fdc_at_device::dor_w));
|
||||
map(0x4, 0x5).m(m_fdc, FUNC(upd765a_device::map));
|
||||
map(0x7, 0x7).rw(FUNC(isa8_fdc_at_device::dir_r), FUNC(isa8_fdc_at_device::ccr_w));
|
||||
}
|
||||
|
||||
void isa8_fdc_at_device::device_start()
|
||||
{
|
||||
set_isa_device();
|
||||
m_isa->install_device(0x03f0, 0x03f7, *this, &isa8_fdc_at_device::map);
|
||||
m_isa->set_dma_channel(2, this, true);
|
||||
|
||||
isa8_upd765_fdc_device::device_start();
|
||||
}
|
||||
|
||||
isa8_fdc_smc_device::isa8_fdc_smc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : isa8_fdc_device(mconfig, ISA8_FDC_SMC, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
@ -125,6 +264,13 @@ void isa8_fdc_smc_device::device_add_mconfig(machine_config &config)
|
||||
FLOPPY_CONNECTOR(config, "fdc:1", pc_hd_floppies, "35hd", isa8_fdc_device::floppy_formats);
|
||||
}
|
||||
|
||||
void isa8_fdc_smc_device::device_start()
|
||||
{
|
||||
set_isa_device();
|
||||
m_isa->install_device(0x03f0, 0x03f7, downcast<smc37c78_device &>(*m_fdc), &smc37c78_device::map);
|
||||
m_isa->set_dma_channel(2, this, true);
|
||||
}
|
||||
|
||||
isa8_fdc_ps2_device::isa8_fdc_ps2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : isa8_fdc_device(mconfig, ISA8_FDC_PS2, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
@ -139,6 +285,13 @@ void isa8_fdc_ps2_device::device_add_mconfig(machine_config &config)
|
||||
FLOPPY_CONNECTOR(config, "fdc:1", pc_hd_floppies, "35hd", isa8_fdc_device::floppy_formats);
|
||||
}
|
||||
|
||||
void isa8_fdc_ps2_device::device_start()
|
||||
{
|
||||
set_isa_device();
|
||||
m_isa->install_device(0x03f0, 0x03f7, downcast<n82077aa_device &>(*m_fdc), &n82077aa_device::map);
|
||||
m_isa->set_dma_channel(2, this, true);
|
||||
}
|
||||
|
||||
isa8_fdc_superio_device::isa8_fdc_superio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : isa8_fdc_device(mconfig, ISA8_FDC_SUPERIO, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
@ -152,15 +305,22 @@ void isa8_fdc_superio_device::device_add_mconfig(machine_config &config)
|
||||
FLOPPY_CONNECTOR(config, "fdc:1", pc_hd_floppies, "35hd", isa8_fdc_device::floppy_formats);
|
||||
}
|
||||
|
||||
void isa8_fdc_superio_device::device_start()
|
||||
{
|
||||
set_isa_device();
|
||||
m_isa->install_device(0x03f0, 0x03f7, downcast<pc_fdc_superio_device &>(*m_fdc), &pc_fdc_superio_device::map);
|
||||
m_isa->set_dma_channel(2, this, true);
|
||||
}
|
||||
|
||||
isa8_ec1841_0003_device::isa8_ec1841_0003_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: isa8_fdc_device(mconfig, ISA8_EC1841_0003, tag, owner, clock)
|
||||
: isa8_fdc_xt_device(mconfig, ISA8_EC1841_0003, tag, owner, clock)
|
||||
, m_bus_mouse(*this, "bus_mouse")
|
||||
{
|
||||
}
|
||||
|
||||
void isa8_ec1841_0003_device::device_start()
|
||||
{
|
||||
isa8_fdc_device::device_start();
|
||||
isa8_fdc_xt_device::device_start();
|
||||
m_isa->install_device(0x023c, 0x023f, *m_bus_mouse, &bus_mouse_device::map);
|
||||
}
|
||||
|
||||
@ -171,11 +331,7 @@ WRITE_LINE_MEMBER( isa8_ec1841_0003_device::aux_irq_w )
|
||||
|
||||
void isa8_ec1841_0003_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
pc_fdc_xt_device &pc_fdc_xt(PC_FDC_XT(config, m_fdc, 0));
|
||||
pc_fdc_xt.intrq_wr_callback().set(FUNC(isa8_fdc_device::irq_w));
|
||||
pc_fdc_xt.drq_wr_callback().set(FUNC(isa8_fdc_device::drq_w));
|
||||
FLOPPY_CONNECTOR(config, "fdc:0", pc_dd_floppies, "525dd", isa8_fdc_device::floppy_formats);
|
||||
FLOPPY_CONNECTOR(config, "fdc:1", pc_dd_floppies, "525dd", isa8_fdc_device::floppy_formats);
|
||||
isa8_fdc_xt_device::device_add_mconfig(config);
|
||||
|
||||
BUS_MOUSE(config, "bus_mouse", 0).extint_callback().set(FUNC(isa8_ec1841_0003_device::aux_irq_w));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Miodrag Milanovic
|
||||
// copyright-holders:Miodrag Milanovic, Wilbert Pol
|
||||
/**********************************************************************
|
||||
|
||||
ISA 8 bit Floppy Disk Controller
|
||||
@ -35,7 +35,6 @@ protected:
|
||||
isa8_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual uint8_t dack_r(int line) override;
|
||||
@ -43,23 +42,61 @@ protected:
|
||||
virtual void dack_line_w(int line, int state) override;
|
||||
virtual void eop_w(int state) override;
|
||||
|
||||
required_device<pc_fdc_interface> m_fdc;
|
||||
required_device<upd765_family_device> m_fdc;
|
||||
};
|
||||
|
||||
class isa8_fdc_xt_device : public isa8_fdc_device {
|
||||
class isa8_upd765_fdc_device : public isa8_fdc_device
|
||||
{
|
||||
protected:
|
||||
// construction/destruction
|
||||
isa8_upd765_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
uint8_t dor_r();
|
||||
void dor_w(uint8_t data);
|
||||
uint8_t dir_r();
|
||||
void ccr_w(uint8_t data);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( fdc_irq_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
|
||||
|
||||
private:
|
||||
bool irq, drq, fdc_drq, fdc_irq;
|
||||
uint8_t dor;
|
||||
|
||||
floppy_image_device *floppy[4];
|
||||
|
||||
void check_irq();
|
||||
void check_drq();
|
||||
};
|
||||
|
||||
class isa8_fdc_xt_device : public isa8_upd765_fdc_device {
|
||||
public:
|
||||
isa8_fdc_xt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
isa8_fdc_xt_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
|
||||
void map(address_map &map);
|
||||
void dor_fifo_w(uint8_t data);
|
||||
};
|
||||
|
||||
class isa8_fdc_at_device : public isa8_fdc_device {
|
||||
class isa8_fdc_at_device : public isa8_upd765_fdc_device {
|
||||
public:
|
||||
isa8_fdc_at_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
|
||||
void map(address_map &map);
|
||||
};
|
||||
|
||||
class isa8_fdc_smc_device : public isa8_fdc_device {
|
||||
@ -67,7 +104,9 @@ public:
|
||||
isa8_fdc_smc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
};
|
||||
|
||||
class isa8_fdc_ps2_device : public isa8_fdc_device {
|
||||
@ -75,7 +114,9 @@ public:
|
||||
isa8_fdc_ps2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
};
|
||||
|
||||
class isa8_fdc_superio_device : public isa8_fdc_device {
|
||||
@ -83,10 +124,12 @@ public:
|
||||
isa8_fdc_superio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
};
|
||||
|
||||
class isa8_ec1841_0003_device : public isa8_fdc_device {
|
||||
class isa8_ec1841_0003_device : public isa8_fdc_xt_device {
|
||||
public:
|
||||
isa8_ec1841_0003_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
|
@ -26,11 +26,6 @@
|
||||
|
||||
|
||||
DEFINE_DEVICE_TYPE(PC_FDC_XT, pc_fdc_xt_device, "pc_fdc_xt", "PC FDC (XT)")
|
||||
DEFINE_DEVICE_TYPE(PC_FDC_AT, pc_fdc_at_device, "pc_fdc_at", "PC FDC (AT)")
|
||||
|
||||
void pc_fdc_family_device::map(address_map &map)
|
||||
{
|
||||
}
|
||||
|
||||
// The schematics show address decoding is minimal
|
||||
void pc_fdc_xt_device::map(address_map &map)
|
||||
@ -43,16 +38,8 @@ void pc_fdc_xt_device::map(address_map &map)
|
||||
}
|
||||
|
||||
|
||||
// Decoding is through a PAL, so presumably complete
|
||||
void pc_fdc_at_device::map(address_map &map)
|
||||
{
|
||||
map(0x2, 0x2).rw(FUNC(pc_fdc_at_device::dor_r), FUNC(pc_fdc_at_device::dor_w));
|
||||
map(0x4, 0x5).m(fdc, FUNC(upd765a_device::map));
|
||||
map(0x7, 0x7).rw(FUNC(pc_fdc_at_device::dir_r), FUNC(pc_fdc_at_device::ccr_w));
|
||||
}
|
||||
|
||||
pc_fdc_family_device::pc_fdc_family_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
|
||||
pc_fdc_interface(mconfig, type, tag, owner, clock), fdc(*this, "upd765"),
|
||||
device_t(mconfig, type, tag, owner, clock), fdc(*this, "upd765"),
|
||||
intrq_cb(*this),
|
||||
drq_cb(*this)
|
||||
{
|
||||
@ -136,11 +123,6 @@ uint8_t pc_fdc_family_device::dor_r()
|
||||
return dor;
|
||||
}
|
||||
|
||||
uint8_t pc_fdc_family_device::dir_r()
|
||||
{
|
||||
return do_dir_r();
|
||||
}
|
||||
|
||||
void pc_fdc_family_device::ccr_w(uint8_t data)
|
||||
{
|
||||
static const int rates[4] = { 500000, 300000, 250000, 1000000 };
|
||||
@ -148,13 +130,6 @@ void pc_fdc_family_device::ccr_w(uint8_t data)
|
||||
fdc->set_rate(rates[data & 3]);
|
||||
}
|
||||
|
||||
uint8_t pc_fdc_family_device::do_dir_r()
|
||||
{
|
||||
if(floppy[dor & 3])
|
||||
return floppy[dor & 3]->dskchg_r() ? 0x00 : 0x80;
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
void pc_fdc_xt_device::dor_fifo_w(uint8_t data)
|
||||
{
|
||||
fdc->fifo_w(data);
|
||||
@ -194,7 +169,3 @@ void pc_fdc_family_device::check_drq()
|
||||
pc_fdc_xt_device::pc_fdc_xt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pc_fdc_family_device(mconfig, PC_FDC_XT, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
pc_fdc_at_device::pc_fdc_at_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pc_fdc_family_device(mconfig, PC_FDC_AT, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
@ -14,21 +14,19 @@
|
||||
#include "machine/upd765.h"
|
||||
|
||||
|
||||
class pc_fdc_family_device : public pc_fdc_interface {
|
||||
class pc_fdc_family_device : public device_t {
|
||||
public:
|
||||
auto intrq_wr_callback() { return intrq_cb.bind(); }
|
||||
auto drq_wr_callback() { return drq_cb.bind(); }
|
||||
|
||||
virtual void map(address_map &map) override;
|
||||
virtual void map(address_map &map) = 0;
|
||||
|
||||
virtual void tc_w(bool state) override;
|
||||
virtual uint8_t dma_r() override;
|
||||
virtual void dma_w(uint8_t data) override;
|
||||
virtual uint8_t do_dir_r() override;
|
||||
void tc_w(bool state);
|
||||
uint8_t dma_r();
|
||||
void dma_w(uint8_t data);
|
||||
|
||||
uint8_t dor_r();
|
||||
void dor_w(uint8_t data);
|
||||
uint8_t dir_r();
|
||||
void ccr_w(uint8_t data);
|
||||
|
||||
required_device<upd765a_device> fdc;
|
||||
@ -62,14 +60,6 @@ public:
|
||||
void dor_fifo_w(uint8_t data);
|
||||
};
|
||||
|
||||
class pc_fdc_at_device : public pc_fdc_family_device {
|
||||
public:
|
||||
pc_fdc_at_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
virtual void map(address_map &map) override;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(PC_FDC_XT, pc_fdc_xt_device)
|
||||
DECLARE_DEVICE_TYPE(PC_FDC_AT, pc_fdc_at_device)
|
||||
|
||||
#endif // MAME_MACHINE_PC_FDC_H
|
||||
|
@ -167,7 +167,7 @@ void tc8566af_device::map(address_map &map)
|
||||
constexpr int upd765_family_device::rates[4];
|
||||
|
||||
upd765_family_device::upd765_family_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
|
||||
pc_fdc_interface(mconfig, type, tag, owner, clock),
|
||||
device_t(mconfig, type, tag, owner, clock),
|
||||
ready_connected(true),
|
||||
ready_polled(true),
|
||||
select_connected(true),
|
||||
|
@ -15,30 +15,7 @@ class floppy_image_device;
|
||||
* mode = mode_t::AT, mode_t::PS2 or mode_t::M30 for the fdcs that have reset-time selection
|
||||
*/
|
||||
|
||||
/* Interface required for PC ISA wrapping */
|
||||
class pc_fdc_interface : public device_t {
|
||||
protected:
|
||||
using device_t::device_t;
|
||||
|
||||
public:
|
||||
typedef delegate<uint8_t ()> byte_read_cb;
|
||||
typedef delegate<void (uint8_t)> byte_write_cb;
|
||||
|
||||
/* Note that the address map must cover and handle the whole 0-7
|
||||
* range. The upd765, while conforming to the rest of the
|
||||
* interface, is not eligible as a result.
|
||||
*/
|
||||
|
||||
virtual void map(address_map &map) = 0;
|
||||
|
||||
virtual uint8_t dma_r() = 0;
|
||||
virtual void dma_w(uint8_t data) = 0;
|
||||
|
||||
virtual void tc_w(bool val) = 0;
|
||||
virtual uint8_t do_dir_r() = 0;
|
||||
};
|
||||
|
||||
class upd765_family_device : public pc_fdc_interface {
|
||||
class upd765_family_device : public device_t {
|
||||
public:
|
||||
enum class mode_t { AT, PS2, M30 };
|
||||
|
||||
@ -48,7 +25,7 @@ public:
|
||||
auto us_wr_callback() { return us_cb.bind(); }
|
||||
auto idx_wr_callback() { return idx_cb.bind(); }
|
||||
|
||||
virtual void map(address_map &map) override = 0;
|
||||
virtual void map(address_map &map) = 0;
|
||||
|
||||
uint8_t sra_r();
|
||||
uint8_t srb_r();
|
||||
@ -63,14 +40,14 @@ public:
|
||||
uint8_t dir_r() { return do_dir_r(); }
|
||||
void ccr_w(uint8_t data);
|
||||
|
||||
virtual uint8_t do_dir_r() override;
|
||||
uint8_t do_dir_r();
|
||||
|
||||
uint8_t dma_r() override;
|
||||
void dma_w(uint8_t data) override;
|
||||
uint8_t dma_r();
|
||||
void dma_w(uint8_t data);
|
||||
|
||||
bool get_irq() const;
|
||||
bool get_drq() const;
|
||||
void tc_w(bool val) override;
|
||||
void tc_w(bool val);
|
||||
void ready_w(bool val);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(tc_line_w) { tc_w(state == ASSERT_LINE); }
|
||||
|
@ -515,19 +515,23 @@ void europc_pc_state::europc_io(address_map &map)
|
||||
map(0x02e0, 0x02e0).r(FUNC(europc_pc_state::europc_jim2_r));
|
||||
}
|
||||
|
||||
class europc_fdc_device : public isa8_fdc_device
|
||||
class europc_fdc_device : public isa8_fdc_xt_device
|
||||
{
|
||||
public:
|
||||
europc_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
void map(address_map &map);
|
||||
};
|
||||
|
||||
DEFINE_DEVICE_TYPE(EUROPC_FDC, europc_fdc_device, "europc_fdc", "EURO PC FDC hookup")
|
||||
|
||||
europc_fdc_device::europc_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: isa8_fdc_device(mconfig, EUROPC_FDC, tag, owner, clock)
|
||||
: isa8_fdc_xt_device(mconfig, EUROPC_FDC, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
@ -539,14 +543,33 @@ static void pc_dd_floppies(device_slot_interface &device)
|
||||
|
||||
void europc_fdc_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
wd37c65c_device &fdc(WD37C65C(config, m_fdc, 16_MHz_XTAL));
|
||||
fdc.intrq_wr_callback().set(FUNC(isa8_fdc_device::irq_w));
|
||||
fdc.drq_wr_callback().set(FUNC(isa8_fdc_device::drq_w));
|
||||
WD37C65C(config, m_fdc, 16_MHz_XTAL);
|
||||
m_fdc->intrq_wr_callback().set(FUNC(europc_fdc_device::fdc_irq_w));
|
||||
m_fdc->drq_wr_callback().set(FUNC(europc_fdc_device::fdc_drq_w));
|
||||
// single built-in 3.5" 720K drive, connector for optional external 3.5" or 5.25" drive
|
||||
FLOPPY_CONNECTOR(config, "fdc:0", pc_dd_floppies, "35dd", isa8_fdc_device::floppy_formats).set_fixed(true);
|
||||
FLOPPY_CONNECTOR(config, "fdc:1", pc_dd_floppies, nullptr, isa8_fdc_device::floppy_formats);
|
||||
}
|
||||
|
||||
void europc_fdc_device::device_start()
|
||||
{
|
||||
set_isa_device();
|
||||
m_isa->install_device(0x03f0, 0x03f7, *this, &europc_fdc_device::map);
|
||||
m_isa->set_dma_channel(2, this, true);
|
||||
|
||||
isa8_upd765_fdc_device::device_start();
|
||||
}
|
||||
|
||||
void europc_fdc_device::map(address_map &map)
|
||||
{
|
||||
// FIXME: the FDC has its own DOR
|
||||
map(0x0, 0x0).r(m_fdc, FUNC(wd37c65c_device::msr_r)).w(FUNC(europc_fdc_device::dor_w));
|
||||
map(0x1, 0x1).r(m_fdc, FUNC(wd37c65c_device::fifo_r)).w(FUNC(europc_fdc_device::dor_fifo_w));
|
||||
map(0x2, 0x2).w(FUNC(europc_fdc_device::dor_w));
|
||||
map(0x3, 0x3).w(FUNC(europc_fdc_device::dor_w));
|
||||
map(0x4, 0x5).m(m_fdc, FUNC(wd37c65c_device::map));
|
||||
}
|
||||
|
||||
static void europc_fdc(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("fdc", EUROPC_FDC);
|
||||
|
Loading…
Reference in New Issue
Block a user