예제 #1
0
        public static int CodeABx(FuncState fs, OpCode op, int a, uint bc)
        {
            OpCodeMode 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)));
        }
예제 #2
0
        private static OpCodeMode M(bool t, bool a, OpArgMask b, OpArgMask c, OpMode op)
        {
            OpCodeMode opCodeMode = new OpCodeMode();

            opCodeMode.TMode  = t;
            opCodeMode.AMode  = a;
            opCodeMode.BMode  = b;
            opCodeMode.CMode  = c;
            opCodeMode.OpMode = op;
            return(opCodeMode);
        }
예제 #3
0
        public override string ToString()
        {
            OpCode     op   = GET_OPCODE();
            int        a    = GETARG_A();
            int        b    = GETARG_B();
            int        c    = GETARG_C();
            int        ax   = GETARG_Ax();
            int        bx   = GETARG_Bx();
            int        sbx  = GETARG_sBx();
            OpCodeMode 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();
            }
        }