Exemplo n.º 1
0
        public static OpcodeEncoder AppendConditionalDisplacement(this OpcodeEncoder encoder, Operand displacement, bool include)
        {
            if (!include)
            {
                return(encoder);
            }

            if (Is8BitDisplacement(displacement))
            {
                return(encoder.AppendByteValue((byte)displacement.ConstantUnsignedInteger));
            }

            return(encoder.AppendIntegerValue(displacement.ConstantUnsignedInteger));
        }
Exemplo n.º 2
0
        public static OpcodeEncoder AppendInteger(this OpcodeEncoder encoder, Operand operand, InstructionSize size)
        {
            if (size == InstructionSize.Size32)
            {
                return(encoder.AppendIntegerValue(operand.ConstantUnsignedInteger));
            }
            if (size == InstructionSize.Size8)
            {
                return(encoder.AppendByteValue((byte)operand.ConstantUnsignedInteger));
            }
            if (size == InstructionSize.Size16)
            {
                return(encoder.AppendShortValue((ushort)operand.ConstantUnsignedInteger));
            }

            throw new InvalidCompilerException("Instruction size invalid");
        }
Exemplo n.º 3
0
 public static OpcodeEncoder AppendImmediate(this OpcodeEncoder encoder, uint value)
 {
     return(encoder.AppendIntegerValue(value));
 }