internal x86OpCode RetrieveNextOpCode()
{
x86OpCode returnOpCode = x86OpCode.Create(x86OpCodes.Unknown);
byte opcodeByte = reader.ReadByte();
returnOpCode._opcodeBytes = new byte[] { opcodeByte };
x86OpCode[] matchingOpcodes = MatchWithOpCodes(opcodeByte);
// if there is one match, set the returning opcode to that match. If not, then it's an instruction
// from an opcode group, and select it by checking the next byte.
if (matchingOpcodes.Length == 1)
returnOpCode = x86OpCode.Create(matchingOpcodes[0]);
else if (matchingOpcodes.Length > 1)
{
x86OpCode selected = SelectOpCodeFromToken(matchingOpcodes, reader.ReadByte());
if (selected != null)
returnOpCode = selected;
if (selected == null || selected._variableByteIndex > -1)
reader.BaseStream.Seek(-1, SeekOrigin.Current);
}
return returnOpCode;
}