summaryrefslogtreecommitdiff
path: root/ppu.c
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-04-06 20:05:32 +0200
committerPeter Fors <peter.fors@mindkiller.com>2025-04-06 20:05:32 +0200
commitdebadc464578ac2be6b75a95f6ea6f95bfecba79 (patch)
tree0d27a48974ccb36f5fde9f945174880a37746da5 /ppu.c
parent1372919415b23a9a596ca7211fd432328b2ac0cc (diff)
cleanup
Diffstat (limited to 'ppu.c')
-rw-r--r--ppu.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/ppu.c b/ppu.c
index e9a6894..d2772d8 100644
--- a/ppu.c
+++ b/ppu.c
@@ -69,7 +69,7 @@ static inline void ppu_write(struct nes_state *state, uint32_t offset, uint8_t v
case 7: { // 2007
uint32_t addr = ppu->vram_addr & 0x3fff;
if(addr < 0x2000) {
- // CHR-RAM, skip
+ state->mapper.chr_write(state, addr, value);
} else if(addr < 0x3f00) {
state->mapper.ciram_write(state, addr, value);
} else if(addr < 0x4000) {
@@ -297,29 +297,11 @@ static void ppu_tick(struct nes_state *state) {
}
ppu->vram_addr = (ppu->vram_addr & ~0x03e0) | (y << 5);
}
- goto render_and_shift;
- } break;
+ }
+ __attribute__((fallthrough));
case 1 ... 255: // fallthrough: this is 1->256
-render_and_shift: ppu_render_pixel(state);
-
- // if(UNLIKELY(dot == 256)) {
- // if((ppu->vram_addr & 0x7000) != 0x7000) {
- // ppu->vram_addr += 0x1000;
- // } else {
- // ppu->vram_addr &= ~0x7000;
- // uint32_t y = (ppu->vram_addr & 0x03e0) >> 5;
- // if(y == 29) {
- // y = 0;
- // ppu->vram_addr ^= 0x0800;
- // } else if(y == 31) {
- // y = 0;
- // } else {
- // y++;
- // }
- // ppu->vram_addr = (ppu->vram_addr & ~0x03e0) | (y << 5);
- // }
- // }
+ ppu_render_pixel(state);
__attribute__((fallthrough));
case 321 ... 336: { // fallthrough: the code below has to run 1->256 + 321->336
@@ -404,7 +386,6 @@ render_and_shift: ppu_render_pixel(state);
case 261: {
switch(dot) {
case 256: {
-
if((ppu->vram_addr & 0x7000) != 0x7000) {
ppu->vram_addr += 0x1000;
} else {