當前位置: 首頁>>代碼示例>>C#>>正文


C# Machine.Run方法代碼示例

本文整理匯總了C#中System.Machine.Run方法的典型用法代碼示例。如果您正苦於以下問題:C# Machine.Run方法的具體用法?C# Machine.Run怎麽用?C# Machine.Run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Machine的用法示例。


在下文中一共展示了Machine.Run方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RunProgram

        private static void RunProgram(string assemblyCode)
        {
            Assembler assembler = new Assembler();

            Instruction[] instructions = assembler.Assemble(assemblyCode);

            Memory memory = new Memory();
            memory.LoadInstructions(instructions);

            Registers registers = new Registers();
            registers.ValueWrittenToOutputRegister += System.Console.Write;

            Machine machine = new Machine(memory, registers);
            machine.Run(25);

            System.Console.ReadLine();
        }
開發者ID:ryanjfitz,項目名稱:SimpSim.NET,代碼行數:17,代碼來源:Program.cs

示例2: ShouldBeAbleToSaveMachineState

        public void ShouldBeAbleToSaveMachineState()
        {
            Memory memory = new Memory();
            memory.LoadInstructions(SamplePrograms.HelloWorldInstructions);

            Machine expectedMachine = new Machine(memory, new Registers());
            expectedMachine.Run();

            StateSaver stateSaver = new StateSaver();
            stateSaver.SaveMachine(expectedMachine, _machineSaveFile);

            FileAssert.Exists(_machineSaveFile);

            Machine actualMachine = stateSaver.LoadMachine(_machineSaveFile);

            Assert.AreEqual(expectedMachine.State, actualMachine.State);
            Assert.AreEqual(expectedMachine.InstructionRegister, actualMachine.InstructionRegister);
            Assert.AreEqual(expectedMachine.ProgramCounter, actualMachine.ProgramCounter);
        }
開發者ID:ryanjfitz,項目名稱:SimpSim.NET,代碼行數:19,代碼來源:StateSaverTests.cs

示例3: Main

 public static void Main(string[] args)
 {
     Machine machine = new Machine ();
     machine.Run();
 }
開發者ID:m0a0t0,項目名稱:Extremely-Simple-C--Platformer,代碼行數:5,代碼來源:Main.cs

示例4: TestBootSequence

        private void TestBootSequence(Cartridge cart)
        {
            Machine machine = new Machine();
            machine.SystemBootMode = BootMode.HLE_IPL_OLD;
            machine.DeviceRCP.DevicePI.MountCartridge(cart);
            Debugger debugger = new Debugger();
            debugger.BreakOnBootMode = DebuggerBootEvent.PostBoot;
            debugger.DebugOnBreak = true;
            var mockedCPUEngine = new Mock<ExecutionEngine>();
            var mockedRCPEngine = new Mock<ExecutionEngine>();
            machine.DeviceCPU.Engine = mockedCPUEngine.Object;
            machine.DeviceRCP.Engine = mockedRCPEngine.Object;
            machine.Initialize();
            machine.Run();

            ExecutionState state = machine.DeviceCPU.State;

            /* CP0 Testing */
            Assert.Equal(0x0000001FUL, state.CP0Regs[CP0RegName.Random]);
            Assert.Equal(0x00005000UL, state.CP0Regs[CP0RegName.Count]);
            Assert.Equal(0x0000005CUL, state.CP0Regs[CP0RegName.Cause]);
            Assert.Equal(0x007FFFF0UL, state.CP0Regs[CP0RegName.Context]);
            Assert.Equal(0xFFFFFFFFUL, state.CP0Regs[CP0RegName.EPC]);
            Assert.Equal(0xFFFFFFFFUL, state.CP0Regs[CP0RegName.BadVAddr]);
            Assert.Equal(0xFFFFFFFFUL, state.CP0Regs[CP0RegName.ErrorEPC]);
            Assert.Equal(0x0006E463UL, state.CP0Regs[CP0RegName.Config]);
            Assert.Equal(0x34000000UL, state.CP0Regs[CP0RegName.SR]);

            /* PIF Testing */
            AssertPIFCodes(
                Cartridge.Current.RomImage.Region,
                Cartridge.Current.RomImage.BootRomInformation.CIC,
                state);

            debugger.Continue();
            machine.Stop();
            machine.Dispose();
        }
開發者ID:RonnChyran,項目名稱:Soft64-Bryan,代碼行數:38,代碼來源:BootTests.cs


注:本文中的System.Machine.Run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。