summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2017-06-24 17:14:32 +0200
committer hap <happppp@users.noreply.github.com>2017-06-24 17:14:32 +0200
commit4cc7afc65c8ddc67c9f64fc6df11775d4b2de4ad (patch)
tree5698fa8e4ed2e8326e59b924be708a0fd342edba
parentc7301ced32518749d1b550cf40eb4fc4abf01fff (diff)
sm500: added device start/reset (nw)
-rw-r--r--src/devices/cpu/sm510/sm500.h4
-rw-r--r--src/devices/cpu/sm510/sm500core.cpp47
-rw-r--r--src/devices/cpu/sm510/sm500op.cpp6
-rw-r--r--src/devices/cpu/sm510/sm510op.cpp1
4 files changed, 58 insertions, 0 deletions
diff --git a/src/devices/cpu/sm510/sm500.h b/src/devices/cpu/sm510/sm500.h
index e09ef52147d..a02d27ef13c 100644
--- a/src/devices/cpu/sm510/sm500.h
+++ b/src/devices/cpu/sm510/sm500.h
@@ -78,6 +78,8 @@ public:
protected:
sm500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_mask, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data);
+ virtual void device_start() override;
+ virtual void device_reset() override;
virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override;
virtual void execute_one() override;
virtual void get_opcode_param() override;
@@ -124,6 +126,8 @@ protected:
virtual void op_exksa();
virtual void op_exkfa();
+ virtual void op_idiv() override;
+
virtual void op_rmf();
virtual void op_smf();
virtual void op_comcn();
diff --git a/src/devices/cpu/sm510/sm500core.cpp b/src/devices/cpu/sm510/sm500core.cpp
index f09fc515f5c..54c2143b3d7 100644
--- a/src/devices/cpu/sm510/sm500core.cpp
+++ b/src/devices/cpu/sm510/sm500core.cpp
@@ -44,6 +44,53 @@ sm500_device::sm500_device(const machine_config &mconfig, device_type type, cons
}
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void sm500_device::device_start()
+{
+ // common init (not everything is used though)
+ sm510_base_device::device_start();
+
+ // init/zerofill
+ memset(m_ox, 0, sizeof(m_ox));
+ memset(m_o, 0, sizeof(m_o));
+ m_cn = 0;
+ m_mx = 0;
+ m_cb = 0;
+ m_s = 0;
+ m_rsub = false;
+
+ // register for savestates
+ save_item(NAME(m_ox));
+ save_item(NAME(m_o));
+ save_item(NAME(m_cn));
+ save_item(NAME(m_mx));
+ save_item(NAME(m_cb));
+ save_item(NAME(m_s));
+ save_item(NAME(m_rsub));
+}
+
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void sm500_device::device_reset()
+{
+ // common reset
+ sm510_base_device::device_reset();
+
+ // SM500 specific
+ op_idiv();
+ m_cb = 0;
+ m_rsub = false;
+}
+
+
+
// disasm
offs_t sm500_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options)
{
diff --git a/src/devices/cpu/sm510/sm500op.cpp b/src/devices/cpu/sm510/sm500op.cpp
index acb2864cec2..102537190ee 100644
--- a/src/devices/cpu/sm510/sm500op.cpp
+++ b/src/devices/cpu/sm510/sm500op.cpp
@@ -183,6 +183,12 @@ void sm500_device::op_exkfa()
// Divider manipulation instructions
+void sm500_device::op_idiv()
+{
+ // IDIV: reset divider low 9 bits
+ m_div &= 0x3f;
+}
+
// Bit manipulation instructions
diff --git a/src/devices/cpu/sm510/sm510op.cpp b/src/devices/cpu/sm510/sm510op.cpp
index 5847cbf68f4..c319b0ccdd4 100644
--- a/src/devices/cpu/sm510/sm510op.cpp
+++ b/src/devices/cpu/sm510/sm510op.cpp
@@ -250,6 +250,7 @@ void sm510_base_device::op_atr()
{
// ATR: output ACC to R
m_r = m_acc;
+ clock_melody();
}