aboutsummaryrefslogtreecommitdiff
path: root/src/ppusim/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ppusim/mem.c')
-rw-r--r--src/ppusim/mem.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ppusim/mem.c b/src/ppusim/mem.c
index bd8606e..f536727 100644
--- a/src/ppusim/mem.c
+++ b/src/ppusim/mem.c
@@ -6,8 +6,14 @@
hh_ppu_data_t *g_hh_ppusim_vram = NULL;
-void hh_ppu_vram_dwrite(hh_ppu_addr_t addr, hh_ppu_data_t data) {
- if (!hh_ppu_vram_valid_address(addr)) return;
- // printf("ppu[0x%04x] = %04x\n", addr, data);
- g_hh_ppusim_vram[addr] = data;
+void hh_ppu_vram_dwrite(uint8_t* data, size_t size) {
+ for (size_t i = 0; i < size; i += 4) {
+ if (i+4 > size) break;
+ hh_ppu_addr_t ppu_addr = (data[i+0] << 8) | (data[i+1] << 0);
+ hh_ppu_data_t ppu_data = (data[i+2] << 8) | (data[i+3] << 0);
+ // printf("%04x: %04x\n", ppu_addr, ppu_data);
+ if (!hh_ppu_vram_valid_address(ppu_addr)) continue;
+ g_hh_ppusim_vram[ppu_addr] = ppu_data;
+ }
}
+