1
0
mirror of https://github.com/mre/mos6502.git synced 2024-11-25 02:33:26 +00:00

Upgrade to Rust 2018 edition

This commit is contained in:
Matthias Endler 2021-04-07 13:55:41 +02:00
parent b6e4a5ce8b
commit 24973d7fbd
6 changed files with 17 additions and 19 deletions

View File

@ -34,6 +34,7 @@ version = "0.2.0"
authors = ["The 6502-rs Developers"]
build = "build.rs"
exclude = ["examples/**"]
edition = "2018"
[lib]
# This will look in src/lib.rs

View File

@ -17,24 +17,23 @@ use mos6502::address::Address;
use mos6502::cpu;
fn main() {
let zero_page_data = [56, 49];
let program = [
// (F)irst | (S)econd
// .algo
// (F)irst | (S)econd
// .algo
0xa5, 0x00, // Load from F to A
// .algo_
// .algo_
0x38, // Set carry flag
0xe5, 0x01, // Substract S from number in A (from F)
0xf0, 0x07, // Jump to .end if diff is zero
0x30, 0x08, // Jump to .swap if diff is negative
0x85, 0x00, // Load A to F
0x4c, 0x12, 0x00, // Jump to .algo_
// .end
// .end
0xa5, 0x00, // Load from S to A
0xff,
// .swap
0xff,
// .swap
0xa6, 0x00, // load F to X
0xa4, 0x01, // load S to Y
0x86, 0x01, // Store X to F
@ -51,6 +50,5 @@ fn main() {
cpu.run();
assert_eq!(7, cpu.registers.accumulator);
}
```

View File

@ -25,11 +25,10 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
use address::{Address, AddressDiff};
use instruction;
use instruction::{DecodedInstr, Instruction, OpInput};
use memory::Memory;
use registers::{Registers, StackPointer, Status, StatusArgs};
use crate::address::{Address, AddressDiff};
use crate::instruction::{self, DecodedInstr, Instruction, OpInput};
use crate::memory::Memory;
use crate::registers::{Registers, StackPointer, Status, StatusArgs};
#[derive(Clone)]
pub struct CPU {

View File

@ -25,9 +25,9 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
use address::Address;
use address::AddressDiff;
use cpu::CPU;
use crate::address::Address;
use crate::address::AddressDiff;
use crate::cpu::CPU;
// Abbreviations
//

View File

@ -25,7 +25,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
use address::{Address, AddressDiff};
use crate::address::{Address, AddressDiff};
// JAM: We can probably come up with a better way to represent address ranges.
// Address range type?

View File

@ -25,8 +25,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
use address::{Address, AddressDiff};
use memory::{STACK_ADDRESS_HI, STACK_ADDRESS_LO};
use crate::address::{Address, AddressDiff};
use crate::memory::{STACK_ADDRESS_HI, STACK_ADDRESS_LO};
// Useful for constructing Status instances
#[derive(Copy, Clone)]