private static Instruction[] Decode(CodeContext context, params byte[] bytes) { var decoder = new InstructionDecoder(InstructionLookup.Instance, context); var instructions = new List<Instruction>(); for (int i = 0; i < bytes.Length; ++i) { if (!decoder.Feed(bytes[i])) { Assert.AreNotEqual(InstructionDecodingState.Error, decoder.State); instructions.Add(decoder.GetInstruction()); decoder.Reset(); } } Assert.AreEqual(InstructionDecodingState.Initial, decoder.State); return instructions.ToArray(); }
private static Instruction Decode(InstructionDecoder decoder, ProcessDebugger debugger, ForeignPtr ptr) { var reader = new BinaryReader(debugger.OpenMemory(ptr)); while (decoder.Feed(reader.ReadByte())) { } return decoder.GetInstruction(); }