pureikyubu/SRC/DSP/DspDisasm.h
2020-03-30 11:21:16 +03:00

46 lines
1 KiB
C++

/// DSP disassembler.
#pragma once
#include <string>
namespace DSP
{
class DspDisasm
{
// Utilities used by disasm
template<typename T>
static std::string ToHexString(T data);
static std::string ParameterToString(DspParameter index, AnalyzeInfo& info);
static std::string InstrToString(DspInstruction, ConditionCode);
static std::string InstrExToString(DspInstructionEx);
// Kek, allowed only in headers..
template<>
static inline std::string ToHexString(uint16_t address)
{
char buf[0x100] = { 0, };
sprintf_s(buf, _countof(buf), "%04X", address);
return std::string(buf);
}
template<>
static inline std::string ToHexString(uint8_t Byte)
{
char buf[0x100] = { 0, };
sprintf_s(buf, _countof(buf), "%02X", Byte);
return std::string(buf);
}
static bool IsHardwareReg(DspAddress address);
static std::string HardwareRegName(DspAddress address);
static std::string CondCodeToString(ConditionCode cc);
public:
static std::string Disasm(DspAddress startAddr, AnalyzeInfo& info);
};
}