- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.1k
Closed
Description
.program test
.pio_version 1
wait 0 jmppin
results in
    0x2060, //  0: wait   0
Maybe something like this (not tested), and trimmed trailing whitespace and ~ instead of ! could also be nice:
diff --git tools/pioasm/pio_disassembler.cpp tools/pioasm/pio_disassembler.cpp
index 2a34796..f62e7b3 100644
--- tools/pioasm/pio_disassembler.cpp
+++ tools/pioasm/pio_disassembler.cpp
@@ -56,7 +56,9 @@ std::string disassemble(uint inst, uint sideset_bits_including_opt, bool sideset
                     if (arg2 & 0x1cu) {
                         invalid = true;
                     } else if (arg2) {
-                        guts = "jmppin " + std::to_string(arg2 & 3u);
+                        guts = "jmppin + " + std::to_string(arg2 & 3u);
+                    } else {
+                        guts = "jmppin";
                     }
                     break;
             }
@@ -131,7 +133,7 @@ std::string disassemble(uint inst, uint sideset_bits_including_opt, bool sideset
                 op("mov");
                 std::string guts = dest + ", ";
                 if (operation == 1) {
-                    guts += "!";
+                    guts += "~";
                 } else if (operation == 2) {
                     guts += "::";
                 }
@@ -193,6 +195,7 @@ std::string disassemble(uint inst, uint sideset_bits_including_opt, bool sideset
     }
     delay &= ((1u << (5 - sideset_bits_including_opt)) - 1u);
     ss << std::left << std::setw(4) << (delay ? ("[" + std::to_string(delay) + "]") : "");
-    return ss.str();
+    auto str = ss.str();
+    return str.substr(0, str.find_last_not_of(" "));
 }