Non cycle-accurate emulator of the 6502 cpu, written in pure rust

Related tags

Emulators cpu6502
Overview

CPU 6502

A non cycle-accurate emulator implementing all legal 6502 opcodes.

What does non cycle-accurate mean?

Every instruction on the 6502 takes a number of clock cycles to complete a single instruction, depending on many factors including memory paging.

This emulator does have a concept of clock, but every instruction takes just one clock cycle to complete. Also, there are no initial clock cycles.

What about interrupts?

As of now, this is no reliable emulator. I'm planning on working on a cycle-accurate 1:1 rapresentation of the 6502 based on this project, which will include interrupts and resets, and will not include any reference to the standard library.

However, BRK interrupts are still completely functional and work as intended.

Sounds cool, how do I run it?

This project is written in Rust, so you will need cargo (or at least rustc) in order to compile it.

Using cargo:

cargo build --release

The output binary will be available here: ./target/release/cpu6502

Actually running it

Once you've built the binary you can run:

./target/release/cpu6502 program.o65

where program.o65 is the binary file containing your program.

A note on running programs

All programs are loaded by an offset of 0x8000 into memory. So you'll need to specify the reset vector to point to that memory location.

You can see an example of how this is done in any of the examples under the examples/ folder

Running an example

Examples are built following xa assembler guidelines, and use its pseudo-opcodes (or macros) for memory allignment.

Compiling an example with xa is really straight-forward:

xa examples/fibonacci.s

Then run it with the emulator binary:

./target/release/cpu6502 a.o65

And the program should panic upon reaching the jamming opcode 0x22, printing the processor status, with the result of the fibonacci sequence stored in the A register (the accumulator)

You might also like...
NES emulator written in Rust to learn Rust

OxideNES A NES emulator in Rust. CPU should be accurate, PPU is mostly accurate, timing between the 2 is off for some corner cases and hardware qui

Commodore 64 emulator written in Rust
Commodore 64 emulator written in Rust

Rust64 - a C64 emulator written in Rust This is my attempt to study the Rust programming language and have fun at the same time. The goal is to presen

A Flash Player emulator written in Rust
A Flash Player emulator written in Rust

website | demo | nightly builds | wiki Ruffle Ruffle is an Adobe Flash Player emulator written in the Rust programming language. Ruffle targets both t

A Game Boy research project and emulator written in Rust

Mooneye GB Mooneye GB is a Game Boy research project and emulator written in Rust. The main goals of this project are accuracy and documentation. Some

RustBoyAdvance-NG is a Nintendo™ Game Boy Advance emulator and debugger, written in the rust programming language.
RustBoyAdvance-NG is a Nintendo™ Game Boy Advance emulator and debugger, written in the rust programming language.

RustBoyAdvance-NG Nintendo GameBoy Advance ™ emulator and debugger, written in rust. WebAssembly Demo: https://michelhe.github.io/rustboyadvance-ng/ P

An NES emulator written in Rust

Pinky Pinky is an NES emulator written in Rust completely from scratch based only on publicly available documentation. You can run it in your Web brow

NES emulator written in Rust

sprocketnes is an emulator for the Nintendo Entertainment System written in the Rust programming language. Its purpose is to serve as a technology dem

ZX Spectrum emulator written in Rust
ZX Spectrum emulator written in Rust

rustzx ZX Spectrum emulator which I writing in rust. I develop this project just for fun and for learning the basics of computer architecture. License

CHIP-8 emulator written in Rust
CHIP-8 emulator written in Rust

CHIP-8 emulator written in Rust. This is intended to be a project for gaining experience writing emulators and practice Rust.

Owner
Pietro
@stack_smash on telegram.
Pietro
Cycle-accurate Gameboy Color emulator in Rust

Description Currently intended only for personal research, this is a WIP cycle-accurate GB/C emulator written in Rust. Building If you wish to build f

Luke Stadem 3 May 5, 2022
A 6502 emulator written in Rust.

v6502 This package contains an emulator for the 6502 microprocessor. It doesn't support binary decimal (BCD) mode yet. To run the debug version: cargo

Andrew Young 4 Nov 14, 2021
🥔 MOS-6502 and NES emulator in Rust (SDL/WebAssembly)

?? Potatis /mos6502 - Generic CPU emulator. Passes all tests, including illegal ops. (No BCD mode). /nes - A very incomplete NES emulator. /nes-sdl -

Henrik Persson 28 Jan 9, 2023
Intel 8080 cpu emulator by Rust

i8080 i8080 is a emulator for Intel 8080 cpu. 8080 Programmers Manual 8080 opcodes [dependencies] i8080 = { git = "https://github.com/mohanson/i8080"

Mohanson 83 Dec 27, 2022
A CPU emulator for running unit tests on Game Boy code.

evunit This is a unit testing application for Game Boy roms. It includes a CPU emulator, and loads test configurations from TOML files. Configuring a

Evie M. 8 Jan 1, 2023
SCEMU The crates.io lib, x86 cpu and systems emulator focused mainly for anti-malware

SCEMU Usage Download the maps32.zip or maps64.zip from: https://github.com/sha0coder/scemu/releases/download/maps/maps32.zip https://github.com/sha0co

sha0coder 11 Dec 25, 2022
Emulator and debugger for LPRS1 ISA & CPU

About LPRSemu is a simple emulator and debugger for LPRS1 ISA & CPU. It supports loading programs from assembly text files, binary string representati

Filip Parag 3 Jan 8, 2023
Chip8 emulator written in pure rust, using rust-sdl2 for graphics

Rust-8 chip8 emulator written in rust, using rust-sdl2 for graphics. Features Fully implemented all 35 original chip8 opcodes. This emulator does NOT

Chris Hinson 7 Dec 28, 2022
Nes-emulator - A NES emulator made to learn the Rust programming language

nes-emulator Building $ rustc --version rustc 1.32.0 (9fda7c223 2019-01-16) $ cargo --version cargo 1.32.0 (8610973aa 2019-01-02) $ cargo build --rel

Michael Burge 225 Dec 23, 2022
Intel 8085 CPU emulation in Rust

PP8085 PP808 is a program that emulates the Intel 8085 Microprocessor architecure. The library is written in Rust and aims to mirror the operation of

Parth Pant 6 Jul 7, 2022