disasm: print word 0 as bare NOP

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthew Stanley
2026-10-04 10:50:02 -07:00
parent d1f7f15dbc
commit 2fd4625d74
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -65,6 +65,8 @@ extern "C" int psx_disasm_one(uint32_t word, uint32_t addr, char* out, int cap)
int n;
if (d.format == InstrFormat::UNKNOWN) {
n = std::snprintf(out, (size_t)cap, ".word 0x%08X", word);
} else if (word == 0u) {
n = std::snprintf(out, (size_t)cap, "NOP");
} else if (std::strcmp(m, "JR") == 0) {
n = std::snprintf(out, (size_t)cap, "%-8s %s", m, rn(d.rs));
} else if (std::strcmp(m, "JALR") == 0) {
+1
View File
@@ -19,6 +19,7 @@ static void check(unsigned word, unsigned pc, const char* expected) {
CHECK(n == (int)std::strlen(expected));
}
int main() {
check(0,0,"NOP");
check(0x012A4020,0,"ADD $t0, $t1, $t2");
check(0x012A0018,0,"MULT $t1, $t2");
check(0x012A001B,0,"DIVU $t1, $t2");