sh2 drc, make B/W read functions signed (reduces generated code size)

This commit is contained in:
kub 2019-04-26 18:53:21 +02:00
parent ed7e915078
commit aa4c4cb951
7 changed files with 85 additions and 60 deletions

View file

@ -372,7 +372,7 @@ INLINE void BRA(sh2_state *sh2, UINT32 d)
#if BUSY_LOOP_HACKS
if (disp == -2)
{
UINT32 next_opcode = RW( sh2, sh2->ppc & AM );
UINT32 next_opcode = (UINT32)(UINT16)RW( sh2, sh2->ppc & AM );
/* BRA $
* NOP
*/
@ -802,7 +802,7 @@ INLINE void DT(sh2_state *sh2, UINT32 n)
sh2->sr &= ~T;
#if BUSY_LOOP_HACKS
{
UINT32 next_opcode = RW( sh2, sh2->ppc & AM );
UINT32 next_opcode = (UINT32)(UINT16)RW( sh2, sh2->ppc & AM );
/* DT Rn
* BF $-2
*/
@ -1049,12 +1049,12 @@ INLINE void MAC_W(sh2_state *sh2, UINT32 m, UINT32 n)
INT32 tempm, tempn, dest, src, ans;
UINT32 templ;
tempn = (INT32) RW( sh2, sh2->r[n] );
tempn = (INT32)(INT16) RW( sh2, sh2->r[n] );
sh2->r[n] += 2;
tempm = (INT32) RW( sh2, sh2->r[m] );
tempm = (INT32)(INT16) RW( sh2, sh2->r[m] );
sh2->r[m] += 2;
templ = sh2->macl;
tempm = ((INT32) (short) tempn * (INT32) (short) tempm);
tempm = (tempn * tempm);
if ((INT32) sh2->macl >= 0)
dest = 0;
else

View file

@ -121,7 +121,7 @@ int sh2_execute_interpreter(SH2 *sh2, int cycles)
if (sh2->delay)
{
sh2->ppc = sh2->delay;
opcode = RW(sh2, sh2->delay);
opcode = (UINT32)(UINT16)RW(sh2, sh2->delay);
// TODO: more branch types
if ((opcode >> 13) == 5) { // BRA/BSR
@ -139,7 +139,7 @@ int sh2_execute_interpreter(SH2 *sh2, int cycles)
else
{
sh2->ppc = sh2->pc;
opcode = RW(sh2, sh2->pc);
opcode = (UINT32)(UINT16)RW(sh2, sh2->pc);
}
sh2->delay = 0;
@ -232,13 +232,13 @@ int sh2_execute_interpreter(SH2 *sh2, int cycles)
if (sh2->delay)
{
sh2->ppc = sh2->delay;
opcode = RW(sh2, sh2->delay);
opcode = (UINT32)(UINT16)RW(sh2, sh2->delay);
sh2->pc -= 2;
}
else
{
sh2->ppc = sh2->pc;
opcode = RW(sh2, sh2->pc);
opcode = (UINT32)(UINT16)RW(sh2, sh2->pc);
}
sh2->delay = 0;