base
This commit is contained in:
parent
9a233f3c12
commit
98f4c0b67e
@ -27,14 +27,14 @@ impl Machine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn one_instruction(mut machine : Machine) -> Machine {
|
pub fn one_instruction(machine :&mut Machine) {
|
||||||
|
|
||||||
let mut unsigned_reg1 : u64 = 0;
|
let mut unsigned_reg1 : u64 = 0;
|
||||||
let mut unsigned_reg2 : u64 = 0;
|
let mut unsigned_reg2 : u64 = 0;
|
||||||
|
|
||||||
if machine.instructions.len() <= machine.pc as usize {
|
if machine.instructions.len() <= machine.pc as usize {
|
||||||
println!("ERROR : number max of instructions rushed");
|
println!("ERROR : number max of instructions rushed");
|
||||||
return machine;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
let inst : Instruction = decode(machine.instructions[machine.pc as usize]);
|
let inst : Instruction = decode(machine.instructions[machine.pc as usize]);
|
||||||
@ -128,7 +128,6 @@ impl Machine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
machine
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,5 +6,5 @@ use machine::Machine;
|
|||||||
fn main() {
|
fn main() {
|
||||||
let mut m = Machine::_init_machine();
|
let mut m = Machine::_init_machine();
|
||||||
m.instructions[0] = 0x37;
|
m.instructions[0] = 0x37;
|
||||||
Machine::one_instruction(m);
|
Machine::one_instruction(&mut m);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user