public Result Disassemble(uint PC, Instruction Instruction)
{
if (ProcessCallback == null)
{
var Dictionary = new Dictionary<InstructionInfo, int>();
InstructionLookup = InstructionTable.ALL.ToArray();
for (int n = 0; n < InstructionLookup.Length; n++) Dictionary[InstructionLookup[n]] = n;
ProcessCallback = EmitLookupGenerator.GenerateSwitch<Func<uint, MipsDisassembler, Result>>("", InstructionTable.ALL, (InstructionInfo) =>
{
return ast.Return(ast.CallStatic(
(Func<uint, int, Result>)MipsDisassembler._InternalHandle,
ast.Argument<uint>(0),
(InstructionInfo != null) ? Dictionary[InstructionInfo] : -1
));
});
}
var Result = ProcessCallback(Instruction, this);
if (Result.InstructionInfo == null)
{
Console.Error.WriteLine(String.Format("Instruction at 0x{0:X8} with data 0x{1:X8} didn't generate a value", PC, (uint)Instruction));
Result.InstructionInfo = InstructionTable.Unknown;
}
Result.InstructionPC = PC;
return Result;
}