mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Merge pull request #6811 from DavidHaywood/080620_2
unsp20 - fix asr (nw)
This commit is contained in:
commit
2021c17a0e
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user