From ea47c29c49bb189972dfa876c61fc5bf74bf795a Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 19 Mar 2023 15:52:16 -0400 Subject: bml3mp1802: Clean up code a little; use input merger for NMI * bml3mp1805: Don't force ready since 6809 code actually polls for it --- src/devices/bus/bml3/bml3mp1802.cpp | 41 +++++++++++++++++-------------------- src/devices/bus/bml3/bml3mp1802.h | 9 ++++---- src/devices/bus/bml3/bml3mp1805.cpp | 1 - 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/src/devices/bus/bml3/bml3mp1802.cpp b/src/devices/bus/bml3/bml3mp1802.cpp index 61900cd020f..3a2d9d2bd9d 100644 --- a/src/devices/bus/bml3/bml3mp1802.cpp +++ b/src/devices/bus/bml3/bml3mp1802.cpp @@ -30,13 +30,12 @@ static void mp1802_floppies(device_slot_interface &device) device.option_add("dd", FLOPPY_525_DD); } -WRITE_LINE_MEMBER( bml3bus_mp1802_device::bml3_wd17xx_intrq_w ) +WRITE_LINE_MEMBER( bml3bus_mp1802_device::nmi_w ) { if (state) - { raise_slot_nmi(); + else lower_slot_nmi(); - } } #define MP1802_ROM_REGION "mp1802_rom" @@ -61,12 +60,15 @@ void bml3bus_mp1802_device::device_add_mconfig(machine_config &config) constexpr auto CLK16M = 32.256_MHz_XTAL / 2; MB8866(config, m_fdc, CLK16M / 16); // 16MCLK divided by IC628 (HD74LS93P) - m_fdc->intrq_wr_callback().set(FUNC(bml3bus_mp1802_device::bml3_wd17xx_intrq_w)); + m_fdc->intrq_wr_callback().set(m_nmigate, FUNC(input_merger_device::in_w<0>)); - FLOPPY_CONNECTOR(config, m_floppy0, mp1802_floppies, "dd", floppy_image_device::default_mfm_floppy_formats); - FLOPPY_CONNECTOR(config, m_floppy1, mp1802_floppies, "dd", floppy_image_device::default_mfm_floppy_formats); - FLOPPY_CONNECTOR(config, m_floppy2, mp1802_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); - FLOPPY_CONNECTOR(config, m_floppy3, mp1802_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); + INPUT_MERGER_ALL_HIGH(config, m_nmigate); + m_nmigate->output_handler().set(FUNC(bml3bus_mp1802_device::nmi_w)); + + FLOPPY_CONNECTOR(config, m_floppy[0], mp1802_floppies, "dd", floppy_image_device::default_mfm_floppy_formats); + FLOPPY_CONNECTOR(config, m_floppy[1], mp1802_floppies, "dd", floppy_image_device::default_mfm_floppy_formats); + FLOPPY_CONNECTOR(config, m_floppy[2], mp1802_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); + FLOPPY_CONNECTOR(config, m_floppy[3], mp1802_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats); SOFTWARE_LIST(config, "flop_list").set_original("bml3_flop").set_filter("5"); } @@ -81,28 +83,23 @@ const tiny_rom_entry *bml3bus_mp1802_device::device_rom_region() const uint8_t bml3bus_mp1802_device::bml3_mp1802_r() { - return m_fdc->drq_r() ? 0x00 : 0x80; + return (m_fdc->drq_r() ? 0x00 : 0x80) | (m_fdc->intrq_r() ? 0x00 : 0x40); } void bml3bus_mp1802_device::bml3_mp1802_w(uint8_t data) { - floppy_image_device *floppy = nullptr; - - switch (data & 0x03) - { - case 0: floppy = m_floppy0->get_device(); break; - case 1: floppy = m_floppy1->get_device(); break; - case 2: floppy = m_floppy2->get_device(); break; - case 3: floppy = m_floppy3->get_device(); break; - } + floppy_image_device *floppy = m_floppy[data & 0x03]->get_device(); m_fdc->set_floppy(floppy); + //m_fdc->dden_w(!BIT(data, 5)); // TODO: support FM tracks in d88_format if (floppy) { floppy->mon_w(!BIT(data, 3)); floppy->ss_w(BIT(data, 4)); } + + m_nmigate->in_w<1>(!BIT(data, 6)); } @@ -114,10 +111,9 @@ bml3bus_mp1802_device::bml3bus_mp1802_device(const machine_config &mconfig, cons device_t(mconfig, BML3BUS_MP1802, tag, owner, clock), device_bml3bus_card_interface(mconfig, *this), m_fdc(*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), - m_floppy2(*this, "fdc:2"), - m_floppy3(*this, "fdc:3"), m_rom(nullptr) + m_floppy(*this, "fdc:%u", 0U), + m_nmigate(*this, "nmigate"), + m_rom(nullptr) { } @@ -141,4 +137,5 @@ void bml3bus_mp1802_device::device_start() void bml3bus_mp1802_device::device_reset() { + bml3_mp1802_w(0); } diff --git a/src/devices/bus/bml3/bml3mp1802.h b/src/devices/bus/bml3/bml3mp1802.h index d1bbdad744b..23d79db8ec7 100644 --- a/src/devices/bus/bml3/bml3mp1802.h +++ b/src/devices/bus/bml3/bml3mp1802.h @@ -16,6 +16,7 @@ #include "bml3bus.h" #include "imagedev/floppy.h" +#include "machine/input_merger.h" #include "machine/wd_fdc.h" @@ -43,13 +44,11 @@ protected: virtual const tiny_rom_entry *device_rom_region() const override; private: - DECLARE_WRITE_LINE_MEMBER(bml3_wd17xx_intrq_w); + DECLARE_WRITE_LINE_MEMBER(nmi_w); required_device m_fdc; - required_device m_floppy0; - required_device m_floppy1; - required_device m_floppy2; - required_device m_floppy3; + required_device_array m_floppy; + required_device m_nmigate; uint8_t *m_rom; }; diff --git a/src/devices/bus/bml3/bml3mp1805.cpp b/src/devices/bus/bml3/bml3mp1805.cpp index 78b58782d6e..dcdfdb47215 100644 --- a/src/devices/bus/bml3/bml3mp1805.cpp +++ b/src/devices/bus/bml3/bml3mp1805.cpp @@ -53,7 +53,6 @@ void bml3bus_mp1805_device::floppy_drives(device_slot_interface &device) void bml3bus_mp1805_device::device_add_mconfig(machine_config &config) { MC6843(config, m_mc6843, 500000); - m_mc6843->force_ready(); m_mc6843->irq().set(FUNC(bml3bus_mp1805_device::nmi_w)); FLOPPY_CONNECTOR(config, m_floppy[0], floppy_drives, "mb_6890", floppy_image_device::default_mfm_floppy_formats).enable_sound(true); -- cgit v1.2.3