Disassembly view fixes
authorslack <slack@codemaniacs.com>
Tue, 17 Mar 2009 01:21:00 +0000 (02:21 +0100)
committerslack <slack@codemaniacs.com>
Tue, 17 Mar 2009 01:21:00 +0000 (02:21 +0100)
qtboi/QtBoiDisassemblyWindow.cc

index 81592e5e81f8c6055a048dda2c12c666bd36fa36..a3d69785e323cbf0146290139110f3bf637c41c3 100644 (file)
@@ -56,26 +56,37 @@ std::string QtBoiDisassemblyWindow::operandToHtml(const Instruction::Operand &op
 std::string QtBoiDisassemblyWindow::insToHtml(const Instruction &ins)
 {
 
-       std::string result(ins.str);
-       result += " ";
-       if (ins.str.substr(0,2)=="JR")
-       {
-               result += operandToHtml(ins.op1);
-               result += " [";
-               result += htmlLinkMem(ins.op2.val);
-               result += "]";
-       }
-       else if (ins.str.substr(0,2)=="JP" || ins.str.substr(0,4)=="CALL")
+       std::string result;
+
+       if (ins.type == Instruction::RESET)
        {
-               result += htmlLinkMem(ins.op1.val);
+               result += "RST ";
+               result += htmlLinkMem(strtol(ins.str.substr(4).c_str(), 0, 16));
        }
-       else 
+       else
        {
-               result += operandToHtml(ins.op1);
-               if (ins.op2.type != Instruction::NONE)
+               result += ins.str;
+               result += " ";
+               if (ins.str.substr(0,2)=="JR")
+               {
+                       result += operandToHtml(ins.op1);
+                       result += " [";
+                       result += htmlLinkMem(ins.op2.val);
+                       result += "]";
+               }
+               else if ((ins.str.substr(0,2)=="JP" && ins.op1.type == Instruction::INM16)
+                               || ins.str.substr(0,4)=="CALL")
+               {
+                       result += htmlLinkMem(ins.op1.val);
+               }
+               else
                {
-                       result += ", ";
-                       result += operandToHtml(ins.op2);
+                       result += operandToHtml(ins.op1);
+                       if (ins.op2.type != Instruction::NONE)
+                       {
+                               result += ", ";
+                               result += operandToHtml(ins.op2);
+                       }
                }
        }
        return result;