diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-04-07 19:29:17 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-04-07 19:29:17 +0200 |
commit | cc5fda1626ac77a74459bcfe3c422be3c2a5267b (patch) | |
tree | 07b46ae1a507359ac241869c7c3e5887d80880d0 /src/ppusim/mem.c | |
parent | 892424ba4d0c979e4351f7a866b6fe777783e4d2 (diff) |
WIP more debugging
Diffstat (limited to 'src/ppusim/mem.c')
-rw-r--r-- | src/ppusim/mem.c | 11 |
1 files changed, 9 insertions, 2 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)); + } } } |