public function executeIteration()
{
//Iterate the interpreter loop:
$op = 0;
while ($this->stopEmulator == 0) {
//Fetch the current opcode.
$op = $this->memoryRead($this->programCounter);
if (!$this->skipPCIncrement) {
//Increment the program counter to the next instruction:
$this->programCounter = $this->programCounter + 1 & 0xffff;
}
$this->skipPCIncrement = false;
//Get how many CPU cycles the current op code counts for:
$this->CPUTicks = $this->TICKTable[$op];
//Execute the OP code instruction:
Opcode::{'opcode' . $op}($this);
//Interrupt Arming:
switch ($this->untilEnable) {
case 1:
$this->IME = true;
// no break
// no break
case 2:
$this->untilEnable--;
// no break
}
//Execute Interrupt:
if ($this->IME) {
$this->runInterrupt();
}
//Timing:
$this->updateCore();
}
}