summaryrefslogtreecommitdiff
path: root/ppu.c
diff options
context:
space:
mode:
Diffstat (limited to 'ppu.c')
-rw-r--r--ppu.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ppu.c b/ppu.c
new file mode 100644
index 0000000..4ae0162
--- /dev/null
+++ b/ppu.c
@@ -0,0 +1,15 @@
+#include "ppu.h"
+
+struct ppu ppu = {0};
+
+void
+ppu_tick(void)
+{
+ ppu.cycles++;
+ if (ppu.cycles >= 341) {
+ ppu.cycles -= 341;
+ ppu.scanlines++;
+ }
+ if (ppu.scanlines >= 262)
+ ppu.scanlines -= 262;
+}