From 1e56490b6bf990f64b44093017baaa157daa45f4 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Mon, 23 Mar 2020 15:16:30 -0700 Subject: [PATCH] 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. --- SourceGen/DisasmProject.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SourceGen/DisasmProject.cs b/SourceGen/DisasmProject.cs index 13746b1..1092c74 100644 --- a/SourceGen/DisasmProject.cs +++ b/SourceGen/DisasmProject.cs @@ -1542,13 +1542,19 @@ namespace SourceGen { DefSymbol defSym = sym as DefSymbol; int adj = 0; 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; } else { // 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. // 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( new XrefSet.Xref(offset, true, xrefType, accType, adj));