Implement RegConst in Compile_LBU

This commit is contained in:
LegendOfDragoon 2015-09-07 15:05:26 -07:00
parent 237b21a596
commit e0bd5442e4
3 changed files with 31 additions and 0 deletions

View File

@ -787,6 +787,17 @@ void Compile_LBU ( void ) {
CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC));
if (IsRegConst(RSPOpC.base) == TRUE) {
char Address[32];
DWORD Addr = (MipsRegConst(RSPOpC.base) + Offset) ^ 3;
Addr &= 0xfff;
sprintf(Address, "Dmem + %Xh", Addr);
MoveZxVariableToX86regByte(RSPInfo.DMEM + Addr, Address, x86_EAX);
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
return;
}
MoveVariableToX86reg(&RSP_GPR[RSPOpC.base].UW, GPR_Name(RSPOpC.base), x86_EBX);
XorX86RegToX86Reg(x86_EAX, x86_EAX);

View File

@ -1982,6 +1982,25 @@ void MoveZxX86RegPtrDispToX86RegHalf(int AddrReg, BYTE Disp, int Destination) {
PUTDST8(RecompPos, Disp);
}
void MoveZxVariableToX86regByte(void *Variable, char *VariableName, int x86reg) {
CPU_Message(" movzx %s, byte ptr [%s]",x86_Name(x86reg),VariableName);
PUTDST16(RecompPos, 0xb60f);
switch (x86reg) {
case x86_EAX: PUTDST8(RecompPos,0x05); break;
case x86_EBX: PUTDST8(RecompPos,0x1D); break;
case x86_ECX: PUTDST8(RecompPos,0x0D); break;
case x86_EDX: PUTDST8(RecompPos,0x15); break;
case x86_ESI: PUTDST8(RecompPos,0x35); break;
case x86_EDI: PUTDST8(RecompPos,0x3D); break;
case x86_ESP: PUTDST8(RecompPos,0x25); break;
case x86_EBP: PUTDST8(RecompPos,0x2D); break;
default: DisplayError("MoveZxVariableToX86regByte\nUnknown x86 Register");
}
PUTDST32(RecompPos,Variable);
}
void MoveZxVariableToX86regHalf(void *Variable, char *VariableName, int x86reg) {
CPU_Message(" movzx %s, word ptr [%s]",x86_Name(x86reg),VariableName);

View File

@ -147,6 +147,7 @@ void MoveZxX86RegHalfToX86Reg ( int Source, int Destination );
void MoveZxX86RegPtrDispToX86RegHalf( int AddrReg, BYTE Disp, int Destination );
void MoveZxN64MemToX86regByte ( int x86reg, int AddrReg );
void MoveZxN64MemToX86regHalf ( int x86reg, int AddrReg );
void MoveZxVariableToX86regByte ( void *Variable, char *VariableName, int x86reg );
void MoveZxVariableToX86regHalf ( void *Variable, char *VariableName, int x86reg );
void MulX86reg ( int x86reg );
void NegateX86reg ( int x86reg );