public static List <AssemblableCommand> MultiCommandDisassembler(ApplicationContext ctx, IMemorizable pointer, [Optional] ref List <int> ids) { var cmds = new List <AssemblableCommand>(); for (var index = 0; index < pointer.Length;) { int length; try { length = GetCommandLength(ctx, pointer.ExtractMemoryPointer(index, pointer.Length - index)); } catch { // ConsoleLogger.Write("Cannot find a command with OpCode " + (pointer.ExtractMemoryPointer(index, pointer.Length - index)).ToString(), "ERROR", ConsoleColor.Red); index += 1; cmds.Add(new AssemblableCommand(CommandTemplate.UNKNOWN)); ids.Add(index); continue; } if (length > pointer.Length - index) { break; } cmds.Add(Dissassemble(ctx, pointer.ExtractMemoryPointer(index, length))); ids.Add(index); index += length; } return(cmds); }
public static AssemblableCommand DisassembleNextCommand(ApplicationContext context, IMemorizable memory) { AssemblableCommand cmd; uint lenght = 0; try { lenght = (uint)GetCommandLength(context, memory.ExtractMemoryPointer(0, memory.Length)); } catch { cmd = new AssemblableCommand(CommandTemplate.UNKNOWN); return(cmd); } cmd = Dissassemble(context, memory.ExtractMemoryPointer(0, (int)lenght)); return(cmd); }