Example #1
0
        public static int CodeABx(FuncState fs, OpCode op, int a, uint bc)
        {
            var mode = OpCodeInfo.GetMode(op);

            Utl.Assert(mode.OpMode == OpMode.iABx ||
                       mode.OpMode == OpMode.iAsBx);
            Utl.Assert(mode.CMode == OpArgMask.OpArgN);
            Utl.Assert(a < Instruction.MAXARG_A & bc <= Instruction.MAXARG_Bx);
            return(Code(fs, Instruction.CreateABx(op, a, bc)));
        }
Example #2
0
 public static bool TestAMode(OpCode op)
 {
     return(OpCodeInfo.GetMode(op).AMode);
 }
Example #3
0
        public override string ToString()
        {
            var op   = GET_OPCODE();
            var a    = GETARG_A();
            var b    = GETARG_B();
            var c    = GETARG_C();
            var ax   = GETARG_Ax();
            var bx   = GETARG_Bx();
            var sbx  = GETARG_sBx();
            var mode = OpCodeInfo.GetMode(op);

            switch (mode.OpMode)
            {
            case OpMode.iABC:
            {
                string ret = string.Format("{0,-9} {1}"
                                           , op
                                           , a);
                if (mode.BMode != OpArgMask.OpArgN)
                {
                    ret += " " + (ISK(b) ? MYK(INDEXK(b)) : b);
                }
                if (mode.CMode != OpArgMask.OpArgN)
                {
                    ret += " " + (ISK(c) ? MYK(INDEXK(c)) : c);
                }
                return(ret);
            }

            case OpMode.iABx:
            {
                string ret = string.Format("{0,-9} {1}"
                                           , op
                                           , a);
                if (mode.BMode == OpArgMask.OpArgK)
                {
                    ret += " " + MYK(bx);
                }
                else if (mode.BMode == OpArgMask.OpArgU)
                {
                    ret += " " + bx;
                }
                return(ret);
            }

            case OpMode.iAsBx:
            {
                return(string.Format("{0,-9} {1} {2}"
                                     , op
                                     , a
                                     , sbx));
            }

            case OpMode.iAx:
            {
                return(string.Format("{0,-9} {1}"
                                     , op
                                     , MYK(ax)));
            }

            default:
                throw new System.NotImplementedException();
            }
        }