mirror of
https://github.com/fadden/6502bench.git
synced 2025-01-05 23:30:20 +00:00
Improve the "info" panel
Not a huge improvement, but things are slightly more organized, and there's a splash of color in the form of a border around the text describing the format of code and data lines. Added an "IsConstant" property to Symbol.
This commit is contained in:
parent
463fbff368
commit
630f7f0f87
@ -1541,8 +1541,8 @@ namespace SourceGen {
|
||||
// - ascending label
|
||||
ActiveDefSymbolList.Sort(delegate (DefSymbol a, DefSymbol b) {
|
||||
// Put constants first.
|
||||
int ca = (a.SymbolType == Symbol.Type.Constant) ? 1 : 0;
|
||||
int cb = (b.SymbolType == Symbol.Type.Constant) ? 1 : 0;
|
||||
int ca = (a.IsConstant) ? 1 : 0;
|
||||
int cb = (b.IsConstant) ? 1 : 0;
|
||||
if (ca != cb) {
|
||||
return cb - ca;
|
||||
}
|
||||
|
@ -426,10 +426,13 @@ namespace SourceGen {
|
||||
/// <summary>
|
||||
/// Generates a string describing the format, suitable for use in the UI.
|
||||
/// </summary>
|
||||
public string ToUiString() {
|
||||
public string ToUiString(bool showBytes = true) {
|
||||
// NOTE: this should be made easier to localize
|
||||
|
||||
string retstr = Length + "-byte ";
|
||||
string retstr = string.Empty;
|
||||
if (showBytes) {
|
||||
retstr = Length + "-byte ";
|
||||
}
|
||||
|
||||
if (IsString) {
|
||||
switch (FormatSubType) {
|
||||
@ -480,19 +483,19 @@ namespace SourceGen {
|
||||
switch (FormatType) {
|
||||
case Type.Default:
|
||||
case Type.NumericLE:
|
||||
retstr += "Numeric (little-endian)";
|
||||
retstr += "numeric (little-endian)";
|
||||
break;
|
||||
case Type.NumericBE:
|
||||
retstr += "Numeric (big-endian)";
|
||||
retstr += "numeric (big-endian)";
|
||||
break;
|
||||
case Type.Dense:
|
||||
retstr += "Dense";
|
||||
retstr += "dense";
|
||||
break;
|
||||
case Type.Fill:
|
||||
retstr += "Fill";
|
||||
retstr += "fill";
|
||||
break;
|
||||
case Type.Junk:
|
||||
retstr += "Unaligned junk";
|
||||
retstr += "unaligned junk";
|
||||
break;
|
||||
default:
|
||||
// strings handled earlier
|
||||
@ -501,35 +504,35 @@ namespace SourceGen {
|
||||
}
|
||||
break;
|
||||
case SubType.Hex:
|
||||
retstr += "Numeric, Hex";
|
||||
retstr += "numeric, Hex";
|
||||
break;
|
||||
case SubType.Decimal:
|
||||
retstr += "Numeric, Decimal";
|
||||
retstr += "numeric, Decimal";
|
||||
break;
|
||||
case SubType.Binary:
|
||||
retstr += "Numeric, Binary";
|
||||
retstr += "numeric, Binary";
|
||||
break;
|
||||
case SubType.Address:
|
||||
retstr += "Address";
|
||||
retstr += "address";
|
||||
break;
|
||||
case SubType.Symbol:
|
||||
if (SymbolRef.IsVariable) {
|
||||
retstr += "Local var \"" + SymbolRef.Label + "\"";
|
||||
retstr += "local var \"" + SymbolRef.Label + "\"";
|
||||
} else {
|
||||
retstr += "Symbol \"" + SymbolRef.Label + "\"";
|
||||
retstr += "symbol \"" + SymbolRef.Label + "\"";
|
||||
}
|
||||
break;
|
||||
case SubType.Ascii:
|
||||
retstr += "Numeric, ASCII";
|
||||
retstr += "numeric, ASCII";
|
||||
break;
|
||||
case SubType.HighAscii:
|
||||
retstr += "Numeric, ASCII (high)";
|
||||
retstr += "numeric, ASCII (high)";
|
||||
break;
|
||||
case SubType.C64Petscii:
|
||||
retstr += "Numeric, C64 PETSCII";
|
||||
retstr += "numeric, C64 PETSCII";
|
||||
break;
|
||||
case SubType.C64Screen:
|
||||
retstr += "Numeric, C64 Screen";
|
||||
retstr += "numeric, C64 Screen";
|
||||
break;
|
||||
case SubType.Align2:
|
||||
case SubType.Align4:
|
||||
@ -547,7 +550,7 @@ namespace SourceGen {
|
||||
case SubType.Align16384:
|
||||
case SubType.Align32768:
|
||||
case SubType.Align65536:
|
||||
retstr += "Alignment to " + (1 << AlignmentToPower(FormatSubType));
|
||||
retstr += "alignment to " + (1 << AlignmentToPower(FormatSubType));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -187,8 +187,7 @@ namespace SourceGen {
|
||||
/// </summary>
|
||||
/// <param name="newSym">Symbol to add.</param>
|
||||
public void AddOrReplace(DefSymbol newSym) {
|
||||
if (newSym.SymbolType != Symbol.Type.Constant &&
|
||||
newSym.SymbolType != Symbol.Type.ExternalAddr) {
|
||||
if (!newSym.IsConstant && newSym.SymbolType != Symbol.Type.ExternalAddr) {
|
||||
Debug.Assert(false, "Unexpected symbol type " + newSym.SymbolType);
|
||||
return;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ using CommonUtil;
|
||||
using CommonWPF;
|
||||
using SourceGen.Sandbox;
|
||||
using SourceGen.WpfGui;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SourceGen {
|
||||
/// <summary>
|
||||
@ -3421,29 +3422,19 @@ namespace SourceGen {
|
||||
#region Info panel
|
||||
|
||||
private void UpdateInfoPanel() {
|
||||
mMainWin.ClearInfoPanel();
|
||||
if (mMainWin.CodeListView_GetSelectionCount() != 1) {
|
||||
// Nothing selected, or multiple lines selected.
|
||||
mMainWin.InfoPanelContents = string.Empty;
|
||||
return;
|
||||
}
|
||||
int lineIndex = mMainWin.CodeListView_GetFirstSelectedIndex();
|
||||
LineListGen.Line line = CodeLineList[lineIndex];
|
||||
StringBuilder sb = new StringBuilder(250);
|
||||
|
||||
// TODO(someday): this should be made easier to localize
|
||||
string lineTypeStr;
|
||||
string extraStr = string.Empty;
|
||||
string lineTypeStr = null;
|
||||
bool isSimple = true;
|
||||
DefSymbol defSym = null;
|
||||
switch (line.LineType) {
|
||||
case LineListGen.Line.Type.Code:
|
||||
lineTypeStr = "code";
|
||||
break;
|
||||
case LineListGen.Line.Type.Data:
|
||||
if (mProject.GetAnattrib(line.FileOffset).IsInlineData) {
|
||||
lineTypeStr = "inline data";
|
||||
} else {
|
||||
lineTypeStr = "data";
|
||||
}
|
||||
break;
|
||||
case LineListGen.Line.Type.LongComment:
|
||||
lineTypeStr = "comment";
|
||||
break;
|
||||
@ -3452,8 +3443,6 @@ namespace SourceGen {
|
||||
break;
|
||||
case LineListGen.Line.Type.Blank:
|
||||
lineTypeStr = "blank line";
|
||||
//lineTypeStr = "blank line (+" +
|
||||
// mOutputFormatter.FormatOffset24(line.FileOffset) + ")";
|
||||
break;
|
||||
case LineListGen.Line.Type.OrgDirective:
|
||||
lineTypeStr = "address directive";
|
||||
@ -3461,36 +3450,33 @@ namespace SourceGen {
|
||||
case LineListGen.Line.Type.RegWidthDirective:
|
||||
lineTypeStr = "register width directive";
|
||||
break;
|
||||
case LineListGen.Line.Type.EquDirective: {
|
||||
lineTypeStr = "equate";
|
||||
int symIndex = LineListGen.DefSymIndexFromOffset(line.FileOffset);
|
||||
DefSymbol defSym = mProject.ActiveDefSymbolList[symIndex];
|
||||
string sourceStr;
|
||||
if (defSym.SymbolSource == Symbol.Source.Project) {
|
||||
sourceStr = "project symbol definition";
|
||||
} else if (defSym.SymbolSource == Symbol.Source.Platform) {
|
||||
sourceStr = "platform symbol file (#" + defSym.LoadOrdinal +
|
||||
":" + defSym.FileIdentifier + ")";
|
||||
if (!string.IsNullOrEmpty(defSym.Tag)) {
|
||||
sourceStr += ", tag=" + defSym.Tag;
|
||||
}
|
||||
} else {
|
||||
sourceStr = "???";
|
||||
}
|
||||
extraStr = "Source: " + sourceStr;
|
||||
if (defSym.SymbolType == Symbol.Type.Constant) {
|
||||
extraStr += " (constant)";
|
||||
} else {
|
||||
extraStr += " (address)";
|
||||
}
|
||||
|
||||
case LineListGen.Line.Type.LocalVariableTable:
|
||||
isSimple = false;
|
||||
lineTypeStr = "variable table";
|
||||
break;
|
||||
case LineListGen.Line.Type.Code:
|
||||
isSimple = false;
|
||||
lineTypeStr = "code";
|
||||
break;
|
||||
case LineListGen.Line.Type.Data:
|
||||
isSimple = false;
|
||||
if (mProject.GetAnattrib(line.FileOffset).IsInlineData) {
|
||||
lineTypeStr = "inline data";
|
||||
} else {
|
||||
lineTypeStr = "data";
|
||||
}
|
||||
break;
|
||||
case LineListGen.Line.Type.LocalVariableTable:
|
||||
lineTypeStr = "variable table";
|
||||
if (mProject.LvTables.TryGetValue(line.FileOffset,
|
||||
out LocalVariableTable lvt)) {
|
||||
extraStr = string.Format("{0} entries, clear-previous={1}",
|
||||
lvt.Count, lvt.ClearPrevious);
|
||||
case LineListGen.Line.Type.EquDirective:
|
||||
isSimple = false;
|
||||
int defSymIndex = LineListGen.DefSymIndexFromOffset(line.FileOffset);
|
||||
defSym = mProject.ActiveDefSymbolList[defSymIndex];
|
||||
if (defSym.SymbolSource == Symbol.Source.Project) {
|
||||
lineTypeStr = "project symbol equate";
|
||||
} else if (defSym.SymbolSource == Symbol.Source.Platform) {
|
||||
lineTypeStr = "platform symbol equate";
|
||||
} else {
|
||||
lineTypeStr = "???";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -3498,63 +3484,137 @@ namespace SourceGen {
|
||||
break;
|
||||
}
|
||||
|
||||
// For anything that isn't code or data, show something simple and bail.
|
||||
if (line.OffsetSpan == 0) {
|
||||
sb.AppendFormat(Res.Strings.INFO_LINE_SUM_NON_FMT,
|
||||
lineIndex, lineTypeStr);
|
||||
#if DEBUG
|
||||
sb.Append(" [offset=+" + line.FileOffset.ToString("x6") + "]");
|
||||
#endif
|
||||
if (!string.IsNullOrEmpty(extraStr)) {
|
||||
sb.Append("\r\n\r\n");
|
||||
sb.Append(extraStr);
|
||||
if (line.IsCodeOrData) {
|
||||
// Show number of bytes of code/data.
|
||||
if (line.OffsetSpan == 1) {
|
||||
mMainWin.InfoLineDescrText = string.Format(Res.Strings.INFO_LINE_SUM_SINGULAR_FMT,
|
||||
lineIndex, line.OffsetSpan, lineTypeStr);
|
||||
} else {
|
||||
mMainWin.InfoLineDescrText = string.Format(Res.Strings.INFO_LINE_SUM_PLURAL_FMT,
|
||||
lineIndex, line.OffsetSpan, lineTypeStr);
|
||||
}
|
||||
mMainWin.InfoPanelContents = sb.ToString();
|
||||
} else {
|
||||
mMainWin.InfoLineDescrText = string.Format(Res.Strings.INFO_LINE_SUM_NON_FMT,
|
||||
lineIndex, lineTypeStr);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
mMainWin.InfoOffsetText = ("[offset=+" + line.FileOffset.ToString("x6") + "]");
|
||||
#endif
|
||||
if (isSimple) {
|
||||
return;
|
||||
}
|
||||
Debug.Assert(line.IsCodeOrData);
|
||||
|
||||
Anattrib attr = mProject.GetAnattrib(line.FileOffset);
|
||||
|
||||
// Show number of bytes of code/data.
|
||||
if (line.OffsetSpan == 1) {
|
||||
sb.AppendFormat(Res.Strings.INFO_LINE_SUM_SINGULAR_FMT,
|
||||
lineIndex, line.OffsetSpan, lineTypeStr);
|
||||
} else {
|
||||
sb.AppendFormat(Res.Strings.INFO_LINE_SUM_PLURAL_FMT,
|
||||
lineIndex, line.OffsetSpan, lineTypeStr);
|
||||
if (line.LineType == LineListGen.Line.Type.LocalVariableTable) {
|
||||
string str = string.Empty;
|
||||
if (mProject.LvTables.TryGetValue(line.FileOffset,
|
||||
out LocalVariableTable lvt)) {
|
||||
str = lvt.Count + " entries";
|
||||
if (lvt.ClearPrevious) {
|
||||
str += "; clear previous";
|
||||
}
|
||||
}
|
||||
mMainWin.InfoPanelDetail1 = str;
|
||||
return;
|
||||
}
|
||||
sb.Append("\r\n");
|
||||
|
||||
if (line.LineType == LineListGen.Line.Type.EquDirective) {
|
||||
StringBuilder esb = new StringBuilder();
|
||||
//esb.Append("\u25b6 ");
|
||||
esb.Append("\u2022 ");
|
||||
if (defSym.IsConstant) {
|
||||
esb.Append("Constant");
|
||||
} else {
|
||||
esb.Append("External address");
|
||||
if (defSym.HasWidth) {
|
||||
esb.Append(", width=");
|
||||
esb.Append(defSym.DataDescriptor.Length);
|
||||
}
|
||||
}
|
||||
if (defSym.Direction != DefSymbol.DirectionFlags.ReadWrite) {
|
||||
esb.Append("\r\nI/O direction: ");
|
||||
esb.Append(defSym.Direction);
|
||||
}
|
||||
if (defSym.MultiMask != null) {
|
||||
esb.Append("\r\nMulti-mask:");
|
||||
int i = 23;
|
||||
if ((defSym.MultiMask.AddressMask | defSym.MultiMask.CompareMask |
|
||||
defSym.MultiMask.CompareValue) < 0x10000) {
|
||||
i = 15;
|
||||
}
|
||||
for ( ; i >= 0; i--) {
|
||||
if ((i & 3) == 3) {
|
||||
esb.Append(' ');
|
||||
}
|
||||
int bit = 1 << i;
|
||||
if ((defSym.MultiMask.AddressMask & bit) != 0) {
|
||||
esb.Append('x');
|
||||
} else if ((defSym.MultiMask.CompareMask & bit) != 0) {
|
||||
if ((defSym.MultiMask.CompareValue & bit) != 0) {
|
||||
esb.Append('1');
|
||||
} else {
|
||||
esb.Append('0');
|
||||
}
|
||||
} else {
|
||||
esb.Append('?');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defSym.SymbolSource == Symbol.Source.Platform) {
|
||||
esb.Append("\r\n\r\nSource file # ");
|
||||
esb.Append(defSym.LoadOrdinal);
|
||||
esb.Append(": ");
|
||||
esb.Append(defSym.FileIdentifier);
|
||||
|
||||
if (!string.IsNullOrEmpty(defSym.Tag)) {
|
||||
esb.Append(", tag=");
|
||||
esb.Append(defSym.Tag);
|
||||
}
|
||||
}
|
||||
mMainWin.InfoPanelDetail1 = esb.ToString();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Handle code/data items. In particular, the format descriptor.
|
||||
//
|
||||
Debug.Assert(line.IsCodeOrData);
|
||||
bool isCode = (line.LineType == LineListGen.Line.Type.Code);
|
||||
|
||||
StringBuilder sb = new StringBuilder(250);
|
||||
Anattrib attr = mProject.GetAnattrib(line.FileOffset);
|
||||
|
||||
if (!mProject.OperandFormats.TryGetValue(line.FileOffset, out FormatDescriptor dfd)) {
|
||||
// No user-specified format, but there may be a generated format.
|
||||
sb.AppendFormat(Res.Strings.INFO_FD_SUM_FMT, Res.Strings.DEFAULT_VALUE);
|
||||
mMainWin.InfoFormatBoxBrush = Brushes.Blue;
|
||||
if (attr.DataDescriptor != null) {
|
||||
sb.Append(" [");
|
||||
sb.Append(attr.DataDescriptor.ToUiString());
|
||||
sb.Append("]");
|
||||
mMainWin.InfoFormatShowSolid = true;
|
||||
sb.Append(Res.Strings.INFO_AUTO_FORMAT);
|
||||
sb.Append(' ');
|
||||
sb.Append(attr.DataDescriptor.ToUiString(!isCode));
|
||||
} else {
|
||||
mMainWin.InfoFormatShowDashes = true;
|
||||
sb.AppendFormat(Res.Strings.INFO_DEFAULT_FORMAT);
|
||||
}
|
||||
} else {
|
||||
// User-specified operand format.
|
||||
// If the descriptor has a weak reference to an unknown symbol, should we
|
||||
// call that out here?
|
||||
sb.AppendFormat(Res.Strings.INFO_FD_SUM_FMT, dfd.ToUiString());
|
||||
|
||||
// If the format descriptor for an instruction has the wrong length, it will
|
||||
// be ignored. Call that out.
|
||||
if (attr.IsInstructionStart && attr.Length != dfd.Length) {
|
||||
sb.AppendFormat(" [incorrect format length]");
|
||||
}
|
||||
mMainWin.InfoFormatBoxBrush = Brushes.Green;
|
||||
mMainWin.InfoFormatShowSolid = true;
|
||||
sb.Append(Res.Strings.INFO_CUSTOM_FORMAT);
|
||||
sb.Append(' ');
|
||||
sb.Append(dfd.ToUiString(!isCode));
|
||||
}
|
||||
sb.Append("\r\n");
|
||||
mMainWin.InfoFormatText = sb.ToString();
|
||||
|
||||
sb.Clear();
|
||||
|
||||
// Debug only
|
||||
//sb.Append("DEBUG: opAddr=" + attr.OperandAddress.ToString("x4") +
|
||||
// " opOff=" + attr.OperandOffset.ToString("x4") + "\r\n");
|
||||
|
||||
sb.Append("\u2022Attributes:");
|
||||
if (attr.IsHinted) {
|
||||
sb.Append(" Hinted(");
|
||||
sb.Append("\u2022 Hints: ");
|
||||
for (int i = 0; i < line.OffsetSpan; i++) {
|
||||
switch (mProject.TypeHints[line.FileOffset + i]) {
|
||||
case CodeAnalysis.TypeHint.Code:
|
||||
@ -3574,26 +3634,12 @@ namespace SourceGen {
|
||||
break;
|
||||
}
|
||||
}
|
||||
sb.Append(')');
|
||||
sb.Append("\r\n");
|
||||
}
|
||||
if (attr.IsEntryPoint) {
|
||||
sb.Append(" EntryPoint");
|
||||
}
|
||||
if (attr.IsBranchTarget) {
|
||||
sb.Append(" BranchTarget");
|
||||
}
|
||||
if (attr.DoesNotContinue) {
|
||||
sb.Append(" NoContinue");
|
||||
}
|
||||
if (attr.DoesNotBranch) {
|
||||
sb.Append(" NoBranch");
|
||||
}
|
||||
if (mProject.StatusFlagOverrides[line.FileOffset].AsInt != 0) {
|
||||
sb.Append(" StatusFlags");
|
||||
}
|
||||
sb.Append("\r\n\r\n");
|
||||
|
||||
if (attr.IsInstruction) {
|
||||
sb.Append("\r\n");
|
||||
|
||||
Asm65.OpDef op = mProject.CpuDef.GetOpDef(mProject.FileData[line.FileOffset]);
|
||||
|
||||
string shortDesc = mOpDesc.GetShortDescription(op.Mnemonic);
|
||||
@ -3614,27 +3660,44 @@ namespace SourceGen {
|
||||
|
||||
sb.Append("\u2022Cycles: ");
|
||||
int cycles = op.Cycles;
|
||||
// TODO: diff GetOpCycleMod vs. op.CycleMods to show which bits apply to
|
||||
// current CPU vs. other CPUs
|
||||
//Asm65.OpDef.CycleMod cycMods =
|
||||
// mProject.CpuDef.GetOpCycleMod(mProject.FileData[line.FileOffset]);
|
||||
Asm65.OpDef.CycleMod cycMods = op.CycleMods;
|
||||
sb.Append(cycles.ToString());
|
||||
if (cycMods != 0) {
|
||||
sb.Append(" (");
|
||||
int workBits = (int)cycMods;
|
||||
|
||||
OpDef.CycleMod allMods = op.CycleMods;
|
||||
OpDef.CycleMod nowMods =
|
||||
mProject.CpuDef.GetOpCycleMod(mProject.FileData[line.FileOffset]);
|
||||
if (allMods != 0) {
|
||||
StringBuilder nowSb = new StringBuilder();
|
||||
StringBuilder otherSb = new StringBuilder();
|
||||
int workBits = (int)allMods;
|
||||
while (workBits != 0) {
|
||||
// Isolate rightmost bit.
|
||||
int firstBit = (~workBits + 1) & workBits;
|
||||
sb.Append(mOpDesc.GetCycleModDescription((OpDef.CycleMod)firstBit));
|
||||
|
||||
string desc = mOpDesc.GetCycleModDescription((OpDef.CycleMod)firstBit);
|
||||
if (((int)nowMods & firstBit) != 0) {
|
||||
if (nowSb.Length != 0) {
|
||||
nowSb.Append(", ");
|
||||
}
|
||||
nowSb.Append(desc);
|
||||
} else {
|
||||
if (otherSb.Length != 0) {
|
||||
otherSb.Append(", ");
|
||||
}
|
||||
otherSb.Append(desc);
|
||||
}
|
||||
// Remove from set.
|
||||
workBits &= ~firstBit;
|
||||
if (workBits != 0) {
|
||||
// more to come
|
||||
sb.Append(", ");
|
||||
}
|
||||
}
|
||||
sb.Append(")");
|
||||
if (nowSb.Length != 0) {
|
||||
sb.Append(" (");
|
||||
sb.Append(nowSb);
|
||||
sb.Append(")");
|
||||
}
|
||||
if (otherSb.Length != 0) {
|
||||
sb.Append(" [");
|
||||
sb.Append(otherSb);
|
||||
sb.Append("]");
|
||||
}
|
||||
}
|
||||
sb.Append("\r\n");
|
||||
|
||||
@ -3655,15 +3718,11 @@ namespace SourceGen {
|
||||
if (!string.IsNullOrEmpty(longDesc)) {
|
||||
sb.Append("\r\n");
|
||||
sb.Append(longDesc);
|
||||
sb.Append("\r\n");
|
||||
}
|
||||
} else {
|
||||
// do we want descriptions of the pseudo-ops?
|
||||
}
|
||||
|
||||
|
||||
// Publish
|
||||
mMainWin.InfoPanelContents = sb.ToString();
|
||||
mMainWin.InfoPanelDetail1 = sb.ToString();
|
||||
}
|
||||
|
||||
#endregion Info panel
|
||||
|
@ -399,7 +399,7 @@ namespace SourceGen {
|
||||
public static string AnnotateEquDirective(Formatter formatter, string operand,
|
||||
DefSymbol defSym) {
|
||||
string typeStr;
|
||||
if (defSym.SymbolType == Symbol.Type.Constant) {
|
||||
if (defSym.IsConstant) {
|
||||
if (defSym.SymbolSource == Symbol.Source.Variable) {
|
||||
typeStr = Res.Strings.EQU_STACK_RELATIVE;
|
||||
} else {
|
||||
@ -412,7 +412,7 @@ namespace SourceGen {
|
||||
string msgStr = null;
|
||||
if (defSym.HasWidth) {
|
||||
msgStr = typeStr + "/" + defSym.DataDescriptor.Length;
|
||||
} else if (defSym.SymbolType == Symbol.Type.Constant) {
|
||||
} else if (defSym.IsConstant) {
|
||||
// not entirely convinced we want this, but there's currently no other way
|
||||
// to tell the difference between an address and a constant from the code list
|
||||
msgStr = typeStr;
|
||||
|
@ -35,7 +35,6 @@ limitations under the License.
|
||||
<system:String x:Key="str_ClipformatAssemblerSource">Assembler Source</system:String>
|
||||
<system:String x:Key="str_ClipformatDisassembly">Disassembly</system:String>
|
||||
<system:String x:Key="str_DefaultHeaderCommentFmt">6502bench SourceGen v{0}</system:String>
|
||||
<system:String x:Key="str_DefaultValue">Default</system:String>
|
||||
<system:String x:Key="str_DefaultAsciiDelimPat">‘#’</system:String>
|
||||
<system:String x:Key="str_DefaultHighAsciiDelimPat">“#”</system:String>
|
||||
<system:String x:Key="str_DefaultC64PetsciiDelimPat">pet:“#”</system:String>
|
||||
@ -93,7 +92,9 @@ limitations under the License.
|
||||
<system:String x:Key="str_FontDescriptorFmt">{0}-point {1}</system:String>
|
||||
<system:String x:Key="str_GeneratedForVersion">Target assembler: {0} v{1} [{2}]</system:String>
|
||||
<system:String x:Key="str_HideCol">Hide</system:String>
|
||||
<system:String x:Key="str_InfoFdSumFmt">•Operand format is {0}</system:String>
|
||||
<system:String x:Key="str_InfoAutoFormat">Format (auto):</system:String>
|
||||
<system:String x:Key="str_InfoCustomFormat">Format:</system:String>
|
||||
<system:String x:Key="str_InfoDefaultFormat">Format: default</system:String>
|
||||
<system:String x:Key="str_InfoLineSumNonFmt">Line {0}: {1}</system:String>
|
||||
<system:String x:Key="str_InfoLineSumPluralFmt">Line {0}: {1} bytes of {2}</system:String>
|
||||
<system:String x:Key="str_InfoLineSumSingularFmt">Line {0}: {1} byte of {2}</system:String>
|
||||
|
@ -45,8 +45,6 @@ namespace SourceGen.Res {
|
||||
(string)Application.Current.FindResource("str_AsmOutputNotFound");
|
||||
public static string DEFAULT_HEADER_COMMENT_FMT =
|
||||
(string)Application.Current.FindResource("str_DefaultHeaderCommentFmt");
|
||||
public static string DEFAULT_VALUE =
|
||||
(string)Application.Current.FindResource("str_DefaultValue");
|
||||
public static string DEFAULT_ASCII_DELIM_PAT =
|
||||
(string)Application.Current.FindResource("str_DefaultAsciiDelimPat");
|
||||
public static string DEFAULT_HIGH_ASCII_DELIM_PAT =
|
||||
@ -167,8 +165,12 @@ namespace SourceGen.Res {
|
||||
(string)Application.Current.FindResource("str_GeneratedForVersion");
|
||||
public static string HIDE_COL =
|
||||
(string)Application.Current.FindResource("str_HideCol");
|
||||
public static string INFO_FD_SUM_FMT =
|
||||
(string)Application.Current.FindResource("str_InfoFdSumFmt");
|
||||
public static string INFO_AUTO_FORMAT =
|
||||
(string)Application.Current.FindResource("str_InfoAutoFormat");
|
||||
public static string INFO_CUSTOM_FORMAT =
|
||||
(string)Application.Current.FindResource("str_InfoCustomFormat");
|
||||
public static string INFO_DEFAULT_FORMAT =
|
||||
(string)Application.Current.FindResource("str_InfoDefaultFormat");
|
||||
public static string INFO_LINE_SUM_NON_FMT =
|
||||
(string)Application.Current.FindResource("str_InfoLineSumNonFmt");
|
||||
public static string INFO_LINE_SUM_PLURAL_FMT =
|
||||
|
@ -55,18 +55,18 @@ namespace SourceGen {
|
||||
/// for external addresses (including variables) and constants.
|
||||
/// </summary>
|
||||
public bool IsInternalLabel {
|
||||
get {
|
||||
return SymbolSource == Source.User || SymbolSource == Source.Auto;
|
||||
}
|
||||
get { return SymbolSource == Source.User || SymbolSource == Source.Auto; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if the symbol is a local variable.
|
||||
/// </summary>
|
||||
public bool IsVariable {
|
||||
get {
|
||||
return SymbolSource == Source.Variable;
|
||||
}
|
||||
get { return SymbolSource == Source.Variable; }
|
||||
}
|
||||
|
||||
public bool IsConstant {
|
||||
get { return SymbolType == Type.Constant; }
|
||||
}
|
||||
|
||||
|
||||
|
@ -349,7 +349,7 @@ namespace SourceGen {
|
||||
/// </summary>
|
||||
/// <param name="sym">Symbol to add.</param>
|
||||
private void AddAddressTableEntry(Symbol sym) {
|
||||
if (sym.SymbolType == Symbol.Type.Constant) {
|
||||
if (sym.IsConstant) {
|
||||
return;
|
||||
}
|
||||
if (sym.SymbolSource == Symbol.Source.Variable) {
|
||||
@ -461,7 +461,7 @@ namespace SourceGen {
|
||||
private void RemoveAddressTableEntry(Symbol sym) {
|
||||
// Easiest thing to do is just regenerate the table. Since we don't track
|
||||
// constants or variables, we can just ignore those.
|
||||
if (sym.SymbolType == Symbol.Type.Constant) {
|
||||
if (sym.IsConstant) {
|
||||
return;
|
||||
}
|
||||
if (sym.SymbolSource == Symbol.Source.Variable) {
|
||||
|
@ -216,7 +216,7 @@ namespace SourceGen.WpfGui {
|
||||
}
|
||||
Comment = mOldSym.Comment;
|
||||
|
||||
if (mOldSym.SymbolType == Symbol.Type.Constant) {
|
||||
if (mOldSym.IsConstant) {
|
||||
IsConstant = true;
|
||||
} else {
|
||||
IsAddress = true;
|
||||
|
@ -879,8 +879,7 @@ namespace SourceGen.WpfGui {
|
||||
Symbol firstPlatform = null;
|
||||
Symbol firstProject = null;
|
||||
foreach (Symbol sym in mProject.SymbolTable) {
|
||||
if (sym.Value == attr.OperandAddress &&
|
||||
sym.SymbolType != Symbol.Type.Constant) {
|
||||
if (sym.Value == attr.OperandAddress && !sym.IsConstant) {
|
||||
if (firstPlatform == null && sym.SymbolSource == Symbol.Source.Platform) {
|
||||
firstPlatform = sym;
|
||||
} else if (firstProject == null &&
|
||||
|
@ -168,7 +168,7 @@ namespace SourceGen.WpfGui {
|
||||
/// </summary>
|
||||
private FormattedSymbol CreateFormattedSymbol(DefSymbol defSym) {
|
||||
string typeStr;
|
||||
if (defSym.SymbolType == Symbol.Type.Constant) {
|
||||
if (defSym.IsConstant) {
|
||||
typeStr = Res.Strings.ABBREV_STACK_RELATIVE;
|
||||
} else {
|
||||
typeStr = Res.Strings.ABBREV_ADDRESS;
|
||||
|
@ -462,7 +462,7 @@ namespace SourceGen.WpfGui {
|
||||
|
||||
private FormattedSymbol CreateFormattedSymbol(DefSymbol defSym) {
|
||||
string typeStr;
|
||||
if (defSym.SymbolType == Symbol.Type.Constant) {
|
||||
if (defSym.IsConstant) {
|
||||
typeStr = Res.Strings.ABBREV_CONSTANT;
|
||||
} else {
|
||||
typeStr = Res.Strings.ABBREV_ADDRESS;
|
||||
|
@ -450,11 +450,11 @@ limitations under the License.
|
||||
DockPanel, so that LastChildFill will expand this to fill all available space. -->
|
||||
<Grid Name="triptychGrid" DockPanel.Dock="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="256" MinWidth="100"/>
|
||||
<ColumnDefinition Width="*" MinWidth="100"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" MinWidth="150"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="256" MinWidth="100"/>
|
||||
<ColumnDefinition Width="*" MinWidth="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
@ -584,7 +584,7 @@ limitations under the License.
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListView Name="codeListView" Grid.Column="2"
|
||||
<ListView Name="codeListView"
|
||||
Style="{StaticResource codeListStyle}"
|
||||
FontFamily="{StaticResource GeneralMonoFont}"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
||||
@ -628,7 +628,8 @@ limitations under the License.
|
||||
|
||||
<!-- A GridSplitter would be nice to make the height adjustable, but I had
|
||||
trouble making everything disappear cleanly, particularly w.r.t. the splitter
|
||||
working correctly after hide + re-show. See
|
||||
working correctly after hide + re-show. (This might have been due to a more
|
||||
general issue... should revisit this someday.) See
|
||||
https://stackoverflow.com/q/2502178/294248 for suggestions. -->
|
||||
<!--<GridSplitter Name="messageLogSplitter" Grid.Row="1" Height="4"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
@ -673,7 +674,7 @@ limitations under the License.
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="2*" MinHeight="100"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*" MinHeight="100"/>
|
||||
<RowDefinition Height="*" MinHeight="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Grid.Row="0" Header="Symbols">
|
||||
@ -721,9 +722,55 @@ limitations under the License.
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Grid.Row="2" Header="Info">
|
||||
<TextBox Text="{Binding InfoPanelContents}" IsReadOnly="True"
|
||||
FontFamily="{StaticResource GeneralMonoFont}"
|
||||
TextWrapping="Wrap"/>
|
||||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" TextWrapping="Wrap"
|
||||
Text="{Binding InfoLineDescrText, FallbackValue=Line #1234: N bytes of data}"/>
|
||||
<TextBlock Grid.Row="1" TextWrapping="Wrap" Foreground="DarkGray"
|
||||
Text="{Binding InfoOffsetText, FallbackValue=[offset: +123456]}"/>
|
||||
|
||||
<StackPanel Grid.Row="2"
|
||||
Visibility="{Binding InfoFormatShowDashes, Converter={StaticResource BoolToVis}}">
|
||||
<!-- For some reason putting the Visibility on the Border causes the
|
||||
border to disappear even when it's supposed to be Visible. So I'm
|
||||
using a panel to contain it. -->
|
||||
<Border BorderThickness="1" Padding="1" Margin="0,2">
|
||||
<!-- https://stackoverflow.com/a/47300149/294248 -->
|
||||
<Border.BorderBrush>
|
||||
<VisualBrush>
|
||||
<VisualBrush.Visual>
|
||||
<Rectangle StrokeDashArray="4 2" Stroke="{Binding InfoFormatBoxBrush}" StrokeThickness="1"
|
||||
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
|
||||
Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
</Border.BorderBrush>
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Text="{Binding InfoFormatText, FallbackValue=Format: good stuff}"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Border Grid.Row="2" BorderThickness="1" Padding="1" Margin="0,2"
|
||||
BorderBrush="{Binding InfoFormatBoxBrush}"
|
||||
Visibility="{Binding InfoFormatShowSolid, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding InfoFormatText}"/>
|
||||
</Border>
|
||||
|
||||
<TextBox Grid.Row="3" Text="{Binding InfoPanelDetail1}" IsReadOnly="True"
|
||||
TextWrapping="Wrap" BorderThickness="0"/>
|
||||
|
||||
<!--<TextBox Grid.Row="4" Text="{Binding InfoPanelMonoContents}" IsReadOnly="True"
|
||||
FontFamily="{StaticResource GeneralMonoFont}"
|
||||
TextWrapping="Wrap" BorderThickness="0"/>-->
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</GroupBox>
|
||||
|
||||
<GridSplitter Height="4" Grid.Row="1"
|
||||
|
@ -355,8 +355,7 @@ namespace SourceGen.WpfGui {
|
||||
// Clear these so we're not still showing them after the project closes.
|
||||
SymbolsList.Clear();
|
||||
NotesList.Clear();
|
||||
|
||||
InfoPanelContents = string.Empty;
|
||||
ClearInfoPanel();
|
||||
|
||||
// If you open a new project while one is already open, the ListView apparently
|
||||
// doesn't reset certain state, possibly because it's never asked to draw after
|
||||
@ -424,7 +423,7 @@ namespace SourceGen.WpfGui {
|
||||
AppSettings.Global.Dirty = true;
|
||||
}
|
||||
private void GridSizeChanged(object sender, EventArgs e) {
|
||||
//Debug.WriteLine("Splitter size change");
|
||||
//Debug.WriteLine("Grid size change: " + sender);
|
||||
AppSettings.Global.Dirty = true;
|
||||
}
|
||||
private void ColumnWidthChanged(object sender, EventArgs e) {
|
||||
@ -1602,8 +1601,8 @@ namespace SourceGen.WpfGui {
|
||||
(SymFilterProjectSymbols != true && sli.Sym.SymbolSource == Symbol.Source.Project) ||
|
||||
(SymFilterPlatformSymbols != true && sli.Sym.SymbolSource == Symbol.Source.Platform) ||
|
||||
(SymFilterAutoLabels != true && sli.Sym.SymbolSource == Symbol.Source.Auto) ||
|
||||
(SymFilterAddresses != true && sli.Sym.SymbolType != Symbol.Type.Constant) ||
|
||||
(SymFilterConstants != true && sli.Sym.SymbolType == Symbol.Type.Constant) ||
|
||||
(SymFilterAddresses != true && !sli.Sym.IsConstant) ||
|
||||
(SymFilterConstants != true && sli.Sym.IsConstant) ||
|
||||
sli.Sym.IsVariable)
|
||||
{
|
||||
e.Accepted = false;
|
||||
@ -1689,18 +1688,64 @@ namespace SourceGen.WpfGui {
|
||||
#region Info panel
|
||||
|
||||
/// <summary>
|
||||
/// Text to display in the Info panel. This is a simple TextBox.
|
||||
/// Text for the line number / description section.
|
||||
/// </summary>
|
||||
public string InfoPanelContents {
|
||||
get {
|
||||
return mInfoBoxContents;
|
||||
}
|
||||
set {
|
||||
mInfoBoxContents = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
public string InfoLineDescrText {
|
||||
get { return mInfoLineDescrText; }
|
||||
set { mInfoLineDescrText = value; OnPropertyChanged(); }
|
||||
}
|
||||
private string mInfoLineDescrText;
|
||||
|
||||
/// <summary>
|
||||
/// Text for the offset, shown only in debug builds.
|
||||
/// </summary>
|
||||
public string InfoOffsetText {
|
||||
get { return mInfoOffsetText; }
|
||||
set { mInfoOffsetText = value; OnPropertyChanged(); }
|
||||
}
|
||||
private string mInfoOffsetText;
|
||||
|
||||
public SolidColorBrush InfoFormatBoxBrush {
|
||||
get { return mInfoFormatBoxBrush; }
|
||||
set { mInfoFormatBoxBrush = value; OnPropertyChanged(); }
|
||||
}
|
||||
private SolidColorBrush mInfoFormatBoxBrush = Brushes.Green;
|
||||
|
||||
public bool InfoFormatShowDashes {
|
||||
get { return mInfoFormatShowDashes; }
|
||||
set { mInfoFormatShowDashes = value; OnPropertyChanged(); }
|
||||
}
|
||||
private bool mInfoFormatShowDashes;
|
||||
|
||||
public bool InfoFormatShowSolid {
|
||||
get { return mInfoFormatShowSolid; }
|
||||
set { mInfoFormatShowSolid = value; OnPropertyChanged(); }
|
||||
}
|
||||
private bool mInfoFormatShowSolid;
|
||||
|
||||
public string InfoFormatText {
|
||||
get { return mInfoFormatText; }
|
||||
set { mInfoFormatText = value; OnPropertyChanged(); }
|
||||
}
|
||||
private string mInfoFormatText;
|
||||
|
||||
public string InfoPanelDetail1 {
|
||||
get { return mInfoPanelDetail1; }
|
||||
set { mInfoPanelDetail1 = value; OnPropertyChanged(); }
|
||||
}
|
||||
private string mInfoPanelDetail1;
|
||||
|
||||
//public string InfoPanelMonoContents {
|
||||
// get { return mInfoPanelMonoContents; }
|
||||
// set { mInfoPanelMonoContents = value; OnPropertyChanged(); }
|
||||
//}
|
||||
//private string mInfoPanelMonoContents;
|
||||
|
||||
|
||||
public void ClearInfoPanel() {
|
||||
InfoLineDescrText = InfoOffsetText = InfoFormatText = InfoPanelDetail1 = string.Empty;
|
||||
InfoFormatShowDashes = InfoFormatShowSolid = false;
|
||||
}
|
||||
private string mInfoBoxContents;
|
||||
|
||||
#endregion Info panel
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user