The Nesdev wiki is the bible for writing NES emulators. It has all the technical documentation you'll need to implement the various aspects of NES hardware. It also has plenty of test ROMs, which are incredibly useful for verifying implementation details!
http://wiki.nesdev.com/w/index.php/NES_reference_guide
Fair warning, while it's pretty easy to get a half-decent 6502 emulator up and running, implementing the PPU is incredibly tricky. If you don't have a lot of experience writing emulators, I'd recommend starting with a simpler system, like the CHIP-8, before tackling the NES.