diff --git a/src/simulator/machine.rs b/src/simulator/machine.rs index dbd18bb..f3f635b 100644 --- a/src/simulator/machine.rs +++ b/src/simulator/machine.rs @@ -1,7 +1,8 @@ -use std::ops::{Add, Sub}; +use std::{ops::{Add, Sub}, io::Write}; use super::{decode::{Instruction, decode}}; use super::global::*; +use std::fs::File; /// doit disparaitre const MEM_SIZE : usize = 4096; @@ -136,6 +137,17 @@ impl Machine { } } + /// Write the contains of the main memory of the machine + /// in a file called burritos_memory.txt + /// + /// ### Parameters + /// + /// - **machine** contains the memory + pub fn extract_memory(machine: &mut Machine){ + let mut file = File::create("burritos_memory.txt").unwrap(); + file.write(&machine.main_memory); + } + /// Execute the instructions table of a machine putted in param /// /// ### Parameters