summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2023-10-12 19:47:08 -0400
committer AJR <ajrhacker@users.noreply.github.com>2023-10-12 19:47:08 -0400
commitfe40e825965a8cc0366eaf7b77ab843f401bc9fd (patch)
tree55b6758fba829c3708f907be647b6a868cbd5e67 /src/devices/bus
parent59521cf6cf1981b006611ea0c8bf5b2649db81ac (diff)
c8280, hp9895: Use device finder arrays for floppy drives
Diffstat (limited to 'src/devices/bus')
-rw-r--r--src/devices/bus/ieee488/c8280.cpp37
-rw-r--r--src/devices/bus/ieee488/c8280.h7
-rw-r--r--src/devices/bus/ieee488/hp9895.cpp2
-rw-r--r--src/devices/bus/ieee488/hp9895.h2
4 files changed, 26 insertions, 22 deletions
diff --git a/src/devices/bus/ieee488/c8280.cpp b/src/devices/bus/ieee488/c8280.cpp
index bf6db655e33..ba90235d30c 100644
--- a/src/devices/bus/ieee488/c8280.cpp
+++ b/src/devices/bus/ieee488/c8280.cpp
@@ -9,6 +9,10 @@
#include "emu.h"
#include "c8280.h"
+#include "cpu/m6502/m6502.h"
+#include "formats/c8280_dsk.h"
+
+
//**************************************************************************
@@ -317,8 +321,9 @@ void c8280_device::device_add_mconfig(machine_config &config)
FD1797(config, m_fdc, XTAL(12'000'000)/6);
m_fdc->intrq_wr_callback().set_inputline(m_fdccpu, M6502_IRQ_LINE);
m_fdc->drq_wr_callback().set_inputline(m_fdccpu, M6502_SET_OVERFLOW);
- FLOPPY_CONNECTOR(config, m_floppy0, c8280_floppies, "8dsdd", c8280_device::floppy_formats);
- FLOPPY_CONNECTOR(config, m_floppy1, c8280_floppies, "8dsdd", c8280_device::floppy_formats);
+
+ for (auto &floppy : m_floppy)
+ FLOPPY_CONNECTOR(config, floppy, c8280_floppies, "8dsdd", c8280_device::floppy_formats);
}
@@ -387,10 +392,9 @@ c8280_device::c8280_device(const machine_config &mconfig, const char *tag, devic
m_riot0(*this, M6532_0_TAG),
m_riot1(*this, M6532_1_TAG),
m_fdc(*this, WD1797_TAG),
- m_floppy0(*this, WD1797_TAG ":0"),
- m_floppy1(*this, WD1797_TAG ":1"),
+ m_floppy(*this, WD1797_TAG ":%u", 0U),
m_address(*this, "ADDRESS"),
- m_floppy(nullptr),
+ m_selected_floppy(nullptr),
m_leds(*this, "led%u", 0U),
m_rfdo(1),
m_daco(1),
@@ -437,8 +441,8 @@ void c8280_device::device_reset()
m_riot1->pa_bit_w<7>(1);
m_fk5 = 0;
- m_floppy = nullptr;
- m_fdc->set_floppy(m_floppy);
+ m_selected_floppy = nullptr;
+ m_fdc->set_floppy(m_selected_floppy);
m_fdc->dden_w(0);
}
@@ -488,8 +492,8 @@ uint8_t c8280_device::fk5_r()
uint8_t data = m_fk5;
- data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 3;
- data |= (m_floppy ? m_floppy->twosid_r() : 1) << 4;
+ data |= (m_selected_floppy ? m_selected_floppy->dskchg_r() : 1) << 3;
+ data |= (m_selected_floppy ? m_selected_floppy->twosid_r() : 1) << 4;
return data;
}
@@ -514,14 +518,17 @@ void c8280_device::fk5_w(uint8_t data)
m_fk5 = data & 0x27;
// drive select
- m_floppy = nullptr;
-
- if (BIT(data, 0)) m_floppy = m_floppy0->get_device();
- if (BIT(data, 1)) m_floppy = m_floppy1->get_device();
+ m_selected_floppy = nullptr;
+ for (int n = 0; n < 2; n++)
+ {
+ if (BIT(data, n))
+ m_selected_floppy = m_floppy[n]->get_device();
+ }
- m_fdc->set_floppy(m_floppy);
+ m_fdc->set_floppy(m_selected_floppy);
- if (m_floppy) m_floppy->mon_w(!BIT(data, 5));
+ if (m_selected_floppy)
+ m_selected_floppy->mon_w(!BIT(data, 5));
// density select
m_fdc->dden_w(BIT(data, 2));
diff --git a/src/devices/bus/ieee488/c8280.h b/src/devices/bus/ieee488/c8280.h
index 4bef271836a..fc6a4f92dec 100644
--- a/src/devices/bus/ieee488/c8280.h
+++ b/src/devices/bus/ieee488/c8280.h
@@ -12,8 +12,6 @@
#pragma once
#include "ieee488.h"
-#include "cpu/m6502/m6502.h"
-#include "formats/c8280_dsk.h"
#include "imagedev/floppy.h"
#include "machine/mos6530.h"
#include "machine/wd_fdc.h"
@@ -68,10 +66,9 @@ private:
required_device<mos6532_device> m_riot0;
required_device<mos6532_device> m_riot1;
required_device<fd1797_device> m_fdc;
- required_device<floppy_connector> m_floppy0;
- required_device<floppy_connector> m_floppy1;
+ required_device_array<floppy_connector, 2> m_floppy;
required_ioport m_address;
- floppy_image_device *m_floppy;
+ floppy_image_device *m_selected_floppy;
output_finder<4> m_leds;
// IEEE-488 bus
diff --git a/src/devices/bus/ieee488/hp9895.cpp b/src/devices/bus/ieee488/hp9895.cpp
index 510ebfa734d..ffc7ae29d70 100644
--- a/src/devices/bus/ieee488/hp9895.cpp
+++ b/src/devices/bus/ieee488/hp9895.cpp
@@ -138,7 +138,7 @@ hp9895_device::hp9895_device(const machine_config &mconfig, const char *tag, dev
device_ieee488_interface(mconfig, *this),
m_cpu(*this , "cpu"),
m_phi(*this , "phi"),
- m_drives{{*this , "floppy0"} , {*this , "floppy1"}},
+ m_drives(*this , "floppy%u" , 0U),
m_switches{*this , "switches"}
{
}
diff --git a/src/devices/bus/ieee488/hp9895.h b/src/devices/bus/ieee488/hp9895.h
index cad61922e46..0f33b543929 100644
--- a/src/devices/bus/ieee488/hp9895.h
+++ b/src/devices/bus/ieee488/hp9895.h
@@ -105,7 +105,7 @@ private:
required_device<z80_device> m_cpu;
required_device<phi_device> m_phi;
- required_device<floppy_connector> m_drives[ 2 ];
+ required_device_array<floppy_connector, 2> m_drives;
required_ioport m_switches;
bool m_cpu_irq;