aboutsummaryrefslogtreecommitdiff
path: root/src/ppusim
diff options
context:
space:
mode:
Diffstat (limited to 'src/ppusim')
-rw-r--r--src/ppusim/mem.c11
-rw-r--r--src/ppusim/sim.h2
-rw-r--r--src/ppusim/work.c4
3 files changed, 10 insertions, 7 deletions
diff --git a/src/ppusim/mem.c b/src/ppusim/mem.c
index 20464cb..def14c0 100644
--- a/src/ppusim/mem.c
+++ b/src/ppusim/mem.c
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "ppu/internals.h"
#include "ppusim/mem.h"
@@ -39,9 +40,10 @@ static void hh_ppu_dbg_memprint(hh_ppu_addr_t addr, hh_ppu_data_t data) {
}
case 3: {
unsigned short i = addr - HH_PPU_VRAM_PAL_OFFSET;
- printf(" (pal[%02i] = #%x%x%x%x%x%x)", i, (data >> 0) & 0xf, (data >> 0) & 0xf,
+ printf(" (pal[%02i] = #%x%x%x%x%x%x)", i,
+ (data >> 8) & 0xf, (data >> 8) & 0xf,
(data >> 4) & 0xf, (data >> 4) & 0xf,
- (data >> 8) & 0xf, (data >> 8) & 0xf);
+ (data >> 0) & 0xf, (data >> 0) & 0xf);
break;
}
case 4: {
@@ -68,6 +70,11 @@ void hh_ppu_vram_dwrite(uint8_t* data, size_t size) {
#endif
if (!hh_ppu_vram_valid_address(ppu_addr)) continue;
g_hh_ppusim_vram[ppu_addr] = ppu_data;
+
+ if (ppu_addr == HH_PPU_VRAM_AUX_OFFSET + 1) {
+ bool reset = HH_RESIZE(ppu_data, 2, 2);
+ if (reset) memset(g_hh_ppusim_vram, 0x0000, 0xffff * sizeof(hh_ppu_data_t));
+ }
}
}
diff --git a/src/ppusim/sim.h b/src/ppusim/sim.h
index 4d1d718..4911a06 100644
--- a/src/ppusim/sim.h
+++ b/src/ppusim/sim.h
@@ -1,7 +1,7 @@
#pragma once
/** @brief pixel-perfect upscale factor for PPUSIM */
-#define HH_PPUSIM_UPSCALE_FACTOR 3
+#define HH_PPUSIM_UPSCALE_FACTOR 1
/** @brief max framerate for PPUSIM */
#define HH_PPUSIM_FRAMERATE 60
diff --git a/src/ppusim/work.c b/src/ppusim/work.c
index 977b2c4..c8964cd 100644
--- a/src/ppusim/work.c
+++ b/src/ppusim/work.c
@@ -25,10 +25,6 @@ void *hh_ppusim_draw_thread(void *arg) {
}
void hh_ppusim_draw_frame(SDL_Renderer *renderer) {
- hh_ppu_data_t *aux = &g_hh_ppusim_vram[HH_PPU_VRAM_AUX_OFFSET];
- bool reset = HH_RESIZE(aux[1], 2, 2);
- if (reset) memset(g_hh_ppusim_vram, 0x0000, 0xffff * sizeof(hh_ppu_data_t));
-
for (unsigned core = 0; core < g_hh_ppusim_core_count; core++) pthread_create(&g_hh_ppusim_threads[core], NULL, hh_ppusim_draw_thread, (void *)(unsigned long)core);
for (unsigned core = 0; core < g_hh_ppusim_core_count; core++) pthread_join(g_hh_ppusim_threads[core], NULL);