Exemplo n.º 1
0
        protected override void BuildBody()
        {
            var sp  = Frame.EnsureRegister(Registers.sp);
            var a   = Frame.EnsureRegister(Registers.a);
            var c   = Frame.EnsureRegister(Registers.c);
            var h   = Frame.EnsureRegister(Registers.h);
            var l   = Frame.EnsureRegister(Registers.l);
            var C   = Frame.EnsureFlagGroup(Architecture.GetFlagGroup("C"));
            var Z   = Frame.EnsureFlagGroup(Architecture.GetFlagGroup("Z"));
            var SZC = Frame.EnsureFlagGroup(Architecture.GetFlagGroup("SZC"));
            var SZP = Frame.EnsureFlagGroup(Architecture.GetFlagGroup("SZP"));

            Assign(sp, Frame.FramePointer);
            Label("m1Loop");
            Assign(a, h);
            Assign(a, Or(a, a));
            Assign(SZC, Cond(a));
            Assign(C, Constant.False());
            Assign(a, Shr(a, Constant.Byte(1)));
            Assign(C, Cond(a));
            Assign(h, a);
            Assign(a, l);
            Assign(a, Fn(CommonOps.RorC, a, Constant.Byte(1), C));
            Assign(C, Cond(a));
            Assign(l, a);
            Assign(c, ISub(c, 1));
            Assign(SZP, Cond(c));
            BranchIf(Test(ConditionCode.NE, Z), "m1Loop");

            Label("m2Done");
            MStore(Word32(0x1000), l);
            MStore(Word32(0x1001), h);
            Return();
        }
Exemplo n.º 2
0
        public Identifier Flags(string s)
        {
            return(Frame.EnsureFlagGroup(Architecture.GetFlagGroup(s)));

            //return base.Flags(Architecture.GetFlagGroup(s).FlagRegister, grf, s);
        }