diff --git a/SourceGen/AsmGen/AsmAcme.cs b/SourceGen/AsmGen/AsmAcme.cs index 6b35050..24f85bb 100644 --- a/SourceGen/AsmGen/AsmAcme.cs +++ b/SourceGen/AsmGen/AsmAcme.cs @@ -106,6 +106,7 @@ namespace SourceGen.AsmGen { private static PseudoOp.PseudoOpNames sDataOpNames = new PseudoOp.PseudoOpNames(new Dictionary { { "EquDirective", "=" }, + //VarDirective { "OrgDirective", "!pseudopc" }, //RegWidthDirective // !al, !as, !rl, !rs { "DefineData1", "!byte" }, @@ -470,6 +471,11 @@ namespace SourceGen.AsmGen { valueStr, SourceFormatter.FormatEolComment(comment)); } + // IGenerator + public void OutputVarDirective(string name, string valueStr, string comment) { + OutputEquDirective(name, valueStr, comment); + } + // IGenerator public void OutputOrgDirective(int offset, int address) { // For the first one, set the "real" PC. For all subsequent directives, set the diff --git a/SourceGen/AsmGen/AsmCc65.cs b/SourceGen/AsmGen/AsmCc65.cs index 0220f7f..43bb542 100644 --- a/SourceGen/AsmGen/AsmCc65.cs +++ b/SourceGen/AsmGen/AsmCc65.cs @@ -103,6 +103,7 @@ namespace SourceGen.AsmGen { private static PseudoOp.PseudoOpNames sDataOpNames = new PseudoOp.PseudoOpNames(new Dictionary { { "EquDirective", "=" }, + //VarDirective { "OrgDirective", ".org" }, //RegWidthDirective // .a8, .a16, .i8, .i16 { "DefineData1", ".byte" }, @@ -504,6 +505,11 @@ namespace SourceGen.AsmGen { valueStr, SourceFormatter.FormatEolComment(comment)); } + // IGenerator + public void OutputVarDirective(string name, string valueStr, string comment) { + OutputEquDirective(name, valueStr, comment); + } + // IGenerator public void OutputOrgDirective(int offset, int address) { // Linear search for offset. List should be small, so this should be quick. diff --git a/SourceGen/AsmGen/AsmMerlin32.cs b/SourceGen/AsmGen/AsmMerlin32.cs index 3697bab..1e36550 100644 --- a/SourceGen/AsmGen/AsmMerlin32.cs +++ b/SourceGen/AsmGen/AsmMerlin32.cs @@ -94,6 +94,7 @@ namespace SourceGen.AsmGen { private static PseudoOp.PseudoOpNames sDataOpNames = new PseudoOp.PseudoOpNames(new Dictionary { { "EquDirective", "equ" }, + { "VarDirective", "~=" }, // not really { "OrgDirective", "org" }, //RegWidthDirective { "DefineData1", "dfb" }, @@ -397,6 +398,12 @@ namespace SourceGen.AsmGen { valueStr, SourceFormatter.FormatEolComment(comment)); } + // IGenerator + public void OutputVarDirective(string name, string valueStr, string comment) { + OutputLine("]" + name, SourceFormatter.FormatPseudoOp(sDataOpNames.EquDirective), + valueStr, SourceFormatter.FormatEolComment(comment)); + } + // IGenerator public void OutputOrgDirective(int offset, int address) { OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(sDataOpNames.OrgDirective), diff --git a/SourceGen/AsmGen/AsmTass64.cs b/SourceGen/AsmGen/AsmTass64.cs index b20c3ef..a784926 100644 --- a/SourceGen/AsmGen/AsmTass64.cs +++ b/SourceGen/AsmGen/AsmTass64.cs @@ -120,6 +120,7 @@ namespace SourceGen.AsmGen { private static PseudoOp.PseudoOpNames sDataOpNames = new PseudoOp.PseudoOpNames(new Dictionary { { "EquDirective", "=" }, + { "VarDirective", ".var" }, { "OrgDirective", ".logical" }, //RegWidthDirective // .as, .al, .xs, .xl { "DefineData1", ".byte" }, @@ -535,6 +536,12 @@ namespace SourceGen.AsmGen { valueStr, SourceFormatter.FormatEolComment(comment)); } + // IGenerator + public void OutputVarDirective(string name, string valueStr, string comment) { + OutputLine(name, SourceFormatter.FormatPseudoOp(sDataOpNames.VarDirective), + valueStr, SourceFormatter.FormatEolComment(comment)); + } + // IGenerator public void OutputOrgDirective(int offset, int address) { // 64tass separates the "compile offset", which determines where the output fits diff --git a/SourceGen/AsmGen/IGenerator.cs b/SourceGen/AsmGen/IGenerator.cs index 5e51952..d366523 100644 --- a/SourceGen/AsmGen/IGenerator.cs +++ b/SourceGen/AsmGen/IGenerator.cs @@ -136,6 +136,14 @@ namespace SourceGen.AsmGen { /// End-of-line comment. void OutputEquDirective(string name, string valueStr, string comment); + /// + /// Outputs a variable definition directive. The numeric value is already formatted. + /// + /// Symbol label. + /// Formatted value. + /// End-of-line comment. + void OutputVarDirective(string name, string valueStr, string comment); + /// /// Outputs a code origin directive. /// diff --git a/SourceGen/LineListGen.cs b/SourceGen/LineListGen.cs index c0655b3..2dfc6fa 100644 --- a/SourceGen/LineListGen.cs +++ b/SourceGen/LineListGen.cs @@ -1331,7 +1331,7 @@ namespace SourceGen { PseudoOp.FormatNumericOpFlags.None); string comment = mFormatter.FormatEolComment(defSym.Comment); return FormattedParts.CreateEquDirective(defSym.Label, - mFormatter.FormatPseudoOp(mPseudoOpNames.EquDirective), + mFormatter.FormatPseudoOp(mPseudoOpNames.VarDirective), addrStr, comment); } } diff --git a/SourceGen/PseudoOp.cs b/SourceGen/PseudoOp.cs index 4d5756c..4ad47fa 100644 --- a/SourceGen/PseudoOp.cs +++ b/SourceGen/PseudoOp.cs @@ -65,6 +65,7 @@ namespace SourceGen { /// public class PseudoOpNames { public string EquDirective { get; private set; } + public string VarDirective { get; private set; } public string OrgDirective { get; private set; } public string RegWidthDirective { get; private set; } @@ -85,10 +86,9 @@ namespace SourceGen { public string StrDci { get; private set; } /// - /// Constructs an empty PseudoOp. + /// Constructs an empty PseudoOp, for deserialization. /// - public PseudoOpNames() : this(new Dictionary()) { - } + public PseudoOpNames() : this(new Dictionary()) { } /// /// Constructor. Pass in a dictionary with name/value pairs. Unknown names @@ -113,6 +113,7 @@ namespace SourceGen { return false; // one is null } return a.EquDirective == b.EquDirective && + a.VarDirective == b.VarDirective && a.OrgDirective == b.OrgDirective && a.RegWidthDirective == b.RegWidthDirective && a.DefineData1 == b.DefineData1 && @@ -217,12 +218,10 @@ namespace SourceGen { /// /// Returns a PseudoOpNames instance with some reasonable defaults for on-screen display. /// - public static PseudoOpNames DefaultPseudoOpNames { - get { return sDefaultPseudoOpNames; } - } - private static readonly PseudoOpNames sDefaultPseudoOpNames = + public static PseudoOpNames DefaultPseudoOpNames { get; } = new PseudoOpNames(new Dictionary { { "EquDirective", ".eq" }, + { "VarDirective", ".var" }, { "OrgDirective", ".org" }, { "RegWidthDirective", ".rwid" }, diff --git a/SourceGen/WpfGui/EditAppSettings.xaml b/SourceGen/WpfGui/EditAppSettings.xaml index 774ac34..f313d27 100644 --- a/SourceGen/WpfGui/EditAppSettings.xaml +++ b/SourceGen/WpfGui/EditAppSettings.xaml @@ -592,13 +592,10 @@ limitations under the License. - - - @@ -611,114 +608,118 @@ limitations under the License. - + - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - + + + + + - + - + + + - - + + + + + + - - + + - + + - + - + + + + + + + + + diff --git a/SourceGen/WpfGui/EditAppSettings.xaml.cs b/SourceGen/WpfGui/EditAppSettings.xaml.cs index b1ca3db..090bf72 100644 --- a/SourceGen/WpfGui/EditAppSettings.xaml.cs +++ b/SourceGen/WpfGui/EditAppSettings.xaml.cs @@ -139,6 +139,7 @@ namespace SourceGen.WpfGui { // Map text boxes to PseudoOpName fields. mPseudoNameMap = new TextBoxPropertyMap[] { new TextBoxPropertyMap(equDirectiveTextBox, "EquDirective"), + new TextBoxPropertyMap(varDirectiveTextBox, "VarDirective"), new TextBoxPropertyMap(orgDirectiveTextBox, "OrgDirective"), new TextBoxPropertyMap(regWidthDirectiveTextBox, "RegWidthDirective"), new TextBoxPropertyMap(defineData1TextBox, "DefineData1"),