1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-06 16:29:03 +00:00

Another update to project/platform cross-references

Don't show adjustments for operands that aren't full addresses.  For
example, "LDA BLAH" shows an adjustment, but "LDA #>BLAH" does not.
This matches the behavior for internal addresses.
This commit is contained in:
Andy McFadden 2020-03-23 15:16:30 -07:00
parent 76784848d0
commit 1e56490b6b

View File

@ -1542,13 +1542,19 @@ namespace SourceGen {
DefSymbol defSym = sym as DefSymbol; DefSymbol defSym = sym as DefSymbol;
int adj = 0; int adj = 0;
Debug.Assert(operandOffset < 0); // outside file scope Debug.Assert(operandOffset < 0); // outside file scope
if (sym.SymbolType != Symbol.Type.Constant) { if (sym.SymbolType != Symbol.Type.Constant &&
attr.OperandAddress >= 0) {
// It's an address operand, so we can compute the offset.
adj = defSym.Value - attr.OperandAddress; adj = defSym.Value - attr.OperandAddress;
} else { } else {
// We could compute the operand's value and display // We could compute the operand's value and display
// the difference, so "LDA #$00" --> "LDA #FOO" when // the difference, so "LDA #$00" --> "LDA #FOO-1" when
// FOO is 1 would display "FOO -1" in the xref table. // FOO is 1 would display "FOO -1" in the xref table.
// Not sure if that's useful. // Not sure if that's useful.
//
// We would need to shift the value to match the part,
// e.g. "LDA #>BLAH" would grab the high part. We'd need
// to tweak the adjustment math appropriately.
} }
defSym.Xrefs.Add( defSym.Xrefs.Add(
new XrefSet.Xref(offset, true, xrefType, accType, adj)); new XrefSet.Xref(offset, true, xrefType, accType, adj));