Giter Club home page Giter Club logo

cpu-6502-rs's Introduction

6502 Emulator in Rust

This is a 6502 emulator, debugger, and visualizer built in Rust. It features an ASM compiler, which takes in an .asm file, and can either output the binary machine code, or load it directly in memory and run it. This project started as an NES emulator, but I decided I was having more fun just building the CPU emulator, and stopped there. I spent more time on compiler and debugger, as I found that interesting.

screenshot of debugger

How to run

The CPU debugger and visualizer can visualize the CPU running, and let you step through the code.

See all of the asm examples.

tree src/bin/cpu-visualizer/asm

src/bin/cpu-visualizer/asm
├── add-with-carry.asm
├── addressing-modes.asm
├── branching.asm
├── compare.asm
├── fibonacci-u16.asm
├── fibonacci-u8.asm
├── fill-zero-page.asm
├── labels-with-jumps.asm
├── logical-operators.asm
├── register-a-modes.asm
├── stack.asm
└── status-flags.asm

Run the cpu-visualizer binary with a path to the .asm file.

cargo run -p cpu-visualizer -- crates/cpu-visualizer/asm/fill-zero-page.asm

The shortcuts for the program can be viewed by hitting ? while using the program.

┌Help─────────────────────────────────────┐
│   n - next instruction                  │
│ 1-9 - next instructions exponentionally │
│ h/? - show help                         │
│   q - quit                              │
│   a - add a page of memory              │
│   r - remove a page of memory           │
└─────────────────────────────────────────┘

To view the logs of the visualizer append the following:

2> error.log; clear; cat error.log

Simple Game

I also built a simple game visualizer which can run the snake game from the Easy 6502 tutorial.

cargo run -p simple-game -- crates/simple-game/asm/snake.asm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.