mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-26 06:49:19 +00:00
Check both directions for project/platform "nearby" matches
If a symbol is defined at <addr>, and we counter STA <addr>-1,Y, we want to use the symbol in the operand. This worked for labels but not project/platform symbols. Also, fixed a crash that happened if you tried to delete an auto label.
This commit is contained in:
parent
81157b6b47
commit
1631cd77f6
@ -1075,6 +1075,21 @@ namespace SourceGen {
|
||||
if (sym == null && (attr.OperandAddress & 0xffff) > 1 && checkNearby) {
|
||||
sym = SymbolTable.FindAddressByValue(attr.OperandAddress - 2);
|
||||
}
|
||||
// Still nothing, try addr+1. Sometimes indexed addressing will use
|
||||
// "STA addr-1,y". This will also catch "STA addr-1" when addr is the
|
||||
// very start of a segment, which means we're actually finding a label
|
||||
// reference rather than project/platform symbol; only works if the
|
||||
// location already has a label.
|
||||
if (sym == null && (attr.OperandAddress & 0xffff) < 0xffff && checkNearby) {
|
||||
sym = SymbolTable.FindAddressByValue(attr.OperandAddress + 1);
|
||||
if (sym != null && sym.SymbolSource != Symbol.Source.Project &&
|
||||
sym.SymbolSource != Symbol.Source.Platform) {
|
||||
Debug.WriteLine("Applying non-platform in GeneratePlatform: " + sym);
|
||||
// should be okay to do this
|
||||
}
|
||||
}
|
||||
|
||||
// If we found something, and it's not a variable, create a descriptor.
|
||||
if (sym != null && !sym.IsVariable) {
|
||||
mAnattribs[offset].DataDescriptor =
|
||||
FormatDescriptor.Create(mAnattribs[offset].Length,
|
||||
|
@ -1624,10 +1624,17 @@ namespace SourceGen {
|
||||
if (mProject.UserLabels.ContainsKey(offset)) {
|
||||
oldUserValue = mProject.UserLabels[offset];
|
||||
}
|
||||
UndoableChange uc = UndoableChange.CreateLabelChange(offset,
|
||||
oldUserValue, dlg.LabelSym);
|
||||
ChangeSet cs = new ChangeSet(uc);
|
||||
ApplyUndoableChanges(cs);
|
||||
if (oldUserValue == dlg.LabelSym) {
|
||||
// Only expected when attr.Symbol is Auto
|
||||
Debug.Assert(attr.Symbol.SymbolSource == Symbol.Source.Auto);
|
||||
Debug.Assert(oldUserValue == null);
|
||||
Debug.WriteLine("Ignoring attempt to delete an auto label");
|
||||
} else {
|
||||
UndoableChange uc = UndoableChange.CreateLabelChange(offset,
|
||||
oldUserValue, dlg.LabelSym);
|
||||
ChangeSet cs = new ChangeSet(uc);
|
||||
ApplyUndoableChanges(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,8 @@ L2080 bit L2080
|
||||
jsr offend
|
||||
lda offend+1
|
||||
jsr offend+1
|
||||
lda $207f
|
||||
jsr $207f
|
||||
lda L2080-1
|
||||
jsr L2080-1
|
||||
lda L2080
|
||||
jsr L2080
|
||||
lda $00
|
||||
|
@ -47,8 +47,8 @@ L2080 bit L2080
|
||||
jsr offend
|
||||
lda offend+1
|
||||
jsr offend+1
|
||||
lda $207f
|
||||
jsr $207f
|
||||
lda L2080-1
|
||||
jsr L2080-1
|
||||
lda L2080
|
||||
jsr L2080
|
||||
lda $00
|
||||
|
@ -55,8 +55,8 @@ L2080 bit L2080
|
||||
jsr offend
|
||||
lda offend+1
|
||||
jsr offend+1
|
||||
lda $207f
|
||||
jsr $207f
|
||||
lda L2080-1
|
||||
jsr L2080-1
|
||||
lda L2080
|
||||
jsr L2080
|
||||
lda $00
|
||||
|
@ -57,8 +57,8 @@ L2080: bit L2080
|
||||
jsr offend
|
||||
lda offend+1
|
||||
jsr offend+1
|
||||
lda $207f
|
||||
jsr $207f
|
||||
lda L2080-1
|
||||
jsr L2080-1
|
||||
lda L2080
|
||||
jsr L2080
|
||||
lda $00
|
||||
|
Loading…
Reference in New Issue
Block a user