Building a NES Emulator from Scratch