Implemented extract_memory

This commit is contained in:
Rémi Rativel 2023-02-13 11:08:24 +01:00
parent fee880e352
commit 3269fa353f

View File

@ -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