Пример #1
0
 public override void Assemble(Assembler assembler)
 {
     assembler.Add(AsmBranch.Create());
     assembler.ElseMapping[this] = assembler.Last() as AsmBranch;
     assembler.Add(AsmEmpty.Create());
     assembler.IfMapping[If].Target = assembler.Last();
 }
Пример #2
0
 public override void Assemble(Assembler assembler)
 {
     assembler.Add(AsmEmpty.Create());
     if (If.Else == null)
     {
         assembler.IfMapping[If].Target = assembler.Last();
     }
     else
     {
         assembler.ElseMapping[If.Else].Target = assembler.Last();
     }
 }
Пример #3
0
        public override void Assemble(Assembler assembler)
        {
            int keycode = Key.KeyCode;
            int dindex  = Assembler.GetDirectionIndex(Key);

            if (Duration is ValRegEx)
            {
                if (Duration is ValReg32)
                {
                    throw new AssembleException(ErrorMessage.NotSupported);
                }
                var reg = Duration as ValRegEx;
                assembler.Add(AsmStoreOp.Create(reg.Index));
                assembler.Add(AsmStick_Standard.Create(keycode, dindex, 0));
                ReleasePrevious(assembler);
            }
            else if (Duration is ValInstant)
            {
                int duration = (Duration as ValInstant).Val;
                var ins      = AsmStick_Standard.Create(keycode, dindex, duration);
                if (ins.Success)
                {
                    assembler.Add(ins);
                    ReleasePrevious(assembler);
                }
                else if (ins == Instruction.Failed.OutOfRange)
                {
                    assembler.Add(AsmStick_Hold.Create(keycode, dindex));
                    ReleasePrevious(assembler);
                    assembler.StickMapping[keycode] = assembler.Last() as AsmStick_Hold;
                    assembler.Add(AsmWait.Create(duration));
                    assembler.Add(AsmEmpty.Create());
                    ReleasePrevious(assembler);
                }
            }
            else
            {
                throw new AssembleException(ErrorMessage.NotImplemented);
            }
        }
Пример #4
0
 public override void Assemble(Assembler assembler)
 {
     assembler.Add(AsmEmpty.Create());
     ReleasePrevious(assembler);
 }