Creating a NES emulator in C++11 (PART 1/2)

In this tool-assisted education video I create a NES emulator with C++0x. You see me type every line. The emulator is very accurate, and sort-of portable; it compiles on any architecture that support libSDL, but it outputs audio through an external program and reads joypad input from a file. This video is part 1/2. — Part 1 ( youtu.be ): Creating the emulator. — Part 2 ( youtu.be ): Compiling and running. The source code is about 940 lines in total. Download & resources: bisqwit.iki.fi FAQ: bisqwit.iki.fi Approximate count of lines of code per topic, in the source code: – 20 lines, CPU: Declarations (registers, flags and internal memory) – 100 lines, CPU: Interpreting and executing CPU opcodes & signals – 100 lines, CPU&GamePak: Memory mapping (iNES mappers 0,1,2,3,7 are supported) – 40 lines, PPU: Declarations (registers and emulator-specific status variables) – 50 lines, PPU: Memory mapping and I/O – 180 lines, PPU: Rendering and timing control – 30 lines, PPU & IO: Joypad updating (PPU provides the timing for input-file access) – 40 lines, PPU & IO: Color NTSC emulation (converting NES colors into RGB through NTSC modem) – 15 lines, IO: libSDL initialization and rendering – 35 lines, main&IO: ROM loading from file, initialization and emulation loop – 200 lines, APU: Sound emulation (of which 40 lines are because of DMC/DPCM support) – 130 lines, (other, such as comments, and inaccuracies in the above numbers) Background music: Jinguji detective series. It was
Video Rating: 4 / 5

Get the book now