summaryrefslogtreecommitdiff
path: root/cpu.c
diff options
context:
space:
mode:
authorVineet Kumar <git@vineetk.net>2024-09-01 19:48:33 -0400
committerVineet Kumar <git@vineetk.net>2026-02-01 18:48:33 -0500
commitefefe2acc2819adc7378d6ee33a4500442536d9f (patch)
treee598943b3e395cbfb581d0a2fed66959229ef520 /cpu.c
parente14776a4739f525ac2c5531fca94142454683563 (diff)
add incomplete ppuHEADmaster
Diffstat (limited to 'cpu.c')
-rw-r--r--cpu.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cpu.c b/cpu.c
index a04c603..bf8ab90 100644
--- a/cpu.c
+++ b/cpu.c
@@ -54,6 +54,8 @@ peek(uint16_t addr)
54 fprintf(stderr, "PRG ROG size is not 0x4000 nor 0x8000\n"), exit(1); 54 fprintf(stderr, "PRG ROG size is not 0x4000 nor 0x8000\n"), exit(1);
55 } else if ((addr >= 0x4000 && addr <= 0x4013) || addr == 0x4015 || addr == 0x4017) 55 } else if ((addr >= 0x4000 && addr <= 0x4013) || addr == 0x4015 || addr == 0x4017)
56 return apu_read(addr); 56 return apu_read(addr);
57 else if (addr >= 0x2000 && addr <= 0x3FFF)
58 return ppu_read(addr);
57 else 59 else
58 return memory[addr]; 60 return memory[addr];
59} 61}
@@ -71,6 +73,9 @@ memwrite(uint16_t addr, uint8_t byte)
71 if (addr >= 0x4000 && addr <= 0x4017) { 73 if (addr >= 0x4000 && addr <= 0x4017) {
72 apu_write(addr, byte); 74 apu_write(addr, byte);
73 return; 75 return;
76 } else if (addr >= 0x2000 && addr <= 0x3FFF) {
77 ppu_write(addr, byte);
78 return;
74 } 79 }
75 80
76 MEMORY_MIRROR(addr); 81 MEMORY_MIRROR(addr);