Clean up disasm immediates.

They were still a bit wrong.
This commit is contained in:
Unknown W. Brackets 2013-03-11 23:45:29 -07:00
parent e4b43b73b4
commit 243c8c7a34

View File

@ -163,7 +163,10 @@ namespace MIPSDis
void Dis_IType(u32 op, char *out)
{
int imm = (signed short)(op&0xFFFF);
s32 simm = (s32)(s16)(op & 0xFFFF);
u32 uimm = (u32)(u16)(op & 0xFFFF);
u32 suimm = (u32)simm;
int rt = _RT;
int rs = _RS;
const char *name = MIPSGetName(op);
@ -172,34 +175,35 @@ namespace MIPSDis
case 8: //addi
case 9: //addiu
case 10: //slti
sprintf(out, "%s\t%s, %s, %s",name,RN(rt),RN(rs),SignedHex(imm));
sprintf(out, "%s\t%s, %s, %s",name,RN(rt),RN(rs),SignedHex(simm));
break;
case 11: //sltiu
sprintf(out, "%s\t%s, %s, 0x%X",name,RN(rt),RN(rs),(u32)imm);
sprintf(out, "%s\t%s, %s, 0x%X",name,RN(rt),RN(rs),suimm);
break;
default:
sprintf(out, "%s\t%s, %s, 0x%X",name,RN(rt),RN(rs),(u32)imm);
sprintf(out, "%s\t%s, %s, 0x%X",name,RN(rt),RN(rs),uimm);
break;
}
}
void Dis_ori(u32 op, char *out)
{
int imm = (signed short)(op&0xFFFF);
s32 simm = (s32)(s16)(op & 0xFFFF);
u32 uimm = (u32)(u16)(op & 0xFFFF);
int rt = _RT;
int rs = _RS;
const char *name = MIPSGetName(op);
if (rs == 0)
sprintf(out, "li\t%s, %s",RN(rt),SignedHex(imm));
sprintf(out, "li\t%s, 0x%X",RN(rt),uimm);
else
sprintf(out, "%s\t%s, %s, %s",name,RN(rt),RN(rs),SignedHex(imm));
sprintf(out, "%s\t%s, %s, 0x%X",name,RN(rt),RN(rs),uimm);
}
void Dis_IType1(u32 op, char *out)
{
int imm = (signed short)(op&0xFFFF);
u32 uimm = (u32)(u16)(op & 0xFFFF);
int rt = _RT;
const char *name = MIPSGetName(op);
sprintf(out, "%s\t%s, %s",name,RN(rt),SignedHex(imm));
sprintf(out, "%s\t%s, 0x%X",name,RN(rt),uimm);
}
void Dis_addi(u32 op, char *out)
@ -266,7 +270,7 @@ namespace MIPSDis
name = "rotr";
if (((op & 0x3f) == 6) && sa == 1)
name = "rotrv";
sprintf(out, "%s\t%s, %s, %s",name,RN(rd),RN(rt),SignedHex(sa));
sprintf(out, "%s\t%s, %s, 0x%X",name,RN(rd),RN(rt),sa);
}
void Dis_VarShiftType(u32 op, char *out)
@ -300,13 +304,13 @@ namespace MIPSDis
case 0x0: //ext
{
int size = _SIZE + 1;
sprintf(out,"%s\t%s, %s, %s, %s",name,RN(Rt),RN(rs),SignedHex(pos),SignedHex(size));
sprintf(out,"%s\t%s, %s, 0x%X, 0x%X",name,RN(Rt),RN(rs),pos,size);
}
break;
case 0x4: // ins
{
int size = (_SIZE + 1) - pos;
sprintf(out,"%s\t%s, %s, %s, %s",name,RN(Rt),RN(rs),SignedHex(pos),SignedHex(size));
sprintf(out,"%s\t%s, %s, 0x%X, 0x%X",name,RN(Rt),RN(rs),pos,size);
}
break;
}