diff --git a/src/devices/bus/abcbus/fd2.cpp b/src/devices/bus/abcbus/fd2.cpp index b23daa8ebd7..4a245b3fee8 100644 --- a/src/devices/bus/abcbus/fd2.cpp +++ b/src/devices/bus/abcbus/fd2.cpp @@ -39,6 +39,8 @@ Notes: #include "emu.h" #include "fd2.h" +#include "formats/abcfd2_dsk.h" + //************************************************************************** @@ -193,8 +195,8 @@ void abc_fd2_device::pio_pb_w(uint8_t data) floppy_image_device *floppy = nullptr; - if (BIT(data, 0)) floppy = m_floppy0->get_device(); - if (BIT(data, 1)) floppy = m_floppy1->get_device(); + if (BIT(data, 0)) floppy = m_floppy[0]->get_device(); + if (BIT(data, 1)) floppy = m_floppy[1]->get_device(); m_fdc->set_floppy(floppy); @@ -258,8 +260,8 @@ void abc_fd2_device::device_add_mconfig(machine_config &config) m_fdc->drq_wr_callback().set(m_pio, FUNC(z80pio_device::pb5_w)); m_fdc->hld_wr_callback().set(m_pio, FUNC(z80pio_device::pb6_w)); - FLOPPY_CONNECTOR(config, m_floppy0, abc_fd2_floppies, "525sssd", abc_fd2_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy1, abc_fd2_floppies, "525sssd", abc_fd2_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[0], abc_fd2_floppies, "525sssd", abc_fd2_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[1], abc_fd2_floppies, "525sssd", abc_fd2_device::floppy_formats).enable_sound(true); } @@ -277,8 +279,7 @@ abc_fd2_device::abc_fd2_device(const machine_config &mconfig, const char *tag, d m_maincpu(*this, Z80_TAG), m_pio(*this, Z80PIO_TAG), m_fdc(*this, FD1771_TAG), - m_floppy0(*this, FD1771_TAG ":0"), - m_floppy1(*this, FD1771_TAG ":1"), + m_floppy(*this, FD1771_TAG ":%u", 0U), m_dos_rom(*this, "dos"), m_cs(false), m_status(0), m_data(0) { diff --git a/src/devices/bus/abcbus/fd2.h b/src/devices/bus/abcbus/fd2.h index a476b66c821..140a1368154 100644 --- a/src/devices/bus/abcbus/fd2.h +++ b/src/devices/bus/abcbus/fd2.h @@ -14,7 +14,6 @@ #include "abcbus.h" #include "cpu/z80/z80.h" #include "machine/z80daisy.h" -#include "formats/abcfd2_dsk.h" #include "imagedev/floppy.h" #include "machine/wd_fdc.h" #include "machine/z80pio.h" @@ -68,8 +67,7 @@ private: required_device m_maincpu; required_device m_pio; required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; + required_device_array m_floppy; required_memory_region m_dos_rom; bool m_cs; diff --git a/src/devices/bus/abcbus/lux10828.cpp b/src/devices/bus/abcbus/lux10828.cpp index 34288b40257..2516229d941 100644 --- a/src/devices/bus/abcbus/lux10828.cpp +++ b/src/devices/bus/abcbus/lux10828.cpp @@ -114,6 +114,9 @@ Notes: #include "emu.h" #include "lux10828.h" +#include "formats/abc800_dsk.h" +#include "formats/abc800i_dsk.h" + //************************************************************************** @@ -231,13 +234,13 @@ uint8_t luxor_55_10828_device::pio_pb_r() // single/double sided drive uint8_t sw1 = m_sw1->read() & 0x0f; - bool ds0 = m_sel0 ? BIT(sw1, 0) : 1; - bool ds1 = m_sel1 ? BIT(sw1, 1) : 1; + bool ds0 = BIT(m_sel, 0) ? BIT(sw1, 0) : 1; + bool ds1 = BIT(m_sel, 1) ? BIT(sw1, 1) : 1; data |= !(ds0 && ds1); // single/double density drive - bool dd0 = m_sel0 ? BIT(sw1, 2) : 1; - bool dd1 = m_sel1 ? BIT(sw1, 3) : 1; + bool dd0 = BIT(m_sel, 0) ? BIT(sw1, 2) : 1; + bool dd1 = BIT(m_sel, 1) ? BIT(sw1, 3) : 1; data |= !(dd0 && dd1) << 1; // TODO ULA output @@ -344,8 +347,8 @@ void luxor_55_10828_device::device_add_mconfig(machine_config &config) m_fdc->intrq_wr_callback().set(FUNC(luxor_55_10828_device::fdc_intrq_w)); m_fdc->drq_wr_callback().set(FUNC(luxor_55_10828_device::fdc_drq_w)); - FLOPPY_CONNECTOR(config, m_floppy0, abc_floppies, "525ssdd", luxor_55_10828_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy1, abc_floppies, "525ssdd", luxor_55_10828_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[0], abc_floppies, "525ssdd", luxor_55_10828_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[1], abc_floppies, "525ssdd", luxor_55_10828_device::floppy_formats).enable_sound(true); } @@ -410,8 +413,7 @@ luxor_55_10828_device::luxor_55_10828_device(const machine_config &mconfig, cons m_maincpu(*this, Z80_TAG), m_pio(*this, Z80PIO_TAG), m_fdc(*this, MB8876_TAG), - m_floppy0(*this, MB8876_TAG":0"), - m_floppy1(*this, MB8876_TAG":1"), + m_floppy(*this, MB8876_TAG":%u", 0U), m_sw1(*this, "SW1"), m_s1(*this, "S1"), m_cs(false), @@ -420,8 +422,7 @@ luxor_55_10828_device::luxor_55_10828_device(const machine_config &mconfig, cons m_fdc_irq(0), m_fdc_drq(0), m_wait_enable(0), - m_sel0(0), - m_sel1(0) + m_sel(0) { } @@ -439,8 +440,7 @@ void luxor_55_10828_device::device_start() save_item(NAME(m_fdc_irq)); save_item(NAME(m_fdc_drq)); save_item(NAME(m_wait_enable)); - save_item(NAME(m_sel0)); - save_item(NAME(m_sel1)); + save_item(NAME(m_sel)); // patch out protection checks (bioses basf6106/mpi02) uint8_t *rom = memregion(Z80_TAG)->base(); @@ -600,13 +600,12 @@ void luxor_55_10828_device::ctrl_w(uint8_t data) return; // drive selection - m_sel0 = BIT(data, 0); - m_sel1 = BIT(data, 1); + m_sel = data & 0x03; floppy_image_device *floppy = nullptr; - if (m_sel0) floppy = m_floppy0->get_device(); - if (m_sel1) floppy = m_floppy1->get_device(); + if (BIT(m_sel, 0)) floppy = m_floppy[0]->get_device(); + if (BIT(m_sel, 1)) floppy = m_floppy[1]->get_device(); m_fdc->set_floppy(floppy); diff --git a/src/devices/bus/abcbus/lux10828.h b/src/devices/bus/abcbus/lux10828.h index d23820b93af..6a65fe2d695 100644 --- a/src/devices/bus/abcbus/lux10828.h +++ b/src/devices/bus/abcbus/lux10828.h @@ -14,8 +14,6 @@ #include "abcbus.h" #include "cpu/z80/z80.h" #include "machine/z80daisy.h" -#include "formats/abc800_dsk.h" -#include "formats/abc800i_dsk.h" #include "imagedev/floppy.h" #include "machine/wd_fdc.h" #include "machine/z80pio.h" @@ -97,19 +95,17 @@ private: required_device m_maincpu; required_device m_pio; required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; + required_device_array m_floppy; required_ioport m_sw1; required_ioport m_s1; bool m_cs; // card selected - uint8_t m_status; // ABC BUS status - uint8_t m_data; // ABC BUS data + uint8_t m_status; // ABC BUS status + uint8_t m_data; // ABC BUS data bool m_fdc_irq; // floppy interrupt bool m_fdc_drq; // floppy data request int m_wait_enable; // wait enable - int m_sel0; // drive select 0 - int m_sel1; // drive select 1 + uint8_t m_sel; // drive select }; diff --git a/src/devices/bus/abcbus/lux21046.cpp b/src/devices/bus/abcbus/lux21046.cpp index 6d17cbbf315..facfeb83c7d 100644 --- a/src/devices/bus/abcbus/lux21046.cpp +++ b/src/devices/bus/abcbus/lux21046.cpp @@ -77,6 +77,9 @@ Notes: #include "emu.h" #include "lux21046.h" +#include "formats/abc800_dsk.h" +#include "formats/abc800i_dsk.h" + //************************************************************************** @@ -318,36 +321,36 @@ void luxor_55_21046_device::device_add_mconfig(machine_config & config) void abc830_device::device_add_mconfig(machine_config &config) { luxor_55_21046_device::device_add_mconfig(config); - FLOPPY_CONNECTOR(config, m_floppy0, abc_floppies, "525ssdd", luxor_55_21046_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy1, abc_floppies, "525ssdd", luxor_55_21046_device::floppy_formats).enable_sound(true); + for (auto &floppy : m_floppy) + FLOPPY_CONNECTOR(config, floppy, abc_floppies, "525ssdd", luxor_55_21046_device::floppy_formats).enable_sound(true); } void abc832_device::device_add_mconfig(machine_config &config) { luxor_55_21046_device::device_add_mconfig(config); - FLOPPY_CONNECTOR(config, m_floppy0, abc_floppies, "525qd", luxor_55_21046_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy1, abc_floppies, "525qd", luxor_55_21046_device::floppy_formats).enable_sound(true); + for (auto &floppy : m_floppy) + FLOPPY_CONNECTOR(config, floppy, abc_floppies, "525qd", luxor_55_21046_device::floppy_formats).enable_sound(true); } void abc834_device::device_add_mconfig(machine_config &config) { luxor_55_21046_device::device_add_mconfig(config); - FLOPPY_CONNECTOR(config, m_floppy0, abc_floppies, "525qd", luxor_55_21046_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy1, abc_floppies, "525qd", luxor_55_21046_device::floppy_formats).enable_sound(true); + for (auto &floppy : m_floppy) + FLOPPY_CONNECTOR(config, floppy, abc_floppies, "525qd", luxor_55_21046_device::floppy_formats).enable_sound(true); } void abc838_device::device_add_mconfig(machine_config &config) { luxor_55_21046_device::device_add_mconfig(config); - FLOPPY_CONNECTOR(config, m_floppy0, abc_floppies, "8dsdd", luxor_55_21046_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy1, abc_floppies, "8dsdd", luxor_55_21046_device::floppy_formats).enable_sound(true); + for (auto &floppy : m_floppy) + FLOPPY_CONNECTOR(config, floppy, abc_floppies, "8dsdd", luxor_55_21046_device::floppy_formats).enable_sound(true); } void abc850_floppy_device::device_add_mconfig(machine_config &config) { luxor_55_21046_device::device_add_mconfig(config); - FLOPPY_CONNECTOR(config, m_floppy0, abc_floppies, "525qd", luxor_55_21046_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy1, abc_floppies, nullptr, luxor_55_21046_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[0], abc_floppies, "525qd", luxor_55_21046_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[1], abc_floppies, nullptr, luxor_55_21046_device::floppy_formats).enable_sound(true); } @@ -719,12 +722,11 @@ luxor_55_21046_device::luxor_55_21046_device(const machine_config &mconfig, cons luxor_55_21046_device::luxor_55_21046_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), device_abcbus_card_interface(mconfig, *this), - m_floppy0(*this, SAB1793_TAG":0"), - m_floppy1(*this, SAB1793_TAG":1"), + m_floppy(*this, SAB1793_TAG":%u", 0U), m_maincpu(*this, Z80_TAG), m_dma(*this, Z80DMA_TAG), m_fdc(*this, SAB1793_TAG), - m_floppy(nullptr), + m_selected_floppy(nullptr), m_sw1(*this, "SW1"), m_sw2(*this, "SW2"), m_sw3(*this, "SW3"), @@ -1015,20 +1017,23 @@ void luxor_55_21046_device::_9b_w(uint8_t data) */ // drive select - m_floppy = nullptr; + m_selected_floppy = nullptr; - if (BIT(data, 0)) m_floppy = m_floppy0->get_device(); - if (BIT(data, 1)) m_floppy = m_floppy1->get_device(); + 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) + if (m_selected_floppy) { // motor enable - m_floppy->mon_w(!BIT(data, 3)); + m_selected_floppy->mon_w(!BIT(data, 3)); // side select - m_floppy->ss_w(BIT(data, 5)); + m_selected_floppy->ss_w(BIT(data, 5)); } } @@ -1093,8 +1098,8 @@ uint8_t luxor_55_21046_device::_9a_r(offs_t offset) data |= m_busy; // floppy - data |= (m_floppy ? m_floppy->twosid_r() : 1) << 1; - //data |= (m_floppy ? m_floppy->dskchg_r() : 1) << 4; + data |= (m_selected_floppy ? m_selected_floppy->twosid_r() : 1) << 1; + //data |= (m_selected_floppy ? m_selected_floppy->dskchg_r() : 1) << 4; // SW2 uint8_t sw2 = m_sw2->read() & 0x0f; diff --git a/src/devices/bus/abcbus/lux21046.h b/src/devices/bus/abcbus/lux21046.h index 89c2adba047..3f83864b476 100644 --- a/src/devices/bus/abcbus/lux21046.h +++ b/src/devices/bus/abcbus/lux21046.h @@ -14,8 +14,6 @@ #include "abcbus.h" #include "cpu/z80/z80.h" #include "machine/z80daisy.h" -#include "formats/abc800_dsk.h" -#include "formats/abc800i_dsk.h" #include "imagedev/floppy.h" #include "machine/wd_fdc.h" #include "machine/z80dma.h" @@ -80,8 +78,7 @@ protected: static void floppy_formats(format_registration &fr); - required_device m_floppy0; - required_device m_floppy1; + required_device_array m_floppy; private: void dma_int_w(int state); @@ -106,15 +103,15 @@ private: required_device m_maincpu; required_device m_dma; required_device m_fdc; - floppy_image_device *m_floppy; + floppy_image_device *m_selected_floppy; required_ioport m_sw1; required_ioport m_sw2; required_ioport m_sw3; bool m_cs; // card selected - uint8_t m_status; // ABC BUS status - uint8_t m_out; // ABC BUS data in - uint8_t m_inp; // ABC BUS data out + uint8_t m_status; // ABC BUS status + uint8_t m_out; // ABC BUS data in + uint8_t m_inp; // ABC BUS data out bool m_fdc_irq; // FDC interrupt int m_dma_irq; // DMA interrupt int m_busy; // busy bit