1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-12 21:09:29 +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
public void OutputAsmConfig() {
// nothing to do
// nothing to do (though we could emit "xc off" for 6502)
}
// IGenerator

View File

@ -150,6 +150,8 @@ namespace SourceGen {
// 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
// numeric/Address, but we don't allow that for instructions.)
//
// Project and platform symbols are applied later.
Debug.Assert(attr.DataDescriptor.FormatSubType !=
FormatDescriptor.SubType.Address);
continue;

View File

@ -14,13 +14,12 @@
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SourceGen {
/// <summary>
/// Subclass of Symbol used for symbols defined in the platform or project.
///
///
/// Instances are immutable.
/// </summary>
public class DefSymbol : Symbol {
@ -34,8 +33,18 @@ namespace SourceGen {
/// </summary>
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; }
/// <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>
/// Cross-reference data, generated by the analyzer.
/// </summary>

View File

@ -713,6 +713,7 @@ namespace SourceGen {
// Create temporary list to hold new lines. Set the initial capacity to
// the previous size, on the assumption that it won't change much.
List<Line> newLines = new List<Line>(endIndex - startIndex + 1);
GenerateLineList(startOffset, endOffset, newLines);
// Out with the old, in with the new.
@ -904,6 +905,7 @@ namespace SourceGen {
addBlank = true;
}
}
int offset = startOffset;
while (offset <= endOffset) {
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
// statement as the first entry for the offset. We're expecting to have very
// few AddressMap entries (usually just one), so it's more efficient to process
// them here and walk through the sub-list than it is to ping the address map
// See if there were any address shifts in this section. If so, go back and
// insert an ORG statement as the first entry for the offset. We're expecting to
// have very few AddressMap entries (usually just one), so it's more efficient to
// process them here and walk through the sub-list than it is to ping the address map
// at every line.
//
// 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
// double-spacing if we do a partial update, because we won't be able to
// "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);
}
}

View File

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