From e85c1665b1d2794688f5dbf92678cab63139dde7 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 9 Nov 2015 07:55:32 +1100 Subject: [PATCH] [Project64] Get Interpreter Ops to use standard types --- .../Interpreter/Interpreter CPU.cpp | 836 ++-- .../Interpreter/Interpreter Ops 32.cpp | 2315 +++++----- .../Interpreter/Interpreter Ops.cpp | 4036 ++++++++--------- .../N64 System/Interpreter/Interpreter Ops.h | 405 +- .../N64 System/Recompiler/Code Block.cpp | 2 +- .../N64 System/Recompiler/Code Section.cpp | 2 +- .../N64 System/Recompiler/Loop Analysis.cpp | 2 +- .../N64 System/Recompiler/Recompiler Ops.cpp | 2 +- 8 files changed, 3791 insertions(+), 3809 deletions(-) diff --git a/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp b/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp index 24c7afe18..0bd568b59 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp @@ -12,446 +12,444 @@ R4300iOp::Func * CInterpreterCPU::m_R4300i_Opcode = NULL; -void ExecuteInterpreterOps (DWORD /*Cycles*/) +void ExecuteInterpreterOps(uint32_t /*Cycles*/) { - g_Notify->BreakPoint(__FILEW__,__LINE__); + g_Notify->BreakPoint(__FILEW__, __LINE__); } -bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2) +bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2) { - OPCODE Command; + OPCODE Command; - if (!g_MMU->LW_VAddr(PC + 4, Command.Hex)) - { - //g_Notify->DisplayError(L"Failed to load word 2"); - //ExitThread(0); - return true; - } + if (!g_MMU->LW_VAddr(PC + 4, Command.Hex)) + { + //g_Notify->DisplayError(L"Failed to load word 2"); + //ExitThread(0); + return true; + } - switch (Command.op) - { - case R4300i_SPECIAL: - switch (Command.funct) - { - case R4300i_SPECIAL_SLL: - case R4300i_SPECIAL_SRL: - case R4300i_SPECIAL_SRA: - case R4300i_SPECIAL_SLLV: - case R4300i_SPECIAL_SRLV: - case R4300i_SPECIAL_SRAV: - case R4300i_SPECIAL_MFHI: - case R4300i_SPECIAL_MTHI: - case R4300i_SPECIAL_MFLO: - case R4300i_SPECIAL_MTLO: - case R4300i_SPECIAL_DSLLV: - case R4300i_SPECIAL_DSRLV: - case R4300i_SPECIAL_DSRAV: - case R4300i_SPECIAL_ADD: - case R4300i_SPECIAL_ADDU: - case R4300i_SPECIAL_SUB: - case R4300i_SPECIAL_SUBU: - case R4300i_SPECIAL_AND: - case R4300i_SPECIAL_OR: - case R4300i_SPECIAL_XOR: - case R4300i_SPECIAL_NOR: - case R4300i_SPECIAL_SLT: - case R4300i_SPECIAL_SLTU: - case R4300i_SPECIAL_DADD: - case R4300i_SPECIAL_DADDU: - case R4300i_SPECIAL_DSUB: - case R4300i_SPECIAL_DSUBU: - case R4300i_SPECIAL_DSLL: - case R4300i_SPECIAL_DSRL: - case R4300i_SPECIAL_DSRA: - case R4300i_SPECIAL_DSLL32: - case R4300i_SPECIAL_DSRL32: - case R4300i_SPECIAL_DSRA32: - if (Command.rd == 0) - { - return false; - } - if (Command.rd == Reg1 || Command.rd == Reg2) - { - return true; - } - break; - case R4300i_SPECIAL_MULT: - case R4300i_SPECIAL_MULTU: - case R4300i_SPECIAL_DIV: - case R4300i_SPECIAL_DIVU: - case R4300i_SPECIAL_DMULT: - case R4300i_SPECIAL_DMULTU: - case R4300i_SPECIAL_DDIV: - case R4300i_SPECIAL_DDIVU: - break; - default: - if (g_Settings->LoadBool(Debugger_Enabled)) - { - g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); - } - return true; - } - break; - case R4300i_CP0: - switch (Command.rs) - { - case R4300i_COP0_MT: break; - case R4300i_COP0_MF: - if (Command.rt == 0) - { - return false; - } - if (Command.rt == Reg1 || Command.rt == Reg2) - { - return true; - } - break; - default: - if ( (Command.rs & 0x10 ) != 0 ) - { - switch (Command.funct) - { - case R4300i_COP0_CO_TLBR: break; - case R4300i_COP0_CO_TLBWI: break; - case R4300i_COP0_CO_TLBWR: break; - case R4300i_COP0_CO_TLBP: break; - default: - if (g_Settings->LoadBool(Debugger_Enabled)) - { - g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n6",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); - } - return true; - } - } - else - { - if (g_Settings->LoadBool(Debugger_Enabled)) - { - g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n7",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); - } - return true; - } - } - break; - case R4300i_CP1: - switch (Command.fmt) - { - case R4300i_COP1_MF: - if (Command.rt == 0) - { - return false; - } - if (Command.rt == Reg1 || Command.rt == Reg2) - { - return true; - } - break; - case R4300i_COP1_CF: break; - case R4300i_COP1_MT: break; - case R4300i_COP1_CT: break; - case R4300i_COP1_S: break; - case R4300i_COP1_D: break; - case R4300i_COP1_W: break; - case R4300i_COP1_L: break; - default: - if (g_Settings->LoadBool(Debugger_Enabled)) - { - g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); - } - return true; - } - break; - case R4300i_ANDI: - case R4300i_ORI: - case R4300i_XORI: - case R4300i_LUI: - case R4300i_ADDI: - case R4300i_ADDIU: - case R4300i_SLTI: - case R4300i_SLTIU: - case R4300i_DADDI: - case R4300i_DADDIU: - case R4300i_LB: - case R4300i_LH: - case R4300i_LW: - case R4300i_LWL: - case R4300i_LWR: - case R4300i_LDL: - case R4300i_LDR: - case R4300i_LBU: - case R4300i_LHU: - case R4300i_LD: - case R4300i_LWC1: - case R4300i_LDC1: - if (Command.rt == 0) - { - return false; - } - if (Command.rt == Reg1 || Command.rt == Reg2) - { - return true; - } - break; - case R4300i_CACHE: break; - case R4300i_SB: break; - case R4300i_SH: break; - case R4300i_SW: break; - case R4300i_SWR: break; - case R4300i_SWL: break; - case R4300i_SWC1: break; - case R4300i_SDC1: break; - case R4300i_SD: break; - default: - if (g_Settings->LoadBool(Debugger_Enabled)) - { - g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str()); - } - return true; - } - return false; + switch (Command.op) + { + case R4300i_SPECIAL: + switch (Command.funct) + { + case R4300i_SPECIAL_SLL: + case R4300i_SPECIAL_SRL: + case R4300i_SPECIAL_SRA: + case R4300i_SPECIAL_SLLV: + case R4300i_SPECIAL_SRLV: + case R4300i_SPECIAL_SRAV: + case R4300i_SPECIAL_MFHI: + case R4300i_SPECIAL_MTHI: + case R4300i_SPECIAL_MFLO: + case R4300i_SPECIAL_MTLO: + case R4300i_SPECIAL_DSLLV: + case R4300i_SPECIAL_DSRLV: + case R4300i_SPECIAL_DSRAV: + case R4300i_SPECIAL_ADD: + case R4300i_SPECIAL_ADDU: + case R4300i_SPECIAL_SUB: + case R4300i_SPECIAL_SUBU: + case R4300i_SPECIAL_AND: + case R4300i_SPECIAL_OR: + case R4300i_SPECIAL_XOR: + case R4300i_SPECIAL_NOR: + case R4300i_SPECIAL_SLT: + case R4300i_SPECIAL_SLTU: + case R4300i_SPECIAL_DADD: + case R4300i_SPECIAL_DADDU: + case R4300i_SPECIAL_DSUB: + case R4300i_SPECIAL_DSUBU: + case R4300i_SPECIAL_DSLL: + case R4300i_SPECIAL_DSRL: + case R4300i_SPECIAL_DSRA: + case R4300i_SPECIAL_DSLL32: + case R4300i_SPECIAL_DSRL32: + case R4300i_SPECIAL_DSRA32: + if (Command.rd == 0) + { + return false; + } + if (Command.rd == Reg1 || Command.rd == Reg2) + { + return true; + } + break; + case R4300i_SPECIAL_MULT: + case R4300i_SPECIAL_MULTU: + case R4300i_SPECIAL_DIV: + case R4300i_SPECIAL_DIVU: + case R4300i_SPECIAL_DMULT: + case R4300i_SPECIAL_DMULTU: + case R4300i_SPECIAL_DDIV: + case R4300i_SPECIAL_DDIVU: + break; + default: + if (g_Settings->LoadBool(Debugger_Enabled)) + { + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str()); + } + return true; + } + break; + case R4300i_CP0: + switch (Command.rs) + { + case R4300i_COP0_MT: break; + case R4300i_COP0_MF: + if (Command.rt == 0) + { + return false; + } + if (Command.rt == Reg1 || Command.rt == Reg2) + { + return true; + } + break; + default: + if ((Command.rs & 0x10) != 0) + { + switch (Command.funct) + { + case R4300i_COP0_CO_TLBR: break; + case R4300i_COP0_CO_TLBWI: break; + case R4300i_COP0_CO_TLBWR: break; + case R4300i_COP0_CO_TLBP: break; + default: + if (g_Settings->LoadBool(Debugger_Enabled)) + { + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n6", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str()); + } + return true; + } + } + else + { + if (g_Settings->LoadBool(Debugger_Enabled)) + { + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n7", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str()); + } + return true; + } + } + break; + case R4300i_CP1: + switch (Command.fmt) + { + case R4300i_COP1_MF: + if (Command.rt == 0) + { + return false; + } + if (Command.rt == Reg1 || Command.rt == Reg2) + { + return true; + } + break; + case R4300i_COP1_CF: break; + case R4300i_COP1_MT: break; + case R4300i_COP1_CT: break; + case R4300i_COP1_S: break; + case R4300i_COP1_D: break; + case R4300i_COP1_W: break; + case R4300i_COP1_L: break; + default: + if (g_Settings->LoadBool(Debugger_Enabled)) + { + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str()); + } + return true; + } + break; + case R4300i_ANDI: + case R4300i_ORI: + case R4300i_XORI: + case R4300i_LUI: + case R4300i_ADDI: + case R4300i_ADDIU: + case R4300i_SLTI: + case R4300i_SLTIU: + case R4300i_DADDI: + case R4300i_DADDIU: + case R4300i_LB: + case R4300i_LH: + case R4300i_LW: + case R4300i_LWL: + case R4300i_LWR: + case R4300i_LDL: + case R4300i_LDR: + case R4300i_LBU: + case R4300i_LHU: + case R4300i_LD: + case R4300i_LWC1: + case R4300i_LDC1: + if (Command.rt == 0) + { + return false; + } + if (Command.rt == Reg1 || Command.rt == Reg2) + { + return true; + } + break; + case R4300i_CACHE: break; + case R4300i_SB: break; + case R4300i_SH: break; + case R4300i_SW: break; + case R4300i_SWR: break; + case R4300i_SWL: break; + case R4300i_SWC1: break; + case R4300i_SDC1: break; + case R4300i_SD: break; + default: + if (g_Settings->LoadBool(Debugger_Enabled)) + { + g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str()); + } + return true; + } + return false; } void CInterpreterCPU::BuildCPU() -{ - R4300iOp::m_TestTimer = false; - R4300iOp::m_NextInstruction = NORMAL; - R4300iOp::m_JumpToLocation = 0; - - if (g_Settings->LoadBool(Game_32Bit)) - { - m_R4300i_Opcode = R4300iOp32::BuildInterpreter(); - } - else - { - m_R4300i_Opcode = R4300iOp::BuildInterpreter(); - } +{ + R4300iOp::m_TestTimer = false; + R4300iOp::m_NextInstruction = NORMAL; + R4300iOp::m_JumpToLocation = 0; + + if (g_Settings->LoadBool(Game_32Bit)) + { + m_R4300i_Opcode = R4300iOp32::BuildInterpreter(); + } + else + { + m_R4300i_Opcode = R4300iOp::BuildInterpreter(); + } } void CInterpreterCPU::InPermLoop() { - // *** Changed ***/ - //if (CPU_Type == CPU_SyncCores) - //{ - // SyncRegisters.CP0[9] +=5; - //} + // *** Changed ***/ + //if (CPU_Type == CPU_SyncCores) + //{ + // SyncRegisters.CP0[9] +=5; + //} - /* Interrupts enabled */ - if (( g_Reg->STATUS_REGISTER & STATUS_IE ) == 0 || - ( g_Reg->STATUS_REGISTER & STATUS_EXL ) != 0 || - ( g_Reg->STATUS_REGISTER & STATUS_ERL ) != 0 || - ( g_Reg->STATUS_REGISTER & 0xFF00) == 0) - { - if (g_Plugins->Gfx()->UpdateScreen != NULL) - { - g_Plugins->Gfx()->UpdateScreen(); - } - //CurrentFrame = 0; - //CurrentPercent = 0; - //DisplayFPS(); - g_Notify->DisplayError(GS(MSG_PERM_LOOP)); - g_System->CloseCpu(); - } - else - { - if (*g_NextTimer > 0) - { - *g_NextTimer = 0 - g_System->CountPerOp(); - g_SystemTimer->UpdateTimers(); - } - } + /* Interrupts enabled */ + if ((g_Reg->STATUS_REGISTER & STATUS_IE) == 0 || + (g_Reg->STATUS_REGISTER & STATUS_EXL) != 0 || + (g_Reg->STATUS_REGISTER & STATUS_ERL) != 0 || + (g_Reg->STATUS_REGISTER & 0xFF00) == 0) + { + if (g_Plugins->Gfx()->UpdateScreen != NULL) + { + g_Plugins->Gfx()->UpdateScreen(); + } + //CurrentFrame = 0; + //CurrentPercent = 0; + //DisplayFPS(); + g_Notify->DisplayError(GS(MSG_PERM_LOOP)); + g_System->CloseCpu(); + } + else + { + if (*g_NextTimer > 0) + { + *g_NextTimer = 0 - g_System->CountPerOp(); + g_SystemTimer->UpdateTimers(); + } + } } void CInterpreterCPU::ExecuteCPU() -{ - bool & Done = g_System->m_EndEmulation; - uint32_t & PROGRAM_COUNTER = *_PROGRAM_COUNTER; - OPCODE & Opcode = R4300iOp::m_Opcode; - DWORD & JumpToLocation = R4300iOp::m_JumpToLocation; - bool & TestTimer = R4300iOp::m_TestTimer; - const BOOL & bDoSomething= g_SystemEvents->DoSomething(); - DWORD CountPerOp = g_System->CountPerOp(); - int & NextTimer = *g_NextTimer; - - __try - { - while (!Done) - { - if (g_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex)) - { - /*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000) - { - WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER)); - //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]); - //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType()); - }*/ - m_R4300i_Opcode[ Opcode.op ](); - NextTimer -= CountPerOp; - - switch (R4300iOp::m_NextInstruction) - { - case NORMAL: - PROGRAM_COUNTER += 4; - break; - case DELAY_SLOT: - R4300iOp::m_NextInstruction = JUMP; - PROGRAM_COUNTER += 4; - break; - case PERMLOOP_DO_DELAY: - R4300iOp::m_NextInstruction = PERMLOOP_DELAY_DONE; - PROGRAM_COUNTER += 4; - break; - case JUMP: - { - BOOL CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer); - PROGRAM_COUNTER = JumpToLocation; - R4300iOp::m_NextInstruction = NORMAL; - if (CheckTimer) - { - TestTimer = false; - if (NextTimer < 0) - { - g_SystemTimer->TimerDone(); - } - if (bDoSomething) - { - g_SystemEvents->ExecuteEvents(); - } - } - } - break; - case PERMLOOP_DELAY_DONE: - PROGRAM_COUNTER = JumpToLocation; - R4300iOp::m_NextInstruction = NORMAL; - CInterpreterCPU::InPermLoop(); - g_SystemTimer->TimerDone(); - if (bDoSomething) - { - g_SystemEvents->ExecuteEvents(); - } - break; - default: - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - } - else - { - g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER); - R4300iOp::m_NextInstruction = NORMAL; - } - } - } __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) - { - g_Notify->DisplayError(GS(MSG_UNKNOWN_MEM_ACTION)); - ExitThread(0); - } -} - - -void CInterpreterCPU::ExecuteOps(int Cycles) { - bool & Done = g_System->m_EndEmulation; + bool & Done = g_System->m_EndEmulation; uint32_t & PROGRAM_COUNTER = *_PROGRAM_COUNTER; - OPCODE & Opcode = R4300iOp::m_Opcode; - DWORD & JumpToLocation = R4300iOp::m_JumpToLocation; - bool & TestTimer = R4300iOp::m_TestTimer; - const BOOL & DoSomething = g_SystemEvents->DoSomething(); - DWORD CountPerOp = g_System->CountPerOp(); + OPCODE & Opcode = R4300iOp::m_Opcode; + uint32_t & JumpToLocation = R4300iOp::m_JumpToLocation; + bool & TestTimer = R4300iOp::m_TestTimer; + const int32_t & bDoSomething = g_SystemEvents->DoSomething(); + uint32_t CountPerOp = g_System->CountPerOp(); + int32_t & NextTimer = *g_NextTimer; __try - { - while (!Done) - { - if (Cycles <= 0) - { - g_SystemTimer->UpdateTimers(); - return; - } - - if (g_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex)) - { - /*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000) - { - WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER)); - //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]); - //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType()); - }*/ - /*if (PROGRAM_COUNTER > 0x80323000 && PROGRAM_COUNTER< 0x80380000) - { - WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER)); - //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]); - //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType()); - }*/ - m_R4300i_Opcode[ Opcode.op ](); - _GPR[0].DW = 0; /* MIPS $zero hard-wired to 0 */ + { + while (!Done) + { + if (g_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex)) + { + /*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000) + { + WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER)); + //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]); + //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType()); + }*/ + m_R4300i_Opcode[Opcode.op](); + NextTimer -= CountPerOp; - Cycles -= CountPerOp; - *g_NextTimer -= CountPerOp; - - /*static DWORD TestAddress = 0x80077B0C, TestValue = 0, CurrentValue = 0; - if (g_MMU->LW_VAddr(TestAddress, TestValue)) - { - if (TestValue != CurrentValue) - { - WriteTraceF(TraceError,"%X: %X changed (%s)",PROGRAM_COUNTER,TestAddress,R4300iOpcodeName(m_Opcode.Hex,PROGRAM_COUNTER) ); - CurrentValue = TestValue; - } - }*/ - - switch (R4300iOp::m_NextInstruction) - { - case NORMAL: - PROGRAM_COUNTER += 4; - break; - case DELAY_SLOT: - R4300iOp::m_NextInstruction = JUMP; - PROGRAM_COUNTER += 4; - break; - case PERMLOOP_DO_DELAY: - R4300iOp::m_NextInstruction = PERMLOOP_DELAY_DONE; - PROGRAM_COUNTER += 4; - break; - case JUMP: - { - BOOL CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer); - PROGRAM_COUNTER = JumpToLocation; - R4300iOp::m_NextInstruction = NORMAL; - if (CheckTimer) - { - TestTimer = false; - if (*g_NextTimer < 0) - { - g_SystemTimer->TimerDone(); - } - if (DoSomething) - { - g_SystemEvents->ExecuteEvents(); - } - } - } - break; - case PERMLOOP_DELAY_DONE: - PROGRAM_COUNTER = JumpToLocation; - R4300iOp::m_NextInstruction = NORMAL; - CInterpreterCPU::InPermLoop(); - g_SystemTimer->TimerDone(); - if (DoSomething) - { - g_SystemEvents->ExecuteEvents(); - } - break; - default: - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - } - else - { - g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER); - R4300iOp::m_NextInstruction = NORMAL; - } - } + switch (R4300iOp::m_NextInstruction) + { + case NORMAL: + PROGRAM_COUNTER += 4; + break; + case DELAY_SLOT: + R4300iOp::m_NextInstruction = JUMP; + PROGRAM_COUNTER += 4; + break; + case PERMLOOP_DO_DELAY: + R4300iOp::m_NextInstruction = PERMLOOP_DELAY_DONE; + PROGRAM_COUNTER += 4; + break; + case JUMP: + { + bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer); + PROGRAM_COUNTER = JumpToLocation; + R4300iOp::m_NextInstruction = NORMAL; + if (CheckTimer) + { + TestTimer = false; + if (NextTimer < 0) + { + g_SystemTimer->TimerDone(); + } + if (bDoSomething) + { + g_SystemEvents->ExecuteEvents(); + } + } + } + break; + case PERMLOOP_DELAY_DONE: + PROGRAM_COUNTER = JumpToLocation; + R4300iOp::m_NextInstruction = NORMAL; + CInterpreterCPU::InPermLoop(); + g_SystemTimer->TimerDone(); + if (bDoSomething) + { + g_SystemEvents->ExecuteEvents(); + } + break; + default: + g_Notify->BreakPoint(__FILEW__, __LINE__); + } + } + else + { + g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP, PROGRAM_COUNTER); + R4300iOp::m_NextInstruction = NORMAL; + } + } } __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) - { - g_Notify->DisplayError(GS(MSG_UNKNOWN_MEM_ACTION)); - ExitThread(0); - } + { + g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION)); + } +} + +void CInterpreterCPU::ExecuteOps(int32_t Cycles) +{ + bool & Done = g_System->m_EndEmulation; + uint32_t & PROGRAM_COUNTER = *_PROGRAM_COUNTER; + OPCODE & Opcode = R4300iOp::m_Opcode; + uint32_t & JumpToLocation = R4300iOp::m_JumpToLocation; + bool & TestTimer = R4300iOp::m_TestTimer; + const int32_t & DoSomething = g_SystemEvents->DoSomething(); + uint32_t CountPerOp = g_System->CountPerOp(); + + __try + { + while (!Done) + { + if (Cycles <= 0) + { + g_SystemTimer->UpdateTimers(); + return; + } + + if (g_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex)) + { + /*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000) + { + WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER)); + //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]); + //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType()); + }*/ + /*if (PROGRAM_COUNTER > 0x80323000 && PROGRAM_COUNTER< 0x80380000) + { + WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER)); + //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]); + //WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType()); + }*/ + m_R4300i_Opcode[Opcode.op](); + _GPR[0].DW = 0; /* MIPS $zero hard-wired to 0 */ + + Cycles -= CountPerOp; + *g_NextTimer -= CountPerOp; + + /*static uint32_t TestAddress = 0x80077B0C, TestValue = 0, CurrentValue = 0; + if (g_MMU->LW_VAddr(TestAddress, TestValue)) + { + if (TestValue != CurrentValue) + { + WriteTraceF(TraceError,"%X: %X changed (%s)",PROGRAM_COUNTER,TestAddress,R4300iOpcodeName(m_Opcode.Hex,PROGRAM_COUNTER) ); + CurrentValue = TestValue; + } + }*/ + + switch (R4300iOp::m_NextInstruction) + { + case NORMAL: + PROGRAM_COUNTER += 4; + break; + case DELAY_SLOT: + R4300iOp::m_NextInstruction = JUMP; + PROGRAM_COUNTER += 4; + break; + case PERMLOOP_DO_DELAY: + R4300iOp::m_NextInstruction = PERMLOOP_DELAY_DONE; + PROGRAM_COUNTER += 4; + break; + case JUMP: + { + bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer); + PROGRAM_COUNTER = JumpToLocation; + R4300iOp::m_NextInstruction = NORMAL; + if (CheckTimer) + { + TestTimer = false; + if (*g_NextTimer < 0) + { + g_SystemTimer->TimerDone(); + } + if (DoSomething) + { + g_SystemEvents->ExecuteEvents(); + } + } + } + break; + case PERMLOOP_DELAY_DONE: + PROGRAM_COUNTER = JumpToLocation; + R4300iOp::m_NextInstruction = NORMAL; + CInterpreterCPU::InPermLoop(); + g_SystemTimer->TimerDone(); + if (DoSomething) + { + g_SystemEvents->ExecuteEvents(); + } + break; + default: + g_Notify->BreakPoint(__FILEW__, __LINE__); + } + } + else + { + g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP, PROGRAM_COUNTER); + R4300iOp::m_NextInstruction = NORMAL; + } + } + } + __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) + { + g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION)); + } } diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp b/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp index 391c5f389..f168b946d 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp @@ -9,1425 +9,1424 @@ * * ****************************************************************************/ #include "stdafx.h" -//#include "../C Core/Logging.h" -bool DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 ); +bool DelaySlotEffectsCompare ( uint32_t PC, uint32_t Reg1, uint32_t Reg2 ); #define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \ - g_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\ - m_NextInstruction = JUMP;\ - m_JumpToLocation = (*_PROGRAM_COUNTER);\ - return; + g_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\ + m_NextInstruction = JUMP;\ + m_JumpToLocation = (*_PROGRAM_COUNTER);\ + return; //#define TEST_COP1_USABLE_EXCEPTION #define TEST_COP1_USABLE_EXCEPTION \ - if ((g_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\ - g_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\ - m_NextInstruction = JUMP;\ - m_JumpToLocation = (*_PROGRAM_COUNTER);\ - return;\ - } + if ((g_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\ + g_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\ + m_NextInstruction = JUMP;\ + m_JumpToLocation = (*_PROGRAM_COUNTER);\ + return;\ + } #define TLB_READ_EXCEPTION(Address) \ - g_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\ - m_NextInstruction = JUMP;\ - m_JumpToLocation = (*_PROGRAM_COUNTER);\ - return; + g_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\ + m_NextInstruction = JUMP;\ + m_JumpToLocation = (*_PROGRAM_COUNTER);\ + return; R4300iOp32::Func * R4300iOp32::BuildInterpreter() -{ - Jump_Opcode[ 0] = SPECIAL; - Jump_Opcode[ 1] = REGIMM; - Jump_Opcode[ 2] = R4300iOp::J; - Jump_Opcode[ 3] = JAL; - Jump_Opcode[ 4] = BEQ; - Jump_Opcode[ 5] = BNE; - Jump_Opcode[ 6] = BLEZ; - Jump_Opcode[ 7] = BGTZ; - Jump_Opcode[ 8] = ADDI; - Jump_Opcode[ 9] = ADDIU; - Jump_Opcode[10] = SLTI; - Jump_Opcode[11] = SLTIU; - Jump_Opcode[12] = ANDI; - Jump_Opcode[13] = ORI; - Jump_Opcode[14] = XORI; - Jump_Opcode[15] = LUI; - Jump_Opcode[16] = COP0; - Jump_Opcode[17] = COP1; - Jump_Opcode[18] = R4300iOp::UnknownOpcode; - Jump_Opcode[19] = R4300iOp::UnknownOpcode; - Jump_Opcode[20] = BEQL; - Jump_Opcode[21] = BNEL; - Jump_Opcode[22] = BLEZL; - Jump_Opcode[23] = BGTZL; - Jump_Opcode[24] = R4300iOp::UnknownOpcode; - Jump_Opcode[25] = R4300iOp::DADDIU; - Jump_Opcode[26] = R4300iOp::LDL; - Jump_Opcode[27] = R4300iOp::LDR; - Jump_Opcode[28] = R4300iOp::UnknownOpcode; - Jump_Opcode[29] = R4300iOp::UnknownOpcode; - Jump_Opcode[30] = R4300iOp::UnknownOpcode; - Jump_Opcode[31] = R4300iOp::UnknownOpcode; - Jump_Opcode[32] = LB; - Jump_Opcode[33] = LH; - Jump_Opcode[34] = LWL; - Jump_Opcode[35] = LW; - Jump_Opcode[36] = LBU; - Jump_Opcode[37] = LHU; - Jump_Opcode[38] = LWR; - Jump_Opcode[39] = LWU; - Jump_Opcode[40] = R4300iOp::SB; - Jump_Opcode[41] = R4300iOp::SH; - Jump_Opcode[42] = R4300iOp::SWL; - Jump_Opcode[43] = R4300iOp::SW; - Jump_Opcode[44] = R4300iOp::SDL; - Jump_Opcode[45] = R4300iOp::SDR; - Jump_Opcode[46] = R4300iOp::SWR; - Jump_Opcode[47] = R4300iOp::CACHE; - Jump_Opcode[48] = R4300iOp::LL; - Jump_Opcode[49] = R4300iOp::LWC1; - Jump_Opcode[50] = R4300iOp::UnknownOpcode; - Jump_Opcode[51] = R4300iOp::UnknownOpcode; - Jump_Opcode[52] = R4300iOp::UnknownOpcode; - Jump_Opcode[53] = R4300iOp::LDC1; - Jump_Opcode[54] = R4300iOp::UnknownOpcode; - Jump_Opcode[55] = R4300iOp::LD; - Jump_Opcode[56] = R4300iOp::SC; - Jump_Opcode[57] = R4300iOp::SWC1; - Jump_Opcode[58] = R4300iOp::UnknownOpcode; - Jump_Opcode[59] = R4300iOp::UnknownOpcode; - Jump_Opcode[60] = R4300iOp::UnknownOpcode; - Jump_Opcode[61] = R4300iOp::SDC1; - Jump_Opcode[62] = R4300iOp::UnknownOpcode; - Jump_Opcode[63] = R4300iOp::SD; +{ + Jump_Opcode[ 0] = SPECIAL; + Jump_Opcode[ 1] = REGIMM; + Jump_Opcode[ 2] = R4300iOp::J; + Jump_Opcode[ 3] = JAL; + Jump_Opcode[ 4] = BEQ; + Jump_Opcode[ 5] = BNE; + Jump_Opcode[ 6] = BLEZ; + Jump_Opcode[ 7] = BGTZ; + Jump_Opcode[ 8] = ADDI; + Jump_Opcode[ 9] = ADDIU; + Jump_Opcode[10] = SLTI; + Jump_Opcode[11] = SLTIU; + Jump_Opcode[12] = ANDI; + Jump_Opcode[13] = ORI; + Jump_Opcode[14] = XORI; + Jump_Opcode[15] = LUI; + Jump_Opcode[16] = COP0; + Jump_Opcode[17] = COP1; + Jump_Opcode[18] = R4300iOp::UnknownOpcode; + Jump_Opcode[19] = R4300iOp::UnknownOpcode; + Jump_Opcode[20] = BEQL; + Jump_Opcode[21] = BNEL; + Jump_Opcode[22] = BLEZL; + Jump_Opcode[23] = BGTZL; + Jump_Opcode[24] = R4300iOp::UnknownOpcode; + Jump_Opcode[25] = R4300iOp::DADDIU; + Jump_Opcode[26] = R4300iOp::LDL; + Jump_Opcode[27] = R4300iOp::LDR; + Jump_Opcode[28] = R4300iOp::UnknownOpcode; + Jump_Opcode[29] = R4300iOp::UnknownOpcode; + Jump_Opcode[30] = R4300iOp::UnknownOpcode; + Jump_Opcode[31] = R4300iOp::UnknownOpcode; + Jump_Opcode[32] = LB; + Jump_Opcode[33] = LH; + Jump_Opcode[34] = LWL; + Jump_Opcode[35] = LW; + Jump_Opcode[36] = LBU; + Jump_Opcode[37] = LHU; + Jump_Opcode[38] = LWR; + Jump_Opcode[39] = LWU; + Jump_Opcode[40] = R4300iOp::SB; + Jump_Opcode[41] = R4300iOp::SH; + Jump_Opcode[42] = R4300iOp::SWL; + Jump_Opcode[43] = R4300iOp::SW; + Jump_Opcode[44] = R4300iOp::SDL; + Jump_Opcode[45] = R4300iOp::SDR; + Jump_Opcode[46] = R4300iOp::SWR; + Jump_Opcode[47] = R4300iOp::CACHE; + Jump_Opcode[48] = R4300iOp::LL; + Jump_Opcode[49] = R4300iOp::LWC1; + Jump_Opcode[50] = R4300iOp::UnknownOpcode; + Jump_Opcode[51] = R4300iOp::UnknownOpcode; + Jump_Opcode[52] = R4300iOp::UnknownOpcode; + Jump_Opcode[53] = R4300iOp::LDC1; + Jump_Opcode[54] = R4300iOp::UnknownOpcode; + Jump_Opcode[55] = R4300iOp::LD; + Jump_Opcode[56] = R4300iOp::SC; + Jump_Opcode[57] = R4300iOp::SWC1; + Jump_Opcode[58] = R4300iOp::UnknownOpcode; + Jump_Opcode[59] = R4300iOp::UnknownOpcode; + Jump_Opcode[60] = R4300iOp::UnknownOpcode; + Jump_Opcode[61] = R4300iOp::SDC1; + Jump_Opcode[62] = R4300iOp::UnknownOpcode; + Jump_Opcode[63] = R4300iOp::SD; - Jump_Special[ 0] = SPECIAL_SLL; - Jump_Special[ 1] = R4300iOp::UnknownOpcode; - Jump_Special[ 2] = SPECIAL_SRL; - Jump_Special[ 3] = SPECIAL_SRA; - Jump_Special[ 4] = SPECIAL_SLLV; - Jump_Special[ 5] = R4300iOp::UnknownOpcode; - Jump_Special[ 6] = SPECIAL_SRLV; - Jump_Special[ 7] = SPECIAL_SRAV; - Jump_Special[ 8] = SPECIAL_JR; - Jump_Special[ 9] = SPECIAL_JALR; - Jump_Special[10] = R4300iOp::UnknownOpcode; - Jump_Special[11] = R4300iOp::UnknownOpcode; - Jump_Special[12] = R4300iOp::SPECIAL_SYSCALL; - Jump_Special[13] = R4300iOp::UnknownOpcode; - Jump_Special[14] = R4300iOp::UnknownOpcode; - Jump_Special[15] = R4300iOp::SPECIAL_SYNC; - Jump_Special[16] = R4300iOp::SPECIAL_MFHI; - Jump_Special[17] = R4300iOp::SPECIAL_MTHI; - Jump_Special[18] = R4300iOp::SPECIAL_MFLO; - Jump_Special[19] = R4300iOp::SPECIAL_MTLO; - Jump_Special[20] = R4300iOp::SPECIAL_DSLLV; - Jump_Special[21] = R4300iOp::UnknownOpcode; - Jump_Special[22] = R4300iOp::SPECIAL_DSRLV; - Jump_Special[23] = R4300iOp::SPECIAL_DSRAV; - Jump_Special[24] = R4300iOp::SPECIAL_MULT; - Jump_Special[25] = R4300iOp::SPECIAL_MULTU; - Jump_Special[26] = R4300iOp::SPECIAL_DIV; - Jump_Special[27] = R4300iOp::SPECIAL_DIVU; - Jump_Special[28] = R4300iOp::SPECIAL_DMULT; - Jump_Special[29] = R4300iOp::SPECIAL_DMULTU; - Jump_Special[30] = R4300iOp::SPECIAL_DDIV; - Jump_Special[31] = R4300iOp::SPECIAL_DDIVU; - Jump_Special[32] = SPECIAL_ADD; - Jump_Special[33] = SPECIAL_ADDU; - Jump_Special[34] = SPECIAL_SUB; - Jump_Special[35] = SPECIAL_SUBU; - Jump_Special[36] = SPECIAL_AND; - Jump_Special[37] = SPECIAL_OR; - Jump_Special[38] = SPECIAL_XOR; - Jump_Special[39] = SPECIAL_NOR; - Jump_Special[40] = R4300iOp::UnknownOpcode; - Jump_Special[41] = R4300iOp::UnknownOpcode; - Jump_Special[42] = SPECIAL_SLT; - Jump_Special[43] = SPECIAL_SLTU; - Jump_Special[44] = R4300iOp::SPECIAL_DADD; - Jump_Special[45] = R4300iOp::SPECIAL_DADDU; - Jump_Special[46] = R4300iOp::SPECIAL_DSUB; - Jump_Special[47] = R4300iOp::SPECIAL_DSUBU; - Jump_Special[48] = R4300iOp::UnknownOpcode; - Jump_Special[49] = R4300iOp::UnknownOpcode; - Jump_Special[50] = R4300iOp::UnknownOpcode; - Jump_Special[51] = R4300iOp::UnknownOpcode; - Jump_Special[52] = R4300iOp::SPECIAL_TEQ; - Jump_Special[53] = R4300iOp::UnknownOpcode; - Jump_Special[54] = R4300iOp::UnknownOpcode; - Jump_Special[55] = R4300iOp::UnknownOpcode; - Jump_Special[56] = R4300iOp::SPECIAL_DSLL; - Jump_Special[57] = R4300iOp::UnknownOpcode; - Jump_Special[58] = R4300iOp::SPECIAL_DSRL; - Jump_Special[59] = R4300iOp::SPECIAL_DSRA; - Jump_Special[60] = R4300iOp::SPECIAL_DSLL32; - Jump_Special[61] = R4300iOp::UnknownOpcode; - Jump_Special[62] = R4300iOp::SPECIAL_DSRL32; - Jump_Special[63] = R4300iOp::SPECIAL_DSRA32; + Jump_Special[ 0] = SPECIAL_SLL; + Jump_Special[ 1] = R4300iOp::UnknownOpcode; + Jump_Special[ 2] = SPECIAL_SRL; + Jump_Special[ 3] = SPECIAL_SRA; + Jump_Special[ 4] = SPECIAL_SLLV; + Jump_Special[ 5] = R4300iOp::UnknownOpcode; + Jump_Special[ 6] = SPECIAL_SRLV; + Jump_Special[ 7] = SPECIAL_SRAV; + Jump_Special[ 8] = SPECIAL_JR; + Jump_Special[ 9] = SPECIAL_JALR; + Jump_Special[10] = R4300iOp::UnknownOpcode; + Jump_Special[11] = R4300iOp::UnknownOpcode; + Jump_Special[12] = R4300iOp::SPECIAL_SYSCALL; + Jump_Special[13] = R4300iOp::UnknownOpcode; + Jump_Special[14] = R4300iOp::UnknownOpcode; + Jump_Special[15] = R4300iOp::SPECIAL_SYNC; + Jump_Special[16] = R4300iOp::SPECIAL_MFHI; + Jump_Special[17] = R4300iOp::SPECIAL_MTHI; + Jump_Special[18] = R4300iOp::SPECIAL_MFLO; + Jump_Special[19] = R4300iOp::SPECIAL_MTLO; + Jump_Special[20] = R4300iOp::SPECIAL_DSLLV; + Jump_Special[21] = R4300iOp::UnknownOpcode; + Jump_Special[22] = R4300iOp::SPECIAL_DSRLV; + Jump_Special[23] = R4300iOp::SPECIAL_DSRAV; + Jump_Special[24] = R4300iOp::SPECIAL_MULT; + Jump_Special[25] = R4300iOp::SPECIAL_MULTU; + Jump_Special[26] = R4300iOp::SPECIAL_DIV; + Jump_Special[27] = R4300iOp::SPECIAL_DIVU; + Jump_Special[28] = R4300iOp::SPECIAL_DMULT; + Jump_Special[29] = R4300iOp::SPECIAL_DMULTU; + Jump_Special[30] = R4300iOp::SPECIAL_DDIV; + Jump_Special[31] = R4300iOp::SPECIAL_DDIVU; + Jump_Special[32] = SPECIAL_ADD; + Jump_Special[33] = SPECIAL_ADDU; + Jump_Special[34] = SPECIAL_SUB; + Jump_Special[35] = SPECIAL_SUBU; + Jump_Special[36] = SPECIAL_AND; + Jump_Special[37] = SPECIAL_OR; + Jump_Special[38] = SPECIAL_XOR; + Jump_Special[39] = SPECIAL_NOR; + Jump_Special[40] = R4300iOp::UnknownOpcode; + Jump_Special[41] = R4300iOp::UnknownOpcode; + Jump_Special[42] = SPECIAL_SLT; + Jump_Special[43] = SPECIAL_SLTU; + Jump_Special[44] = R4300iOp::SPECIAL_DADD; + Jump_Special[45] = R4300iOp::SPECIAL_DADDU; + Jump_Special[46] = R4300iOp::SPECIAL_DSUB; + Jump_Special[47] = R4300iOp::SPECIAL_DSUBU; + Jump_Special[48] = R4300iOp::UnknownOpcode; + Jump_Special[49] = R4300iOp::UnknownOpcode; + Jump_Special[50] = R4300iOp::UnknownOpcode; + Jump_Special[51] = R4300iOp::UnknownOpcode; + Jump_Special[52] = R4300iOp::SPECIAL_TEQ; + Jump_Special[53] = R4300iOp::UnknownOpcode; + Jump_Special[54] = R4300iOp::UnknownOpcode; + Jump_Special[55] = R4300iOp::UnknownOpcode; + Jump_Special[56] = R4300iOp::SPECIAL_DSLL; + Jump_Special[57] = R4300iOp::UnknownOpcode; + Jump_Special[58] = R4300iOp::SPECIAL_DSRL; + Jump_Special[59] = R4300iOp::SPECIAL_DSRA; + Jump_Special[60] = R4300iOp::SPECIAL_DSLL32; + Jump_Special[61] = R4300iOp::UnknownOpcode; + Jump_Special[62] = R4300iOp::SPECIAL_DSRL32; + Jump_Special[63] = R4300iOp::SPECIAL_DSRA32; - Jump_Regimm[ 0] = REGIMM_BLTZ; - Jump_Regimm[ 1] = REGIMM_BGEZ; - Jump_Regimm[ 2] = REGIMM_BLTZL; - Jump_Regimm[ 3] = REGIMM_BGEZL; - Jump_Regimm[ 4] = R4300iOp::UnknownOpcode; - Jump_Regimm[ 5] = R4300iOp::UnknownOpcode; - Jump_Regimm[ 6] = R4300iOp::UnknownOpcode; - Jump_Regimm[ 7] = R4300iOp::UnknownOpcode; - Jump_Regimm[ 8] = R4300iOp::UnknownOpcode; - Jump_Regimm[ 9] = R4300iOp::UnknownOpcode; - Jump_Regimm[10] = R4300iOp::UnknownOpcode; - Jump_Regimm[11] = R4300iOp::UnknownOpcode; - Jump_Regimm[12] = R4300iOp::UnknownOpcode; - Jump_Regimm[13] = R4300iOp::UnknownOpcode; - Jump_Regimm[14] = R4300iOp::UnknownOpcode; - Jump_Regimm[15] = R4300iOp::UnknownOpcode; - Jump_Regimm[16] = REGIMM_BLTZAL; - Jump_Regimm[17] = REGIMM_BGEZAL; - Jump_Regimm[18] = R4300iOp::UnknownOpcode; - Jump_Regimm[19] = R4300iOp::UnknownOpcode; - Jump_Regimm[20] = R4300iOp::UnknownOpcode; - Jump_Regimm[21] = R4300iOp::UnknownOpcode; - Jump_Regimm[22] = R4300iOp::UnknownOpcode; - Jump_Regimm[23] = R4300iOp::UnknownOpcode; - Jump_Regimm[24] = R4300iOp::UnknownOpcode; - Jump_Regimm[25] = R4300iOp::UnknownOpcode; - Jump_Regimm[26] = R4300iOp::UnknownOpcode; - Jump_Regimm[27] = R4300iOp::UnknownOpcode; - Jump_Regimm[28] = R4300iOp::UnknownOpcode; - Jump_Regimm[29] = R4300iOp::UnknownOpcode; - Jump_Regimm[30] = R4300iOp::UnknownOpcode; - Jump_Regimm[31] = R4300iOp::UnknownOpcode; - - Jump_CoP0[ 0] = COP0_MF; - Jump_CoP0[ 1] = R4300iOp::UnknownOpcode; - Jump_CoP0[ 2] = R4300iOp::UnknownOpcode; - Jump_CoP0[ 3] = R4300iOp::UnknownOpcode; - Jump_CoP0[ 4] = COP0_MT; - Jump_CoP0[ 5] = R4300iOp::UnknownOpcode; - Jump_CoP0[ 6] = R4300iOp::UnknownOpcode; - Jump_CoP0[ 7] = R4300iOp::UnknownOpcode; - Jump_CoP0[ 8] = R4300iOp::UnknownOpcode; - Jump_CoP0[ 9] = R4300iOp::UnknownOpcode; - Jump_CoP0[10] = R4300iOp::UnknownOpcode; - Jump_CoP0[11] = R4300iOp::UnknownOpcode; - Jump_CoP0[12] = R4300iOp::UnknownOpcode; - Jump_CoP0[13] = R4300iOp::UnknownOpcode; - Jump_CoP0[14] = R4300iOp::UnknownOpcode; - Jump_CoP0[15] = R4300iOp::UnknownOpcode; - Jump_CoP0[16] = R4300iOp::COP0_CO; - Jump_CoP0[17] = R4300iOp::COP0_CO; - Jump_CoP0[18] = R4300iOp::COP0_CO; - Jump_CoP0[19] = R4300iOp::COP0_CO; - Jump_CoP0[20] = R4300iOp::COP0_CO; - Jump_CoP0[21] = R4300iOp::COP0_CO; - Jump_CoP0[22] = R4300iOp::COP0_CO; - Jump_CoP0[23] = R4300iOp::COP0_CO; - Jump_CoP0[24] = R4300iOp::COP0_CO; - Jump_CoP0[25] = R4300iOp::COP0_CO; - Jump_CoP0[26] = R4300iOp::COP0_CO; - Jump_CoP0[27] = R4300iOp::COP0_CO; - Jump_CoP0[28] = R4300iOp::COP0_CO; - Jump_CoP0[29] = R4300iOp::COP0_CO; - Jump_CoP0[30] = R4300iOp::COP0_CO; - Jump_CoP0[31] = R4300iOp::COP0_CO; + Jump_Regimm[ 0] = REGIMM_BLTZ; + Jump_Regimm[ 1] = REGIMM_BGEZ; + Jump_Regimm[ 2] = REGIMM_BLTZL; + Jump_Regimm[ 3] = REGIMM_BGEZL; + Jump_Regimm[ 4] = R4300iOp::UnknownOpcode; + Jump_Regimm[ 5] = R4300iOp::UnknownOpcode; + Jump_Regimm[ 6] = R4300iOp::UnknownOpcode; + Jump_Regimm[ 7] = R4300iOp::UnknownOpcode; + Jump_Regimm[ 8] = R4300iOp::UnknownOpcode; + Jump_Regimm[ 9] = R4300iOp::UnknownOpcode; + Jump_Regimm[10] = R4300iOp::UnknownOpcode; + Jump_Regimm[11] = R4300iOp::UnknownOpcode; + Jump_Regimm[12] = R4300iOp::UnknownOpcode; + Jump_Regimm[13] = R4300iOp::UnknownOpcode; + Jump_Regimm[14] = R4300iOp::UnknownOpcode; + Jump_Regimm[15] = R4300iOp::UnknownOpcode; + Jump_Regimm[16] = REGIMM_BLTZAL; + Jump_Regimm[17] = REGIMM_BGEZAL; + Jump_Regimm[18] = R4300iOp::UnknownOpcode; + Jump_Regimm[19] = R4300iOp::UnknownOpcode; + Jump_Regimm[20] = R4300iOp::UnknownOpcode; + Jump_Regimm[21] = R4300iOp::UnknownOpcode; + Jump_Regimm[22] = R4300iOp::UnknownOpcode; + Jump_Regimm[23] = R4300iOp::UnknownOpcode; + Jump_Regimm[24] = R4300iOp::UnknownOpcode; + Jump_Regimm[25] = R4300iOp::UnknownOpcode; + Jump_Regimm[26] = R4300iOp::UnknownOpcode; + Jump_Regimm[27] = R4300iOp::UnknownOpcode; + Jump_Regimm[28] = R4300iOp::UnknownOpcode; + Jump_Regimm[29] = R4300iOp::UnknownOpcode; + Jump_Regimm[30] = R4300iOp::UnknownOpcode; + Jump_Regimm[31] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[ 0] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[ 1] = R4300iOp::COP0_CO_TLBR; - Jump_CoP0_Function[ 2] = R4300iOp::COP0_CO_TLBWI; - Jump_CoP0_Function[ 3] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[ 4] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[ 5] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[ 6] = R4300iOp::COP0_CO_TLBWR; - Jump_CoP0_Function[ 7] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[ 8] = R4300iOp::COP0_CO_TLBP; - Jump_CoP0_Function[ 9] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[10] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[11] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[12] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[13] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[14] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[15] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[16] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[17] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[18] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[19] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[20] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[21] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[22] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[23] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[24] = R4300iOp::COP0_CO_ERET; - Jump_CoP0_Function[25] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[26] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[27] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[28] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[29] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[30] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[31] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[32] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[33] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[34] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[35] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[36] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[37] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[38] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[39] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[40] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[41] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[42] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[43] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[44] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[45] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[46] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[47] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[48] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[49] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[50] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[51] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[52] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[53] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[54] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[55] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[56] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[57] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[58] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[59] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[60] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[61] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[62] = R4300iOp::UnknownOpcode; - Jump_CoP0_Function[63] = R4300iOp::UnknownOpcode; - - Jump_CoP1[ 0] = COP1_MF; - Jump_CoP1[ 1] = R4300iOp::COP1_DMF; - Jump_CoP1[ 2] = COP1_CF; - Jump_CoP1[ 3] = R4300iOp::UnknownOpcode; - Jump_CoP1[ 4] = R4300iOp::COP1_MT; - Jump_CoP1[ 5] = COP1_DMT; - Jump_CoP1[ 6] = R4300iOp::COP1_CT; - Jump_CoP1[ 7] = R4300iOp::UnknownOpcode; - Jump_CoP1[ 8] = R4300iOp::COP1_BC; - Jump_CoP1[ 9] = R4300iOp::UnknownOpcode; - Jump_CoP1[10] = R4300iOp::UnknownOpcode; - Jump_CoP1[11] = R4300iOp::UnknownOpcode; - Jump_CoP1[12] = R4300iOp::UnknownOpcode; - Jump_CoP1[13] = R4300iOp::UnknownOpcode; - Jump_CoP1[14] = R4300iOp::UnknownOpcode; - Jump_CoP1[15] = R4300iOp::UnknownOpcode; - Jump_CoP1[16] = R4300iOp::COP1_S; - Jump_CoP1[17] = R4300iOp::COP1_D; - Jump_CoP1[18] = R4300iOp::UnknownOpcode; - Jump_CoP1[19] = R4300iOp::UnknownOpcode; - Jump_CoP1[20] = R4300iOp::COP1_W; - Jump_CoP1[21] = R4300iOp::COP1_L; - Jump_CoP1[22] = R4300iOp::UnknownOpcode; - Jump_CoP1[23] = R4300iOp::UnknownOpcode; - Jump_CoP1[24] = R4300iOp::UnknownOpcode; - Jump_CoP1[25] = R4300iOp::UnknownOpcode; - Jump_CoP1[26] = R4300iOp::UnknownOpcode; - Jump_CoP1[27] = R4300iOp::UnknownOpcode; - Jump_CoP1[28] = R4300iOp::UnknownOpcode; - Jump_CoP1[29] = R4300iOp::UnknownOpcode; - Jump_CoP1[30] = R4300iOp::UnknownOpcode; - Jump_CoP1[31] = R4300iOp::UnknownOpcode; + Jump_CoP0[ 0] = COP0_MF; + Jump_CoP0[ 1] = R4300iOp::UnknownOpcode; + Jump_CoP0[ 2] = R4300iOp::UnknownOpcode; + Jump_CoP0[ 3] = R4300iOp::UnknownOpcode; + Jump_CoP0[ 4] = COP0_MT; + Jump_CoP0[ 5] = R4300iOp::UnknownOpcode; + Jump_CoP0[ 6] = R4300iOp::UnknownOpcode; + Jump_CoP0[ 7] = R4300iOp::UnknownOpcode; + Jump_CoP0[ 8] = R4300iOp::UnknownOpcode; + Jump_CoP0[ 9] = R4300iOp::UnknownOpcode; + Jump_CoP0[10] = R4300iOp::UnknownOpcode; + Jump_CoP0[11] = R4300iOp::UnknownOpcode; + Jump_CoP0[12] = R4300iOp::UnknownOpcode; + Jump_CoP0[13] = R4300iOp::UnknownOpcode; + Jump_CoP0[14] = R4300iOp::UnknownOpcode; + Jump_CoP0[15] = R4300iOp::UnknownOpcode; + Jump_CoP0[16] = R4300iOp::COP0_CO; + Jump_CoP0[17] = R4300iOp::COP0_CO; + Jump_CoP0[18] = R4300iOp::COP0_CO; + Jump_CoP0[19] = R4300iOp::COP0_CO; + Jump_CoP0[20] = R4300iOp::COP0_CO; + Jump_CoP0[21] = R4300iOp::COP0_CO; + Jump_CoP0[22] = R4300iOp::COP0_CO; + Jump_CoP0[23] = R4300iOp::COP0_CO; + Jump_CoP0[24] = R4300iOp::COP0_CO; + Jump_CoP0[25] = R4300iOp::COP0_CO; + Jump_CoP0[26] = R4300iOp::COP0_CO; + Jump_CoP0[27] = R4300iOp::COP0_CO; + Jump_CoP0[28] = R4300iOp::COP0_CO; + Jump_CoP0[29] = R4300iOp::COP0_CO; + Jump_CoP0[30] = R4300iOp::COP0_CO; + Jump_CoP0[31] = R4300iOp::COP0_CO; - Jump_CoP1_BC[ 0] = R4300iOp::COP1_BCF; - Jump_CoP1_BC[ 1] = R4300iOp::COP1_BCT; - Jump_CoP1_BC[ 2] = R4300iOp::COP1_BCFL; - Jump_CoP1_BC[ 3] = R4300iOp::COP1_BCTL; - Jump_CoP1_BC[ 4] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[ 5] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[ 6] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[ 7] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[ 8] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[ 9] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[10] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[11] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[12] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[13] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[14] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[15] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[16] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[17] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[18] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[19] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[20] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[21] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[22] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[23] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[24] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[25] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[26] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[27] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[28] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[29] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[30] = R4300iOp::UnknownOpcode; - Jump_CoP1_BC[31] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[ 0] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[ 1] = R4300iOp::COP0_CO_TLBR; + Jump_CoP0_Function[ 2] = R4300iOp::COP0_CO_TLBWI; + Jump_CoP0_Function[ 3] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[ 4] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[ 5] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[ 6] = R4300iOp::COP0_CO_TLBWR; + Jump_CoP0_Function[ 7] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[ 8] = R4300iOp::COP0_CO_TLBP; + Jump_CoP0_Function[ 9] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[10] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[11] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[12] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[13] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[14] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[15] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[16] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[17] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[18] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[19] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[20] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[21] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[22] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[23] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[24] = R4300iOp::COP0_CO_ERET; + Jump_CoP0_Function[25] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[26] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[27] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[28] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[29] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[30] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[31] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[32] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[33] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[34] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[35] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[36] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[37] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[38] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[39] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[40] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[41] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[42] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[43] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[44] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[45] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[46] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[47] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[48] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[49] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[50] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[51] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[52] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[53] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[54] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[55] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[56] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[57] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[58] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[59] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[60] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[61] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[62] = R4300iOp::UnknownOpcode; + Jump_CoP0_Function[63] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[ 0] = R4300iOp::COP1_S_ADD; - Jump_CoP1_S[ 1] = R4300iOp::COP1_S_SUB; - Jump_CoP1_S[ 2] = R4300iOp::COP1_S_MUL; - Jump_CoP1_S[ 3] = R4300iOp::COP1_S_DIV; - Jump_CoP1_S[ 4] = R4300iOp::COP1_S_SQRT; - 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[ 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 - Jump_CoP1_S[12] = R4300iOp::COP1_S_ROUND_W; - Jump_CoP1_S[13] = R4300iOp::COP1_S_TRUNC_W; - Jump_CoP1_S[14] = R4300iOp::COP1_S_CEIL_W; //added by Witten - Jump_CoP1_S[15] = R4300iOp::COP1_S_FLOOR_W; - Jump_CoP1_S[16] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[17] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[18] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[19] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[20] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[21] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[22] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[23] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[24] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[25] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[26] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[27] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[28] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[29] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[30] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[31] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[32] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[33] = R4300iOp::COP1_S_CVT_D; - Jump_CoP1_S[34] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[35] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[36] = R4300iOp::COP1_S_CVT_W; - Jump_CoP1_S[37] = R4300iOp::COP1_S_CVT_L; - Jump_CoP1_S[38] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[39] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[40] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[41] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[42] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[43] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[44] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[45] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[46] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[47] = R4300iOp::UnknownOpcode; - Jump_CoP1_S[48] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[49] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[50] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[51] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[52] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[53] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[54] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[55] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[56] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[57] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[58] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[59] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[60] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[61] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[62] = R4300iOp::COP1_S_CMP; - Jump_CoP1_S[63] = R4300iOp::COP1_S_CMP; + Jump_CoP1[ 0] = COP1_MF; + Jump_CoP1[ 1] = R4300iOp::COP1_DMF; + Jump_CoP1[ 2] = COP1_CF; + Jump_CoP1[ 3] = R4300iOp::UnknownOpcode; + Jump_CoP1[ 4] = R4300iOp::COP1_MT; + Jump_CoP1[ 5] = COP1_DMT; + Jump_CoP1[ 6] = R4300iOp::COP1_CT; + Jump_CoP1[ 7] = R4300iOp::UnknownOpcode; + Jump_CoP1[ 8] = R4300iOp::COP1_BC; + Jump_CoP1[ 9] = R4300iOp::UnknownOpcode; + Jump_CoP1[10] = R4300iOp::UnknownOpcode; + Jump_CoP1[11] = R4300iOp::UnknownOpcode; + Jump_CoP1[12] = R4300iOp::UnknownOpcode; + Jump_CoP1[13] = R4300iOp::UnknownOpcode; + Jump_CoP1[14] = R4300iOp::UnknownOpcode; + Jump_CoP1[15] = R4300iOp::UnknownOpcode; + Jump_CoP1[16] = R4300iOp::COP1_S; + Jump_CoP1[17] = R4300iOp::COP1_D; + Jump_CoP1[18] = R4300iOp::UnknownOpcode; + Jump_CoP1[19] = R4300iOp::UnknownOpcode; + Jump_CoP1[20] = R4300iOp::COP1_W; + Jump_CoP1[21] = R4300iOp::COP1_L; + Jump_CoP1[22] = R4300iOp::UnknownOpcode; + Jump_CoP1[23] = R4300iOp::UnknownOpcode; + Jump_CoP1[24] = R4300iOp::UnknownOpcode; + Jump_CoP1[25] = R4300iOp::UnknownOpcode; + Jump_CoP1[26] = R4300iOp::UnknownOpcode; + Jump_CoP1[27] = R4300iOp::UnknownOpcode; + Jump_CoP1[28] = R4300iOp::UnknownOpcode; + Jump_CoP1[29] = R4300iOp::UnknownOpcode; + Jump_CoP1[30] = R4300iOp::UnknownOpcode; + Jump_CoP1[31] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[ 0] = R4300iOp::COP1_D_ADD; - Jump_CoP1_D[ 1] = R4300iOp::COP1_D_SUB; - Jump_CoP1_D[ 2] = R4300iOp::COP1_D_MUL; - Jump_CoP1_D[ 3] = R4300iOp::COP1_D_DIV; - Jump_CoP1_D[ 4] = R4300iOp::COP1_D_SQRT; - Jump_CoP1_D[ 5] = R4300iOp::COP1_D_ABS; - Jump_CoP1_D[ 6] = R4300iOp::COP1_D_MOV; - Jump_CoP1_D[ 7] = R4300iOp::COP1_D_NEG; - Jump_CoP1_D[ 8] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[ 9] = R4300iOp::COP1_D_TRUNC_L; //added by Witten - Jump_CoP1_D[10] = R4300iOp::COP1_D_CEIL_L; //added by Witten - Jump_CoP1_D[11] = R4300iOp::COP1_D_FLOOR_L; //added by Witten - Jump_CoP1_D[12] = R4300iOp::COP1_D_ROUND_W; - Jump_CoP1_D[13] = R4300iOp::COP1_D_TRUNC_W; - Jump_CoP1_D[14] = R4300iOp::COP1_D_CEIL_W; //added by Witten - Jump_CoP1_D[15] = R4300iOp::COP1_D_FLOOR_W; //added by Witten - Jump_CoP1_D[16] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[17] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[18] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[19] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[20] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[21] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[22] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[23] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[24] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[25] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[26] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[27] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[28] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[29] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[30] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[31] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[32] = R4300iOp::COP1_D_CVT_S; - Jump_CoP1_D[33] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[34] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[35] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[36] = R4300iOp::COP1_D_CVT_W; - Jump_CoP1_D[37] = R4300iOp::COP1_D_CVT_L; - Jump_CoP1_D[38] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[39] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[40] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[41] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[42] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[43] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[44] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[45] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[46] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[47] = R4300iOp::UnknownOpcode; - Jump_CoP1_D[48] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[49] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[50] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[51] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[52] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[53] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[54] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[55] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[56] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[57] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[58] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[59] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[60] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[61] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[62] = R4300iOp::COP1_D_CMP; - Jump_CoP1_D[63] = R4300iOp::COP1_D_CMP; + Jump_CoP1_BC[ 0] = R4300iOp::COP1_BCF; + Jump_CoP1_BC[ 1] = R4300iOp::COP1_BCT; + Jump_CoP1_BC[ 2] = R4300iOp::COP1_BCFL; + Jump_CoP1_BC[ 3] = R4300iOp::COP1_BCTL; + Jump_CoP1_BC[ 4] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[ 5] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[ 6] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[ 7] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[ 8] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[ 9] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[10] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[11] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[12] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[13] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[14] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[15] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[16] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[17] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[18] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[19] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[20] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[21] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[22] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[23] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[24] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[25] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[26] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[27] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[28] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[29] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[30] = R4300iOp::UnknownOpcode; + Jump_CoP1_BC[31] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 0] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 1] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 2] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 3] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 4] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 5] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 6] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 7] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 8] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[ 9] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[10] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[11] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[12] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[13] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[14] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[15] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[16] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[17] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[18] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[19] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[20] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[21] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[22] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[23] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[24] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[25] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[26] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[27] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[28] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[29] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[30] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[31] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[32] = R4300iOp::COP1_W_CVT_S; - Jump_CoP1_W[33] = R4300iOp::COP1_W_CVT_D; - Jump_CoP1_W[34] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[35] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[36] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[37] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[38] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[39] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[40] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[41] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[42] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[43] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[44] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[45] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[46] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[47] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[48] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[49] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[50] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[51] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[52] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[53] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[54] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[55] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[56] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[57] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[58] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[59] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[60] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[61] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[62] = R4300iOp::UnknownOpcode; - Jump_CoP1_W[63] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[ 0] = R4300iOp::COP1_S_ADD; + Jump_CoP1_S[ 1] = R4300iOp::COP1_S_SUB; + Jump_CoP1_S[ 2] = R4300iOp::COP1_S_MUL; + Jump_CoP1_S[ 3] = R4300iOp::COP1_S_DIV; + Jump_CoP1_S[ 4] = R4300iOp::COP1_S_SQRT; + 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[ 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 + Jump_CoP1_S[12] = R4300iOp::COP1_S_ROUND_W; + Jump_CoP1_S[13] = R4300iOp::COP1_S_TRUNC_W; + Jump_CoP1_S[14] = R4300iOp::COP1_S_CEIL_W; //added by Witten + Jump_CoP1_S[15] = R4300iOp::COP1_S_FLOOR_W; + Jump_CoP1_S[16] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[17] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[18] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[19] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[20] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[21] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[22] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[23] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[24] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[25] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[26] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[27] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[28] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[29] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[30] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[31] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[32] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[33] = R4300iOp::COP1_S_CVT_D; + Jump_CoP1_S[34] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[35] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[36] = R4300iOp::COP1_S_CVT_W; + Jump_CoP1_S[37] = R4300iOp::COP1_S_CVT_L; + Jump_CoP1_S[38] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[39] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[40] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[41] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[42] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[43] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[44] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[45] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[46] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[47] = R4300iOp::UnknownOpcode; + Jump_CoP1_S[48] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[49] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[50] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[51] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[52] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[53] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[54] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[55] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[56] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[57] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[58] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[59] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[60] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[61] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[62] = R4300iOp::COP1_S_CMP; + Jump_CoP1_S[63] = R4300iOp::COP1_S_CMP; - Jump_CoP1_L[ 0] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[ 1] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[ 2] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[ 3] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[ 4] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[ 5] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[ 6] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[ 7] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[ 8] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[ 9] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[10] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[11] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[12] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[13] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[14] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[15] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[16] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[17] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[18] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[19] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[20] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[21] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[22] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[23] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[24] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[25] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[26] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[27] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[28] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[29] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[30] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[31] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[32] = R4300iOp::COP1_L_CVT_S; - Jump_CoP1_L[33] = R4300iOp::COP1_L_CVT_D; - Jump_CoP1_L[34] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[35] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[36] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[37] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[38] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[39] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[40] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[41] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[42] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[43] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[44] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[45] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[46] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[47] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[48] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[49] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[50] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[51] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[52] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[53] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[54] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[55] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[56] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[57] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[58] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[59] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[60] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[61] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[62] = R4300iOp::UnknownOpcode; - Jump_CoP1_L[63] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[ 0] = R4300iOp::COP1_D_ADD; + Jump_CoP1_D[ 1] = R4300iOp::COP1_D_SUB; + Jump_CoP1_D[ 2] = R4300iOp::COP1_D_MUL; + Jump_CoP1_D[ 3] = R4300iOp::COP1_D_DIV; + Jump_CoP1_D[ 4] = R4300iOp::COP1_D_SQRT; + Jump_CoP1_D[ 5] = R4300iOp::COP1_D_ABS; + Jump_CoP1_D[ 6] = R4300iOp::COP1_D_MOV; + Jump_CoP1_D[ 7] = R4300iOp::COP1_D_NEG; + Jump_CoP1_D[ 8] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[ 9] = R4300iOp::COP1_D_TRUNC_L; //added by Witten + Jump_CoP1_D[10] = R4300iOp::COP1_D_CEIL_L; //added by Witten + Jump_CoP1_D[11] = R4300iOp::COP1_D_FLOOR_L; //added by Witten + Jump_CoP1_D[12] = R4300iOp::COP1_D_ROUND_W; + Jump_CoP1_D[13] = R4300iOp::COP1_D_TRUNC_W; + Jump_CoP1_D[14] = R4300iOp::COP1_D_CEIL_W; //added by Witten + Jump_CoP1_D[15] = R4300iOp::COP1_D_FLOOR_W; //added by Witten + Jump_CoP1_D[16] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[17] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[18] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[19] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[20] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[21] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[22] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[23] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[24] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[25] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[26] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[27] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[28] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[29] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[30] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[31] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[32] = R4300iOp::COP1_D_CVT_S; + Jump_CoP1_D[33] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[34] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[35] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[36] = R4300iOp::COP1_D_CVT_W; + Jump_CoP1_D[37] = R4300iOp::COP1_D_CVT_L; + Jump_CoP1_D[38] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[39] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[40] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[41] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[42] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[43] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[44] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[45] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[46] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[47] = R4300iOp::UnknownOpcode; + Jump_CoP1_D[48] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[49] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[50] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[51] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[52] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[53] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[54] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[55] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[56] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[57] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[58] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[59] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[60] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[61] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[62] = R4300iOp::COP1_D_CMP; + Jump_CoP1_D[63] = R4300iOp::COP1_D_CMP; - return Jump_Opcode; + Jump_CoP1_W[ 0] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[ 1] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[ 2] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[ 3] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[ 4] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[ 5] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[ 6] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[ 7] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[ 8] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[ 9] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[10] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[11] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[12] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[13] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[14] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[15] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[16] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[17] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[18] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[19] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[20] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[21] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[22] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[23] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[24] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[25] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[26] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[27] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[28] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[29] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[30] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[31] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[32] = R4300iOp::COP1_W_CVT_S; + Jump_CoP1_W[33] = R4300iOp::COP1_W_CVT_D; + Jump_CoP1_W[34] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[35] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[36] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[37] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[38] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[39] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[40] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[41] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[42] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[43] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[44] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[45] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[46] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[47] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[48] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[49] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[50] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[51] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[52] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[53] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[54] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[55] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[56] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[57] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[58] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[59] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[60] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[61] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[62] = R4300iOp::UnknownOpcode; + Jump_CoP1_W[63] = R4300iOp::UnknownOpcode; + + Jump_CoP1_L[ 0] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[ 1] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[ 2] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[ 3] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[ 4] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[ 5] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[ 6] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[ 7] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[ 8] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[ 9] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[10] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[11] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[12] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[13] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[14] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[15] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[16] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[17] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[18] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[19] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[20] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[21] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[22] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[23] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[24] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[25] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[26] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[27] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[28] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[29] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[30] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[31] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[32] = R4300iOp::COP1_L_CVT_S; + Jump_CoP1_L[33] = R4300iOp::COP1_L_CVT_D; + Jump_CoP1_L[34] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[35] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[36] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[37] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[38] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[39] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[40] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[41] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[42] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[43] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[44] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[45] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[46] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[47] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[48] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[49] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[50] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[51] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[52] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[53] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[54] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[55] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[56] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[57] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[58] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[59] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[60] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[61] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[62] = R4300iOp::UnknownOpcode; + Jump_CoP1_L[63] = R4300iOp::UnknownOpcode; + + return Jump_Opcode; } - /************************* Opcode functions *************************/ void R4300iOp32::JAL() { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = ((*_PROGRAM_COUNTER) & 0xF0000000) + (m_Opcode.target << 2); - _GPR[31].UW[0] = (*_PROGRAM_COUNTER) + 8; + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = ((*_PROGRAM_COUNTER) & 0xF0000000) + (m_Opcode.target << 2); + _GPR[31].UW[0] = (*_PROGRAM_COUNTER) + 8; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } } void R4300iOp32::BEQ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0]) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0]) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::BNE() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].W[0] != _GPR[m_Opcode.rt].W[0]) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].W[0] != _GPR[m_Opcode.rt].W[0]) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::BLEZ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].W[0] <= 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].W[0] <= 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::BGTZ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].W[0] > 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].W[0] > 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::ADDI() { #ifdef Interpreter_StackTest - if (m_Opcode.rs == 29 && m_Opcode.rt == 29) - { - StackValue += (short)m_Opcode.immediate; - } + if (m_Opcode.rs == 29 && m_Opcode.rt == 29) + { + StackValue += (int16_t)m_Opcode.immediate; + } #endif - _GPR[m_Opcode.rt].W[0] = (_GPR[m_Opcode.rs].W[0] + ((short)m_Opcode.immediate)); + _GPR[m_Opcode.rt].W[0] = (_GPR[m_Opcode.rs].W[0] + ((int16_t)m_Opcode.immediate)); #ifdef Interpreter_StackTest - if (m_Opcode.rt == 29 && m_Opcode.rs != 29) - { - StackValue = _GPR[m_Opcode.rt].W[0]; - } + if (m_Opcode.rt == 29 && m_Opcode.rs != 29) + { + StackValue = _GPR[m_Opcode.rt].W[0]; + } #endif } void R4300iOp32::ADDIU() { #ifdef Interpreter_StackTest - if (m_Opcode.rs == 29 && m_Opcode.rt == 29) - { - StackValue += (short)m_Opcode.immediate; - } + if (m_Opcode.rs == 29 && m_Opcode.rt == 29) + { + StackValue += (int16_t)m_Opcode.immediate; + } #endif - _GPR[m_Opcode.rt].W[0] = (_GPR[m_Opcode.rs].W[0] + ((short)m_Opcode.immediate)); + _GPR[m_Opcode.rt].W[0] = (_GPR[m_Opcode.rs].W[0] + ((int16_t)m_Opcode.immediate)); #ifdef Interpreter_StackTest - if (m_Opcode.rt == 29 && m_Opcode.rs != 29) - { - StackValue = _GPR[m_Opcode.rt].W[0]; - } + if (m_Opcode.rt == 29 && m_Opcode.rs != 29) + { + StackValue = _GPR[m_Opcode.rt].W[0]; + } #endif } void R4300iOp32::SLTI() { - if (_GPR[m_Opcode.rs].W[0] < (__int64)((short)m_Opcode.immediate)) - { - _GPR[m_Opcode.rt].W[0] = 1; - } - else - { - _GPR[m_Opcode.rt].W[0] = 0; - } + if (_GPR[m_Opcode.rs].W[0] < (int64_t)((int16_t)m_Opcode.immediate)) + { + _GPR[m_Opcode.rt].W[0] = 1; + } + else + { + _GPR[m_Opcode.rt].W[0] = 0; + } } void R4300iOp32::SLTIU() { - int imm32 = (short)m_Opcode.immediate; - __int64 imm64; + int32_t imm32 = (int16_t)m_Opcode.immediate; + int64_t imm64; - imm64 = imm32; - _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].UW[0] < (unsigned __int64)imm64?1:0; + imm64 = imm32; + _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].UW[0] < (uint64_t)imm64?1:0; } void R4300iOp32::ANDI() { - _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].W[0] & m_Opcode.immediate; + _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].W[0] & m_Opcode.immediate; } void R4300iOp32::ORI() { - _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].W[0] | m_Opcode.immediate; + _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].W[0] | m_Opcode.immediate; } void R4300iOp32::XORI() { - _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].W[0] ^ m_Opcode.immediate; + _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].W[0] ^ m_Opcode.immediate; } void R4300iOp32::LUI() { - _GPR[m_Opcode.rt].W[0] = (long)((short)m_Opcode.offset << 16); + _GPR[m_Opcode.rt].W[0] = (int32_t)((int16_t)m_Opcode.offset << 16); #ifdef Interpreter_StackTest - if (m_Opcode.rt == 29) - { - StackValue = _GPR[m_Opcode.rt].W[0]; - } + if (m_Opcode.rt == 29) + { + StackValue = _GPR[m_Opcode.rt].W[0]; + } #endif } void R4300iOp32::BEQL() { - if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0]) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0]) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::BNEL() { - if (_GPR[m_Opcode.rs].W[0] != _GPR[m_Opcode.rt].W[0]) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].W[0] != _GPR[m_Opcode.rt].W[0]) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::BLEZL() { - if (_GPR[m_Opcode.rs].W[0] <= 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].W[0] <= 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::BGTZL() { - if (_GPR[m_Opcode.rs].W[0] > 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].W[0] > 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::LB() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rt].B[0]; - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rt].B[0]; + } } void R4300iOp32::LH() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 1) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } - if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rt].HW[0]; - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 1) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } + if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rt].HW[0]; + } } void R4300iOp32::LWL() { - DWORD Offset, Address, Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 3; + uint32_t Offset, Address, Value; - if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value)) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - return; - } - - _GPR[m_Opcode.rt].W[0] = (int)(_GPR[m_Opcode.rt].W[0] & LWL_MASK[Offset]); - _GPR[m_Opcode.rt].W[0] += (int)(Value << LWL_SHIFT[Offset]); + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 3; + + if (!g_MMU->LW_VAddr((Address & ~3),Value)) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + return; + } + + _GPR[m_Opcode.rt].W[0] = (int32_t)(_GPR[m_Opcode.rt].W[0] & LWL_MASK[Offset]); + _GPR[m_Opcode.rt].W[0] += (int32_t)(Value << LWL_SHIFT[Offset]); } void R4300iOp32::LW() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } - if (g_LogOptions.GenerateLog) - { - Log_LW((*_PROGRAM_COUNTER),Address); - } + if (g_LogOptions.GenerateLog) + { + Log_LW((*_PROGRAM_COUNTER),Address); + } - if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rt].W[0]; - } + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rt].W[0]; + } } void R4300iOp32::LBU() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].UW[0] = _GPR[m_Opcode.rt].UB[0]; - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].UW[0] = _GPR[m_Opcode.rt].UB[0]; + } } void R4300iOp32::LHU() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 1) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } - if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].UW[0] = _GPR[m_Opcode.rt].UHW[0]; - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 1) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } + if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].UW[0] = _GPR[m_Opcode.rt].UHW[0]; + } } void R4300iOp32::LWR() { - DWORD Offset, Address, Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 3; + uint32_t Offset, Address, Value; - if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value)) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } - - _GPR[m_Opcode.rt].W[0] = (int)(_GPR[m_Opcode.rt].W[0] & LWR_MASK[Offset]); - _GPR[m_Opcode.rt].W[0] += (int)(Value >> LWR_SHIFT[Offset]); + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 3; + + if (!g_MMU->LW_VAddr((Address & ~3),Value)) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } + + _GPR[m_Opcode.rt].W[0] = (int32_t)(_GPR[m_Opcode.rt].W[0] & LWR_MASK[Offset]); + _GPR[m_Opcode.rt].W[0] += (int32_t)(Value >> LWR_SHIFT[Offset]); } void R4300iOp32::LWU() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } - if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].UW[0] = _GPR[m_Opcode.rt].UW[0]; - } + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].UW[0] = _GPR[m_Opcode.rt].UW[0]; + } } - void R4300iOp32::LL() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } - if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rt].W[0]; - (*_LLBit) = 1; - } + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rt].W[0]; + (*_LLBit) = 1; + } } /********************** R4300i OpCodes: Special **********************/ void R4300iOp32::SPECIAL_SLL() { - _GPR[m_Opcode.rd].W[0] = (_GPR[m_Opcode.rt].W[0] << m_Opcode.sa); + _GPR[m_Opcode.rd].W[0] = (_GPR[m_Opcode.rt].W[0] << m_Opcode.sa); } void R4300iOp32::SPECIAL_SRL() { - _GPR[m_Opcode.rd].W[0] = (int)(_GPR[m_Opcode.rt].UW[0] >> m_Opcode.sa); + _GPR[m_Opcode.rd].W[0] = (int32_t)(_GPR[m_Opcode.rt].UW[0] >> m_Opcode.sa); } void R4300iOp32::SPECIAL_SRA() { - _GPR[m_Opcode.rd].W[0] = (_GPR[m_Opcode.rt].W[0] >> m_Opcode.sa); + _GPR[m_Opcode.rd].W[0] = (_GPR[m_Opcode.rt].W[0] >> m_Opcode.sa); } void R4300iOp32::SPECIAL_SLLV() { - _GPR[m_Opcode.rd].W[0] = (_GPR[m_Opcode.rt].W[0] << (_GPR[m_Opcode.rs].UW[0] & 0x1F)); + _GPR[m_Opcode.rd].W[0] = (_GPR[m_Opcode.rt].W[0] << (_GPR[m_Opcode.rs].UW[0] & 0x1F)); } void R4300iOp32::SPECIAL_SRLV() { - _GPR[m_Opcode.rd].W[0] = (int)(_GPR[m_Opcode.rt].UW[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F)); + _GPR[m_Opcode.rd].W[0] = (int32_t)(_GPR[m_Opcode.rt].UW[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F)); } void R4300iOp32::SPECIAL_SRAV() { - _GPR[m_Opcode.rd].W[0] = (_GPR[m_Opcode.rt].W[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F)); + _GPR[m_Opcode.rd].W[0] = (_GPR[m_Opcode.rt].W[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F)); } void R4300iOp32::SPECIAL_JALR() { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = _GPR[m_Opcode.rs].UW[0]; - _GPR[m_Opcode.rd].W[0] = (long)((*_PROGRAM_COUNTER) + 8); - m_TestTimer = true; + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = _GPR[m_Opcode.rs].UW[0]; + _GPR[m_Opcode.rd].W[0] = (int32_t)((*_PROGRAM_COUNTER) + 8); + m_TestTimer = true; } void R4300iOp32::SPECIAL_ADD() { - _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] + _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] + _GPR[m_Opcode.rt].W[0]; } void R4300iOp32::SPECIAL_ADDU() { - _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] + _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] + _GPR[m_Opcode.rt].W[0]; } void R4300iOp32::SPECIAL_SUB() { - _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] - _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] - _GPR[m_Opcode.rt].W[0]; } void R4300iOp32::SPECIAL_SUBU() { - _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] - _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] - _GPR[m_Opcode.rt].W[0]; } void R4300iOp32::SPECIAL_AND() { - _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] & _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] & _GPR[m_Opcode.rt].W[0]; } void R4300iOp32::SPECIAL_OR() { - _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] | _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].W[0] = _GPR[m_Opcode.rs].W[0] | _GPR[m_Opcode.rt].W[0]; #ifdef Interpreter_StackTest - if (m_Opcode.rd == 29) - { - StackValue = _GPR[m_Opcode.rd].W[0]; - } + if (m_Opcode.rd == 29) + { + StackValue = _GPR[m_Opcode.rd].W[0]; + } #endif } void R4300iOp32::SPECIAL_NOR() { - _GPR[m_Opcode.rd].W[0] = ~(_GPR[m_Opcode.rs].W[0] | _GPR[m_Opcode.rt].W[0]); + _GPR[m_Opcode.rd].W[0] = ~(_GPR[m_Opcode.rs].W[0] | _GPR[m_Opcode.rt].W[0]); } void R4300iOp32::SPECIAL_SLT() { - if (_GPR[m_Opcode.rs].W[0] < _GPR[m_Opcode.rt].W[0]) - { - _GPR[m_Opcode.rd].W[0] = 1; - } - else - { - _GPR[m_Opcode.rd].W[0] = 0; - } + if (_GPR[m_Opcode.rs].W[0] < _GPR[m_Opcode.rt].W[0]) + { + _GPR[m_Opcode.rd].W[0] = 1; + } + else + { + _GPR[m_Opcode.rd].W[0] = 0; + } } void R4300iOp32::SPECIAL_SLTU() { - if (_GPR[m_Opcode.rs].UW[0] < _GPR[m_Opcode.rt].UW[0]) - { - _GPR[m_Opcode.rd].W[0] = 1; - } - else - { - _GPR[m_Opcode.rd].W[0] = 0; - } + if (_GPR[m_Opcode.rs].UW[0] < _GPR[m_Opcode.rt].UW[0]) + { + _GPR[m_Opcode.rd].W[0] = 1; + } + else + { + _GPR[m_Opcode.rd].W[0] = 0; + } } void R4300iOp32::SPECIAL_TEQ() { - if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0] && g_Settings->LoadBool(Debugger_Enabled)) - { - g_Notify->DisplayError(L"Should trap this ???"); - } + if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0] && g_Settings->LoadBool(Debugger_Enabled)) + { + g_Notify->DisplayError(L"Should trap this ???"); + } } -void R4300iOp32::SPECIAL_DSRL32() +void R4300iOp32::SPECIAL_DSRL32() { - _GPR[m_Opcode.rd].UW[0] = (DWORD)(_GPR[m_Opcode.rt].UDW >> (m_Opcode.sa + 32)); + _GPR[m_Opcode.rd].UW[0] = (uint32_t)(_GPR[m_Opcode.rt].UDW >> (m_Opcode.sa + 32)); } -void R4300iOp32::SPECIAL_DSRA32() +void R4300iOp32::SPECIAL_DSRA32() { - _GPR[m_Opcode.rd].W[0] = (long)(_GPR[m_Opcode.rt].DW >> (m_Opcode.sa + 32)); + _GPR[m_Opcode.rd].W[0] = (int32_t)(_GPR[m_Opcode.rt].DW >> (m_Opcode.sa + 32)); } /********************** R4300i OpCodes: RegImm **********************/ void R4300iOp32::REGIMM_BLTZ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].W[0] < 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].W[0] < 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::REGIMM_BGEZ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].W[0] >= 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].W[0] >= 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::REGIMM_BLTZL() { - if (_GPR[m_Opcode.rs].W[0] < 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].W[0] < 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::REGIMM_BGEZL() { - if (_GPR[m_Opcode.rs].W[0] >= 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].W[0] >= 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp32::REGIMM_BLTZAL() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].W[0] < 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } - _GPR[31].W[0]= (long)((*_PROGRAM_COUNTER) + 8); + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].W[0] < 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } + _GPR[31].W[0]= (int32_t)((*_PROGRAM_COUNTER) + 8); } void R4300iOp32::REGIMM_BGEZAL() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].W[0] >= 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } - _GPR[31].W[0] = (long)((*_PROGRAM_COUNTER) + 8); + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].W[0] >= 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } + _GPR[31].W[0] = (int32_t)((*_PROGRAM_COUNTER) + 8); } -/************************** COP0 functions **************************/ -void R4300iOp32::COP0_MF() { - if (g_LogOptions.LogCP0reads) - { - LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]); - } - if (m_Opcode.rd == 9) - { - g_SystemTimer->UpdateTimers(); - } - _GPR[m_Opcode.rt].W[0] = (int)_CP0[m_Opcode.rd]; +/************************** COP0 functions **************************/ +void R4300iOp32::COP0_MF() +{ + if (g_LogOptions.LogCP0reads) + { + LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]); + } + + if (m_Opcode.rd == 9) + { + g_SystemTimer->UpdateTimers(); + } + _GPR[m_Opcode.rt].W[0] = (int32_t)_CP0[m_Opcode.rd]; } void R4300iOp32::COP0_MT() { - if (g_LogOptions.LogCP0changes) - { - LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)",(*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0],CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]); - if (m_Opcode.rd == 11) //Compare - { - LogMessage("%08X: Cause register changed from %08X to %08X",(*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7)); - } - } + if (g_LogOptions.LogCP0changes) + { + LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)",(*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0],CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]); + if (m_Opcode.rd == 11) //Compare + { + LogMessage("%08X: Cause register changed from %08X to %08X",(*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7)); + } + } - switch (m_Opcode.rd) - { - case 0: //Index - case 2: //EntryLo0 - case 3: //EntryLo1 - case 5: //PageMask - case 10: //Entry Hi - case 14: //EPC - case 16: //Config - case 18: //WatchLo - case 19: //WatchHi - case 28: //Tag lo - case 29: //Tag Hi - case 30: //ErrEPC - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - break; - case 6: //Wired - g_SystemTimer->UpdateTimers(); - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - break; - case 4: //Context - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0] & 0xFF800000; - break; - case 9: //Count - g_SystemTimer->UpdateTimers(); - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - g_SystemTimer->UpdateCompareTimer(); - break; - case 11: //Compare - g_SystemTimer->UpdateTimers(); - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7; - g_SystemTimer->UpdateCompareTimer(); - break; - case 12: //Status - if ((_CP0[m_Opcode.rd] & STATUS_FR) != (_GPR[m_Opcode.rt].UW[0] & STATUS_FR)) - { - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - g_Reg->FixFpuLocations(); - } - else - { - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - } - if ((_CP0[m_Opcode.rd] & 0x18) != 0 && g_Settings->LoadBool(Debugger_Enabled)) - { - g_Notify->DisplayError(L"Left kernel mode ??"); - } - g_Reg->CheckInterrupts(); - break; - case 13: //cause - _CP0[m_Opcode.rd] &= 0xFFFFCFF; - if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && g_Settings->LoadBool(Debugger_Enabled) ) - { - g_Notify->DisplayError(L"Set IP0 or IP1"); - } - break; - default: - UnknownOpcode(); - } + switch (m_Opcode.rd) + { + case 0: //Index + case 2: //EntryLo0 + case 3: //EntryLo1 + case 5: //PageMask + case 10: //Entry Hi + case 14: //EPC + case 16: //Config + case 18: //WatchLo + case 19: //WatchHi + case 28: //Tag lo + case 29: //Tag Hi + case 30: //ErrEPC + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + break; + case 6: //Wired + g_SystemTimer->UpdateTimers(); + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + break; + case 4: //Context + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0] & 0xFF800000; + break; + case 9: //Count + g_SystemTimer->UpdateTimers(); + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + g_SystemTimer->UpdateCompareTimer(); + break; + case 11: //Compare + g_SystemTimer->UpdateTimers(); + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7; + g_SystemTimer->UpdateCompareTimer(); + break; + case 12: //Status + if ((_CP0[m_Opcode.rd] & STATUS_FR) != (_GPR[m_Opcode.rt].UW[0] & STATUS_FR)) + { + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + g_Reg->FixFpuLocations(); + } + else + { + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + } + if ((_CP0[m_Opcode.rd] & 0x18) != 0 && g_Settings->LoadBool(Debugger_Enabled)) + { + g_Notify->DisplayError(L"Left kernel mode ??"); + } + g_Reg->CheckInterrupts(); + break; + case 13: //cause + _CP0[m_Opcode.rd] &= 0xFFFFCFF; + if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && g_Settings->LoadBool(Debugger_Enabled) ) + { + g_Notify->DisplayError(L"Set IP0 or IP1"); + } + break; + default: + UnknownOpcode(); + } } /************************** COP1 functions **************************/ void R4300iOp32::COP1_MF() { - TEST_COP1_USABLE_EXCEPTION - _GPR[m_Opcode.rt].W[0] = *(int *)_FPR_S[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _GPR[m_Opcode.rt].W[0] = *(int32_t *)_FPR_S[m_Opcode.fs]; } void R4300iOp32::COP1_CF() { - TEST_COP1_USABLE_EXCEPTION - if (m_Opcode.fs != 31 && m_Opcode.fs != 0) - { - if (g_Settings->LoadBool(Debugger_Enabled)) { g_Notify->DisplayError(L"CFC1 what register are you writing to ?"); } - return; - } - _GPR[m_Opcode.rt].W[0] = (int)_FPCR[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + if (m_Opcode.fs != 31 && m_Opcode.fs != 0) + { + if (g_Settings->LoadBool(Debugger_Enabled)) { g_Notify->DisplayError(L"CFC1 what register are you writing to ?"); } + return; + } + _GPR[m_Opcode.rt].W[0] = (int32_t)_FPCR[m_Opcode.fs]; } void R4300iOp32::COP1_DMT() { - TEST_COP1_USABLE_EXCEPTION - *(__int64 *)_FPR_D[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0]; + TEST_COP1_USABLE_EXCEPTION + *(int64_t *)_FPR_D[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0]; } diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp index be46680a5..250893e37 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp @@ -11,12 +11,12 @@ #include "stdafx.h" void InPermLoop(); -void TestInterpreterJump(DWORD PC, DWORD TargetPC, int Reg1, int Reg2); +void TestInterpreterJump(uint32_t PC, uint32_t TargetPC, int32_t Reg1, int32_t Reg2); bool R4300iOp::m_TestTimer = false; -DWORD R4300iOp::m_NextInstruction; +uint32_t R4300iOp::m_NextInstruction; OPCODE R4300iOp::m_Opcode; -DWORD R4300iOp::m_JumpToLocation; +uint32_t R4300iOp::m_JumpToLocation; R4300iOp::Func R4300iOp::Jump_Opcode[64]; R4300iOp::Func R4300iOp::Jump_Special[64]; @@ -30,2338 +30,2332 @@ R4300iOp::Func R4300iOp::Jump_CoP1_D[64]; R4300iOp::Func R4300iOp::Jump_CoP1_W[64]; R4300iOp::Func R4300iOp::Jump_CoP1_L[64]; -const DWORD R4300iOp::SWL_MASK[4] = { 0x00000000, 0xFF000000,0xFFFF0000,0xFFFFFF00 }; -const DWORD R4300iOp::SWR_MASK[4] = { 0x00FFFFFF, 0x0000FFFF,0x000000FF,0x00000000 }; -const DWORD R4300iOp::LWL_MASK[4] = { 0x00000000, 0x000000FF,0x0000FFFF,0x00FFFFFF }; -const DWORD R4300iOp::LWR_MASK[4] = { 0xFFFFFF00, 0xFFFF0000,0xFF000000,0x0000000 }; +const uint32_t R4300iOp::SWL_MASK[4] = { 0x00000000, 0xFF000000,0xFFFF0000,0xFFFFFF00 }; +const uint32_t R4300iOp::SWR_MASK[4] = { 0x00FFFFFF, 0x0000FFFF,0x000000FF,0x00000000 }; +const uint32_t R4300iOp::LWL_MASK[4] = { 0x00000000, 0x000000FF,0x0000FFFF,0x00FFFFFF }; +const uint32_t R4300iOp::LWR_MASK[4] = { 0xFFFFFF00, 0xFFFF0000,0xFF000000,0x0000000 }; -const int R4300iOp::SWL_SHIFT[4] = { 0, 8, 16, 24 }; -const int R4300iOp::SWR_SHIFT[4] = { 24, 16 , 8, 0 }; -const int R4300iOp::LWL_SHIFT[4] = { 0, 8, 16, 24}; -const int R4300iOp::LWR_SHIFT[4] = { 24, 16 ,8, 0 }; +const int32_t R4300iOp::SWL_SHIFT[4] = { 0, 8, 16, 24 }; +const int32_t R4300iOp::SWR_SHIFT[4] = { 24, 16 , 8, 0 }; +const int32_t R4300iOp::LWL_SHIFT[4] = { 0, 8, 16, 24}; +const int32_t R4300iOp::LWR_SHIFT[4] = { 24, 16 ,8, 0 }; #define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \ - g_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\ - m_NextInstruction = JUMP;\ - m_JumpToLocation = (*_PROGRAM_COUNTER);\ - return; + g_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\ + m_NextInstruction = JUMP;\ + m_JumpToLocation = (*_PROGRAM_COUNTER);\ + return; //#define TEST_COP1_USABLE_EXCEPTION #define TEST_COP1_USABLE_EXCEPTION \ - if ((g_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\ - g_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\ - m_NextInstruction = JUMP;\ - m_JumpToLocation = (*_PROGRAM_COUNTER);\ - return;\ - } + if ((g_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\ + g_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\ + m_NextInstruction = JUMP;\ + m_JumpToLocation = (*_PROGRAM_COUNTER);\ + return;\ + } #define TLB_READ_EXCEPTION(Address) \ - g_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\ - m_NextInstruction = JUMP;\ - m_JumpToLocation = (*_PROGRAM_COUNTER);\ - return; + g_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\ + m_NextInstruction = JUMP;\ + m_JumpToLocation = (*_PROGRAM_COUNTER);\ + return; void R4300iOp::SPECIAL() { - Jump_Special[ m_Opcode.funct ](); + Jump_Special[ m_Opcode.funct ](); } void R4300iOp::REGIMM() { - Jump_Regimm[ m_Opcode.rt ](); + Jump_Regimm[ m_Opcode.rt ](); } void R4300iOp::COP0() { - Jump_CoP0[ m_Opcode.rs ](); + Jump_CoP0[ m_Opcode.rs ](); } void R4300iOp::COP0_CO() { - Jump_CoP0_Function[ m_Opcode.funct ](); + Jump_CoP0_Function[ m_Opcode.funct ](); } void R4300iOp::COP1() { - Jump_CoP1[ m_Opcode.fmt ](); + Jump_CoP1[ m_Opcode.fmt ](); } void R4300iOp::COP1_BC() { - Jump_CoP1_BC[ m_Opcode.ft ](); + Jump_CoP1_BC[ m_Opcode.ft ](); } void R4300iOp::COP1_S() { - _controlfp(*_RoundingModel,_MCW_RC); - Jump_CoP1_S[ m_Opcode.funct ](); + _controlfp(*_RoundingModel,_MCW_RC); + Jump_CoP1_S[ m_Opcode.funct ](); } void R4300iOp::COP1_D() { - _controlfp(*_RoundingModel,_MCW_RC); - Jump_CoP1_D[ m_Opcode.funct ](); + _controlfp(*_RoundingModel,_MCW_RC); + Jump_CoP1_D[ m_Opcode.funct ](); } void R4300iOp::COP1_W() { - Jump_CoP1_W[ m_Opcode.funct ](); + Jump_CoP1_W[ m_Opcode.funct ](); } void R4300iOp::COP1_L() { - Jump_CoP1_L[ m_Opcode.funct ](); + Jump_CoP1_L[ m_Opcode.funct ](); } R4300iOp::Func * R4300iOp::BuildInterpreter() -{ - Jump_Opcode[ 0] = SPECIAL; - Jump_Opcode[ 1] = REGIMM; - Jump_Opcode[ 2] = J; - Jump_Opcode[ 3] = JAL; - Jump_Opcode[ 4] = BEQ; - Jump_Opcode[ 5] = BNE; - Jump_Opcode[ 6] = BLEZ; - Jump_Opcode[ 7] = BGTZ; - Jump_Opcode[ 8] = ADDI; - Jump_Opcode[ 9] = ADDIU; - Jump_Opcode[10] = SLTI; - Jump_Opcode[11] = SLTIU; - Jump_Opcode[12] = ANDI; - Jump_Opcode[13] = ORI; - Jump_Opcode[14] = XORI; - Jump_Opcode[15] = LUI; - Jump_Opcode[16] = COP0; - Jump_Opcode[17] = COP1; - Jump_Opcode[18] = UnknownOpcode; - Jump_Opcode[19] = UnknownOpcode; - Jump_Opcode[20] = BEQL; - Jump_Opcode[21] = BNEL; - Jump_Opcode[22] = BLEZL; - Jump_Opcode[23] = BGTZL; - Jump_Opcode[24] = UnknownOpcode; - Jump_Opcode[25] = DADDIU; - Jump_Opcode[26] = LDL; - Jump_Opcode[27] = LDR; - Jump_Opcode[28] = UnknownOpcode; - Jump_Opcode[29] = UnknownOpcode; - Jump_Opcode[30] = UnknownOpcode; - Jump_Opcode[31] = UnknownOpcode; - Jump_Opcode[32] = LB; - Jump_Opcode[33] = LH; - Jump_Opcode[34] = LWL; - Jump_Opcode[35] = LW; - Jump_Opcode[36] = LBU; - Jump_Opcode[37] = LHU; - Jump_Opcode[38] = LWR; - Jump_Opcode[39] = LWU; - Jump_Opcode[40] = SB; - Jump_Opcode[41] = SH; - Jump_Opcode[42] = SWL; - Jump_Opcode[43] = SW; - Jump_Opcode[44] = SDL; - Jump_Opcode[45] = SDR; - Jump_Opcode[46] = SWR; - Jump_Opcode[47] = CACHE; - Jump_Opcode[48] = LL; - Jump_Opcode[49] = LWC1; - Jump_Opcode[50] = UnknownOpcode; - Jump_Opcode[51] = UnknownOpcode; - Jump_Opcode[52] = UnknownOpcode; - Jump_Opcode[53] = LDC1; - Jump_Opcode[54] = UnknownOpcode; - Jump_Opcode[55] = LD; - Jump_Opcode[56] = SC; - Jump_Opcode[57] = SWC1; - Jump_Opcode[58] = UnknownOpcode; - Jump_Opcode[59] = UnknownOpcode; - Jump_Opcode[60] = UnknownOpcode; - Jump_Opcode[61] = SDC1; - Jump_Opcode[62] = UnknownOpcode; - Jump_Opcode[63] = SD; +{ + Jump_Opcode[ 0] = SPECIAL; + Jump_Opcode[ 1] = REGIMM; + Jump_Opcode[ 2] = J; + Jump_Opcode[ 3] = JAL; + Jump_Opcode[ 4] = BEQ; + Jump_Opcode[ 5] = BNE; + Jump_Opcode[ 6] = BLEZ; + Jump_Opcode[ 7] = BGTZ; + Jump_Opcode[ 8] = ADDI; + Jump_Opcode[ 9] = ADDIU; + Jump_Opcode[10] = SLTI; + Jump_Opcode[11] = SLTIU; + Jump_Opcode[12] = ANDI; + Jump_Opcode[13] = ORI; + Jump_Opcode[14] = XORI; + Jump_Opcode[15] = LUI; + Jump_Opcode[16] = COP0; + Jump_Opcode[17] = COP1; + Jump_Opcode[18] = UnknownOpcode; + Jump_Opcode[19] = UnknownOpcode; + Jump_Opcode[20] = BEQL; + Jump_Opcode[21] = BNEL; + Jump_Opcode[22] = BLEZL; + Jump_Opcode[23] = BGTZL; + Jump_Opcode[24] = UnknownOpcode; + Jump_Opcode[25] = DADDIU; + Jump_Opcode[26] = LDL; + Jump_Opcode[27] = LDR; + Jump_Opcode[28] = UnknownOpcode; + Jump_Opcode[29] = UnknownOpcode; + Jump_Opcode[30] = UnknownOpcode; + Jump_Opcode[31] = UnknownOpcode; + Jump_Opcode[32] = LB; + Jump_Opcode[33] = LH; + Jump_Opcode[34] = LWL; + Jump_Opcode[35] = LW; + Jump_Opcode[36] = LBU; + Jump_Opcode[37] = LHU; + Jump_Opcode[38] = LWR; + Jump_Opcode[39] = LWU; + Jump_Opcode[40] = SB; + Jump_Opcode[41] = SH; + Jump_Opcode[42] = SWL; + Jump_Opcode[43] = SW; + Jump_Opcode[44] = SDL; + Jump_Opcode[45] = SDR; + Jump_Opcode[46] = SWR; + Jump_Opcode[47] = CACHE; + Jump_Opcode[48] = LL; + Jump_Opcode[49] = LWC1; + Jump_Opcode[50] = UnknownOpcode; + Jump_Opcode[51] = UnknownOpcode; + Jump_Opcode[52] = UnknownOpcode; + Jump_Opcode[53] = LDC1; + Jump_Opcode[54] = UnknownOpcode; + Jump_Opcode[55] = LD; + Jump_Opcode[56] = SC; + Jump_Opcode[57] = SWC1; + Jump_Opcode[58] = UnknownOpcode; + Jump_Opcode[59] = UnknownOpcode; + Jump_Opcode[60] = UnknownOpcode; + Jump_Opcode[61] = SDC1; + Jump_Opcode[62] = UnknownOpcode; + Jump_Opcode[63] = SD; - Jump_Special[ 0] = SPECIAL_SLL; - Jump_Special[ 1] = UnknownOpcode; - Jump_Special[ 2] = SPECIAL_SRL; - Jump_Special[ 3] = SPECIAL_SRA; - Jump_Special[ 4] = SPECIAL_SLLV; - Jump_Special[ 5] = UnknownOpcode; - Jump_Special[ 6] = SPECIAL_SRLV; - Jump_Special[ 7] = SPECIAL_SRAV; - Jump_Special[ 8] = SPECIAL_JR; - Jump_Special[ 9] = SPECIAL_JALR; - Jump_Special[10] = UnknownOpcode; - Jump_Special[11] = UnknownOpcode; - Jump_Special[12] = SPECIAL_SYSCALL; - Jump_Special[13] = UnknownOpcode; - Jump_Special[14] = UnknownOpcode; - Jump_Special[15] = SPECIAL_SYNC; - Jump_Special[16] = SPECIAL_MFHI; - Jump_Special[17] = SPECIAL_MTHI; - Jump_Special[18] = SPECIAL_MFLO; - Jump_Special[19] = SPECIAL_MTLO; - Jump_Special[20] = SPECIAL_DSLLV; - Jump_Special[21] = UnknownOpcode; - Jump_Special[22] = SPECIAL_DSRLV; - Jump_Special[23] = SPECIAL_DSRAV; - Jump_Special[24] = SPECIAL_MULT; - Jump_Special[25] = SPECIAL_MULTU; - Jump_Special[26] = SPECIAL_DIV; - Jump_Special[27] = SPECIAL_DIVU; - Jump_Special[28] = SPECIAL_DMULT; - Jump_Special[29] = SPECIAL_DMULTU; - Jump_Special[30] = SPECIAL_DDIV; - Jump_Special[31] = SPECIAL_DDIVU; - Jump_Special[32] = SPECIAL_ADD; - Jump_Special[33] = SPECIAL_ADDU; - Jump_Special[34] = SPECIAL_SUB; - Jump_Special[35] = SPECIAL_SUBU; - Jump_Special[36] = SPECIAL_AND; - Jump_Special[37] = SPECIAL_OR; - Jump_Special[38] = SPECIAL_XOR; - Jump_Special[39] = SPECIAL_NOR; - Jump_Special[40] = UnknownOpcode; - Jump_Special[41] = UnknownOpcode; - Jump_Special[42] = SPECIAL_SLT; - Jump_Special[43] = SPECIAL_SLTU; - Jump_Special[44] = SPECIAL_DADD; - Jump_Special[45] = SPECIAL_DADDU; - Jump_Special[46] = SPECIAL_DSUB; - Jump_Special[47] = SPECIAL_DSUBU; - Jump_Special[48] = UnknownOpcode; - Jump_Special[49] = UnknownOpcode; - Jump_Special[50] = UnknownOpcode; - Jump_Special[51] = UnknownOpcode; - Jump_Special[52] = SPECIAL_TEQ; - Jump_Special[53] = UnknownOpcode; - Jump_Special[54] = UnknownOpcode; - Jump_Special[55] = UnknownOpcode; - Jump_Special[56] = SPECIAL_DSLL; - Jump_Special[57] = UnknownOpcode; - Jump_Special[58] = SPECIAL_DSRL; - Jump_Special[59] = SPECIAL_DSRA; - Jump_Special[60] = SPECIAL_DSLL32; - Jump_Special[61] = UnknownOpcode; - Jump_Special[62] = SPECIAL_DSRL32; - Jump_Special[63] = SPECIAL_DSRA32; + Jump_Special[ 0] = SPECIAL_SLL; + Jump_Special[ 1] = UnknownOpcode; + Jump_Special[ 2] = SPECIAL_SRL; + Jump_Special[ 3] = SPECIAL_SRA; + Jump_Special[ 4] = SPECIAL_SLLV; + Jump_Special[ 5] = UnknownOpcode; + Jump_Special[ 6] = SPECIAL_SRLV; + Jump_Special[ 7] = SPECIAL_SRAV; + Jump_Special[ 8] = SPECIAL_JR; + Jump_Special[ 9] = SPECIAL_JALR; + Jump_Special[10] = UnknownOpcode; + Jump_Special[11] = UnknownOpcode; + Jump_Special[12] = SPECIAL_SYSCALL; + Jump_Special[13] = UnknownOpcode; + Jump_Special[14] = UnknownOpcode; + Jump_Special[15] = SPECIAL_SYNC; + Jump_Special[16] = SPECIAL_MFHI; + Jump_Special[17] = SPECIAL_MTHI; + Jump_Special[18] = SPECIAL_MFLO; + Jump_Special[19] = SPECIAL_MTLO; + Jump_Special[20] = SPECIAL_DSLLV; + Jump_Special[21] = UnknownOpcode; + Jump_Special[22] = SPECIAL_DSRLV; + Jump_Special[23] = SPECIAL_DSRAV; + Jump_Special[24] = SPECIAL_MULT; + Jump_Special[25] = SPECIAL_MULTU; + Jump_Special[26] = SPECIAL_DIV; + Jump_Special[27] = SPECIAL_DIVU; + Jump_Special[28] = SPECIAL_DMULT; + Jump_Special[29] = SPECIAL_DMULTU; + Jump_Special[30] = SPECIAL_DDIV; + Jump_Special[31] = SPECIAL_DDIVU; + Jump_Special[32] = SPECIAL_ADD; + Jump_Special[33] = SPECIAL_ADDU; + Jump_Special[34] = SPECIAL_SUB; + Jump_Special[35] = SPECIAL_SUBU; + Jump_Special[36] = SPECIAL_AND; + Jump_Special[37] = SPECIAL_OR; + Jump_Special[38] = SPECIAL_XOR; + Jump_Special[39] = SPECIAL_NOR; + Jump_Special[40] = UnknownOpcode; + Jump_Special[41] = UnknownOpcode; + Jump_Special[42] = SPECIAL_SLT; + Jump_Special[43] = SPECIAL_SLTU; + Jump_Special[44] = SPECIAL_DADD; + Jump_Special[45] = SPECIAL_DADDU; + Jump_Special[46] = SPECIAL_DSUB; + Jump_Special[47] = SPECIAL_DSUBU; + Jump_Special[48] = UnknownOpcode; + Jump_Special[49] = UnknownOpcode; + Jump_Special[50] = UnknownOpcode; + Jump_Special[51] = UnknownOpcode; + Jump_Special[52] = SPECIAL_TEQ; + Jump_Special[53] = UnknownOpcode; + Jump_Special[54] = UnknownOpcode; + Jump_Special[55] = UnknownOpcode; + Jump_Special[56] = SPECIAL_DSLL; + Jump_Special[57] = UnknownOpcode; + Jump_Special[58] = SPECIAL_DSRL; + Jump_Special[59] = SPECIAL_DSRA; + Jump_Special[60] = SPECIAL_DSLL32; + Jump_Special[61] = UnknownOpcode; + Jump_Special[62] = SPECIAL_DSRL32; + Jump_Special[63] = SPECIAL_DSRA32; - Jump_Regimm[ 0] = REGIMM_BLTZ; - Jump_Regimm[ 1] = REGIMM_BGEZ; - Jump_Regimm[ 2] = REGIMM_BLTZL; - Jump_Regimm[ 3] = REGIMM_BGEZL; - Jump_Regimm[ 4] = UnknownOpcode; - Jump_Regimm[ 5] = UnknownOpcode; - Jump_Regimm[ 6] = UnknownOpcode; - Jump_Regimm[ 7] = UnknownOpcode; - Jump_Regimm[ 8] = UnknownOpcode; - Jump_Regimm[ 9] = UnknownOpcode; - Jump_Regimm[10] = UnknownOpcode; - Jump_Regimm[11] = UnknownOpcode; - Jump_Regimm[12] = UnknownOpcode; - Jump_Regimm[13] = UnknownOpcode; - Jump_Regimm[14] = UnknownOpcode; - Jump_Regimm[15] = UnknownOpcode; - Jump_Regimm[16] = REGIMM_BLTZAL; - Jump_Regimm[17] = REGIMM_BGEZAL; - Jump_Regimm[18] = UnknownOpcode; - Jump_Regimm[19] = UnknownOpcode; - Jump_Regimm[20] = UnknownOpcode; - Jump_Regimm[21] = UnknownOpcode; - Jump_Regimm[22] = UnknownOpcode; - Jump_Regimm[23] = UnknownOpcode; - Jump_Regimm[24] = UnknownOpcode; - Jump_Regimm[25] = UnknownOpcode; - Jump_Regimm[26] = UnknownOpcode; - Jump_Regimm[27] = UnknownOpcode; - Jump_Regimm[28] = UnknownOpcode; - Jump_Regimm[29] = UnknownOpcode; - Jump_Regimm[30] = UnknownOpcode; - Jump_Regimm[31] = UnknownOpcode; - - Jump_CoP0[ 0] = COP0_MF; - Jump_CoP0[ 1] = UnknownOpcode; - Jump_CoP0[ 2] = UnknownOpcode; - Jump_CoP0[ 3] = UnknownOpcode; - Jump_CoP0[ 4] = COP0_MT; - Jump_CoP0[ 5] = UnknownOpcode; - Jump_CoP0[ 6] = UnknownOpcode; - Jump_CoP0[ 7] = UnknownOpcode; - Jump_CoP0[ 8] = UnknownOpcode; - Jump_CoP0[ 9] = UnknownOpcode; - Jump_CoP0[10] = UnknownOpcode; - Jump_CoP0[11] = UnknownOpcode; - Jump_CoP0[12] = UnknownOpcode; - Jump_CoP0[13] = UnknownOpcode; - Jump_CoP0[14] = UnknownOpcode; - Jump_CoP0[15] = UnknownOpcode; - Jump_CoP0[16] = COP0_CO; - Jump_CoP0[17] = COP0_CO; - Jump_CoP0[18] = COP0_CO; - Jump_CoP0[19] = COP0_CO; - Jump_CoP0[20] = COP0_CO; - Jump_CoP0[21] = COP0_CO; - Jump_CoP0[22] = COP0_CO; - Jump_CoP0[23] = COP0_CO; - Jump_CoP0[24] = COP0_CO; - Jump_CoP0[25] = COP0_CO; - Jump_CoP0[26] = COP0_CO; - Jump_CoP0[27] = COP0_CO; - Jump_CoP0[28] = COP0_CO; - Jump_CoP0[29] = COP0_CO; - Jump_CoP0[30] = COP0_CO; - Jump_CoP0[31] = COP0_CO; + Jump_Regimm[ 0] = REGIMM_BLTZ; + Jump_Regimm[ 1] = REGIMM_BGEZ; + Jump_Regimm[ 2] = REGIMM_BLTZL; + Jump_Regimm[ 3] = REGIMM_BGEZL; + Jump_Regimm[ 4] = UnknownOpcode; + Jump_Regimm[ 5] = UnknownOpcode; + Jump_Regimm[ 6] = UnknownOpcode; + Jump_Regimm[ 7] = UnknownOpcode; + Jump_Regimm[ 8] = UnknownOpcode; + Jump_Regimm[ 9] = UnknownOpcode; + Jump_Regimm[10] = UnknownOpcode; + Jump_Regimm[11] = UnknownOpcode; + Jump_Regimm[12] = UnknownOpcode; + Jump_Regimm[13] = UnknownOpcode; + Jump_Regimm[14] = UnknownOpcode; + Jump_Regimm[15] = UnknownOpcode; + Jump_Regimm[16] = REGIMM_BLTZAL; + Jump_Regimm[17] = REGIMM_BGEZAL; + Jump_Regimm[18] = UnknownOpcode; + Jump_Regimm[19] = UnknownOpcode; + Jump_Regimm[20] = UnknownOpcode; + Jump_Regimm[21] = UnknownOpcode; + Jump_Regimm[22] = UnknownOpcode; + Jump_Regimm[23] = UnknownOpcode; + Jump_Regimm[24] = UnknownOpcode; + Jump_Regimm[25] = UnknownOpcode; + Jump_Regimm[26] = UnknownOpcode; + Jump_Regimm[27] = UnknownOpcode; + Jump_Regimm[28] = UnknownOpcode; + Jump_Regimm[29] = UnknownOpcode; + Jump_Regimm[30] = UnknownOpcode; + Jump_Regimm[31] = UnknownOpcode; - Jump_CoP0_Function[ 0] = UnknownOpcode; - Jump_CoP0_Function[ 1] = COP0_CO_TLBR; - Jump_CoP0_Function[ 2] = COP0_CO_TLBWI; - Jump_CoP0_Function[ 3] = UnknownOpcode; - Jump_CoP0_Function[ 4] = UnknownOpcode; - Jump_CoP0_Function[ 5] = UnknownOpcode; - Jump_CoP0_Function[ 6] = COP0_CO_TLBWR; - Jump_CoP0_Function[ 7] = UnknownOpcode; - Jump_CoP0_Function[ 8] = COP0_CO_TLBP; - Jump_CoP0_Function[ 9] = UnknownOpcode; - Jump_CoP0_Function[10] = UnknownOpcode; - Jump_CoP0_Function[11] = UnknownOpcode; - Jump_CoP0_Function[12] = UnknownOpcode; - Jump_CoP0_Function[13] = UnknownOpcode; - Jump_CoP0_Function[14] = UnknownOpcode; - Jump_CoP0_Function[15] = UnknownOpcode; - Jump_CoP0_Function[16] = UnknownOpcode; - Jump_CoP0_Function[17] = UnknownOpcode; - Jump_CoP0_Function[18] = UnknownOpcode; - Jump_CoP0_Function[19] = UnknownOpcode; - Jump_CoP0_Function[20] = UnknownOpcode; - Jump_CoP0_Function[21] = UnknownOpcode; - Jump_CoP0_Function[22] = UnknownOpcode; - Jump_CoP0_Function[23] = UnknownOpcode; - Jump_CoP0_Function[24] = COP0_CO_ERET; - Jump_CoP0_Function[25] = UnknownOpcode; - Jump_CoP0_Function[26] = UnknownOpcode; - Jump_CoP0_Function[27] = UnknownOpcode; - Jump_CoP0_Function[28] = UnknownOpcode; - Jump_CoP0_Function[29] = UnknownOpcode; - Jump_CoP0_Function[30] = UnknownOpcode; - Jump_CoP0_Function[31] = UnknownOpcode; - Jump_CoP0_Function[32] = UnknownOpcode; - Jump_CoP0_Function[33] = UnknownOpcode; - Jump_CoP0_Function[34] = UnknownOpcode; - Jump_CoP0_Function[35] = UnknownOpcode; - Jump_CoP0_Function[36] = UnknownOpcode; - Jump_CoP0_Function[37] = UnknownOpcode; - Jump_CoP0_Function[38] = UnknownOpcode; - Jump_CoP0_Function[39] = UnknownOpcode; - Jump_CoP0_Function[40] = UnknownOpcode; - Jump_CoP0_Function[41] = UnknownOpcode; - Jump_CoP0_Function[42] = UnknownOpcode; - Jump_CoP0_Function[43] = UnknownOpcode; - Jump_CoP0_Function[44] = UnknownOpcode; - Jump_CoP0_Function[45] = UnknownOpcode; - Jump_CoP0_Function[46] = UnknownOpcode; - Jump_CoP0_Function[47] = UnknownOpcode; - Jump_CoP0_Function[48] = UnknownOpcode; - Jump_CoP0_Function[49] = UnknownOpcode; - Jump_CoP0_Function[50] = UnknownOpcode; - Jump_CoP0_Function[51] = UnknownOpcode; - Jump_CoP0_Function[52] = UnknownOpcode; - Jump_CoP0_Function[53] = UnknownOpcode; - Jump_CoP0_Function[54] = UnknownOpcode; - Jump_CoP0_Function[55] = UnknownOpcode; - Jump_CoP0_Function[56] = UnknownOpcode; - Jump_CoP0_Function[57] = UnknownOpcode; - Jump_CoP0_Function[58] = UnknownOpcode; - Jump_CoP0_Function[59] = UnknownOpcode; - Jump_CoP0_Function[60] = UnknownOpcode; - Jump_CoP0_Function[61] = UnknownOpcode; - Jump_CoP0_Function[62] = UnknownOpcode; - Jump_CoP0_Function[63] = UnknownOpcode; - - Jump_CoP1[ 0] = COP1_MF; - Jump_CoP1[ 1] = COP1_DMF; - Jump_CoP1[ 2] = COP1_CF; - Jump_CoP1[ 3] = UnknownOpcode; - Jump_CoP1[ 4] = COP1_MT; - Jump_CoP1[ 5] = COP1_DMT; - Jump_CoP1[ 6] = COP1_CT; - Jump_CoP1[ 7] = UnknownOpcode; - Jump_CoP1[ 8] = COP1_BC; - Jump_CoP1[ 9] = UnknownOpcode; - Jump_CoP1[10] = UnknownOpcode; - Jump_CoP1[11] = UnknownOpcode; - Jump_CoP1[12] = UnknownOpcode; - Jump_CoP1[13] = UnknownOpcode; - Jump_CoP1[14] = UnknownOpcode; - Jump_CoP1[15] = UnknownOpcode; - Jump_CoP1[16] = COP1_S; - Jump_CoP1[17] = COP1_D; - Jump_CoP1[18] = UnknownOpcode; - Jump_CoP1[19] = UnknownOpcode; - Jump_CoP1[20] = COP1_W; - Jump_CoP1[21] = COP1_L; - Jump_CoP1[22] = UnknownOpcode; - Jump_CoP1[23] = UnknownOpcode; - Jump_CoP1[24] = UnknownOpcode; - Jump_CoP1[25] = UnknownOpcode; - Jump_CoP1[26] = UnknownOpcode; - Jump_CoP1[27] = UnknownOpcode; - Jump_CoP1[28] = UnknownOpcode; - Jump_CoP1[29] = UnknownOpcode; - Jump_CoP1[30] = UnknownOpcode; - Jump_CoP1[31] = UnknownOpcode; + Jump_CoP0[ 0] = COP0_MF; + Jump_CoP0[ 1] = UnknownOpcode; + Jump_CoP0[ 2] = UnknownOpcode; + Jump_CoP0[ 3] = UnknownOpcode; + Jump_CoP0[ 4] = COP0_MT; + Jump_CoP0[ 5] = UnknownOpcode; + Jump_CoP0[ 6] = UnknownOpcode; + Jump_CoP0[ 7] = UnknownOpcode; + Jump_CoP0[ 8] = UnknownOpcode; + Jump_CoP0[ 9] = UnknownOpcode; + Jump_CoP0[10] = UnknownOpcode; + Jump_CoP0[11] = UnknownOpcode; + Jump_CoP0[12] = UnknownOpcode; + Jump_CoP0[13] = UnknownOpcode; + Jump_CoP0[14] = UnknownOpcode; + Jump_CoP0[15] = UnknownOpcode; + Jump_CoP0[16] = COP0_CO; + Jump_CoP0[17] = COP0_CO; + Jump_CoP0[18] = COP0_CO; + Jump_CoP0[19] = COP0_CO; + Jump_CoP0[20] = COP0_CO; + Jump_CoP0[21] = COP0_CO; + Jump_CoP0[22] = COP0_CO; + Jump_CoP0[23] = COP0_CO; + Jump_CoP0[24] = COP0_CO; + Jump_CoP0[25] = COP0_CO; + Jump_CoP0[26] = COP0_CO; + Jump_CoP0[27] = COP0_CO; + Jump_CoP0[28] = COP0_CO; + Jump_CoP0[29] = COP0_CO; + Jump_CoP0[30] = COP0_CO; + Jump_CoP0[31] = COP0_CO; - Jump_CoP1_BC[ 0] = COP1_BCF; - Jump_CoP1_BC[ 1] = COP1_BCT; - Jump_CoP1_BC[ 2] = COP1_BCFL; - Jump_CoP1_BC[ 3] = COP1_BCTL; - Jump_CoP1_BC[ 4] = UnknownOpcode; - Jump_CoP1_BC[ 5] = UnknownOpcode; - Jump_CoP1_BC[ 6] = UnknownOpcode; - Jump_CoP1_BC[ 7] = UnknownOpcode; - Jump_CoP1_BC[ 8] = UnknownOpcode; - Jump_CoP1_BC[ 9] = UnknownOpcode; - Jump_CoP1_BC[10] = UnknownOpcode; - Jump_CoP1_BC[11] = UnknownOpcode; - Jump_CoP1_BC[12] = UnknownOpcode; - Jump_CoP1_BC[13] = UnknownOpcode; - Jump_CoP1_BC[14] = UnknownOpcode; - Jump_CoP1_BC[15] = UnknownOpcode; - Jump_CoP1_BC[16] = UnknownOpcode; - Jump_CoP1_BC[17] = UnknownOpcode; - Jump_CoP1_BC[18] = UnknownOpcode; - Jump_CoP1_BC[19] = UnknownOpcode; - Jump_CoP1_BC[20] = UnknownOpcode; - Jump_CoP1_BC[21] = UnknownOpcode; - Jump_CoP1_BC[22] = UnknownOpcode; - Jump_CoP1_BC[23] = UnknownOpcode; - Jump_CoP1_BC[24] = UnknownOpcode; - Jump_CoP1_BC[25] = UnknownOpcode; - Jump_CoP1_BC[26] = UnknownOpcode; - Jump_CoP1_BC[27] = UnknownOpcode; - Jump_CoP1_BC[28] = UnknownOpcode; - Jump_CoP1_BC[29] = UnknownOpcode; - Jump_CoP1_BC[30] = UnknownOpcode; - Jump_CoP1_BC[31] = UnknownOpcode; + Jump_CoP0_Function[ 0] = UnknownOpcode; + Jump_CoP0_Function[ 1] = COP0_CO_TLBR; + Jump_CoP0_Function[ 2] = COP0_CO_TLBWI; + Jump_CoP0_Function[ 3] = UnknownOpcode; + Jump_CoP0_Function[ 4] = UnknownOpcode; + Jump_CoP0_Function[ 5] = UnknownOpcode; + Jump_CoP0_Function[ 6] = COP0_CO_TLBWR; + Jump_CoP0_Function[ 7] = UnknownOpcode; + Jump_CoP0_Function[ 8] = COP0_CO_TLBP; + Jump_CoP0_Function[ 9] = UnknownOpcode; + Jump_CoP0_Function[10] = UnknownOpcode; + Jump_CoP0_Function[11] = UnknownOpcode; + Jump_CoP0_Function[12] = UnknownOpcode; + Jump_CoP0_Function[13] = UnknownOpcode; + Jump_CoP0_Function[14] = UnknownOpcode; + Jump_CoP0_Function[15] = UnknownOpcode; + Jump_CoP0_Function[16] = UnknownOpcode; + Jump_CoP0_Function[17] = UnknownOpcode; + Jump_CoP0_Function[18] = UnknownOpcode; + Jump_CoP0_Function[19] = UnknownOpcode; + Jump_CoP0_Function[20] = UnknownOpcode; + Jump_CoP0_Function[21] = UnknownOpcode; + Jump_CoP0_Function[22] = UnknownOpcode; + Jump_CoP0_Function[23] = UnknownOpcode; + Jump_CoP0_Function[24] = COP0_CO_ERET; + Jump_CoP0_Function[25] = UnknownOpcode; + Jump_CoP0_Function[26] = UnknownOpcode; + Jump_CoP0_Function[27] = UnknownOpcode; + Jump_CoP0_Function[28] = UnknownOpcode; + Jump_CoP0_Function[29] = UnknownOpcode; + Jump_CoP0_Function[30] = UnknownOpcode; + Jump_CoP0_Function[31] = UnknownOpcode; + Jump_CoP0_Function[32] = UnknownOpcode; + Jump_CoP0_Function[33] = UnknownOpcode; + Jump_CoP0_Function[34] = UnknownOpcode; + Jump_CoP0_Function[35] = UnknownOpcode; + Jump_CoP0_Function[36] = UnknownOpcode; + Jump_CoP0_Function[37] = UnknownOpcode; + Jump_CoP0_Function[38] = UnknownOpcode; + Jump_CoP0_Function[39] = UnknownOpcode; + Jump_CoP0_Function[40] = UnknownOpcode; + Jump_CoP0_Function[41] = UnknownOpcode; + Jump_CoP0_Function[42] = UnknownOpcode; + Jump_CoP0_Function[43] = UnknownOpcode; + Jump_CoP0_Function[44] = UnknownOpcode; + Jump_CoP0_Function[45] = UnknownOpcode; + Jump_CoP0_Function[46] = UnknownOpcode; + Jump_CoP0_Function[47] = UnknownOpcode; + Jump_CoP0_Function[48] = UnknownOpcode; + Jump_CoP0_Function[49] = UnknownOpcode; + Jump_CoP0_Function[50] = UnknownOpcode; + Jump_CoP0_Function[51] = UnknownOpcode; + Jump_CoP0_Function[52] = UnknownOpcode; + Jump_CoP0_Function[53] = UnknownOpcode; + Jump_CoP0_Function[54] = UnknownOpcode; + Jump_CoP0_Function[55] = UnknownOpcode; + Jump_CoP0_Function[56] = UnknownOpcode; + Jump_CoP0_Function[57] = UnknownOpcode; + Jump_CoP0_Function[58] = UnknownOpcode; + Jump_CoP0_Function[59] = UnknownOpcode; + Jump_CoP0_Function[60] = UnknownOpcode; + Jump_CoP0_Function[61] = UnknownOpcode; + Jump_CoP0_Function[62] = UnknownOpcode; + Jump_CoP0_Function[63] = UnknownOpcode; - Jump_CoP1_S[ 0] = COP1_S_ADD; - Jump_CoP1_S[ 1] = COP1_S_SUB; - Jump_CoP1_S[ 2] = COP1_S_MUL; - Jump_CoP1_S[ 3] = COP1_S_DIV; - Jump_CoP1_S[ 4] = COP1_S_SQRT; - 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[ 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 - Jump_CoP1_S[12] = COP1_S_ROUND_W; - Jump_CoP1_S[13] = COP1_S_TRUNC_W; - Jump_CoP1_S[14] = COP1_S_CEIL_W; //added by Witten - Jump_CoP1_S[15] = COP1_S_FLOOR_W; - Jump_CoP1_S[16] = UnknownOpcode; - Jump_CoP1_S[17] = UnknownOpcode; - Jump_CoP1_S[18] = UnknownOpcode; - Jump_CoP1_S[19] = UnknownOpcode; - Jump_CoP1_S[20] = UnknownOpcode; - Jump_CoP1_S[21] = UnknownOpcode; - Jump_CoP1_S[22] = UnknownOpcode; - Jump_CoP1_S[23] = UnknownOpcode; - Jump_CoP1_S[24] = UnknownOpcode; - Jump_CoP1_S[25] = UnknownOpcode; - Jump_CoP1_S[26] = UnknownOpcode; - Jump_CoP1_S[27] = UnknownOpcode; - Jump_CoP1_S[28] = UnknownOpcode; - Jump_CoP1_S[29] = UnknownOpcode; - Jump_CoP1_S[30] = UnknownOpcode; - Jump_CoP1_S[31] = UnknownOpcode; - Jump_CoP1_S[32] = UnknownOpcode; - Jump_CoP1_S[33] = COP1_S_CVT_D; - Jump_CoP1_S[34] = UnknownOpcode; - Jump_CoP1_S[35] = UnknownOpcode; - Jump_CoP1_S[36] = COP1_S_CVT_W; - Jump_CoP1_S[37] = COP1_S_CVT_L; - Jump_CoP1_S[38] = UnknownOpcode; - Jump_CoP1_S[39] = UnknownOpcode; - Jump_CoP1_S[40] = UnknownOpcode; - Jump_CoP1_S[41] = UnknownOpcode; - Jump_CoP1_S[42] = UnknownOpcode; - Jump_CoP1_S[43] = UnknownOpcode; - Jump_CoP1_S[44] = UnknownOpcode; - Jump_CoP1_S[45] = UnknownOpcode; - Jump_CoP1_S[46] = UnknownOpcode; - Jump_CoP1_S[47] = UnknownOpcode; - Jump_CoP1_S[48] = COP1_S_CMP; - Jump_CoP1_S[49] = COP1_S_CMP; - Jump_CoP1_S[50] = COP1_S_CMP; - Jump_CoP1_S[51] = COP1_S_CMP; - Jump_CoP1_S[52] = COP1_S_CMP; - Jump_CoP1_S[53] = COP1_S_CMP; - Jump_CoP1_S[54] = COP1_S_CMP; - Jump_CoP1_S[55] = COP1_S_CMP; - Jump_CoP1_S[56] = COP1_S_CMP; - Jump_CoP1_S[57] = COP1_S_CMP; - Jump_CoP1_S[58] = COP1_S_CMP; - Jump_CoP1_S[59] = COP1_S_CMP; - Jump_CoP1_S[60] = COP1_S_CMP; - Jump_CoP1_S[61] = COP1_S_CMP; - Jump_CoP1_S[62] = COP1_S_CMP; - Jump_CoP1_S[63] = COP1_S_CMP; + Jump_CoP1[ 0] = COP1_MF; + Jump_CoP1[ 1] = COP1_DMF; + Jump_CoP1[ 2] = COP1_CF; + Jump_CoP1[ 3] = UnknownOpcode; + Jump_CoP1[ 4] = COP1_MT; + Jump_CoP1[ 5] = COP1_DMT; + Jump_CoP1[ 6] = COP1_CT; + Jump_CoP1[ 7] = UnknownOpcode; + Jump_CoP1[ 8] = COP1_BC; + Jump_CoP1[ 9] = UnknownOpcode; + Jump_CoP1[10] = UnknownOpcode; + Jump_CoP1[11] = UnknownOpcode; + Jump_CoP1[12] = UnknownOpcode; + Jump_CoP1[13] = UnknownOpcode; + Jump_CoP1[14] = UnknownOpcode; + Jump_CoP1[15] = UnknownOpcode; + Jump_CoP1[16] = COP1_S; + Jump_CoP1[17] = COP1_D; + Jump_CoP1[18] = UnknownOpcode; + Jump_CoP1[19] = UnknownOpcode; + Jump_CoP1[20] = COP1_W; + Jump_CoP1[21] = COP1_L; + Jump_CoP1[22] = UnknownOpcode; + Jump_CoP1[23] = UnknownOpcode; + Jump_CoP1[24] = UnknownOpcode; + Jump_CoP1[25] = UnknownOpcode; + Jump_CoP1[26] = UnknownOpcode; + Jump_CoP1[27] = UnknownOpcode; + Jump_CoP1[28] = UnknownOpcode; + Jump_CoP1[29] = UnknownOpcode; + Jump_CoP1[30] = UnknownOpcode; + Jump_CoP1[31] = UnknownOpcode; - Jump_CoP1_D[ 0] = COP1_D_ADD; - Jump_CoP1_D[ 1] = COP1_D_SUB; - Jump_CoP1_D[ 2] = COP1_D_MUL; - Jump_CoP1_D[ 3] = COP1_D_DIV; - Jump_CoP1_D[ 4] = COP1_D_SQRT; - Jump_CoP1_D[ 5] = COP1_D_ABS; - Jump_CoP1_D[ 6] = COP1_D_MOV; - Jump_CoP1_D[ 7] = COP1_D_NEG; - Jump_CoP1_D[ 8] = UnknownOpcode; - Jump_CoP1_D[ 9] = COP1_D_TRUNC_L; //added by Witten - Jump_CoP1_D[10] = COP1_D_CEIL_L; //added by Witten - Jump_CoP1_D[11] = COP1_D_FLOOR_L; //added by Witten - Jump_CoP1_D[12] = COP1_D_ROUND_W; - Jump_CoP1_D[13] = COP1_D_TRUNC_W; - Jump_CoP1_D[14] = COP1_D_CEIL_W; //added by Witten - Jump_CoP1_D[15] = COP1_D_FLOOR_W; //added by Witten - Jump_CoP1_D[16] = UnknownOpcode; - Jump_CoP1_D[17] = UnknownOpcode; - Jump_CoP1_D[18] = UnknownOpcode; - Jump_CoP1_D[19] = UnknownOpcode; - Jump_CoP1_D[20] = UnknownOpcode; - Jump_CoP1_D[21] = UnknownOpcode; - Jump_CoP1_D[22] = UnknownOpcode; - Jump_CoP1_D[23] = UnknownOpcode; - Jump_CoP1_D[24] = UnknownOpcode; - Jump_CoP1_D[25] = UnknownOpcode; - Jump_CoP1_D[26] = UnknownOpcode; - Jump_CoP1_D[27] = UnknownOpcode; - Jump_CoP1_D[28] = UnknownOpcode; - Jump_CoP1_D[29] = UnknownOpcode; - Jump_CoP1_D[30] = UnknownOpcode; - Jump_CoP1_D[31] = UnknownOpcode; - Jump_CoP1_D[32] = COP1_D_CVT_S; - Jump_CoP1_D[33] = UnknownOpcode; - Jump_CoP1_D[34] = UnknownOpcode; - Jump_CoP1_D[35] = UnknownOpcode; - Jump_CoP1_D[36] = COP1_D_CVT_W; - Jump_CoP1_D[37] = COP1_D_CVT_L; - Jump_CoP1_D[38] = UnknownOpcode; - Jump_CoP1_D[39] = UnknownOpcode; - Jump_CoP1_D[40] = UnknownOpcode; - Jump_CoP1_D[41] = UnknownOpcode; - Jump_CoP1_D[42] = UnknownOpcode; - Jump_CoP1_D[43] = UnknownOpcode; - Jump_CoP1_D[44] = UnknownOpcode; - Jump_CoP1_D[45] = UnknownOpcode; - Jump_CoP1_D[46] = UnknownOpcode; - Jump_CoP1_D[47] = UnknownOpcode; - Jump_CoP1_D[48] = COP1_D_CMP; - Jump_CoP1_D[49] = COP1_D_CMP; - Jump_CoP1_D[50] = COP1_D_CMP; - Jump_CoP1_D[51] = COP1_D_CMP; - Jump_CoP1_D[52] = COP1_D_CMP; - Jump_CoP1_D[53] = COP1_D_CMP; - Jump_CoP1_D[54] = COP1_D_CMP; - Jump_CoP1_D[55] = COP1_D_CMP; - Jump_CoP1_D[56] = COP1_D_CMP; - Jump_CoP1_D[57] = COP1_D_CMP; - Jump_CoP1_D[58] = COP1_D_CMP; - Jump_CoP1_D[59] = COP1_D_CMP; - Jump_CoP1_D[60] = COP1_D_CMP; - Jump_CoP1_D[61] = COP1_D_CMP; - Jump_CoP1_D[62] = COP1_D_CMP; - Jump_CoP1_D[63] = COP1_D_CMP; + Jump_CoP1_BC[ 0] = COP1_BCF; + Jump_CoP1_BC[ 1] = COP1_BCT; + Jump_CoP1_BC[ 2] = COP1_BCFL; + Jump_CoP1_BC[ 3] = COP1_BCTL; + Jump_CoP1_BC[ 4] = UnknownOpcode; + Jump_CoP1_BC[ 5] = UnknownOpcode; + Jump_CoP1_BC[ 6] = UnknownOpcode; + Jump_CoP1_BC[ 7] = UnknownOpcode; + Jump_CoP1_BC[ 8] = UnknownOpcode; + Jump_CoP1_BC[ 9] = UnknownOpcode; + Jump_CoP1_BC[10] = UnknownOpcode; + Jump_CoP1_BC[11] = UnknownOpcode; + Jump_CoP1_BC[12] = UnknownOpcode; + Jump_CoP1_BC[13] = UnknownOpcode; + Jump_CoP1_BC[14] = UnknownOpcode; + Jump_CoP1_BC[15] = UnknownOpcode; + Jump_CoP1_BC[16] = UnknownOpcode; + Jump_CoP1_BC[17] = UnknownOpcode; + Jump_CoP1_BC[18] = UnknownOpcode; + Jump_CoP1_BC[19] = UnknownOpcode; + Jump_CoP1_BC[20] = UnknownOpcode; + Jump_CoP1_BC[21] = UnknownOpcode; + Jump_CoP1_BC[22] = UnknownOpcode; + Jump_CoP1_BC[23] = UnknownOpcode; + Jump_CoP1_BC[24] = UnknownOpcode; + Jump_CoP1_BC[25] = UnknownOpcode; + Jump_CoP1_BC[26] = UnknownOpcode; + Jump_CoP1_BC[27] = UnknownOpcode; + Jump_CoP1_BC[28] = UnknownOpcode; + Jump_CoP1_BC[29] = UnknownOpcode; + Jump_CoP1_BC[30] = UnknownOpcode; + Jump_CoP1_BC[31] = UnknownOpcode; - Jump_CoP1_W[ 0] = UnknownOpcode; - Jump_CoP1_W[ 1] = UnknownOpcode; - Jump_CoP1_W[ 2] = UnknownOpcode; - Jump_CoP1_W[ 3] = UnknownOpcode; - Jump_CoP1_W[ 4] = UnknownOpcode; - Jump_CoP1_W[ 5] = UnknownOpcode; - Jump_CoP1_W[ 6] = UnknownOpcode; - Jump_CoP1_W[ 7] = UnknownOpcode; - Jump_CoP1_W[ 8] = UnknownOpcode; - Jump_CoP1_W[ 9] = UnknownOpcode; - Jump_CoP1_W[10] = UnknownOpcode; - Jump_CoP1_W[11] = UnknownOpcode; - Jump_CoP1_W[12] = UnknownOpcode; - Jump_CoP1_W[13] = UnknownOpcode; - Jump_CoP1_W[14] = UnknownOpcode; - Jump_CoP1_W[15] = UnknownOpcode; - Jump_CoP1_W[16] = UnknownOpcode; - Jump_CoP1_W[17] = UnknownOpcode; - Jump_CoP1_W[18] = UnknownOpcode; - Jump_CoP1_W[19] = UnknownOpcode; - Jump_CoP1_W[20] = UnknownOpcode; - Jump_CoP1_W[21] = UnknownOpcode; - Jump_CoP1_W[22] = UnknownOpcode; - Jump_CoP1_W[23] = UnknownOpcode; - Jump_CoP1_W[24] = UnknownOpcode; - Jump_CoP1_W[25] = UnknownOpcode; - Jump_CoP1_W[26] = UnknownOpcode; - Jump_CoP1_W[27] = UnknownOpcode; - Jump_CoP1_W[28] = UnknownOpcode; - Jump_CoP1_W[29] = UnknownOpcode; - Jump_CoP1_W[30] = UnknownOpcode; - Jump_CoP1_W[31] = UnknownOpcode; - Jump_CoP1_W[32] = COP1_W_CVT_S; - Jump_CoP1_W[33] = COP1_W_CVT_D; - Jump_CoP1_W[34] = UnknownOpcode; - Jump_CoP1_W[35] = UnknownOpcode; - Jump_CoP1_W[36] = UnknownOpcode; - Jump_CoP1_W[37] = UnknownOpcode; - Jump_CoP1_W[38] = UnknownOpcode; - Jump_CoP1_W[39] = UnknownOpcode; - Jump_CoP1_W[40] = UnknownOpcode; - Jump_CoP1_W[41] = UnknownOpcode; - Jump_CoP1_W[42] = UnknownOpcode; - Jump_CoP1_W[43] = UnknownOpcode; - Jump_CoP1_W[44] = UnknownOpcode; - Jump_CoP1_W[45] = UnknownOpcode; - Jump_CoP1_W[46] = UnknownOpcode; - Jump_CoP1_W[47] = UnknownOpcode; - Jump_CoP1_W[48] = UnknownOpcode; - Jump_CoP1_W[49] = UnknownOpcode; - Jump_CoP1_W[50] = UnknownOpcode; - Jump_CoP1_W[51] = UnknownOpcode; - Jump_CoP1_W[52] = UnknownOpcode; - Jump_CoP1_W[53] = UnknownOpcode; - Jump_CoP1_W[54] = UnknownOpcode; - Jump_CoP1_W[55] = UnknownOpcode; - Jump_CoP1_W[56] = UnknownOpcode; - Jump_CoP1_W[57] = UnknownOpcode; - Jump_CoP1_W[58] = UnknownOpcode; - Jump_CoP1_W[59] = UnknownOpcode; - Jump_CoP1_W[60] = UnknownOpcode; - Jump_CoP1_W[61] = UnknownOpcode; - Jump_CoP1_W[62] = UnknownOpcode; - Jump_CoP1_W[63] = UnknownOpcode; + Jump_CoP1_S[ 0] = COP1_S_ADD; + Jump_CoP1_S[ 1] = COP1_S_SUB; + Jump_CoP1_S[ 2] = COP1_S_MUL; + Jump_CoP1_S[ 3] = COP1_S_DIV; + Jump_CoP1_S[ 4] = COP1_S_SQRT; + 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[ 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 + Jump_CoP1_S[12] = COP1_S_ROUND_W; + Jump_CoP1_S[13] = COP1_S_TRUNC_W; + Jump_CoP1_S[14] = COP1_S_CEIL_W; //added by Witten + Jump_CoP1_S[15] = COP1_S_FLOOR_W; + Jump_CoP1_S[16] = UnknownOpcode; + Jump_CoP1_S[17] = UnknownOpcode; + Jump_CoP1_S[18] = UnknownOpcode; + Jump_CoP1_S[19] = UnknownOpcode; + Jump_CoP1_S[20] = UnknownOpcode; + Jump_CoP1_S[21] = UnknownOpcode; + Jump_CoP1_S[22] = UnknownOpcode; + Jump_CoP1_S[23] = UnknownOpcode; + Jump_CoP1_S[24] = UnknownOpcode; + Jump_CoP1_S[25] = UnknownOpcode; + Jump_CoP1_S[26] = UnknownOpcode; + Jump_CoP1_S[27] = UnknownOpcode; + Jump_CoP1_S[28] = UnknownOpcode; + Jump_CoP1_S[29] = UnknownOpcode; + Jump_CoP1_S[30] = UnknownOpcode; + Jump_CoP1_S[31] = UnknownOpcode; + Jump_CoP1_S[32] = UnknownOpcode; + Jump_CoP1_S[33] = COP1_S_CVT_D; + Jump_CoP1_S[34] = UnknownOpcode; + Jump_CoP1_S[35] = UnknownOpcode; + Jump_CoP1_S[36] = COP1_S_CVT_W; + Jump_CoP1_S[37] = COP1_S_CVT_L; + Jump_CoP1_S[38] = UnknownOpcode; + Jump_CoP1_S[39] = UnknownOpcode; + Jump_CoP1_S[40] = UnknownOpcode; + Jump_CoP1_S[41] = UnknownOpcode; + Jump_CoP1_S[42] = UnknownOpcode; + Jump_CoP1_S[43] = UnknownOpcode; + Jump_CoP1_S[44] = UnknownOpcode; + Jump_CoP1_S[45] = UnknownOpcode; + Jump_CoP1_S[46] = UnknownOpcode; + Jump_CoP1_S[47] = UnknownOpcode; + Jump_CoP1_S[48] = COP1_S_CMP; + Jump_CoP1_S[49] = COP1_S_CMP; + Jump_CoP1_S[50] = COP1_S_CMP; + Jump_CoP1_S[51] = COP1_S_CMP; + Jump_CoP1_S[52] = COP1_S_CMP; + Jump_CoP1_S[53] = COP1_S_CMP; + Jump_CoP1_S[54] = COP1_S_CMP; + Jump_CoP1_S[55] = COP1_S_CMP; + Jump_CoP1_S[56] = COP1_S_CMP; + Jump_CoP1_S[57] = COP1_S_CMP; + Jump_CoP1_S[58] = COP1_S_CMP; + Jump_CoP1_S[59] = COP1_S_CMP; + Jump_CoP1_S[60] = COP1_S_CMP; + Jump_CoP1_S[61] = COP1_S_CMP; + Jump_CoP1_S[62] = COP1_S_CMP; + Jump_CoP1_S[63] = COP1_S_CMP; - Jump_CoP1_L[ 0] = UnknownOpcode; - Jump_CoP1_L[ 1] = UnknownOpcode; - Jump_CoP1_L[ 2] = UnknownOpcode; - Jump_CoP1_L[ 3] = UnknownOpcode; - Jump_CoP1_L[ 4] = UnknownOpcode; - Jump_CoP1_L[ 5] = UnknownOpcode; - Jump_CoP1_L[ 6] = UnknownOpcode; - Jump_CoP1_L[ 7] = UnknownOpcode; - Jump_CoP1_L[ 8] = UnknownOpcode; - Jump_CoP1_L[ 9] = UnknownOpcode; - Jump_CoP1_L[10] = UnknownOpcode; - Jump_CoP1_L[11] = UnknownOpcode; - Jump_CoP1_L[12] = UnknownOpcode; - Jump_CoP1_L[13] = UnknownOpcode; - Jump_CoP1_L[14] = UnknownOpcode; - Jump_CoP1_L[15] = UnknownOpcode; - Jump_CoP1_L[16] = UnknownOpcode; - Jump_CoP1_L[17] = UnknownOpcode; - Jump_CoP1_L[18] = UnknownOpcode; - Jump_CoP1_L[19] = UnknownOpcode; - Jump_CoP1_L[20] = UnknownOpcode; - Jump_CoP1_L[21] = UnknownOpcode; - Jump_CoP1_L[22] = UnknownOpcode; - Jump_CoP1_L[23] = UnknownOpcode; - Jump_CoP1_L[24] = UnknownOpcode; - Jump_CoP1_L[25] = UnknownOpcode; - Jump_CoP1_L[26] = UnknownOpcode; - Jump_CoP1_L[27] = UnknownOpcode; - Jump_CoP1_L[28] = UnknownOpcode; - Jump_CoP1_L[29] = UnknownOpcode; - Jump_CoP1_L[30] = UnknownOpcode; - Jump_CoP1_L[31] = UnknownOpcode; - Jump_CoP1_L[32] = COP1_L_CVT_S; - Jump_CoP1_L[33] = COP1_L_CVT_D; - Jump_CoP1_L[34] = UnknownOpcode; - Jump_CoP1_L[35] = UnknownOpcode; - Jump_CoP1_L[36] = UnknownOpcode; - Jump_CoP1_L[37] = UnknownOpcode; - Jump_CoP1_L[38] = UnknownOpcode; - Jump_CoP1_L[39] = UnknownOpcode; - Jump_CoP1_L[40] = UnknownOpcode; - Jump_CoP1_L[41] = UnknownOpcode; - Jump_CoP1_L[42] = UnknownOpcode; - Jump_CoP1_L[43] = UnknownOpcode; - Jump_CoP1_L[44] = UnknownOpcode; - Jump_CoP1_L[45] = UnknownOpcode; - Jump_CoP1_L[46] = UnknownOpcode; - Jump_CoP1_L[47] = UnknownOpcode; - Jump_CoP1_L[48] = UnknownOpcode; - Jump_CoP1_L[49] = UnknownOpcode; - Jump_CoP1_L[50] = UnknownOpcode; - Jump_CoP1_L[51] = UnknownOpcode; - Jump_CoP1_L[52] = UnknownOpcode; - Jump_CoP1_L[53] = UnknownOpcode; - Jump_CoP1_L[54] = UnknownOpcode; - Jump_CoP1_L[55] = UnknownOpcode; - Jump_CoP1_L[56] = UnknownOpcode; - Jump_CoP1_L[57] = UnknownOpcode; - Jump_CoP1_L[58] = UnknownOpcode; - Jump_CoP1_L[59] = UnknownOpcode; - Jump_CoP1_L[60] = UnknownOpcode; - Jump_CoP1_L[61] = UnknownOpcode; - Jump_CoP1_L[62] = UnknownOpcode; - Jump_CoP1_L[63] = UnknownOpcode; + Jump_CoP1_D[ 0] = COP1_D_ADD; + Jump_CoP1_D[ 1] = COP1_D_SUB; + Jump_CoP1_D[ 2] = COP1_D_MUL; + Jump_CoP1_D[ 3] = COP1_D_DIV; + Jump_CoP1_D[ 4] = COP1_D_SQRT; + Jump_CoP1_D[ 5] = COP1_D_ABS; + Jump_CoP1_D[ 6] = COP1_D_MOV; + Jump_CoP1_D[ 7] = COP1_D_NEG; + Jump_CoP1_D[ 8] = UnknownOpcode; + Jump_CoP1_D[ 9] = COP1_D_TRUNC_L; //added by Witten + Jump_CoP1_D[10] = COP1_D_CEIL_L; //added by Witten + Jump_CoP1_D[11] = COP1_D_FLOOR_L; //added by Witten + Jump_CoP1_D[12] = COP1_D_ROUND_W; + Jump_CoP1_D[13] = COP1_D_TRUNC_W; + Jump_CoP1_D[14] = COP1_D_CEIL_W; //added by Witten + Jump_CoP1_D[15] = COP1_D_FLOOR_W; //added by Witten + Jump_CoP1_D[16] = UnknownOpcode; + Jump_CoP1_D[17] = UnknownOpcode; + Jump_CoP1_D[18] = UnknownOpcode; + Jump_CoP1_D[19] = UnknownOpcode; + Jump_CoP1_D[20] = UnknownOpcode; + Jump_CoP1_D[21] = UnknownOpcode; + Jump_CoP1_D[22] = UnknownOpcode; + Jump_CoP1_D[23] = UnknownOpcode; + Jump_CoP1_D[24] = UnknownOpcode; + Jump_CoP1_D[25] = UnknownOpcode; + Jump_CoP1_D[26] = UnknownOpcode; + Jump_CoP1_D[27] = UnknownOpcode; + Jump_CoP1_D[28] = UnknownOpcode; + Jump_CoP1_D[29] = UnknownOpcode; + Jump_CoP1_D[30] = UnknownOpcode; + Jump_CoP1_D[31] = UnknownOpcode; + Jump_CoP1_D[32] = COP1_D_CVT_S; + Jump_CoP1_D[33] = UnknownOpcode; + Jump_CoP1_D[34] = UnknownOpcode; + Jump_CoP1_D[35] = UnknownOpcode; + Jump_CoP1_D[36] = COP1_D_CVT_W; + Jump_CoP1_D[37] = COP1_D_CVT_L; + Jump_CoP1_D[38] = UnknownOpcode; + Jump_CoP1_D[39] = UnknownOpcode; + Jump_CoP1_D[40] = UnknownOpcode; + Jump_CoP1_D[41] = UnknownOpcode; + Jump_CoP1_D[42] = UnknownOpcode; + Jump_CoP1_D[43] = UnknownOpcode; + Jump_CoP1_D[44] = UnknownOpcode; + Jump_CoP1_D[45] = UnknownOpcode; + Jump_CoP1_D[46] = UnknownOpcode; + Jump_CoP1_D[47] = UnknownOpcode; + Jump_CoP1_D[48] = COP1_D_CMP; + Jump_CoP1_D[49] = COP1_D_CMP; + Jump_CoP1_D[50] = COP1_D_CMP; + Jump_CoP1_D[51] = COP1_D_CMP; + Jump_CoP1_D[52] = COP1_D_CMP; + Jump_CoP1_D[53] = COP1_D_CMP; + Jump_CoP1_D[54] = COP1_D_CMP; + Jump_CoP1_D[55] = COP1_D_CMP; + Jump_CoP1_D[56] = COP1_D_CMP; + Jump_CoP1_D[57] = COP1_D_CMP; + Jump_CoP1_D[58] = COP1_D_CMP; + Jump_CoP1_D[59] = COP1_D_CMP; + Jump_CoP1_D[60] = COP1_D_CMP; + Jump_CoP1_D[61] = COP1_D_CMP; + Jump_CoP1_D[62] = COP1_D_CMP; + Jump_CoP1_D[63] = COP1_D_CMP; - return Jump_Opcode; + Jump_CoP1_W[ 0] = UnknownOpcode; + Jump_CoP1_W[ 1] = UnknownOpcode; + Jump_CoP1_W[ 2] = UnknownOpcode; + Jump_CoP1_W[ 3] = UnknownOpcode; + Jump_CoP1_W[ 4] = UnknownOpcode; + Jump_CoP1_W[ 5] = UnknownOpcode; + Jump_CoP1_W[ 6] = UnknownOpcode; + Jump_CoP1_W[ 7] = UnknownOpcode; + Jump_CoP1_W[ 8] = UnknownOpcode; + Jump_CoP1_W[ 9] = UnknownOpcode; + Jump_CoP1_W[10] = UnknownOpcode; + Jump_CoP1_W[11] = UnknownOpcode; + Jump_CoP1_W[12] = UnknownOpcode; + Jump_CoP1_W[13] = UnknownOpcode; + Jump_CoP1_W[14] = UnknownOpcode; + Jump_CoP1_W[15] = UnknownOpcode; + Jump_CoP1_W[16] = UnknownOpcode; + Jump_CoP1_W[17] = UnknownOpcode; + Jump_CoP1_W[18] = UnknownOpcode; + Jump_CoP1_W[19] = UnknownOpcode; + Jump_CoP1_W[20] = UnknownOpcode; + Jump_CoP1_W[21] = UnknownOpcode; + Jump_CoP1_W[22] = UnknownOpcode; + Jump_CoP1_W[23] = UnknownOpcode; + Jump_CoP1_W[24] = UnknownOpcode; + Jump_CoP1_W[25] = UnknownOpcode; + Jump_CoP1_W[26] = UnknownOpcode; + Jump_CoP1_W[27] = UnknownOpcode; + Jump_CoP1_W[28] = UnknownOpcode; + Jump_CoP1_W[29] = UnknownOpcode; + Jump_CoP1_W[30] = UnknownOpcode; + Jump_CoP1_W[31] = UnknownOpcode; + Jump_CoP1_W[32] = COP1_W_CVT_S; + Jump_CoP1_W[33] = COP1_W_CVT_D; + Jump_CoP1_W[34] = UnknownOpcode; + Jump_CoP1_W[35] = UnknownOpcode; + Jump_CoP1_W[36] = UnknownOpcode; + Jump_CoP1_W[37] = UnknownOpcode; + Jump_CoP1_W[38] = UnknownOpcode; + Jump_CoP1_W[39] = UnknownOpcode; + Jump_CoP1_W[40] = UnknownOpcode; + Jump_CoP1_W[41] = UnknownOpcode; + Jump_CoP1_W[42] = UnknownOpcode; + Jump_CoP1_W[43] = UnknownOpcode; + Jump_CoP1_W[44] = UnknownOpcode; + Jump_CoP1_W[45] = UnknownOpcode; + Jump_CoP1_W[46] = UnknownOpcode; + Jump_CoP1_W[47] = UnknownOpcode; + Jump_CoP1_W[48] = UnknownOpcode; + Jump_CoP1_W[49] = UnknownOpcode; + Jump_CoP1_W[50] = UnknownOpcode; + Jump_CoP1_W[51] = UnknownOpcode; + Jump_CoP1_W[52] = UnknownOpcode; + Jump_CoP1_W[53] = UnknownOpcode; + Jump_CoP1_W[54] = UnknownOpcode; + Jump_CoP1_W[55] = UnknownOpcode; + Jump_CoP1_W[56] = UnknownOpcode; + Jump_CoP1_W[57] = UnknownOpcode; + Jump_CoP1_W[58] = UnknownOpcode; + Jump_CoP1_W[59] = UnknownOpcode; + Jump_CoP1_W[60] = UnknownOpcode; + Jump_CoP1_W[61] = UnknownOpcode; + Jump_CoP1_W[62] = UnknownOpcode; + Jump_CoP1_W[63] = UnknownOpcode; + + Jump_CoP1_L[ 0] = UnknownOpcode; + Jump_CoP1_L[ 1] = UnknownOpcode; + Jump_CoP1_L[ 2] = UnknownOpcode; + Jump_CoP1_L[ 3] = UnknownOpcode; + Jump_CoP1_L[ 4] = UnknownOpcode; + Jump_CoP1_L[ 5] = UnknownOpcode; + Jump_CoP1_L[ 6] = UnknownOpcode; + Jump_CoP1_L[ 7] = UnknownOpcode; + Jump_CoP1_L[ 8] = UnknownOpcode; + Jump_CoP1_L[ 9] = UnknownOpcode; + Jump_CoP1_L[10] = UnknownOpcode; + Jump_CoP1_L[11] = UnknownOpcode; + Jump_CoP1_L[12] = UnknownOpcode; + Jump_CoP1_L[13] = UnknownOpcode; + Jump_CoP1_L[14] = UnknownOpcode; + Jump_CoP1_L[15] = UnknownOpcode; + Jump_CoP1_L[16] = UnknownOpcode; + Jump_CoP1_L[17] = UnknownOpcode; + Jump_CoP1_L[18] = UnknownOpcode; + Jump_CoP1_L[19] = UnknownOpcode; + Jump_CoP1_L[20] = UnknownOpcode; + Jump_CoP1_L[21] = UnknownOpcode; + Jump_CoP1_L[22] = UnknownOpcode; + Jump_CoP1_L[23] = UnknownOpcode; + Jump_CoP1_L[24] = UnknownOpcode; + Jump_CoP1_L[25] = UnknownOpcode; + Jump_CoP1_L[26] = UnknownOpcode; + Jump_CoP1_L[27] = UnknownOpcode; + Jump_CoP1_L[28] = UnknownOpcode; + Jump_CoP1_L[29] = UnknownOpcode; + Jump_CoP1_L[30] = UnknownOpcode; + Jump_CoP1_L[31] = UnknownOpcode; + Jump_CoP1_L[32] = COP1_L_CVT_S; + Jump_CoP1_L[33] = COP1_L_CVT_D; + Jump_CoP1_L[34] = UnknownOpcode; + Jump_CoP1_L[35] = UnknownOpcode; + Jump_CoP1_L[36] = UnknownOpcode; + Jump_CoP1_L[37] = UnknownOpcode; + Jump_CoP1_L[38] = UnknownOpcode; + Jump_CoP1_L[39] = UnknownOpcode; + Jump_CoP1_L[40] = UnknownOpcode; + Jump_CoP1_L[41] = UnknownOpcode; + Jump_CoP1_L[42] = UnknownOpcode; + Jump_CoP1_L[43] = UnknownOpcode; + Jump_CoP1_L[44] = UnknownOpcode; + Jump_CoP1_L[45] = UnknownOpcode; + Jump_CoP1_L[46] = UnknownOpcode; + Jump_CoP1_L[47] = UnknownOpcode; + Jump_CoP1_L[48] = UnknownOpcode; + Jump_CoP1_L[49] = UnknownOpcode; + Jump_CoP1_L[50] = UnknownOpcode; + Jump_CoP1_L[51] = UnknownOpcode; + Jump_CoP1_L[52] = UnknownOpcode; + Jump_CoP1_L[53] = UnknownOpcode; + Jump_CoP1_L[54] = UnknownOpcode; + Jump_CoP1_L[55] = UnknownOpcode; + Jump_CoP1_L[56] = UnknownOpcode; + Jump_CoP1_L[57] = UnknownOpcode; + Jump_CoP1_L[58] = UnknownOpcode; + Jump_CoP1_L[59] = UnknownOpcode; + Jump_CoP1_L[60] = UnknownOpcode; + Jump_CoP1_L[61] = UnknownOpcode; + Jump_CoP1_L[62] = UnknownOpcode; + Jump_CoP1_L[63] = UnknownOpcode; + + return Jump_Opcode; } -bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2); +bool DelaySlotEffectsCompare (uint32_t PC, uint32_t Reg1, uint32_t Reg2); -void TestInterpreterJump (DWORD PC, DWORD TargetPC, int Reg1, int Reg2) +void TestInterpreterJump (uint32_t PC, uint32_t TargetPC, int32_t Reg1, int32_t Reg2) { - if (PC != TargetPC) - { - return; - } - if (DelaySlotEffectsCompare(PC,Reg1,Reg2)) - { - return; - } - R4300iOp::m_NextInstruction = PERMLOOP_DO_DELAY; - R4300iOp::m_TestTimer = true; + if (PC != TargetPC) + { + return; + } + if (DelaySlotEffectsCompare(PC,Reg1,Reg2)) + { + return; + } + R4300iOp::m_NextInstruction = PERMLOOP_DO_DELAY; + R4300iOp::m_TestTimer = true; } /************************* Opcode functions *************************/ void R4300iOp::J() { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = ((*_PROGRAM_COUNTER) & 0xF0000000) + (m_Opcode.target << 2); - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = ((*_PROGRAM_COUNTER) & 0xF0000000) + (m_Opcode.target << 2); + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } } void R4300iOp::JAL() { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = ((*_PROGRAM_COUNTER) & 0xF0000000) + (m_Opcode.target << 2); - _GPR[31].DW= (long)((*_PROGRAM_COUNTER) + 8); + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = ((*_PROGRAM_COUNTER) & 0xF0000000) + (m_Opcode.target << 2); + _GPR[31].DW= (int32_t)((*_PROGRAM_COUNTER) + 8); - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } } void R4300iOp::BEQ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].DW == _GPR[m_Opcode.rt].DW) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].DW == _GPR[m_Opcode.rt].DW) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::BNE() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].DW != _GPR[m_Opcode.rt].DW) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].DW != _GPR[m_Opcode.rt].DW) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::BLEZ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].DW <= 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].DW <= 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::BGTZ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].DW > 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].DW > 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::ADDI() { #ifdef Interpreter_StackTest - if (m_Opcode.rs == 29 && m_Opcode.rt == 29) - { - StackValue += (short)m_Opcode.immediate; - } + if (m_Opcode.rs == 29 && m_Opcode.rt == 29) + { + StackValue += (int16_t)m_Opcode.immediate; + } #endif - _GPR[m_Opcode.rt].DW = (_GPR[m_Opcode.rs].W[0] + ((short)m_Opcode.immediate)); + _GPR[m_Opcode.rt].DW = (_GPR[m_Opcode.rs].W[0] + ((int16_t)m_Opcode.immediate)); #ifdef Interpreter_StackTest - if (m_Opcode.rt == 29 && m_Opcode.rs != 29) - { - StackValue = _GPR[m_Opcode.rt].W[0]; - } + if (m_Opcode.rt == 29 && m_Opcode.rs != 29) + { + StackValue = _GPR[m_Opcode.rt].W[0]; + } #endif } void R4300iOp::ADDIU() { #ifdef Interpreter_StackTest - if (m_Opcode.rs == 29 && m_Opcode.rt == 29) - { - StackValue += (short)m_Opcode.immediate; - } + if (m_Opcode.rs == 29 && m_Opcode.rt == 29) + { + StackValue += (int16_t)m_Opcode.immediate; + } #endif - _GPR[m_Opcode.rt].DW = (_GPR[m_Opcode.rs].W[0] + ((short)m_Opcode.immediate)); + _GPR[m_Opcode.rt].DW = (_GPR[m_Opcode.rs].W[0] + ((int16_t)m_Opcode.immediate)); #ifdef Interpreter_StackTest - if (m_Opcode.rt == 29 && m_Opcode.rs != 29) - { - StackValue = _GPR[m_Opcode.rt].W[0]; - } + if (m_Opcode.rt == 29 && m_Opcode.rs != 29) + { + StackValue = _GPR[m_Opcode.rt].W[0]; + } #endif } void R4300iOp::SLTI() { - if (_GPR[m_Opcode.rs].DW < (__int64)((short)m_Opcode.immediate)) - { - _GPR[m_Opcode.rt].DW = 1; - } - else - { - _GPR[m_Opcode.rt].DW = 0; - } + if (_GPR[m_Opcode.rs].DW < (int64_t)((int16_t)m_Opcode.immediate)) + { + _GPR[m_Opcode.rt].DW = 1; + } + else + { + _GPR[m_Opcode.rt].DW = 0; + } } void R4300iOp::SLTIU() { - int imm32 = (short)m_Opcode.immediate; - __int64 imm64; + int32_t imm32 = (int16_t)m_Opcode.immediate; + int64_t imm64; - imm64 = imm32; - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].UDW < (unsigned __int64)imm64?1:0; + imm64 = imm32; + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].UDW < (uint64_t)imm64?1:0; } void R4300iOp::ANDI() { - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].DW & m_Opcode.immediate; + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].DW & m_Opcode.immediate; } void R4300iOp::ORI() { - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].DW | m_Opcode.immediate; + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].DW | m_Opcode.immediate; } void R4300iOp::XORI() { - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].DW ^ m_Opcode.immediate; + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].DW ^ m_Opcode.immediate; } void R4300iOp::LUI() { - _GPR[m_Opcode.rt].DW = (long)((short)m_Opcode.offset << 16); + _GPR[m_Opcode.rt].DW = (int32_t)((int16_t)m_Opcode.offset << 16); #ifdef Interpreter_StackTest - if (m_Opcode.rt == 29) - { - StackValue = _GPR[m_Opcode.rt].W[0]; - } + if (m_Opcode.rt == 29) + { + StackValue = _GPR[m_Opcode.rt].W[0]; + } #endif } void R4300iOp::BEQL() { - if (_GPR[m_Opcode.rs].DW == _GPR[m_Opcode.rt].DW) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].DW == _GPR[m_Opcode.rt].DW) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::BNEL() { - if (_GPR[m_Opcode.rs].DW != _GPR[m_Opcode.rt].DW) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].DW != _GPR[m_Opcode.rt].DW) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,m_Opcode.rt)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::BLEZL() { - if (_GPR[m_Opcode.rs].DW <= 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].DW <= 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::BGTZL() { - if (_GPR[m_Opcode.rs].DW > 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) - { - m_NextInstruction = PERMLOOP_DO_DELAY; - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].DW > 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER,m_Opcode.rs,0)) + { + m_NextInstruction = PERMLOOP_DO_DELAY; + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::DADDIU() { - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].DW + (__int64)((short)m_Opcode.immediate); + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rs].DW + (int64_t)((int16_t)m_Opcode.immediate); } -QWORD LDL_MASK[8] = { 0,0xFF,0xFFFF,0xFFFFFF,0xFFFFFFFF,0xFFFFFFFFFF, - 0xFFFFFFFFFFFF, 0xFFFFFFFFFFFFFF }; -int LDL_SHIFT[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +uint64_t LDL_MASK[8] = { 0,0xFF,0xFFFF,0xFFFFFF,0xFFFFFFFF,0xFFFFFFFFFF, 0xFFFFFFFFFFFF, 0xFFFFFFFFFFFFFF }; +int32_t LDL_SHIFT[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; void R4300iOp::LDL() { - DWORD Offset, Address; - QWORD Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 7; + uint32_t Offset, Address; + uint64_t Value; - if (!g_MMU->LD_VAddr((Address & ~7),Value)) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].DW & LDL_MASK[Offset]; - _GPR[m_Opcode.rt].DW += Value << LDL_SHIFT[Offset]; + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 7; + + if (!g_MMU->LD_VAddr((Address & ~7),Value)) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].DW & LDL_MASK[Offset]; + _GPR[m_Opcode.rt].DW += Value << LDL_SHIFT[Offset]; } -QWORD LDR_MASK[8] = { 0xFFFFFFFFFFFFFF00, 0xFFFFFFFFFFFF0000, - 0xFFFFFFFFFF000000, 0xFFFFFFFF00000000, - 0xFFFFFF0000000000, 0xFFFF000000000000, - 0xFF00000000000000, 0 }; -int LDR_SHIFT[8] = { 56, 48, 40, 32, 24, 16, 8, 0 }; +uint64_t LDR_MASK[8] = { 0xFFFFFFFFFFFFFF00, 0xFFFFFFFFFFFF0000, + 0xFFFFFFFFFF000000, 0xFFFFFFFF00000000, + 0xFFFFFF0000000000, 0xFFFF000000000000, + 0xFF00000000000000, 0 }; +int32_t LDR_SHIFT[8] = { 56, 48, 40, 32, 24, 16, 8, 0 }; void R4300iOp::LDR() { - DWORD Offset, Address; - QWORD Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 7; + uint32_t Offset, Address; + uint64_t Value; - if (!g_MMU->LD_VAddr((Address & ~7),Value)) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 7; - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].DW & LDR_MASK[Offset]; - _GPR[m_Opcode.rt].DW += Value >> LDR_SHIFT[Offset]; + if (!g_MMU->LD_VAddr((Address & ~7),Value)) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].DW & LDR_MASK[Offset]; + _GPR[m_Opcode.rt].DW += Value >> LDR_SHIFT[Offset]; } void R4300iOp::LB() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].B[0]; - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].B[0]; + } } void R4300iOp::LH() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 1) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } - if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].HW[0]; - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 1) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } + if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].HW[0]; + } } void R4300iOp::LWL() { - DWORD Offset, Address, Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 3; + uint32_t Offset, Address, Value; - if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value)) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } - - _GPR[m_Opcode.rt].DW = (int)(_GPR[m_Opcode.rt].W[0] & LWL_MASK[Offset]); - _GPR[m_Opcode.rt].DW += (int)(Value << LWL_SHIFT[Offset]); + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 3; + + if (!g_MMU->LW_VAddr((Address & ~3),Value)) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } + + _GPR[m_Opcode.rt].DW = (int32_t)(_GPR[m_Opcode.rt].W[0] & LWL_MASK[Offset]); + _GPR[m_Opcode.rt].DW += (int32_t)(Value << LWL_SHIFT[Offset]); } void R4300iOp::LW() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } - if (g_LogOptions.GenerateLog) - { - Log_LW((*_PROGRAM_COUNTER),Address); - } + if (g_LogOptions.GenerateLog) + { + Log_LW((*_PROGRAM_COUNTER),Address); + } - if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].W[0]; - } + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].W[0]; + } } void R4300iOp::LBU() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].UDW = _GPR[m_Opcode.rt].UB[0]; - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].UDW = _GPR[m_Opcode.rt].UB[0]; + } } void R4300iOp::LHU() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 1) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } - if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].UDW = _GPR[m_Opcode.rt].UHW[0]; - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 1) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } + if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].UDW = _GPR[m_Opcode.rt].UHW[0]; + } } void R4300iOp::LWR() { - DWORD Offset, Address, Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 3; + uint32_t Offset, Address, Value; - if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value)) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } - - _GPR[m_Opcode.rt].DW = (int)(_GPR[m_Opcode.rt].W[0] & LWR_MASK[Offset]); - _GPR[m_Opcode.rt].DW += (int)(Value >> LWR_SHIFT[Offset]); + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 3; + + if (!g_MMU->LW_VAddr((Address & ~3),Value)) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } + + _GPR[m_Opcode.rt].DW = (int32_t)(_GPR[m_Opcode.rt].W[0] & LWR_MASK[Offset]); + _GPR[m_Opcode.rt].DW += (int32_t)(Value >> LWR_SHIFT[Offset]); } void R4300iOp::LWU() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } - if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].UDW = _GPR[m_Opcode.rt].UW[0]; - } + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].UDW = _GPR[m_Opcode.rt].UW[0]; + } } -void R4300iOp::SB() +void R4300iOp::SB() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if (!g_MMU->SB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if (!g_MMU->SB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } void R4300iOp::SH() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 1) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, false); - } - if (!g_MMU->SH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 1) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, false); + } + if (!g_MMU->SH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } void R4300iOp::SWL() { - DWORD Offset, Address, Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 3; + uint32_t Offset, Address, Value; - if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } - - Value &= SWL_MASK[Offset]; - Value += _GPR[m_Opcode.rt].UW[0] >> SWL_SHIFT[Offset]; + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 3; - if (!g_MMU->SW_VAddr((Address & ~0x03),Value)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + if (!g_MMU->LW_VAddr((Address & ~3),Value)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } + + Value &= SWL_MASK[Offset]; + Value += _GPR[m_Opcode.rt].UW[0] >> SWL_SHIFT[Offset]; + + if (!g_MMU->SW_VAddr((Address & ~0x03),Value)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } - void R4300iOp::SW() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, false); - } - if (g_LogOptions.GenerateLog) - { - Log_SW((*_PROGRAM_COUNTER),Address,_GPR[m_Opcode.rt].UW[0]); - } - if (!g_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, false); + } + if (g_LogOptions.GenerateLog) + { + Log_SW((*_PROGRAM_COUNTER),Address,_GPR[m_Opcode.rt].UW[0]); + } + if (!g_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } -QWORD SDL_MASK[8] = { 0,0xFF00000000000000, - 0xFFFF000000000000, - 0xFFFFFF0000000000, - 0xFFFFFFFF00000000, - 0xFFFFFFFFFF000000, - 0xFFFFFFFFFFFF0000, - 0xFFFFFFFFFFFFFF00 }; +uint64_t SDL_MASK[8] = { 0,0xFF00000000000000, + 0xFFFF000000000000, + 0xFFFFFF0000000000, + 0xFFFFFFFF00000000, + 0xFFFFFFFFFF000000, + 0xFFFFFFFFFFFF0000, + 0xFFFFFFFFFFFFFF00 }; -int SDL_SHIFT[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; +int32_t SDL_SHIFT[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; void R4300iOp::SDL() { - DWORD Offset, Address; - QWORD Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 7; + uint32_t Offset, Address; + uint64_t Value; - if (!g_MMU->LD_VAddr((Address & ~7),Value)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } - - Value &= SDL_MASK[Offset]; - Value += _GPR[m_Opcode.rt].UDW >> SDL_SHIFT[Offset]; + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 7; - if (!g_MMU->SD_VAddr((Address & ~7),Value)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + if (!g_MMU->LD_VAddr((Address & ~7),Value)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } + + Value &= SDL_MASK[Offset]; + Value += _GPR[m_Opcode.rt].UDW >> SDL_SHIFT[Offset]; + + if (!g_MMU->SD_VAddr((Address & ~7),Value)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } -QWORD SDR_MASK[8] = { 0x00FFFFFFFFFFFFFF, - 0x0000FFFFFFFFFFFF, - 0x000000FFFFFFFFFF, - 0x00000000FFFFFFFF, - 0x0000000000FFFFFF, - 0x000000000000FFFF, - 0x00000000000000FF, - 0x0000000000000000 }; +uint64_t SDR_MASK[8] = { 0x00FFFFFFFFFFFFFF, + 0x0000FFFFFFFFFFFF, + 0x000000FFFFFFFFFF, + 0x00000000FFFFFFFF, + 0x0000000000FFFFFF, + 0x000000000000FFFF, + 0x00000000000000FF, + 0x0000000000000000 }; -int SDR_SHIFT[8] = { 56,48,40,32,24,16,8,0 }; +int32_t SDR_SHIFT[8] = { 56,48,40,32,24,16,8,0 }; void R4300iOp::SDR() { - DWORD Offset, Address; - QWORD Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 7; + uint32_t Offset, Address; + uint64_t Value; - if (!g_MMU->LD_VAddr((Address & ~7),Value)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } - - Value &= SDR_MASK[Offset]; - Value += _GPR[m_Opcode.rt].UDW << SDR_SHIFT[Offset]; + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 7; - if (!g_MMU->SD_VAddr((Address & ~7),Value)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + if (!g_MMU->LD_VAddr((Address & ~7),Value)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } + + Value &= SDR_MASK[Offset]; + Value += _GPR[m_Opcode.rt].UDW << SDR_SHIFT[Offset]; + + if (!g_MMU->SD_VAddr((Address & ~7),Value)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } void R4300iOp::SWR() { - DWORD Offset, Address, Value; - - Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - Offset = Address & 3; + uint32_t Offset, Address, Value; - if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } - - Value &= SWR_MASK[Offset]; - Value += _GPR[m_Opcode.rt].UW[0] << SWR_SHIFT[Offset]; + Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + Offset = Address & 3; - if (!g_MMU->SW_VAddr((Address & ~0x03),Value)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + if (!g_MMU->LW_VAddr((Address & ~3),Value)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } + + Value &= SWR_MASK[Offset]; + Value += _GPR[m_Opcode.rt].UW[0] << SWR_SHIFT[Offset]; + + if (!g_MMU->SW_VAddr((Address & ~0x03),Value)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } -void R4300iOp::CACHE() +void R4300iOp::CACHE() { - if (!g_LogOptions.LogCache) - { - return; - } - LogMessage("%08X: Cache operation %d, 0x%08X", (*_PROGRAM_COUNTER), m_Opcode.rt, - _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset ); + if (!g_LogOptions.LogCache) + { + return; + } + LogMessage("%08X: Cache operation %d, 0x%08X", (*_PROGRAM_COUNTER), m_Opcode.rt, _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset ); } -void R4300iOp::LL() +void R4300iOp::LL() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } - if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } - else - { - _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].W[0]; - (*_LLBit) = 1; - } + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } + else + { + _GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].W[0]; + (*_LLBit) = 1; + } } -void R4300iOp::LWC1() +void R4300iOp::LWC1() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (DWORD)((short)m_Opcode.offset); - TEST_COP1_USABLE_EXCEPTION - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } - if (!g_MMU->LW_VAddr(Address,*(uint32_t *)_FPR_S[m_Opcode.ft])) - { - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - TLB_READ_EXCEPTION(Address); - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (uint32_t)((int16_t)m_Opcode.offset); + TEST_COP1_USABLE_EXCEPTION + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } + if (!g_MMU->LW_VAddr(Address,*(uint32_t *)_FPR_S[m_Opcode.ft])) + { + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + TLB_READ_EXCEPTION(Address); + } } void R4300iOp::SC() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, false); - } - Log_SW((*_PROGRAM_COUNTER),Address,_GPR[m_Opcode.rt].UW[0]); - if ((*_LLBit) == 1) - { - if (!g_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } - } - _GPR[m_Opcode.rt].UW[0] = (*_LLBit); + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, false); + } + Log_SW((*_PROGRAM_COUNTER),Address,_GPR[m_Opcode.rt].UW[0]); + if ((*_LLBit) == 1) + { + if (!g_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } + } + _GPR[m_Opcode.rt].UW[0] = (*_LLBit); } void R4300iOp::LD() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 7) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } - if (!g_MMU->LD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - return; - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 7) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } + if (!g_MMU->LD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + return; + } #ifdef Interpreter_StackTest - if (m_Opcode.rt == 29) - { - StackValue = _GPR[m_Opcode.rt].W[0]; - } + if (m_Opcode.rt == 29) + { + StackValue = _GPR[m_Opcode.rt].W[0]; + } #endif } - void R4300iOp::LDC1() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; - TEST_COP1_USABLE_EXCEPTION - if ((Address & 7) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, true); - } - if (!g_MMU->LD_VAddr(Address,*(unsigned __int64 *)_FPR_D[m_Opcode.ft])) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + TEST_COP1_USABLE_EXCEPTION + if ((Address & 7) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, true); + } + if (!g_MMU->LD_VAddr(Address,*(uint64_t *)_FPR_D[m_Opcode.ft])) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } void R4300iOp::SWC1() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - TEST_COP1_USABLE_EXCEPTION - if ((Address & 3) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, false); - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + TEST_COP1_USABLE_EXCEPTION + if ((Address & 3) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, false); + } - if (!g_MMU->SW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + if (!g_MMU->SW_VAddr(Address,*(uint32_t *)_FPR_S[m_Opcode.ft])) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } void R4300iOp::SDC1() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; - TEST_COP1_USABLE_EXCEPTION - if ((Address & 7) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, false); - } - if (!g_MMU->SD_VAddr(Address,*(__int64 *)_FPR_D[m_Opcode.ft])) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + TEST_COP1_USABLE_EXCEPTION + if ((Address & 7) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, false); + } + if (!g_MMU->SD_VAddr(Address,*(int64_t *)_FPR_D[m_Opcode.ft])) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } -void R4300iOp::SD() +void R4300iOp::SD() { - DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if ((Address & 7) != 0) - { - ADDRESS_ERROR_EXCEPTION(Address, false); - } - if (!g_MMU->SD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) - { - if (bHaveDebugger()) - { - g_Notify->BreakPoint(__FILEW__,__LINE__); - } - if (bShowTLBMisses()) - { - g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); - } - } + uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset; + if ((Address & 7) != 0) + { + ADDRESS_ERROR_EXCEPTION(Address, false); + } + if (!g_MMU->SD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) + { + if (bHaveDebugger()) + { + g_Notify->BreakPoint(__FILEW__,__LINE__); + } + if (bShowTLBMisses()) + { + g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str()); + } + } } /********************** R4300i OpCodes: Special **********************/ void R4300iOp::SPECIAL_SLL() { - _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].W[0] << m_Opcode.sa); + _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].W[0] << m_Opcode.sa); } void R4300iOp::SPECIAL_SRL() { - _GPR[m_Opcode.rd].DW = (int)(_GPR[m_Opcode.rt].UW[0] >> m_Opcode.sa); + _GPR[m_Opcode.rd].DW = (int32_t)(_GPR[m_Opcode.rt].UW[0] >> m_Opcode.sa); } void R4300iOp::SPECIAL_SRA() { - _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].W[0] >> m_Opcode.sa); + _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].W[0] >> m_Opcode.sa); } void R4300iOp::SPECIAL_SLLV() { - _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].W[0] << (_GPR[m_Opcode.rs].UW[0] & 0x1F)); + _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].W[0] << (_GPR[m_Opcode.rs].UW[0] & 0x1F)); } void R4300iOp::SPECIAL_SRLV() { - _GPR[m_Opcode.rd].DW = (int)(_GPR[m_Opcode.rt].UW[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F)); + _GPR[m_Opcode.rd].DW = (int32_t)(_GPR[m_Opcode.rt].UW[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F)); } void R4300iOp::SPECIAL_SRAV() { - _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].W[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F)); + _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].W[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F)); } void R4300iOp::SPECIAL_JR() { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = _GPR[m_Opcode.rs].UW[0]; - m_TestTimer = true; + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = _GPR[m_Opcode.rs].UW[0]; + m_TestTimer = true; } void R4300iOp::SPECIAL_JALR() { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = _GPR[m_Opcode.rs].UW[0]; - _GPR[m_Opcode.rd].DW = (long)((*_PROGRAM_COUNTER) + 8); - m_TestTimer = true; + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = _GPR[m_Opcode.rs].UW[0]; + _GPR[m_Opcode.rd].DW = (int32_t)((*_PROGRAM_COUNTER) + 8); + m_TestTimer = true; } void R4300iOp::SPECIAL_SYSCALL() { - g_Reg->DoSysCallException(m_NextInstruction == JUMP); - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER); + g_Reg->DoSysCallException(m_NextInstruction == JUMP); + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER); } void R4300iOp::SPECIAL_BREAK() { - g_Reg->DoBreakException(m_NextInstruction == JUMP); - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER); + g_Reg->DoBreakException(m_NextInstruction == JUMP); + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER); } void R4300iOp::SPECIAL_SYNC() { - } void R4300iOp::SPECIAL_MFHI() { - _GPR[m_Opcode.rd].DW = _RegHI->DW; + _GPR[m_Opcode.rd].DW = _RegHI->DW; } void R4300iOp::SPECIAL_MTHI() { - _RegHI->DW = _GPR[m_Opcode.rs].DW; + _RegHI->DW = _GPR[m_Opcode.rs].DW; } void R4300iOp::SPECIAL_MFLO() { - _GPR[m_Opcode.rd].DW = _RegLO->DW; + _GPR[m_Opcode.rd].DW = _RegLO->DW; } void R4300iOp::SPECIAL_MTLO() { - _RegLO->DW = _GPR[m_Opcode.rs].DW; + _RegLO->DW = _GPR[m_Opcode.rs].DW; } void R4300iOp::SPECIAL_DSLLV() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rt].DW << (_GPR[m_Opcode.rs].UW[0] & 0x3F); + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rt].DW << (_GPR[m_Opcode.rs].UW[0] & 0x3F); } void R4300iOp::SPECIAL_DSRLV() { - _GPR[m_Opcode.rd].UDW = _GPR[m_Opcode.rt].UDW >> (_GPR[m_Opcode.rs].UW[0] & 0x3F); + _GPR[m_Opcode.rd].UDW = _GPR[m_Opcode.rt].UDW >> (_GPR[m_Opcode.rs].UW[0] & 0x3F); } void R4300iOp::SPECIAL_DSRAV() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rt].DW >> (_GPR[m_Opcode.rs].UW[0] & 0x3F); + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rt].DW >> (_GPR[m_Opcode.rs].UW[0] & 0x3F); } void R4300iOp::SPECIAL_MULT() { - _RegHI->DW = (__int64)(_GPR[m_Opcode.rs].W[0]) * (__int64)(_GPR[m_Opcode.rt].W[0]); - _RegLO->DW = _RegHI->W[0]; - _RegHI->DW = _RegHI->W[1]; + _RegHI->DW = (int64_t)(_GPR[m_Opcode.rs].W[0]) * (int64_t)(_GPR[m_Opcode.rt].W[0]); + _RegLO->DW = _RegHI->W[0]; + _RegHI->DW = _RegHI->W[1]; } void R4300iOp::SPECIAL_MULTU() { - _RegHI->DW = (unsigned __int64)(_GPR[m_Opcode.rs].UW[0]) * (unsigned __int64)(_GPR[m_Opcode.rt].UW[0]); - _RegLO->DW = _RegHI->W[0]; - _RegHI->DW = _RegHI->W[1]; + _RegHI->DW = (uint64_t)(_GPR[m_Opcode.rs].UW[0]) * (uint64_t)(_GPR[m_Opcode.rt].UW[0]); + _RegLO->DW = _RegHI->W[0]; + _RegHI->DW = _RegHI->W[1]; } void R4300iOp::SPECIAL_DIV() { - if ( _GPR[m_Opcode.rt].UDW != 0 ) - { - _RegLO->DW = _GPR[m_Opcode.rs].W[0] / _GPR[m_Opcode.rt].W[0]; - _RegHI->DW = _GPR[m_Opcode.rs].W[0] % _GPR[m_Opcode.rt].W[0]; - } - else - { - if (bShowDivByZero()) - { - g_Notify->DisplayError(L"DIV by 0 ???"); - } - _RegLO->DW = 0; - _RegHI->DW = 0; - } + if ( _GPR[m_Opcode.rt].UDW != 0 ) + { + _RegLO->DW = _GPR[m_Opcode.rs].W[0] / _GPR[m_Opcode.rt].W[0]; + _RegHI->DW = _GPR[m_Opcode.rs].W[0] % _GPR[m_Opcode.rt].W[0]; + } + else + { + if (bShowDivByZero()) + { + g_Notify->DisplayError(L"DIV by 0 ???"); + } + _RegLO->DW = 0; + _RegHI->DW = 0; + } } void R4300iOp::SPECIAL_DIVU() { - if (_GPR[m_Opcode.rt].UW[0] != 0) - { - _RegLO->DW = (int)(_GPR[m_Opcode.rs].UW[0] / _GPR[m_Opcode.rt].UW[0]); - _RegHI->DW = (int)(_GPR[m_Opcode.rs].UW[0] % _GPR[m_Opcode.rt].UW[0]); - } - else - { - if (bShowDivByZero()) - { - g_Notify->DisplayError(L"DIVU by 0 ???"); - } - _RegLO->DW = 0; - _RegHI->DW = 0; - } + if (_GPR[m_Opcode.rt].UW[0] != 0) + { + _RegLO->DW = (int32_t)(_GPR[m_Opcode.rs].UW[0] / _GPR[m_Opcode.rt].UW[0]); + _RegHI->DW = (int32_t)(_GPR[m_Opcode.rs].UW[0] % _GPR[m_Opcode.rt].UW[0]); + } + else + { + if (bShowDivByZero()) + { + g_Notify->DisplayError(L"DIVU by 0 ???"); + } + _RegLO->DW = 0; + _RegHI->DW = 0; + } } void R4300iOp::SPECIAL_DMULT() { - MIPS_DWORD Tmp[3]; - - _RegLO->UDW = (QWORD)_GPR[m_Opcode.rs].UW[0] * (QWORD)_GPR[m_Opcode.rt].UW[0]; - Tmp[0].UDW = (__int64)_GPR[m_Opcode.rs].W[1] * (__int64)(QWORD)_GPR[m_Opcode.rt].UW[0]; - Tmp[1].UDW = (__int64)(QWORD)_GPR[m_Opcode.rs].UW[0] * (__int64)_GPR[m_Opcode.rt].W[1]; - _RegHI->UDW = (__int64)_GPR[m_Opcode.rs].W[1] * (__int64)_GPR[m_Opcode.rt].W[1]; - - Tmp[2].UDW = (QWORD)_RegLO->UW[1] + (QWORD)Tmp[0].UW[0] + (QWORD)Tmp[1].UW[0]; - _RegLO->UDW += ((QWORD)Tmp[0].UW[0] + (QWORD)Tmp[1].UW[0]) << 32; - _RegHI->UDW += (QWORD)Tmp[0].W[1] + (QWORD)Tmp[1].W[1] + Tmp[2].UW[1]; + MIPS_DWORD Tmp[3]; + + _RegLO->UDW = (uint64_t)_GPR[m_Opcode.rs].UW[0] * (uint64_t)_GPR[m_Opcode.rt].UW[0]; + Tmp[0].UDW = (int64_t)_GPR[m_Opcode.rs].W[1] * (int64_t)(uint64_t)_GPR[m_Opcode.rt].UW[0]; + Tmp[1].UDW = (int64_t)(uint64_t)_GPR[m_Opcode.rs].UW[0] * (int64_t)_GPR[m_Opcode.rt].W[1]; + _RegHI->UDW = (int64_t)_GPR[m_Opcode.rs].W[1] * (int64_t)_GPR[m_Opcode.rt].W[1]; + + Tmp[2].UDW = (uint64_t)_RegLO->UW[1] + (uint64_t)Tmp[0].UW[0] + (uint64_t)Tmp[1].UW[0]; + _RegLO->UDW += ((uint64_t)Tmp[0].UW[0] + (uint64_t)Tmp[1].UW[0]) << 32; + _RegHI->UDW += (uint64_t)Tmp[0].W[1] + (uint64_t)Tmp[1].W[1] + Tmp[2].UW[1]; } -void R4300iOp::SPECIAL_DMULTU() +void R4300iOp::SPECIAL_DMULTU() { - MIPS_DWORD Tmp[3]; - - _RegLO->UDW = (QWORD)_GPR[m_Opcode.rs].UW[0] * (QWORD)_GPR[m_Opcode.rt].UW[0]; - Tmp[0].UDW = (QWORD)_GPR[m_Opcode.rs].UW[1] * (QWORD)_GPR[m_Opcode.rt].UW[0]; - Tmp[1].UDW = (QWORD)_GPR[m_Opcode.rs].UW[0] * (QWORD)_GPR[m_Opcode.rt].UW[1]; - _RegHI->UDW = (QWORD)_GPR[m_Opcode.rs].UW[1] * (QWORD)_GPR[m_Opcode.rt].UW[1]; - - Tmp[2].UDW = (QWORD)_RegLO->UW[1] + (QWORD)Tmp[0].UW[0] + (QWORD)Tmp[1].UW[0]; - _RegLO->UDW += ((QWORD)Tmp[0].UW[0] + (QWORD)Tmp[1].UW[0]) << 32; - _RegHI->UDW += (QWORD)Tmp[0].UW[1] + (QWORD)Tmp[1].UW[1] + Tmp[2].UW[1]; + MIPS_DWORD Tmp[3]; + + _RegLO->UDW = (uint64_t)_GPR[m_Opcode.rs].UW[0] * (uint64_t)_GPR[m_Opcode.rt].UW[0]; + Tmp[0].UDW = (uint64_t)_GPR[m_Opcode.rs].UW[1] * (uint64_t)_GPR[m_Opcode.rt].UW[0]; + Tmp[1].UDW = (uint64_t)_GPR[m_Opcode.rs].UW[0] * (uint64_t)_GPR[m_Opcode.rt].UW[1]; + _RegHI->UDW = (uint64_t)_GPR[m_Opcode.rs].UW[1] * (uint64_t)_GPR[m_Opcode.rt].UW[1]; + + Tmp[2].UDW = (uint64_t)_RegLO->UW[1] + (uint64_t)Tmp[0].UW[0] + (uint64_t)Tmp[1].UW[0]; + _RegLO->UDW += ((uint64_t)Tmp[0].UW[0] + (uint64_t)Tmp[1].UW[0]) << 32; + _RegHI->UDW += (uint64_t)Tmp[0].UW[1] + (uint64_t)Tmp[1].UW[1] + Tmp[2].UW[1]; } void R4300iOp::SPECIAL_DDIV() { - if ( _GPR[m_Opcode.rt].UDW != 0 ) - { - _RegLO->DW = _GPR[m_Opcode.rs].DW / _GPR[m_Opcode.rt].DW; - _RegHI->DW = _GPR[m_Opcode.rs].DW % _GPR[m_Opcode.rt].DW; - } - else - { - if (bHaveDebugger()) - { - g_Notify->DisplayError(L"DDIV by 0 ???"); - } - } + if ( _GPR[m_Opcode.rt].UDW != 0 ) + { + _RegLO->DW = _GPR[m_Opcode.rs].DW / _GPR[m_Opcode.rt].DW; + _RegHI->DW = _GPR[m_Opcode.rs].DW % _GPR[m_Opcode.rt].DW; + } + else + { + if (bHaveDebugger()) + { + g_Notify->DisplayError(L"DDIV by 0 ???"); + } + } } void R4300iOp::SPECIAL_DDIVU() { - if ( _GPR[m_Opcode.rt].UDW != 0 ) - { - _RegLO->UDW = _GPR[m_Opcode.rs].UDW / _GPR[m_Opcode.rt].UDW; - _RegHI->UDW = _GPR[m_Opcode.rs].UDW % _GPR[m_Opcode.rt].UDW; - } - else - { - if (bHaveDebugger()) - { - g_Notify->DisplayError(L"DDIVU by 0 ???"); - } - } + if ( _GPR[m_Opcode.rt].UDW != 0 ) + { + _RegLO->UDW = _GPR[m_Opcode.rs].UDW / _GPR[m_Opcode.rt].UDW; + _RegHI->UDW = _GPR[m_Opcode.rs].UDW % _GPR[m_Opcode.rt].UDW; + } + else + { + if (bHaveDebugger()) + { + g_Notify->DisplayError(L"DDIVU by 0 ???"); + } + } } void R4300iOp::SPECIAL_ADD() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].W[0] + _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].W[0] + _GPR[m_Opcode.rt].W[0]; } void R4300iOp::SPECIAL_ADDU() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].W[0] + _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].W[0] + _GPR[m_Opcode.rt].W[0]; } void R4300iOp::SPECIAL_SUB() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].W[0] - _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].W[0] - _GPR[m_Opcode.rt].W[0]; } void R4300iOp::SPECIAL_SUBU() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].W[0] - _GPR[m_Opcode.rt].W[0]; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].W[0] - _GPR[m_Opcode.rt].W[0]; } void R4300iOp::SPECIAL_AND() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW & _GPR[m_Opcode.rt].DW; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW & _GPR[m_Opcode.rt].DW; } void R4300iOp::SPECIAL_OR() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW | _GPR[m_Opcode.rt].DW; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW | _GPR[m_Opcode.rt].DW; #ifdef Interpreter_StackTest - if (m_Opcode.rd == 29) - { - StackValue = _GPR[m_Opcode.rd].W[0]; - } + if (m_Opcode.rd == 29) + { + StackValue = _GPR[m_Opcode.rd].W[0]; + } #endif } void R4300iOp::SPECIAL_XOR() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW ^ _GPR[m_Opcode.rt].DW; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW ^ _GPR[m_Opcode.rt].DW; } void R4300iOp::SPECIAL_NOR() { - _GPR[m_Opcode.rd].DW = ~(_GPR[m_Opcode.rs].DW | _GPR[m_Opcode.rt].DW); + _GPR[m_Opcode.rd].DW = ~(_GPR[m_Opcode.rs].DW | _GPR[m_Opcode.rt].DW); } void R4300iOp::SPECIAL_SLT() { - if (_GPR[m_Opcode.rs].DW < _GPR[m_Opcode.rt].DW) - { - _GPR[m_Opcode.rd].DW = 1; - } - else - { - _GPR[m_Opcode.rd].DW = 0; - } + if (_GPR[m_Opcode.rs].DW < _GPR[m_Opcode.rt].DW) + { + _GPR[m_Opcode.rd].DW = 1; + } + else + { + _GPR[m_Opcode.rd].DW = 0; + } } void R4300iOp::SPECIAL_SLTU() { - if (_GPR[m_Opcode.rs].UDW < _GPR[m_Opcode.rt].UDW) - { - _GPR[m_Opcode.rd].DW = 1; - } - else - { - _GPR[m_Opcode.rd].DW = 0; - } + if (_GPR[m_Opcode.rs].UDW < _GPR[m_Opcode.rt].UDW) + { + _GPR[m_Opcode.rd].DW = 1; + } + else + { + _GPR[m_Opcode.rd].DW = 0; + } } void R4300iOp::SPECIAL_DADD() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW + _GPR[m_Opcode.rt].DW; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW + _GPR[m_Opcode.rt].DW; } void R4300iOp::SPECIAL_DADDU() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW + _GPR[m_Opcode.rt].DW; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW + _GPR[m_Opcode.rt].DW; } void R4300iOp::SPECIAL_DSUB() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW - _GPR[m_Opcode.rt].DW; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW - _GPR[m_Opcode.rt].DW; } void R4300iOp::SPECIAL_DSUBU() { - _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW - _GPR[m_Opcode.rt].DW; + _GPR[m_Opcode.rd].DW = _GPR[m_Opcode.rs].DW - _GPR[m_Opcode.rt].DW; } void R4300iOp::SPECIAL_TEQ() { - if (_GPR[m_Opcode.rs].DW == _GPR[m_Opcode.rt].DW && bHaveDebugger()) - { - g_Notify->DisplayError(L"Should trap this ???"); - } + if (_GPR[m_Opcode.rs].DW == _GPR[m_Opcode.rt].DW && bHaveDebugger()) + { + g_Notify->DisplayError(L"Should trap this ???"); + } } void R4300iOp::SPECIAL_DSLL() { - _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].DW << m_Opcode.sa); + _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].DW << m_Opcode.sa); } void R4300iOp::SPECIAL_DSRL() { - _GPR[m_Opcode.rd].UDW = (_GPR[m_Opcode.rt].UDW >> m_Opcode.sa); + _GPR[m_Opcode.rd].UDW = (_GPR[m_Opcode.rt].UDW >> m_Opcode.sa); } void R4300iOp::SPECIAL_DSRA() { - _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].DW >> m_Opcode.sa); + _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].DW >> m_Opcode.sa); } void R4300iOp::SPECIAL_DSLL32() { - _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].DW << (m_Opcode.sa + 32)); + _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].DW << (m_Opcode.sa + 32)); } void R4300iOp::SPECIAL_DSRL32() { - _GPR[m_Opcode.rd].UDW = (_GPR[m_Opcode.rt].UDW >> (m_Opcode.sa + 32)); + _GPR[m_Opcode.rd].UDW = (_GPR[m_Opcode.rt].UDW >> (m_Opcode.sa + 32)); } void R4300iOp::SPECIAL_DSRA32() { - _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].DW >> (m_Opcode.sa + 32)); + _GPR[m_Opcode.rd].DW = (_GPR[m_Opcode.rt].DW >> (m_Opcode.sa + 32)); } /********************** R4300i OpCodes: RegImm **********************/ void R4300iOp::REGIMM_BLTZ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].DW < 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].DW < 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::REGIMM_BGEZ() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].DW >= 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].DW >= 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::REGIMM_BLTZL() { - if (_GPR[m_Opcode.rs].DW < 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].DW < 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::REGIMM_BGEZL() { - if (_GPR[m_Opcode.rs].DW >= 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + if (_GPR[m_Opcode.rs].DW >= 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::REGIMM_BLTZAL() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].DW < 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } - _GPR[31].DW= (long)((*_PROGRAM_COUNTER) + 8); + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].DW < 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } + _GPR[31].DW= (int32_t)((*_PROGRAM_COUNTER) + 8); } void R4300iOp::REGIMM_BGEZAL() { - m_NextInstruction = DELAY_SLOT; - if (_GPR[m_Opcode.rs].DW >= 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - if ((*_PROGRAM_COUNTER) == m_JumpToLocation) - { - if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) - { - CInterpreterCPU::InPermLoop(); - } - } - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } - _GPR[31].DW = (long)((*_PROGRAM_COUNTER) + 8); + m_NextInstruction = DELAY_SLOT; + if (_GPR[m_Opcode.rs].DW >= 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + if ((*_PROGRAM_COUNTER) == m_JumpToLocation) + { + if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER),m_Opcode.rs,0)) + { + CInterpreterCPU::InPermLoop(); + } + } + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } + _GPR[31].DW = (int32_t)((*_PROGRAM_COUNTER) + 8); } /************************** COP0 functions **************************/ -void R4300iOp::COP0_MF() +void R4300iOp::COP0_MF() { - if (g_LogOptions.LogCP0reads) - { - LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]); - } + if (g_LogOptions.LogCP0reads) + { + LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]); + } - if (m_Opcode.rd == 9) - { - g_SystemTimer->UpdateTimers(); - } - _GPR[m_Opcode.rt].DW = (int)_CP0[m_Opcode.rd]; + if (m_Opcode.rd == 9) + { + g_SystemTimer->UpdateTimers(); + } + _GPR[m_Opcode.rt].DW = (int32_t)_CP0[m_Opcode.rd]; } void R4300iOp::COP0_MT() { - if (g_LogOptions.LogCP0changes) - { - LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)",(*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0],CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]); - if (m_Opcode.rd == 11) //Compare - { - LogMessage("%08X: Cause register changed from %08X to %08X",(*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7)); - } - } + if (g_LogOptions.LogCP0changes) + { + LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)",(*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0],CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]); + if (m_Opcode.rd == 11) //Compare + { + LogMessage("%08X: Cause register changed from %08X to %08X",(*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7)); + } + } - switch (m_Opcode.rd) - { - case 0: //Index - case 2: //EntryLo0 - case 3: //EntryLo1 - case 5: //PageMask - case 10: //Entry Hi - case 14: //EPC - case 16: //Config - case 18: //WatchLo - case 19: //WatchHi - case 28: //Tag lo - case 29: //Tag Hi - case 30: //ErrEPC - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - break; - case 6: //Wired - g_SystemTimer->UpdateTimers(); - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - break; - case 4: //Context - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0] & 0xFF800000; - break; - case 9: //Count - g_SystemTimer->UpdateTimers(); - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - g_SystemTimer->UpdateCompareTimer(); - break; - case 11: //Compare - g_SystemTimer->UpdateTimers(); - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7; - g_SystemTimer->UpdateCompareTimer(); - break; - case 12: //Status - if ((_CP0[m_Opcode.rd] & STATUS_FR) != (_GPR[m_Opcode.rt].UW[0] & STATUS_FR)) - { - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - g_Reg->FixFpuLocations(); - } - else - { - _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; - } - if ((_CP0[m_Opcode.rd] & 0x18) != 0 && bHaveDebugger()) - { - g_Notify->DisplayError(L"Left kernel mode ??"); - } - g_Reg->CheckInterrupts(); - break; - case 13: //cause - _CP0[m_Opcode.rd] &= 0xFFFFCFF; - if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && bHaveDebugger()) - { - g_Notify->DisplayError(L"Set IP0 or IP1"); - } - break; - default: - UnknownOpcode(); - } + switch (m_Opcode.rd) + { + case 0: //Index + case 2: //EntryLo0 + case 3: //EntryLo1 + case 5: //PageMask + case 10: //Entry Hi + case 14: //EPC + case 16: //Config + case 18: //WatchLo + case 19: //WatchHi + case 28: //Tag lo + case 29: //Tag Hi + case 30: //ErrEPC + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + break; + case 6: //Wired + g_SystemTimer->UpdateTimers(); + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + break; + case 4: //Context + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0] & 0xFF800000; + break; + case 9: //Count + g_SystemTimer->UpdateTimers(); + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + g_SystemTimer->UpdateCompareTimer(); + break; + case 11: //Compare + g_SystemTimer->UpdateTimers(); + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7; + g_SystemTimer->UpdateCompareTimer(); + break; + case 12: //Status + if ((_CP0[m_Opcode.rd] & STATUS_FR) != (_GPR[m_Opcode.rt].UW[0] & STATUS_FR)) + { + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + g_Reg->FixFpuLocations(); + } + else + { + _CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0]; + } + if ((_CP0[m_Opcode.rd] & 0x18) != 0 && bHaveDebugger()) + { + g_Notify->DisplayError(L"Left kernel mode ??"); + } + g_Reg->CheckInterrupts(); + break; + case 13: //cause + _CP0[m_Opcode.rd] &= 0xFFFFCFF; + if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && bHaveDebugger()) + { + g_Notify->DisplayError(L"Set IP0 or IP1"); + } + break; + default: + UnknownOpcode(); + } } /************************** COP0 CO functions ***********************/ void R4300iOp::COP0_CO_TLBR() { - if (!g_System->bUseTlb()) - { - return; - } - g_TLB->ReadEntry(); + if (!g_System->bUseTlb()) + { + return; + } + g_TLB->ReadEntry(); } void R4300iOp::COP0_CO_TLBWI() { - if (!g_System->bUseTlb()) - { - return; - } - g_TLB->WriteEntry(g_Reg->INDEX_REGISTER & 0x1F, false); + if (!g_System->bUseTlb()) + { + return; + } + g_TLB->WriteEntry(g_Reg->INDEX_REGISTER & 0x1F, false); } void R4300iOp::COP0_CO_TLBWR() { - if (!g_System->bUseTlb()) - { - return; - } - g_TLB->WriteEntry(g_Reg->RANDOM_REGISTER & 0x1F,true); + if (!g_System->bUseTlb()) + { + return; + } + g_TLB->WriteEntry(g_Reg->RANDOM_REGISTER & 0x1F,true); } void R4300iOp::COP0_CO_TLBP() { - if (!g_System->bUseTlb()) - { - return; - } - g_TLB->Probe(); + if (!g_System->bUseTlb()) + { + return; + } + g_TLB->Probe(); } void R4300iOp::COP0_CO_ERET() { - m_NextInstruction = JUMP; - if ((g_Reg->STATUS_REGISTER & STATUS_ERL) != 0) - { - m_JumpToLocation = g_Reg->ERROREPC_REGISTER; - g_Reg->STATUS_REGISTER &= ~STATUS_ERL; - } - else - { - m_JumpToLocation = g_Reg->EPC_REGISTER; - g_Reg->STATUS_REGISTER &= ~STATUS_EXL; - } - (*_LLBit) = 0; - g_Reg->CheckInterrupts(); - m_TestTimer = true; + m_NextInstruction = JUMP; + if ((g_Reg->STATUS_REGISTER & STATUS_ERL) != 0) + { + m_JumpToLocation = g_Reg->ERROREPC_REGISTER; + g_Reg->STATUS_REGISTER &= ~STATUS_ERL; + } + else + { + m_JumpToLocation = g_Reg->EPC_REGISTER; + g_Reg->STATUS_REGISTER &= ~STATUS_EXL; + } + (*_LLBit) = 0; + g_Reg->CheckInterrupts(); + m_TestTimer = true; } /************************** COP1 functions **************************/ void R4300iOp::COP1_MF() { - TEST_COP1_USABLE_EXCEPTION - _GPR[m_Opcode.rt].DW = *(int *)_FPR_S[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _GPR[m_Opcode.rt].DW = *(int32_t *)_FPR_S[m_Opcode.fs]; } void R4300iOp::COP1_DMF() { - TEST_COP1_USABLE_EXCEPTION - _GPR[m_Opcode.rt].DW = *(__int64 *)_FPR_D[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _GPR[m_Opcode.rt].DW = *(int64_t *)_FPR_D[m_Opcode.fs]; } void R4300iOp::COP1_CF() { - TEST_COP1_USABLE_EXCEPTION - if (m_Opcode.fs != 31 && m_Opcode.fs != 0) - { - if (bHaveDebugger()) - { - g_Notify->DisplayError(L"CFC1 what register are you writing to ?"); - } - return; - } - _GPR[m_Opcode.rt].DW = (int)_FPCR[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + if (m_Opcode.fs != 31 && m_Opcode.fs != 0) + { + if (bHaveDebugger()) + { + g_Notify->DisplayError(L"CFC1 what register are you writing to ?"); + } + return; + } + _GPR[m_Opcode.rt].DW = (int32_t)_FPCR[m_Opcode.fs]; } void R4300iOp::COP1_MT() { - TEST_COP1_USABLE_EXCEPTION - *(int *)_FPR_S[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0]; + TEST_COP1_USABLE_EXCEPTION + *(int32_t *)_FPR_S[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0]; } void R4300iOp::COP1_DMT() { - TEST_COP1_USABLE_EXCEPTION - *(__int64 *)_FPR_D[m_Opcode.fs] = _GPR[m_Opcode.rt].DW; + TEST_COP1_USABLE_EXCEPTION + *(int64_t *)_FPR_D[m_Opcode.fs] = _GPR[m_Opcode.rt].DW; } void R4300iOp::COP1_CT() { - TEST_COP1_USABLE_EXCEPTION - if (m_Opcode.fs == 31) { - _FPCR[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0]; - switch ((_FPCR[m_Opcode.fs] & 3)) - { - case 0: *_RoundingModel = ROUND_NEAR; break; - case 1: *_RoundingModel = ROUND_CHOP; break; - case 2: *_RoundingModel = ROUND_UP; break; - case 3: *_RoundingModel = ROUND_DOWN; break; - } - return; - } - if (bHaveDebugger()) - { - g_Notify->DisplayError(L"CTC1 what register are you writing to ?"); - } + TEST_COP1_USABLE_EXCEPTION + if (m_Opcode.fs == 31) { + _FPCR[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0]; + switch ((_FPCR[m_Opcode.fs] & 3)) + { + case 0: *_RoundingModel = ROUND_NEAR; break; + case 1: *_RoundingModel = ROUND_CHOP; break; + case 2: *_RoundingModel = ROUND_UP; break; + case 3: *_RoundingModel = ROUND_DOWN; break; + } + return; + } + if (bHaveDebugger()) + { + g_Notify->DisplayError(L"CTC1 what register are you writing to ?"); + } } /************************* COP1: BC1 functions ***********************/ void R4300iOp::COP1_BCF() { - TEST_COP1_USABLE_EXCEPTION - m_NextInstruction = DELAY_SLOT; - if ((_FPCR[31] & FPCSR_C) == 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + TEST_COP1_USABLE_EXCEPTION + m_NextInstruction = DELAY_SLOT; + if ((_FPCR[31] & FPCSR_C) == 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::COP1_BCT() { - TEST_COP1_USABLE_EXCEPTION - m_NextInstruction = DELAY_SLOT; - if ((_FPCR[31] & FPCSR_C) != 0) - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - } - else - { - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + TEST_COP1_USABLE_EXCEPTION + m_NextInstruction = DELAY_SLOT; + if ((_FPCR[31] & FPCSR_C) != 0) + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + } + else + { + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::COP1_BCFL() { - TEST_COP1_USABLE_EXCEPTION - if ((_FPCR[31] & FPCSR_C) == 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + TEST_COP1_USABLE_EXCEPTION + if ((_FPCR[31] & FPCSR_C) == 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } void R4300iOp::COP1_BCTL() { - TEST_COP1_USABLE_EXCEPTION - if ((_FPCR[31] & FPCSR_C) != 0) - { - m_NextInstruction = DELAY_SLOT; - m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4; - } - else - { - m_NextInstruction = JUMP; - m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; - } + TEST_COP1_USABLE_EXCEPTION + if ((_FPCR[31] & FPCSR_C) != 0) + { + m_NextInstruction = DELAY_SLOT; + m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4; + } + else + { + m_NextInstruction = JUMP; + m_JumpToLocation = (*_PROGRAM_COUNTER) + 8; + } } /************************** COP1: S functions ************************/ -__inline void Float_RoundToInteger32( int * Dest, float * Source ) +__inline void Float_RoundToInteger32( int32_t * Dest, float * Source ) { #ifdef _M_IX86 - _asm - { - mov esi, [Source] - mov edi, [Dest] - fld dword ptr [esi] - fistp dword ptr [edi] - } + _asm + { + mov esi, [Source] + mov edi, [Dest] + fld dword ptr [esi] + fistp dword ptr [edi] + } #else __m128 xmm; @@ -2370,16 +2364,16 @@ __inline void Float_RoundToInteger32( int * Dest, float * Source ) #endif } -__inline void Float_RoundToInteger64( __int64 * Dest, float * Source ) +__inline void Float_RoundToInteger64( int64_t * Dest, float * Source ) { #ifdef _M_IX86 - _asm - { - mov esi, [Source] - mov edi, [Dest] - fld dword ptr [esi] - fistp qword ptr [edi] - } + _asm + { + mov esi, [Source] + mov edi, [Dest] + fld dword ptr [esi] + fistp qword ptr [edi] + } #else __m128 xmm; @@ -2390,30 +2384,30 @@ __inline void Float_RoundToInteger64( __int64 * Dest, float * Source ) void R4300iOp::COP1_S_ADD() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] + *(float *)_FPR_S[m_Opcode.ft]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] + *(float *)_FPR_S[m_Opcode.ft]); } void R4300iOp::COP1_S_SUB() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] - *(float *)_FPR_S[m_Opcode.ft]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] - *(float *)_FPR_S[m_Opcode.ft]); } void R4300iOp::COP1_S_MUL() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * *(float *)_FPR_S[m_Opcode.ft]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * *(float *)_FPR_S[m_Opcode.ft]); } void R4300iOp::COP1_S_DIV() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] / *(float *)_FPR_S[m_Opcode.ft]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] / *(float *)_FPR_S[m_Opcode.ft]); } void R4300iOp::COP1_S_SQRT() @@ -2421,19 +2415,19 @@ void R4300iOp::COP1_S_SQRT() float * Dest = (float *)(_FPR_S[m_Opcode.fd]); float * Source = (float *)(_FPR_S[m_Opcode.fs]); - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); #ifdef _M_IX86 - _asm - { - push esi - mov esi, dword ptr [Source] - fld dword ptr [esi] - fsqrt - mov esi, dword ptr [Dest] - fstp dword ptr [esi] - pop esi - } + _asm + { + push esi + mov esi, dword ptr [Source] + fld dword ptr [esi] + fsqrt + mov esi, dword ptr [Dest] + fstp dword ptr [esi] + pop esi + } #else __m128 xmm; @@ -2445,155 +2439,154 @@ void R4300iOp::COP1_S_SQRT() void R4300iOp::COP1_S_ABS() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = (float)fabs(*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = (float)fabs(*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_MOV() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = *(float *)_FPR_S[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = *(float *)_FPR_S[m_Opcode.fs]; } void R4300iOp::COP1_S_NEG() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * -1.0f); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * -1.0f); } void R4300iOp::COP1_S_TRUNC_L() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_CHOP,_MCW_RC); - Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_CHOP,_MCW_RC); + Float_RoundToInteger64(&*(int64_t *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_CEIL_L() { //added by Witten - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_UP,_MCW_RC); - Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_UP,_MCW_RC); + Float_RoundToInteger64(&*(int64_t *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_FLOOR_L() { //added by Witten - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_DOWN,_MCW_RC); - Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_DOWN,_MCW_RC); + Float_RoundToInteger64(&*(int64_t *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_ROUND_W() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_NEAR,_MCW_RC); - Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_NEAR,_MCW_RC); + Float_RoundToInteger32(&*(int32_t *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_TRUNC_W() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_CHOP,_MCW_RC); - Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_CHOP,_MCW_RC); + Float_RoundToInteger32(&*(int32_t *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_CEIL_W() { //added by Witten - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_UP,_MCW_RC); - Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_UP,_MCW_RC); + Float_RoundToInteger32(&*(int32_t *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_FLOOR_W() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_DOWN,_MCW_RC); - Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_DOWN,_MCW_RC); + Float_RoundToInteger32(&*(int32_t *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_CVT_D() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = (double)(*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = (double)(*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_CVT_W() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + Float_RoundToInteger32(&*(int32_t *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_CVT_L() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + Float_RoundToInteger64(&*(int64_t *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_S_CMP() { - bool less, equal, unorded; - int condition; - float Temp0, Temp1; + bool less, equal, unorded; + int32_t condition; + float Temp0, Temp1; - TEST_COP1_USABLE_EXCEPTION + TEST_COP1_USABLE_EXCEPTION - Temp0 = *(float *)_FPR_S[m_Opcode.fs]; - Temp1 = *(float *)_FPR_S[m_Opcode.ft]; + Temp0 = *(float *)_FPR_S[m_Opcode.fs]; + Temp1 = *(float *)_FPR_S[m_Opcode.ft]; - if (_isnan(Temp0) || _isnan(Temp1)) - { - if (bHaveDebugger()) - { - g_Notify->DisplayError(__FUNCTIONW__ L": Nan ?"); - } - less = false; - equal = false; - unorded = true; - if ((m_Opcode.funct & 8) != 0) - { - if (bHaveDebugger()) - { - g_Notify->DisplayError(stdstr_f("Signal InvalidOperationException\nin r4300i_COP1_S_CMP\n%X %ff\n%X %ff", Temp0,Temp0,Temp1,Temp1).ToUTF16().c_str()); - } - } - } - else - { - less = Temp0 < Temp1; - equal = Temp0 == Temp1; - unorded = false; - } - - condition = ((m_Opcode.funct & 4) && less) | ((m_Opcode.funct & 2) && equal) | - ((m_Opcode.funct & 1) && unorded); + if (_isnan(Temp0) || _isnan(Temp1)) + { + if (bHaveDebugger()) + { + g_Notify->DisplayError(__FUNCTIONW__ L": Nan ?"); + } + less = false; + equal = false; + unorded = true; + if ((m_Opcode.funct & 8) != 0) + { + if (bHaveDebugger()) + { + g_Notify->DisplayError(stdstr_f("Signal InvalidOperationException\nin r4300i_COP1_S_CMP\n%X %ff\n%X %ff", Temp0,Temp0,Temp1,Temp1).ToUTF16().c_str()); + } + } + } + else + { + less = Temp0 < Temp1; + equal = Temp0 == Temp1; + unorded = false; + } - if (condition) - { - _FPCR[31] |= FPCSR_C; - } - else - { - _FPCR[31] &= ~FPCSR_C; - } - + condition = ((m_Opcode.funct & 4) && less) | ((m_Opcode.funct & 2) && equal) | + ((m_Opcode.funct & 1) && unorded); + + if (condition) + { + _FPCR[31] |= FPCSR_C; + } + else + { + _FPCR[31] &= ~FPCSR_C; + } } /************************** COP1: D functions ************************/ -__inline void Double_RoundToInteger32( DWORD * Dest, double * Source ) +__inline void Double_RoundToInteger32( uint32_t * Dest, double * Source ) { #ifdef _M_IX86 - _asm - { - mov esi, [Source] - mov edi, [Dest] - fld qword ptr [esi] - fistp dword ptr [edi] - } + _asm + { + mov esi, [Source] + mov edi, [Dest] + fld qword ptr [esi] + fistp dword ptr [edi] + } #else __m128d xmm; @@ -2602,16 +2595,16 @@ __inline void Double_RoundToInteger32( DWORD * Dest, double * Source ) #endif } -__inline void Double_RoundToInteger64( unsigned __int64 * Dest, double * Source ) +__inline void Double_RoundToInteger64( uint64_t * Dest, double * Source ) { #ifdef _M_IX86 - _asm - { - mov esi, [Source] - mov edi, [Dest] - fld qword ptr [esi] - fistp qword ptr [edi] - } + _asm + { + mov esi, [Source] + mov edi, [Dest] + fld qword ptr [esi] + fistp qword ptr [edi] + } #else __m128d xmm; @@ -2622,234 +2615,229 @@ __inline void Double_RoundToInteger64( unsigned __int64 * Dest, double * Source void R4300iOp::COP1_D_ADD() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] + *(double *)_FPR_D[m_Opcode.ft]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] + *(double *)_FPR_D[m_Opcode.ft]; } void R4300iOp::COP1_D_SUB() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] - *(double *)_FPR_D[m_Opcode.ft]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] - *(double *)_FPR_D[m_Opcode.ft]; } void R4300iOp::COP1_D_MUL() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] * *(double *)_FPR_D[m_Opcode.ft]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] * *(double *)_FPR_D[m_Opcode.ft]; } void R4300iOp::COP1_D_DIV() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] / *(double *)_FPR_D[m_Opcode.ft]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] / *(double *)_FPR_D[m_Opcode.ft]; } void R4300iOp::COP1_D_SQRT() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = (double)sqrt(*(double *)_FPR_D[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = (double)sqrt(*(double *)_FPR_D[m_Opcode.fs]); } void R4300iOp::COP1_D_ABS() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = fabs(*(double *)_FPR_D[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = fabs(*(double *)_FPR_D[m_Opcode.fs]); } void R4300iOp::COP1_D_MOV() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(__int64 *)_FPR_D[m_Opcode.fd] = *(__int64 *)_FPR_D[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(int64_t *)_FPR_D[m_Opcode.fd] = *(int64_t *)_FPR_D[m_Opcode.fs]; } void R4300iOp::COP1_D_NEG() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = (*(double *)_FPR_D[m_Opcode.fs] * -1.0); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = (*(double *)_FPR_D[m_Opcode.fs] * -1.0); } void R4300iOp::COP1_D_TRUNC_L() { //added by Witten - TEST_COP1_USABLE_EXCEPTION - _controlfp(RC_CHOP,_MCW_RC); - Double_RoundToInteger64(&*(QWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); + TEST_COP1_USABLE_EXCEPTION + _controlfp(RC_CHOP,_MCW_RC); + Double_RoundToInteger64(&*(uint64_t *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); } void R4300iOp::COP1_D_CEIL_L() { //added by Witten - TEST_COP1_USABLE_EXCEPTION - _controlfp(RC_UP,_MCW_RC); - Double_RoundToInteger64(&*(QWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); + TEST_COP1_USABLE_EXCEPTION + _controlfp(RC_UP,_MCW_RC); + Double_RoundToInteger64(&*(uint64_t *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); } void R4300iOp::COP1_D_FLOOR_L() { //added by Witten - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_DOWN,_MCW_RC); - Double_RoundToInteger64(&*(QWORD *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_DOWN,_MCW_RC); + Double_RoundToInteger64(&*(uint64_t *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_S[m_Opcode.fs]); } void R4300iOp::COP1_D_ROUND_W() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_NEAR,_MCW_RC); - Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_NEAR,_MCW_RC); + Double_RoundToInteger32(&*(uint32_t *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); } void R4300iOp::COP1_D_TRUNC_W() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(RC_CHOP,_MCW_RC); - Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); + TEST_COP1_USABLE_EXCEPTION + _controlfp(RC_CHOP,_MCW_RC); + Double_RoundToInteger32(&*(uint32_t *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); } void R4300iOp::COP1_D_CEIL_W() { //added by Witten - TEST_COP1_USABLE_EXCEPTION - _controlfp(RC_UP,_MCW_RC); - Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); + TEST_COP1_USABLE_EXCEPTION + _controlfp(RC_UP,_MCW_RC); + Double_RoundToInteger32(&*(uint32_t *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); } void R4300iOp::COP1_D_FLOOR_W() { //added by Witten - TEST_COP1_USABLE_EXCEPTION - _controlfp(_RC_DOWN,_MCW_RC); - Double_RoundToInteger32(&*(DWORD *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(_RC_DOWN,_MCW_RC); + Double_RoundToInteger32(&*(uint32_t *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_S[m_Opcode.fs]); } -void R4300iOp::COP1_D_CVT_S() +void R4300iOp::COP1_D_CVT_S() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = (float)*(double *)_FPR_D[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = (float)*(double *)_FPR_D[m_Opcode.fs]; } -void R4300iOp::COP1_D_CVT_W() +void R4300iOp::COP1_D_CVT_W() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + Double_RoundToInteger32(&*(uint32_t *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] ); } -void R4300iOp::COP1_D_CVT_L() +void R4300iOp::COP1_D_CVT_L() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - Double_RoundToInteger64(&*(unsigned __int64 *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + Double_RoundToInteger64(&*(uint64_t *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs]); } void R4300iOp::COP1_D_CMP() { - bool less, equal, unorded; - int condition; - MIPS_DWORD Temp0, Temp1; + bool less, equal, unorded; + int32_t condition; + MIPS_DWORD Temp0, Temp1; - TEST_COP1_USABLE_EXCEPTION + TEST_COP1_USABLE_EXCEPTION - Temp0.DW = *(__int64 *)_FPR_D[m_Opcode.fs]; - Temp1.DW = *(__int64 *)_FPR_D[m_Opcode.ft]; + Temp0.DW = *(int64_t *)_FPR_D[m_Opcode.fs]; + Temp1.DW = *(int64_t *)_FPR_D[m_Opcode.ft]; - if (_isnan(Temp0.D) || _isnan(Temp1.D)) - { - if (bHaveDebugger()) - { - g_Notify->DisplayError(__FUNCTIONW__ L": Nan ?"); - } - less = false; - equal = false; - unorded = true; - if ((m_Opcode.funct & 8) != 0) - { - if (bHaveDebugger()) - { - g_Notify->DisplayError(L"Signal InvalidOperationException\nin " __FUNCTIONW__); - } - } - } - else - { - less = Temp0.D < Temp1.D; - equal = Temp0.D == Temp1.D; - unorded = false; - } - - condition = ((m_Opcode.funct & 4) && less) | ((m_Opcode.funct & 2) && equal) | - ((m_Opcode.funct & 1) && unorded); + if (_isnan(Temp0.D) || _isnan(Temp1.D)) + { + if (bHaveDebugger()) + { + g_Notify->DisplayError(__FUNCTIONW__ L": Nan ?"); + } + less = false; + equal = false; + unorded = true; + if ((m_Opcode.funct & 8) != 0) + { + if (bHaveDebugger()) + { + g_Notify->DisplayError(L"Signal InvalidOperationException\nin " __FUNCTIONW__); + } + } + } + else + { + less = Temp0.D < Temp1.D; + equal = Temp0.D == Temp1.D; + unorded = false; + } - if (condition) - { - _FPCR[31] |= FPCSR_C; - } - else - { - _FPCR[31] &= ~FPCSR_C; - } + condition = ((m_Opcode.funct & 4) && less) | ((m_Opcode.funct & 2) && equal) | + ((m_Opcode.funct & 1) && unorded); + + if (condition) + { + _FPCR[31] |= FPCSR_C; + } + else + { + _FPCR[31] &= ~FPCSR_C; + } } /************************** COP1: W functions ************************/ void R4300iOp::COP1_W_CVT_S() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = (float)*(int *)_FPR_S[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = (float)*(int32_t *)_FPR_S[m_Opcode.fs]; } void R4300iOp::COP1_W_CVT_D() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = (double)*(int *)_FPR_S[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = (double)*(int32_t *)_FPR_S[m_Opcode.fs]; } /************************** COP1: L functions ************************/ void R4300iOp::COP1_L_CVT_S() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(float *)_FPR_S[m_Opcode.fd] = (float)*(__int64 *)_FPR_D[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(float *)_FPR_S[m_Opcode.fd] = (float)*(int64_t *)_FPR_D[m_Opcode.fs]; } void R4300iOp::COP1_L_CVT_D() { - TEST_COP1_USABLE_EXCEPTION - _controlfp(*_RoundingModel,_MCW_RC); - *(double *)_FPR_D[m_Opcode.fd] = (double)*(__int64 *)_FPR_D[m_Opcode.fs]; + TEST_COP1_USABLE_EXCEPTION + _controlfp(*_RoundingModel,_MCW_RC); + *(double *)_FPR_D[m_Opcode.fd] = (double)*(int64_t *)_FPR_D[m_Opcode.fs]; } /************************** Other functions **************************/ -void R4300iOp::UnknownOpcode() +void R4300iOp::UnknownOpcode() { - g_Notify->DisplayError(stdstr_f("%s: %08X\n%s\n\nStopping Emulation !", GS(MSG_UNHANDLED_OP), (*_PROGRAM_COUNTER), - R4300iOpcodeName(m_Opcode.Hex,(*_PROGRAM_COUNTER))).ToUTF16().c_str()); - g_System->m_EndEmulation = true; - + g_Notify->DisplayError(stdstr_f("%s: %08X\n%s\n\nStopping Emulation !", GS(MSG_UNHANDLED_OP), (*_PROGRAM_COUNTER), + R4300iOpcodeName(m_Opcode.Hex,(*_PROGRAM_COUNTER))).ToUTF16().c_str()); + g_System->m_EndEmulation = true; + g_Notify->BreakPoint(__FILEW__,__LINE__); #ifdef tofix - if (HaveDebugger && !inFullScreen) - { - int response; + if (HaveDebugger && !inFullScreen) + { + int32_t response; - strcat(Message,"\n\nDo you wish to enter the debugger ?"); - - response = MessageBox(NULL,Message,GS(MSG_MSGBOX_TITLE), MB_YESNO | MB_ICONERROR ); - if (response == IDYES) - { - Enter_R4300i_Commands_Window (); - } - ExitThread(0); - } - else - { - g_Notify->DisplayError(Message); - ExitThread(0); - } + strcat(Message,"\n\nDo you wish to enter the debugger ?"); + + response = MessageBox(NULL,Message,GS(MSG_MSGBOX_TITLE), MB_YESNO | MB_ICONERROR ); + if (response == IDYES) + { + Enter_R4300i_Commands_Window (); + } + ExitThread(0); + } #endif } diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops.h b/Source/Project64/N64 System/Interpreter/Interpreter Ops.h index 3c2153aba..909a0acad 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops.h +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops.h @@ -11,228 +11,225 @@ #pragma once class R4300iOp : - protected CDebugSettings, - protected CSystemRegisters + protected CDebugSettings, + protected CSystemRegisters { public: - typedef void(*Func)(); + typedef void(*Func)(); - /************************* OpCode functions *************************/ - static void J(); - static void JAL(); - static void BNE(); - static void BEQ(); - static void BLEZ(); - static void BGTZ(); - static void ADDI(); - static void ADDIU(); - static void SLTI(); - static void SLTIU(); - static void ANDI(); - static void ORI(); - static void XORI(); - static void LUI(); - static void BEQL(); - static void BNEL(); - static void BLEZL(); - static void BGTZL(); - static void DADDIU(); - static void LDL(); - static void LDR(); - static void LB(); - static void LH(); - static void LWL(); - static void LW(); - static void LBU(); - static void LHU(); - static void LWR(); - static void LWU(); - static void SB(); - static void SH(); - static void SWL(); - static void SW(); - static void SDL(); - static void SDR(); - static void SWR(); - static void CACHE(); - static void LL(); - static void LWC1(); - static void LDC1(); - static void LD(); - static void SC(); - static void SWC1(); - static void SDC1(); - static void SD(); + /************************* OpCode functions *************************/ + static void J(); + static void JAL(); + static void BNE(); + static void BEQ(); + static void BLEZ(); + static void BGTZ(); + static void ADDI(); + static void ADDIU(); + static void SLTI(); + static void SLTIU(); + static void ANDI(); + static void ORI(); + static void XORI(); + static void LUI(); + static void BEQL(); + static void BNEL(); + static void BLEZL(); + static void BGTZL(); + static void DADDIU(); + static void LDL(); + static void LDR(); + static void LB(); + static void LH(); + static void LWL(); + static void LW(); + static void LBU(); + static void LHU(); + static void LWR(); + static void LWU(); + static void SB(); + static void SH(); + static void SWL(); + static void SW(); + static void SDL(); + static void SDR(); + static void SWR(); + static void CACHE(); + static void LL(); + static void LWC1(); + static void LDC1(); + static void LD(); + static void SC(); + static void SWC1(); + static void SDC1(); + static void SD(); + /********************** R4300i OpCodes: Special **********************/ + static void SPECIAL_SLL(); + static void SPECIAL_SRL(); + static void SPECIAL_SRA(); + static void SPECIAL_SLLV(); + static void SPECIAL_SRLV(); + static void SPECIAL_SRAV(); + static void SPECIAL_JR(); + static void SPECIAL_JALR(); + static void SPECIAL_SYSCALL(); + static void SPECIAL_BREAK(); + static void SPECIAL_SYNC(); + static void SPECIAL_MFHI(); + static void SPECIAL_MTHI(); + static void SPECIAL_MFLO(); + static void SPECIAL_MTLO(); + static void SPECIAL_DSLLV(); + static void SPECIAL_DSRLV(); + static void SPECIAL_DSRAV(); + static void SPECIAL_MULT(); + static void SPECIAL_MULTU(); + static void SPECIAL_DIV(); + static void SPECIAL_DIVU(); + static void SPECIAL_DMULT(); + static void SPECIAL_DMULTU(); + static void SPECIAL_DDIV(); + static void SPECIAL_DDIVU(); + static void SPECIAL_ADD(); + static void SPECIAL_ADDU(); + static void SPECIAL_SUB(); + static void SPECIAL_SUBU(); + static void SPECIAL_AND(); + static void SPECIAL_OR(); + static void SPECIAL_XOR(); + static void SPECIAL_NOR(); + static void SPECIAL_SLT(); + static void SPECIAL_SLTU(); + static void SPECIAL_DADD(); + static void SPECIAL_DADDU(); + static void SPECIAL_DSUB(); + static void SPECIAL_DSUBU(); + static void SPECIAL_TEQ(); + static void SPECIAL_DSLL(); + static void SPECIAL_DSRL(); + static void SPECIAL_DSRA(); + static void SPECIAL_DSLL32(); + static void SPECIAL_DSRL32(); + static void SPECIAL_DSRA32(); - /********************** R4300i OpCodes: Special **********************/ - static void SPECIAL_SLL(); - static void SPECIAL_SRL(); - static void SPECIAL_SRA(); - static void SPECIAL_SLLV(); - static void SPECIAL_SRLV(); - static void SPECIAL_SRAV(); - static void SPECIAL_JR(); - static void SPECIAL_JALR(); - static void SPECIAL_SYSCALL(); - static void SPECIAL_BREAK(); - static void SPECIAL_SYNC(); - static void SPECIAL_MFHI(); - static void SPECIAL_MTHI(); - static void SPECIAL_MFLO(); - static void SPECIAL_MTLO(); - static void SPECIAL_DSLLV(); - static void SPECIAL_DSRLV(); - static void SPECIAL_DSRAV(); - static void SPECIAL_MULT(); - static void SPECIAL_MULTU(); - static void SPECIAL_DIV(); - static void SPECIAL_DIVU(); - static void SPECIAL_DMULT(); - static void SPECIAL_DMULTU(); - static void SPECIAL_DDIV(); - static void SPECIAL_DDIVU(); - static void SPECIAL_ADD(); - static void SPECIAL_ADDU(); - static void SPECIAL_SUB(); - static void SPECIAL_SUBU(); - static void SPECIAL_AND(); - static void SPECIAL_OR(); - static void SPECIAL_XOR(); - static void SPECIAL_NOR(); - static void SPECIAL_SLT(); - static void SPECIAL_SLTU(); - static void SPECIAL_DADD(); - static void SPECIAL_DADDU(); - static void SPECIAL_DSUB(); - static void SPECIAL_DSUBU(); - static void SPECIAL_TEQ(); - static void SPECIAL_DSLL(); - static void SPECIAL_DSRL(); - static void SPECIAL_DSRA(); - static void SPECIAL_DSLL32(); - static void SPECIAL_DSRL32(); - static void SPECIAL_DSRA32(); + /********************** R4300i OpCodes: RegImm **********************/ + static void REGIMM_BLTZ(); + static void REGIMM_BGEZ(); + static void REGIMM_BLTZL(); + static void REGIMM_BGEZL(); + static void REGIMM_BLTZAL(); + static void REGIMM_BGEZAL(); - /********************** R4300i OpCodes: RegImm **********************/ - static void REGIMM_BLTZ(); - static void REGIMM_BGEZ(); - static void REGIMM_BLTZL(); - static void REGIMM_BGEZL(); - static void REGIMM_BLTZAL(); - static void REGIMM_BGEZAL(); + /************************** COP0 functions **************************/ + static void COP0_MF(); + static void COP0_MT(); - /************************** COP0 functions **************************/ - static void COP0_MF(); - static void COP0_MT(); + /************************** COP0 CO functions ***********************/ + static void COP0_CO_TLBR(); + static void COP0_CO_TLBWI(); + static void COP0_CO_TLBWR(); + static void COP0_CO_TLBP(); + static void COP0_CO_ERET(); - /************************** COP0 CO functions ***********************/ - static void COP0_CO_TLBR(); - static void COP0_CO_TLBWI(); - static void COP0_CO_TLBWR(); - static void COP0_CO_TLBP(); - static void COP0_CO_ERET(); + /************************** COP1 functions **************************/ + static void COP1_MF(); + static void COP1_DMF(); + static void COP1_CF(); + static void COP1_MT(); + static void COP1_DMT(); + static void COP1_CT(); - /************************** COP1 functions **************************/ - static void COP1_MF(); - static void COP1_DMF(); - static void COP1_CF(); - static void COP1_MT(); - static void COP1_DMT(); - static void COP1_CT(); + /************************* COP1: BC1 functions ***********************/ + static void COP1_BCF(); + static void COP1_BCT(); + static void COP1_BCFL(); + static void COP1_BCTL(); - /************************* COP1: BC1 functions ***********************/ - static void COP1_BCF(); - static void COP1_BCT(); - static void COP1_BCFL(); - static void COP1_BCTL(); + /************************** COP1: S functions ************************/ + static void COP1_S_ADD(); + static void COP1_S_SUB(); + static void COP1_S_MUL(); + static void COP1_S_DIV(); + static void COP1_S_SQRT(); + static void COP1_S_ABS(); + static void COP1_S_MOV(); + static void COP1_S_NEG(); + static void COP1_S_TRUNC_L(); + static void COP1_S_CEIL_L(); //added by Witten + static void COP1_S_FLOOR_L(); //added by Witten + static void COP1_S_ROUND_W(); + static void COP1_S_TRUNC_W(); + static void COP1_S_CEIL_W(); //added by Witten + static void COP1_S_FLOOR_W(); + static void COP1_S_CVT_D(); + static void COP1_S_CVT_W(); + static void COP1_S_CVT_L(); + static void COP1_S_CMP(); - /************************** COP1: S functions ************************/ - static void COP1_S_ADD(); - static void COP1_S_SUB(); - static void COP1_S_MUL(); - static void COP1_S_DIV(); - static void COP1_S_SQRT(); - static void COP1_S_ABS(); - static void COP1_S_MOV(); - static void COP1_S_NEG(); - static void COP1_S_TRUNC_L(); - static void COP1_S_CEIL_L(); //added by Witten - static void COP1_S_FLOOR_L(); //added by Witten - static void COP1_S_ROUND_W(); - static void COP1_S_TRUNC_W(); - static void COP1_S_CEIL_W(); //added by Witten - static void COP1_S_FLOOR_W(); - static void COP1_S_CVT_D(); - static void COP1_S_CVT_W(); - static void COP1_S_CVT_L(); - static void COP1_S_CMP(); + /************************** COP1: D functions ************************/ + static void COP1_D_ADD(); + static void COP1_D_SUB(); + static void COP1_D_MUL(); + static void COP1_D_DIV(); + static void COP1_D_SQRT(); + static void COP1_D_ABS(); + static void COP1_D_MOV(); + static void COP1_D_NEG(); + static void COP1_D_TRUNC_L(); //added by Witten + static void COP1_D_CEIL_L(); //added by Witten + static void COP1_D_FLOOR_L(); //added by Witten + static void COP1_D_ROUND_W(); + static void COP1_D_TRUNC_W(); + static void COP1_D_CEIL_W(); //added by Witten + static void COP1_D_FLOOR_W(); //added by Witten + static void COP1_D_CVT_S(); + static void COP1_D_CVT_W(); + static void COP1_D_CVT_L(); + static void COP1_D_CMP(); - /************************** COP1: D functions ************************/ - static void COP1_D_ADD(); - static void COP1_D_SUB(); - static void COP1_D_MUL(); - static void COP1_D_DIV(); - static void COP1_D_SQRT(); - static void COP1_D_ABS(); - static void COP1_D_MOV(); - static void COP1_D_NEG(); - static void COP1_D_TRUNC_L(); //added by Witten - static void COP1_D_CEIL_L(); //added by Witten - static void COP1_D_FLOOR_L(); //added by Witten - static void COP1_D_ROUND_W(); - static void COP1_D_TRUNC_W(); - static void COP1_D_CEIL_W(); //added by Witten - static void COP1_D_FLOOR_W(); //added by Witten - static void COP1_D_CVT_S(); - static void COP1_D_CVT_W(); - static void COP1_D_CVT_L(); - static void COP1_D_CMP(); + /************************** COP1: W functions ************************/ + static void COP1_W_CVT_S(); + static void COP1_W_CVT_D(); - /************************** COP1: W functions ************************/ - static void COP1_W_CVT_S(); - static void COP1_W_CVT_D(); + /************************** COP1: L functions ************************/ + static void COP1_L_CVT_S(); + static void COP1_L_CVT_D(); - /************************** COP1: L functions ************************/ - static void COP1_L_CVT_S(); - static void COP1_L_CVT_D(); + /************************** Other functions **************************/ + static void UnknownOpcode(); - /************************** Other functions **************************/ - static void UnknownOpcode(); + static Func* BuildInterpreter(); - - static Func* BuildInterpreter(); - - static bool m_TestTimer; - static DWORD m_NextInstruction; - static OPCODE m_Opcode; - static DWORD m_JumpToLocation; + static bool m_TestTimer; + static uint32_t m_NextInstruction; + static OPCODE m_Opcode; + static uint32_t m_JumpToLocation; protected: - static void SPECIAL(); - static void REGIMM(); - static void COP0(); - static void COP0_CO(); - static void COP1(); - static void COP1_BC(); - static void COP1_S(); - static void COP1_D(); - static void COP1_W(); - static void COP1_L(); + static void SPECIAL(); + static void REGIMM(); + static void COP0(); + static void COP0_CO(); + static void COP1(); + static void COP1_BC(); + static void COP1_S(); + static void COP1_D(); + static void COP1_W(); + static void COP1_L(); - static Func Jump_Opcode[64]; - static Func Jump_Special[64]; - static Func Jump_Regimm[32]; - static Func Jump_CoP0[32]; - static Func Jump_CoP0_Function[64]; - static Func Jump_CoP1[32]; - static Func Jump_CoP1_BC[32]; - static Func Jump_CoP1_S[64]; - static Func Jump_CoP1_D[64]; - static Func Jump_CoP1_W[64]; - static Func Jump_CoP1_L[64]; - - static const DWORD SWL_MASK[4], SWR_MASK[4], LWL_MASK[4], LWR_MASK[4]; - static const int SWL_SHIFT[4], SWR_SHIFT[4], LWL_SHIFT[4], LWR_SHIFT[4]; + static Func Jump_Opcode[64]; + static Func Jump_Special[64]; + static Func Jump_Regimm[32]; + static Func Jump_CoP0[32]; + static Func Jump_CoP0_Function[64]; + static Func Jump_CoP1[32]; + static Func Jump_CoP1_BC[32]; + static Func Jump_CoP1_S[64]; + static Func Jump_CoP1_D[64]; + static Func Jump_CoP1_W[64]; + static Func Jump_CoP1_L[64]; + static const uint32_t SWL_MASK[4], SWR_MASK[4], LWL_MASK[4], LWR_MASK[4]; + static const int32_t SWL_SHIFT[4], SWR_SHIFT[4], LWL_SHIFT[4], LWR_SHIFT[4]; }; diff --git a/Source/Project64/N64 System/Recompiler/Code Block.cpp b/Source/Project64/N64 System/Recompiler/Code Block.cpp index 860f47f45..c201cfadc 100644 --- a/Source/Project64/N64 System/Recompiler/Code Block.cpp +++ b/Source/Project64/N64 System/Recompiler/Code Block.cpp @@ -10,7 +10,7 @@ ****************************************************************************/ #include "stdafx.h" -bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2); +bool DelaySlotEffectsCompare (uint32_t PC, uint32_t Reg1, uint32_t Reg2); CCodeBlock::CCodeBlock(DWORD VAddrEnter, BYTE * RecompPos) : m_VAddrEnter(VAddrEnter), diff --git a/Source/Project64/N64 System/Recompiler/Code Section.cpp b/Source/Project64/N64 System/Recompiler/Code Section.cpp index 6da875477..3caf8fd4e 100644 --- a/Source/Project64/N64 System/Recompiler/Code Section.cpp +++ b/Source/Project64/N64 System/Recompiler/Code Section.cpp @@ -12,7 +12,7 @@ void InPermLoop(); -bool DelaySlotEffectsCompare(DWORD PC, DWORD Reg1, DWORD Reg2); +bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2); static bool DelaySlotEffectsJump(DWORD JumpPC) { OPCODE Command; diff --git a/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp b/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp index e8ebe7760..c07be8800 100644 --- a/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp +++ b/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp @@ -14,7 +14,7 @@ #define CHECKED_BUILD 1 #endif -bool DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 ); +bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2); LoopAnalysis::LoopAnalysis(CCodeBlock * CodeBlock, CCodeSection * Section) : m_EnterSection(Section), diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp index 0c19ffd12..383e72c4b 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp @@ -38,7 +38,7 @@ void CRecompilerOps::CompileWriteTLBMiss (x86Reg AddressReg, x86Reg LookUpReg ) m_Section->CompileExit(m_CompilePC, m_CompilePC, m_RegWorkingSet, CExitInfo::TLBWriteMiss, false, JeLabel32); } -bool DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 ); +bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2); /************************** Branch functions ************************/ void CRecompilerOps::Compile_Branch (CRecompilerOps::BranchFunction CompareFunc, BRANCH_TYPE BranchType, bool Link)