2019-12-19 22:20:32 +00:00
|
|
|
#include <QPainter>
|
|
|
|
|
2024-03-21 14:24:08 -04:00
|
|
|
#include "DisAsmVuTableModel.h"
|
2019-12-19 22:20:32 +00:00
|
|
|
#include "string_cast.h"
|
|
|
|
#include "string_format.h"
|
|
|
|
#include "lexical_cast_ex.h"
|
|
|
|
|
2024-03-21 14:24:08 -04:00
|
|
|
CDisAsmVuTableModel::CDisAsmVuTableModel(QTableView* parent, CVirtualMachine& virtualMachine, CMIPS* context, uint64 size, uint32 windowSize)
|
|
|
|
: CDisAsmTableModel(parent, virtualMachine, context, size, windowSize, DISASM_TYPE::DISASM_VU)
|
2019-12-19 22:20:32 +00:00
|
|
|
{
|
2021-01-12 08:28:24 -05:00
|
|
|
m_headers = {"S", "Address", "R", "Instr", "UI-Mn", "UI-Op", "LI-Mn", "LI-Op", "Target/Comments"};
|
2019-12-19 22:20:32 +00:00
|
|
|
|
|
|
|
m_instructionSize = 8;
|
|
|
|
}
|
|
|
|
|
2024-03-21 14:24:08 -04:00
|
|
|
std::string CDisAsmVuTableModel::GetInstructionDetails(int index, uint32 address) const
|
2019-12-19 22:20:32 +00:00
|
|
|
{
|
|
|
|
assert((address & 0x07) == 0);
|
|
|
|
|
|
|
|
uint32 lowerInstruction = GetInstruction(address + 0);
|
|
|
|
uint32 upperInstruction = GetInstruction(address + 4);
|
|
|
|
switch(index)
|
|
|
|
{
|
2019-12-19 21:37:47 +00:00
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
std::string instructionCode = lexical_cast_hex<std::string>(upperInstruction, 8) + (" ") + lexical_cast_hex<std::string>(lowerInstruction, 8);
|
|
|
|
return instructionCode;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
char disAsm[256];
|
|
|
|
m_ctx->m_pArch->GetInstructionMnemonic(m_ctx, address + 4, upperInstruction, disAsm, 256);
|
|
|
|
return disAsm;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
char disAsm[256];
|
|
|
|
m_ctx->m_pArch->GetInstructionOperands(m_ctx, address + 4, upperInstruction, disAsm, 256);
|
|
|
|
return disAsm;
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
char disAsm[256];
|
|
|
|
m_ctx->m_pArch->GetInstructionMnemonic(m_ctx, address + 0, lowerInstruction, disAsm, 256);
|
|
|
|
return disAsm;
|
|
|
|
}
|
|
|
|
case 4:
|
|
|
|
{
|
|
|
|
char disAsm[256];
|
|
|
|
m_ctx->m_pArch->GetInstructionOperands(m_ctx, address + 0, lowerInstruction, disAsm, 256);
|
|
|
|
return disAsm;
|
|
|
|
}
|
2019-12-19 22:20:32 +00:00
|
|
|
}
|
2019-12-19 13:51:41 +00:00
|
|
|
return "";
|
2019-12-19 22:20:32 +00:00
|
|
|
}
|