Skip to content

drmonkeysee/Aldo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

  1. Install Xcode
  2. Install Homebrew
  3. brew install ncurses
  4. make run to print usage
  5. make run FILE=<file> to load a program ROM

macOS GUI

  1. Install Xcode
  2. Run make ext
  3. Open ext/ folder
  4. Mount SDL2 dmg file
  5. Copy SDL2.framework to ext/ folder
  6. Open mac/Aldo.xcodeproj
  7. 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

  1. Run locale to verify your terminal is using a UTF-8 locale (C.UTF-8 will work)
  2. [sudo] apt update
  3. [sudo] apt install -y build-essential git libncurses-dev
  4. make run to print usage
  5. make 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:

  1. [sudo] apt install -y curl libsdl2-dev
  2. Run make ext
  3. 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

  1. Follow the CinyTest build/install instructions
  2. Install Python3 (in order of recommended options)
    • manage installs via pyenv brew install pyenv and install any Python version >= 3.12
    • OR directly brew install Python@3.12 (any version >= 3.12)
    • OR install from the official site linked above
  3. make check

Debian/Ubuntu

  1. Follow the CinyTest build/install instructions
  2. Install additional dependencies [sudo] apt install -y bsdextrautils curl python3
  3. make check

The verification target is made up of these test targets:

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

Resources