mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-29 10:50:28 +00:00
Tweak def symbol sort order
The list of EQUs at the top of the file is sorted, by type, then value, then name. This adds width as an additional check, so that if you have overlapping items the widest comes first. This is nice when you have a general entry for a block of data, and then specific entries for some locations within the block.
This commit is contained in:
parent
5548469ba1
commit
422af1193c
@ -1673,7 +1673,7 @@ namespace SourceGen {
|
||||
|
||||
// Sort order:
|
||||
// - constants appear before addresses
|
||||
// - ascending numeric value
|
||||
// - ascending numeric value, wider items first
|
||||
// - ascending label
|
||||
ActiveDefSymbolList.Sort(delegate (DefSymbol a, DefSymbol b) {
|
||||
// Put constants first.
|
||||
@ -1687,11 +1687,27 @@ namespace SourceGen {
|
||||
return -1;
|
||||
} else if (a.Value > b.Value) {
|
||||
return 1;
|
||||
} else if (IsWider(a, b)) {
|
||||
return -1;
|
||||
} else if (IsWider(b, a)) {
|
||||
return 1;
|
||||
}
|
||||
return Asm65.Label.LABEL_COMPARER.Compare(a.Label, b.Label);
|
||||
});
|
||||
}
|
||||
|
||||
private bool IsWider(DefSymbol a, DefSymbol b) {
|
||||
if (!a.HasWidth && !b.HasWidth) {
|
||||
return false;
|
||||
} else if (a.HasWidth && !b.HasWidth) {
|
||||
return true;
|
||||
} else if (!a.HasWidth && !b.HasWidth) {
|
||||
return true;
|
||||
} else {
|
||||
return a.DataDescriptor.Length > b.DataDescriptor.Length;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Analysis
|
||||
|
||||
|
||||
|
@ -15,8 +15,8 @@ ChkProj2 = $2204
|
||||
ProjSym2 = $220a
|
||||
Over1 = $3000 ;$3000-300f, inclusive
|
||||
Over2 = $3002 ;$3002-3009
|
||||
Over2a = $3006 ;$3006
|
||||
Over3 = $3006 ;$3006-300c
|
||||
Over2a = $3006 ;$3006
|
||||
SepOver1 = $3100 ;$3100-3103, inclusive
|
||||
SepOver2 = $3102 ;$3102-3105, inclusive
|
||||
ReadOnly = $5000 ;R
|
||||
|
@ -14,8 +14,8 @@ ChkProj2 equ $2204
|
||||
ProjSym2 equ $220a
|
||||
Over1 equ $3000 ;$3000-300f, inclusive
|
||||
Over2 equ $3002 ;$3002-3009
|
||||
Over2a equ $3006 ;$3006
|
||||
Over3 equ $3006 ;$3006-300c
|
||||
Over2a equ $3006 ;$3006
|
||||
SepOver1 equ $3100 ;$3100-3103, inclusive
|
||||
SepOver2 equ $3102 ;$3102-3105, inclusive
|
||||
ReadOnly equ $5000 ;R
|
||||
|
@ -15,8 +15,8 @@ ChkProj2 = $2204
|
||||
ProjSym2 = $220a
|
||||
Over1 = $3000 ;$3000-300f, inclusive
|
||||
Over2 = $3002 ;$3002-3009
|
||||
Over2a = $3006 ;$3006
|
||||
Over3 = $3006 ;$3006-300c
|
||||
Over2a = $3006 ;$3006
|
||||
SepOver1 = $3100 ;$3100-3103, inclusive
|
||||
SepOver2 = $3102 ;$3102-3105, inclusive
|
||||
ReadOnly = $5000 ;R
|
||||
|
@ -15,8 +15,8 @@ ChkProj2 = $2204
|
||||
ProjSym2 = $220a
|
||||
Over1 = $3000 ;$3000-300f, inclusive
|
||||
Over2 = $3002 ;$3002-3009
|
||||
Over2a = $3006 ;$3006
|
||||
Over3 = $3006 ;$3006-300c
|
||||
Over2a = $3006 ;$3006
|
||||
SepOver1 = $3100 ;$3100-3103, inclusive
|
||||
SepOver2 = $3102 ;$3102-3105, inclusive
|
||||
ReadOnly = $5000 ;R
|
||||
|
Loading…
Reference in New Issue
Block a user