mirror of
https://github.com/mre/mos6502.git
synced 2024-11-30 20:51:21 +00:00
Add comments
This commit is contained in:
parent
abb01df4b4
commit
3830ccca27
@ -9,11 +9,12 @@ It builds on stable Rust and supports `#[no_std]` targets.
|
|||||||
## Usage example
|
## Usage example
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
extern crate mos6502;
|
|
||||||
use mos6502::address::Address;
|
use mos6502::address::Address;
|
||||||
use mos6502::cpu;
|
use mos6502::cpu;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// Calculate the greatest common divisor of 56 and 49
|
||||||
|
// using Euclid's algorithm.
|
||||||
let zero_page_data = [56, 49];
|
let zero_page_data = [56, 49];
|
||||||
|
|
||||||
let program = [
|
let program = [
|
||||||
@ -46,6 +47,7 @@ fn main() {
|
|||||||
|
|
||||||
cpu.run();
|
cpu.run();
|
||||||
|
|
||||||
|
// The expected GCD is 7
|
||||||
assert_eq!(7, cpu.registers.accumulator);
|
assert_eq!(7, cpu.registers.accumulator);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user