summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/clipper/clipper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/clipper/clipper.cpp')
-rw-r--r--src/devices/cpu/clipper/clipper.cpp62
1 files changed, 21 insertions, 41 deletions
diff --git a/src/devices/cpu/clipper/clipper.cpp b/src/devices/cpu/clipper/clipper.cpp
index a18fcd2fc92..aff0b589a45 100644
--- a/src/devices/cpu/clipper/clipper.cpp
+++ b/src/devices/cpu/clipper/clipper.cpp
@@ -14,11 +14,9 @@
*/
#include "emu.h"
-#include "debugger.h"
#include "clipper.h"
#include "clipperd.h"
-#define LOG_GENERAL (1U << 0)
#define LOG_EXCEPTION (1U << 1)
#define LOG_SYSCALLS (1U << 2)
@@ -68,6 +66,7 @@ clipper_c300_device::clipper_c300_device(const machine_config &mconfig, const ch
clipper_c400_device::clipper_c400_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: clipper_device(mconfig, CLIPPER_C400, tag, owner, clock, ENDIANNESS_LITTLE, SSW_ID_C4R4)
+ , m_db_pc(0)
, m_cammu(*this, "^cammu")
{
}
@@ -81,34 +80,15 @@ clipper_device::clipper_device(const machine_config &mconfig, device_type type,
, m_psw(endianness == ENDIANNESS_BIG ? PSW_BIG : 0)
, m_ssw(cpuid)
, m_r(m_rs)
+ , m_ru{0}
+ , m_rs{0}
+ , m_f{0}
+ , m_fp_pc(0)
+ , m_fp_dst(0)
+ , m_info{0}
{
}
-// rotate helpers to replace MSVC intrinsics
-inline u32 rotl32(u32 x, u8 shift)
-{
- shift &= 31;
- return (x << shift) | (x >> ((32 - shift) & 31));
-}
-
-inline u32 rotr32(u32 x, u8 shift)
-{
- shift &= 31;
- return (x >> shift) | (x << ((32 - shift) & 31));
-}
-
-inline u64 rotl64(u64 x, u8 shift)
-{
- shift &= 63;
- return (x << shift) | (x >> ((64 - shift) & 63));
-}
-
-inline u64 rotr64(u64 x, u8 shift)
-{
- shift &= 63;
- return (x >> shift) | (x << ((64 - shift) & 63));
-}
-
void clipper_device::device_start()
{
// configure the cammu address spaces
@@ -203,7 +183,7 @@ void clipper_device::execute_run()
if (m_nmi)
{
// acknowledge non-maskable interrupt
- standard_irq_callback(INPUT_LINE_NMI);
+ standard_irq_callback(INPUT_LINE_NMI, m_pc);
LOGMASKED(LOG_EXCEPTION, "non-maskable interrupt\n");
m_pc = intrap(EXCEPTION_INTERRUPT_BASE, m_pc);
@@ -216,7 +196,7 @@ void clipper_device::execute_run()
if ((m_ivec & IVEC_LEVEL) <= SSW(IL))
{
// acknowledge interrupt
- standard_irq_callback(INPUT_LINE_IRQ0);
+ standard_irq_callback(INPUT_LINE_IRQ0, m_pc);
m_pc = intrap(EXCEPTION_INTERRUPT_BASE + m_ivec * 8, m_pc);
@@ -328,12 +308,12 @@ device_memory_interface::space_config_vector clipper_device::memory_space_config
};
}
-bool clipper_device::memory_translate(int spacenum, int intention, offs_t &address)
+bool clipper_device::memory_translate(int spacenum, int intention, offs_t &address, address_space *&target_space)
{
- return ((intention & TRANSLATE_TYPE_MASK) == TRANSLATE_FETCH ? get_icammu() : get_dcammu()).memory_translate(m_ssw, spacenum, intention, address);
+ return (intention == TR_FETCH ? get_icammu() : get_dcammu()).memory_translate(m_ssw, spacenum, intention, address, target_space);
}
-WRITE16_MEMBER(clipper_device::set_exception)
+void clipper_device::set_exception(u16 data)
{
LOGMASKED(LOG_EXCEPTION, "external exception 0x%04x triggered\n", data);
@@ -687,18 +667,18 @@ void clipper_device::execute_instruction()
case 0x34:
// rotw: rotate word
if (!BIT31(m_r[R1]))
- m_r[R2] = rotl32(m_r[R2], m_r[R1]);
+ m_r[R2] = rotl_32(m_r[R2], m_r[R1]);
else
- m_r[R2] = rotr32(m_r[R2], -m_r[R1]);
+ m_r[R2] = rotr_32(m_r[R2], -m_r[R1]);
// FLAGS: 00ZN
FLAGS(0, 0, m_r[R2] == 0, BIT31(m_r[R2]));
break;
case 0x35:
// rotl: rotate longword
if (!BIT31(m_r[R1]))
- set_64(R2, rotl64(get_64(R2), m_r[R1]));
+ set_64(R2, rotl_64(get_64(R2), m_r[R1]));
else
- set_64(R2, rotr64(get_64(R2), -m_r[R1]));
+ set_64(R2, rotr_64(get_64(R2), -m_r[R1]));
// FLAGS: 00ZN
FLAGS(0, 0, get_64(R2) == 0, BIT63(get_64(R2)));
break;
@@ -766,9 +746,9 @@ void clipper_device::execute_instruction()
case 0x3c:
// roti: rotate immediate
if (!BIT31(m_info.imm))
- m_r[R2] = rotl32(m_r[R2], m_info.imm);
+ m_r[R2] = rotl_32(m_r[R2], m_info.imm);
else
- m_r[R2] = rotr32(m_r[R2], -m_info.imm);
+ m_r[R2] = rotr_32(m_r[R2], -m_info.imm);
FLAGS(0, 0, m_r[R2] == 0, BIT31(m_r[R2]));
// FLAGS: 00ZN
// TRAPS: I
@@ -776,9 +756,9 @@ void clipper_device::execute_instruction()
case 0x3d:
// rotli: rotate longword immediate
if (!BIT31(m_info.imm))
- set_64(R2, rotl64(get_64(R2), m_info.imm));
+ set_64(R2, rotl_64(get_64(R2), m_info.imm));
else
- set_64(R2, rotr64(get_64(R2), -m_info.imm));
+ set_64(R2, rotr_64(get_64(R2), -m_info.imm));
FLAGS(0, 0, get_64(R2) == 0, BIT63(get_64(R2)));
// FLAGS: 00ZN
// TRAPS: I
@@ -1262,7 +1242,7 @@ void clipper_device::execute_instruction()
m_r[0]--;
m_r[1]++;
- m_r[2] = rotr32(m_r[2], 8);
+ m_r[2] = rotr_32(m_r[2], 8);
}
// TRAPS: P,W
break;