aboutsummaryrefslogtreecommitdiff
path: root/src/ppusim
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-03-30 15:10:17 +0200
committerlonkaars <loek@pipeframe.xyz>2023-03-30 15:10:17 +0200
commit6292c1101121bc8ba2db752cab3cbe41469b29d0 (patch)
treeb8cc9ac68b2c972b67d8aa4c9da84ea8c415a759 /src/ppusim
parent54b6ca70a74b3beb1331fd0b0bed28c665ed1f4d (diff)
new spi system
Diffstat (limited to 'src/ppusim')
-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;
+ }
}
+