Skip to content

A simple 6502 emulator written in Rust

Notifications You must be signed in to change notification settings

datag/rust-6502-emu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-6502-emu

My Rust learning project writing a simple 6502 emulator.

⚠️ Although there are some unit tests, the functionality is not yet completely tested or proven. And some functionality such as BCD mode still needs to be implemented. This is just a tinkering project - don't expect too much!

Key data:

  • Memory size: 64K
  • Stack: 0x0100 to 0x01FF
  • Reset vector address: 0xE000

Building

cargo build --release

This results in the release binary ./target/release/rust-6502-emu.

Running

Synopsis

Usage: rust-6502-emu [OPTIONS]

Options:
  -c, --cycles <CYCLES>  Cycles to execute
  -d, --demo             Load demo data
  -f, --file <FILE>      Load data from file
  -i, --interactive      Interactive mode
  -v, --verbose...       Verbosity; can be specified multiple times
  -h, --help             Print help
  -V, --version          Print version

Example invocation

Running an example program:

./target/release/rust-6502-emu -f examples/fibonacci.bin

Running an example program step-by-step in interactive mode:

./target/release/rust-6502-emu -i -f examples/fibonacci.bin

Running with demo code:

./target/release/rust-6502-emu -d

Running without a program initialized in memory is less exciting, as we're hitting a BRK as first instruction:

./target/release/rust-6502-emu

Example programs

There are some example programs in ./examples including a Makefile. CC65 is used for assembling and linking.

Pre-built *.bin files can be loaded using the -f <binfile> option.

The examples can be (re)build using make all.

Useful resources / documents

Tools

About

A simple 6502 emulator written in Rust

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages