244. Validation tiny rom writes ppu memory
VALIDATION TEST: tiny iNES ROM writes to PPU memory through PPUADDR/PPUDATA.
Lesson 244 of 356 · tests/chapter_03_ppu_memory_and_graphics_data/test_244_VALIDATION_tiny_rom_writes_ppu_memory.py
This file is not a student implementation step.
There is nothing new to implement for this test. It exists only to validate that the pieces built so far work together through their real boundaries:
iNES bytes
-> Cartridge.from_ines_bytes(data)
-> CpuBus(cartridge=cartridge, ppu=ppu)
-> CPU.reset()
-> CPU.step()
-> STA $2006 / STA $2007
-> CpuBus.write(...)
-> PPU.write_register(...)
-> PPUADDR sets vram_addr
-> PPUDATA writes through PpuBus
-> VRAM stores the byteWhy this validation exists
Previous tests verified PPUADDR, PPUDATA, PPUCTRL increment behavior, PpuBus, and CpuBus routing in isolation. This test proves a real CPU program fetched from a tiny cartridge-backed iNES ROM can write into PPU-side memory.
Tiny program placed at CPU address $8000:
A9 20 LDA #$20
8D 06 20 STA $2006 ; PPUADDR high byte
A9 00 LDA #$00
8D 06 20 STA $2006 ; PPUADDR low byte
A9 AA LDA #$AA
8D 07 20 STA $2007 ; PPUDATA write to PPU memory at $2000
EA NOPExpected result
ppu.ppu_bus.read($2000) == $AA
ppu.vram_addr == $2001Out of scope
- rendering
- nametable mirroring accuracy
- palette RAM accuracy
- CHR RAM writes
- PPUDATA reads/read buffering
- VBlank/NMI timing
Run this lesson
uv run pytest tests/chapter_03_ppu_memory_and_graphics_data/test_244_VALIDATION_tiny_rom_writes_ppu_memory.py -v