Beispiel #1
0
        public void LSMultiple_Push()
        {
            //  e92d000a        push {r1, r3} = strdb r13, {r1, r3}
            uint u = 0xe92d000a;
            int  r = Convert.ToInt32(~u);

            r = ~r;

            Memory regs = new Memory(regsize), RAM = new Memory(16);

            regs.WriteWord(Reg.R1, 34);
            regs.WriteWord(Reg.R3, -23);
            regs.WriteWord(Reg.R13, 12);

            LSMultiple inst = new LSMultiple(r, ref regs, ref RAM, 12);

            inst.Decode();
            inst.Execute();

            Assert.IsTrue(RAM.ReadWord(4) == 34);
            Assert.IsTrue(RAM.ReadWord(8) == -23);
            Assert.IsTrue(regs.ReadWord(Reg.R13) == 4);

            Assert.IsTrue(inst.ToString() == "push {r1, r3}");
        }
Beispiel #2
0
        public void LSMultiple_Pop_EdgeCases()
        {
            //    e8bd000a        pop     {r1, r3}
            uint u = 0xe8bd000a;
            int  r = Convert.ToInt32(~u);

            r = ~r;

            Memory regs = new Memory(regsize), RAM = new Memory(12);

            RAM.WriteWord(4, 34);
            RAM.WriteWord(0, -23);
            regs.WriteWord(Reg.R13, 0);

            LSMultiple inst = new LSMultiple(r, ref regs, ref RAM, 12);

            inst.Decode();
            inst.Execute();

            Assert.IsTrue(regs.ReadWord(Reg.R1) == -23);
            Assert.IsTrue(regs.ReadWord(Reg.R3) == 34);
            Assert.IsTrue(regs.ReadWord(Reg.R13) == 8);
            Assert.IsTrue(inst.ToString() == "pop {r1, r3}");
        }