From b2b10969c92e168ae77d299cee3e618dbcf0e12b Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Sun, 22 May 2016 23:20:49 -0700 Subject: [PATCH] Implement COP1_S_ROUND_L in cpu interpreter --- .../N64System/Interpreter/InterpreterOps.cpp | 8 +++++++- .../Project64-core/N64System/Interpreter/InterpreterOps.h | 1 + .../N64System/Interpreter/InterpreterOps32.cpp | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp b/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp index 5759e0f65..946387469 100644 --- a/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp +++ b/Source/Project64-core/N64System/Interpreter/InterpreterOps.cpp @@ -481,7 +481,7 @@ R4300iOp::Func * R4300iOp::BuildInterpreter() Jump_CoP1_S[5] = COP1_S_ABS; Jump_CoP1_S[6] = COP1_S_MOV; Jump_CoP1_S[7] = COP1_S_NEG; - Jump_CoP1_S[8] = UnknownOpcode; + Jump_CoP1_S[8] = COP1_S_ROUND_L; Jump_CoP1_S[9] = COP1_S_TRUNC_L; Jump_CoP1_S[10] = COP1_S_CEIL_L; //added by Witten Jump_CoP1_S[11] = COP1_S_FLOOR_L; //added by Witten @@ -2461,6 +2461,12 @@ void R4300iOp::COP1_S_NEG() *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * -1.0f); } +void R4300iOp::COP1_S_ROUND_L() +{ + TEST_COP1_USABLE_EXCEPTION(); + Float_RoundToInteger64(&*(int64_t *)_FPR_D[m_Opcode.fd], &*(float *)_FPR_S[m_Opcode.fs], FE_TONEAREST); +} + void R4300iOp::COP1_S_TRUNC_L() { TEST_COP1_USABLE_EXCEPTION(); diff --git a/Source/Project64-core/N64System/Interpreter/InterpreterOps.h b/Source/Project64-core/N64System/Interpreter/InterpreterOps.h index 6aeb7000d..12f2d9b9d 100644 --- a/Source/Project64-core/N64System/Interpreter/InterpreterOps.h +++ b/Source/Project64-core/N64System/Interpreter/InterpreterOps.h @@ -160,6 +160,7 @@ public: static void COP1_S_ABS(); static void COP1_S_MOV(); static void COP1_S_NEG(); + static void COP1_S_ROUND_L(); static void COP1_S_TRUNC_L(); static void COP1_S_CEIL_L(); //added by Witten static void COP1_S_FLOOR_L(); //added by Witten diff --git a/Source/Project64-core/N64System/Interpreter/InterpreterOps32.cpp b/Source/Project64-core/N64System/Interpreter/InterpreterOps32.cpp index 09447ae6d..a459f3b9e 100644 --- a/Source/Project64-core/N64System/Interpreter/InterpreterOps32.cpp +++ b/Source/Project64-core/N64System/Interpreter/InterpreterOps32.cpp @@ -376,7 +376,7 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter() Jump_CoP1_S[5] = R4300iOp::COP1_S_ABS; Jump_CoP1_S[6] = R4300iOp::COP1_S_MOV; Jump_CoP1_S[7] = R4300iOp::COP1_S_NEG; - Jump_CoP1_S[8] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[8] = R4300iOp::COP1_S_ROUND_L; Jump_CoP1_S[9] = R4300iOp::COP1_S_TRUNC_L; Jump_CoP1_S[10] = R4300iOp::COP1_S_CEIL_L; //added by Witten Jump_CoP1_S[11] = R4300iOp::COP1_S_FLOOR_L; //added by Witten