summaryrefslogtreecommitdiff
path: root/ppu.c
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2024-07-21 13:53:04 -0400
committervin <git@vineetk.net>2024-07-21 13:53:04 -0400
commit7d148924e2fee1a2692d2c49a01e6770b630f906 (patch)
tree0fc1abc86a7dae9c249f9a796f4af2e9ebbaffff /ppu.c
parent2df7df5f5b0f325864f92c5a58f3c132cfff989e (diff)
start implementing PPU
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;
+}