コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: phdpua/Chip8
        public MainPage()
        {
            if (!TestRenderMode())
                return;

            screenData = new uint[640 * 320];

            spriteBatch = new SpriteBatch(GraphicsDeviceManager.Current.GraphicsDevice);

            RomItems = new List<string>(RomLoader.GetRomList());

            texture = new Texture2D(GraphicsDeviceManager.Current.GraphicsDevice, 640, 320, false, SurfaceFormat.Color);

            InitializeComponent();

            this.KeyDown += new KeyEventHandler(RootVisual_KeyDown);
            this.KeyUp += new KeyEventHandler(RootVisual_KeyUp);

            cpu = new Chip8();
            timer = new DispatcherTimer();
            bitmap = new WriteableBitmap(640, 320);

            //screen.Source = bitmap;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 0, 0, 1000 / FPU);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: perfp/Chip8
        public static void Main(string[] args)
        {
            string programpath = "test.bin";
            var chip8 = new Chip8();

            if(args.Length > 0) {
                programpath = args[0];
                chip8.Run(programpath);
            }
        }
コード例 #3
0
ファイル: Tests.cs プロジェクト: phdpua/Chip8
        private Chip8 GetCpuInstance(byte[] rom, int steps = 0)
        {
            Chip8 cpu = new Chip8();
            cpu.LoadRom(rom);

            if (steps == 0)
                steps = rom.Length / 2;

            ExecuteCommandsNTime(cpu, steps);

            return cpu;
        }
コード例 #4
0
ファイル: Tests.cs プロジェクト: phdpua/Chip8
 private void ExecuteCommandsNTime(Chip8 cpu, int number)
 {
     for (int i = 0; i < number; i++)
         cpu.ExecuteNextOpcode();
 }