From 79cd19b66a35c0a80922f1e684e867a48aa79be3 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sat, 11 Mar 2017 21:37:58 -0500 Subject: [PATCH] Assembler: Minor bug fixes for edit code feature --- GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs index 006cd347..5a9ce838 100644 --- a/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs +++ b/GUI.NET/Debugger/Controls/ctrlDebuggerCode.cs @@ -207,14 +207,16 @@ namespace Mesen.GUI.Debugger string comment = codeLabel?.Comment; string label = codeLabel?.Label; - if(code == "STP*" || code == "NOP*") { + bool addPadding = true; + if(code.StartsWith("STP*") || code.StartsWith("NOP*")) { //Transform unofficial opcodes that can't be reassembled properly into .byte statements if(comment != null) { comment.Insert(1, code + " - "); } else { comment = code; } - code = ".byte " + string.Join(",", _codeByteCode[i].Split(' ').Select((hexByte) => "$" + hexByte)); + code = ".byte " + string.Join(",", _codeByteCode[i].Split(' ')); + addPadding = false; } if(!string.IsNullOrWhiteSpace(comment) && comment.Contains("\n")) { @@ -224,7 +226,7 @@ namespace Mesen.GUI.Debugger if(!string.IsNullOrWhiteSpace(label)) { result.Add(label + ":"); } - result.Add(" " + code + (!string.IsNullOrWhiteSpace(comment) ? (" ;" + comment) : "")); + result.Add((addPadding ? " " : "") + code + (!string.IsNullOrWhiteSpace(comment) ? (" ;" + comment) : "")); int length = _codeByteCode[i].Count(c => c == ' ') + 1; byteLength += length;