`Creeper´: Now displays the register name in the error message for invalid instructions

This commit is contained in:
Gabriel Correia 2024-02-09 21:11:54 -03:00
parent 117e5a0b36
commit b5a84d5194
6 changed files with 22 additions and 19 deletions

View File

@ -88,7 +88,7 @@ namespace cosmic::creeper::ee {
for (u8 opi{}; opi < 3; opi++) {
operands[opi] = (opcode >> (11 + opi * 5)) & 0x1f;
#if TRANSLATE_REGISTERS
translatedGprs[opi] = gprsId[operands.at(opi)];
translatedGprs[opi] = gprsNames[operands.at(opi)];
#endif
}
#if TRANSLATE_REGISTERS
@ -97,8 +97,14 @@ namespace cosmic::creeper::ee {
#endif
decode.ops = Operands(opcode, operands);
decode.execute = [](InvokeOpInfo& err) {
throw AppErr("Invalid or unrecognized opcode {:#x}, parameters: {}", err.ops.inst,
fmt::join(err.ops.gprs, "; "));
std::array<std::string, 3> gprs{
std::string{"$"} + gprsNames[err.ops.gprs[0]],
std::string{"$"} + gprsNames[err.ops.gprs[1]],
std::string{"$"} + gprsNames[err.ops.gprs[2]]
};
throw AppErr("Invalid or unrecognized opcode {:#x}, parameters: Unk {}", err.ops.inst,
fmt::join(gprs, ", "));
};
switch (opcode >> 26) {

View File

@ -32,7 +32,7 @@ namespace cosmic::engine {
}
runCycles = cycles[0] = 0;
user->info("(EE): Emotion Engine is finally reset to default, "\
"GPR {}: {}", gprsId[15], fmt::join(GPRs[15].dw, ", "));
"GPR {}: {}", gprsNames[15], fmt::join(GPRs[15].dw, ", "));
}
void EeMipsCore::pulse(u32 cycles) {
this->cycles[0] = cycles;
@ -170,7 +170,7 @@ namespace cosmic::engine {
for (u32 ir{}; ir < 32; ir++) {
fmt::format_to(back_inserter(states), "EE-GPR {}: dw0: {:#x}, dw1: {:#x}\n",
gprsId[ir], GPRs[ir].dw[0], GPRs[ir].dw[1]);
gprsNames[ir], GPRs[ir].dw[0], GPRs[ir].dw[1]);
}
fmt::format_to(back_inserter(states), "LO: {:#x}\n", mulDivStorage[0]);
fmt::format_to(back_inserter(states), "HI: {:#x}\n", mulDivStorage[1]);

View File

@ -90,5 +90,5 @@ namespace cosmic::engine {
Ld = 0x37,
Sw = 0x2b,
};
extern const std::array<const char*, 32> gprsId;
extern const std::array<const char*, 32> gprsNames;
}

View File

@ -17,7 +17,7 @@ namespace cosmic::engine {
mulDivStorage[0] = val & 0xffffffff;
mulDivStorage[1] = (val >> 32) & 0xffffffff;
}
const std::array<const char*, 32> gprsId{
const std::array<const char*, 32> gprsNames{
"zero",
"at", "v0", "v1", "a0", "a1", "a2", "a3",
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",

View File

@ -118,8 +118,8 @@ namespace cosmic::gs {
end = packet[0] & 1 << 0xf;
fmt = packet[0] >> 58 & 0x3;
regs = packet[0] >> 60;
[[unlikely]] if (fmt > Image3FmtTag)
;
[[unlikely]] if (fmt > Image3FmtTag) {
}
// The first transfer from Vif to GS is its Gif-Tag; let's decode it now
unpacked->perLoop = lo;

View File

@ -2,17 +2,14 @@
#include <os/neon_simd.h>
#include <common/asm_c++out.h>
namespace cosmic::gs {
__asm(
".data\n"
"gSize: .int 0\n"
"gResetDone: .byte 0\n"
extern "C" {
i32 gSize;
bool gResetDone;
void* gBackPtr;
void* gFrontPtr;
".align 8\n"
"gBackPtr: .quad 0\n"
"gFrontPtr: .quad 0\n"
".bss\n"
".align 16\n"
"gQueue: .space 16 * 16");
std::array<u8, 16 * 16> gQueue;
}
[[gnu::naked]] void gifQueueReset() {
PROLOGUE_ASM(16);