public static void ParseAndUpdateVfprSourceTargetPrefix(int Index, string RegisterName, ref VfpuPrefix VfpuPrefix)
{
int SetIndex = Index;
bool IsConstant;
RegisterName = RegisterName.Replace(" ", "");
if (RegisterName.StartsWith("-"))
{
RegisterName = RegisterName.Substr(1);
VfpuPrefix.SourceNegate(Index, true);
}
if (RegisterName.StartsWith("|") && RegisterName.EndsWith("|"))
{
RegisterName = RegisterName.Substr(1, -1);
VfpuPrefix.SourceAbsolute(Index, true);
}
switch (RegisterName)
{
case "x": IsConstant = false; SetIndex = 0; break;
case "y": IsConstant = false; SetIndex = 1; break;
case "z": IsConstant = false; SetIndex = 2; break;
case "w": IsConstant = false; SetIndex = 3; break;
case "3": IsConstant = true; SetIndex = 0; VfpuPrefix.SourceAbsolute(Index, true); break;
case "0": IsConstant = true; SetIndex = 0; VfpuPrefix.SourceAbsolute(Index, false); break;
case "1/3": IsConstant = true; SetIndex = 1; VfpuPrefix.SourceAbsolute(Index, true); break;
case "1": IsConstant = true; SetIndex = 1; VfpuPrefix.SourceAbsolute(Index, false); break;
case "1/4": IsConstant = true; SetIndex = 2; VfpuPrefix.SourceAbsolute(Index, true); break;
case "2": IsConstant = true; SetIndex = 2; VfpuPrefix.SourceAbsolute(Index, false); break;
case "1/6": IsConstant = true; SetIndex = 3; VfpuPrefix.SourceAbsolute(Index, true); break;
case "1/2": IsConstant = true; SetIndex = 3; VfpuPrefix.SourceAbsolute(Index, false); break;
default: throw(new NotImplementedException(String.Format("Invalid RegisterName {0}", RegisterName)));
}
VfpuPrefix.SourceConstant(Index, IsConstant);
VfpuPrefix.SourceIndex(Index, (uint)SetIndex);
}