summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/sda2006.h
diff options
context:
space:
mode:
author Tomasz Slanina <tomasz.slanina@alan-systems.com>2018-08-22 10:19:16 +0200
committer Tomasz Slanina <tomasz.slanina@alan-systems.com>2018-08-22 10:19:16 +0200
commit403196c318fa275fccbb08ac21c9a83371d3123c (patch)
tree40937f2c2eb7701b6825c40f258b4e187ded11fb /src/devices/machine/sda2006.h
parentfbfab1d7a57d66c89273f31f02bf19f3781ae36a (diff)
New Working Game
------------------------------- Nightmare [Tomasz Slanina, Roberto Fresca, Jordi Beltran, Paco Ortiz, Recreativas.org]
Diffstat (limited to 'src/devices/machine/sda2006.h')
-rwxr-xr-xsrc/devices/machine/sda2006.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/devices/machine/sda2006.h b/src/devices/machine/sda2006.h
new file mode 100755
index 00000000000..51fb91446d2
--- /dev/null
+++ b/src/devices/machine/sda2006.h
@@ -0,0 +1,60 @@
+// license:BSD-3-Clause
+// copyright-holders:Tomasz Slanina
+#ifndef MAME_MACHINE_SDA2006_H
+#define MAME_MACHINE_SDA2006_H
+
+#pragma once
+
+
+
+// sda2006_device
+
+class sda2006_device : public device_t,
+ public device_nvram_interface
+{
+public:
+ // construction/destruction
+ sda2006_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+
+ // I/O operations
+ DECLARE_READ_LINE_MEMBER( read_data );
+ DECLARE_WRITE_LINE_MEMBER( write_data );
+ DECLARE_WRITE_LINE_MEMBER( write_clock );
+ DECLARE_WRITE_LINE_MEMBER( write_enable );
+
+protected:
+ // device-level overrides
+ virtual void device_validity_check(validity_checker &valid) const override;
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ virtual void nvram_default() override;
+ virtual void nvram_read(emu_file &file) override;
+ virtual void nvram_write(emu_file &file) override;
+
+private:
+ enum {
+ EEPROM_READ = 0,
+ EEPROM_WRITE
+ };
+
+ uint8_t m_latch;
+ uint8_t m_current_address;
+ uint32_t m_eeprom_state;
+ uint8_t m_read_stream_pos;
+ bool m_is_end_o_stream;
+ uint8_t m_write_stream_length;
+ uint32_t m_write_stream;
+ uint8_t m_write_state;
+ uint8_t m_clock_state;
+
+
+
+ uint16_t m_eeprom_data[0x20];
+};
+
+
+// device type definition
+DECLARE_DEVICE_TYPE(SDA2006, sda2006_device)
+
+#endif // MAME_MACHINE_SDA2006_H