예제 #1
0
 public override void Assemble(Assembler assembler)
 {
     if (Count is ValReg)
     {
         assembler.Add(AsmMov.Create(Assembler.IReg, (int)((Count as ValReg).Index << 4)));
         assembler.Add(AsmStoreOp.Create(Assembler.IReg));
     }
     else if (Count is ValReg32)
     {
         throw new AssembleException(ErrorMessage.NotSupported);
     }
     assembler.Add(AsmFor.Create());
     assembler.ForMapping[this] = assembler.Last() as AsmFor;
 }
예제 #2
0
 public override void Assemble(Assembler assembler)
 {
     if (Duration is ValReg)
     {
         assembler.Add(AsmStoreOp.Create((Duration as ValReg).Index));
         assembler.Add(AsmWait.Create(0));
     }
     else if (Duration is ValInstant)
     {
         assembler.Add(AsmWait.Create((Duration as ValInstant).Val));
     }
     else
     {
         throw new AssembleException(ErrorMessage.NotSupported);
     }
 }
예제 #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)
        {
            if (RegIter is ValReg32)
            {
                throw new AssembleException(ErrorMessage.NotSupported);
            }
            assembler.Add(AsmMov.Create(RegIter.Index, InitVal));
            uint e_val = RegIter.Index;

            if (Count is ValReg)
            {
                e_val |= (Count as ValReg).Index << 4;
            }
            else if (Count is ValReg32)
            {
                throw new AssembleException(ErrorMessage.NotSupported);
            }
            assembler.Add(AsmMov.Create(Assembler.IReg, (int)e_val));
            assembler.Add(AsmStoreOp.Create(Assembler.IReg));
            assembler.Add(AsmFor.Create());
            assembler.ForMapping[this] = assembler.Last() as AsmFor;
        }