1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-08-08 13:25:26 +00:00

Various tweaks

Fixed a minor bug in GenerateLineList that would cause a blank line
to disappear under certain circumstances.  Harmless, but odd.

Added a width property to DefSymbol.

Updated comments.
This commit is contained in:
Andy McFadden
2019-08-24 17:35:26 -07:00
parent 2fa5fdc237
commit 5dcdbe3f3a
5 changed files with 31 additions and 10 deletions

View File

@@ -388,7 +388,7 @@ namespace SourceGen.AsmGen {
// IGenerator // IGenerator
public void OutputAsmConfig() { public void OutputAsmConfig() {
// nothing to do // nothing to do (though we could emit "xc off" for 6502)
} }
// IGenerator // IGenerator

View File

@@ -150,6 +150,8 @@ namespace SourceGen {
// Either way there's nothing further for us to do. (Technically we // Either way there's nothing further for us to do. (Technically we
// would want to treat it like the no-descriptor case if the type was // would want to treat it like the no-descriptor case if the type was
// numeric/Address, but we don't allow that for instructions.) // numeric/Address, but we don't allow that for instructions.)
//
// Project and platform symbols are applied later.
Debug.Assert(attr.DataDescriptor.FormatSubType != Debug.Assert(attr.DataDescriptor.FormatSubType !=
FormatDescriptor.SubType.Address); FormatDescriptor.SubType.Address);
continue; continue;

View File

@@ -14,13 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
namespace SourceGen { namespace SourceGen {
/// <summary> /// <summary>
/// Subclass of Symbol used for symbols defined in the platform or project. /// Subclass of Symbol used for symbols defined in the platform or project.
/// ///
/// Instances are immutable. /// Instances are immutable.
/// </summary> /// </summary>
public class DefSymbol : Symbol { public class DefSymbol : Symbol {
@@ -34,8 +33,18 @@ namespace SourceGen {
/// </summary> /// </summary>
public string Comment { get; private set; } public string Comment { get; private set; }
/// <summary>
/// Platform symbols only: tag used to organize symbols into groups. Used by
/// extension scripts.
/// </summary>
public string Tag { get; private set; } public string Tag { get; private set; }
/// <summary>
/// Number of bytes referenced by the symbol. Useful for identifying two-byte and
/// three-byte pointers. Used for Variables.
/// </summary>
public int Width { get; private set; }
/// <summary> /// <summary>
/// Cross-reference data, generated by the analyzer. /// Cross-reference data, generated by the analyzer.
/// </summary> /// </summary>

View File

@@ -713,6 +713,7 @@ namespace SourceGen {
// Create temporary list to hold new lines. Set the initial capacity to // Create temporary list to hold new lines. Set the initial capacity to
// the previous size, on the assumption that it won't change much. // the previous size, on the assumption that it won't change much.
List<Line> newLines = new List<Line>(endIndex - startIndex + 1); List<Line> newLines = new List<Line>(endIndex - startIndex + 1);
GenerateLineList(startOffset, endOffset, newLines); GenerateLineList(startOffset, endOffset, newLines);
// Out with the old, in with the new. // Out with the old, in with the new.
@@ -904,6 +905,7 @@ namespace SourceGen {
addBlank = true; addBlank = true;
} }
} }
int offset = startOffset; int offset = startOffset;
while (offset <= endOffset) { while (offset <= endOffset) {
Anattrib attr = mProject.GetAnattrib(offset); Anattrib attr = mProject.GetAnattrib(offset);
@@ -1034,10 +1036,10 @@ namespace SourceGen {
} }
} }
// See if there were any address shifts in this section. If so, insert an ORG // See if there were any address shifts in this section. If so, go back and
// statement as the first entry for the offset. We're expecting to have very // insert an ORG statement as the first entry for the offset. We're expecting to
// few AddressMap entries (usually just one), so it's more efficient to process // have very few AddressMap entries (usually just one), so it's more efficient to
// them here and walk through the sub-list than it is to ping the address map // process them here and walk through the sub-list than it is to ping the address map
// at every line. // at every line.
// //
// It should not be possible for an address map change to appear in the middle // It should not be possible for an address map change to appear in the middle
@@ -1067,8 +1069,17 @@ namespace SourceGen {
// isn't the ORG at the start of the file. (This may temporarily do // isn't the ORG at the start of the file. (This may temporarily do
// double-spacing if we do a partial update, because we won't be able to // double-spacing if we do a partial update, because we won't be able to
// "see" the previous line. Harmless.) // "see" the previous line. Harmless.)
if (ent.Offset != 0 && index > 0 && lines[index-1].LineType != Line.Type.Blank) { //
Line blankLine = new Line(topLine.FileOffset, 0, Line.Type.Blank); // Interesting case:
// .dd2 $1000
// <blank>
// .org $1234
// .dd2 $aabb ;comment
// We need to include "index == 0" or we'll lose the blank when the comment
// is edited.
if (ent.Offset != 0 &&
(index == 0 || (index > 0 && lines[index-1].LineType != Line.Type.Blank))){
Line blankLine = GenerateBlankLine(topLine.FileOffset);
lines.Insert(index, blankLine); lines.Insert(index, blankLine);
} }
} }

View File

@@ -127,7 +127,6 @@ namespace SourceGen.WpfGui {
valueNotesLabel.Foreground = valueValid ? mDefaultLabelColor : Brushes.Red; valueNotesLabel.Foreground = valueValid ? mDefaultLabelColor : Brushes.Red;
IsValid = labelValid && labelUnique && valueValid; IsValid = labelValid && labelUnique && valueValid;
Debug.WriteLine("VALID IS " + IsValid);
} }
private bool ParseValue(out int value, out int numBase) { private bool ParseValue(out int value, out int numBase) {