sh2: handle some branch exceptions

This commit is contained in:
notaz 2017-08-18 03:44:25 +03:00
parent 61290a3553
commit 6a5b1b362e
3 changed files with 40 additions and 4 deletions

View file

@ -122,6 +122,18 @@ int sh2_execute_interpreter(SH2 *sh2, int cycles)
{
sh2->ppc = sh2->delay;
opcode = RW(sh2, sh2->delay);
// TODO: more branch types
if ((opcode >> 13) == 5) { // BRA/BSR
sh2->r[15] -= 4;
WL(sh2, sh2->r[15], sh2->sr);
sh2->r[15] -= 4;
WL(sh2, sh2->r[15], sh2->pc);
sh2->pc = RL(sh2, sh2->vbr + 6 * 4);
sh2->icount -= 5;
opcode = 9; // NOP
}
sh2->pc -= 2;
}
else