From 18c6ade499a0cbdaa6a9a2f618442860ceb130ae Mon Sep 17 00:00:00 2001 From: angelosa Date: Fri, 20 Sep 2024 09:34:38 +0200 Subject: bus/bml3: drop bml3 prefix for slot options filenames --- scripts/src/bus.lua | 16 ++-- src/devices/bus/bml3/bml3kanji.cpp | 86 ------------------- src/devices/bus/bml3/bml3kanji.h | 51 ----------- src/devices/bus/bml3/bml3mp1802.cpp | 143 ------------------------------- src/devices/bus/bml3/bml3mp1802.h | 62 -------------- src/devices/bus/bml3/bml3mp1805.cpp | 163 ------------------------------------ src/devices/bus/bml3/bml3mp1805.h | 61 -------------- src/devices/bus/bml3/bml3rtc.cpp | 109 ------------------------ src/devices/bus/bml3/bml3rtc.h | 54 ------------ src/devices/bus/bml3/kanji.cpp | 86 +++++++++++++++++++ src/devices/bus/bml3/kanji.h | 51 +++++++++++ src/devices/bus/bml3/mp1802.cpp | 143 +++++++++++++++++++++++++++++++ src/devices/bus/bml3/mp1802.h | 62 ++++++++++++++ src/devices/bus/bml3/mp1805.cpp | 163 ++++++++++++++++++++++++++++++++++++ src/devices/bus/bml3/mp1805.h | 61 ++++++++++++++ src/devices/bus/bml3/rtc.cpp | 109 ++++++++++++++++++++++++ src/devices/bus/bml3/rtc.h | 54 ++++++++++++ src/mame/hitachi/bml3.cpp | 8 +- 18 files changed, 741 insertions(+), 741 deletions(-) delete mode 100644 src/devices/bus/bml3/bml3kanji.cpp delete mode 100644 src/devices/bus/bml3/bml3kanji.h delete mode 100644 src/devices/bus/bml3/bml3mp1802.cpp delete mode 100644 src/devices/bus/bml3/bml3mp1802.h delete mode 100644 src/devices/bus/bml3/bml3mp1805.cpp delete mode 100644 src/devices/bus/bml3/bml3mp1805.h delete mode 100644 src/devices/bus/bml3/bml3rtc.cpp delete mode 100644 src/devices/bus/bml3/bml3rtc.h create mode 100644 src/devices/bus/bml3/kanji.cpp create mode 100644 src/devices/bus/bml3/kanji.h create mode 100644 src/devices/bus/bml3/mp1802.cpp create mode 100644 src/devices/bus/bml3/mp1802.h create mode 100644 src/devices/bus/bml3/mp1805.cpp create mode 100644 src/devices/bus/bml3/mp1805.h create mode 100644 src/devices/bus/bml3/rtc.cpp create mode 100644 src/devices/bus/bml3/rtc.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 16f86826013..2b94b22976c 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -4235,14 +4235,14 @@ if (BUSES["BML3"]~=null) then files { MAME_DIR .. "src/devices/bus/bml3/bml3bus.cpp", MAME_DIR .. "src/devices/bus/bml3/bml3bus.h", - MAME_DIR .. "src/devices/bus/bml3/bml3mp1802.cpp", - MAME_DIR .. "src/devices/bus/bml3/bml3mp1802.h", - MAME_DIR .. "src/devices/bus/bml3/bml3mp1805.cpp", - MAME_DIR .. "src/devices/bus/bml3/bml3mp1805.h", - MAME_DIR .. "src/devices/bus/bml3/bml3kanji.cpp", - MAME_DIR .. "src/devices/bus/bml3/bml3kanji.h", - MAME_DIR .. "src/devices/bus/bml3/bml3rtc.cpp", - MAME_DIR .. "src/devices/bus/bml3/bml3rtc.h", + MAME_DIR .. "src/devices/bus/bml3/mp1802.cpp", + MAME_DIR .. "src/devices/bus/bml3/mp1802.h", + MAME_DIR .. "src/devices/bus/bml3/mp1805.cpp", + MAME_DIR .. "src/devices/bus/bml3/mp1805.h", + MAME_DIR .. "src/devices/bus/bml3/kanji.cpp", + MAME_DIR .. "src/devices/bus/bml3/kanji.h", + MAME_DIR .. "src/devices/bus/bml3/rtc.cpp", + MAME_DIR .. "src/devices/bus/bml3/rtc.h", } end diff --git a/src/devices/bus/bml3/bml3kanji.cpp b/src/devices/bus/bml3/bml3kanji.cpp deleted file mode 100644 index 0e2f9cf7d39..00000000000 --- a/src/devices/bus/bml3/bml3kanji.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Jonathan Edwards -/********************************************************************* - - bml3kanji.c - - Hitachi MP-9740 (?) kanji character ROM for the MB-689x - -*********************************************************************/ - -#include "emu.h" -#include "bml3kanji.h" - - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(BML3BUS_KANJI, bml3bus_kanji_device, "bml3kanji", "Hitachi MP-9740 Kanji Character ROM Card") - -ROM_START( kanji ) - ROM_REGION( 0x20000, "kanji_rom", ROMREGION_ERASEFF ) - ROM_LOAD("kanji.rom", 0x00000, 0x20000, BAD_DUMP CRC(de99a726) SHA1(65fead5d0d779b242f6e0ac25fcc9899dc343101)) -ROM_END - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const tiny_rom_entry *bml3bus_kanji_device::device_rom_region() const -{ - return ROM_NAME( kanji ); -} - -uint8_t bml3bus_kanji_device::bml3_kanji_r(offs_t offset) -{ - return m_rom[((uint32_t)m_kanji_addr << 1) + offset]; -} - -void bml3bus_kanji_device::bml3_kanji_w(offs_t offset, uint8_t data) -{ - 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_t clock) : - device_t(mconfig, BML3BUS_KANJI, tag, owner, clock), - device_bml3bus_card_interface(mconfig, *this), m_kanji_addr(0), - m_rom(*this, "kanji_rom") -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void bml3bus_kanji_device::device_start() -{ - save_item(NAME(m_kanji_addr)); -} - -void bml3bus_kanji_device::map_io(address_space_installer &space) -{ - // install into memory - space.install_readwrite_handler(0xff75, 0xff76, read8sm_delegate(*this, FUNC(bml3bus_kanji_device::bml3_kanji_r)), write8sm_delegate(*this, FUNC(bml3bus_kanji_device::bml3_kanji_w))); -} - -void bml3bus_kanji_device::device_reset() -{ - m_kanji_addr = 0; -} diff --git a/src/devices/bus/bml3/bml3kanji.h b/src/devices/bus/bml3/bml3kanji.h deleted file mode 100644 index d1e456508ae..00000000000 --- a/src/devices/bus/bml3/bml3kanji.h +++ /dev/null @@ -1,51 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Jonathan Edwards -/********************************************************************* - - bml3kanji.h - - Hitachi MP-9740 (?) kanji character ROM for the MB-689x - -*********************************************************************/ - -#ifndef MAME_BUS_BML3_BML3KANJI_H -#define MAME_BUS_BML3_BML3KANJI_H - -#pragma once - -#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_t clock); - - uint8_t bml3_kanji_r(offs_t offset); - void bml3_kanji_w(offs_t offset, uint8_t data); - -protected: - virtual void device_start() override; - virtual void device_reset() override; - - // optional information overrides - virtual const tiny_rom_entry *device_rom_region() const override; - - virtual void map_io(address_space_installer &space) override; - - uint16_t m_kanji_addr; - -private: - required_region_ptr m_rom; -}; - -// device type definition -DECLARE_DEVICE_TYPE(BML3BUS_KANJI, bml3bus_kanji_device) - -#endif // MAME_BUS_BML3_BML3KANJI_H diff --git a/src/devices/bus/bml3/bml3mp1802.cpp b/src/devices/bus/bml3/bml3mp1802.cpp deleted file mode 100644 index f9695af9067..00000000000 --- a/src/devices/bus/bml3/bml3mp1802.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Jonathan Edwards -/********************************************************************* - - 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" - -#include "softlist_dev.h" - - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(BML3BUS_MP1802, bml3bus_mp1802_device, "bml3mp1802", "Hitachi MP-1802 5.25\" Floppy Controller Card") - -static void mp1802_floppies(device_slot_interface &device) -{ - device.option_add("dd", FLOPPY_525_DD); -} - -void bml3bus_mp1802_device::nmi_w(int state) -{ - if (state) - raise_slot_nmi(); - else - lower_slot_nmi(); -} - -ROM_START( mp1802 ) - ROM_REGION(0x800, "mp1802_rom", 0) - // MP-1802 disk controller ROM, which replaces part of the system ROM - ROM_LOAD( "mp1802.rom", 0x000, 0x800, BAD_DUMP CRC(8d0dc101) SHA1(92f7d1cebecafa7472e45c4999520de5c01c6dbc)) -ROM_END - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -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(m_nmigate, FUNC(input_merger_device::in_w<0>)); - - 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"); -} - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const tiny_rom_entry *bml3bus_mp1802_device::device_rom_region() const -{ - return ROM_NAME( mp1802 ); -} - -uint8_t bml3bus_mp1802_device::bml3_mp1802_r() -{ - 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 = m_floppy[data & 0x03]->get_device(); - - m_fdc->set_floppy(floppy); - m_fdc->dden_w(!BIT(data, 5)); - - if (floppy) - { - floppy->mon_w(!BIT(data, 3)); - floppy->ss_w(BIT(data, 4)); - } - - m_nmigate->in_w<1>(!BIT(data, 6)); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -bml3bus_mp1802_device::bml3bus_mp1802_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, BML3BUS_MP1802, tag, owner, clock), - device_bml3bus_card_interface(mconfig, *this), - m_fdc(*this, "fdc"), - m_floppy(*this, "fdc:%u", 0U), - m_nmigate(*this, "nmigate"), - m_rom(*this, "mp1802_rom") -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void bml3bus_mp1802_device::device_start() -{ -} - -void bml3bus_mp1802_device::device_reset() -{ - bml3_mp1802_w(0); -} - -void bml3bus_mp1802_device::map_exrom(address_space_installer &space) -{ - space.install_rom(0xf800, 0xfeff, &m_rom[0]); - space.install_rom(0xfff0, 0xffff, &m_rom[0x7f0]); -} - -void bml3bus_mp1802_device::map_io(address_space_installer &space) -{ - // install into memory - space.install_readwrite_handler(0xff00, 0xff03, read8sm_delegate(*m_fdc, FUNC(mb8866_device::read)), write8sm_delegate(*m_fdc, FUNC(mb8866_device::write))); - space.install_readwrite_handler(0xff04, 0xff04, read8smo_delegate(*this, FUNC(bml3bus_mp1802_device::bml3_mp1802_r)), write8smo_delegate(*this, FUNC(bml3bus_mp1802_device::bml3_mp1802_w))); -} diff --git a/src/devices/bus/bml3/bml3mp1802.h b/src/devices/bus/bml3/bml3mp1802.h deleted file mode 100644 index ecc379261c6..00000000000 --- a/src/devices/bus/bml3/bml3mp1802.h +++ /dev/null @@ -1,62 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Jonathan Edwards -/********************************************************************* - - bml3mp1802.h - - Hitachi MP-1802 floppy disk controller card for the MB-6890 - Hitachi MP-3550 floppy drive is attached - -*********************************************************************/ - -#ifndef MAME_BUS_BML3_BML3MP1802_H -#define MAME_BUS_BML3_BML3MP1802_H - -#pragma once - -#include "bml3bus.h" -#include "imagedev/floppy.h" -#include "machine/input_merger.h" -#include "machine/wd_fdc.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_t clock); - - uint8_t bml3_mp1802_r(); - void bml3_mp1802_w(uint8_t data); - -protected: - virtual void device_start() override; - virtual void device_reset() override; - - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override; - virtual const tiny_rom_entry *device_rom_region() const override; - - virtual void map_exrom(address_space_installer &space) override; - virtual void map_io(address_space_installer &space) override; - -private: - void nmi_w(int state); - - required_device m_fdc; - required_device_array m_floppy; - required_device m_nmigate; - - required_region_ptr m_rom; -}; - -// device type definition -DECLARE_DEVICE_TYPE(BML3BUS_MP1802, bml3bus_mp1802_device) - -#endif // MAME_BUS_BML3_BML3MP1802_H diff --git a/src/devices/bus/bml3/bml3mp1805.cpp b/src/devices/bus/bml3/bml3mp1805.cpp deleted file mode 100644 index 707608c6db3..00000000000 --- a/src/devices/bus/bml3/bml3mp1805.cpp +++ /dev/null @@ -1,163 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Jonathan Edwards -/********************************************************************* - - bml3mp1805.c - - Hitachi MP-1805 floppy disk controller card for the MB-6890 - Floppy drive is attached (single-sided, single density) - -*********************************************************************/ - -#include "emu.h" -#include "bml3mp1805.h" - -#include "softlist_dev.h" - - -/*************************************************************************** - PARAMETERS -***************************************************************************/ - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(BML3BUS_MP1805, bml3bus_mp1805_device, "bml3mp1805", "Hitachi MP-1805 3\" Floppy Controller Card") - -ROM_START( mp1805 ) - ROM_REGION(0x800, "mp1805_rom", 0) - // MP-1805 disk controller ROM, which replaces part of the system ROM - ROM_LOAD( "mp1805.rom", 0x000, 0x800, BAD_DUMP CRC(b532d8d9) SHA1(6f1160356d5bf64b5926b1fdb60db414edf65f22)) -ROM_END - -void bml3bus_mp1805_device::floppy_drives(device_slot_interface &device) -{ - device.option_add("mb_6890", FLOPPY_3_SSSD); -} - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -void bml3bus_mp1805_device::device_add_mconfig(machine_config &config) -{ - MC6843(config, m_mc6843, 500000); - 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); - FLOPPY_CONNECTOR(config, m_floppy[1], floppy_drives, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy[2], floppy_drives, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppy[3], floppy_drives, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); - SOFTWARE_LIST(config, "flop_list").set_original("bml3_flop").set_filter("3"); -} - -//------------------------------------------------- -// rom_region - device-specific ROM region -//------------------------------------------------- - -const tiny_rom_entry *bml3bus_mp1805_device::device_rom_region() const -{ - return ROM_NAME( mp1805 ); -} - -uint8_t bml3bus_mp1805_device::bml3_mp1805_r() -{ - // TODO: read supported or not? - // return mc6843_drq_r(m_mc6843) ? 0x00 : 0x80; - return -1; -} - -void bml3bus_mp1805_device::bml3_mp1805_w(uint8_t data) -{ - // b7 b6 b5 b4 b3 b2 b1 b0 - // MT ? ? ? D3 D2 D1 D0 - // MT: 0=motor off, 1=motor on - // Dn: 1=select drive - - logerror("control_w %02x\n", data); - u8 prev, next; - bool mon = BIT(data, 7); - floppy_image_device *fprev = nullptr, *fnext = nullptr; - - if (!mon) - { - for(prev = 0; prev < 4; prev++) - if(BIT(m_control, prev)) - break; - - if (prev < 4) - { - fprev = m_floppy[prev]->get_device(); - if (fprev) - { - logerror("Drive %d motor off\n",prev); - fprev->mon_w(1); - } - } - } - else - if (data & 15) - { - for(next = 0; next < 4; next++) - if(BIT(data, next)) - break; - - fnext = m_floppy[next]->get_device(); - if (fnext) - { - logerror("Drive %d motor on\n",next); - fnext->mon_w(0); - } - } - - m_control = data; - m_mc6843->set_floppy(fnext); -} - - -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -bml3bus_mp1805_device::bml3bus_mp1805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, BML3BUS_MP1805, tag, owner, clock), - device_bml3bus_card_interface(mconfig, *this), - m_floppy(*this, "%u", 0U), - m_mc6843(*this, "mc6843"), - m_rom(*this, "mp1805_rom") -{ -} - - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void bml3bus_mp1805_device::device_start() -{ - save_item(NAME(m_control)); -} - -void bml3bus_mp1805_device::device_reset() -{ - m_control = 0; -} - -void bml3bus_mp1805_device::map_exrom(address_space_installer &space) -{ - space.install_rom(0xf800, 0xfeff, &m_rom[0]); - space.install_rom(0xfff0, 0xffff, &m_rom[0x7f0]); -} - -void bml3bus_mp1805_device::map_io(address_space_installer &space) -{ - // install into memory - space.install_device(0xff18, 0xff1f, *m_mc6843, &mc6843_device::map); - space.install_readwrite_handler(0xff20, 0xff20, read8smo_delegate(*this, FUNC(bml3bus_mp1805_device::bml3_mp1805_r)), write8smo_delegate(*this, FUNC(bml3bus_mp1805_device::bml3_mp1805_w))); -} diff --git a/src/devices/bus/bml3/bml3mp1805.h b/src/devices/bus/bml3/bml3mp1805.h deleted file mode 100644 index 3dfecc0ec22..00000000000 --- a/src/devices/bus/bml3/bml3mp1805.h +++ /dev/null @@ -1,61 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Jonathan Edwards -/********************************************************************* - - bml3mp1805.h - - Hitachi MP-1805 floppy disk controller card for the MB-6890 - Floppy drive is attached - -*********************************************************************/ - -#ifndef MAME_BUS_BML3_BML3MP1805_H -#define MAME_BUS_BML3_BML3MP1805_H - -#pragma once - -#include "bml3bus.h" -#include "imagedev/floppy.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_t clock); - - uint8_t bml3_mp1805_r(); - void bml3_mp1805_w(uint8_t data); - -protected: - virtual void device_start() override; - virtual void device_reset() override; - - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override; - virtual const tiny_rom_entry *device_rom_region() const override; - - virtual void map_exrom(address_space_installer &space) override; - virtual void map_io(address_space_installer &space) override; - -private: - required_device_array m_floppy; - required_device m_mc6843; - - required_region_ptr m_rom; - - uint8_t m_control; - - static void floppy_drives(device_slot_interface &device); -}; - -// device type definition -DECLARE_DEVICE_TYPE(BML3BUS_MP1805, bml3bus_mp1805_device) - -#endif // MAME_BUS_BML3_BML3MP1805_H diff --git a/src/devices/bus/bml3/bml3rtc.cpp b/src/devices/bus/bml3/bml3rtc.cpp deleted file mode 100644 index 28971440f49..00000000000 --- a/src/devices/bus/bml3/bml3rtc.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Russell Bull -/********************************************************************* - - bml3rtc.cpp - - Hitachi RTC card for the MB-6890 - - I cannot find any reference to the original Hitachi board that - had this feature, but I was given a schematic back in the 1980's - and I designed a board that included the circuitry. - The standard ROM supported this battery-backed RTC and detects - it's presence on start up. - -*********************************************************************/ - -#include "emu.h" -#include "bml3rtc.h" - - -//************************************************************************** -// DEVICE DEFINITIONS -//************************************************************************** - -DEFINE_DEVICE_TYPE(BML3BUS_RTC, bml3bus_rtc_device, "bml3rtc", "Hitachi Real Time Clock Card") - - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -void bml3bus_rtc_device::device_add_mconfig(machine_config &config) -{ - MSM5832(config, m_rtc, 32.768_kHz_XTAL); -} - - -uint8_t bml3bus_rtc_device::bml3_rtc_r(offs_t offset) -{ - uint8_t data = 0x00; - - if (offset == 2) // read @ 0xff3a - { - if (BIT(m_addr_latch, 7)) //bit 7 is the !write buffer enable - { - data = m_rtc->data_r(); - } - else - { - data = m_data_latch; //the Hitachi ROM code detects RTC presence by reading back what it wrote to the data latch - } - } - return data | 0xf0; // return low nibble only -} - -void bml3bus_rtc_device::bml3_rtc_w(offs_t offset, uint8_t data) -{ - switch (offset) - { - case 0: // addr latch @ 0xff38 - m_rtc->cs_w(1); //always selected - m_rtc->write_w(BIT(data, 6)); - m_rtc->read_w(BIT(data, 7)); - m_rtc->address_w(data & 0x0f); - - m_addr_latch = data; - break; - - case 1: // data latch @ 0xff39 - m_rtc->hold_w(BIT(data, 6)); - - if (BIT(m_addr_latch, 6)) - { - m_rtc->data_w(data & 0x0f); - } - - m_data_latch = data; - break; - } -} -//************************************************************************** -// LIVE DEVICE -//************************************************************************** - -bml3bus_rtc_device::bml3bus_rtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, BML3BUS_RTC, tag, owner, clock) - , device_bml3bus_card_interface(mconfig, *this) - , m_rtc(*this, "rtc") -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void bml3bus_rtc_device::device_start() -{ - m_addr_latch = 0; - m_data_latch = 0; - - save_item(NAME(m_addr_latch)); - save_item(NAME(m_data_latch)); -} - -void bml3bus_rtc_device::map_io(address_space_installer &space) -{ - // install into memory - space.install_readwrite_handler(0xff38, 0xff3a, read8sm_delegate(*this, FUNC(bml3bus_rtc_device::bml3_rtc_r)), write8sm_delegate(*this, FUNC(bml3bus_rtc_device::bml3_rtc_w))); -} diff --git a/src/devices/bus/bml3/bml3rtc.h b/src/devices/bus/bml3/bml3rtc.h deleted file mode 100644 index 155bce0904c..00000000000 --- a/src/devices/bus/bml3/bml3rtc.h +++ /dev/null @@ -1,54 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:Russell Bull -/********************************************************************* - - bml3rtc.h - - Hitachi RTC card for the MB-6890 - -*********************************************************************/ - -#ifndef MAME_BUS_BML3_BML3RTC_H -#define MAME_BUS_BML3_BML3RTC_H - -#pragma once - -#include "bml3bus.h" -#include "machine/msm5832.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class bml3bus_rtc_device: - public device_t, - public device_bml3bus_card_interface -{ -public: - // construction/destruction - bml3bus_rtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - uint8_t bml3_rtc_r(offs_t offset); - void bml3_rtc_w(offs_t offset, uint8_t data); - -protected: - // device-level overrides - virtual void device_start() override; - - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override; - - virtual void map_io(address_space_installer &space) override; - -private: - required_device m_rtc; - - uint8_t m_addr_latch; - uint8_t m_data_latch; -}; - -// device type definition -DECLARE_DEVICE_TYPE(BML3BUS_RTC, bml3bus_rtc_device) - -#endif // MAME_BUS_BML3_BML3RTC_H diff --git a/src/devices/bus/bml3/kanji.cpp b/src/devices/bus/bml3/kanji.cpp new file mode 100644 index 00000000000..ecc466b2bda --- /dev/null +++ b/src/devices/bus/bml3/kanji.cpp @@ -0,0 +1,86 @@ +// license:GPL-2.0+ +// copyright-holders:Jonathan Edwards +/********************************************************************* + + bml3kanji.c + + Hitachi MP-9740 (?) kanji character ROM for the MB-689x + +*********************************************************************/ + +#include "emu.h" +#include "kanji.h" + + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(BML3BUS_KANJI, bml3bus_kanji_device, "bml3kanji", "Hitachi MP-9740 Kanji Character ROM Card") + +ROM_START( kanji ) + ROM_REGION( 0x20000, "kanji_rom", ROMREGION_ERASEFF ) + ROM_LOAD("kanji.rom", 0x00000, 0x20000, BAD_DUMP CRC(de99a726) SHA1(65fead5d0d779b242f6e0ac25fcc9899dc343101)) +ROM_END + + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *bml3bus_kanji_device::device_rom_region() const +{ + return ROM_NAME( kanji ); +} + +uint8_t bml3bus_kanji_device::bml3_kanji_r(offs_t offset) +{ + return m_rom[((uint32_t)m_kanji_addr << 1) + offset]; +} + +void bml3bus_kanji_device::bml3_kanji_w(offs_t offset, uint8_t data) +{ + 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_t clock) : + device_t(mconfig, BML3BUS_KANJI, tag, owner, clock), + device_bml3bus_card_interface(mconfig, *this), m_kanji_addr(0), + m_rom(*this, "kanji_rom") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bml3bus_kanji_device::device_start() +{ + save_item(NAME(m_kanji_addr)); +} + +void bml3bus_kanji_device::map_io(address_space_installer &space) +{ + // install into memory + space.install_readwrite_handler(0xff75, 0xff76, read8sm_delegate(*this, FUNC(bml3bus_kanji_device::bml3_kanji_r)), write8sm_delegate(*this, FUNC(bml3bus_kanji_device::bml3_kanji_w))); +} + +void bml3bus_kanji_device::device_reset() +{ + m_kanji_addr = 0; +} diff --git a/src/devices/bus/bml3/kanji.h b/src/devices/bus/bml3/kanji.h new file mode 100644 index 00000000000..d1e456508ae --- /dev/null +++ b/src/devices/bus/bml3/kanji.h @@ -0,0 +1,51 @@ +// license:GPL-2.0+ +// copyright-holders:Jonathan Edwards +/********************************************************************* + + bml3kanji.h + + Hitachi MP-9740 (?) kanji character ROM for the MB-689x + +*********************************************************************/ + +#ifndef MAME_BUS_BML3_BML3KANJI_H +#define MAME_BUS_BML3_BML3KANJI_H + +#pragma once + +#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_t clock); + + uint8_t bml3_kanji_r(offs_t offset); + void bml3_kanji_w(offs_t offset, uint8_t data); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual const tiny_rom_entry *device_rom_region() const override; + + virtual void map_io(address_space_installer &space) override; + + uint16_t m_kanji_addr; + +private: + required_region_ptr m_rom; +}; + +// device type definition +DECLARE_DEVICE_TYPE(BML3BUS_KANJI, bml3bus_kanji_device) + +#endif // MAME_BUS_BML3_BML3KANJI_H diff --git a/src/devices/bus/bml3/mp1802.cpp b/src/devices/bus/bml3/mp1802.cpp new file mode 100644 index 00000000000..30c39ae61d4 --- /dev/null +++ b/src/devices/bus/bml3/mp1802.cpp @@ -0,0 +1,143 @@ +// license:GPL-2.0+ +// copyright-holders:Jonathan Edwards +/********************************************************************* + + bml3mp1802.c + + Hitachi MP-1802 floppy disk controller card for the MB-6890 + Hitachi MP-3550 floppy drive is attached + +*********************************************************************/ + +#include "emu.h" +#include "mp1802.h" + +#include "softlist_dev.h" + + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(BML3BUS_MP1802, bml3bus_mp1802_device, "bml3mp1802", "Hitachi MP-1802 5.25\" Floppy Controller Card") + +static void mp1802_floppies(device_slot_interface &device) +{ + device.option_add("dd", FLOPPY_525_DD); +} + +void bml3bus_mp1802_device::nmi_w(int state) +{ + if (state) + raise_slot_nmi(); + else + lower_slot_nmi(); +} + +ROM_START( mp1802 ) + ROM_REGION(0x800, "mp1802_rom", 0) + // MP-1802 disk controller ROM, which replaces part of the system ROM + ROM_LOAD( "mp1802.rom", 0x000, 0x800, BAD_DUMP CRC(8d0dc101) SHA1(92f7d1cebecafa7472e45c4999520de5c01c6dbc)) +ROM_END + + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +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(m_nmigate, FUNC(input_merger_device::in_w<0>)); + + 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"); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *bml3bus_mp1802_device::device_rom_region() const +{ + return ROM_NAME( mp1802 ); +} + +uint8_t bml3bus_mp1802_device::bml3_mp1802_r() +{ + 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 = m_floppy[data & 0x03]->get_device(); + + m_fdc->set_floppy(floppy); + m_fdc->dden_w(!BIT(data, 5)); + + if (floppy) + { + floppy->mon_w(!BIT(data, 3)); + floppy->ss_w(BIT(data, 4)); + } + + m_nmigate->in_w<1>(!BIT(data, 6)); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +bml3bus_mp1802_device::bml3bus_mp1802_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, BML3BUS_MP1802, tag, owner, clock), + device_bml3bus_card_interface(mconfig, *this), + m_fdc(*this, "fdc"), + m_floppy(*this, "fdc:%u", 0U), + m_nmigate(*this, "nmigate"), + m_rom(*this, "mp1802_rom") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bml3bus_mp1802_device::device_start() +{ +} + +void bml3bus_mp1802_device::device_reset() +{ + bml3_mp1802_w(0); +} + +void bml3bus_mp1802_device::map_exrom(address_space_installer &space) +{ + space.install_rom(0xf800, 0xfeff, &m_rom[0]); + space.install_rom(0xfff0, 0xffff, &m_rom[0x7f0]); +} + +void bml3bus_mp1802_device::map_io(address_space_installer &space) +{ + // install into memory + space.install_readwrite_handler(0xff00, 0xff03, read8sm_delegate(*m_fdc, FUNC(mb8866_device::read)), write8sm_delegate(*m_fdc, FUNC(mb8866_device::write))); + space.install_readwrite_handler(0xff04, 0xff04, read8smo_delegate(*this, FUNC(bml3bus_mp1802_device::bml3_mp1802_r)), write8smo_delegate(*this, FUNC(bml3bus_mp1802_device::bml3_mp1802_w))); +} diff --git a/src/devices/bus/bml3/mp1802.h b/src/devices/bus/bml3/mp1802.h new file mode 100644 index 00000000000..ecc379261c6 --- /dev/null +++ b/src/devices/bus/bml3/mp1802.h @@ -0,0 +1,62 @@ +// license:GPL-2.0+ +// copyright-holders:Jonathan Edwards +/********************************************************************* + + bml3mp1802.h + + Hitachi MP-1802 floppy disk controller card for the MB-6890 + Hitachi MP-3550 floppy drive is attached + +*********************************************************************/ + +#ifndef MAME_BUS_BML3_BML3MP1802_H +#define MAME_BUS_BML3_BML3MP1802_H + +#pragma once + +#include "bml3bus.h" +#include "imagedev/floppy.h" +#include "machine/input_merger.h" +#include "machine/wd_fdc.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_t clock); + + uint8_t bml3_mp1802_r(); + void bml3_mp1802_w(uint8_t data); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + + virtual void map_exrom(address_space_installer &space) override; + virtual void map_io(address_space_installer &space) override; + +private: + void nmi_w(int state); + + required_device m_fdc; + required_device_array m_floppy; + required_device m_nmigate; + + required_region_ptr m_rom; +}; + +// device type definition +DECLARE_DEVICE_TYPE(BML3BUS_MP1802, bml3bus_mp1802_device) + +#endif // MAME_BUS_BML3_BML3MP1802_H diff --git a/src/devices/bus/bml3/mp1805.cpp b/src/devices/bus/bml3/mp1805.cpp new file mode 100644 index 00000000000..a836243cb98 --- /dev/null +++ b/src/devices/bus/bml3/mp1805.cpp @@ -0,0 +1,163 @@ +// license:GPL-2.0+ +// copyright-holders:Jonathan Edwards +/********************************************************************* + + bml3mp1805.c + + Hitachi MP-1805 floppy disk controller card for the MB-6890 + Floppy drive is attached (single-sided, single density) + +*********************************************************************/ + +#include "emu.h" +#include "mp1805.h" + +#include "softlist_dev.h" + + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(BML3BUS_MP1805, bml3bus_mp1805_device, "bml3mp1805", "Hitachi MP-1805 3\" Floppy Controller Card") + +ROM_START( mp1805 ) + ROM_REGION(0x800, "mp1805_rom", 0) + // MP-1805 disk controller ROM, which replaces part of the system ROM + ROM_LOAD( "mp1805.rom", 0x000, 0x800, BAD_DUMP CRC(b532d8d9) SHA1(6f1160356d5bf64b5926b1fdb60db414edf65f22)) +ROM_END + +void bml3bus_mp1805_device::floppy_drives(device_slot_interface &device) +{ + device.option_add("mb_6890", FLOPPY_3_SSSD); +} + + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void bml3bus_mp1805_device::device_add_mconfig(machine_config &config) +{ + MC6843(config, m_mc6843, 500000); + 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); + FLOPPY_CONNECTOR(config, m_floppy[1], floppy_drives, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[2], floppy_drives, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppy[3], floppy_drives, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); + SOFTWARE_LIST(config, "flop_list").set_original("bml3_flop").set_filter("3"); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *bml3bus_mp1805_device::device_rom_region() const +{ + return ROM_NAME( mp1805 ); +} + +uint8_t bml3bus_mp1805_device::bml3_mp1805_r() +{ + // TODO: read supported or not? + // return mc6843_drq_r(m_mc6843) ? 0x00 : 0x80; + return -1; +} + +void bml3bus_mp1805_device::bml3_mp1805_w(uint8_t data) +{ + // b7 b6 b5 b4 b3 b2 b1 b0 + // MT ? ? ? D3 D2 D1 D0 + // MT: 0=motor off, 1=motor on + // Dn: 1=select drive + + logerror("control_w %02x\n", data); + u8 prev, next; + bool mon = BIT(data, 7); + floppy_image_device *fprev = nullptr, *fnext = nullptr; + + if (!mon) + { + for(prev = 0; prev < 4; prev++) + if(BIT(m_control, prev)) + break; + + if (prev < 4) + { + fprev = m_floppy[prev]->get_device(); + if (fprev) + { + logerror("Drive %d motor off\n",prev); + fprev->mon_w(1); + } + } + } + else + if (data & 15) + { + for(next = 0; next < 4; next++) + if(BIT(data, next)) + break; + + fnext = m_floppy[next]->get_device(); + if (fnext) + { + logerror("Drive %d motor on\n",next); + fnext->mon_w(0); + } + } + + m_control = data; + m_mc6843->set_floppy(fnext); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +bml3bus_mp1805_device::bml3bus_mp1805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, BML3BUS_MP1805, tag, owner, clock), + device_bml3bus_card_interface(mconfig, *this), + m_floppy(*this, "%u", 0U), + m_mc6843(*this, "mc6843"), + m_rom(*this, "mp1805_rom") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bml3bus_mp1805_device::device_start() +{ + save_item(NAME(m_control)); +} + +void bml3bus_mp1805_device::device_reset() +{ + m_control = 0; +} + +void bml3bus_mp1805_device::map_exrom(address_space_installer &space) +{ + space.install_rom(0xf800, 0xfeff, &m_rom[0]); + space.install_rom(0xfff0, 0xffff, &m_rom[0x7f0]); +} + +void bml3bus_mp1805_device::map_io(address_space_installer &space) +{ + // install into memory + space.install_device(0xff18, 0xff1f, *m_mc6843, &mc6843_device::map); + space.install_readwrite_handler(0xff20, 0xff20, read8smo_delegate(*this, FUNC(bml3bus_mp1805_device::bml3_mp1805_r)), write8smo_delegate(*this, FUNC(bml3bus_mp1805_device::bml3_mp1805_w))); +} diff --git a/src/devices/bus/bml3/mp1805.h b/src/devices/bus/bml3/mp1805.h new file mode 100644 index 00000000000..3dfecc0ec22 --- /dev/null +++ b/src/devices/bus/bml3/mp1805.h @@ -0,0 +1,61 @@ +// license:GPL-2.0+ +// copyright-holders:Jonathan Edwards +/********************************************************************* + + bml3mp1805.h + + Hitachi MP-1805 floppy disk controller card for the MB-6890 + Floppy drive is attached + +*********************************************************************/ + +#ifndef MAME_BUS_BML3_BML3MP1805_H +#define MAME_BUS_BML3_BML3MP1805_H + +#pragma once + +#include "bml3bus.h" +#include "imagedev/floppy.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_t clock); + + uint8_t bml3_mp1805_r(); + void bml3_mp1805_w(uint8_t data); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + + virtual void map_exrom(address_space_installer &space) override; + virtual void map_io(address_space_installer &space) override; + +private: + required_device_array m_floppy; + required_device m_mc6843; + + required_region_ptr m_rom; + + uint8_t m_control; + + static void floppy_drives(device_slot_interface &device); +}; + +// device type definition +DECLARE_DEVICE_TYPE(BML3BUS_MP1805, bml3bus_mp1805_device) + +#endif // MAME_BUS_BML3_BML3MP1805_H diff --git a/src/devices/bus/bml3/rtc.cpp b/src/devices/bus/bml3/rtc.cpp new file mode 100644 index 00000000000..37bf5771878 --- /dev/null +++ b/src/devices/bus/bml3/rtc.cpp @@ -0,0 +1,109 @@ +// license:GPL-2.0+ +// copyright-holders:Russell Bull +/********************************************************************* + + bml3rtc.cpp + + Hitachi RTC card for the MB-6890 + + I cannot find any reference to the original Hitachi board that + had this feature, but I was given a schematic back in the 1980's + and I designed a board that included the circuitry. + The standard ROM supported this battery-backed RTC and detects + it's presence on start up. + +*********************************************************************/ + +#include "emu.h" +#include "rtc.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(BML3BUS_RTC, bml3bus_rtc_device, "bml3rtc", "Hitachi Real Time Clock Card") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void bml3bus_rtc_device::device_add_mconfig(machine_config &config) +{ + MSM5832(config, m_rtc, 32.768_kHz_XTAL); +} + + +uint8_t bml3bus_rtc_device::bml3_rtc_r(offs_t offset) +{ + uint8_t data = 0x00; + + if (offset == 2) // read @ 0xff3a + { + if (BIT(m_addr_latch, 7)) //bit 7 is the !write buffer enable + { + data = m_rtc->data_r(); + } + else + { + data = m_data_latch; //the Hitachi ROM code detects RTC presence by reading back what it wrote to the data latch + } + } + return data | 0xf0; // return low nibble only +} + +void bml3bus_rtc_device::bml3_rtc_w(offs_t offset, uint8_t data) +{ + switch (offset) + { + case 0: // addr latch @ 0xff38 + m_rtc->cs_w(1); //always selected + m_rtc->write_w(BIT(data, 6)); + m_rtc->read_w(BIT(data, 7)); + m_rtc->address_w(data & 0x0f); + + m_addr_latch = data; + break; + + case 1: // data latch @ 0xff39 + m_rtc->hold_w(BIT(data, 6)); + + if (BIT(m_addr_latch, 6)) + { + m_rtc->data_w(data & 0x0f); + } + + m_data_latch = data; + break; + } +} +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +bml3bus_rtc_device::bml3bus_rtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, BML3BUS_RTC, tag, owner, clock) + , device_bml3bus_card_interface(mconfig, *this) + , m_rtc(*this, "rtc") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void bml3bus_rtc_device::device_start() +{ + m_addr_latch = 0; + m_data_latch = 0; + + save_item(NAME(m_addr_latch)); + save_item(NAME(m_data_latch)); +} + +void bml3bus_rtc_device::map_io(address_space_installer &space) +{ + // install into memory + space.install_readwrite_handler(0xff38, 0xff3a, read8sm_delegate(*this, FUNC(bml3bus_rtc_device::bml3_rtc_r)), write8sm_delegate(*this, FUNC(bml3bus_rtc_device::bml3_rtc_w))); +} diff --git a/src/devices/bus/bml3/rtc.h b/src/devices/bus/bml3/rtc.h new file mode 100644 index 00000000000..155bce0904c --- /dev/null +++ b/src/devices/bus/bml3/rtc.h @@ -0,0 +1,54 @@ +// license:GPL-2.0+ +// copyright-holders:Russell Bull +/********************************************************************* + + bml3rtc.h + + Hitachi RTC card for the MB-6890 + +*********************************************************************/ + +#ifndef MAME_BUS_BML3_BML3RTC_H +#define MAME_BUS_BML3_BML3RTC_H + +#pragma once + +#include "bml3bus.h" +#include "machine/msm5832.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class bml3bus_rtc_device: + public device_t, + public device_bml3bus_card_interface +{ +public: + // construction/destruction + bml3bus_rtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + uint8_t bml3_rtc_r(offs_t offset); + void bml3_rtc_w(offs_t offset, uint8_t data); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + virtual void map_io(address_space_installer &space) override; + +private: + required_device m_rtc; + + uint8_t m_addr_latch; + uint8_t m_data_latch; +}; + +// device type definition +DECLARE_DEVICE_TYPE(BML3BUS_RTC, bml3bus_rtc_device) + +#endif // MAME_BUS_BML3_BML3RTC_H diff --git a/src/mame/hitachi/bml3.cpp b/src/mame/hitachi/bml3.cpp index 31a212bd41a..5414d3ef7cf 100644 --- a/src/mame/hitachi/bml3.cpp +++ b/src/mame/hitachi/bml3.cpp @@ -26,10 +26,10 @@ TODO: #include "emupal.h" #include "bus/bml3/bml3bus.h" -#include "bus/bml3/bml3mp1802.h" -#include "bus/bml3/bml3mp1805.h" -#include "bus/bml3/bml3kanji.h" -#include "bus/bml3/bml3rtc.h" +#include "bus/bml3/mp1802.h" +#include "bus/bml3/mp1805.h" +#include "bus/bml3/kanji.h" +#include "bus/bml3/rtc.h" #include "screen.h" #include "speaker.h" -- cgit v1.2.3