Exemplo n.º 1
0
        public override byte[] ByteOutput()
        {
            int addr = 0;

            Bytes.Add(OPCodes.Codes.FctPrepare);
            Bytes.Add(Fct.Id);

            // arguments à gérer
            foreach (Variable variable in Variables)
            {
                if (variable is IConstVariable)
                {
                    Bytes.Add(OPCodes.Codes.VarConstCopy);
                    Bytes.Add(variable.Size);
                    Bytes.Add(variable.As <IConstVariable>().GetValueAsBytes());
                    Bytes.Add(addr);
                }
                else
                {
                    Bytes.Add(OPCodes.Codes.VarFctCopy);
                    Bytes.Add(variable.Size);
                    Bytes.Add(variable.Address);
                    Bytes.Add(addr);
                }

                addr += variable.Size;
            }

            Bytes.Add(OPCodes.Codes.FctStart);

            return(Bytes.Convert());
        }
Exemplo n.º 2
0
        public override byte[] ByteOutput()
        {
            Bytes.Add(OPCodes.Codes.Jump);
            Bytes.Add(0);

            return(Bytes.Convert());
        }
Exemplo n.º 3
0
        public override byte[] ByteOutput()
        {
            List <byte[]> bytes = new List <byte[]>();

            Bytes.Add(new AssignTargetRegisterInstruction(From[0], 0));
            Bytes.Add(new AssignTargetRegisterInstruction(From[1], 1));
            Bytes.Add(new AssignTargetRegisterInstruction(To, 2));

            Bytes.Add(OPCodes.Codes.AssignTypeRegister);
            Bytes.Add(0);
            Bytes.Add(From[0].Type);

            Bytes.Add(OPCodes.Codes.AssignTypeRegister);
            Bytes.Add(1);
            Bytes.Add(From[1].Type);

            TreatVariable(0);
            TreatVariable(1);

            Bytes.Add(OPCodes.Codes.OperationAdd);

            // ATTENTION SI C'EST UN PTR
            Bytes.Add(To.Type);
            Bytes.Add(To.Address);

            return(Bytes.Convert());
        }
Exemplo n.º 4
0
        public override byte[] ByteOutput()
        {
            Bytes.Add(OPCodes.Codes.AssignReturnCarry);
            Bytes.Add(Variable.Address);
            Bytes.Add(Variable.Size);

            return(Bytes.Convert());
        }
        public override byte[] ByteOutput()
        {
            Bytes.Add(OPCodes.Codes.AssignTargetRegister);
            Bytes.Add(Index);
            Bytes.Add(Variable.Target);

            return(Bytes.Convert());
        }
        public override byte[] ByteOutput()
        {
            Bytes.Add(OPCodes.Codes.AssignOperationRegister);
            Bytes.Add(Id);
            Bytes.Add(V.Size);
            Bytes.Add(V.Address);

            return (Bytes.Convert());
        }
Exemplo n.º 7
0
        public override byte[] ByteOutput()
        {
            FctCallRetInstruction i = new FctCallRetInstruction(FunctionToCall);

            i.Variables = Variables;
            Bytes.Add(i.ByteOutput());

            return(Bytes.Convert());
        }
Exemplo n.º 8
0
        public override byte[] ByteOutput()
        {
            TreatVariable(V1, 0);
            TreatVariable(V2, 1);

            Bytes.Add(OPCodes.Codes.Ifn);
            Bytes.Add((int)Flag);

            Bytes.Add(0);

            return(Bytes.Convert());
        }
Exemplo n.º 9
0
        public override byte[] ByteOutput()
        {
            Bytes.Add(OPCodes.Codes.AssignTypeRegister);
            Bytes.Add(0);
            Bytes.Add(V1.Type);

            Bytes.Add(new AssignOperationRegister(V1, 0).ByteOutput());

            Bytes.Add(OPCodes.Codes.Cast);
            Bytes.Add(V2.Type);
            Bytes.Add(V2.Address);

            return(Bytes.Convert());
        }
Exemplo n.º 10
0
        public override byte[] ByteOutput()
        {
            Bytes.Add(new AssignTargetRegisterInstruction(Source, 0));
            Bytes.Add(new AssignTargetRegisterInstruction(Destination, 1));

            if (Source is ConstPtrVariable)
            {
                Bytes.Add(OPCodes.Codes.AssignPtrCarry);
            }

            Bytes.Add(OPCodes.Codes.Set);
            Bytes.Add(Source.Size);
            Bytes.Add(Source.GetAddressOrValue());
            Bytes.Add(Destination.GetAddressOrValue());

            return(Bytes.Convert());
        }
Exemplo n.º 11
0
        public override byte[] ByteOutput()
        {
            if (Variable is IConstVariable)
            {
                Bytes.Add(OPCodes.Codes.SetReturnCarry);
                Bytes.Add(Variable.Size);
                Bytes.Add(Variable.As <IConstVariable>().GetValueAsBytes());
            }
            else
            {
                Bytes.Add(OPCodes.Codes.Ret);
                Bytes.Add(Variable.Address);
                Bytes.Add(Defines.SIZE_INT);
            }

            Bytes.Add(OPCodes.Codes.FctPop);

            return(Bytes.Convert());
        }
Exemplo n.º 12
0
        public override byte[] ByteOutput()
        {
            Bytes.Add(Code);

            return(Bytes.Convert());
        }
Exemplo n.º 13
0
        public override byte[] ByteOutput()
        {
            Bytes.Add(OPCodes.Codes.FctPop);

            return(Bytes.Convert());
        }