This is my attempt to create basic NES emulator in Java.
My goal is to not to look at other's code, but to understand on the high-level the NES architecture and create it in Java.
While developing the NES, not everything goes according to plan.
This section is to show the fun and weird experiences I had.
First pattern tile render (notice I already added CPU debugger (everything works except the stack, which for now is just for show):
Added pattern tables, added system palette, added run/stop buttons
Added assembly viewer, PPU registers viewer, and PPU debugger
First time working palette from RAM:
First time rendering basic background (on the right - the game itself):
First time working complete palette initialization from NESTEST, code is just waiting for input interrupts:
Fixed debugger nametable canvases + fixed NMI interrupt loop:
First time working controller display:
First time working NESTEST:
First time working NESTEST, fixed controller input:
First time running Donkey Kong (cool glitches):
First time working donkey kong:
Found mario face in my debugger:
Weird sprite rendering glitch:
Fixed sprite rendering glitch:
Fixed palette and colors for sprites:
A lot of debugger improvements, including:
- Palette selection: redraws the pattern tables when user selects a palette
- Rendering nametables now works correctly, sprites are not displayed there
- Added global controls for the debugger: Run/Stop and checkbox of maximum emulation speed
Trying to fix PPU rendering issues (left - my game, right - FCEUX emulator:
First time working render output using PPU timings, instead of directly reading the nametable, notice I still have some rendering problems (not drawing '1/2' pattern correctly):
The most used resorces:
- Online emulator for quick testing of the CPU: here
- Best CPU instructions summary: here
- Addressing Modes + to make my emulator CPU/cycle accurate: here, which is from a question I posted on reddit: here
Others:
- CPU Registers: wiki
- R6500 Microchip datasheet: datasheet
- Complete NES Emulator from scratch: YouTube
- NES References guide (
nesdev.org
): wiki - yizhang82's blog: blog
- A blog/website that is no longer maintained but useful (using Wayback machine): here
- Another youtuber reading the architecture: YouTube
- Blog explains 6502 addressing mode: Emulator101
- Introduction to 6502 assembly: here
- Basic NES program that actually works: here
- Great CPU summary of almost everything: here
- Started reading PPU blogs, but this one is the best: here
- Blog explains a lot about PPU, includes asm source code that runs basic blue background: here
- Detailed PPU timings (scanline, cycles): here