RSP: Add method to get element specifier index from the Vector
This commit is contained in:
parent
97fccb1c36
commit
6e03d6ad7b
|
@ -1262,19 +1262,16 @@ void RSP_Vector_VSUB(void)
|
|||
|
||||
void RSP_Vector_VABS(void)
|
||||
{
|
||||
uint8_t del;
|
||||
RSPVector Result;
|
||||
for (uint8_t el = 0; el < 8; el++)
|
||||
{
|
||||
del = EleSpec[RSPOpC.e].B[el];
|
||||
|
||||
if (RSP_Vect[RSPOpC.vs].s16(el) > 0)
|
||||
{
|
||||
Result.s16(el) = RSP_Vect[RSPOpC.vt].u16(del);
|
||||
Result.s16(el) = RSP_Vect[RSPOpC.vt].ue(el, RSPOpC.e);
|
||||
}
|
||||
else if (RSP_Vect[RSPOpC.vs].s16(el) < 0)
|
||||
{
|
||||
Result.u16(el) = RSP_Vect[RSPOpC.vt].u16(del) == 0x8000 ? 0x7FFF : RSP_Vect[RSPOpC.vt].s16(del) * -1;
|
||||
Result.u16(el) = RSP_Vect[RSPOpC.vt].ue(el, RSPOpC.e) == 0x8000 ? 0x7FFF : RSP_Vect[RSPOpC.vt].se(el, RSPOpC.e) * -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,11 +1,25 @@
|
|||
#include "RspTypes.h"
|
||||
|
||||
extern UDWORD EleSpec[16];
|
||||
|
||||
RSPVector::RSPVector()
|
||||
{
|
||||
m_Reg[0] = 0;
|
||||
m_Reg[1] = 0;
|
||||
}
|
||||
|
||||
uint16_t & RSPVector::ue(uint8_t Index, uint8_t Element)
|
||||
{
|
||||
Index = EleSpec[Element].B[Index];
|
||||
return ((uint16_t*)&m_Reg)[7 - Index];
|
||||
}
|
||||
|
||||
int16_t & RSPVector::se(uint8_t Index, uint8_t Element)
|
||||
{
|
||||
Index = EleSpec[Element].B[Index];
|
||||
return ((int16_t*)&m_Reg)[7 - Index];
|
||||
}
|
||||
|
||||
int8_t & RSPVector::s8(uint8_t Index)
|
||||
{
|
||||
return ((int8_t*)&m_Reg)[15 - Index];
|
||||
|
|
|
@ -29,6 +29,9 @@ class RSPVector
|
|||
public:
|
||||
RSPVector();
|
||||
|
||||
uint16_t & ue(uint8_t Index, uint8_t Element);
|
||||
int16_t & se(uint8_t Index, uint8_t Element);
|
||||
|
||||
int8_t & s8(uint8_t Index);
|
||||
uint8_t & u8(uint8_t Index);
|
||||
int16_t & s16(uint8_t Index);
|
||||
|
|
Loading…
Reference in New Issue