RSP: Inline memory functions in to the opcodes
This commit is contained in:
parent
562d4d4e56
commit
e1854e1589
|
@ -429,7 +429,7 @@ DWORD RunInterpreterCPU(DWORD Cycles)
|
|||
|
||||
RDP_LogLoc(*PrgCount);
|
||||
|
||||
RSP_LW_IMEM(*PrgCount, &RSPOpC.Value);
|
||||
RSPOpC.Value = *(uint32_t *)(RSPInfo.IMEM + (*PrgCount & 0xFFC));
|
||||
RSP_Opcode[RSPOpC.op]();
|
||||
RSP_GPR[0].W = 0x00000000; // MIPS $zero hard-wired to 0
|
||||
|
||||
|
|
|
@ -138,59 +138,111 @@ void RSP_Opcode_COP2(void)
|
|||
void RSP_Opcode_LB(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
|
||||
RSP_LB_DMEM(Address, &RSP_GPR[RSPOpC.rt].UB[0]);
|
||||
RSP_GPR[RSPOpC.rt].W = RSP_GPR[RSPOpC.rt].B[0];
|
||||
RSP_GPR[RSPOpC.rt].W = *(int8_t *)(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
|
||||
}
|
||||
|
||||
void RSP_Opcode_LH(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
|
||||
RSP_LH_DMEM(Address, &RSP_GPR[RSPOpC.rt].UHW[0]);
|
||||
if ((Address & 0x1) != 0)
|
||||
{
|
||||
RSP_GPR[RSPOpC.rt].UHW[0] = *(uint8_t *)(RSPInfo.DMEM + (((Address + 0) & 0xFFF) ^ 3)) << 8;
|
||||
RSP_GPR[RSPOpC.rt].UHW[0] += *(uint8_t *)(RSPInfo.DMEM + (((Address + 1) & 0xFFF) ^ 3)) << 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RSP_GPR[RSPOpC.rt].UHW[0] = *(uint16_t *)(RSPInfo.DMEM + ((Address ^ 2) & 0xFFF));
|
||||
}
|
||||
RSP_GPR[RSPOpC.rt].W = RSP_GPR[RSPOpC.rt].HW[0];
|
||||
}
|
||||
|
||||
void RSP_Opcode_LW(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
|
||||
RSP_LW_DMEM(Address, &RSP_GPR[RSPOpC.rt].UW);
|
||||
if ((Address & 0x3) != 0)
|
||||
{
|
||||
RSP_GPR[RSPOpC.rt].UW = *(uint8_t *)(RSPInfo.DMEM + (((Address + 0) & 0xFFF) ^ 3)) << 24;
|
||||
RSP_GPR[RSPOpC.rt].UW += *(uint8_t *)(RSPInfo.DMEM + (((Address + 1) & 0xFFF) ^ 3)) << 16;
|
||||
RSP_GPR[RSPOpC.rt].UW += *(uint8_t *)(RSPInfo.DMEM + (((Address + 2) & 0xFFF) ^ 3)) << 8;
|
||||
RSP_GPR[RSPOpC.rt].UW += *(uint8_t *)(RSPInfo.DMEM + (((Address + 3) & 0xFFF) ^ 3)) << 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RSP_GPR[RSPOpC.rt].UW = *(uint32_t *)(RSPInfo.DMEM + (Address & 0xFFF));
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_LBU(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
|
||||
RSP_LB_DMEM(Address, &RSP_GPR[RSPOpC.rt].UB[0]);
|
||||
RSP_GPR[RSPOpC.rt].UW = RSP_GPR[RSPOpC.rt].UB[0];
|
||||
RSP_GPR[RSPOpC.rt].UW = *(uint8_t *)(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
|
||||
}
|
||||
|
||||
void RSP_Opcode_LHU(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
|
||||
RSP_LH_DMEM(Address, &RSP_GPR[RSPOpC.rt].UHW[0]);
|
||||
if ((Address & 0x1) != 0)
|
||||
{
|
||||
RSP_GPR[RSPOpC.rt].UHW[0] = *(uint8_t *)(RSPInfo.DMEM + (((Address + 0) & 0xFFF) ^ 3)) << 8;
|
||||
RSP_GPR[RSPOpC.rt].UHW[0] += *(uint8_t *)(RSPInfo.DMEM + (((Address + 1) & 0xFFF) ^ 3)) << 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RSP_GPR[RSPOpC.rt].UHW[0] = *(uint16_t *)(RSPInfo.DMEM + ((Address ^ 2) & 0xFFF));
|
||||
}
|
||||
RSP_GPR[RSPOpC.rt].UW = RSP_GPR[RSPOpC.rt].UHW[0];
|
||||
}
|
||||
|
||||
void RSP_Opcode_LWU(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
|
||||
RSP_LW_DMEM(Address, &RSP_GPR[RSPOpC.rt].UW);
|
||||
if ((Address & 0x3) != 0)
|
||||
{
|
||||
RSP_GPR[RSPOpC.rt].UW = *(uint8_t *)(RSPInfo.DMEM + (((Address + 0) & 0xFFF) ^ 3)) << 24;
|
||||
RSP_GPR[RSPOpC.rt].UW += *(uint8_t *)(RSPInfo.DMEM + (((Address + 1) & 0xFFF) ^ 3)) << 16;
|
||||
RSP_GPR[RSPOpC.rt].UW += *(uint8_t *)(RSPInfo.DMEM + (((Address + 2) & 0xFFF) ^ 3)) << 8;
|
||||
RSP_GPR[RSPOpC.rt].UW += *(uint8_t *)(RSPInfo.DMEM + (((Address + 3) & 0xFFF) ^ 3)) << 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RSP_GPR[RSPOpC.rt].UW = *(uint32_t *)(RSPInfo.DMEM + (Address & 0xFFF));
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SB(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
|
||||
RSP_SB_DMEM(Address, RSP_GPR[RSPOpC.rt].UB[0]);
|
||||
*(uint8_t *)(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_GPR[RSPOpC.rt].UB[0];
|
||||
}
|
||||
|
||||
void RSP_Opcode_SH(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
|
||||
RSP_SH_DMEM(Address, RSP_GPR[RSPOpC.rt].UHW[0]);
|
||||
if ((Address & 0x1) != 0)
|
||||
{
|
||||
*(uint8_t *)(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = (RSP_GPR[RSPOpC.rt].UHW[0] >> 8);
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Address + 1) ^ 3) & 0xFFF)) = (RSP_GPR[RSPOpC.rt].UHW[0] & 0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
*(uint16_t *)(RSPInfo.DMEM + ((Address ^ 2) & 0xFFF)) = RSP_GPR[RSPOpC.rt].UHW[0];
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SW(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
|
||||
RSP_SW_DMEM(Address, RSP_GPR[RSPOpC.rt].UW);
|
||||
if ((Address & 0x3) != 0)
|
||||
{
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Address + 0) ^ 3) & 0xFFF)) = (RSP_GPR[RSPOpC.rt].UW >> 24) & 0xFF;
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Address + 1) ^ 3) & 0xFFF)) = (RSP_GPR[RSPOpC.rt].UW >> 16) & 0xFF;
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Address + 2) ^ 3) & 0xFFF)) = (RSP_GPR[RSPOpC.rt].UW >> 8) & 0xFF;
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Address + 3) ^ 3) & 0xFFF)) = (RSP_GPR[RSPOpC.rt].UW >> 0) & 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(uint32_t *)(RSPInfo.DMEM + (Address & 0xFFF)) = RSP_GPR[RSPOpC.rt].UW;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_LC2(void)
|
||||
|
@ -2080,61 +2132,145 @@ void RSP_Vector_VNOOP(void)
|
|||
void RSP_Opcode_LBV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 0)) & 0xFFF;
|
||||
RSP_LBV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
RSP_Vect[RSPOpC.rt].s8((uint8_t)(15 - RSPOpC.del)) = *(RSPInfo.DMEM + (Address ^ 3));
|
||||
}
|
||||
|
||||
void RSP_Opcode_LSV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 1)) & 0xFFF;
|
||||
RSP_LSV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint8_t length = 2;
|
||||
if (length > 16 - RSPOpC.del)
|
||||
{
|
||||
length = (uint8_t)(16 - RSPOpC.del);
|
||||
}
|
||||
for (uint8_t i = RSPOpC.del, n = (uint8_t)(length + RSPOpC.del); i < n; i++)
|
||||
{
|
||||
RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_LLV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 2)) & 0xFFF;
|
||||
RSP_LLV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint8_t length = 4;
|
||||
if (length > 16 - RSPOpC.del)
|
||||
{
|
||||
length = (uint8_t)(16 - RSPOpC.del);
|
||||
}
|
||||
for (uint8_t i = RSPOpC.del, n = (uint8_t)(length + RSPOpC.del); i < n; i++)
|
||||
{
|
||||
RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_LDV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
|
||||
RSP_LDV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint8_t length = 8;
|
||||
if (length > 16 - RSPOpC.del)
|
||||
{
|
||||
length = (uint8_t)(16 - RSPOpC.del);
|
||||
}
|
||||
for (uint8_t i = RSPOpC.del, n = (uint8_t)(length + RSPOpC.del); i < n; i++)
|
||||
{
|
||||
RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_LQV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_LQV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint32_t length = ((Address + 0x10) & ~0xF) - Address;
|
||||
if (length > 16 - RSPOpC.del)
|
||||
{
|
||||
length = 16 - RSPOpC.del;
|
||||
}
|
||||
for (uint8_t i = RSPOpC.del; i < (length + RSPOpC.del); i++)
|
||||
{
|
||||
RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
|
||||
Address += 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RSP_Opcode_LRV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_LRV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint8_t offset = (Address & 0xF) - 1;
|
||||
uint8_t length = (uint8_t)((Address & 0xF) - RSPOpC.del);
|
||||
Address &= 0xFF0;
|
||||
for (uint8_t i = RSPOpC.del; i < (length + RSPOpC.del); i++)
|
||||
{
|
||||
RSP_Vect[RSPOpC.rt].s8(offset - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_LPV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
|
||||
RSP_LPV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
RSP_Vect[RSPOpC.rt].s16(7) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[RSPOpC.rt].s16(6) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 1) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[RSPOpC.rt].s16(5) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 2) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[RSPOpC.rt].s16(4) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 3) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[RSPOpC.rt].s16(3) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 4) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[RSPOpC.rt].s16(2) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 5) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[RSPOpC.rt].s16(1) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 6) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[RSPOpC.rt].s16(0) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 7) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
}
|
||||
|
||||
void RSP_Opcode_LUV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
|
||||
RSP_LUV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
RSP_Vect[RSPOpC.rt].s16(7) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(6) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 1) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(5) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 2) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(4) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 3) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(3) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 4) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(2) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 5) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(1) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 6) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(0) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 7) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
}
|
||||
|
||||
void RSP_Opcode_LHV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_LHV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
RSP_Vect[RSPOpC.rt].s16(7) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(6) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 2) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(5) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 4) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(4) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 6) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(3) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 8) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(2) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 10) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(1) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 12) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[RSPOpC.rt].s16(0) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 14) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
}
|
||||
|
||||
void RSP_Opcode_LFV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_LFV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint8_t length = 8;
|
||||
if (length > 16 - RSPOpC.del)
|
||||
{
|
||||
length = (uint8_t)(16 - RSPOpC.del);
|
||||
}
|
||||
|
||||
RSPVector Temp;
|
||||
Temp.s16(7) = *(RSPInfo.DMEM + (((Address + RSPOpC.del) ^ 3) & 0xFFF)) << 7;
|
||||
Temp.s16(6) = *(RSPInfo.DMEM + (((Address + ((0x4 - RSPOpC.del) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(5) = *(RSPInfo.DMEM + (((Address + ((0x8 - RSPOpC.del) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(4) = *(RSPInfo.DMEM + (((Address + ((0xC - RSPOpC.del) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(3) = *(RSPInfo.DMEM + (((Address + ((0x8 - RSPOpC.del) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(2) = *(RSPInfo.DMEM + (((Address + ((0xC - RSPOpC.del) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(1) = *(RSPInfo.DMEM + (((Address + ((0x10 - RSPOpC.del) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(0) = *(RSPInfo.DMEM + (((Address + ((0x4 - RSPOpC.del) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
|
||||
for (uint8_t i = RSPOpC.del, n = (uint8_t)(length + RSPOpC.del); i < n; i++)
|
||||
{
|
||||
RSP_Vect[RSPOpC.rt].s8(15 - i) = Temp.s8(15 - i);
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_LWV(void)
|
||||
|
@ -2143,8 +2279,20 @@ void RSP_Opcode_LWV(void)
|
|||
|
||||
void RSP_Opcode_LTV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_LTV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint32_t Address = ((((uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF) + 8) & 0xFF0) + (RSPOpC.del & 0x1);
|
||||
uint8_t length = 8;
|
||||
if (length > 32 - RSPOpC.rt)
|
||||
{
|
||||
length = (uint8_t)(32 - RSPOpC.rt);
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < length; i++)
|
||||
{
|
||||
uint8_t del = ((8 - (RSPOpC.del >> 1) + i) << 1) & 0xF;
|
||||
RSP_Vect[RSPOpC.rt + i].s8(15 - del) = *(RSPInfo.DMEM + (Address ^ 3));
|
||||
RSP_Vect[RSPOpC.rt + i].s8(14 - del) = *(RSPInfo.DMEM + ((Address + 1) ^ 3));
|
||||
Address += 2;
|
||||
}
|
||||
}
|
||||
|
||||
// SC2 functions
|
||||
|
@ -2152,73 +2300,247 @@ void RSP_Opcode_LTV(void)
|
|||
void RSP_Opcode_SBV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 0)) & 0xFFF;
|
||||
RSP_SBV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8((uint8_t)(15 - RSPOpC.del));
|
||||
}
|
||||
|
||||
void RSP_Opcode_SSV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 1)) & 0xFFF;
|
||||
RSP_SSV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
for (uint8_t i = RSPOpC.del, n = (uint8_t)(2 + RSPOpC.del); i < n; i++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(15 - (i & 0xF));
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SLV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 2)) & 0xFFF;
|
||||
RSP_SLV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
for (uint8_t i = RSPOpC.del, n = (uint8_t)(4 + RSPOpC.del); i < n; i++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(15 - (i & 0xF));
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SDV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
|
||||
RSP_SDV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
for (uint8_t i = RSPOpC.del; i < (8 + RSPOpC.del); i++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(15 - (i & 0xF));
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SQV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_SQV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint8_t Length = (uint8_t)(((Address + 0x10) & ~0xF) - Address);
|
||||
for (uint8_t i = RSPOpC.del; i < (Length + RSPOpC.del); i++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(i & 0xF);
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SRV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_SRV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint8_t Length = (Address & 0xF);
|
||||
uint8_t Offset = (0x10 - Length) & 0xF;
|
||||
Address &= 0xFF0;
|
||||
for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(15 - ((i + Offset) & 0xF));
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SPV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
|
||||
RSP_SPV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
for (uint8_t i = RSPOpC.del, n = (uint8_t)(8 + RSPOpC.del); i < n; i++)
|
||||
{
|
||||
if (((i) & 0xF) < 8)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].u8(15 - ((i & 0xF) << 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = (RSP_Vect[RSPOpC.rt].u8(15 - ((i & 0x7) << 1)) << 1) + (RSP_Vect[RSPOpC.rt].u8(14 - ((i & 0x7) << 1)) >> 7);
|
||||
}
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SUV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
|
||||
RSP_SUV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
for (uint8_t Count = RSPOpC.del; Count < (8 + RSPOpC.del); Count++)
|
||||
{
|
||||
if (((Count) & 0xF) < 8)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = ((RSP_Vect[RSPOpC.rt].u8(15 - ((Count & 0x7) << 1)) << 1) + (RSP_Vect[RSPOpC.rt].u8(14 - ((Count & 0x7) << 1)) >> 7)) & 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].u8(15 - ((Count & 0x7) << 1));
|
||||
}
|
||||
Address += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SHV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_SHV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = (RSP_Vect[RSPOpC.rt].u8((15 - RSPOpC.del) & 0xF) << 1) + (RSP_Vect[RSPOpC.rt].u8((14 - RSPOpC.del) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Address + 2) ^ 3) & 0xFFF)) = (RSP_Vect[RSPOpC.rt].u8((13 - RSPOpC.del) & 0xF) << 1) + (RSP_Vect[RSPOpC.rt].u8((12 - RSPOpC.del) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Address + 4) ^ 3) & 0xFFF)) = (RSP_Vect[RSPOpC.rt].u8((11 - RSPOpC.del) & 0xF) << 1) + (RSP_Vect[RSPOpC.rt].u8((10 - RSPOpC.del) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Address + 6) ^ 3) & 0xFFF)) = (RSP_Vect[RSPOpC.rt].u8((9 - RSPOpC.del) & 0xF) << 1) + (RSP_Vect[RSPOpC.rt].u8((8 - RSPOpC.del) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Address + 8) ^ 3) & 0xFFF)) = (RSP_Vect[RSPOpC.rt].u8((7 - RSPOpC.del) & 0xF) << 1) + (RSP_Vect[RSPOpC.rt].u8((6 - RSPOpC.del) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Address + 10) ^ 3) & 0xFFF)) = (RSP_Vect[RSPOpC.rt].u8((5 - RSPOpC.del) & 0xF) << 1) + (RSP_Vect[RSPOpC.rt].u8((4 - RSPOpC.del) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Address + 12) ^ 3) & 0xFFF)) = (RSP_Vect[RSPOpC.rt].u8((3 - RSPOpC.del) & 0xF) << 1) + (RSP_Vect[RSPOpC.rt].u8((2 - RSPOpC.del) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Address + 14) ^ 3) & 0xFFF)) = (RSP_Vect[RSPOpC.rt].u8((1 - RSPOpC.del) & 0xF) << 1) + (RSP_Vect[RSPOpC.rt].u8((0 - RSPOpC.del) & 0xF) >> 7);
|
||||
}
|
||||
|
||||
void RSP_Opcode_SFV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_SFV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
|
||||
int offset = Address & 0xF;
|
||||
Address &= 0xFF0;
|
||||
|
||||
switch (RSPOpC.del)
|
||||
{
|
||||
case 0:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(7) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(6) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(5) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(4) >> 7) & 0xFF;
|
||||
break;
|
||||
case 1:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(1) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(0) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(3) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(2) >> 7) & 0xFF;
|
||||
break;
|
||||
case 2:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 3:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF) ^ 3))) = 0;
|
||||
break;
|
||||
case 4:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(6) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(5) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(4) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(7) >> 7) & 0xFF;
|
||||
break;
|
||||
case 5:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(0) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(3) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(2) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(1) >> 7) & 0xFF;
|
||||
break;
|
||||
case 6:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 7:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 8:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(3) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(2) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(1) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(0) >> 7) & 0xFF;
|
||||
break;
|
||||
case 9:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 10:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 11:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(4) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(7) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(6) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(5) >> 7) & 0xFF;
|
||||
break;
|
||||
case 12:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(2) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(1) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(0) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(3) >> 7) & 0xFF;
|
||||
break;
|
||||
case 13:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 14:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 15:
|
||||
*(RSPInfo.DMEM + ((Address + offset) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(7) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(6) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(5) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Address + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[RSPOpC.rt].u16(4) >> 7) & 0xFF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_STV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_STV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint8_t Length = 8;
|
||||
if (Length > 32 - RSPOpC.rt)
|
||||
{
|
||||
Length = (uint8_t)(32 - RSPOpC.rt);
|
||||
}
|
||||
Length = Length << 1;
|
||||
uint8_t Del = RSPOpC.del >> 1;
|
||||
for (uint8_t i = 0; i < Length; i += 2)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt + Del].u8(15 - i);
|
||||
*(RSPInfo.DMEM + (((Address + 1) ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt + Del].u8(14 - i);
|
||||
Del = (Del + 1) & 7;
|
||||
Address += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_Opcode_SWV(void)
|
||||
{
|
||||
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
|
||||
RSP_SWV_DMEM(Address, RSPOpC.rt, RSPOpC.del);
|
||||
uint8_t Offset = Address & 0xF;
|
||||
Address &= 0xFF0;
|
||||
for (uint8_t i = RSPOpC.del, n = (16 + RSPOpC.del); i < n; i++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Address + (Offset & 0xF)) ^ 3)) = RSP_Vect[RSPOpC.rt].s8(15 - (i & 0xF));
|
||||
Offset += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Other functions
|
||||
|
|
|
@ -221,7 +221,6 @@ void DumpRSPCode(void)
|
|||
void DumpRSPData(void)
|
||||
{
|
||||
char string[100], LogFileName[255], *p;
|
||||
uint32_t value;
|
||||
DWORD location, dwWritten;
|
||||
HANDLE hLogFile = NULL;
|
||||
|
||||
|
@ -256,12 +255,12 @@ void DumpRSPData(void)
|
|||
unsigned int characters_to_write;
|
||||
int characters_converted;
|
||||
|
||||
RSP_LW_DMEM(location, &value);
|
||||
uint32_t Value = *(uint32_t *)(RSPInfo.DMEM + location);
|
||||
characters_converted = sprintf(
|
||||
&string[0],
|
||||
" 0x%03X\t0x%08X\r\n",
|
||||
location,
|
||||
value);
|
||||
Value);
|
||||
|
||||
if (characters_converted < 0)
|
||||
{
|
||||
|
|
|
@ -21,8 +21,7 @@ Input: PC
|
|||
bool IsOpcodeNop(DWORD PC)
|
||||
{
|
||||
RSPOpcode RspOp;
|
||||
RSP_LW_IMEM(PC, &RspOp.Value);
|
||||
|
||||
RspOp.Value = *(uint32_t *)(RSPInfo.IMEM + (PC & 0xFFC));
|
||||
if (RspOp.op == RSP_SPECIAL && RspOp.funct == RSP_SPECIAL_SLL)
|
||||
{
|
||||
return (RspOp.rd == 0) ? true : false;
|
||||
|
@ -46,7 +45,7 @@ bool IsNextInstructionMmx(DWORD PC)
|
|||
|
||||
PC += 4;
|
||||
if (PC >= 0x1000) return false;
|
||||
RSP_LW_IMEM(PC, &RspOp.Value);
|
||||
RspOp.Value = *(uint32_t *)(RSPInfo.IMEM + (PC & 0xFFC));
|
||||
|
||||
if (RspOp.op != RSP_CP2)
|
||||
return false;
|
||||
|
@ -146,7 +145,7 @@ DWORD WriteToAccum2(int Location, int PC, bool RecursiveCall)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
RSP_LW_IMEM(PC, &RspOp.Value);
|
||||
RspOp.Value = *(uint32_t *)(RSPInfo.IMEM + (PC & 0xFFC));
|
||||
|
||||
switch (RspOp.op)
|
||||
{
|
||||
|
@ -240,7 +239,8 @@ DWORD WriteToAccum2(int Location, int PC, bool RecursiveCall)
|
|||
}
|
||||
// If the opcode (which is 8 bytes before the destination and also a J backward) then ignore this
|
||||
BranchImmed = (PC + ((short)RspOp.offset << 2) + 4) & 0xFFC;
|
||||
RSP_LW_IMEM(BranchImmed - 8, &NextOp.Value);
|
||||
NextOp.Value = *(uint32_t *)(RSPInfo.IMEM + ((BranchImmed - 8) & 0xFFC));
|
||||
|
||||
if (RspOp.op == RSP_J && (int)(RspOp.target << 2) < PC)
|
||||
{
|
||||
break;
|
||||
|
@ -501,7 +501,7 @@ bool WriteToVectorDest2(DWORD DestReg, int PC, bool RecursiveCall)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
RSP_LW_IMEM(PC, &RspOp.Value);
|
||||
RspOp.Value = *(uint32_t *)(RSPInfo.IMEM + (PC & 0xFFC));
|
||||
|
||||
switch (RspOp.op)
|
||||
{
|
||||
|
@ -904,7 +904,7 @@ bool UseRspFlags(int PC)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
RSP_LW_IMEM(PC, &RspOp.Value);
|
||||
RspOp.Value = *(uint32_t *)(RSPInfo.IMEM + (PC & 0xFFC));
|
||||
|
||||
switch (RspOp.op)
|
||||
{
|
||||
|
@ -1137,8 +1137,7 @@ bool IsRegisterConstant(DWORD Reg, DWORD * Constant)
|
|||
|
||||
while (PC < 0x1000)
|
||||
{
|
||||
|
||||
RSP_LW_IMEM(PC, &RspOp.Value);
|
||||
RspOp.Value = *(uint32_t *)(RSPInfo.IMEM + (PC & 0xFFC));
|
||||
|
||||
// Resample command in microcode likes S7
|
||||
/* if (PC == 0xFBC) {
|
||||
|
|
|
@ -417,7 +417,7 @@ void ReOrderInstructions(DWORD StartPC, DWORD EndPC)
|
|||
DWORD Count, ReorderedOps, CurrentPC;
|
||||
RSPOpcode PreviousOp, CurrentOp, RspOp;
|
||||
|
||||
PreviousOp.Value = *(DWORD *)(RSPInfo.IMEM + StartPC);
|
||||
PreviousOp.Value = *(DWORD *)(RSPInfo.IMEM + (StartPC & 0xFFC));
|
||||
|
||||
if (IsOpcodeBranch(StartPC, PreviousOp))
|
||||
{
|
||||
|
@ -452,7 +452,7 @@ void ReOrderInstructions(DWORD StartPC, DWORD EndPC)
|
|||
for (Count = 0; Count < InstructionCount; Count += 4)
|
||||
{
|
||||
CurrentPC = StartPC;
|
||||
PreviousOp.Value = *(DWORD *)(RSPInfo.IMEM + CurrentPC);
|
||||
PreviousOp.Value = *(DWORD *)(RSPInfo.IMEM + (CurrentPC & 0xFFC));
|
||||
ReorderedOps = 0;
|
||||
|
||||
for (;;)
|
||||
|
@ -476,7 +476,7 @@ void ReOrderInstructions(DWORD StartPC, DWORD EndPC)
|
|||
CPU_Message("Swapped %X and %X", CurrentPC - 4, CurrentPC);
|
||||
#endif
|
||||
}
|
||||
PreviousOp.Value = *(DWORD *)(RSPInfo.IMEM + CurrentPC);
|
||||
PreviousOp.Value = *(DWORD *)(RSPInfo.IMEM + (CurrentPC & 0xFFC));
|
||||
|
||||
if (IsOpcodeNop(CurrentPC) && IsOpcodeNop(CurrentPC + 4) && IsOpcodeNop(CurrentPC + 8))
|
||||
{
|
||||
|
|
|
@ -110,196 +110,6 @@ void SetJumpTable(uint32_t End)
|
|||
NoOfMaps += 1;
|
||||
}
|
||||
|
||||
void RSP_LB_DMEM(uint32_t Addr, uint8_t * Value)
|
||||
{
|
||||
*Value = *(uint8_t *)(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF));
|
||||
}
|
||||
|
||||
void RSP_LBV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
RSP_Vect[vect].s8(15 - element) = *(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF));
|
||||
}
|
||||
|
||||
void RSP_LDV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
uint8_t length, Count;
|
||||
|
||||
length = 8;
|
||||
if (length > 16 - element)
|
||||
{
|
||||
length = 16 - element;
|
||||
}
|
||||
for (Count = element; Count < (length + element); Count++)
|
||||
{
|
||||
RSP_Vect[vect].s8(15 - Count) = *(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF));
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_LFV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
uint8_t length, count;
|
||||
RSPVector Temp;
|
||||
|
||||
length = 8;
|
||||
if (length > 16 - element)
|
||||
{
|
||||
length = 16 - element;
|
||||
}
|
||||
|
||||
Temp.s16(7) = *(RSPInfo.DMEM + (((Addr + element) ^ 3) & 0xFFF)) << 7;
|
||||
Temp.s16(6) = *(RSPInfo.DMEM + (((Addr + ((0x4 - element) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(5) = *(RSPInfo.DMEM + (((Addr + ((0x8 - element) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(4) = *(RSPInfo.DMEM + (((Addr + ((0xC - element) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(3) = *(RSPInfo.DMEM + (((Addr + ((0x8 - element) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(2) = *(RSPInfo.DMEM + (((Addr + ((0xC - element) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(1) = *(RSPInfo.DMEM + (((Addr + ((0x10 - element) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
Temp.s16(0) = *(RSPInfo.DMEM + (((Addr + ((0x4 - element) ^ 3) & 0xf)) & 0xFFF)) << 7;
|
||||
|
||||
for (count = element; count < (length + element); count++)
|
||||
{
|
||||
RSP_Vect[vect].s8(15 - count) = Temp.s8(15 - count);
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_LH_DMEM(uint32_t Addr, uint16_t * Value)
|
||||
{
|
||||
if ((Addr & 0x1) != 0)
|
||||
{
|
||||
*Value = *(uint8_t *)(RSPInfo.DMEM + (((Addr + 0) & 0xFFF) ^ 3)) << 8;
|
||||
*Value += *(uint8_t *)(RSPInfo.DMEM + (((Addr + 1) & 0xFFF) ^ 3)) << 0;
|
||||
return;
|
||||
}
|
||||
*Value = *(uint16_t *)(RSPInfo.DMEM + ((Addr ^ 2) & 0xFFF));
|
||||
}
|
||||
|
||||
void RSP_LHV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
RSP_Vect[vect].s16(7) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(6) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 2) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(5) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 4) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(4) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 6) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(3) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 8) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(2) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 10) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(1) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 12) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(0) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 14) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
}
|
||||
|
||||
void RSP_LLV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
uint8_t length, Count;
|
||||
|
||||
length = 4;
|
||||
if (length > 16 - element)
|
||||
{
|
||||
length = 16 - element;
|
||||
}
|
||||
for (Count = element; Count < (length + element); Count++)
|
||||
{
|
||||
RSP_Vect[vect].s8(15 - Count) = *(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF));
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_LPV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
RSP_Vect[vect].s16(7) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[vect].s16(6) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 1) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[vect].s16(5) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 2) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[vect].s16(4) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 3) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[vect].s16(3) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 4) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[vect].s16(2) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 5) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[vect].s16(1) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 6) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
RSP_Vect[vect].s16(0) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 7) & 0xF) ^ 3) & 0xFFF)) << 8;
|
||||
}
|
||||
|
||||
void RSP_LRV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
uint8_t offset = (Addr & 0xF) - 1;
|
||||
uint8_t length = (Addr & 0xF) - element;
|
||||
Addr &= 0xFF0;
|
||||
for (uint32_t i = element; i < (length + element); i++)
|
||||
{
|
||||
RSP_Vect[vect].s8(offset - i) = *(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF));
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_LQV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
uint32_t length = ((Addr + 0x10) & ~0xF) - Addr;
|
||||
if (length > 16 - element)
|
||||
{
|
||||
length = 16 - element;
|
||||
}
|
||||
for (uint8_t i = element; i < (length + element); i++)
|
||||
{
|
||||
RSP_Vect[vect].s8(i) = *(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF));
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_LSV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
uint8_t length, Count;
|
||||
|
||||
length = 2;
|
||||
if (length > 16 - element)
|
||||
{
|
||||
length = 16 - element;
|
||||
}
|
||||
for (Count = element; Count < (length + element); Count++)
|
||||
{
|
||||
RSP_Vect[vect].s8(15 - Count) = *(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF));
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_LTV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
uint8_t del, count, length;
|
||||
|
||||
length = 8;
|
||||
if (length > 32 - vect)
|
||||
{
|
||||
length = 32 - vect;
|
||||
}
|
||||
|
||||
Addr = ((Addr + 8) & 0xFF0) + (element & 0x1);
|
||||
for (count = 0; count < length; count++)
|
||||
{
|
||||
del = ((8 - (element >> 1) + count) << 1) & 0xF;
|
||||
RSP_Vect[vect + count].s8(15 - del) = *(RSPInfo.DMEM + (Addr ^ 3));
|
||||
RSP_Vect[vect + count].s8(14 - del) = *(RSPInfo.DMEM + ((Addr + 1) ^ 3));
|
||||
Addr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_LUV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
RSP_Vect[vect].s16(7) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(6) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 1) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(5) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 2) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(4) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 3) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(3) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 4) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(2) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 5) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(1) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 6) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
RSP_Vect[vect].s16(0) = *(RSPInfo.DMEM + ((Addr + ((0x10 - element + 7) & 0xF) ^ 3) & 0xFFF)) << 7;
|
||||
}
|
||||
|
||||
void RSP_LW_DMEM(uint32_t Addr, uint32_t * Value)
|
||||
{
|
||||
if ((Addr & 0x3) != 0)
|
||||
{
|
||||
*Value = *(uint8_t *)(RSPInfo.DMEM + (((Addr + 0) & 0xFFF) ^ 3)) << 24;
|
||||
*Value += *(uint8_t *)(RSPInfo.DMEM + (((Addr + 1) & 0xFFF) ^ 3)) << 16;
|
||||
*Value += *(uint8_t *)(RSPInfo.DMEM + (((Addr + 2) & 0xFFF) ^ 3)) << 8;
|
||||
*Value += *(uint8_t *)(RSPInfo.DMEM + (((Addr + 3) & 0xFFF) ^ 3)) << 0;
|
||||
return;
|
||||
}
|
||||
*Value = *(uint32_t *)(RSPInfo.DMEM + (Addr & 0xFFF));
|
||||
}
|
||||
|
||||
void RSP_LW_IMEM(uint32_t Addr, uint32_t * Value)
|
||||
{
|
||||
if ((Addr & 0x3) != 0)
|
||||
|
@ -308,294 +118,3 @@ void RSP_LW_IMEM(uint32_t Addr, uint32_t * Value)
|
|||
}
|
||||
*Value = *(uint32_t *)(RSPInfo.IMEM + (Addr & 0xFFF));
|
||||
}
|
||||
|
||||
void RSP_SB_DMEM(uint32_t Addr, uint8_t Value)
|
||||
{
|
||||
*(uint8_t *)(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = Value;
|
||||
}
|
||||
|
||||
void RSP_SBV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = RSP_Vect[vect].s8(15 - element);
|
||||
}
|
||||
|
||||
void RSP_SDV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
int Count;
|
||||
|
||||
for (Count = element; Count < (8 + element); Count++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = RSP_Vect[vect].s8(15 - (Count & 0xF));
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SFV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
int offset = Addr & 0xF;
|
||||
Addr &= 0xFF0;
|
||||
|
||||
switch (element)
|
||||
{
|
||||
case 0:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = (RSP_Vect[vect].u16(7) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(6) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(5) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(4) >> 7) & 0xFF;
|
||||
break;
|
||||
case 1:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = (RSP_Vect[vect].u16(1) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(0) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(3) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(2) >> 7) & 0xFF;
|
||||
break;
|
||||
case 2:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 3:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF) ^ 3))) = 0;
|
||||
break;
|
||||
case 4:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = (RSP_Vect[vect].u16(6) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(5) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(4) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(7) >> 7) & 0xFF;
|
||||
break;
|
||||
case 5:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = (RSP_Vect[vect].u16(0) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(3) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(2) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(1) >> 7) & 0xFF;
|
||||
break;
|
||||
case 6:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 7:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 8:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = (RSP_Vect[vect].u16(3) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(2) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(1) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(0) >> 7) & 0xFF;
|
||||
break;
|
||||
case 9:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 10:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 11:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = (RSP_Vect[vect].u16(4) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(7) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(6) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(5) >> 7) & 0xFF;
|
||||
break;
|
||||
case 12:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = (RSP_Vect[vect].u16(2) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(1) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(0) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(3) >> 7) & 0xFF;
|
||||
break;
|
||||
case 13:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 14:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = 0;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = 0;
|
||||
break;
|
||||
case 15:
|
||||
*(RSPInfo.DMEM + ((Addr + offset) ^ 3)) = (RSP_Vect[vect].u16(7) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 4) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(6) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 8) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(5) >> 7) & 0xFF;
|
||||
*(RSPInfo.DMEM + ((Addr + ((offset + 12) & 0xF)) ^ 3)) = (RSP_Vect[vect].u16(4) >> 7) & 0xFF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SH_DMEM(uint32_t Addr, uint16_t Value)
|
||||
{
|
||||
if ((Addr & 0x1) != 0)
|
||||
{
|
||||
*(uint8_t *)(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = (Value >> 8);
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Addr + 1) ^ 3) & 0xFFF)) = (Value & 0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
*(uint16_t *)(RSPInfo.DMEM + ((Addr ^ 2) & 0xFFF)) = Value;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SHV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = (RSP_Vect[vect].u8((15 - element) & 0xF) << 1) +
|
||||
(RSP_Vect[vect].u8((14 - element) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Addr + 2) ^ 3) & 0xFFF)) = (RSP_Vect[vect].u8((13 - element) & 0xF) << 1) +
|
||||
(RSP_Vect[vect].u8((12 - element) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Addr + 4) ^ 3) & 0xFFF)) = (RSP_Vect[vect].u8((11 - element) & 0xF) << 1) +
|
||||
(RSP_Vect[vect].u8((10 - element) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Addr + 6) ^ 3) & 0xFFF)) = (RSP_Vect[vect].u8((9 - element) & 0xF) << 1) +
|
||||
(RSP_Vect[vect].u8((8 - element) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Addr + 8) ^ 3) & 0xFFF)) = (RSP_Vect[vect].u8((7 - element) & 0xF) << 1) +
|
||||
(RSP_Vect[vect].u8((6 - element) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Addr + 10) ^ 3) & 0xFFF)) = (RSP_Vect[vect].u8((5 - element) & 0xF) << 1) +
|
||||
(RSP_Vect[vect].u8((4 - element) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Addr + 12) ^ 3) & 0xFFF)) = (RSP_Vect[vect].u8((3 - element) & 0xF) << 1) +
|
||||
(RSP_Vect[vect].u8((2 - element) & 0xF) >> 7);
|
||||
*(RSPInfo.DMEM + (((Addr + 14) ^ 3) & 0xFFF)) = (RSP_Vect[vect].u8((1 - element) & 0xF) << 1) +
|
||||
(RSP_Vect[vect].u8((0 - element) & 0xF) >> 7);
|
||||
}
|
||||
|
||||
void RSP_SLV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
int Count;
|
||||
|
||||
for (Count = element; Count < (4 + element); Count++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = RSP_Vect[vect].s8(15 - (Count & 0xF));
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SPV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
int Count;
|
||||
|
||||
for (Count = element; Count < (8 + element); Count++)
|
||||
{
|
||||
if (((Count)&0xF) < 8)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = RSP_Vect[vect].u8(15 - ((Count & 0xF) << 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = (RSP_Vect[vect].u8(15 - ((Count & 0x7) << 1)) << 1) +
|
||||
(RSP_Vect[vect].u8(14 - ((Count & 0x7) << 1)) >> 7);
|
||||
}
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SQV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
uint8_t length = ((Addr + 0x10) & ~0xF) - Addr;
|
||||
for (uint8_t i = element; i < (length + element); i++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = RSP_Vect[vect].s8(i & 0xF);
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SRV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
int length, Count, offset;
|
||||
|
||||
length = (Addr & 0xF);
|
||||
offset = (0x10 - length) & 0xF;
|
||||
Addr &= 0xFF0;
|
||||
for (Count = element; Count < (length + element); Count++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = RSP_Vect[vect].s8(15 - ((Count + offset) & 0xF));
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SSV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
int Count;
|
||||
|
||||
for (Count = element; Count < (2 + element); Count++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = RSP_Vect[vect].s8(15 - (Count & 0xF));
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_STV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
uint8_t del, count, length;
|
||||
|
||||
length = 8;
|
||||
if (length > 32 - vect)
|
||||
{
|
||||
length = 32 - vect;
|
||||
}
|
||||
length = length << 1;
|
||||
del = element >> 1;
|
||||
for (count = 0; count < length; count += 2)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = RSP_Vect[vect + del].u8(15 - count);
|
||||
*(RSPInfo.DMEM + (((Addr + 1) ^ 3) & 0xFFF)) = RSP_Vect[vect + del].u8(14 - count);
|
||||
del = (del + 1) & 7;
|
||||
Addr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SUV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
for (uint8_t Count = element; Count < (8 + element); Count++)
|
||||
{
|
||||
if (((Count)&0xF) < 8)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = ((RSP_Vect[vect].u8(15 - ((Count & 0x7) << 1)) << 1) +
|
||||
(RSP_Vect[vect].u8(14 - ((Count & 0x7) << 1)) >> 7)) &
|
||||
0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr ^ 3) & 0xFFF)) = RSP_Vect[vect].u8(15 - ((Count & 0x7) << 1));
|
||||
}
|
||||
Addr += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SW_DMEM(uint32_t Addr, uint32_t Value)
|
||||
{
|
||||
if ((Addr & 0x3) != 0)
|
||||
{
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Addr + 0) ^ 3) & 0xFFF)) = (Value >> 24) & 0xFF;
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Addr + 1) ^ 3) & 0xFFF)) = (Value >> 16) & 0xFF;
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Addr + 2) ^ 3) & 0xFFF)) = (Value >> 8) & 0xFF;
|
||||
*(uint8_t *)(RSPInfo.DMEM + (((Addr + 3) ^ 3) & 0xFFF)) = (Value >> 0) & 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(uint32_t *)(RSPInfo.DMEM + (Addr & 0xFFF)) = Value;
|
||||
}
|
||||
}
|
||||
|
||||
void RSP_SWV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element)
|
||||
{
|
||||
int Count, offset;
|
||||
|
||||
offset = Addr & 0xF;
|
||||
Addr &= 0xFF0;
|
||||
for (Count = element; Count < (16 + element); Count++)
|
||||
{
|
||||
*(RSPInfo.DMEM + ((Addr + (offset & 0xF)) ^ 3)) = RSP_Vect[vect].s8(15 - (Count & 0xF));
|
||||
offset += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,33 +8,5 @@ extern uint8_t *RecompCode, *RecompCodeSecondary, *RecompPos;
|
|||
extern void ** JumpTable;
|
||||
extern uint32_t Table;
|
||||
|
||||
void RSP_LB_DMEM(uint32_t Addr, uint8_t * Value);
|
||||
void RSP_LBV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LDV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LFV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LH_DMEM(uint32_t Addr, uint16_t * Value);
|
||||
void RSP_LHV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LLV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LPV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LRV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LQV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LSV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LTV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LUV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_LW_DMEM(uint32_t Addr, uint32_t * Value);
|
||||
void RSP_LW_IMEM(uint32_t Addr, uint32_t * Value);
|
||||
void RSP_SB_DMEM(uint32_t Addr, uint8_t Value);
|
||||
void RSP_SBV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SDV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SFV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SH_DMEM(uint32_t Addr, uint16_t Value);
|
||||
void RSP_SHV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SLV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SPV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SQV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SRV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SSV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_STV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SUV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
void RSP_SW_DMEM(uint32_t Addr, uint32_t Value);
|
||||
void RSP_SWV_DMEM(uint32_t Addr, uint8_t vect, uint8_t element);
|
||||
|
|
Loading…
Reference in New Issue