diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp index 71028a393..4e32e765c 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.cpp @@ -989,12 +989,23 @@ uint16_t CArmOps::ThumbCompressConst (uint32_t value) { return (uint16_t)((value & 0xFF)); } + + //'nnnnnnnn 00000000 nnnnnnnn 00000000' + if (((value >> 24) & 0xFF) == ((value >> 8) & 0xFF) && + ((value >> 16) & 0xFF) == 0 && + (value & 0xFF) == 0) + { + return (uint16_t)(0x200 | (value & 0xFF)); + } + + //'nnnnnnnn nnnnnnnn nnnnnnnn nnnnnnnn' if (((value >> 24) & 0xFF) == (value & 0xFF) && ((value >> 16) & 0xFF) == (value & 0xFF) && ((value >> 8) & 0xFF) == (value & 0xFF)) { return (uint16_t)(0x300 | (value & 0xFF)); } + CPU_Message("%s: value >> 24 = %X value >> 16 = %X value >> 8 = %X value = %X", __FUNCTION__, (value >> 24), (value >> 16), (value >> 8), value); CPU_Message("%s: value = %X", __FUNCTION__, value); g_Notify->BreakPoint(__FILE__,__LINE__); diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.h b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.h index 2ad336650..f1e06f083 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.h +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmOps.h @@ -177,21 +177,24 @@ protected: static void XorArmRegToArmReg(ArmReg DestReg, ArmReg SourceReg); static void XorArmRegToArmReg(ArmReg DestReg, ArmReg SourceReg1, ArmReg SourceReg2); - static bool CanThumbCompressConst (uint32_t value); - static uint16_t ThumbCompressConst (uint32_t value); - static void * GetAddressOf(int32_t value, ...); static void SetJump8(uint8_t * Loc, uint8_t * JumpLoc); static void SetJump20(uint32_t * Loc, uint32_t * JumpLoc); + static CArmRegInfo m_RegWorkingSet; + +protected: static const char * ArmBranchSuffix(ArmBranchCompare CompareType); static const char * ArmRegName(ArmReg Reg); static const char * ArmFpuSingleName(ArmFpuSingle Reg); + + static bool CanThumbCompressConst (uint32_t value); + static uint16_t ThumbCompressConst (uint32_t value); + static void AddCode8(uint8_t value); static void AddCode16(uint16_t value); static void AddCode32(uint32_t value); - static CArmRegInfo m_RegWorkingSet; }; #define AddressOf(Addr) CArmOps::GetAddressOf(5,(Addr))