Hardware bugs and quirks
From NESdev Wiki
Jump to navigationJump to search
CPU
The NES uses the 6502 as its CPU core, which has a few bugs and quirks of its own. The only behavior different from a standard 6502 is the NES's decimal flag is inactive; it will behave as though it is always unset.
Some Famiclones may use a 65C02, which does have a working decimal flag and does not have the 6502's undocumented instructions. Official hardware never uses a 65C02.
PPU
- Setting bit 6 of PPUCTRL ($2000) on a stock NES can potentially damage the PPU.
- Setting PPUADDR ($2006) may corrupt the scroll registers. Be sure to set PPUCTRL ($2000) and PPUSCROLL ($2005) after you're done with PPUADDR.
- Setting OAMADDR ($2003) corrupts OAM. Usually you'll just want to set it to $00 and follow it with OAMDMA in your vblank routine, which will help with other OAM bugs as well.
- If OAMADDR is greater than 7 at the end of vblank, OAM may be corrupted.
- Blanking the display mid-frame can corrupt OAM.
- The sprite overflow flag can have false positives and false negatives.
APU
- Playing DMC samples can corrupt controller reads. Usually circumvented by re-reading the controller until two consecutive reads match.
- Writing to $4003 or $4007 will reset the phase and envelope of the channel. This means changing the high bits of a note's frequency will retrigger the note, which can cause popping noises during software sweeps. Similarly, writing to $400B will reload the triangle's linear counter.
- A negative sweep on pulse channel 1 will subtract the shifted period value minus 1. This does not happen on pulse channel 2.