Example #1
0
static bool
rlwGeneric(PPCEmuAssembler& a, Instruction instr)
{
   a.mov(a.eax, a.ppcgpr[instr.rS]);

   if (flags & RlwImmediate) {
      a.rol(a.eax, instr.sh);
   } else {
      a.mov(a.ecx, a.ppcgpr[instr.rB]);
      a.and_(a.ecx, 0x1f);
      a.rol(a.eax, a.ecx.r8());
   }

   auto m = make_ppc_bitmask(instr.mb, instr.me);

   if (flags & RlwAnd) {
      a.and_(a.eax, m);
   } else if (flags & RlwInsert) {
      a.and_(a.eax, m);
      a.mov(a.ecx, a.ppcgpr[instr.rA]);
      a.and_(a.ecx, ~m);
      a.or_(a.eax, a.ecx);
   }

   a.mov(a.ppcgpr[instr.rA], a.eax);

   if (instr.rc) {
      updateConditionRegister(a, a.eax, a.ecx, a.edx);
   }

   return true;
}