Move "Step" out of Interpreter.hpp

This commit is contained in:
SimoneN64
2023-07-25 09:15:32 +02:00
parent 698032f0a1
commit 44c3a6f155
2 changed files with 30 additions and 28 deletions

View File

@@ -5,4 +5,33 @@ void Interpreter::Reset() {
regs.Reset();
mem.Reset();
}
int Interpreter::Step() {
CheckCompareInterrupt();
regs.prevDelaySlot = regs.delaySlot;
regs.delaySlot = false;
u32 paddr = 0;
if(!MapVAddr(regs, LOAD, regs.pc, paddr)) {
HandleTLBException(regs, regs.pc);
FireException(regs, GetTLBExceptionCode(regs.cop0.tlbError, LOAD), 0, false);
return 0;
}
u32 instruction = mem.Read32(regs, paddr);
if(ShouldServiceInterrupt()) {
FireException(regs, ExceptionCode::Interrupt, 0, false);
return 0;
}
regs.oldPC = regs.pc;
regs.pc = regs.nextPC;
regs.nextPC += 4;
Exec(instruction);
return 1;
}
}