Skip to content

Instantly share code, notes, and snippets.

@jacobmischka
Created February 8, 2015 05:04
Show Gist options
  • Save jacobmischka/723af9f6f7b6f3660fe6 to your computer and use it in GitHub Desktop.
Save jacobmischka/723af9f6f7b6f3660fe6 to your computer and use it in GitHub Desktop.
writecontroller
if (cpu.cycles >= 30000) { // "about" 30000 cycles
ppu.controller = val;
ppu.vram_addr_inc = ((val >> 2) & 0x1) ? 1: 32;
ppu.sprite_pattern_addr = ((val >> 3) & 0x1) * 0x1000;
ppu.bg_pattern_addr = ((val >> 4) & 0x1) * 0x1000;
ppu.sprite_height = ((val >> 5) & 0x1) ? 8 : 16;
ppu.nmi_on_vblank = (val >> 7) & 0x1;
// Change scroll latch to match base nametable address
ppu.vram_latch = (ppu.vram_latch & 0xF3FF) | ((WORD)(val & 0x3) << 10);
ppu.first_write = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment