summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2017-06-25 18:33:38 +0200
committer hap <happppp@users.noreply.github.com>2017-06-25 18:33:59 +0200
commitd36944fbb08f6d15b2228bfd76249399eaed84c4 (patch)
tree58938cc9aa559e133ad83956ce80ff496ea9596b
parentc318e49ab277001120e667876f3b21da7539a047 (diff)
sm500: small cleanup (nw)
-rw-r--r--src/devices/cpu/sm510/sm500.h6
-rw-r--r--src/devices/cpu/sm510/sm500core.cpp25
-rw-r--r--src/devices/cpu/sm510/sm500op.cpp23
-rw-r--r--src/devices/cpu/sm510/sm5acore.cpp10
4 files changed, 31 insertions, 33 deletions
diff --git a/src/devices/cpu/sm510/sm500.h b/src/devices/cpu/sm510/sm500.h
index 7c11f21e1f3..727b789bbe3 100644
--- a/src/devices/cpu/sm510/sm500.h
+++ b/src/devices/cpu/sm510/sm500.h
@@ -83,7 +83,7 @@ public:
template <class Object> static devcb_base &set_write_o_callback(device_t &device, Object &&cb) { return downcast<sm500_device &>(device).m_write_o.set_callback(std::forward<Object>(cb)); }
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);
+ sm500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_pins, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data);
virtual void device_start() override;
virtual void device_reset() override;
@@ -99,7 +99,7 @@ protected:
devcb_write8 m_write_o;
virtual void lcd_update() override;
- int m_o_mask; // number of 4-bit O pins minus 1
+ int m_o_pins; // number of 4-bit O pins
u8 m_ox[9]; // W' latch, max 9
u8 m_o[9]; // W latch
u8 m_cn;
@@ -153,7 +153,7 @@ public:
sm5a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
- sm5a_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);
+ sm5a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_pins, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data);
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;
diff --git a/src/devices/cpu/sm510/sm500core.cpp b/src/devices/cpu/sm510/sm500core.cpp
index 2b9211a15dd..3e77e091c17 100644
--- a/src/devices/cpu/sm510/sm500core.cpp
+++ b/src/devices/cpu/sm510/sm500core.cpp
@@ -35,18 +35,26 @@ ADDRESS_MAP_END
// device definitions
sm500_device::sm500_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : sm500_device(mconfig, SM500, tag, owner, clock, 1 /* stack levels */, 6 /* o mask */, 11 /* prg width */, ADDRESS_MAP_NAME(program_1_2k), 6 /* data width */, ADDRESS_MAP_NAME(data_4x10x4))
+ : sm500_device(mconfig, SM500, tag, owner, clock, 1 /* stack levels */, 7 /* o group pins */, 11 /* prg width */, ADDRESS_MAP_NAME(program_1_2k), 6 /* data width */, ADDRESS_MAP_NAME(data_4x10x4))
{
}
-sm500_device::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)
+sm500_device::sm500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_pins, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data)
: sm510_base_device(mconfig, type, tag, owner, clock, stack_levels, prgwidth, program, datawidth, data),
m_write_o(*this),
- m_o_mask(o_mask)
+ m_o_pins(o_pins)
{
}
+// disasm
+offs_t sm500_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options)
+{
+ extern CPU_DISASSEMBLE(sm500);
+ return CPU_DISASSEMBLE_NAME(sm500)(this, stream, pc, oprom, opram, options);
+}
+
+
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@@ -100,15 +108,6 @@ void sm500_device::device_reset()
-// disasm
-offs_t sm500_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options)
-{
- extern CPU_DISASSEMBLE(sm500);
- return CPU_DISASSEMBLE_NAME(sm500)(this, stream, pc, oprom, opram, options);
-}
-
-
-
//-------------------------------------------------
// lcd driver
//-------------------------------------------------
@@ -118,7 +117,7 @@ void sm500_device::lcd_update()
// 2 columns
for (int h = 0; h < 2; h++)
{
- for (int o = 0; o <= m_o_mask; o++)
+ for (int o = 0; o < m_o_pins; o++)
{
// 4 segments per group
u8 seg = h ? m_o[o] : m_ox[o];
diff --git a/src/devices/cpu/sm510/sm500op.cpp b/src/devices/cpu/sm510/sm500op.cpp
index 01b5a127faf..8993259b460 100644
--- a/src/devices/cpu/sm510/sm500op.cpp
+++ b/src/devices/cpu/sm510/sm500op.cpp
@@ -12,7 +12,7 @@
void sm500_device::shift_w()
{
// shifts internal W' latches
- for (int i = 0; i < m_o_mask; i++)
+ for (int i = 0; i < (m_o_pins-1); i++)
m_ox[i] = m_ox[i + 1];
}
@@ -37,9 +37,8 @@ u8 sm500_device::get_digit()
void sm500_device::op_lb()
{
// LB x: load BM/BL with 4-bit immediate value (partial)
- // BL bit 2 is clearned, bit 3 is param bit 2|3
- m_bm = (m_op & 3);
- m_bl = ((m_op << 1 | m_op) & 8) | (m_op >> 2 & 3);
+ m_bm = m_op & 3;
+ m_bl = (m_op >> 2 & 3) | ((m_op & 0xc) ? 8 : 0);
}
void sm500_device::op_incb()
@@ -122,43 +121,43 @@ void sm500_device::op_atbp()
void sm500_device::op_ptw()
{
// PTW: partial transfer W' to W
- m_o[m_o_mask] = m_ox[m_o_mask];
- m_o[m_o_mask-1] = m_ox[m_o_mask-1];
+ m_o[m_o_pins-1] = m_ox[m_o_pins-1];
+ m_o[m_o_pins-2] = m_ox[m_o_pins-2];
}
void sm500_device::op_tw()
{
// TW: transfer W' to W
- for (int i = 0; i <= m_o_mask; i++)
+ for (int i = 0; i < m_o_pins; i++)
m_o[i] = m_ox[i];
}
void sm500_device::op_pdtw()
{
// PDTW: partial shift digit into W'
- m_ox[m_o_mask-1] = m_ox[m_o_mask];
- m_ox[m_o_mask] = get_digit();
+ m_ox[m_o_pins-2] = m_ox[m_o_pins-1];
+ m_ox[m_o_pins-1] = get_digit();
}
void sm500_device::op_dtw()
{
// DTW: shift digit into W'
shift_w();
- m_ox[m_o_mask] = get_digit();
+ m_ox[m_o_pins-1] = get_digit();
}
void sm500_device::op_wr()
{
// WR: shift ACC into W', reset last bit
shift_w();
- m_ox[m_o_mask] = m_acc & 7;
+ m_ox[m_o_pins-1] = m_acc & 7;
}
void sm500_device::op_ws()
{
// WR: shift ACC into W', set last bit
shift_w();
- m_ox[m_o_mask] = m_acc | 8;
+ m_ox[m_o_pins-1] = m_acc | 8;
}
diff --git a/src/devices/cpu/sm510/sm5acore.cpp b/src/devices/cpu/sm510/sm5acore.cpp
index c73fd4b4c90..1fd23887227 100644
--- a/src/devices/cpu/sm510/sm5acore.cpp
+++ b/src/devices/cpu/sm510/sm5acore.cpp
@@ -42,22 +42,22 @@ ADDRESS_MAP_END
// device definitions
sm5a_device::sm5a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : sm5a_device(mconfig, SM5A, tag, owner, clock, 1 /* stack levels */, 8 /* o mask */, 11 /* prg width */, ADDRESS_MAP_NAME(program_1_8k), 7 /* data width */, ADDRESS_MAP_NAME(data_5x13x4))
+ : sm5a_device(mconfig, SM5A, tag, owner, clock, 1 /* stack levels */, 9 /* o group pins */, 11 /* prg width */, ADDRESS_MAP_NAME(program_1_8k), 7 /* data width */, ADDRESS_MAP_NAME(data_5x13x4))
{
}
-sm5a_device::sm5a_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)
- : sm500_device(mconfig, type, tag, owner, clock, stack_levels, o_mask, prgwidth, program, datawidth, data)
+sm5a_device::sm5a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_pins, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data)
+ : sm500_device(mconfig, type, tag, owner, clock, stack_levels, o_pins, prgwidth, program, datawidth, data)
{
}
sm5l_device::sm5l_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : sm5a_device(mconfig, SM5L, tag, owner, clock, 1, 8, 11, ADDRESS_MAP_NAME(program_1_8k), 7, ADDRESS_MAP_NAME(data_5x13x4))
+ : sm5a_device(mconfig, SM5L, tag, owner, clock, 1, 9, 11, ADDRESS_MAP_NAME(program_1_8k), 7, ADDRESS_MAP_NAME(data_5x13x4))
{
}
kb1013vk12_device::kb1013vk12_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : sm5a_device(mconfig, KB1013VK12, tag, owner, clock, 1, 8, 11, ADDRESS_MAP_NAME(program_1_8k), 7, ADDRESS_MAP_NAME(data_5x13x4))
+ : sm5a_device(mconfig, KB1013VK12, tag, owner, clock, 1, 9, 11, ADDRESS_MAP_NAME(program_1_8k), 7, ADDRESS_MAP_NAME(data_5x13x4))
{
}