X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=cpu%2Fsh2%2Fmame%2Fsh2pico.c;h=636ebc6f4289de3af1094b5d4437c9c36a81e389;hb=a90cc666d08526ada34a87c3e6d9a5312d90be84;hp=789987852d447b54944410d3b57ecb0bd4de0794;hpb=4835077e00c2cf7e3dba7bf7801c6aafd9d00dbe;p=picodrive.git diff --git a/cpu/sh2/mame/sh2pico.c b/cpu/sh2/mame/sh2pico.c index 7899878..636ebc6 100644 --- a/cpu/sh2/mame/sh2pico.c +++ b/cpu/sh2/mame/sh2pico.c @@ -21,7 +21,7 @@ typedef unsigned char UINT8; // this nasty conversion is needed for drc-expecting memhandlers #define MAKE_READFUNC(name, cname) \ -static INLINE unsigned int name(SH2 *sh2, unsigned int a) \ +static __inline unsigned int name(SH2 *sh2, unsigned int a) \ { \ unsigned int ret; \ sh2->sr |= sh2->icount << 12; \ @@ -32,7 +32,7 @@ static INLINE unsigned int name(SH2 *sh2, unsigned int a) \ } #define MAKE_WRITEFUNC(name, cname) \ -static INLINE void name(SH2 *sh2, unsigned int a, unsigned int d) \ +static __inline void name(SH2 *sh2, unsigned int a, unsigned int d) \ { \ sh2->sr |= sh2->icount << 12; \ cname(a, d, sh2); \ @@ -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