コード例 #1
0
ファイル: x86Disassembler.cs プロジェクト: Rex-Hays/GNIDA
        private x86OpCode SelectOpCodeFromToken(x86OpCode[] matches, byte token)
        {
            byte groupIndex = matches[0]._opcodeBytes[0];

            byte hByte = (byte)(token >> 4 << 4);
            byte lByte = (byte)(token - hByte);

            int index = (int)Math.Floor((double)(token % 0x40) / (double)8.0f);

            // 0xff group has got more than 8 instructions with some special tokens.
            if (groupIndex == 0xFF)
            {
                // instructions with lowerbyte of 5 or D are an exception.
                if (lByte == 0x5 || lByte == 0xD)
                    return matches.FirstOrDefault(m => m._opcodeBytes[1] == token);
                else
                    index *= 2;
            }

            if (index < 0 || index >= matches.Length)
                return null;

            return matches[index];
        }
コード例 #2
0
        private x86OpCode SelectOpCodeFromToken(x86OpCode[] matches, byte token)
        {
            byte groupIndex = matches[0].opcodebytes[0];

            int index = token / 8;

            if (index >= 0x8)
                index = token - ((token / 8) * 8);

            // 0xff group has got more than 8 instructions with some special tokens.
            if (groupIndex == 0xFF)
            {
                // instructions with lowerbyte of 5 or D are an exception.
                byte lByte = (byte)(token - ((token >> 4) << 4));
                if (lByte == 0x5 || lByte == 0xD)
                    return matches.FirstOrDefault(m => m.opcodebytes[1] == token);
                else
                    index *= 2;
            }

            if (index >= matches.Length)
                return null;

            return matches[index];
        }