A MOS 6502 CPU emulator build in Rust
Note
A Nerd Font is strongly recommended in your terminal emulator for proper rendering of UI icons.
The MOS 6502 is an 8-bit microprocessor that was designed by a small team led by Chuck Peddle for MOS Technology [...].
When it was introduced, the 6502 was the least expensive microprocessor on the market by a considerable margin. It initially sold for less than one-sixth the cost of competing designs from larger companies, such as the 6800 or Intel 8080. Its introduction caused rapid decreases in pricing across the entire processor market. Along with the Zilog Z80, it sparked a series of projects that resulted in the home computer revolution of the early 1980s.
Source: Wikipedia
![]() Home |
![]() Settings |
||||||
![]() Running |
|||||||
-
Virtual Screen: A 32x32 pixel screen using the Unicode half-block character
▀with a custom color palette.- Color Palette: Supports 16 custom colors. For more information, see the Color List.
-
Flags Container: Displays the status flags (
$N, V, D, I, Z, C$ ), highlighting active flags in bright green. -
Register Container: Live tracking of registers (
$AC, XR, YR, SP$ ). - Stack Viewer: A scrollable list showing stack addresses and values, with the current stack pointer highlighted.
- Memory Viewer: A hexadecimal grid tracking system memory layout, complete with vertical scrolling.
- Disassembly Program Viewer: Automatically disassembles loaded ROM bytes into opcodes and functions (with indented code and labeled addresses). Includes a scrollbar.
- Settings Menu: Adjustable CPU speed settings and repository links.
- Footer Bar: Quick reference guide for keyboard shortcuts and controls.
- File Browser: Lists files and folders present in the current directory, enhanced with Nerd Font icons.
- Start Address: Automatically detects files ending with
_demo.binand configures the start address to0xC000. - Emulation Speed: Adjusts the Hz / MHz target.
This project was built to help me learn Rust while using my emulator knowledge. Here is wh
- Rust: for the whole app !
ദ്ദി(˵ •̀ ᴗ - ˵ ) ✧ - Ratatui: to create a nice looking TUI
- ca65: to compile the ASM code
- ld65: to link the
.ofile into a.binfile
The easiest way to get the emulator is to install it directly via crates.io using Cargo:
cargo install rust6502Tip
To fully test the emulator, download the demo .bin files attached to the Github Release !
- Just run
rust6502and use the built-in File Explorer to navigate to your.binfiles and press Start
ദ്ദി(˵ •̀ ᴗ - ˵ ) ✧
On Stardance you can watch the full development process via all the devlogs I've created here: Rust 6502 Devlogs
- Clone the repository with
git clone https://github.com/wirenux/Rust-6502.git
cd Rust-6502- Then install the dependencies and run the program with:
cargo runTo build custom assembly files without error (handling proper memory origin segments and interrupts), it is recommended to use the cc65 toolchain (ca65 for assembly and ld65 for linking):
ca65 program.s -o program.o
ld65 program.o -C linker.cfg -o program.binTo verify instruction behavior and debugging assembly routines I have used the Masswerk 6502 Assembler & Emulator
For more information about the emulator subsystem, check out the dedicated documentation:
- Assembly & Toolchain Guide: Step by step guide to writing 6502 assembly, configuring
linker.cfg, and compiling withcc65. - Color Palette: Reference guide for the 16 custom display colors.
- Screen Documentation: Details on the memory-mapped video buffer, resolution, and pixel rendering.
- Writing small ASM programs during development to test CPU behavior, and brainstorming.
This project is created by @wirenux in Rust and use Ratatui.
This project is release under the MIT License.






