The following resources were used for the project:
- The great work on wiki.nesdev.org
- R650X and R651X Datasheet http://www.6502.org/documents/datasheets/rockwell/rockwell_r650x_r651x.pdf
- Reset behaviour description https://www.pagetable.com/?p=410
- The cc65 assembler
- https://github.com/clbr/neslib
- NTSC NES palette generator
This project the following awesome libraries
- Ebiten for 2D display, audio and input
- CPU Working "We've built a working 6502 emulator. Kinda cool"
- Nes Illegal Opcodes "Look at the debug tool, it's amazing"
- PPU Debug Working
- DMA Working
- PPU Background Rendering Clock Accurate
- PPU Sprite Rendering Working Clock Accurate
- Input Working
- APU Working
- Implemented iNES Mappers: Mapper000, Mapper002
Start the emulator with nes romfile.rom
The rom file should be valid rom file including iNES header. You can build your own rom file with the description below.
Space
- Start or Stop auto modeEnter
- Execute one CPU instructionArrow Up
- Execute one CPU ClockArror Left
- Execute one Master/PPU ClockR
ResetF1
Hide/Display CPU Debug displayF2
Hide/Display Pattern TablesF3
Hide/Display Nametable InformationF4
Hide/Display Palette InformationL
Enable LoggingKeypad
Enter requested instruction that should be executed when pressing enter. 0 = Disabled,Esc
Reset requested instructions
- No CGO required. Just run
go buid github.com/exp625/gones
TODO
- Install the cc65 compiler
- Write your C program inside the test folder
test.c
- Assemble you C program to 6502 assembler
cc65 -Os -T -t nes test.c
- Create object files for
- Your assembled program
ca65 -t nes test.s
- The startup code
ca65 -t nes crt0.s
- The default nes characters
ca65 -t nes chars.s
- Your assembled program
- Create your rom file
ld65 -C memory.cfg test.o crt0.o chars.o nes.lib -o $FILE.nes
For a one liner (Set FILE
accordingly): FILE="test" && cc65 -Os -T -t nes $FILE.c && ca65 -t nes $FILE.s && ca65 -t nes crt0.s && ca65 -t nes chars.s && ld65 -C memory.cfg $FILE.o crt0.o chars.o nes.lib -o $FILE.nes
- Download the awesome nestest.rom
- Download the known good cpu log
- Start the emulator with the nestest.rom file
nes nestest.rom
- Force the emulator to start execution on 0xC000 and set P flag to 0x24 using the
Q
Key ( See Note for why) - Enable logging to file using
L
Key - Run the emulator step by step or in auto mode
- Compare generated log file to the know good log file