public void ExecSingleInstruction(string inst)
        {
            var oldPc = PC;
            var x     = Parser.Parser.ParseLine(inst);

            switch (x)
            {
            case JInstruction j:
                x = new JInstruction {
                    Key = j.Key, ITarget = labels[j.Target]
                }.Into;
                break;

            case IInstruction i:
                if (i.Key == "beq" || i.Key == "bne")
                {
                    x = new IInstruction {
                        Key = i.Key, RS = i.RS, RT = i.RT, Imm = labels[i.Label]
                    };
                }
                break;
            }
            ExecInst(x);
            if (PC == oldPc + 1)
            {
                PC--;
            }
        }
Exemple #2
0
        public void Execute_PCChangedToAddressTimesFour()
        {
            target = new JInstruction(0x00000003);

            target.Execute(ref pc, mem, reg);

            Assert.AreEqual(0x0000000C, pc);
        }
Exemple #3
0
        public void Execute_UpperFourPcBitsMaintained()
        {
            pc     = 0x20000000;
            target = new JInstruction(0x00000003);

            target.Execute(ref pc, mem, reg);

            Assert.AreEqual(0x2000000C, pc);
        }
Exemple #4
0
        public void ToString_Formatted()
        {
            target = new JInstruction(0x00000003);

            Assert.AreEqual("J 0x00000003", target.ToString());
        }