1
0
forked from Rativel/BurritOS

machine tests ok

This commit is contained in:
Baptiste
2023-03-15 15:12:47 +01:00
parent 84d8bcc84f
commit 2533883ea7
2 changed files with 16 additions and 14 deletions

View File

@@ -39,8 +39,8 @@ impl Section {
/// Creates a memory section from a SectionFormat
fn from(section: &SectionFormat) -> Section {
let addr = usize::from_str_radix(&section.addr, 10).unwrap_or_default();
let len = usize::from_str_radix(&section.len, 10).unwrap_or_default();
let addr = usize::from_str_radix(&section.addr, 16).unwrap_or_default();
let len = usize::from_str_radix(&section.len, 16).unwrap_or_default();
let content: Vec<u8> = section.content.as_bytes().chunks(2).map(|x| {
u8::from_str_radix(std::str::from_utf8(x).unwrap_or_default(), 16).unwrap_or_default()
}).collect();
@@ -170,7 +170,7 @@ impl MemChecker{
for section in m_c.sections.iter() {
for (i,b) in section.content.iter().enumerate() {
machine.main_memory[section.addr/8 + i] = *b;
machine.main_memory[section.addr + i] = *b;
}
}
}