mirror of
https://github.com/fadden/6502bench.git
synced 2024-12-01 22:50:35 +00:00
Fix the "target assembler" comment
The code generator outputs an optional comment specifying which version of which assembler the code was generated for. This was handled inconsistently and, for the most part, incorrectly. We now report the correct version.
This commit is contained in:
parent
8c053c29f2
commit
a1130ddc2b
@ -99,6 +99,7 @@ namespace SourceGen.AsmGen {
|
|||||||
|
|
||||||
// Version we're coded against.
|
// Version we're coded against.
|
||||||
private static CommonUtil.Version V0_96_4 = new CommonUtil.Version(0, 96, 4);
|
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.
|
// Set if we're inside a "pseudopc" block, which will need to be closed.
|
||||||
private bool mInPseudoPcBlock;
|
private bool mInPseudoPcBlock;
|
||||||
@ -106,9 +107,6 @@ namespace SourceGen.AsmGen {
|
|||||||
// v0.97 started treating '\' in constants as an escape character.
|
// v0.97 started treating '\' in constants as an escape character.
|
||||||
private bool mBackslashEscapes = true;
|
private bool mBackslashEscapes = true;
|
||||||
|
|
||||||
// Interesting versions.
|
|
||||||
private static CommonUtil.Version V0_97 = new CommonUtil.Version(0, 97);
|
|
||||||
|
|
||||||
|
|
||||||
// Pseudo-op string constants.
|
// Pseudo-op string constants.
|
||||||
private static PseudoOp.PseudoOpNames sDataOpNames =
|
private static PseudoOp.PseudoOpNames sDataOpNames =
|
||||||
@ -155,13 +153,11 @@ namespace SourceGen.AsmGen {
|
|||||||
Debug.Assert(!string.IsNullOrEmpty(fileNameBase));
|
Debug.Assert(!string.IsNullOrEmpty(fileNameBase));
|
||||||
|
|
||||||
Project = project;
|
Project = project;
|
||||||
|
Quirks = new AssemblerQuirks();
|
||||||
if (asmVersion != null) {
|
if (asmVersion != null) {
|
||||||
// Use the actual version.
|
mAsmVersion = asmVersion.Version; // Use the actual version.
|
||||||
mAsmVersion = asmVersion.Version;
|
|
||||||
} else {
|
} else {
|
||||||
// No assembler installed. Use v0.97.
|
mAsmVersion = V0_97; // No assembler installed, use default.
|
||||||
mAsmVersion = V0_97;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACME isn't a single-pass assembler, but the code that determines label widths
|
// ACME isn't a single-pass assembler, but the code that determines label widths
|
||||||
@ -179,7 +175,6 @@ namespace SourceGen.AsmGen {
|
|||||||
// lda zero
|
// lda zero
|
||||||
// rts
|
// rts
|
||||||
// }
|
// }
|
||||||
Quirks = new AssemblerQuirks();
|
|
||||||
Quirks.SinglePassAssembler = true;
|
Quirks.SinglePassAssembler = true;
|
||||||
Quirks.SinglePassNoLabelCorrection = true;
|
Quirks.SinglePassNoLabelCorrection = true;
|
||||||
if (mAsmVersion < V0_97) {
|
if (mAsmVersion < V0_97) {
|
||||||
@ -256,7 +251,7 @@ namespace SourceGen.AsmGen {
|
|||||||
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
||||||
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
||||||
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
||||||
"acme", V0_96_4, AsmAcme.OPTIONS));
|
"acme", mAsmVersion, AsmAcme.OPTIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasNonZeroBankCode()) {
|
if (HasNonZeroBankCode()) {
|
||||||
|
@ -147,12 +147,9 @@ namespace SourceGen.AsmGen {
|
|||||||
Project = project;
|
Project = project;
|
||||||
Quirks = new AssemblerQuirks();
|
Quirks = new AssemblerQuirks();
|
||||||
if (asmVersion != null) {
|
if (asmVersion != null) {
|
||||||
// Use the actual version. If it's > 2.17 we'll try to take advantage of
|
mAsmVersion = asmVersion.Version; // Use the actual version.
|
||||||
// bug fixes.
|
|
||||||
mAsmVersion = asmVersion.Version;
|
|
||||||
} else {
|
} else {
|
||||||
// No assembler installed. Use 2.18.
|
mAsmVersion = V2_18; // No assembler installed, use default.
|
||||||
mAsmVersion = V2_18;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAsmVersion <= V2_17) {
|
if (mAsmVersion <= V2_17) {
|
||||||
@ -235,18 +232,9 @@ namespace SourceGen.AsmGen {
|
|||||||
mOutStream = sw;
|
mOutStream = sw;
|
||||||
|
|
||||||
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
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 +
|
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
||||||
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
||||||
"cc65", V2_18,
|
"cc65", mAsmVersion,
|
||||||
AsmCc65.OPTIONS + " -C " + Path.GetFileName(cfgName)));
|
AsmCc65.OPTIONS + " -C " + Path.GetFileName(cfgName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,9 @@ namespace SourceGen.AsmGen {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private CommonUtil.Version mAsmVersion = CommonUtil.Version.NO_VERSION;
|
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.
|
// Pseudo-op string constants.
|
||||||
private static PseudoOp.PseudoOpNames sDataOpNames =
|
private static PseudoOp.PseudoOpNames sDataOpNames =
|
||||||
@ -139,6 +142,12 @@ namespace SourceGen.AsmGen {
|
|||||||
|
|
||||||
Project = project;
|
Project = project;
|
||||||
Quirks = new AssemblerQuirks();
|
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.NoPcRelBankWrap = true;
|
||||||
Quirks.TracksSepRepNotEmu = true;
|
Quirks.TracksSepRepNotEmu = true;
|
||||||
|
|
||||||
@ -207,7 +216,7 @@ namespace SourceGen.AsmGen {
|
|||||||
// No version-specific stuff yet. We're generating code for v1.0.
|
// No version-specific stuff yet. We're generating code for v1.0.
|
||||||
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
||||||
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
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);
|
GenCommon.Generate(this, sw, worker);
|
||||||
|
@ -168,6 +168,12 @@ namespace SourceGen.AsmGen {
|
|||||||
|
|
||||||
Project = project;
|
Project = project;
|
||||||
Quirks = new AssemblerQuirks();
|
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.StackIntOperandIsImmediate = true;
|
||||||
Quirks.LeadingUnderscoreSpecial = true;
|
Quirks.LeadingUnderscoreSpecial = true;
|
||||||
Quirks.Need24BitsForAbsPBR = true;
|
Quirks.Need24BitsForAbsPBR = true;
|
||||||
@ -257,7 +263,7 @@ namespace SourceGen.AsmGen {
|
|||||||
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
|
||||||
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
OutputLine(SourceFormatter.FullLineCommentDelimiter +
|
||||||
string.Format(Res.Strings.GENERATED_FOR_VERSION_FMT,
|
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);
|
GenCommon.Generate(this, sw, worker);
|
||||||
|
Loading…
Reference in New Issue
Block a user