This emulator is geared towards an easy integration with the no_std
Rust projects
to run in the environment where is no OS. That said, it should be very easy to use
in the std
projects, too, as demonstrated by the examples below. A great emphasis
has been put on the clean implementation. Some bit twiddling has been employed in
few places to make the code branchless and hopefully even more performant.
The emulator comes with some unit-tests tests (work in progress), and most notably, it passes the 6502 functional tests.
This emulator strives to perform computation to the letter of the specification which is stricter than the real hardware and 6502 netlist-based emulators such as Perfect 6502 do. In short, this is not a hardware simulator.
The emulation algorithm is quite simple:
That said, there is no emulation of the microarch layer, e.g., no:
Stack underflows and overflows might be set to result in a fault, and the emulator will not continue execution until it is reset.
It goes without saying that the glitches at the physical layer are not emulated, too :)
Add
toml
yamos6502 = "0.1"
to your project's Cargo.toml
. If you intend not to depend on the std
crate, here is the syntax to use instead:
toml
yamos6502 = { version = "0.1", default_features = false }
yamos6502e
```text
Usage: yamos6502e [OPTIONS]
Arguments:
Options:
--rom-start print_stats
instructions
[default: 0]
--pause-millis
[default: 65536]
--log
[default: info]
[possible values: info, debug, trace]
-h, --help Print help (see a summary with '-h') -V, --version Print version ```
To run the 6502 functional tests and print staticstics every 15000000 instructions:
```sh #
# cargo run --example yamos6502e \ ../650265C02functionaltests/binfiles/6502functionaltest.bin:0000 \ --print-stats 15000000 \ --reset-pc 0x400 \ --exit-pc 0x3469 \ --stack-wraparound \ --dead-loop-iterations 16 ```
Building with --release
produces a much faster emulator at the cost of omitting some runtime
checks.