From 0b2c805a96d5f7f93df076bec55b73c589f4f49b Mon Sep 17 00:00:00 2001 From: Johannes Muenzel Date: Fri, 26 Sep 2014 02:59:00 -0400 Subject: [PATCH] Shuffle things around a little. For now a library called machine6502 will be the main code base. 6502-rs is inconvenient to use in a rust context since it starts with a number. The test_exe is no longer the main cargo build target --- .gitignore | 2 +- Cargo.toml | 11 ++++------ src/{defs6502 => machine6502}/lib.rs | 12 +---------- src/{defs6502 => machine6502}/machine/mod.rs | 22 +++++++++++++------- src/{defs6502 => test_exe}/Cargo.toml | 11 ++++++---- src/{exe => test_exe}/main.rs | 4 ++-- 6 files changed, 30 insertions(+), 32 deletions(-) rename src/{defs6502 => machine6502}/lib.rs (82%) rename src/{defs6502 => machine6502}/machine/mod.rs (94%) rename src/{defs6502 => test_exe}/Cargo.toml (94%) rename src/{exe => test_exe}/main.rs (96%) diff --git a/.gitignore b/.gitignore index a50055b..b8dff35 100644 --- a/.gitignore +++ b/.gitignore @@ -56,7 +56,7 @@ Cargo.lock /*-*-*/ /Makefile /doc -/target/ +target/ /test/ /tmp/ TAGS diff --git a/Cargo.toml b/Cargo.toml index 3a54a43..612f4d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,14 +27,11 @@ [package] -name = "6502-rs" +name = "machine6502" version = "0.0.1" authors = ["The 6502-rs Developers"] -[[bin]] -name = "6502-rs" -path = "src/exe/main.rs" - -[dependencies.defs6502] -path="src/defs6502" +[lib] +name = "machine6502" +path = "src/machine6502/lib.rs" diff --git a/src/defs6502/lib.rs b/src/machine6502/lib.rs similarity index 82% rename from src/defs6502/lib.rs rename to src/machine6502/lib.rs index df841ba..754e212 100644 --- a/src/defs6502/lib.rs +++ b/src/machine6502/lib.rs @@ -25,15 +25,5 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -pub use machine::ProcessorStatus; -pub use machine::Machine; -pub use machine::StackPointer; -pub use machine::STACK_POINTER_IN_MEMORY_LO; -pub use machine::STACK_POINTER_IN_MEMORY_HI; -pub use machine::MemoryAddr; -pub use machine::stack_pointer_to_addr; -pub use machine::Instruction; -pub use machine::AddressingMode; - -mod machine; +pub mod machine; diff --git a/src/defs6502/machine/mod.rs b/src/machine6502/machine/mod.rs similarity index 94% rename from src/defs6502/machine/mod.rs rename to src/machine6502/machine/mod.rs index a91681c..c1a5f7d 100644 --- a/src/defs6502/machine/mod.rs +++ b/src/machine6502/machine/mod.rs @@ -50,18 +50,26 @@ pub bitflags! { } } +#[allow(non_snake_case)] pub struct Machine { - A : u8, - X : u8, - Y : u8, - SP : u8, - P : ProcessorStatus, - PC : u16, + pub A : u8, + pub X : u8, + pub Y : u8, + pub SP : u8, + pub P : ProcessorStatus, + pub PC : u16, } impl Machine { pub fn new() -> Machine { - Machine { A: 0, X: 0, Y: 0, SP: 0, P: ProcessorStatus::empty(), PC: 0 } + Machine { + A: 0, + X: 0, + Y: 0, + SP: 0, + P: ProcessorStatus::empty(), + PC: 0 + } } } diff --git a/src/defs6502/Cargo.toml b/src/test_exe/Cargo.toml similarity index 94% rename from src/defs6502/Cargo.toml rename to src/test_exe/Cargo.toml index e3d8ff4..43e1196 100644 --- a/src/defs6502/Cargo.toml +++ b/src/test_exe/Cargo.toml @@ -26,11 +26,14 @@ # POSSIBILITY OF SUCH DAMAGE. [package] -name = "defs6502" +name = "test_exe" version = "0.0.1" authors = [ "The 6502-rs Developers" ] -[lib] -name = "defs6502" -path = "lib.rs" +[[bin]] +name = "test_exe" +path = "main.rs" + +[dependencies.machine6502] +path="../../" diff --git a/src/exe/main.rs b/src/test_exe/main.rs similarity index 96% rename from src/exe/main.rs rename to src/test_exe/main.rs index fde0727..d27be44 100644 --- a/src/exe/main.rs +++ b/src/test_exe/main.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. -extern crate defs6502; +extern crate machine6502; -use defs6502::Machine; +use machine6502::machine::Machine; fn main() { let _q = Machine::new();