Permalink
Browse files

Merge pull request #557 from tgiphil/master

- New instruction template option
  • Loading branch information...
tgiphil committed Jan 12, 2019
2 parents cc37e7b + 7904a13 commit 8374963ecc30518afe20a4d934fa0076459f90aa
@@ -6,7 +6,7 @@
"[x64-rex64]=[x64-rex],rex.w=1",

"[x64-branch]=[x64],operand-prefix=0x0F,opcode=[opcode-branch],immediate=rel32:label",
"[x64-setbyteif]=[x64],operand-prefixoperand-prefix=0x0F,opcode=[opcode-setbyteif],mod=11,reg=000,rm=reg3:r",
"[x64-setbyteif]=[x64],operand-prefix=0x0F,opcode=[opcode-setbyteif],mod=11,reg=000,rm=reg3:r",
"[x64-cmov]=[x64],operand-prefix=0x0F,opcode=[opcode-cmov],mod=11,reg=reg3:r,rm=reg3:o1",

"[x64-base-load-ebp+zero]=[x64],mod=01,reg=reg3:[dest],rm=101,immediate=0x00",
@@ -819,8 +819,37 @@ private static void GetCodes(string part, ref string code, ref string postcode)
case "supress8": code = "SuppressByte"; return;
case "": return;

default: throw new Exception("ERROR!");
default: break;
}

if (part.StartsWith("reg("))
{
int open = part.IndexOf('(');
int comma = part.IndexOf('-');
int closed = part.IndexOf(')');

if (open >= 0)
{
int start = Convert.ToInt32(part.Substring(open + 1, comma - open - 1).Trim());
int end = comma < 0 ? start : Convert.ToInt32(part.Substring(comma + 1, closed - comma - 1).Trim());
int length = end - start + 1;

code = "AppendBit(";

if (start == 0)
{
postcode = ".Register.RegisterCode) & 0x" + ("111111111111111111111111111111".Substring(0, length));
}
else
{
postcode = ".Register.RegisterCode >> " + start.ToString() + ") & 0x" + ("111111111111111111111111111111".Substring(0, length));
}

return;
}
}

throw new Exception("ERROR!");
}

private static string GetOperand(string part)

0 comments on commit 8374963

Please sign in to comment.