aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-04-06 16:49:36 +0200
committerlonkaars <loek@pipeframe.xyz>2023-04-06 16:49:36 +0200
commit892424ba4d0c979e4351f7a866b6fe777783e4d2 (patch)
treed6688765834be74370038d8662703bd83b1acd40 /src/main.c
parent4881723cf765fbd7bad2a1f08baf5897a7425401 (diff)
dma send done and working
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 3cb045d..fb96d84 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3,6 +3,13 @@
#include "main.h"
#include "demo.h"
#include "ppu/ppu.h"
+#include "input.h"
+
+#ifdef HH_TARGET_DESKTOP
+#include <stdio.h>
+#include "../test/ppu-stm-integration-demo/data.h"
+#include "ppu/internals.h"
+#endif
bool g_hh_run = true;
volatile unsigned long g_hh_vcount;
@@ -10,8 +17,27 @@ volatile unsigned short g_hh_hcount;
void hh_ppu_vblank_interrupt() {
static unsigned long frame = 0;
- hh_demo_loop(frame++);
+ static bool done = false;
+#ifdef HH_TARGET_STM32
hh_ppu_flush();
+ hh_input_read();
+ hh_demo_loop(frame);
+#endif
+#ifdef HH_TARGET_DESKTOP
+ //hh_ppu_vram_dwrite((uint8_t*) HH_PPUINTDEMO_ARR, HH_PPUINTDEMO_LENGTH);
+ for (unsigned int limit = 0; limit < 1000; limit++) {
+ if (frame * 4 > HH_PPUINTDEMO_LENGTH) {
+ if (!done) printf("done\n");
+ done = true;
+ return;
+ }
+ hh_ppu_vram_dwrite((uint8_t*) HH_PPUINTDEMO_ARR + frame * 4, 4);
+ uint8_t* d = HH_PPUINTDEMO_ARR + frame * 4;
+ if (d[0] == 0xff && d[1] == 0xff && d[2] == 0xff && d[3] == 0xff) break; // run all commands until flush
+ else frame++;
+ }
+#endif
+ frame++;
}
int main() {