Building a Nintendo Entertainment System in Verilog.
Aim: to play the original NES Super Mario Bros ROM.
- Implemented
- 6502 CPU working and passing tests (for official opcodes)
- OAM DMA working
- PPU background layer
- Emulation
- Verilator emulation running in C++ with PixelGameEngine renderer from OneLoneCoder
- Super Mario Bros - now able to reach splash screen
- FPGA
- NES Running on ARTY A7 hardware
- Arduino based interface for uploading ROMs and debugging the NES design
- Super Mario Bros - now able to reach splash screen
- Bazel v5.0.0
brew install bazel
- MacOS
- Add '--spawn_strategy=local' and '--config debug' to bazel command line, to make sure symbols are correctly included in your build
- When debugging in VSCode with a C++ config, you can see symbol values
- Breakpoints can be set in source files via VSCode
- When lldb stops execution at a breakpoint, VSCode is not currently able to load the correct source file - further investigation required
bazel build //nes:test-cpu6502 --incompatible_require_linker_input_cc_api=false
./bazel-bin/nes/test-cpu6502
bazel build //nes:test-ppu --incompatible_require_linker_input_cc_api=false
./bazel-bin/nes/test-ppu
bazel build //nes:test-nes --incompatible_require_linker_input_cc_api=false
./bazel-bin/nes/test-nes
Currently supported on MacOSX.
Implemented with the OneLoneCoder Pixel Game Engine.
Test the VGA output module.
bazel build //nes:emulator-vga --incompatible_require_linker_input_cc_api=false --config release
./bazel-bin/nes/emulator-vga
Currently supported on MacOSX.
Implemented with the OneLoneCoder Pixel Game Engine.
bazel build //nes:emulator-cpu --incompatible_require_linker_input_cc_api=false --config release
./bazel-bin/nes/emulator-cpu
Key | Action |
---|---|
Z | Reset Simulation |
R | Switch between single step and run mode |
SPACE | Step through a single Opcode (in single step mode) |
Currently supported on MacOSX.
Implemented with the OneLoneCoder Pixel Game Engine.
bazel build //nes:emulator-nes --incompatible_require_linker_input_cc_api=false --config release
./bazel-bin/nes/emulator-nes
Debugger interface for interacting with CPU6502, intended for use with SPI comms.
bazel build //nes:test-debugger-cpu --incompatible_require_linker_input_cc_api=false
./bazel-bin/nes/test-debugger-cpu
Debugger interface for interacting with NES, intended for use with SPI comms.
bazel build //nes:test-debugger-nes --incompatible_require_linker_input_cc_api=false
./bazel-bin/nes/test-debugger-nes
Information from .nes rom headers dumped with scripts/parse_ines.py
- Super Mario World
PRG ROM 2 x 16 KB units
CHR ROM 1 x 8 KB units
mirroring: horizontal
has batter backed prg rom: False
has trainer: False
ignore mirroring control: False
mapper number: 0
- Super Mario World 2
PRG ROM 8 x 16 KB units
CHR ROM 16 x 8 KB units
mirroring: vertical
has batter backed prg rom: False
has trainer: False
ignore mirroring control: False
mapper number: 4
- Super Mario World 3
PRG ROM 16 x 16 KB units
CHR ROM 16 x 8 KB units
mirroring: vertical
has batter backed prg rom: False
has trainer: False
ignore mirroring control: False
mapper number: 4
- Kirby's Adventure ''' PRG ROM 32 x 16 KB units CHR ROM 32 x 8 KB units mirroring: vertical has batter backed prg rom: True has trainer: False ignore mirroring control: False mapper number: 4 '''
- Super Mario Disassembly - useful for stepping through code
- NOTE: infinite loop at 0x8057 appears to be label "EndlessLoop"
- perhaps we can step through code from 'start' to see what needs to be emulated so far