summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/sharc/sharcops.hxx
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2018-03-14 00:38:54 +0100
committer angelosa <salese_corp_ltd@email.it>2018-03-14 00:42:17 +0100
commit7ae8a01086773beddc5a5a96ec22fec8809a1a29 (patch)
treee40b6b7f126b3fc3ddb1c4da9499b5307c289b85 /src/devices/cpu/sharc/sharcops.hxx
parent4b356e3b2cd8ba2032d17404f69065ad14fdf4da (diff)
sharc.cpp: fix LSHIFT negative operations to not extend the sign on result, fixes Last Bronx frame flickering [Angelo Salese]
Diffstat (limited to 'src/devices/cpu/sharc/sharcops.hxx')
-rw-r--r--src/devices/cpu/sharc/sharcops.hxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/devices/cpu/sharc/sharcops.hxx b/src/devices/cpu/sharc/sharcops.hxx
index f753a2182d8..9afa4754f5d 100644
--- a/src/devices/cpu/sharc/sharcops.hxx
+++ b/src/devices/cpu/sharc/sharcops.hxx
@@ -472,9 +472,9 @@ void adsp21062_device::SHIFT_OPERATION_IMM(int shiftop, int data, int rn, int rx
case 0x00: /* LSHIFT Rx BY <data8>*/
{
if(shift < 0) {
- REG(rn) = (shift > -32 ) ? (REG(rx) >> -shift) : 0;
+ REG(rn) = (shift > -32 ) ? ((uint32_t)REG(rx) >> -shift) : 0;
} else {
- REG(rn) = (shift < 32) ? (REG(rx) << shift) : 0;
+ REG(rn) = (shift < 32) ? ((uint32_t)REG(rx) << shift) : 0;
if (shift > 0)
{
m_core->astat |= SV;
@@ -524,14 +524,15 @@ void adsp21062_device::SHIFT_OPERATION_IMM(int shiftop, int data, int rn, int rx
{
uint32_t r = 0;
if(shift < 0) {
- r = (shift > -32 ) ? (REG(rx) >> -shift) : 0;
+ r = (shift > -32 ) ? ((uint32_t)REG(rx) >> -shift) : 0;
} else {
- r = (shift < 32) ? (REG(rx) << shift) : 0;
+ r = (shift < 32) ? ((uint32_t)REG(rx) << shift) : 0;
if (shift > 0)
{
m_core->astat |= SV;
}
}
+
SET_FLAG_SZ(r);
REG(rn) = REG(rn) | r;
@@ -887,11 +888,11 @@ void adsp21062_device::COMPUTE(uint32_t opcode)
int shift = REG(ry);
if(shift < 0)
{
- REG(rn) = (shift > -32 ) ? (REG(rx) >> -shift) : 0;
+ REG(rn) = (shift > -32 ) ? ((uint32_t)REG(rx) >> -shift) : 0;
}
else
{
- REG(rn) = (shift < 32) ? (REG(rx) << shift) : 0;
+ REG(rn) = (shift < 32) ? ((uint32_t)REG(rx) << shift) : 0;
if (shift > 0)
{
m_core->astat |= SV;