summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus
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 /src/devices/bus
parented3fb56b47940aecbe7961b247861f878aa50127 (diff)
bml3: Added Hitachi Real Time Clock card [Russell Bull]
Diffstat (limited to 'src/devices/bus')
-rw-r--r--src/devices/bus/bml3/bml3rtc.cpp104
-rw-r--r--src/devices/bus/bml3/bml3rtc.h52
2 files changed, 156 insertions, 0 deletions
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