2006-06-15 04:19:30 +00:00
|
|
|
#include "MA_VU.h"
|
|
|
|
#include "MIPS.h"
|
|
|
|
|
2008-04-09 02:52:38 +00:00
|
|
|
CCodeGen* CMA_VU::m_codeGen = NULL;
|
|
|
|
CMIPS* CMA_VU::m_pCtx = NULL;
|
|
|
|
uint32 CMA_VU::m_nOpcode = 0;
|
|
|
|
uint32 CMA_VU::m_nAddress = 0;
|
|
|
|
|
2008-06-23 01:35:05 +00:00
|
|
|
CMA_VU::CMA_VU(bool maskDataAddress) :
|
|
|
|
CMIPSArchitecture(MIPS_REGSIZE_64),
|
|
|
|
m_Lower(maskDataAddress)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
|
|
|
SetupReflectionTables();
|
|
|
|
}
|
|
|
|
|
2008-03-30 22:12:52 +00:00
|
|
|
CMA_VU::~CMA_VU()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-04-09 02:52:38 +00:00
|
|
|
void CMA_VU::CompileInstruction(uint32 nAddress, CCodeGen* codeGen, CMIPS* pCtx, bool nParent)
|
2006-06-15 04:19:30 +00:00
|
|
|
{
|
2008-03-22 02:37:01 +00:00
|
|
|
if(nParent)
|
|
|
|
{
|
2008-04-09 02:52:38 +00:00
|
|
|
//SetupQuickVariables(nAddress, pBlock, pCtx);
|
|
|
|
//TODO: Get rid of static storage...
|
|
|
|
m_pCtx = pCtx;
|
|
|
|
m_codeGen = codeGen;
|
|
|
|
m_nAddress = nAddress;
|
2008-06-15 19:55:28 +00:00
|
|
|
m_nOpcode = m_pCtx->m_pMemoryMap->GetInstruction(m_nAddress);
|
2008-03-22 02:37:01 +00:00
|
|
|
}
|
|
|
|
|
2006-06-15 04:19:30 +00:00
|
|
|
if(nAddress & 0x04)
|
|
|
|
{
|
2008-04-09 02:52:38 +00:00
|
|
|
m_Upper.CompileInstruction(nAddress, codeGen, pCtx, nParent);
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-04-09 02:52:38 +00:00
|
|
|
m_Lower.CompileInstruction(nAddress, codeGen, pCtx, nParent);
|
2006-06-15 04:19:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMA_VU::SetupReflectionTables()
|
|
|
|
{
|
|
|
|
m_Lower.SetupReflectionTables();
|
|
|
|
m_Upper.SetupReflectionTables();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMA_VU::GetInstructionMnemonic(CMIPS* pCtx, uint32 nAddress, uint32 nOpcode, char* sText, unsigned int nCount)
|
|
|
|
{
|
|
|
|
if(nAddress & 0x04)
|
|
|
|
{
|
|
|
|
m_Upper.GetInstructionMnemonic(pCtx, nAddress, nOpcode, sText, nCount);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_Lower.GetInstructionMnemonic(pCtx, nAddress, nOpcode, sText, nCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMA_VU::GetInstructionOperands(CMIPS* pCtx, uint32 nAddress, uint32 nOpcode, char* sText, unsigned int nCount)
|
|
|
|
{
|
|
|
|
if(nAddress & 0x04)
|
|
|
|
{
|
|
|
|
m_Upper.GetInstructionOperands(pCtx, nAddress, nOpcode, sText, nCount);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_Lower.GetInstructionOperands(pCtx, nAddress, nOpcode, sText, nCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CMA_VU::IsInstructionBranch(CMIPS* pCtx, uint32 nAddress, uint32 nOpcode)
|
|
|
|
{
|
|
|
|
if(nAddress & 0x04)
|
|
|
|
{
|
|
|
|
return m_Upper.IsInstructionBranch(pCtx, nAddress, nOpcode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return m_Lower.IsInstructionBranch(pCtx, nAddress, nOpcode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32 CMA_VU::GetInstructionEffectiveAddress(CMIPS* pCtx, uint32 nAddress, uint32 nOpcode)
|
|
|
|
{
|
|
|
|
if(nAddress & 0x04)
|
|
|
|
{
|
|
|
|
return m_Upper.GetInstructionEffectiveAddress(pCtx, nAddress, nOpcode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return m_Lower.GetInstructionEffectiveAddress(pCtx, nAddress, nOpcode);
|
|
|
|
}
|
|
|
|
}
|