animate_stars makes stored stars twinkle by alternating the tile pattern written to each star location. It checks the time counter, updates only on selected ticks, and writes through the PPU during the NMI update. section 13.2.1
The function follows a small update loop:
- Use the time counter to decide whether this update should run. section 13.2.1
- Read each stored VRAM address and skip processing when the location is empty. section 13.2.1
- Select one of two star patterns from the time counter and write it to PPU_VRAM_IO. section 13.2.1
- Call the function from NMI, then clear stored locations when returning to the title screen. section 13.2.1
Twinkling stars
After compiling and running in the emulator, the game places 10 stars randomly and alternates their two graphical patterns, making them appear to twinkle. section 13.2.1
