Example #1
0
 public void Remap(ref uint Pointer)
 {
     BlockStart = Pointer;
     Pointer   += (uint)Commands.Sum(cmd => cmd.Length) + 2;
     // +2 - last return command
     STMProgram.Align32Bits(ref Pointer);
 }
Example #2
0
        public void Generate(CodeGeneratorContext context, STMProgram prog)
        {
            context.CurrentModel = __Model;

            prog.Models.Add(__Model);
            prog.PPMLength = (byte)Math.Max(prog.PPMLength, __Model.Channels);

            var stmmodel = prog.Models[__Model.Index];

            context.ModelCode = __Model.IsMenu
                ? prog.MenuCode
                : stmmodel.ModelCode;

            var cnt = __Elements.OfType <FMPPMOutDesignPanel>().Count();

            if (cnt > 0)
            {
                stmmodel.Modes = new STMFlightMode[cnt];
            }

            stmmodel.ModeVariable = (uint)prog.Variables.Add((ushort)_DataIndex, (ushort)_FRAMStateAddr,
                                                             __Model.CName + "_STATE", __Model.Index, 1, 0, (short)cnt, 0);

            prog.StartupCode.Add(0x0F, stmmodel.ModeVariable, 0);

            foreach (var generator in __Model.Generators)
            {
                generator.GenerateJoystick(context, prog);
            }

            foreach (var generator in __Model.Generators)
            {
                generator.GenerateSTMCode(context, prog);
            }
        }
Example #3
0
        public void Remap(ref uint Pointer)
        {
            ModelCode.Remap(ref Pointer);
            CodeAddr = ModelCode.BlockStart;

            if (string.IsNullOrWhiteSpace(Name))
            {
                NameAddr = 0;
            }
            else
            {
                NameAddr = Pointer;
                Pointer += (uint)Name.Length;
                Pointer++;
            }

            STMProgram.Align32Bits(ref Pointer);

            if (Modes != null && Modes.Length != 0)
            {
                ModesAddr = Pointer;
                Pointer  += (uint)(4 * Modes.Length);

                foreach (var mode in Modes)
                {
                    mode.Remap(ref Pointer);
                }
            }
        }
Example #4
0
        public void Remap(ref uint Pointer)
        {
            if (string.IsNullOrWhiteSpace(Name))
            {
                NameAddr = 0;
            }
            else
            {
                NameAddr = Pointer;
                Pointer += (uint)Name.Length;
                Pointer++;
            }

            STMProgram.Align32Bits(ref Pointer);
        }
Example #5
0
        public void Remap(ref uint Pointer)
        {
            if (string.IsNullOrWhiteSpace(Name))
            {
                NameAddr = 0;
            }
            else
            {
                NameAddr = Pointer;
                Pointer += (uint)Name.Length;
                Pointer++;
            }

            STMProgram.Align32Bits(ref Pointer);

            if (Links != null && Links.Length != 0)
            {
                LinksAddr = Pointer;
                Pointer  += (uint)(STMBlockInkInfo.LENGTH * Links.Length);

                foreach (var mode in Links)
                {
                    mode.Remap(ref Pointer);
                }
            }

            STMProgram.Align32Bits(ref Pointer);

            if (Variables != null && Variables.Length != 0)
            {
                VarsAddr = Pointer;
                Pointer += (uint)(4 * Variables.Length);
            }

            STMProgram.Align32Bits(ref Pointer);
        }
Example #6
0
 private void PrepareProgram(CodeGeneratorContext context)
 {
     __prg = new STMProgram();
     Settings.Generate(__prg);
 }
Example #7
0
        public virtual void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
        {
//            throw new NotImplementedException();
        }
Example #8
0
 public virtual void GenerateJoystick(CodeGeneratorContext context, STMProgram prog)
 {
 }
Example #9
0
 public virtual void GenerateSTMCode(CodeGeneratorContext context, STMProgram prog)
 {
     prog.Blocks.Add(new STMBlockInfo(this, context.CurrentModel));
 }