summaryrefslogtreecommitdiff
path: root/mknes.c
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-04-07 15:55:23 +0200
committerPeter Fors <peter.fors@mindkiller.com>2025-04-07 15:55:23 +0200
commit5409798e800b6deb5d5874401a2925d1e18d8bd3 (patch)
tree640f57759bd2b35b3797651b07fa4d4b4a03e4fc /mknes.c
parentdebadc464578ac2be6b75a95f6ea6f95bfecba79 (diff)
almost back to normal after bytestream excursion
Diffstat (limited to 'mknes.c')
-rw-r--r--mknes.c17
1 files changed, 14 insertions, 3 deletions
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 {