Skip to content
Permalink
Browse files

cpu: workaround for GTE + interrupt CPU bug

  • Loading branch information
JaCzekanski committed Sep 1, 2019
1 parent bc8f2df commit a0505bcddfd7a7e1df31d7b658e8776b152ebae2
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/cpu/instructions.cpp
@@ -163,6 +163,18 @@ std::array<PrimaryInstruction, 64> SpecialTable = {{

void exception(CPU *cpu, COP0::CAUSE::Exception cause) {
using Exception = COP0::CAUSE::Exception;

// Hardware quirk:
// If COP2 opcode is executed when interrupt occures
// COP0 set EPC to the same opcode causing it to execute twice
// HACK: Delay interrupts if current opcode is GTE command
if (cause == Exception::interrupt) {
Opcode i(cpu->sys->readMemory32(cpu->exceptionPC));
if (i.op == 18) { // COP2 opcode
return;
}
}

cpu->cop0.cause.clearForException();
cpu->cop0.cause.exception = cause;

0 comments on commit a0505bc

Please sign in to comment.
You can’t perform that action at this time.