public void Go() { var cartridge = new NESLoader().Load <NESCartridge>(@"C:\Emulators\NES\Games\World\Donkey Kong (JU).nes"); this.nes.Load(cartridge); this.nes.PowerOn(); }
public void Setup() { var cartridge = new NESLoader().Load <NESCartridge>(@"C:\Emulators\NES\Games\Super Mario Bros.nes"); this.nes.Load(cartridge); this.nes.PowerOn(); this.opcodes = this.nes.CPU.Opcodes; }
public void Awake() { this.palette = new PaletteHandler(); this.rend = this.GetComponent <Renderer>(); this.texture = new Texture2D(256, 240, TextureFormat.ARGB32, mipmap: false); this.rend.material.mainTexture = texture; this.ioc = new StandardKernel(new NintendoModule()); this.nes = this.ioc.Get <NES>(); var cartridge = NESLoader.CreateCartridge(@"C:\emulators\nes\games\Super Mario Bros.nes"); this.nes.LoadCartridge(cartridge); this.nes.PowerOn(); this.nesThread = new Thread(NESStep); this.nesThread.Start(); }
private void Go() { //this.nes = this.injectionKernel.Get<NES>(); this.nes.InputHandler.SetController1(new KeyboardController(this.nes.InputHandler, new Range(0x4016, 0x4016), "Control Input 1")); //this.nes.InputHandler.SetController2(new KeyboardController(new Range(0x4017, 0x4017), "Control Input 2")); string cartridgePath = @"C:\Emulators\NES\Games\World\Donkey Kong (JU).nes"; // string cartridgePath = @"C:\Emulators\NES\Games\Super Mario Bros.nes"; // string cartridgePath = @"C:\Emulators\NES\Games\USA\Legend of Zelda, The (U) (PRG 1).nes"; // string cartridgePath = @"C:\Emulators\NES\Games\USA\Bionic Commando (U).nes"; // string cartridgePath = @"C:\Emulators\NES\Games\USA\Mega Man (U).nes"; // string cartridgePath = @"C:\Emulators\NES\Games\USA\Slalom (U).nes"; // Controller Tests // string cartridgePath = @"C:\src\emulators\nes-test-roms\read_joy3\test_buttons.nes"; // CPU Tests // PASSING //string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\01-implied.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\02-immediate.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\03-zero_page.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\04-zp_xy.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\05-absolute.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\06-abs_xy.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\07-ind_x.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\08-ind_y.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\09-branches.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\10-stack.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\instr_test-v3\rom_singles\11-jmp_jsr.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\instr_test-v3\rom_singles\12-rts.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\instr_test-v3\rom_singles\14-brk.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\instr_test-v3\rom_singles\15-special.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\instr_test-v3\rom_singles\13-rti.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nes_instr_test\rom_singles\11-special.nes"; // NMI Tests //string cartridgePath = @"C:\src\emulators\nes-test-roms\vbl_nmi_timing\1.frame_basics.nes"; // FAILING // string cartridgePath = @"C:\src\emulators\nes-test-roms\blargg_nes_cpu_test5\official.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\cpu_timing_test6\cpu_timing_test.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\oam_read\oam_read.nes"; //string cartridgePath = @"C:\src\emulators\nes-test-roms\blargg_nes_cpu_test5\official.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\nestest.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\instr_test-v3\official_only.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\cpu_timing_test6\cpu_timing_test.nes"; // PPU Tests // string cartridgePath = @"C:\src\emulators\nes-test-roms\scanline\scanline.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\scanline-a1\scanline.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\scrolltest\scroll.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\blargg_ppu_tests_2005.09.15b\palette_ram.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\blargg_ppu_tests_2005.09.15b\power_up_palette.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\blargg_ppu_tests_2005.09.15b\sprite_ram.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\blargg_ppu_tests_2005.09.15b\vbl_clear_time.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\blargg_ppu_tests_2005.09.15b\vram_access.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\full_palette\full_palette.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\scrolltest\scroll.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\cpu_dummy_reads\cpu_dummy_reads.nes"; // Sprites // Passing // Sprite-0 hits // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\01.basics.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\02.alignment.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\03.corners.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\04.flip.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\05.left_clip.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\06.right_edge.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\07.screen_bottom.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\08.double_height.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\09.timing_basics.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\10.timing_order.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_hit_tests_2005.10.05\11.edge_timing.nes"; // Sprite overflow // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_overflow_tests\1.Basics.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_overflow_tests\2.Details.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_overflow_tests\3.Timing.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_overflow_tests\4.Obscure.nes"; // string cartridgePath = @"C:\src\emulators\nes-test-roms\sprite_overflow_tests\5.Emulator.nes"; var cartridge = new NESLoader().Load <NESCartridge>(cartridgePath); this.system.Load(cartridge); this.system.PowerOn(); Task.Factory.StartNew( () => this.system.Run(), CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Current); var uiDispatcher = Dispatcher.CurrentDispatcher; Task.Factory.StartNew(() => { DateTime lastTime = DateTime.Now; long lastFrame = 0; double fps = 0; double improveBy = 0; while (!this.system.IsPaused && this.system.IsPoweredOn) { if ((DateTime.Now - lastTime).TotalSeconds >= 1) { fps = nes.CurrentFrame - lastFrame; lastFrame = nes.CurrentFrame; improveBy = 60 / fps; lastTime = DateTime.Now; uiDispatcher.Invoke(() => this.Text = $"Frame: {this.nes.CurrentFrame} FPS: {fps} Improve: {improveBy:F2}x"); } this.Draw(this.nes.Screen); } }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Current); }