1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-05-31 22:41:37 +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:
Andy McFadden 2021-07-31 14:56:17 -07:00
parent 8c053c29f2
commit a1130ddc2b
4 changed files with 25 additions and 27 deletions

View File

@ -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()) {

View File

@ -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)));
}

View File

@ -91,6 +91,9 @@ namespace SourceGen.AsmGen {
/// </summary>
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);

View File

@ -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);