コード例 #1
0
        private void UpdateDisassembly()
        {
            this.ResetDisassembly();
            uint savePC = myComputer.getRegisters().ReadWord(15);
            int  i      = 0;

            //save register 15 in TEMPVAR
            if (myComputer.getStepNum() > 4)
            {
                myComputer.getRegisters().WriteWord(15, savePC - 16);
            }
            else
            {
                myComputer.getRegisters().WriteWord(15, (uint)(savePC - (myComputer.getStepNum() * 4)));
                i = 4 - myComputer.getStepNum();
            }
            //set register 15 4 commands back. (sub 16).
            myComputer.disassembling = true;
            myComputer.getCPU().disassembling = true;
            //set computer.disassembling to true
            //set cpu.disassembling to true

            for (; i < 9; i++)
            {
                myComputer.getCPU().disassembly = "";
                myComputer.step();
                this.disassemblyView.Rows[i].Cells[0].Value = String.Format("{0:X8}", myComputer.getRegisters().ReadWord(15) - 12);
                this.disassemblyView.Rows[i].Cells[1].Value = String.Format("{0:X8}", myComputer.getCPU().unDecodedInstruction);
                this.disassemblyView.Rows[i].Cells[2].Value = myComputer.getCPU().disassembly;

                //stop stepping if swi
                if (myComputer.getCPU().disassembly.Length >= 3 && myComputer.getCPU().disassembly.Substring(0, 3) == "swi")
                {
                    this.disassemblyView.Rows[i].Cells[0].Value = String.Format("{0:X8}", myComputer.getRegisters().ReadWord(15) - 8);
                    break;
                }
            }
            //step through 9 times.
            //grab computer.getregister.readword(15)
            //grab computer.getpcu.undecoded instruction
            //grab computer.getcpu.disassembly after each step.

            this.disassemblyView.Rows[4].DefaultCellStyle.BackColor = Color.LightGray;
            //highlight the 5th row

            myComputer.getRegisters().WriteWord(15, savePC);
            //set register 15 = to TEMPVAR
            myComputer.disassembling = false;
            myComputer.getCPU().disassembling = false;
            //set computer.disassembling to false
        }
コード例 #2
0
ファイル: TestComputer.cs プロジェクト: wiglz4/ARMsim
 //Method:       RunTests
 //Purpose:      tests every method in the Computer class
 //Variables:    myOptions - Options handle to options to class
 public static void RunTests(Options myOptions)
 {
     myOptions.SetFileName("ctest.exe");
     Console.WriteLine("testing Computer setup...");
     Computer myTestComp = new Computer(myOptions);
     myTestComp.endRun += new Computer.EventHandler(delegate { });
     myTestComp.putChar += new Computer.EventHandler(delegate { });
     Console.WriteLine("testing Computer Running...");
     myTestComp.step();
     Debug.Assert(myTestComp.getStepNum() == 1);
     myTestComp.Run();
     Debug.Assert(myTestComp.getStepNum() == 20);
     Console.WriteLine("success!");
     myTestComp.FileStreamClose();
 }
コード例 #3
0
ファイル: TestComputer.cs プロジェクト: wiglz4/ARMsim
        //Method:       RunTests
        //Purpose:      tests every method in the Computer class
        //Variables:    myOptions - Options handle to options to class
        public static void RunTests(Options myOptions)
        {
            myOptions.SetFileName("ctest.exe");
            Console.WriteLine("testing Computer setup...");
            Computer myTestComp = new Computer(myOptions);

            myTestComp.endRun  += new Computer.EventHandler(delegate { });
            myTestComp.putChar += new Computer.EventHandler(delegate { });
            Console.WriteLine("testing Computer Running...");
            myTestComp.step();
            Debug.Assert(myTestComp.getStepNum() == 1);
            myTestComp.Run();
            Debug.Assert(myTestComp.getStepNum() == 20);
            Console.WriteLine("success!");
            myTestComp.FileStreamClose();
        }