HangX-Ma / tinynes

NES emulator based on 6052 CPU written from scratch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tinynes

NES emulator based on 6052 CPU written from scratch.

This project based on OneLoneCoder/olcNES, following rules described in OneLoneCoder's license.

Tinynes: Super Mario Bro
Tinynes: Super Mario Bro

Prerequisite

  • Ubuntu 20.04 or higher
  • CMake 3.14 or higher
  • Install SFML2.x for graphic debug.
sudo apt-get install build-essential
sudo apt-get install libsfml-dev

Usage

git clone https://github.com/HangX-Ma/tinynes
cd tinynes
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
# run simulator
./build/demo/demo_ppu

You can find loadCartridge function and change the file_path to switch nes file. Please check demo source code to figure out control logic.

Generally, ↑, ↓, ←, → control the moving directions; A, S, Z, X are functional keys; <space> starts simulator; R resets simulator.

Schedule

  • STEP 1: Complete 6052 processor instruction set and adapt SFML graphic library
  • STEP 2: Add PPU(Picture Processing Unit) background, foreground and other units like VRAM, Cartridge, etc
  • STEP 3: Add APU(Audio Processing Unit) and develop SFML custom audio stream processing tool
  • STEP 4: Add more mapper and optimize runtime speed with APU component. (If possible)

NES Emulator Concept

NES Memory Map
NES Memory Map

You can find the description of CPU memory map from NES Dev wiki: CPU memory map. The above picture used as a note to describe the NES emulator system.

All components are linked and managed by the main BUS. The bus takes the responsibility to transfer data and message. Except the main BUS, PPU has its own bus to communicates with other graphic related components such as pattern tables, name tables, palettes, etc.

Reference

License

MIT License

About

NES emulator based on 6052 CPU written from scratch

License:MIT License


Languages

Language:C++ 86.8%Language:CMake 12.5%Language:C 0.7%