Aldo
A MOS Technology 6502 emulator written in C, targeting the C17 standard and using (most) of the guidelines of Modern C.
The current milestone is to build a NES emulator, but the long-term goal is for Aldo to be a "fantasy" 6502 computer (similar to PICO-8's "fantasy console" concept), as well as being able to emulate other 6502 systems beyond the NES, such as the Commodore 64 or Apple II.
Build
At some point I may look into replacing this with CMake but at the moment the build is pretty simple.
macOS CLI
The Homebrew and ncurses steps get you the latest version of ncurses and are optional. The OS-shipped version works just as well and will be used automatically if the brew version is not installed.
- Install Xcode
- Install Homebrew
brew install ncurses
make run
to print usagemake run FILE=<file>
to load a program ROM
macOS GUI
- Install Xcode
- Run
make ext
- Open ext/ folder
- Mount SDL2 dmg file
- Copy SDL2.framework to ext/ folder
- Open mac/Aldo.xcodeproj
- Build and Run "Aldo" target
The GUI app will include a build of the CLI binary in Aldo.app/Contents/MacOS/Cli. Unlike the make target, this build will always link to the OS ncurses libraries. In addition, the GUI and CLI executables depend on a shared library embedded in the app bundle rather than statically linking everything. This means the linking and runtime characteristics of the CLI differ somewhat from the make build. Specifically, the bundled CLI binary cannot be moved to another folder or it won't find libaldo at load time. If you want a friendlier path for the CLI you can create a soft-link to it in your location of choice, for example:
ln -s /Applications/Aldo.app/Contents/MacOS/Cli/aldoc /usr/local/bin/aldoc
Debian/Ubuntu CLI
- Run
locale
to verify your terminal is using a UTF-8 locale (C.UTF-8
will work) [sudo] apt update
[sudo] apt install -y build-essential git libncurses-dev
make run
to print usagemake run FILE=<file>
to load a program ROM
Debian/Ubuntu GUI
This build is best done with GCC-12+ as earlier versions have some bugs around how C++ concepts are applied. Follow steps 1-3 of the CLI build above. Then:
[sudo] apt install -y curl libsdl2-dev
- Run
make ext
make debug-gui
This will build a binary but the platform layer is not yet implemented, so running it will print a diagnostic and exit immediately. At the moment this build is only good for cross-checking compilation between Clang and GCC.
Test
The Makefile also provides a verification target.
macOS
- Follow the CinyTest build/install instructions
- Install Python3 (in order of recommended options)
- manage installs via pyenv
brew install pyenv
and install any Python version >= 3.8 - OR directly
brew install Python@3.8
(any version >= 3.8) - OR install from the official site linked above
- manage installs via pyenv
make check
Debian/Ubuntu
- Follow the CinyTest build/install instructions
- Install additional dependencies
[sudo] apt install -y bsdextrautils curl python3
make check
The verification target is made up of these test targets:
make test
: Aldo unit tests, written using CinyTestmake nestest nesdiff
: kevtris's nestest CPU testsmake bcdtest
: Bruce Clark's Binary-coded Decimal tests; additional details in BCDTEST.md
Additionally, the macOS Xcode project's Dev target can run the Aldo unit tests. This is equivalent to the make test
target.
External Dependencies
Dependencies needed to build and run Aldo components.
CLI/Test
GUI
- SDL2 (Simple Directmedia Layer)
- Dear ImGui