Fix endianness issues particulary with strings
This commit is contained in:
@ -154,13 +154,17 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result<MachineOk, Mach
|
||||
let f = machine.read_int_register(12);
|
||||
|
||||
// load buffer
|
||||
let mut buffer = "".to_string();
|
||||
let mut buffer = String::new();
|
||||
let mut val: [u8; 4] = [0; 4];
|
||||
for (j, elem) in val.iter_mut().enumerate() {
|
||||
*elem = machine.read_memory(1, address as usize + j) as u8;
|
||||
}
|
||||
for i in 0..size {
|
||||
buffer.push((machine.read_memory(1, (address + i) as usize)) as u8 as char);
|
||||
}
|
||||
|
||||
if f as u8 == CONSOLE_OUTPUT {
|
||||
println!("{}", buffer); // todo replace with console driver in the future
|
||||
print!("{}", buffer); // todo replace with console driver in the future
|
||||
Ok(MachineOk::Ok)
|
||||
} else {
|
||||
Err("SC_WRITE to file is not yet implemented")?
|
||||
|
Reference in New Issue
Block a user