summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2019-10-01 00:23:21 +0300
committerOxore <oxore@protonmail.com>2019-10-01 00:23:21 +0300
commit9f9569447bdd1c7a82baebbd88cdb37e30eb180c (patch)
tree9a871a9a8db28949dbc97ad62f22e2506d7d6a13 /src
parent6195de98c48a43f1c9d7838e8d2d9d11a1ae3571 (diff)
Implement loading hex from file
Diffstat (limited to 'src')
-rw-r--r--src/main.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index f424b0e..f5dd8c1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,5 @@
+use std::env;
+use std::fs;
use std::io;
use std::io::prelude::*;
use std::{thread, time};
@@ -44,10 +46,18 @@ fn cli_controller(asyncpair: Arc<(Mutex<bool>, Condvar)>) {
}
fn main() {
+ let args: Vec<_> = env::args().collect();
+ if args.len() < 2 {
+ println!("Please, specify ihex file");
+ return;
+ }
+ let data = fs::read_to_string(&args[1])
+ .expect(&format!("Unable to read file {}", &args[1]));
+
let asyncpair = Arc::new((Mutex::new(false), Condvar::new()));
let asyncpair2 = asyncpair.clone();
- let core = match Core::with_ram_from_hex(String::from(":0300000075800008\n:00000001FF\n")) {
+ let core = match Core::with_ram_from_hex(String::from(data)) {
Ok(value) => value,
Err(err_string) => {
println!("{}", err_string);