summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author shattered <shattered@users.noreply.github.com>2019-08-04 22:47:29 +0300
committer R. Belmont <rb6502@users.noreply.github.com>2019-08-04 15:47:29 -0400
commit5936b650b63c3a87383c543ed89578de092d9e18 (patch)
tree50b09a74935bc66fdb5d3c5b890e1ceafa5242d1
parent2499d149916c7af10aedb604642f7aeb521c56be (diff)
agat: Nippel Clock slot device (#5425)
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/a2bus/nippelclock.cpp112
-rw-r--r--src/devices/bus/a2bus/nippelclock.h51
-rw-r--r--src/mame/drivers/agat.cpp2
4 files changed, 167 insertions, 0 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 609a80df776..d238c58bbec 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -2125,6 +2125,8 @@ if (BUSES["A2BUS"]~=null) then
MAME_DIR .. "src/devices/bus/a2bus/agat840k_hle.h",
MAME_DIR .. "src/devices/bus/a2bus/agat_fdc.cpp",
MAME_DIR .. "src/devices/bus/a2bus/agat_fdc.h",
+ MAME_DIR .. "src/devices/bus/a2bus/nippelclock.cpp",
+ MAME_DIR .. "src/devices/bus/a2bus/nippelclock.h",
MAME_DIR .. "src/devices/bus/a2bus/ssprite.cpp",
MAME_DIR .. "src/devices/bus/a2bus/ssprite.h",
MAME_DIR .. "src/devices/bus/a2bus/ssbapple.cpp",
diff --git a/src/devices/bus/a2bus/nippelclock.cpp b/src/devices/bus/a2bus/nippelclock.cpp
new file mode 100644
index 00000000000..047e13422e0
--- /dev/null
+++ b/src/devices/bus/a2bus/nippelclock.cpp
@@ -0,0 +1,112 @@
+// license:BSD-3-Clause
+// copyright-holders:Sergey Svishchev
+/*********************************************************************
+
+ nippelclock.c
+
+ Implementation of the Nippel Clock card for Agat.
+
+ https://archive.org/details/Nippel_Clock_Agat
+
+*********************************************************************/
+
+#include "emu.h"
+#include "nippelclock.h"
+
+/***************************************************************************
+ PARAMETERS
+***************************************************************************/
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(A2BUS_NIPPELCLOCK, a2bus_nippelclock_device, "nclock", "Nippel Clock")
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+//-------------------------------------------------
+// device_add_mconfig - add device configuration
+//-------------------------------------------------
+
+void a2bus_nippelclock_device::device_add_mconfig(machine_config &config)
+{
+ MC146818(config, m_rtc, 32.768_kHz_XTAL);
+ m_rtc->irq().set(FUNC(a2bus_nippelclock_device::irq_w));
+ m_rtc->set_24hrs(true);
+ m_rtc->set_binary(true);
+}
+
+WRITE_LINE_MEMBER(a2bus_nippelclock_device::irq_w)
+{
+ if (state == ASSERT_LINE)
+ {
+ raise_slot_irq();
+ }
+ else
+ {
+ lower_slot_irq();
+ }
+}
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+a2bus_nippelclock_device::a2bus_nippelclock_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
+ , device_a2bus_card_interface(mconfig, *this)
+ , m_rtc(*this, "rtc")
+{
+}
+
+a2bus_nippelclock_device::a2bus_nippelclock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a2bus_nippelclock_device(mconfig, A2BUS_NIPPELCLOCK, tag, owner, clock)
+{
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void a2bus_nippelclock_device::device_start()
+{
+}
+
+void a2bus_nippelclock_device::device_reset()
+{
+}
+
+
+/*-------------------------------------------------
+ read_c0nx - called for reads from this card's c0nx space
+-------------------------------------------------*/
+
+uint8_t a2bus_nippelclock_device::read_c0nx(uint8_t offset)
+{
+ switch (offset)
+ {
+ case 6: case 7:
+ return m_rtc->read(offset - 6);
+ break;
+ }
+
+ return 0;
+}
+
+
+/*-------------------------------------------------
+ write_c0nx - called for writes to this card's c0nx space
+-------------------------------------------------*/
+
+void a2bus_nippelclock_device::write_c0nx(uint8_t offset, uint8_t data)
+{
+ switch (offset)
+ {
+ case 6: case 7:
+ m_rtc->write(offset - 6, data);
+ break;
+ }
+}
diff --git a/src/devices/bus/a2bus/nippelclock.h b/src/devices/bus/a2bus/nippelclock.h
new file mode 100644
index 00000000000..d2ac6f14c7f
--- /dev/null
+++ b/src/devices/bus/a2bus/nippelclock.h
@@ -0,0 +1,51 @@
+// license:BSD-3-Clause
+// copyright-holders:Sergey Svishchev
+/*********************************************************************
+
+ nippelclock.h
+
+ Implementation of the Nippel Clock card for Agat.
+
+*********************************************************************/
+
+#ifndef MAME_BUS_A2BUS_A2NIPPELCLOCK_H
+#define MAME_BUS_A2BUS_A2NIPPELCLOCK_H
+
+#pragma once
+
+#include "a2bus.h"
+#include "machine/mc146818.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class a2bus_nippelclock_device:
+ public device_t,
+ public device_a2bus_card_interface
+{
+public:
+ // construction/destruction
+ a2bus_nippelclock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ a2bus_nippelclock_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_add_mconfig(machine_config &config) override;
+
+ // overrides of standard a2bus slot functions
+ virtual uint8_t read_c0nx(uint8_t offset) override;
+ virtual void write_c0nx(uint8_t offset, uint8_t data) override;
+
+ required_device<mc146818_device> m_rtc;
+
+private:
+ DECLARE_WRITE_LINE_MEMBER(irq_w);
+};
+
+// device type definition
+DECLARE_DEVICE_TYPE(A2BUS_NIPPELCLOCK, a2bus_nippelclock_device)
+
+#endif // MAME_BUS_A2BUS_A2NIPPELCLOCK_H
diff --git a/src/mame/drivers/agat.cpp b/src/mame/drivers/agat.cpp
index 6d65d2b4e99..17a4a0d7d41 100644
--- a/src/mame/drivers/agat.cpp
+++ b/src/mame/drivers/agat.cpp
@@ -88,6 +88,7 @@
#include "bus/a2bus/agat7ram.h"
#include "bus/a2bus/agat840k_hle.h"
#include "bus/a2bus/agat_fdc.h"
+#include "bus/a2bus/nippelclock.h"
#include "cpu/m6502/r65c02.h"
#include "screen.h"
@@ -1477,6 +1478,7 @@ static void agat9_cards(device_slot_interface &device)
device.option_add("a9fdc140", A2BUS_AGAT9_FDC); // Disk II clone -- decimal 3.089.173 (reworked for agat9)
device.option_add("a9fdchle", A2BUS_AGAT840K_HLE); // 840K floppy controller -- decimal 7.104.351 or 3.089.023?
device.option_add("a9fdc", A2BUS_AGAT_FDC); // 840K floppy controller LLE
+ device.option_add("a9nclock", A2BUS_NIPPELCLOCK); // Nippel Clock (mc146818)
}
void agat7_state::agat7(machine_config &config)