summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-10-12 22:45:15 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-10-12 22:45:15 -0400
commitc6900b12fde939126e89f4bea6744dbc2cb51ed4 (patch)
tree367136d78508c11aa3a94d1d4a851f387326f2cd /src/devices
parentd1e3e46eebab6b728d6081a1142b1e597ce176a8 (diff)
New machines marked as NOT_WORKING
---------------------------------- Scientific Instruments Model 5500 Temperature Controller [ClawGrip]
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/machine/x2201.cpp189
-rw-r--r--src/devices/machine/x2201.h75
2 files changed, 264 insertions, 0 deletions
diff --git a/src/devices/machine/x2201.cpp b/src/devices/machine/x2201.cpp
new file mode 100644
index 00000000000..eb7ebd50f05
--- /dev/null
+++ b/src/devices/machine/x2201.cpp
@@ -0,0 +1,189 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/**********************************************************************
+
+ Xicor X2201 1024 x 1 bit Nonvolatile Static RAM
+
+ This was Xicor's first NOVRAM product, combining static RAM with
+ an E²PROM overlay. Besides having separate data input and output
+ lines (and only one of each), its interface differs slightly from
+ the later NOVRAMs in requiring an active chip select during recall
+ and store operations.
+
+ While US patent 4535411A suggests that this device was sometimes
+ used in groups of eight to simulate a byte-wide memory, the
+ emulation (for the most part) assumes each bit will be accessed
+ separately and packs them into bytes for storage efficiency.
+
+**********************************************************************/
+
+#include "emu.h"
+#include "machine/x2201.h"
+#include <algorithm>
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(X2201, x2201_device, "x2201", "Xicor X2201 1024x1 NOVRAM")
+
+
+//**************************************************************************
+// DEVICE CONSTRUCTION AND INITIALIZATION
+//**************************************************************************
+
+//-------------------------------------------------
+// x2201_device - constructor
+//-------------------------------------------------
+
+x2201_device::x2201_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, X2201, tag, owner, clock)
+ , device_nvram_interface(mconfig, *this)
+ , m_default_data(*this, DEVICE_SELF, 1024 / 8)
+ , m_cs(false)
+ , m_store(false)
+ , m_array_recall(false)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void x2201_device::device_start()
+{
+ // create arrays
+ m_ram = make_unique_clear<u8[]>(1024 / 8);
+ m_eeprom = std::make_unique<u8[]>(1028 / 8);
+
+ // register state for saving
+ save_pointer(NAME(m_ram), 1024 / 8);
+ save_pointer(NAME(m_eeprom), 1024 / 8);
+ save_item(NAME(m_cs));
+ save_item(NAME(m_store));
+ save_item(NAME(m_array_recall));
+}
+
+
+//**************************************************************************
+// NVRAM INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// nvram_default - called to initialize NVRAM to
+// its default state
+//-------------------------------------------------
+
+void x2201_device::nvram_default()
+{
+ // erase to ones unless region overrides
+ if (m_default_data.found())
+ std::copy_n(&m_default_data[0], 1024 / 8, &m_eeprom[0]);
+ else
+ std::fill_n(&m_eeprom[0], 1024 / 8, 0xff);
+}
+
+
+//-------------------------------------------------
+// nvram_read - called to read NVRAM from the
+// specified file
+//-------------------------------------------------
+
+void x2201_device::nvram_read(emu_file &file)
+{
+ file.read(&m_eeprom[0], 1024 / 8);
+}
+
+
+//-------------------------------------------------
+// nvram_write - called to write NVRAM to the
+// specified file
+//-------------------------------------------------
+
+void x2201_device::nvram_write(emu_file &file)
+{
+ file.write(&m_eeprom[0], 1024 / 8);
+}
+
+
+//**************************************************************************
+// MEMORY ACCESS
+//**************************************************************************
+
+//-------------------------------------------------
+// read - read the addressed bit of RAM
+//-------------------------------------------------
+
+u8 x2201_device::read(offs_t offset)
+{
+ return BIT(m_ram[(offset >> 3) & 127], offset & 7);
+}
+
+
+//-------------------------------------------------
+// read_byte - read 8 bits of data from RAM
+// (FIXME: remove once CRU reads are 1-bit)
+//-------------------------------------------------
+
+u8 x2201_device::read_byte(offs_t offset)
+{
+ return m_ram[offset & 127];
+}
+
+
+//-------------------------------------------------
+// write - write one bit of data to RAM
+//-------------------------------------------------
+
+void x2201_device::write(offs_t offset, u8 data)
+{
+ offs_t address = (offset >> 3) & 127;
+ if (BIT(data, 0))
+ m_ram[address] |= 1 << (offset & 7);
+ else
+ m_ram[address] &= ~(1 << (offset & 7));
+}
+
+
+//**************************************************************************
+// CONTROL STROBES
+//**************************************************************************
+
+//-------------------------------------------------
+// cs_w - write to the CS line (active low)
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER(x2201_device::cs_w)
+{
+ m_cs = !state;
+}
+
+
+//-------------------------------------------------
+// store_w - trigger to store RAM data in EEPROM
+// (active low)
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER(x2201_device::store_w)
+{
+ if (m_cs && !state && !m_store)
+ std::copy_n(&m_ram[0], 1024 / 8, &m_eeprom[0]);
+
+ m_array_recall = !state;
+}
+
+
+//-------------------------------------------------
+// array_recall_w - trigger to pull EEPROM data
+// into RAM (active low)
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER(x2201_device::array_recall_w)
+{
+ if (m_cs && !state && !m_array_recall)
+ std::copy_n(&m_eeprom[0], 1024 / 8, &m_ram[0]);
+
+ m_array_recall = !state;
+}
diff --git a/src/devices/machine/x2201.h b/src/devices/machine/x2201.h
new file mode 100644
index 00000000000..670c69b349c
--- /dev/null
+++ b/src/devices/machine/x2201.h
@@ -0,0 +1,75 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/***************************************************************************
+
+ Xicor X2201 1024 x 1 bit Nonvolatile Static RAM
+
+****************************************************************************
+ ____ ____
+ A0 1 |* \_/ | 18 Vcc
+ A1 2 | | 17 A5
+ A2 3 | | 16 A6
+ A3 4 | | 15 A7
+ A4 5 | X2201 | 14 A8
+ DOut 6 | | 13 A9
+ /STORE 7 | | 12 DIn
+ /WE 8 | | 11 /ARRAY RECALL
+ GND 9 |___________| 10 /CS
+
+***************************************************************************/
+
+#ifndef MAME_MACHINE_X2201_H
+#define MAME_MACHINE_X2201_H
+
+#pragma once
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> x2201_device
+
+class x2201_device : public device_t, public device_nvram_interface
+{
+public:
+ // construction/destruction
+ x2201_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
+
+ // read/write handlers
+ u8 read(offs_t offset);
+ u8 read_byte(offs_t offset); // hack
+ void write(offs_t offset, u8 data);
+
+ // control lines
+ DECLARE_WRITE_LINE_MEMBER(cs_w);
+ DECLARE_WRITE_LINE_MEMBER(array_recall_w);
+ DECLARE_WRITE_LINE_MEMBER(store_w);
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+ // device_nvram_interface overrides
+ virtual void nvram_default() override;
+ virtual void nvram_read(emu_file &file) override;
+ virtual void nvram_write(emu_file &file) override;
+
+private:
+ // optional default data
+ optional_region_ptr<u8> m_default_data;
+
+ // memory arrays
+ std::unique_ptr<u8[]> m_ram;
+ std::unique_ptr<u8[]> m_eeprom;
+
+ // line state
+ bool m_cs;
+ bool m_store;
+ bool m_array_recall;
+};
+
+// device type definition
+DECLARE_DEVICE_TYPE(X2201, x2201_device)
+
+#endif // MAME_MACHINE_X2201_H