summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/unsp/unsp_exxx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/unsp/unsp_exxx.cpp')
-rw-r--r--src/devices/cpu/unsp/unsp_exxx.cpp46
1 files changed, 10 insertions, 36 deletions
diff --git a/src/devices/cpu/unsp/unsp_exxx.cpp b/src/devices/cpu/unsp/unsp_exxx.cpp
index 38a15fe94d4..5a9a035d862 100644
--- a/src/devices/cpu/unsp/unsp_exxx.cpp
+++ b/src/devices/cpu/unsp/unsp_exxx.cpp
@@ -244,39 +244,13 @@ void unsp_12_device::execute_exxx_group(uint16_t op)
switch (shift)
{
- case 0x00:
+ case 0x00: // jak_smwm train movement
{
LOGMASKED(LOG_UNSP_SHIFTS, "%s = %s asr %s\n", regs[rd], regs[rd], regs[rs]);
-
- uint32_t rdval = (uint16_t)(m_core->m_r[rd]);
- int shift = (m_core->m_r[rs] & 0x01f);
- if (shift == 0)
- return;
-
+ int16_t rdval = (int16_t)((uint16_t)m_core->m_r[rd]);
+ int shift = (m_core->m_r[rs] & 0x1f);
uint32_t res;
- if (BIT(rd, (32 - shift)))
- {
- if (shift >= 16)
- {
- res = 0x0000ffff;
- }
- else
- {
- res = (rdval >> shift) | (uint16_t)(0xffff0000 >> shift);
- }
- }
- else
- {
- if (shift >= 16)
- {
- res = 0;
- }
- else
- {
- res = rdval >> shift;
- }
- }
-
+ res = rdval >> shift;
LOGMASKED(LOG_UNSP_SHIFTS, "result: %08x\n", res);
m_core->m_r[rd] = res;
return;
@@ -287,7 +261,7 @@ void unsp_12_device::execute_exxx_group(uint16_t op)
LOGMASKED(LOG_UNSP_SHIFTS, "%s = %s asror %s (%04x %04x)\n", regs[rd], regs[rd], regs[rs], m_core->m_r[rd], m_core->m_r[rs]);
const int32_t rdval = (int32_t)(m_core->m_r[rd] << 16);
- const int shift = (m_core->m_r[rs] & 0x01f);
+ const int shift = (m_core->m_r[rs] & 0x1f);
const uint32_t res = rdval >> shift;
m_core->m_r[REG_R3] |= (uint16_t)res;
m_core->m_r[REG_R4] = (uint16_t)(res >> 16);
@@ -299,7 +273,7 @@ void unsp_12_device::execute_exxx_group(uint16_t op)
{
LOGMASKED(LOG_UNSP_SHIFTS, "pc:%06x: %s = %s lsl %s (%04x %04x)\n", UNSP_LPC, regs[rd], regs[rd], regs[rs], m_core->m_r[rd], m_core->m_r[rs]);
const uint32_t rdval = (uint16_t)(m_core->m_r[rd]);
- const int shift = (m_core->m_r[rs] & 0x01f);
+ const int shift = (m_core->m_r[rs] & 0x1f);
const uint32_t res = (uint16_t)(rdval << shift);
LOGMASKED(LOG_UNSP_SHIFTS, "result: %08x\n", res);
m_core->m_r[rd] = res;
@@ -311,8 +285,8 @@ void unsp_12_device::execute_exxx_group(uint16_t op)
// wrlshunt uses this
LOGMASKED(LOG_UNSP_SHIFTS, "pc:%06x: %s = %s lslor %s (%04x %04x)\n", UNSP_LPC, regs[rd], regs[rd], regs[rs], m_core->m_r[rd], m_core->m_r[rs]);
- const uint32_t rdval = m_core->m_r[rd];
- const int shift = (m_core->m_r[rs] & 0x01f);
+ const uint32_t rdval = (uint16_t)m_core->m_r[rd];
+ const int shift = (m_core->m_r[rs] & 0x1f);
const uint32_t res = rdval << shift;
m_core->m_r[REG_R3] = (uint16_t)res;
m_core->m_r[REG_R4] |= (uint16_t)(res >> 16);
@@ -326,7 +300,7 @@ void unsp_12_device::execute_exxx_group(uint16_t op)
LOGMASKED(LOG_UNSP_SHIFTS, "pc:%06x: %s = %s lsr %s (%04x %04x)\n", UNSP_LPC, regs[rd], regs[rd], regs[rs], m_core->m_r[rd], m_core->m_r[rs]);
const uint32_t rdval = (uint16_t)(m_core->m_r[rd]);
- const int shift = (m_core->m_r[rs] & 0x01f);
+ const int shift = (m_core->m_r[rs] & 0x1f);
const uint32_t res = (uint16_t)(rdval >> shift);
LOGMASKED(LOG_UNSP_SHIFTS, "result: %08x\n", res);
m_core->m_r[rd] = res;
@@ -337,7 +311,7 @@ void unsp_12_device::execute_exxx_group(uint16_t op)
{
LOGMASKED(LOG_UNSP_SHIFTS, "pc:%06x: %s = %s lsror %s (%04x %04x)\n", UNSP_LPC, regs[rd], regs[rd], regs[rs], m_core->m_r[rd], m_core->m_r[rs]);
const uint32_t rdval = m_core->m_r[rd] << 16;
- const int shift = (m_core->m_r[rs] & 0x01f);
+ const int shift = (m_core->m_r[rs] & 0x1f);
const uint32_t res = rdval >> shift;
m_core->m_r[REG_R3] |= (uint16_t)res;
m_core->m_r[REG_R4] = (uint16_t)(res >> 16);