summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs
index 8f1acad..05b32c2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -9,7 +9,10 @@ use std::time::Duration;
mod core;
mod rom;
+mod memory;
+
use self::core::Core;
+use self::rom::Rom;
enum Control {
Run(bool),
@@ -126,34 +129,34 @@ fn main() {
.value_of("file")
.expect("No file name provided");
- let controller = {
- let controller_type_name = cli_args_matches
- .value_of("interface")
- .expect("No interface type specified");
- new_controller(controller_type_name)
- .unwrap_or_else(|_| panic!("Unknown controller type \"{}\"", controller_type_name))
- };
-
/* Read program and instantiate a simulator */
let data =
fs::read_to_string(filename).unwrap_or_else(|_| panic!("Unable to read file {}", filename));
- let core = match Core::new_with_rom_from_hex(data) {
+ let core = Core::new().rom(match Rom::from_hex(data) {
Ok(value) => value,
Err(err_string) => {
println!("{}", err_string);
return;
}
- };
+ });
/* Run core worker and controller */
let (bound_core, bound_controller) = new_bound_pair();
+ core_worker(core, bound_core);
+
thread::spawn(move || {
- core_worker(core, bound_core);
+ let controller = {
+ let controller_type_name = cli_args_matches
+ .value_of("interface")
+ .expect("No interface type specified");
+ new_controller(controller_type_name)
+ .unwrap_or_else(|_| panic!("Unknown controller type \"{}\"", controller_type_name))
+ };
+
+ controller(bound_controller);
});
-
- controller(bound_controller);
}