diff options
| author | Vineet Kumar <git@vineetk.net> | 2024-09-01 19:48:33 -0400 |
|---|---|---|
| committer | Vineet Kumar <git@vineetk.net> | 2026-02-01 18:48:33 -0500 |
| commit | efefe2acc2819adc7378d6ee33a4500442536d9f (patch) | |
| tree | e598943b3e395cbfb581d0a2fed66959229ef520 /cpu.c | |
| parent | e14776a4739f525ac2c5531fca94142454683563 (diff) | |
Diffstat (limited to 'cpu.c')
| -rw-r--r-- | cpu.c | 5 |
1 files changed, 5 insertions, 0 deletions
| @@ -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); |
