Implemented extract_memory
This commit is contained in:
parent
fee880e352
commit
3269fa353f
@ -1,7 +1,8 @@
|
|||||||
use std::ops::{Add, Sub};
|
use std::{ops::{Add, Sub}, io::Write};
|
||||||
|
|
||||||
use super::{decode::{Instruction, decode}};
|
use super::{decode::{Instruction, decode}};
|
||||||
use super::global::*;
|
use super::global::*;
|
||||||
|
use std::fs::File;
|
||||||
|
|
||||||
/// doit disparaitre
|
/// doit disparaitre
|
||||||
const MEM_SIZE : usize = 4096;
|
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
|
/// Execute the instructions table of a machine putted in param
|
||||||
///
|
///
|
||||||
/// ### Parameters
|
/// ### Parameters
|
||||||
|
Loading…
Reference in New Issue
Block a user