Exemple #1
0
 /// <summary>
 /// R(A) = Kst(extra arg)
 /// </summary>
 public static void LoadKx(Instruction ins, ILuaVM vm)
 {
     ins.ABx(out var a, out _);
     a += 1;
     new Instruction(vm.Fetch()).Ax(out var ax);
     vm.GetConst(ax);
     vm.Replace(a);
 }
Exemple #2
0
        public static void LoadKx(int i, ILuaVM vm)
        {
            int a  = Instruction.GetA(i) + 1;
            int ax = Instruction.GetAx(vm.Fetch());

            vm.GetConst(ax);
            vm.Replace(a);
        }
Exemple #3
0
    internal static void LoadKx(Instruction i, ILuaVM vm)
    {
        var(a, _) = i.ABx();
        a        += 1;
        int ax = ((Instruction)vm.Fetch()).Ax();

        vm.GetConst(ax);
        vm.Replace(a);
    }
Exemple #4
0
        //R(A)[(C - 1)*FPF+i] := R(A + i)
        public static void SetList(int i, ILuaVM vm)
        {
            int a = Instruction.GetA(i) + 1;
            int b = Instruction.GetB(i);
            int c = Instruction.GetC(i);

            c = c > 0 ? c - 1 : Instruction.GetAx(vm.Fetch());

            vm.CheckStack(1);
            int idx = c * LFIELDS_PER_FLUSH;

            for (int j = 1; j <= b; j++)
            {
                idx++;
                vm.PushValue(a + j);
                vm.SetI(a, idx);
            }
        }
Exemple #5
0
    public static void SetList(Instruction i, ILuaVM vm)
    {
        const int FIELDS_PER_FLUSH = 50;

        var(a, b, c) = i.ABC();
        a           += 1;

        bool bIsZero = b == 0;

        if (bIsZero)
        {
            b = (int)vm.ToInteger(-1) - a - 1;
            vm.Pop(1);
        }

        if (c > 0)
        {
            c -= 1;
        }
        else
        {
            c = ((Instruction)vm.Fetch()).Ax();
        }

        Int64 idx = (Int64)(c * FIELDS_PER_FLUSH);

        for (int j = 1; j <= b; j++)
        {
            idx++;
            vm.PushValue(a + j);
            vm.SetI(a, idx);
        }

        if (bIsZero)
        {
            for (int j = vm.RegisterCount() + 1; j <= vm.GetTop(); j++)
            {
                idx++;
                vm.PushValue(j);
                vm.SetI(a, idx);
            }
            vm.SetTop(vm.RegisterCount());
        }
    }
Exemple #6
0
        /// <summary>
        /// R(A)[(C - 1) * FPF + i] := R(A + i), 1 <= i <= B
        /// </summary>
        public static void SetList(Instruction ins, ILuaVM vm)
        {
            ins.ABC(out var a, out var b, out var c);
            a += 1;

            if (c > 0)
            {
                c--;
            }
            else
            {
                new Instruction(vm.Fetch()).Ax(out c);
            }

            var bIsZero = b == 0;

            if (bIsZero)
            {
                b = (int)vm.ToInteger(-1) - a - 1;
                vm.Pop(1);
            }

            vm.CheckStack(1);
            var idx = (LuaInt)(c * LFIELDS_PER_FLUSH);

            for (var j = 1; j <= b; j++)
            {
                idx++;
                vm.PushValue(a + j);
                vm.SetI(a, idx);
            }

            if (bIsZero)
            {
                for (var j = vm.RegisterCount() + 1; j <= vm.GetTop(); j++)
                {
                    idx++;
                    vm.PushValue(j);
                    vm.SetI(a, idx);
                }

                vm.SetTop(vm.RegisterCount());
            }
        }