diff options
| author | Peter Fors <peter.fors@mindkiller.com> | 2025-04-28 18:27:17 +0200 |
|---|---|---|
| committer | Peter Fors <peter.fors@mindkiller.com> | 2025-04-28 18:27:17 +0200 |
| commit | c40f7421d8c1ccbe008dbd2191c6642625ae4b83 (patch) | |
| tree | 9779e0a5cff2adec44897dab43d3838e8e61d3fe /mknes.c | |
| parent | 8a32bcfac621dfcaa6af832228e56713a4af6156 (diff) | |
before ppu rearrangement and fix of scanline 261
Diffstat (limited to 'mknes.c')
| -rw-r--r-- | mknes.c | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -90,7 +90,7 @@ static GLFWwindow *window; #include "render.c" static uint32_t frames; // debug information -// #include "smb_tas.h" // REMOVE ME +#include "smb_tas.h" // REMOVE ME // NES core #include "mapper.h" @@ -224,6 +224,19 @@ int main(int argc, char **argv) { uint32_t hi = nstate->mapper.prg_read(nstate, 0xfffd); nstate->cpu.pc = (hi << 8) | lo; +#if 0 + 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++; + } + return 0; +#endif + + struct timer_handle *timer = timer_new(FRAME_INTERVAL_NS); if(!timer) { fprintf(stderr, "Failed to create timer\n"); @@ -263,16 +276,6 @@ 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)) { timer_wait(timer); glfwPollEvents(); @@ -305,7 +308,6 @@ 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 { |
