mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-30 01:50:10 +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) {
|
if (sym == null && (attr.OperandAddress & 0xffff) > 1 && checkNearby) {
|
||||||
sym = SymbolTable.FindAddressByValue(attr.OperandAddress - 2);
|
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) {
|
if (sym != null && !sym.IsVariable) {
|
||||||
mAnattribs[offset].DataDescriptor =
|
mAnattribs[offset].DataDescriptor =
|
||||||
FormatDescriptor.Create(mAnattribs[offset].Length,
|
FormatDescriptor.Create(mAnattribs[offset].Length,
|
||||||
|
@ -1624,10 +1624,17 @@ namespace SourceGen {
|
|||||||
if (mProject.UserLabels.ContainsKey(offset)) {
|
if (mProject.UserLabels.ContainsKey(offset)) {
|
||||||
oldUserValue = mProject.UserLabels[offset];
|
oldUserValue = mProject.UserLabels[offset];
|
||||||
}
|
}
|
||||||
UndoableChange uc = UndoableChange.CreateLabelChange(offset,
|
if (oldUserValue == dlg.LabelSym) {
|
||||||
oldUserValue, dlg.LabelSym);
|
// Only expected when attr.Symbol is Auto
|
||||||
ChangeSet cs = new ChangeSet(uc);
|
Debug.Assert(attr.Symbol.SymbolSource == Symbol.Source.Auto);
|
||||||
ApplyUndoableChanges(cs);
|
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
|
jsr offend
|
||||||
lda offend+1
|
lda offend+1
|
||||||
jsr offend+1
|
jsr offend+1
|
||||||
lda $207f
|
lda L2080-1
|
||||||
jsr $207f
|
jsr L2080-1
|
||||||
lda L2080
|
lda L2080
|
||||||
jsr L2080
|
jsr L2080
|
||||||
lda $00
|
lda $00
|
||||||
|
@ -47,8 +47,8 @@ L2080 bit L2080
|
|||||||
jsr offend
|
jsr offend
|
||||||
lda offend+1
|
lda offend+1
|
||||||
jsr offend+1
|
jsr offend+1
|
||||||
lda $207f
|
lda L2080-1
|
||||||
jsr $207f
|
jsr L2080-1
|
||||||
lda L2080
|
lda L2080
|
||||||
jsr L2080
|
jsr L2080
|
||||||
lda $00
|
lda $00
|
||||||
|
@ -55,8 +55,8 @@ L2080 bit L2080
|
|||||||
jsr offend
|
jsr offend
|
||||||
lda offend+1
|
lda offend+1
|
||||||
jsr offend+1
|
jsr offend+1
|
||||||
lda $207f
|
lda L2080-1
|
||||||
jsr $207f
|
jsr L2080-1
|
||||||
lda L2080
|
lda L2080
|
||||||
jsr L2080
|
jsr L2080
|
||||||
lda $00
|
lda $00
|
||||||
|
@ -57,8 +57,8 @@ L2080: bit L2080
|
|||||||
jsr offend
|
jsr offend
|
||||||
lda offend+1
|
lda offend+1
|
||||||
jsr offend+1
|
jsr offend+1
|
||||||
lda $207f
|
lda L2080-1
|
||||||
jsr $207f
|
jsr L2080-1
|
||||||
lda L2080
|
lda L2080
|
||||||
jsr L2080
|
jsr L2080
|
||||||
lda $00
|
lda $00
|
||||||
|
Loading…
Reference in New Issue
Block a user