2 releases

0.1.1 Oct 26, 2022
0.1.0 Oct 23, 2022

#1279 in Algorithms

35 downloads per month
Used in 2 crates

GPL-3.0-or-later

85KB
2K SLoC

vm6502

As the name suggests, this crate is a 6502 virtual machine.

It's primary application case is found in emu6502.

Currently, if you'd like more information, please check docs.rs to the vm6502 crate.

    # To run the virtual cpu tests, first cd to the `vm6502` directory then run:
    cargo test

Features

`pretty', 'debug', and 'ugly' debugging modes available to emu6502.

When debugging vm6502, there are many features you can enable and disable, see the Cargo.toml for information.

References


lib.rs:

6502 virtual machine implementation.

This crate provides a virtual machine for the 6502 CPU.

It is designed to be used as a library, with no frontend.

Virtual machine

The virtual machine is implemented as a struct, VirtualMachine, which contains all the state of the machine. The state is stored in a flat array, which is indexed by the Registers struct.

Specifications

Registers

THere are 8 status flags, stored in the registers.

S/N: The B flag is not actually set on the real 6502 status register, instead it's configured in memory when it's pushed and pulled. (Presumably during BRK)

Flags

Memory

The VirtualMachine has a flat memory map which the stack and heap index into.

Addressing modes

Instruction set

Instructions

Macros

Several macros are provided for more easily interacting with the machine and wielding opcodes. See more.

!! In construction !!

Also provided is an assembler and a programmer.

Dependencies

~2.5MB
~54K SLoC