summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nigel Barnes <Pernod70@users.noreply.github.com>2019-11-22 23:15:54 +0000
committer Nigel Barnes <Pernod70@users.noreply.github.com>2019-11-22 23:18:04 +0000
commit50d394f973fbe47523abc9b5bb3238cf0d705889 (patch)
tree44885949f3b988c689a168932100a6a24aea0046
parented3fb56b47940aecbe7961b247861f878aa50127 (diff)
bml3: Added Hitachi Real Time Clock card [Russell Bull]
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/bml3/bml3rtc.cpp104
-rw-r--r--src/devices/bus/bml3/bml3rtc.h52
-rw-r--r--src/mame/drivers/bml3.cpp4
4 files changed, 161 insertions, 1 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 79369295eee..fc1c26ac01f 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -3180,6 +3180,8 @@ if (BUSES["BML3"]~=null) then
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",
}
end
diff --git a/src/devices/bus/bml3/bml3rtc.cpp b/src/devices/bus/bml3/bml3rtc.cpp
new file mode 100644
index 00000000000..baaba60a22c
--- /dev/null
+++ b/src/devices/bus/bml3/bml3rtc.cpp
@@ -0,0 +1,104 @@
+// 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);
+}
+
+
+READ8_MEMBER(bml3bus_rtc_device::bml3_rtc_r)
+{
+ 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
+}
+
+WRITE8_MEMBER(bml3bus_rtc_device::bml3_rtc_w)
+{
+ 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()
+{
+ // install into memory
+ address_space &space_prg = space();
+ space_prg.install_readwrite_handler(0xff38, 0xff3a, read8_delegate(*this, FUNC(bml3bus_rtc_device::bml3_rtc_r)), write8_delegate(*this, FUNC(bml3bus_rtc_device::bml3_rtc_w)));
+
+ m_addr_latch = 0;
+ m_data_latch = 0;
+}
diff --git a/src/devices/bus/bml3/bml3rtc.h b/src/devices/bus/bml3/bml3rtc.h
new file mode 100644
index 00000000000..2adb9870804
--- /dev/null
+++ b/src/devices/bus/bml3/bml3rtc.h
@@ -0,0 +1,52 @@
+// 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);
+
+ DECLARE_READ8_MEMBER(bml3_rtc_r);
+ DECLARE_WRITE8_MEMBER(bml3_rtc_w);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+ // optional information overrides
+ virtual void device_add_mconfig(machine_config &config) override;
+
+private:
+ required_device<msm5832_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/drivers/bml3.cpp b/src/mame/drivers/bml3.cpp
index 2132ee2a9cc..67ccb984eba 100644
--- a/src/mame/drivers/bml3.cpp
+++ b/src/mame/drivers/bml3.cpp
@@ -30,6 +30,7 @@
#include "bus/bml3/bml3mp1802.h"
#include "bus/bml3/bml3mp1805.h"
#include "bus/bml3/bml3kanji.h"
+#include "bus/bml3/bml3rtc.h"
#include "screen.h"
#include "speaker.h"
@@ -914,6 +915,7 @@ static void bml3_cards(device_slot_interface &device)
device.option_add("bml3mp1802", BML3BUS_MP1802); // MP-1802 Floppy Controller Card
device.option_add("bml3mp1805", BML3BUS_MP1805); // MP-1805 Floppy Controller Card
device.option_add("bml3kanji", BML3BUS_KANJI);
+ device.option_add("bml3rtc", BML3BUS_RTC);
}
@@ -980,7 +982,7 @@ void bml3_state::bml3_common(machine_config &config)
Note it isn't feasible to use both, as they each place boot ROM at F800.
*/
BML3BUS_SLOT(config, "sl1", m_bml3bus, bml3_cards, "bml3mp1805");
- BML3BUS_SLOT(config, "sl2", m_bml3bus, bml3_cards, nullptr);
+ BML3BUS_SLOT(config, "sl2", m_bml3bus, bml3_cards, "bml3rtc");
BML3BUS_SLOT(config, "sl3", m_bml3bus, bml3_cards, nullptr);
BML3BUS_SLOT(config, "sl4", m_bml3bus, bml3_cards, nullptr);
BML3BUS_SLOT(config, "sl5", m_bml3bus, bml3_cards, nullptr);