You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
851 B
31 lines
851 B
use crate::asm::data::literal::Addr;
|
|
use crate::asm::instr::Op;
|
|
use crate::asm::instr::op::{EvalRes, OpTrait};
|
|
use crate::runtime::fault::Fault;
|
|
use crate::runtime::frame::StackFrame;
|
|
use crate::runtime::run_thread::RunThread;
|
|
|
|
impl RunThread {
|
|
// TODO unit tests
|
|
pub fn eval_op(&mut self) -> Result<EvalRes, Fault> {
|
|
let mut cycles = 1;
|
|
let mut advance = 1;
|
|
|
|
let frame = &mut self.frame;
|
|
|
|
let op = self.program.read(frame.pc);
|
|
|
|
debug!("------------------------");
|
|
debug!("{} | {:?}", frame.pc, op);
|
|
|
|
/* Operations can be given different execution times when run in slow mode. */
|
|
/* Presently, all that do anything use 1 cycle. */
|
|
|
|
op.execute(&self.program, &mut self.call_stack, frame)?;
|
|
|
|
Ok(EvalRes {
|
|
cycles,
|
|
advance,
|
|
})
|
|
}
|
|
}
|
|
|