1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-07-24 22:25:06 +00:00

Show load address in Edit Address dialog

Sometimes code relocates a few bits of itself but not others.  We
don't currently have a way to say, "go back to where we would have
been".  As a cheap alternative, we now show the "load address", i.e.
where we'd be if there were no address map entries after the first.
This commit is contained in:
Andy McFadden
2019-10-22 13:52:19 -07:00
parent 1b0ee7de21
commit 463fbff368
5 changed files with 54 additions and 9 deletions

View File

@@ -1614,7 +1614,13 @@ namespace SourceGen {
int offset = CodeLineList[selIndex].FileOffset;
Anattrib attr = mProject.GetAnattrib(offset);
EditAddress dlg = new EditAddress(mMainWin, attr.Address, mProject.CpuDef.MaxAddressValue);
// Compute load address, i.e. where the byte would have been placed if the entire
// file were loaded at the address of the first address map entry. We assume
// offsets wrap at the bank boundary.
int firstAddr = mProject.AddrMap.OffsetToAddress(0);
int loadAddr = ((firstAddr + offset) & 0xffff) | (firstAddr & 0xff0000);
EditAddress dlg = new EditAddress(mMainWin, attr.Address, loadAddr,
mProject.CpuDef.MaxAddressValue, mOutputFormatter);
if (dlg.ShowDialog() != true) {
return;
}