From 24973d7fbd5acd19cf5d6ead626b0a8456c11757 Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Wed, 7 Apr 2021 13:55:41 +0200 Subject: [PATCH] Upgrade to Rust 2018 edition --- Cargo.toml | 1 + README.md | 14 ++++++-------- src/cpu.rs | 9 ++++----- src/instruction.rs | 6 +++--- src/memory.rs | 2 +- src/registers.rs | 4 ++-- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9626412..d8bfaee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/README.md b/README.md index 732e59a..9892621 100644 --- a/README.md +++ b/README.md @@ -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); - } ``` diff --git a/src/cpu.rs b/src/cpu.rs index c8e0ada..2b4f34d 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -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 { diff --git a/src/instruction.rs b/src/instruction.rs index ac053f2..10c4b78 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -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 // diff --git a/src/memory.rs b/src/memory.rs index a70f8cd..64a994e 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -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? diff --git a/src/registers.rs b/src/registers.rs index 92caa57..66f3bcf 100644 --- a/src/registers.rs +++ b/src/registers.rs @@ -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)]