diff --git a/SourceGen/AsmGen/AsmAcme.cs b/SourceGen/AsmGen/AsmAcme.cs index 945fad1..879c9b5 100644 --- a/SourceGen/AsmGen/AsmAcme.cs +++ b/SourceGen/AsmGen/AsmAcme.cs @@ -99,6 +99,7 @@ namespace SourceGen.AsmGen { // Version we're coded against. private static CommonUtil.Version V0_96_4 = new CommonUtil.Version(0, 96, 4); + private static CommonUtil.Version V0_97 = new CommonUtil.Version(0, 97); // Set if we're inside a "pseudopc" block, which will need to be closed. private bool mInPseudoPcBlock; @@ -106,9 +107,6 @@ namespace SourceGen.AsmGen { // v0.97 started treating '\' in constants as an escape character. private bool mBackslashEscapes = true; - // Interesting versions. - private static CommonUtil.Version V0_97 = new CommonUtil.Version(0, 97); - // Pseudo-op string constants. private static PseudoOp.PseudoOpNames sDataOpNames = @@ -155,13 +153,11 @@ namespace SourceGen.AsmGen { Debug.Assert(!string.IsNullOrEmpty(fileNameBase)); Project = project; - + Quirks = new AssemblerQuirks(); if (asmVersion != null) { - // Use the actual version. - mAsmVersion = asmVersion.Version; + mAsmVersion = asmVersion.Version; // Use the actual version. } else { - // No assembler installed. Use v0.97. - mAsmVersion = V0_97; + mAsmVersion = V0_97; // No assembler installed, use default. } // ACME isn't a single-pass assembler, but the code that determines label widths @@ -179,7 +175,6 @@ namespace SourceGen.AsmGen { // lda zero // rts // } - Quirks = new AssemblerQuirks(); Quirks.SinglePassAssembler = true; Quirks.SinglePassNoLabelCorrection = true; if (mAsmVersion < V0_97) { @@ -256,7 +251,7 @@ namespace SourceGen.AsmGen { if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) { OutputLine(SourceFormatter.FullLineCommentDelimiter + string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT, - "acme", V0_96_4, AsmAcme.OPTIONS)); + "acme", mAsmVersion, AsmAcme.OPTIONS)); } if (HasNonZeroBankCode()) { diff --git a/SourceGen/AsmGen/AsmCc65.cs b/SourceGen/AsmGen/AsmCc65.cs index 46c905c..21d842b 100644 --- a/SourceGen/AsmGen/AsmCc65.cs +++ b/SourceGen/AsmGen/AsmCc65.cs @@ -147,12 +147,9 @@ namespace SourceGen.AsmGen { Project = project; Quirks = new AssemblerQuirks(); if (asmVersion != null) { - // Use the actual version. If it's > 2.17 we'll try to take advantage of - // bug fixes. - mAsmVersion = asmVersion.Version; + mAsmVersion = asmVersion.Version; // Use the actual version. } else { - // No assembler installed. Use 2.18. - mAsmVersion = V2_18; + mAsmVersion = V2_18; // No assembler installed, use default. } if (mAsmVersion <= V2_17) { @@ -235,18 +232,9 @@ namespace SourceGen.AsmGen { mOutStream = sw; if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) { - //if (mAsmVersion.IsValid && mAsmVersion <= V2_17) { - // OutputLine(SourceFormatter.FullLineCommentDelimiter + - // string.Format(Properties.Resources.GENERATED_FOR_VERSION, - // "cc65", mAsmVersion.ToString())); - //} else { - // OutputLine(SourceFormatter.FullLineCommentDelimiter + - // string.Format(Properties.Resources.GENERATED_FOR_LATEST, "cc65")); - //} - OutputLine(SourceFormatter.FullLineCommentDelimiter + string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT, - "cc65", V2_18, + "cc65", mAsmVersion, AsmCc65.OPTIONS + " -C " + Path.GetFileName(cfgName))); } diff --git a/SourceGen/AsmGen/AsmMerlin32.cs b/SourceGen/AsmGen/AsmMerlin32.cs index 967b540..70393a2 100644 --- a/SourceGen/AsmGen/AsmMerlin32.cs +++ b/SourceGen/AsmGen/AsmMerlin32.cs @@ -91,6 +91,9 @@ namespace SourceGen.AsmGen { /// private CommonUtil.Version mAsmVersion = CommonUtil.Version.NO_VERSION; + // Interesting versions. + private static CommonUtil.Version V1_0 = new CommonUtil.Version(1, 0); + // Pseudo-op string constants. private static PseudoOp.PseudoOpNames sDataOpNames = @@ -139,6 +142,12 @@ namespace SourceGen.AsmGen { Project = project; Quirks = new AssemblerQuirks(); + if (asmVersion != null) { + mAsmVersion = asmVersion.Version; // Use the actual version. + } else { + mAsmVersion = V1_0; // No assembler installed, use default. + } + Quirks.NoPcRelBankWrap = true; Quirks.TracksSepRepNotEmu = true; @@ -207,7 +216,7 @@ namespace SourceGen.AsmGen { // No version-specific stuff yet. We're generating code for v1.0. OutputLine(SourceFormatter.FullLineCommentDelimiter + string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT, - "Merlin 32", new CommonUtil.Version(1, 0), string.Empty)); + "Merlin 32", mAsmVersion, string.Empty)); } GenCommon.Generate(this, sw, worker); diff --git a/SourceGen/AsmGen/AsmTass64.cs b/SourceGen/AsmGen/AsmTass64.cs index 2c7ffc3..e653086 100644 --- a/SourceGen/AsmGen/AsmTass64.cs +++ b/SourceGen/AsmGen/AsmTass64.cs @@ -168,6 +168,12 @@ namespace SourceGen.AsmGen { Project = project; Quirks = new AssemblerQuirks(); + if (asmVersion != null) { + mAsmVersion = asmVersion.Version; // Use the actual version. + } else { + mAsmVersion = V1_53; // No assembler installed, use default. + } + Quirks.StackIntOperandIsImmediate = true; Quirks.LeadingUnderscoreSpecial = true; Quirks.Need24BitsForAbsPBR = true; @@ -257,7 +263,7 @@ namespace SourceGen.AsmGen { if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) { OutputLine(SourceFormatter.FullLineCommentDelimiter + string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT, - "64tass", V1_53, AsmTass64.BASE_OPTIONS + extraOptions)); + "64tass", mAsmVersion, AsmTass64.BASE_OPTIONS + extraOptions)); } GenCommon.Generate(this, sw, worker);