Fix for Mega Man X2's "weapon get" screen. (Jonas Quinn)
This commit is contained in:
Brandon Wright 2010-09-27 02:56:14 -05:00
parent 98aac99c42
commit bf209d05b8
1 changed files with 9 additions and 2 deletions

View File

@ -1013,9 +1013,16 @@ void S9xSetC4 (uint8 byte, uint16 Address)
printf("$7f4d=%02x, expected 02 for command 10 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]);
#endif
int32 tmp;
tmp = SAR((int32) READ_WORD(Memory.C4RAM + 0x1f83) * C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 16);
int32 r1;
r1 = READ_WORD(Memory.C4RAM + 0x1f83);
if (r1 & 0x8000)
r1 |= ~0x7fff;
else
r1 &= 0x7fff;
tmp = SAR(r1 * C4CosTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 16);
WRITE_3WORD(Memory.C4RAM + 0x1f86, tmp);
tmp = SAR((int32) READ_WORD(Memory.C4RAM + 0x1f83) * C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 16);
tmp = SAR(r1 * C4SinTable[READ_WORD(Memory.C4RAM + 0x1f80) & 0x1ff] * 2, 16);
WRITE_3WORD(Memory.C4RAM + 0x1f89, (tmp - SAR(tmp, 6)));
break;
}