mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
PowerPC: Parametrize CTR macro.
This commit is contained in:
parent
0a343007cb
commit
c13ca271d8
@ -441,7 +441,7 @@ static void ReadRegister()
|
||||
wbe32hex(reply, LR(PowerPC::ppcState));
|
||||
break;
|
||||
case 68:
|
||||
wbe32hex(reply, CTR);
|
||||
wbe32hex(reply, CTR(PowerPC::ppcState));
|
||||
break;
|
||||
case 69:
|
||||
wbe32hex(reply, PowerPC::ppcState.spr[SPR_XER]);
|
||||
@ -653,7 +653,7 @@ static void WriteRegister()
|
||||
LR(PowerPC::ppcState) = re32hex(bufptr);
|
||||
break;
|
||||
case 68:
|
||||
CTR = re32hex(bufptr);
|
||||
CTR(PowerPC::ppcState) = re32hex(bufptr);
|
||||
break;
|
||||
case 69:
|
||||
PowerPC::ppcState.spr[SPR_XER] = re32hex(bufptr);
|
||||
|
@ -29,12 +29,12 @@ void Interpreter::bx(UGeckoInstruction inst)
|
||||
void Interpreter::bcx(UGeckoInstruction inst)
|
||||
{
|
||||
if ((inst.BO & BO_DONT_DECREMENT_FLAG) == 0)
|
||||
CTR--;
|
||||
CTR(PowerPC::ppcState)--;
|
||||
|
||||
const bool true_false = ((inst.BO >> 3) & 1) != 0;
|
||||
const bool only_counter_check = ((inst.BO >> 4) & 1) != 0;
|
||||
const bool only_condition_check = ((inst.BO >> 2) & 1) != 0;
|
||||
const u32 ctr_check = ((CTR != 0) ^ (inst.BO >> 1)) & 1;
|
||||
const u32 ctr_check = ((CTR(PowerPC::ppcState) != 0) ^ (inst.BO >> 1)) & 1;
|
||||
const bool counter = only_condition_check || ctr_check != 0;
|
||||
const bool condition =
|
||||
only_counter_check || (PowerPC::ppcState.cr.GetBit(inst.BI) == u32(true_false));
|
||||
@ -65,7 +65,7 @@ void Interpreter::bcctrx(UGeckoInstruction inst)
|
||||
|
||||
if (condition != 0)
|
||||
{
|
||||
PowerPC::ppcState.npc = CTR & (~3);
|
||||
PowerPC::ppcState.npc = CTR(PowerPC::ppcState) & (~3);
|
||||
if (inst.LK_3)
|
||||
LR(PowerPC::ppcState) = PowerPC::ppcState.pc + 4;
|
||||
}
|
||||
@ -76,9 +76,9 @@ void Interpreter::bcctrx(UGeckoInstruction inst)
|
||||
void Interpreter::bclrx(UGeckoInstruction inst)
|
||||
{
|
||||
if ((inst.BO_2 & BO_DONT_DECREMENT_FLAG) == 0)
|
||||
CTR--;
|
||||
CTR(PowerPC::ppcState)--;
|
||||
|
||||
const u32 counter = ((inst.BO_2 >> 2) | ((CTR != 0) ^ (inst.BO_2 >> 1))) & 1;
|
||||
const u32 counter = ((inst.BO_2 >> 2) | ((CTR(PowerPC::ppcState) != 0) ^ (inst.BO_2 >> 1))) & 1;
|
||||
const u32 condition =
|
||||
((inst.BO_2 >> 4) | (PowerPC::ppcState.cr.GetBit(inst.BI_2) == ((inst.BO_2 >> 3) & 1))) & 1;
|
||||
|
||||
|
@ -247,7 +247,7 @@ void UpdatePerformanceMonitor(u32 cycles, u32 num_load_stores, u32 num_fp_inst);
|
||||
#define THRM3(ppc_state) ((UReg_THRM3&)(ppc_state).spr[SPR_THRM3])
|
||||
|
||||
#define LR(ppc_state) (ppc_state).spr[SPR_LR]
|
||||
#define CTR PowerPC::ppcState.spr[SPR_CTR]
|
||||
#define CTR(ppc_state) (ppc_state).spr[SPR_CTR]
|
||||
#define rDEC PowerPC::ppcState.spr[SPR_DEC]
|
||||
#define SRR0 PowerPC::ppcState.spr[SPR_SRR0]
|
||||
#define SRR1 PowerPC::ppcState.spr[SPR_SRR1]
|
||||
|
@ -471,7 +471,8 @@ static bool WillInstructionReturn(UGeckoInstruction inst)
|
||||
// Is a rfi instruction
|
||||
if (inst.hex == 0x4C000064u)
|
||||
return true;
|
||||
bool counter = (inst.BO_2 >> 2 & 1) != 0 || (CTR != 0) != ((inst.BO_2 >> 1 & 1) != 0);
|
||||
bool counter =
|
||||
(inst.BO_2 >> 2 & 1) != 0 || (CTR(PowerPC::ppcState) != 0) != ((inst.BO_2 >> 1 & 1) != 0);
|
||||
bool condition =
|
||||
inst.BO_2 >> 4 != 0 || PowerPC::ppcState.cr.GetBit(inst.BI_2) == (inst.BO_2 >> 3 & 1);
|
||||
bool isBclr = inst.OPCD_7 == 0b010011 && (inst.hex >> 1 & 0b10000) != 0;
|
||||
|
Loading…
Reference in New Issue
Block a user