Removed a stray MOV in increase_addr_reg, fixed decrease_addr_reg. NR should work now.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5329 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
j4ck.fr0st
2010-04-11 14:06:46 +00:00
parent 800595980e
commit 945f8089b8
4 changed files with 41 additions and 33 deletions

View File

@ -63,7 +63,7 @@ void DSPEmitter::increment_addr_reg(int reg)
// if ((tmp & tmb) == tmb)
AND(16, R(ECX), R(EAX));
CMP(16, R(EAX), R(ECX));
FixupBranch not_equal = J_CC(CC_NZ);
FixupBranch not_equal = J_CC(CC_NE);
// tmp ^= g_dsp.r[DSP_REG_WR0 + reg];
MOVZX(32, 16, ECX, M(&g_dsp.r[reg]));
@ -155,8 +155,6 @@ void DSPEmitter::increase_addr_reg(int reg)
SetJumpTarget(posValue);
SetJumpTarget(end);
MOV(16, M(&g_dsp.r[reg]), R(EDX));
}
// Decrease addr register according to the correspond ix register
@ -164,38 +162,35 @@ void DSPEmitter::decrease_addr_reg(int reg)
{
// s16 value = (s16)g_dsp.r[DSP_REG_IX0 + reg];
MOVSX(32, 16, EDX, M(&g_dsp.r[DSP_REG_IX0 + reg]));
XOR(32, R(ESI), R(ESI)); // i = 0
// if (value > 0)
CMP(16, R(EDX), Imm16(0));
FixupBranch end = J_CC(CC_Z);
CMP(32, R(EDX), Imm32(0));
FixupBranch end = J_CC(CC_Z, true);
FixupBranch negValue = J_CC(CC_L);
// for (int i = 0; i < value; i++)
XOR(32, R(ESI), R(ESI)); // i = 0
FixupBranch posloop;
SetJumpTarget(posloop);
JumpTarget loop_pos = GetCodePtr();
decrement_addr_reg(reg);
ADD(32, R(ESI), Imm32(1)); // i++
CMP(32, R(ESI), R(EDX)); // i < value
J_CC(CC_NE, loop_pos);
FixupBranch posValue = J();
// FIXME: get normal abs with cdq
IMUL(32, EDX, Imm16(-1));
SetJumpTarget(negValue);
//abs == cdq; xor eax, edx; sub eax, edx
//we know its negative, and in that case edx is -1
XOR(32, R(EDX), Imm32(-1));
SUB(32, R(EDX), Imm32(-1));
// for (int i = 0; i < (int)(-value); i++)
XOR(32, R(ESI), R(ESI)); // i = 0
FixupBranch negloop;
SetJumpTarget(negloop);
JumpTarget loop_neg = GetCodePtr();
increment_addr_reg(reg);
ADD(32, R(ESI), Imm32(1)); // i++
CMP(32, R(ESI), R(EDX)); // i < -value
negloop = J_CC(CC_L);
J_CC(CC_NE, loop_neg);
SetJumpTarget(posValue);
SetJumpTarget(end);
@ -203,7 +198,6 @@ void DSPEmitter::decrease_addr_reg(int reg)
void DSPEmitter::ext_dmem_write(u32 dest, u32 src)
{
// u16 addr = g_dsp.r[dest];
MOVZX(32, 16, EAX, M(&g_dsp.r[dest]));