NES Emulator part 1: the CPU

When I finished my undergrad program, I realized that I had no idea what to do with my weekends. [TODO finish intro, explain that this is about writing an NES emulator and what an NES emulator is, maybe with like a picture of an NES]

The natural starting place for a project like this is the CPU (Central Processing Unit), which is the heart of the system. A game cartridge for the NES contains a series of instructions, which tells the NES how the game is played. The CPU's job is to read those instructions and carry them out. Here's how it works:

[Picture: a picture of the MOS 6502, with boxes around it representing its registers. The PC is set to c7a0, the stack pointer is FD, and the flags set are I and B. Registers A, X, and Y are all 0. Below is a strip of boxes representing the memory. Starting at address c79e it contains values 78, d8, a9, 10, 8d, 00, 20.]

[TODO description of what a CPU is, what a register is]

[Picture: there is an arrow pointing from the PC to the memory cell at c7a0. The 6502 has a thought bubble saying "a9 = LDA".]

When the CPU wants to execute an instruction, it first needs to know what instruction to execute.


Comments powered by Disqus