From efac3341361c6a537b18e7c37a625d20b02faa1e Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 7 Nov 2022 14:26:06 +1030 Subject: [PATCH] Rearrange MoveX86regHalfToVariable parameters --- .../Recompiler/x86/x86RecompilerOps.cpp | 2 +- .../N64System/Recompiler/x86/x86ops.cpp | 39 +------------------ .../N64System/Recompiler/x86/x86ops.h | 3 +- 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 056067bef..06bb9485e 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -10341,7 +10341,7 @@ void CX86RecompilerOps::SH_Register(CX86Ops::x86Reg Reg, uint32_t VAddr) } else if (PAddr < g_MMU->RdramSize()) { - m_Assembler.MoveX86regHalfToVariable(Reg, (PAddr ^ 2) + g_MMU->Rdram(), stdstr_f("RDRAM + (%X ^ 2)", PAddr).c_str()); + m_Assembler.MoveX86regHalfToVariable((PAddr ^ 2) + g_MMU->Rdram(), stdstr_f("RDRAM + (%X ^ 2)", PAddr).c_str(), Reg); } break; default: diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp index e74ae874f..7c3f205dd 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.cpp @@ -1184,44 +1184,7 @@ void CX86Ops::MoveX86regByteToX86regPointer(x86Reg AddrReg1, x86Reg AddrReg2, x8 AddCode8(Param); } -void CX86Ops::MoveX86regHalfToN64Mem(x86Reg Reg, x86Reg AddrReg) -{ - uint16_t x86Command = 0; - - CodeLog(" mov word ptr [%s+N64mem], %s", x86_Name(AddrReg), x86_HalfName(Reg)); - - AddCode8(0x66); - switch (AddrReg) - { - case x86_EAX: x86Command = 0x0089; break; - case x86_EBX: x86Command = 0x0389; break; - case x86_ECX: x86Command = 0x0189; break; - case x86_EDX: x86Command = 0x0289; break; - case x86_ESI: x86Command = 0x0689; break; - case x86_EDI: x86Command = 0x0789; break; - case x86_ESP: x86Command = 0x0489; break; - case x86_EBP: x86Command = 0x0589; break; - default: - g_Notify->BreakPoint(__FILE__, __LINE__); - } - switch (Reg) - { - case x86_EAX: x86Command += 0x8000; break; - case x86_EBX: x86Command += 0x9800; break; - case x86_ECX: x86Command += 0x8800; break; - case x86_EDX: x86Command += 0x9000; break; - case x86_ESI: x86Command += 0xB000; break; - case x86_EDI: x86Command += 0xB800; break; - case x86_ESP: x86Command += 0xA000; break; - case x86_EBP: x86Command += 0xA800; break; - default: - g_Notify->BreakPoint(__FILE__, __LINE__); - } - AddCode16(x86Command); - AddCode32((uint32_t)g_MMU->Rdram()); -} - -void CX86Ops::MoveX86regHalfToVariable(x86Reg Reg, void * Variable, const char * VariableName) +void CX86Ops::MoveX86regHalfToVariable(void * Variable, const char * VariableName, x86Reg Reg) { CodeLog(" mov word ptr [%s], %s", VariableName, x86_HalfName(Reg)); AddCode8(0x66); diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h index aa02b1437..7f9e86c53 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h @@ -146,8 +146,7 @@ public: void MoveX86PointerToX86regDisp(x86Reg Reg, x86Reg X86Pointer, uint8_t Disp); void MoveX86regByteToVariable(void * Variable, const char * VariableName, x86Reg Reg); void MoveX86regByteToX86regPointer(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg Reg); - void MoveX86regHalfToN64Mem(x86Reg Reg, x86Reg AddrReg); - void MoveX86regHalfToVariable(x86Reg Reg, void * Variable, const char * VariableName); + void MoveX86regHalfToVariable(void * Variable, const char * VariableName, x86Reg Reg); void MoveX86regHalfToX86regPointer(x86Reg Reg, x86Reg AddrReg1, x86Reg AddrReg2); void MoveX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg Reg); void MoveX86regPointerToX86regDisp8(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg Reg, uint8_t offset);