mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-26 06:49:19 +00:00
Optionally add spaces in the "bytes" column
Affects the display list and copy/paste text. Makes the column three spaces wider, but makes it easier to read.
This commit is contained in:
parent
80da6cc1df
commit
96ee33ae8c
@ -74,6 +74,8 @@ namespace Asm65 {
|
||||
// miscellaneous
|
||||
public bool mHexDumpAsciiOnly; // disallow non-ASCII chars in hex dumps?
|
||||
|
||||
public bool mSpacesBetweenBytes; // "20edfd" vs. "20 ed fd"
|
||||
|
||||
public enum CharConvMode { Unknown = 0, PlainAscii, HighLowAscii };
|
||||
public CharConvMode mHexDumpCharConvMode; // character conversion mode for dumps
|
||||
|
||||
@ -639,9 +641,12 @@ namespace Asm65 {
|
||||
private void GenerateByteFormat(int len) {
|
||||
Debug.Assert(len <= MAX_BYTE_DUMP);
|
||||
|
||||
StringBuilder sb = new StringBuilder(len * 6);
|
||||
StringBuilder sb = new StringBuilder(len * 7);
|
||||
for (int i = 0; i < len; i++) {
|
||||
//. e.g. "{0:x2}"
|
||||
if (i != 0 && mFormatConfig.mSpacesBetweenBytes) {
|
||||
sb.Append(' ');
|
||||
}
|
||||
// e.g. "{0:x2}"
|
||||
sb.Append("{" + i + ":" + mHexFmtChar + "2}");
|
||||
}
|
||||
mByteDumpFormats[len - 1] = sb.ToString();
|
||||
|
31
SourceGen/AppForms/EditAppSettings.Designer.cs
generated
31
SourceGen/AppForms/EditAppSettings.Designer.cs
generated
@ -156,6 +156,8 @@ namespace SourceGen.AppForms {
|
||||
this.defineData1Label = new System.Windows.Forms.Label();
|
||||
this.equDirectiveTextBox = new System.Windows.Forms.TextBox();
|
||||
this.equDirectiveLabel = new System.Windows.Forms.Label();
|
||||
this.codeViewMiscGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.spacesBetweenBytesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.settingsTabControl.SuspendLayout();
|
||||
this.codeViewTabPage.SuspendLayout();
|
||||
this.clipboardGroupBox.SuspendLayout();
|
||||
@ -169,6 +171,7 @@ namespace SourceGen.AppForms {
|
||||
this.operandWidthGroupBox.SuspendLayout();
|
||||
this.pseudoOpTabPage.SuspendLayout();
|
||||
this.quickPseudoSetGroup.SuspendLayout();
|
||||
this.codeViewMiscGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cancelButton
|
||||
@ -222,6 +225,7 @@ namespace SourceGen.AppForms {
|
||||
//
|
||||
// codeViewTabPage
|
||||
//
|
||||
this.codeViewTabPage.Controls.Add(this.codeViewMiscGroupBox);
|
||||
this.codeViewTabPage.Controls.Add(this.clipboardGroupBox);
|
||||
this.codeViewTabPage.Controls.Add(this.enableDebugCheckBox);
|
||||
this.codeViewTabPage.Controls.Add(this.upperCaseGroupBox);
|
||||
@ -405,7 +409,7 @@ namespace SourceGen.AppForms {
|
||||
//
|
||||
// selectFontButton
|
||||
//
|
||||
this.selectFontButton.Location = new System.Drawing.Point(6, 60);
|
||||
this.selectFontButton.Location = new System.Drawing.Point(6, 58);
|
||||
this.selectFontButton.Name = "selectFontButton";
|
||||
this.selectFontButton.Size = new System.Drawing.Size(125, 23);
|
||||
this.selectFontButton.TabIndex = 2;
|
||||
@ -1452,6 +1456,27 @@ namespace SourceGen.AppForms {
|
||||
this.equDirectiveLabel.Text = "Equate:";
|
||||
this.equDirectiveLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// codeViewMiscGroupBox
|
||||
//
|
||||
this.codeViewMiscGroupBox.Controls.Add(this.spacesBetweenBytesCheckBox);
|
||||
this.codeViewMiscGroupBox.Location = new System.Drawing.Point(406, 101);
|
||||
this.codeViewMiscGroupBox.Name = "codeViewMiscGroupBox";
|
||||
this.codeViewMiscGroupBox.Size = new System.Drawing.Size(200, 47);
|
||||
this.codeViewMiscGroupBox.TabIndex = 5;
|
||||
this.codeViewMiscGroupBox.TabStop = false;
|
||||
this.codeViewMiscGroupBox.Text = "Miscellaneous";
|
||||
//
|
||||
// spacesBetweenBytesCheckBox
|
||||
//
|
||||
this.spacesBetweenBytesCheckBox.AutoSize = true;
|
||||
this.spacesBetweenBytesCheckBox.Location = new System.Drawing.Point(7, 20);
|
||||
this.spacesBetweenBytesCheckBox.Name = "spacesBetweenBytesCheckBox";
|
||||
this.spacesBetweenBytesCheckBox.Size = new System.Drawing.Size(158, 17);
|
||||
this.spacesBetweenBytesCheckBox.TabIndex = 0;
|
||||
this.spacesBetweenBytesCheckBox.Text = "Add spaces in bytes column";
|
||||
this.spacesBetweenBytesCheckBox.UseVisualStyleBackColor = true;
|
||||
this.spacesBetweenBytesCheckBox.CheckedChanged += new System.EventHandler(this.spacesBetweenBytesCheckBox_CheckedChanged);
|
||||
//
|
||||
// EditAppSettings
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
@ -1493,6 +1518,8 @@ namespace SourceGen.AppForms {
|
||||
this.pseudoOpTabPage.ResumeLayout(false);
|
||||
this.pseudoOpTabPage.PerformLayout();
|
||||
this.quickPseudoSetGroup.ResumeLayout(false);
|
||||
this.codeViewMiscGroupBox.ResumeLayout(false);
|
||||
this.codeViewMiscGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -1617,5 +1644,7 @@ namespace SourceGen.AppForms {
|
||||
private System.Windows.Forms.ComboBox pseudoOpQuickComboBox;
|
||||
private System.Windows.Forms.Button displayFmtSetButton;
|
||||
private System.Windows.Forms.ComboBox displayFmtQuickComboBox;
|
||||
private System.Windows.Forms.GroupBox codeViewMiscGroupBox;
|
||||
private System.Windows.Forms.CheckBox spacesBetweenBytesCheckBox;
|
||||
}
|
||||
}
|
@ -209,6 +209,8 @@ namespace SourceGen.AppForms {
|
||||
clipboardFormatComboBox.SelectedIndex = clipIndex;
|
||||
}
|
||||
|
||||
spacesBetweenBytesCheckBox.Checked =
|
||||
mSettings.GetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, false);
|
||||
enableDebugCheckBox.Checked = mSettings.GetBool(AppSettings.DEBUG_MENU_ENABLED, false);
|
||||
|
||||
// Assemblers.
|
||||
@ -396,6 +398,12 @@ namespace SourceGen.AppForms {
|
||||
SetDirty(true);
|
||||
}
|
||||
|
||||
private void spacesBetweenBytesCheckBox_CheckedChanged(object sender, EventArgs e) {
|
||||
mSettings.SetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES,
|
||||
spacesBetweenBytesCheckBox.Checked);
|
||||
SetDirty(true);
|
||||
}
|
||||
|
||||
private void enableDebugCheckBox_CheckedChanged(object sender, EventArgs e) {
|
||||
mSettings.SetBool(AppSettings.DEBUG_MENU_ENABLED, enableDebugCheckBox.Checked);
|
||||
SetDirty(true);
|
||||
|
@ -1735,7 +1735,15 @@ namespace SourceGen.AppForms {
|
||||
StringBuilder sb = new StringBuilder(100);
|
||||
|
||||
int addrAdj = mProject.CpuDef.HasAddr16 ? 6 : 9;
|
||||
int disAdj = (format != Disassembly) ? 0 : addrAdj + 10;
|
||||
int disAdj = 0;
|
||||
int bytesWidth = 0;
|
||||
if (format == Disassembly) {
|
||||
// A limit of 8 gets us 4 bytes from dense display ("20edfd60") and 3 if spaces
|
||||
// are included ("20 ed fd") with no excess. We want to increase it to 11 so
|
||||
// we can always show 4 bytes.
|
||||
bytesWidth = (mFormatterConfig.mSpacesBetweenBytes ? 11 : 8);
|
||||
disAdj = addrAdj + bytesWidth + 2;
|
||||
}
|
||||
|
||||
// Walking through the selected indices can be slow for a large file, so we
|
||||
// run through the full list and pick out the selected items with our parallel
|
||||
@ -1758,10 +1766,10 @@ namespace SourceGen.AppForms {
|
||||
sb.Append(": ");
|
||||
}
|
||||
|
||||
// shorten the "..."
|
||||
// Shorten the "...".
|
||||
string bytesStr = parts.Bytes;
|
||||
if (bytesStr != null && bytesStr.Length > 8) {
|
||||
bytesStr = bytesStr.Substring(0, 8) + "+";
|
||||
if (bytesStr != null && bytesStr.Length > bytesWidth) {
|
||||
bytesStr = bytesStr.Substring(0, bytesWidth) + "+";
|
||||
}
|
||||
TextUtil.AppendPaddedString(sb, bytesStr, disAdj);
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ namespace SourceGen {
|
||||
public const string FMT_UPPER_OPERAND_S = "fmt-upper-operand-s";
|
||||
public const string FMT_UPPER_OPERAND_XY = "fmt-upper-operand-xy";
|
||||
public const string FMT_ADD_SPACE_FULL_COMMENT = "fmt-add-space-full-comment";
|
||||
public const string FMT_SPACES_BETWEEN_BYTES = "fmt-spaces-between-bytes";
|
||||
|
||||
public const string FMT_OPCODE_SUFFIX_ABS = "fmt-opcode-suffix-abs";
|
||||
public const string FMT_OPCODE_SUFFIX_LONG = "fmt-opcode-suffix-long";
|
||||
|
@ -310,6 +310,8 @@ namespace SourceGen.AsmGen {
|
||||
settings.GetBool(AppSettings.FMT_UPPER_OPERAND_S, false);
|
||||
config.mUpperOperandXY =
|
||||
settings.GetBool(AppSettings.FMT_UPPER_OPERAND_XY, false);
|
||||
config.mSpacesBetweenBytes =
|
||||
settings.GetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, false);
|
||||
config.mAddSpaceLongComment =
|
||||
settings.GetBool(AppSettings.FMT_ADD_SPACE_FULL_COMMENT, true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user