aboutsummaryrefslogtreecommitdiff
path: root/stm32/main.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-02-24 12:07:02 +0100
committerlonkaars <loek@pipeframe.xyz>2023-02-24 12:07:02 +0100
commit7da7908989686daa2ac9fd2f3f79cad2f03c0828 (patch)
treee0446546ee97f44806aac861dd8b64cc16ae953e /stm32/main.c
parent6e1cce415050ca82f8243b5ae5a8d1564f311ee8 (diff)
WIP ppu interface
Diffstat (limited to 'stm32/main.c')
-rw-r--r--stm32/main.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/stm32/main.c b/stm32/main.c
index 4722fe0..910d2dd 100644
--- a/stm32/main.c
+++ b/stm32/main.c
@@ -1,3 +1,40 @@
+#include <malloc.h>
+#include <math.h>
+#include <stdio.h>
+
+#include "ppu/ppu.h"
+#include "ppu/consts.h"
+
+hh_s_ppu_loc_sprite* hh_debug_circle_sprite() {
+ hh_s_ppu_loc_sprite* s = malloc(sizeof(hh_s_ppu_loc_sprite));
+
+ for (int x = 0; x < HH_PPU_SPRITE_WIDTH; x++)
+ for (int y = 0; y < HH_PPU_SPRITE_HEIGHT; y++)
+ *s[y * HH_PPU_SPRITE_WIDTH + x] = (pow(x - 8, 2) + pow(y - 8, 2) < 67) ? 1 : 0;
+
+ return s;
+}
+
int main() {
+ hh_ppu_init();
+
+ hh_ppu_update_aux((hh_s_ppu_loc_aux) {
+ .bg_shift_x = 0,
+ .bg_shift_y = 0,
+ .fg_fetch = 0,
+ .sysreset = 0,
+ });
+
+ hh_s_ppu_loc_sprite* sprite = hh_debug_circle_sprite();
+ hh_ppu_update_sprite(0, *sprite);
+ free(sprite);
+
while (1);
}
+
+void hh_ppu_vblank_interrupt() {
+ static unsigned long frame = 0;
+ frame++;
+
+
+}