From d2e3ddff144f3405883299d97fe5186e1232abd4 Mon Sep 17 00:00:00 2001 From: Nabile Rahmani Date: Wed, 19 Dec 2018 15:43:20 +0100 Subject: [PATCH] Fixed incorrect masking for sub-word writes. --- DotN64/CPU/VR4300/VR4300.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DotN64/CPU/VR4300/VR4300.cs b/DotN64/CPU/VR4300/VR4300.cs index eab9a76..22d4fe8 100644 --- a/DotN64/CPU/VR4300/VR4300.cs +++ b/DotN64/CPU/VR4300/VR4300.cs @@ -354,7 +354,7 @@ namespace DotN64.CPU physicalAddress &= ~0b11u; var shift = ((int)address & 0b11 ^ -(int)CP0.Config.BE) << 3; - WriteSysAD(physicalAddress, (ReadSysAD(physicalAddress) & ~(uint.MaxValue << shift)) | (uint)((byte)data << shift)); + WriteSysAD(physicalAddress, (ReadSysAD(physicalAddress) & ~((uint)byte.MaxValue << shift)) | (uint)((byte)data << shift)); } break; case AccessSize.HalfWord: @@ -362,7 +362,7 @@ namespace DotN64.CPU physicalAddress &= ~0b11u; var shift = ((int)address & 0b11 ^ (-(int)CP0.Config.BE << 1)) << 3; - WriteSysAD(physicalAddress, (ReadSysAD(physicalAddress) & ~(uint.MaxValue << shift)) | (uint)((ushort)data << shift)); + WriteSysAD(physicalAddress, (ReadSysAD(physicalAddress) & ~((uint)ushort.MaxValue << shift)) | (uint)((ushort)data << shift)); } break; case AccessSize.Word: