summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/heathzenith/h89/z37_fdc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/heathzenith/h89/z37_fdc.cpp')
-rw-r--r--src/devices/bus/heathzenith/h89/z37_fdc.cpp71
1 files changed, 10 insertions, 61 deletions
diff --git a/src/devices/bus/heathzenith/h89/z37_fdc.cpp b/src/devices/bus/heathzenith/h89/z37_fdc.cpp
index 41dc53b4b8a..af0c4d9ae79 100644
--- a/src/devices/bus/heathzenith/h89/z37_fdc.cpp
+++ b/src/devices/bus/heathzenith/h89/z37_fdc.cpp
@@ -35,65 +35,16 @@
#define FUNCNAME __PRETTY_FUNCTION__
#endif
-namespace {
-
-class h89bus_z37_device : public device_t, public device_h89bus_right_card_interface
-{
-public:
- h89bus_z37_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
-
- virtual void write(u8 select_lines, u8 offset, u8 data) override;
- virtual u8 read(u8 select_lines, u8 offset) override;
-
-protected:
- virtual void device_start() override ATTR_COLD;
- virtual void device_reset() override ATTR_COLD;
- virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
-
- void ctrl_w(u8 val);
-
- void intf_w(u8 val);
-
- void cmd_w(u8 val);
- u8 stat_r();
-
- void data_w(u8 val);
- u8 data_r();
-
- void set_irq(int state);
- void set_drq(int state);
-
-private:
- required_device<fd1797_device> m_fdc;
- required_device_array<floppy_connector, 4> m_floppies;
-
- bool m_irq_allowed;
- bool m_drq_allowed;
- bool m_access_track_sector;
-
- /// Bits set in cmd_ControlPort_c - DK.CON
- static constexpr u8 ctrl_EnableIntReq_c = 0;
- static constexpr u8 ctrl_EnableDrqInt_c = 1;
- static constexpr u8 ctrl_SetMFMRecording_c = 2;
- static constexpr u8 ctrl_MotorsOn_c = 3;
- static constexpr u8 ctrl_Drive_0_c = 4;
- static constexpr u8 ctrl_Drive_1_c = 5;
- static constexpr u8 ctrl_Drive_2_c = 6;
- static constexpr u8 ctrl_Drive_3_c = 7;
-
- /// Bits to set alternate registers on InterfaceControl_c - DK.INT
- static constexpr u8 if_SelectSectorTrack_c = 0;
-};
h89bus_z37_device::h89bus_z37_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock):
device_t(mconfig, H89BUS_Z37, tag, owner, 0),
device_h89bus_right_card_interface(mconfig, *this),
m_fdc(*this, "z37_fdc"),
- m_floppies(*this, "z37_fdc:%u", 0U)
+ m_floppies(*this, "z37_fdc:%u", 0U),
+ m_intr_cntrl(*this, finder_base::DUMMY_TAG)
{
}
-
void h89bus_z37_device::ctrl_w(u8 val)
{
bool motor_on = bool(BIT(val, ctrl_MotorsOn_c));
@@ -107,12 +58,12 @@ void h89bus_z37_device::ctrl_w(u8 val)
if (m_drq_allowed)
{
- set_slot_blockirq(1);
+ m_intr_cntrl->block_interrupts(1);
}
else
{
- set_slot_blockirq(0);
- set_slot_fdcdrq(0);
+ m_intr_cntrl->block_interrupts(0);
+ m_intr_cntrl->set_drq(0);
}
if (BIT(val, ctrl_Drive_0_c))
@@ -246,9 +197,9 @@ void h89bus_z37_device::device_reset()
m_drq_allowed = false;
m_access_track_sector = false;
- set_slot_fdcirq(0);
- set_slot_fdcdrq(0);
- set_slot_blockirq(0);
+ m_intr_cntrl->set_irq(0);
+ m_intr_cntrl->set_drq(0);
+ m_intr_cntrl->block_interrupts(0);
}
static void z37_floppies(device_slot_interface &device)
@@ -285,16 +236,14 @@ void h89bus_z37_device::set_irq(int state)
{
LOGLINES("set irq, allowed: %d state: %d\n", m_irq_allowed, state);
- set_slot_fdcirq(m_irq_allowed ? state : CLEAR_LINE);
+ m_intr_cntrl->set_irq(m_irq_allowed ? state : CLEAR_LINE);
}
void h89bus_z37_device::set_drq(int state)
{
LOGLINES("set drq, allowed: %d state: %d\n", m_drq_allowed, state);
- set_slot_fdcdrq(m_drq_allowed ? state : CLEAR_LINE);
+ m_intr_cntrl->set_drq(m_drq_allowed ? state : CLEAR_LINE);
}
-} // anonymous namespace
-
DEFINE_DEVICE_TYPE_PRIVATE(H89BUS_Z37, device_h89bus_right_card_interface, h89bus_z37_device, "h89_z37", "Heathkit Z-37 Floppy Disk Controller");