From 5409798e800b6deb5d5874401a2925d1e18d8bd3 Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Mon, 7 Apr 2025 15:55:23 +0200 Subject: almost back to normal after bytestream excursion --- mknes.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'mknes.c') diff --git a/mknes.c b/mknes.c index 977a3be..255b123 100644 --- a/mknes.c +++ b/mknes.c @@ -87,6 +87,7 @@ static GLFWwindow *window; #include "mknes.h" // #include "apu.c" #include "ppu.c" +#include "ppu_registers.c" #include "memory.c" #include "cpu.c" #include "ines2.c" @@ -132,9 +133,10 @@ int main(int argc, char **argv) { timeBeginPeriod(1); #endif + state.toggle_crt_emulation = 1; struct nes_state *nstate = allocate_nes_state(); + // ppu_generate_full_timeline(); - state.toggle_crt_emulation = 1; setbuf(stdout, 0); init_opcode_lut(); init_opcode_ud_lut(); @@ -225,12 +227,20 @@ int main(int argc, char **argv) { timer_start(timer); +#if 1 + for(uint32_t i = 0; i < 0x5000; ++ i) { + while(!nstate->ppu.frame_ready) { + // PROFILE_NAMED("nes emulator"); + cpu_tick(nstate); + } + nstate->ppu.frame_ready = 0; + frames++; + } +#else while(!glfwWindowShouldClose(window)) { - // for(uint32_t i = 0; i < 0x5000; ++ i) { timer_wait(timer); glfwPollEvents(); -// // while(!nstate->ppu.frame_ready) { // PROFILE_NAMED("nes emulator"); cpu_tick(nstate); @@ -252,6 +262,7 @@ int main(int argc, char **argv) { render_frame(); glfwSwapBuffers(window); } +#endif printf("total frames: %6.6d total cycles: %ld\n", frames, nstate->cycles); glfwDestroyWindow(window); } else { -- cgit v1.2.3