mirror of
https://github.com/fadden/6502bench.git
synced 2025-04-03 18:30:45 +00:00
Generalize expression style setting
Before you could choose between Merlin-style and generic. Now there's a combo box that lets you choose Merlin, cc65, or "common", the latter being used for 64tass.
This commit is contained in:
parent
da91f86043
commit
2cb6b55802
82
SourceGen/AppForms/EditAppSettings.Designer.cs
generated
82
SourceGen/AppForms/EditAppSettings.Designer.cs
generated
@ -43,6 +43,8 @@ namespace SourceGen.AppForms {
|
||||
this.applyButton = new System.Windows.Forms.Button();
|
||||
this.settingsTabControl = new System.Windows.Forms.TabControl();
|
||||
this.codeViewTabPage = new System.Windows.Forms.TabPage();
|
||||
this.codeViewMiscGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.spacesBetweenBytesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.clipboardGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.clipboardFormatLabel = new System.Windows.Forms.Label();
|
||||
this.clipboardFormatComboBox = new System.Windows.Forms.ComboBox();
|
||||
@ -94,7 +96,6 @@ namespace SourceGen.AppForms {
|
||||
this.displayFmtQuickComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.displayFmtSetButton = new System.Windows.Forms.Button();
|
||||
this.quickFmtDefaultButton = new System.Windows.Forms.Button();
|
||||
this.useMerlinExpressions = new System.Windows.Forms.CheckBox();
|
||||
this.operandWidthGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.disambPrefix24TextBox = new System.Windows.Forms.TextBox();
|
||||
this.disambPrefix16TextBox = new System.Windows.Forms.TextBox();
|
||||
@ -156,10 +157,11 @@ 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.expressionStyleLabel = new System.Windows.Forms.Label();
|
||||
this.expressionStyleComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.settingsTabControl.SuspendLayout();
|
||||
this.codeViewTabPage.SuspendLayout();
|
||||
this.codeViewMiscGroupBox.SuspendLayout();
|
||||
this.clipboardGroupBox.SuspendLayout();
|
||||
this.upperCaseGroupBox.SuspendLayout();
|
||||
this.codeViewFontGroupBox.SuspendLayout();
|
||||
@ -171,7 +173,6 @@ namespace SourceGen.AppForms {
|
||||
this.operandWidthGroupBox.SuspendLayout();
|
||||
this.pseudoOpTabPage.SuspendLayout();
|
||||
this.quickPseudoSetGroup.SuspendLayout();
|
||||
this.codeViewMiscGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cancelButton
|
||||
@ -239,6 +240,27 @@ namespace SourceGen.AppForms {
|
||||
this.codeViewTabPage.Text = "Code View";
|
||||
this.codeViewTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// clipboardGroupBox
|
||||
//
|
||||
this.clipboardGroupBox.Controls.Add(this.clipboardFormatLabel);
|
||||
@ -717,9 +739,10 @@ namespace SourceGen.AppForms {
|
||||
//
|
||||
// displayFormatTabPage
|
||||
//
|
||||
this.displayFormatTabPage.Controls.Add(this.expressionStyleComboBox);
|
||||
this.displayFormatTabPage.Controls.Add(this.expressionStyleLabel);
|
||||
this.displayFormatTabPage.Controls.Add(this.fmtExplanationLabel);
|
||||
this.displayFormatTabPage.Controls.Add(this.quickDisplayFormatGroup);
|
||||
this.displayFormatTabPage.Controls.Add(this.useMerlinExpressions);
|
||||
this.displayFormatTabPage.Controls.Add(this.operandWidthGroupBox);
|
||||
this.displayFormatTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.displayFormatTabPage.Name = "displayFormatTabPage";
|
||||
@ -781,17 +804,6 @@ namespace SourceGen.AppForms {
|
||||
this.quickFmtDefaultButton.UseVisualStyleBackColor = true;
|
||||
this.quickFmtDefaultButton.Click += new System.EventHandler(this.quickFmtDefaultButton_Click);
|
||||
//
|
||||
// useMerlinExpressions
|
||||
//
|
||||
this.useMerlinExpressions.AutoSize = true;
|
||||
this.useMerlinExpressions.Location = new System.Drawing.Point(6, 153);
|
||||
this.useMerlinExpressions.Name = "useMerlinExpressions";
|
||||
this.useMerlinExpressions.Size = new System.Drawing.Size(158, 17);
|
||||
this.useMerlinExpressions.TabIndex = 2;
|
||||
this.useMerlinExpressions.Text = "Use Merlin-style expressions";
|
||||
this.useMerlinExpressions.UseVisualStyleBackColor = true;
|
||||
this.useMerlinExpressions.CheckedChanged += new System.EventHandler(this.shiftAfterAdjustCheckBox_CheckedChanged);
|
||||
//
|
||||
// operandWidthGroupBox
|
||||
//
|
||||
this.operandWidthGroupBox.Controls.Add(this.disambPrefix24TextBox);
|
||||
@ -1456,26 +1468,23 @@ namespace SourceGen.AppForms {
|
||||
this.equDirectiveLabel.Text = "Equate:";
|
||||
this.equDirectiveLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// codeViewMiscGroupBox
|
||||
// expressionStyleLabel
|
||||
//
|
||||
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";
|
||||
this.expressionStyleLabel.AutoSize = true;
|
||||
this.expressionStyleLabel.Location = new System.Drawing.Point(7, 156);
|
||||
this.expressionStyleLabel.Name = "expressionStyleLabel";
|
||||
this.expressionStyleLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.expressionStyleLabel.TabIndex = 4;
|
||||
this.expressionStyleLabel.Text = "Expression style:";
|
||||
//
|
||||
// spacesBetweenBytesCheckBox
|
||||
// expressionStyleComboBox
|
||||
//
|
||||
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);
|
||||
this.expressionStyleComboBox.FormattingEnabled = true;
|
||||
this.expressionStyleComboBox.Location = new System.Drawing.Point(98, 153);
|
||||
this.expressionStyleComboBox.Name = "expressionStyleComboBox";
|
||||
this.expressionStyleComboBox.Size = new System.Drawing.Size(121, 21);
|
||||
this.expressionStyleComboBox.TabIndex = 5;
|
||||
this.expressionStyleComboBox.SelectedIndexChanged += new System.EventHandler(this.expressionStyleComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// EditAppSettings
|
||||
//
|
||||
@ -1499,6 +1508,8 @@ namespace SourceGen.AppForms {
|
||||
this.settingsTabControl.ResumeLayout(false);
|
||||
this.codeViewTabPage.ResumeLayout(false);
|
||||
this.codeViewTabPage.PerformLayout();
|
||||
this.codeViewMiscGroupBox.ResumeLayout(false);
|
||||
this.codeViewMiscGroupBox.PerformLayout();
|
||||
this.clipboardGroupBox.ResumeLayout(false);
|
||||
this.clipboardGroupBox.PerformLayout();
|
||||
this.upperCaseGroupBox.ResumeLayout(false);
|
||||
@ -1518,8 +1529,6 @@ namespace SourceGen.AppForms {
|
||||
this.pseudoOpTabPage.ResumeLayout(false);
|
||||
this.pseudoOpTabPage.PerformLayout();
|
||||
this.quickPseudoSetGroup.ResumeLayout(false);
|
||||
this.codeViewMiscGroupBox.ResumeLayout(false);
|
||||
this.codeViewMiscGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -1609,7 +1618,6 @@ namespace SourceGen.AppForms {
|
||||
private System.Windows.Forms.CheckBox enableDebugCheckBox;
|
||||
private System.Windows.Forms.CheckBox showAsmIdentCheckBox;
|
||||
private System.Windows.Forms.TabPage displayFormatTabPage;
|
||||
private System.Windows.Forms.CheckBox useMerlinExpressions;
|
||||
private System.Windows.Forms.GroupBox operandWidthGroupBox;
|
||||
private System.Windows.Forms.TextBox disambPrefix24TextBox;
|
||||
private System.Windows.Forms.TextBox disambPrefix16TextBox;
|
||||
@ -1646,5 +1654,7 @@ namespace SourceGen.AppForms {
|
||||
private System.Windows.Forms.ComboBox displayFmtQuickComboBox;
|
||||
private System.Windows.Forms.GroupBox codeViewMiscGroupBox;
|
||||
private System.Windows.Forms.CheckBox spacesBetweenBytesCheckBox;
|
||||
private System.Windows.Forms.ComboBox expressionStyleComboBox;
|
||||
private System.Windows.Forms.Label expressionStyleLabel;
|
||||
}
|
||||
}
|
@ -18,11 +18,11 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using AssemblerInfo = SourceGen.AsmGen.AssemblerInfo;
|
||||
using AssemblerConfig = SourceGen.AsmGen.AssemblerConfig;
|
||||
using ExpressionMode = Asm65.Formatter.FormatConfig.ExpressionMode;
|
||||
|
||||
namespace SourceGen.AppForms {
|
||||
public partial class EditAppSettings : Form {
|
||||
@ -91,7 +91,7 @@ namespace SourceGen.AppForms {
|
||||
// Enumerated ID.
|
||||
public AssemblerInfo.Id AssemblerId { get; private set; }
|
||||
|
||||
// Human-readable name.
|
||||
// Human-readable name for display.
|
||||
public string Name { get; private set; }
|
||||
|
||||
public AsmComboItem(AssemblerInfo info) {
|
||||
@ -100,6 +100,27 @@ namespace SourceGen.AppForms {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Holds an item for the expression style selection combo box.
|
||||
/// </summary>
|
||||
private struct ExpressionStyleItem {
|
||||
// Enumerated mode.
|
||||
public ExpressionMode ExpMode { get; private set; }
|
||||
|
||||
// Human-readable name for display.
|
||||
public string Name { get; private set; }
|
||||
|
||||
public ExpressionStyleItem(ExpressionMode expMode, string name) {
|
||||
ExpMode = expMode;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
private static ExpressionStyleItem[] sExpStyleItems = new ExpressionStyleItem[] {
|
||||
new ExpressionStyleItem(ExpressionMode.Common, "Common"),
|
||||
new ExpressionStyleItem(ExpressionMode.Cc65, "cc65"),
|
||||
new ExpressionStyleItem(ExpressionMode.Merlin, "Merlin"),
|
||||
};
|
||||
|
||||
|
||||
public EditAppSettings(ProjectView projectView, Tab initialTab,
|
||||
AssemblerInfo.Id initialAsmId) {
|
||||
@ -154,6 +175,11 @@ namespace SourceGen.AppForms {
|
||||
ConfigureComboBox(asmConfigComboBox);
|
||||
ConfigureComboBox(displayFmtQuickComboBox);
|
||||
ConfigureComboBox(pseudoOpQuickComboBox);
|
||||
|
||||
expressionStyleComboBox.DisplayMember = "Name";
|
||||
foreach (ExpressionStyleItem esi in sExpStyleItems) {
|
||||
expressionStyleComboBox.Items.Add(esi);
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigureComboBox(ComboBox cb) {
|
||||
@ -238,9 +264,11 @@ namespace SourceGen.AppForms {
|
||||
PopulateWidthDisamSettings();
|
||||
|
||||
string exprMode = mSettings.GetString(AppSettings.FMT_EXPRESSION_MODE, string.Empty);
|
||||
useMerlinExpressions.Checked =
|
||||
(Asm65.Formatter.FormatConfig.ParseExpressionMode(exprMode) ==
|
||||
Asm65.Formatter.FormatConfig.ExpressionMode.Merlin);
|
||||
ExpressionMode mode;
|
||||
if (!Enum.TryParse<ExpressionMode>(exprMode, out mode)) {
|
||||
mode = ExpressionMode.Common;
|
||||
}
|
||||
SetExpressionStyle(mode);
|
||||
|
||||
if (mInitialTab != Tab.Unknown) {
|
||||
settingsTabControl.SelectTab((int)mInitialTab);
|
||||
@ -608,11 +636,20 @@ namespace SourceGen.AppForms {
|
||||
// mSettings.GetString(AppSettings.FMT_OPERAND_PREFIX_LONG, string.Empty) + "'");
|
||||
}
|
||||
|
||||
private void shiftAfterAdjustCheckBox_CheckedChanged(object sender, EventArgs e) {
|
||||
string mode = useMerlinExpressions.Checked ?
|
||||
Asm65.Formatter.FormatConfig.ExpressionMode.Merlin.ToString() :
|
||||
Asm65.Formatter.FormatConfig.ExpressionMode.Cc65.ToString();
|
||||
mSettings.SetString(AppSettings.FMT_EXPRESSION_MODE, mode);
|
||||
private void SetExpressionStyle(ExpressionMode mode) {
|
||||
foreach (ExpressionStyleItem esi in expressionStyleComboBox.Items) {
|
||||
if (esi.ExpMode == mode) {
|
||||
expressionStyleComboBox.SelectedItem = esi;
|
||||
return;
|
||||
}
|
||||
}
|
||||
Debug.Assert(false, "Expression mode " + mode + " not found");
|
||||
expressionStyleComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void expressionStyleComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
||||
ExpressionStyleItem esi = (ExpressionStyleItem)expressionStyleComboBox.SelectedItem;
|
||||
mSettings.SetString(AppSettings.FMT_EXPRESSION_MODE, esi.ExpMode.ToString());
|
||||
SetDirty(true);
|
||||
}
|
||||
|
||||
@ -629,15 +666,13 @@ namespace SourceGen.AppForms {
|
||||
formatConfig.mForceLongOpcodeSuffix,
|
||||
formatConfig.mForceAbsOperandPrefix,
|
||||
formatConfig.mForceLongOperandPrefix);
|
||||
useMerlinExpressions.Checked = (formatConfig.mExpressionMode ==
|
||||
Asm65.Formatter.FormatConfig.ExpressionMode.Merlin);
|
||||
|
||||
SetExpressionStyle(formatConfig.mExpressionMode);
|
||||
// dirty flag set by change watchers if one or more fields have changed
|
||||
}
|
||||
|
||||
private void quickFmtDefaultButton_Click(object sender, EventArgs e) {
|
||||
SetWidthDisamSettings(null, "l", "a:", "f:");
|
||||
useMerlinExpressions.Checked = false;
|
||||
SetExpressionStyle(ExpressionMode.Common);
|
||||
// dirty flag set by change watchers if one or more fields have changed
|
||||
}
|
||||
|
||||
|
@ -121,10 +121,10 @@ do not affect generated code.</p>
|
||||
strings are used when the width of an instruction operand is unclear.
|
||||
You may specify values for all of them or none of them.</p>
|
||||
|
||||
<p>The Merlin assembler uses an expression syntax that is compact but
|
||||
different from many other cross-assemblers. Notably, the byte-selection
|
||||
operators ('<', '>', '^') act like shift operators, yielding
|
||||
16-bit values when wide registers are enabled on the 65816.</p>
|
||||
<p>Different assemblers have different ways of forming expressions.
|
||||
Sometimes the rules allow expressions to be written simply, other times
|
||||
explicit grouping with parenthesis is required. Select whichever style
|
||||
you are most comfortable with.</p>
|
||||
|
||||
<p>The "quick set" buttons configure the fields on this tab to match
|
||||
the conventions of the specified assembler. Select your preferred assembler
|
||||
|
Loading…
x
Reference in New Issue
Block a user