diff --git a/Add.asm b/Add.asm deleted file mode 100755 index 56414fe..0000000 --- a/Add.asm +++ /dev/null @@ -1,13 +0,0 @@ -// This file is part of www.nand2tetris.org -// and the book "The Elements of Computing Systems" -// by Nisan and Schocken, MIT Press. -// File name: projects/06/add/Add.asm - -// Computes R0 = 2 + 3 (R0 refers to RAM[0]) - -@2 -D=A // hi -@3 -D=D+A -@0 -M=D diff --git a/MaxL.asm b/MaxL.asm deleted file mode 100644 index 70ea3e9..0000000 --- a/MaxL.asm +++ /dev/null @@ -1,25 +0,0 @@ -// This file is part of www.nand2tetris.org -// and the book "The Elements of Computing Systems" -// by Nisan and Schocken, MIT Press. -// File name: projects/06/max/MaxL.asm - -// Symbol-less version of the Max.asm program. - -@0 -D=M -@1 -D=D-M -@12 -D;JGT -@1 -D=M -@2 -M=D -@16 -0;JMP -@0 -D=M -@2 -M=D -@16 -0;JMP diff --git a/src/main.rs b/src/main.rs index c6ce411..e01909b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,8 +49,8 @@ fn main() { .unwrap_or("") { "asm" => { - let filename = path.file_stem().unwrap().to_str().unwrap(); - let mut file = fs::File::create(format!("{}.hack", filename)).unwrap(); + let filepath = path.canonicalize().unwrap().to_str().unwrap().replace("asm", "hack"); + let mut file = fs::File::create(filepath).unwrap(); let content = fs::read_to_string(&path).expect("You must provide a correct filepath!"); let re = Regex::new(r"\s*\/\/.*").unwrap(); let processed: String = content