Rust64 - A C64 Emulator in Rust

Rust64 is an emulator of the Commodore 64 (C64) written in the Rust programming language. This project aims to provide a clear and fun way to understand the workings of the Commodore 64 by presenting its internal operations in an unobfuscated manner. The emulation is cycle-based and currently offers a fairly accurate representation of the C64's behavior.

Features

Visual Debugger

One of Rust64's standout features is its built-in visual debugger, which provides detailed insights into various memory pages and registers. This debugger allows users to view:

  • Contents of each memory page in RAM
  • Color RAM
  • VIC (Video Interface Chip) registers
  • CIA (Complex Interface Adapter) registers
  • SID (Sound Interface Device) registers

The VIC window functions as an ICU64-style raster debugger, where each pixel signifies one VIC cycle, displaying any events occurring at that time.

Dependencies

Rust64 relies on several key dependencies to function:

  • minifb: A simple framebuffer crate that works out of the box.
  • sdl2: Requires additional setup steps, which are detailed in the rust-sdl2 repository.

Rust Version Requirement

To compile and run Rust64, you need Rust 1.58.0 or higher.

Demonstrations and Screenshots

Rust64 has been showcased in various demonstrations:

Screenshot Screenshot

Key Mappings

Rust64 includes specific key mappings for C64 and special keys to enhance the emulation experience:

  • ESC - Run/Stop
  • END - Restore
  • TAB - Control
  • LCTRL - C=
  • ` - <-
  • - - +
  • INS - &
  • HOME - CLR/Home
  • BSPACE - INST/DEL
  • [ - @
  • ] - *
  • DEL - ^
  • ; - :
  • ' - ;
  • **** - =
  • F11 - Start ASM output to console
  • F12 - Reset C64
  • RCTRL - Joystick fire button
  • NUMLOCK - Toggle between joystick ports 1 and 2 (default: port 2)

Debugger Window Keys

  • PGUP/PGDWN - Flip currently displayed memory page
  • HOME/END - Switch between RAM, Color RAM, VIC, CIA, and SID

Development and Future Enhancements

The Rust64 project is a work-in-progress (WIP), with planned enhancements and known issues:

  • TODO:
    • Implement serial bus/disk drives (d64, t64, tap)
    • Add remaining undocumented operations
    • Switch audio support from SDL2 to cpal (once it supports OSX)
    • Improve SID emulation
  • Known Issues:
    • Missing serial bus can cause some programs to perform incorrectly or enter infinite loops.
    • Programs requiring precise timing may not run correctly yet.

Resources and Inspirations

The development of Rust64 was supported by various documents and websites, including:

Similar Projects