summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/bml3
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/bus/bml3')
-rw-r--r--src/emu/bus/bml3/bml3bus.c257
-rw-r--r--src/emu/bus/bml3/bml3bus.h151
-rw-r--r--src/emu/bus/bml3/bml3kanji.c99
-rw-r--r--src/emu/bus/bml3/bml3kanji.h47
-rw-r--r--src/emu/bus/bml3/bml3mp1802.c155
-rw-r--r--src/emu/bus/bml3/bml3mp1802.h50
-rw-r--r--src/emu/bus/bml3/bml3mp1805.c178
-rw-r--r--src/emu/bus/bml3/bml3mp1805.h52
8 files changed, 989 insertions, 0 deletions
diff --git a/src/emu/bus/bml3/bml3bus.c b/src/emu/bus/bml3/bml3bus.c
new file mode 100644
index 00000000000..d864f2e4f1f
--- /dev/null
+++ b/src/emu/bus/bml3/bml3bus.c
@@ -0,0 +1,257 @@
+/***************************************************************************
+
+ bml3bus.c - Hitachi MB-6890 slot bus and card emulation
+
+ Adapted from a2bus by Jonathan Edwards
+
+ Pinout (/ indicates an inverted signal, ie, one that would have a bar over it
+ on a schematic diagram)
+
+ out <-> CPU CPU <-> out
+ ---------- -----------
+ +5V <-- 1 2 <-> GND
+ D0 <-> 3 4 <-> D1
+ D2 <-> 5 6 <-> D3
+ D4 <-> 7 8 <-> D5
+ D6 <-> 9 10 <-> D7
+ A0 <-> 11 12 <-> A1
+ A2 <-> 13 14 <-> A3
+ A4 <-> 15 16 <-> A5
+ A6 <-> 17 18 <-> A7
+ A8 <-> 19 20 <-> A9
+ A10 <-> 21 22 <-> A11
+ A12 <-> 23 24 <-> A13
+ A14 <-> 25 26 <-> A15
+ BA <-- 27 28 --> BS
+ /ROM-KIL --> 29 30 --> EXROM-KIL
+ R/W IN --> 31 32 --> /EX-I/O
+ R/W OUT <-- 33 34 --> VMA OUT
+ E <-- 35 36 --> Q
+ /RES <-- 37 38 <-- /NMI
+ /IRQ --> 39 40 <-- /FIRQ
+ /HALT --> 41 42 <-- /VMA CTRL
+ /DMA --> 43 44 --> /BANK-SW
+ HALT ACK <-- 45 46 <-- SOUND IN
+ 16MCK <-- 47 48 <-> GND
+ 2MCK <-- 49 50 <-> GND
+ -5V <-- 51 52 --> /EX-I/O2
+ -12V <-- 53 54 --> +12V
+ GND <-> 55 56 --> +5V
+
+***************************************************************************/
+
+#include "emu.h"
+#include "emuopts.h"
+#include "bml3bus.h"
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type BML3BUS_SLOT = &device_creator<bml3bus_slot_device>;
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// bml3bus_slot_device - constructor
+//-------------------------------------------------
+bml3bus_slot_device::bml3bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, BML3BUS_SLOT, "Hitachi MB-6890 Slot", tag, owner, clock, "bml3bus_slot", __FILE__),
+ device_slot_interface(mconfig, *this)
+{
+}
+
+bml3bus_slot_device::bml3bus_slot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
+ device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ device_slot_interface(mconfig, *this)
+{
+}
+
+void bml3bus_slot_device::static_set_bml3bus_slot(device_t &device, const char *tag, const char *slottag)
+{
+ bml3bus_slot_device &bml3bus_card = dynamic_cast<bml3bus_slot_device &>(device);
+ bml3bus_card.m_bml3bus_tag = tag;
+ bml3bus_card.m_bml3bus_slottag = slottag;
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void bml3bus_slot_device::device_start()
+{
+ device_bml3bus_card_interface *dev = dynamic_cast<device_bml3bus_card_interface *>(get_card_device());
+
+ if (dev) device_bml3bus_card_interface::static_set_bml3bus_tag(*dev, m_bml3bus_tag, m_bml3bus_slottag);
+}
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type BML3BUS = &device_creator<bml3bus_device>;
+
+void bml3bus_device::static_set_cputag(device_t &device, const char *tag)
+{
+ bml3bus_device &bml3bus = downcast<bml3bus_device &>(device);
+ bml3bus.m_cputag = tag;
+}
+
+//-------------------------------------------------
+// device_config_complete - perform any
+// operations now that the configuration is
+// complete
+//-------------------------------------------------
+
+void bml3bus_device::device_config_complete()
+{
+ // inherit a copy of the static data
+ const bml3bus_interface *intf = reinterpret_cast<const bml3bus_interface *>(static_config());
+ if (intf != NULL)
+ {
+ *static_cast<bml3bus_interface *>(this) = *intf;
+ }
+
+ // or initialize to defaults if none provided
+ else
+ {
+ memset(&m_out_nmi_cb, 0, sizeof(m_out_nmi_cb));
+ memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
+ memset(&m_out_firq_cb, 0, sizeof(m_out_firq_cb));
+ }
+}
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// bml3bus_device - constructor
+//-------------------------------------------------
+
+bml3bus_device::bml3bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, BML3BUS, "Hitachi MB-6890 Bus", tag, owner, clock, "bml3bus", __FILE__)
+{
+}
+
+bml3bus_device::bml3bus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
+ device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+{
+}
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void bml3bus_device::device_start()
+{
+ m_maincpu = machine().device<cpu_device>(m_cputag);
+
+ // resolve callbacks
+ m_out_nmi_func.resolve(m_out_nmi_cb, *this);
+ m_out_irq_func.resolve(m_out_irq_cb, *this);
+ m_out_firq_func.resolve(m_out_firq_cb, *this);
+
+ // clear slots
+ for (int i = 0; i < BML3BUS_MAX_SLOTS; i++)
+ {
+ m_device_list[i] = NULL;
+ }
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void bml3bus_device::device_reset()
+{
+}
+
+device_bml3bus_card_interface *bml3bus_device::get_bml3bus_card(int slot)
+{
+ if (slot < 0)
+ {
+ return NULL;
+ }
+
+ return m_device_list[slot];
+}
+
+void bml3bus_device::add_bml3bus_card(int slot, device_bml3bus_card_interface *card)
+{
+ m_device_list[slot] = card;
+}
+
+void bml3bus_device::set_nmi_line(int state)
+{
+ m_out_nmi_func(state);
+}
+
+void bml3bus_device::set_irq_line(int state)
+{
+ m_out_irq_func(state);
+}
+
+void bml3bus_device::set_firq_line(int state)
+{
+ m_out_firq_func(state);
+}
+
+// interrupt request from bml3bus card
+WRITE_LINE_MEMBER( bml3bus_device::nmi_w ) { m_out_nmi_func(state); }
+WRITE_LINE_MEMBER( bml3bus_device::irq_w ) { m_out_irq_func(state); }
+WRITE_LINE_MEMBER( bml3bus_device::firq_w ) { m_out_firq_func(state); }
+
+//**************************************************************************
+// DEVICE CONFIG BML3BUS CARD INTERFACE
+//**************************************************************************
+
+
+//**************************************************************************
+// DEVICE BML3BUS CARD INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_bml3bus_card_interface - constructor
+//-------------------------------------------------
+
+device_bml3bus_card_interface::device_bml3bus_card_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig, device),
+ m_bml3bus(NULL),
+ m_bml3bus_tag(NULL)
+{
+}
+
+
+//-------------------------------------------------
+// ~device_bml3bus_card_interface - destructor
+//-------------------------------------------------
+
+device_bml3bus_card_interface::~device_bml3bus_card_interface()
+{
+}
+
+void device_bml3bus_card_interface::static_set_bml3bus_tag(device_t &device, const char *tag, const char *slottag)
+{
+ device_bml3bus_card_interface &bml3bus_card = dynamic_cast<device_bml3bus_card_interface &>(device);
+ bml3bus_card.m_bml3bus_tag = tag;
+ bml3bus_card.m_bml3bus_slottag = slottag;
+}
+
+void device_bml3bus_card_interface::set_bml3bus_device()
+{
+ // extract the slot number from the last digit of the slot tag
+ int tlen = strlen(m_bml3bus_slottag);
+
+ m_slot = (m_bml3bus_slottag[tlen-1] - '1');
+
+ if (m_slot < 0 || m_slot >= BML3BUS_MAX_SLOTS)
+ {
+ fatalerror("Slot %x out of range for Hitachi MB-6890 Bus\n", m_slot);
+ }
+
+ m_bml3bus = dynamic_cast<bml3bus_device *>(device().machine().device(m_bml3bus_tag));
+ m_bml3bus->add_bml3bus_card(m_slot, this);
+}
diff --git a/src/emu/bus/bml3/bml3bus.h b/src/emu/bus/bml3/bml3bus.h
new file mode 100644
index 00000000000..66a5660bbd2
--- /dev/null
+++ b/src/emu/bus/bml3/bml3bus.h
@@ -0,0 +1,151 @@
+/***************************************************************************
+
+ bml3bus.h - Hitachi MB-6890 slot bus and card emulation
+
+ Adapted from a2bus by Jonathan Edwards
+
+***************************************************************************/
+
+#pragma once
+
+#ifndef __BML3BUS_H__
+#define __BML3BUS_H__
+
+#include "emu.h"
+
+#define BML3BUS_MAX_SLOTS 6
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_BML3BUS_BUS_ADD(_tag, _cputag, _config) \
+ MCFG_DEVICE_ADD(_tag, BML3BUS, 0) \
+ MCFG_DEVICE_CONFIG(_config) \
+ bml3bus_device::static_set_cputag(*device, _cputag);
+#define MCFG_BML3BUS_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, BML3BUS_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
+ bml3bus_slot_device::static_set_bml3bus_slot(*device, _nbtag, _tag);
+#define MCFG_BML3BUS_SLOT_REMOVE(_tag) \
+ MCFG_DEVICE_REMOVE(_tag)
+
+#define MCFG_BML3BUS_ONBOARD_ADD(_nbtag, _tag, _dev_type) \
+ MCFG_DEVICE_ADD(_tag, _dev_type, 0) \
+ device_bml3bus_card_interface::static_set_bml3bus_tag(*device, _nbtag, _tag);
+
+#define MCFG_BML3BUS_BUS_REMOVE(_tag) \
+ MCFG_DEVICE_REMOVE(_tag)
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class bml3bus_device;
+
+class bml3bus_slot_device : public device_t,
+ public device_slot_interface
+{
+public:
+ // construction/destruction
+ bml3bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ bml3bus_slot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+
+ // device-level overrides
+ virtual void device_start();
+
+ // inline configuration
+ static void static_set_bml3bus_slot(device_t &device, const char *tag, const char *slottag);
+protected:
+ // configuration
+ const char *m_bml3bus_tag, *m_bml3bus_slottag;
+};
+
+// device type definition
+extern const device_type BML3BUS_SLOT;
+
+// ======================> bml3bus_interface
+
+struct bml3bus_interface
+{
+ devcb_write_line m_out_nmi_cb;
+ devcb_write_line m_out_irq_cb;
+ devcb_write_line m_out_firq_cb;
+};
+
+class device_bml3bus_card_interface;
+// ======================> bml3bus_device
+class bml3bus_device : public device_t,
+ public bml3bus_interface
+{
+public:
+ // construction/destruction
+ bml3bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ bml3bus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+ // inline configuration
+ static void static_set_cputag(device_t &device, const char *tag);
+
+ void add_bml3bus_card(int slot, device_bml3bus_card_interface *card);
+ device_bml3bus_card_interface *get_bml3bus_card(int slot);
+
+ void set_nmi_line(int state);
+ void set_irq_line(int state);
+ void set_firq_line(int state);
+
+ DECLARE_WRITE_LINE_MEMBER( nmi_w );
+ DECLARE_WRITE_LINE_MEMBER( irq_w );
+ DECLARE_WRITE_LINE_MEMBER( firq_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+ virtual void device_config_complete();
+
+ // internal state
+ cpu_device *m_maincpu;
+
+ devcb_resolved_write_line m_out_nmi_func;
+ devcb_resolved_write_line m_out_irq_func;
+ devcb_resolved_write_line m_out_firq_func;
+
+ device_bml3bus_card_interface *m_device_list[BML3BUS_MAX_SLOTS];
+ const char *m_cputag;
+};
+
+
+// device type definition
+extern const device_type BML3BUS;
+
+// ======================> device_bml3bus_card_interface
+
+// class representing interface-specific live bml3bus card
+class device_bml3bus_card_interface : public device_slot_card_interface
+{
+ friend class bml3bus_device;
+public:
+ // construction/destruction
+ device_bml3bus_card_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_bml3bus_card_interface();
+
+ device_bml3bus_card_interface *next() const { return m_next; }
+
+ void set_bml3bus_device();
+
+ void raise_slot_nmi() { m_bml3bus->set_nmi_line(ASSERT_LINE); }
+ void lower_slot_nmi() { m_bml3bus->set_nmi_line(CLEAR_LINE); }
+ void raise_slot_irq() { m_bml3bus->set_irq_line(ASSERT_LINE); }
+ void lower_slot_irq() { m_bml3bus->set_irq_line(CLEAR_LINE); }
+ void raise_slot_firq() { m_bml3bus->set_firq_line(ASSERT_LINE); }
+ void lower_slot_firq() { m_bml3bus->set_firq_line(CLEAR_LINE); }
+
+ // inline configuration
+ static void static_set_bml3bus_tag(device_t &device, const char *tag, const char *slottag);
+public:
+ bml3bus_device *m_bml3bus;
+ const char *m_bml3bus_tag, *m_bml3bus_slottag;
+ int m_slot;
+ device_bml3bus_card_interface *m_next;
+};
+
+#endif /* __BML3BUS_H__ */
diff --git a/src/emu/bus/bml3/bml3kanji.c b/src/emu/bus/bml3/bml3kanji.c
new file mode 100644
index 00000000000..e13f07e28ff
--- /dev/null
+++ b/src/emu/bus/bml3/bml3kanji.c
@@ -0,0 +1,99 @@
+/*********************************************************************
+
+ bml3kanji.c
+
+ Hitachi MP-9740 (?) kanji character ROM for the MB-689x
+
+*********************************************************************/
+
+#include "emu.h"
+#include "bml3kanji.h"
+
+
+/***************************************************************************
+ PARAMETERS
+***************************************************************************/
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type BML3BUS_KANJI = &device_creator<bml3bus_kanji_device>;
+
+#define KANJI_ROM_REGION "kanji_rom"
+
+ROM_START( kanji )
+ ROM_REGION( 0x20000, KANJI_ROM_REGION, ROMREGION_ERASEFF )
+ ROM_LOAD("kanji.rom", 0x00000, 0x20000, BAD_DUMP CRC(de99a726) SHA1(65fead5d0d779b242f6e0ac25fcc9899dc343101))
+ROM_END
+
+MACHINE_CONFIG_FRAGMENT( kanji )
+ // nothing to add
+MACHINE_CONFIG_END
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor bml3bus_kanji_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( kanji );
+}
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *bml3bus_kanji_device::device_rom_region() const
+{
+ return ROM_NAME( kanji );
+}
+
+READ8_MEMBER( bml3bus_kanji_device::bml3_kanji_r )
+{
+ return m_rom[((UINT32)m_kanji_addr << 1) + offset];
+}
+
+WRITE8_MEMBER( bml3bus_kanji_device::bml3_kanji_w )
+{
+ m_kanji_addr &= (0xff << (offset*8));
+ m_kanji_addr |= (data << ((offset^1)*8));
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+bml3bus_kanji_device::bml3bus_kanji_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, BML3BUS_KANJI, "Hitachi MP-9740 Kanji Character ROM Card", tag, owner, clock, "bml3kanji", __FILE__),
+ device_bml3bus_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void bml3bus_kanji_device::device_start()
+{
+ // set_bml3bus_device makes m_slot valid
+ set_bml3bus_device();
+
+ m_rom = memregion(KANJI_ROM_REGION)->base();
+
+ // install into memory
+ address_space &space_prg = machine().firstcpu->space(AS_PROGRAM);
+ space_prg.install_readwrite_handler(0xff75, 0xff76, read8_delegate( FUNC(bml3bus_kanji_device::bml3_kanji_r), this), write8_delegate(FUNC(bml3bus_kanji_device::bml3_kanji_w), this) );
+}
+
+void bml3bus_kanji_device::device_reset()
+{
+ m_kanji_addr = 0;
+}
diff --git a/src/emu/bus/bml3/bml3kanji.h b/src/emu/bus/bml3/bml3kanji.h
new file mode 100644
index 00000000000..91353e001f9
--- /dev/null
+++ b/src/emu/bus/bml3/bml3kanji.h
@@ -0,0 +1,47 @@
+/*********************************************************************
+
+ bml3kanji.h
+
+ Hitachi MP-9740 (?) kanji character ROM for the MB-689x
+
+*********************************************************************/
+
+#ifndef __BML3BUS_KANJI__
+#define __BML3BUS_KANJI__
+
+#include "emu.h"
+#include "bml3bus.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class bml3bus_kanji_device:
+ public device_t,
+ public device_bml3bus_card_interface
+{
+public:
+ // construction/destruction
+ bml3bus_kanji_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual const rom_entry *device_rom_region() const;
+
+ DECLARE_READ8_MEMBER(bml3_kanji_r);
+ DECLARE_WRITE8_MEMBER(bml3_kanji_w);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+ UINT16 m_kanji_addr;
+
+private:
+ UINT8 *m_rom;
+};
+
+// device type definition
+extern const device_type BML3BUS_KANJI;
+
+#endif /* __BML3BUS_KANJI__ */
diff --git a/src/emu/bus/bml3/bml3mp1802.c b/src/emu/bus/bml3/bml3mp1802.c
new file mode 100644
index 00000000000..3d20f77f122
--- /dev/null
+++ b/src/emu/bus/bml3/bml3mp1802.c
@@ -0,0 +1,155 @@
+/*********************************************************************
+
+ bml3mp1802.c
+
+ Hitachi MP-1802 floppy disk controller card for the MB-6890
+ Hitachi MP-3550 floppy drive is attached
+
+*********************************************************************/
+
+#include "emu.h"
+#include "bml3mp1802.h"
+
+
+/***************************************************************************
+ PARAMETERS
+***************************************************************************/
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type BML3BUS_MP1802 = &device_creator<bml3bus_mp1802_device>;
+
+static const floppy_interface bml3_mp1802_floppy_interface =
+{
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ FLOPPY_STANDARD_5_25_DSDD,
+ LEGACY_FLOPPY_OPTIONS_NAME(default),
+ NULL
+};
+
+WRITE_LINE_MEMBER( bml3bus_mp1802_device::bml3_wd17xx_intrq_w )
+{
+ if (state) {
+ m_bml3bus->set_nmi_line(PULSE_LINE);
+ }
+}
+
+const wd17xx_interface bml3_wd17xx_interface =
+{
+ DEVCB_NULL,
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, bml3bus_mp1802_device, bml3_wd17xx_intrq_w),
+ DEVCB_NULL,
+ {FLOPPY_0, FLOPPY_1}
+};
+
+
+#define MP1802_ROM_REGION "mp1802_rom"
+
+ROM_START( mp1802 )
+ ROM_REGION(0x10000, MP1802_ROM_REGION, 0)
+ // MP-1802 disk controller ROM, which replaces part of the system ROM
+ ROM_LOAD( "mp1802.rom", 0xf800, 0x800, BAD_DUMP CRC(8d0dc101) SHA1(92f7d1cebecafa7472e45c4999520de5c01c6dbc))
+ROM_END
+
+MACHINE_CONFIG_FRAGMENT( mp1802 )
+ MCFG_MB8866_ADD("wd17xx", bml3_wd17xx_interface )
+ MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(bml3_mp1802_floppy_interface)
+MACHINE_CONFIG_END
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor bml3bus_mp1802_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( mp1802 );
+}
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *bml3bus_mp1802_device::device_rom_region() const
+{
+ return ROM_NAME( mp1802 );
+}
+
+READ8_MEMBER( bml3bus_mp1802_device::bml3_mp1802_r)
+{
+ return wd17xx_drq_r(m_wd17xx) ? 0x00 : 0x80;
+}
+
+WRITE8_MEMBER( bml3bus_mp1802_device::bml3_mp1802_w)
+{
+ int drive = data & 0x03;
+ int side = BIT(data, 4);
+ int motor = BIT(data, 3);
+ const char *floppy_name = NULL;
+ switch (drive) {
+ case 0:
+ floppy_name = FLOPPY_0;
+ break;
+ case 1:
+ floppy_name = FLOPPY_1;
+ break;
+ case 2:
+ floppy_name = FLOPPY_2;
+ break;
+ case 3:
+ floppy_name = FLOPPY_3;
+ break;
+ }
+ device_t *floppy = subdevice(floppy_name);
+ wd17xx_set_drive(m_wd17xx,drive);
+ floppy_mon_w(floppy, !motor);
+ floppy_drive_set_ready_state(floppy, ASSERT_LINE, 0);
+ wd17xx_set_side(m_wd17xx,side);
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+bml3bus_mp1802_device::bml3bus_mp1802_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, BML3BUS_MP1802, "Hitachi MP-1802 Floppy Controller Card", tag, owner, clock, "bml3mp1802", __FILE__),
+ device_bml3bus_card_interface(mconfig, *this),
+ m_wd17xx(*this, "wd17xx")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void bml3bus_mp1802_device::device_start()
+{
+ // set_bml3bus_device makes m_slot valid
+ set_bml3bus_device();
+
+ m_rom = memregion(MP1802_ROM_REGION)->base();
+
+ // install into memory
+ address_space &space_prg = machine().firstcpu->space(AS_PROGRAM);
+ space_prg.install_legacy_readwrite_handler(m_wd17xx, 0xff00, 0xff03, FUNC(wd17xx_r), FUNC(wd17xx_w));
+ space_prg.install_readwrite_handler(0xff04, 0xff04, read8_delegate( FUNC(bml3bus_mp1802_device::bml3_mp1802_r), this), write8_delegate(FUNC(bml3bus_mp1802_device::bml3_mp1802_w), this) );
+ // overwriting the main ROM (rather than using e.g. install_rom) should mean that bank switches for RAM expansion still work...
+ UINT8 *mainrom = device().machine().root_device().memregion("maincpu")->base();
+ memcpy(mainrom + 0xf800, m_rom + 0xf800, 0x800);
+}
+
+void bml3bus_mp1802_device::device_reset()
+{
+}
diff --git a/src/emu/bus/bml3/bml3mp1802.h b/src/emu/bus/bml3/bml3mp1802.h
new file mode 100644
index 00000000000..81301c79661
--- /dev/null
+++ b/src/emu/bus/bml3/bml3mp1802.h
@@ -0,0 +1,50 @@
+/*********************************************************************
+
+ bml3mp1802.h
+
+ Hitachi MP-1802 floppy disk controller card for the MB-6890
+ Hitachi MP-3550 floppy drive is attached
+
+*********************************************************************/
+
+#ifndef __BML3BUS_MP1802__
+#define __BML3BUS_MP1802__
+
+#include "emu.h"
+#include "bml3bus.h"
+#include "imagedev/flopdrv.h"
+#include "machine/wd17xx.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class bml3bus_mp1802_device:
+ public device_t,
+ public device_bml3bus_card_interface
+{
+public:
+ // construction/destruction
+ bml3bus_mp1802_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual const rom_entry *device_rom_region() const;
+
+ DECLARE_READ8_MEMBER(bml3_mp1802_r);
+ DECLARE_WRITE8_MEMBER(bml3_mp1802_w);
+ DECLARE_WRITE_LINE_MEMBER(bml3_wd17xx_intrq_w);
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+ required_device<mb8866_device> m_wd17xx;
+
+private:
+ UINT8 *m_rom;
+};
+
+// device type definition
+extern const device_type BML3BUS_MP1802;
+
+#endif /* __BML3BUS_MP1802__ */
diff --git a/src/emu/bus/bml3/bml3mp1805.c b/src/emu/bus/bml3/bml3mp1805.c
new file mode 100644
index 00000000000..2fb71c1605a
--- /dev/null
+++ b/src/emu/bus/bml3/bml3mp1805.c
@@ -0,0 +1,178 @@
+/*********************************************************************
+
+ bml3mp1805.c
+
+ Hitachi MP-1805 floppy disk controller card for the MB-6890
+ Floppy drive is attached
+
+*********************************************************************/
+
+#include "emu.h"
+#include "bml3mp1805.h"
+
+
+/***************************************************************************
+ PARAMETERS
+***************************************************************************/
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type BML3BUS_MP1805 = &device_creator<bml3bus_mp1805_device>;
+
+static const floppy_interface bml3_mp1805_floppy_interface =
+{
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ FLOPPY_STANDARD_3_SSDD,
+ LEGACY_FLOPPY_OPTIONS_NAME(default),
+ NULL
+};
+
+WRITE_LINE_MEMBER( bml3bus_mp1805_device::bml3_mc6843_intrq_w )
+{
+ if (state) {
+ m_bml3bus->set_nmi_line(PULSE_LINE);
+ }
+}
+
+const mc6843_interface bml3_6843_if =
+{
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, bml3bus_mp1805_device, bml3_mc6843_intrq_w)
+};
+
+
+#define MP1805_ROM_REGION "mp1805_rom"
+
+ROM_START( mp1805 )
+ ROM_REGION(0x10000, MP1805_ROM_REGION, 0)
+ // MP-1805 disk controller ROM, which replaces part of the system ROM
+ ROM_LOAD( "mp1805.rom", 0xf800, 0x0800, BAD_DUMP CRC(b532d8d9) SHA1(6f1160356d5bf64b5926b1fdb60db414edf65f22))
+ROM_END
+
+MACHINE_CONFIG_FRAGMENT( mp1805 )
+ MCFG_MC6843_ADD( "mc6843", bml3_6843_if )
+ MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(bml3_mp1805_floppy_interface)
+MACHINE_CONFIG_END
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor bml3bus_mp1805_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( mp1805 );
+}
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *bml3bus_mp1805_device::device_rom_region() const
+{
+ return ROM_NAME( mp1805 );
+}
+
+READ8_MEMBER( bml3bus_mp1805_device::bml3_mp1805_r)
+{
+ // TODO: read supported or not?
+ // return mc6843_drq_r(m_mc6843) ? 0x00 : 0x80;
+ return -1;
+}
+
+WRITE8_MEMBER( bml3bus_mp1805_device::bml3_mp1805_w)
+{
+ // b7 b6 b5 b4 b3 b2 b1 b0
+ // MT ? ? ? D3 D2 D1 D0
+ // MT: 0=motor off, 1=motor on
+ // Dn: 1=select drive <n>
+ int drive_select = data & 0x0f;
+ int drive;
+ // TODO: MESS UI for flipping disk? Note that D88 images are double-sided, but the physical drive is single-sided
+ int side = 0;
+ int motor = BIT(data, 7);
+ const char *floppy_name = NULL;
+ switch (drive_select) {
+ case 1:
+ drive = 0;
+ break;
+ case 2:
+ drive = 1;
+ break;
+ case 4:
+ drive = 2;
+ break;
+ case 8:
+ drive = 3;
+ break;
+ default:
+ // TODO: what's the correct behaviour if more than one drive select bit is set? Or no bit set?
+ drive = 0;
+ break;
+ }
+ switch (drive) {
+ case 0:
+ floppy_name = FLOPPY_0;
+ break;
+ case 1:
+ floppy_name = FLOPPY_1;
+ break;
+ case 2:
+ floppy_name = FLOPPY_2;
+ break;
+ case 3:
+ floppy_name = FLOPPY_3;
+ break;
+ }
+ device_t *floppy = subdevice(floppy_name);
+ m_mc6843->set_drive(drive);
+ floppy_mon_w(floppy, motor);
+ floppy_drive_set_ready_state(floppy, ASSERT_LINE, 0);
+ m_mc6843->set_side(side);
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+bml3bus_mp1805_device::bml3bus_mp1805_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, BML3BUS_MP1805, "Hitachi MP-1805 Floppy Controller Card", tag, owner, clock, "bml3mp1805", __FILE__),
+ device_bml3bus_card_interface(mconfig, *this),
+ m_mc6843(*this, "mc6843")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void bml3bus_mp1805_device::device_start()
+{
+ // set_bml3bus_device makes m_slot valid
+ set_bml3bus_device();
+
+ m_rom = memregion(MP1805_ROM_REGION)->base();
+
+ // install into memory
+ address_space &space_prg = machine().firstcpu->space(AS_PROGRAM);
+ space_prg.install_readwrite_handler(0xff18, 0xff1f, read8_delegate( FUNC(mc6843_device::read), (mc6843_device*)m_mc6843), write8_delegate(FUNC(mc6843_device::write), (mc6843_device*)m_mc6843) );
+ space_prg.install_readwrite_handler(0xff20, 0xff20, read8_delegate( FUNC(bml3bus_mp1805_device::bml3_mp1805_r), this), write8_delegate(FUNC(bml3bus_mp1805_device::bml3_mp1805_w), this) );
+ // overwriting the main ROM (rather than using e.g. install_rom) should mean that bank switches for RAM expansion still work...
+ UINT8 *mainrom = device().machine().root_device().memregion("maincpu")->base();
+ memcpy(mainrom + 0xf800, m_rom + 0xf800, 0x800);
+}
+
+void bml3bus_mp1805_device::device_reset()
+{
+}
diff --git a/src/emu/bus/bml3/bml3mp1805.h b/src/emu/bus/bml3/bml3mp1805.h
new file mode 100644
index 00000000000..4f3ab58e9dd
--- /dev/null
+++ b/src/emu/bus/bml3/bml3mp1805.h
@@ -0,0 +1,52 @@
+/*********************************************************************
+
+ bml3mp1805.h
+
+ Hitachi MP-1805 floppy disk controller card for the MB-6890
+ Floppy drive is attached
+
+*********************************************************************/
+
+#ifndef __BML3BUS_MP1805__
+#define __BML3BUS_MP1805__
+
+#include "emu.h"
+#include "bml3bus.h"
+#include "imagedev/flopdrv.h"
+#include "machine/mc6843.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class bml3bus_mp1805_device:
+ public device_t,
+ public device_bml3bus_card_interface
+{
+public:
+ // construction/destruction
+ bml3bus_mp1805_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual const rom_entry *device_rom_region() const;
+
+ DECLARE_READ8_MEMBER(bml3_mp1805_r);
+ DECLARE_WRITE8_MEMBER(bml3_mp1805_w);
+
+ DECLARE_WRITE_LINE_MEMBER( bml3_mc6843_intrq_w );
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+ required_device<mc6843_device> m_mc6843;
+
+private:
+ UINT8 *m_rom;
+};
+
+// device type definition
+extern const device_type BML3BUS_MP1805;
+
+#endif /* __BML3BUS_MP1805__ */