Expand description

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.

Modules

High performance 6502 assembler.

Macros

Make an arbitrary state from flags.
Macro to get the value of an opcode from its name.
Macro to get the name of an opcode from its value.
Convert Status to binary flag.