This is one of my favourite projects, while currently incomplete I have been slowly working on it for almost a year. The aim was to learn about low level hardware emulation.
I picked the NES because it is a relatively simple console to emulator (compared to newer ones) whilst being a lot more feature complete than consoles like the Atari 2600. I had always found CPU architecture quite interesting and figured the 6502 was simple enough for one person to understand how it functions.
I used some other emulators written in C/C++ to help with some of the more niche code (such as stack manipulation/flag setting) especially where documentation was lacking. After a fair amount of debugging and reading the NesDev Wiki I eventually got the CPU portion to a state where it seemed to be functioning properly, at least to a surface level. Now onto the PPU!
The PPU (Picture Processing Unit)
The NES PPU is a very specialised chip, it contains a lot of odd quirks and performs some very specific functions. This makes emulation quite difficult for several reasons:
- Documentation is lacking / can be hard to understand. This has been a nightmare as there are pages and pages of documentation in writing as well as diagrams some of which are many years old and possibly out of date.
- Hard to compare to flows I'm more familiar with. As a very specialised chip it can be difficult to understand why it does some things without having a very deep understanding of the architecture.
I'm yet to complete the PPU (Or even get a picture!). Whilst I have found the problem, the solution requires debugging the code running on the 6502 itself; thus it seems about time to write a debugger…