mirror of
https://github.com/fadden/6502bench.git
synced 2024-12-02 13:51:36 +00:00
Fix "goto address" for overlapping segments
If you have multiple overlapping segments (say, four 8KB chunks that all load at $8000), and you use the "goto" command to jump to address $8100, it should try to jump to that address within whichever segment you happen to be working (based on the current line selection). If that address doesn't exist in the current segment, it's okay to punt and jump to the first occurrence of that address in the file. The existing code was always jumping to the first instance. (related to issue #98)
This commit is contained in:
parent
b75c37a9b9
commit
38bc7721a4
@ -167,8 +167,10 @@ namespace SourceGen.WpfGui {
|
||||
if (labelOffset >= 0) {
|
||||
TargetOffset = labelOffset;
|
||||
} else if (Address.ParseAddress(input, 1 << 24, out int addr)) {
|
||||
// could be a valid address; check against address map
|
||||
int offset = mProject.AddrMap.AddressToOffset(0, addr);
|
||||
// Could be a valid address; check against address map. Use the provided
|
||||
// initial offset so we stay within current segment if there are overlapping
|
||||
// address ranges.
|
||||
int offset = mProject.AddrMap.AddressToOffset(mInitialOffset, addr);
|
||||
if (offset >= 0) {
|
||||
TargetOffset = offset;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user