mirror of
https://github.com/fadden/6502bench.git
synced 2024-12-30 14:31:13 +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:
parent
1b0ee7de21
commit
463fbff368
@ -306,8 +306,11 @@ namespace SourceGen {
|
|||||||
// picked up as an address for something else. So we set it to the same
|
// picked up as an address for something else. So we set it to the same
|
||||||
// address as the start of the file. The overlapping-address code should do
|
// address as the start of the file. The overlapping-address code should do
|
||||||
// the right thing with it.
|
// the right thing with it.
|
||||||
|
//
|
||||||
|
// Updated after adding the "load address" report to the address edit dialog.
|
||||||
|
// We don't want the two-byte offset.
|
||||||
int loadAddr = RawData.GetWord(mFileData, 0, 2, false);
|
int loadAddr = RawData.GetWord(mFileData, 0, 2, false);
|
||||||
AddrMap.Set(0, loadAddr);
|
AddrMap.Set(0, loadAddr - 2);
|
||||||
AddrMap.Set(2, loadAddr);
|
AddrMap.Set(2, loadAddr);
|
||||||
OperandFormats[0] = FormatDescriptor.Create(2, FormatDescriptor.Type.NumericLE,
|
OperandFormats[0] = FormatDescriptor.Create(2, FormatDescriptor.Type.NumericLE,
|
||||||
FormatDescriptor.SubType.None);
|
FormatDescriptor.SubType.None);
|
||||||
|
@ -1614,7 +1614,13 @@ namespace SourceGen {
|
|||||||
int offset = CodeLineList[selIndex].FileOffset;
|
int offset = CodeLineList[selIndex].FileOffset;
|
||||||
Anattrib attr = mProject.GetAnattrib(offset);
|
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) {
|
if (dlg.ShowDialog() != true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,9 @@ would resolve to address $123456.</p>
|
|||||||
<p>There will always be an address directive at the start of the file.
|
<p>There will always be an address directive at the start of the file.
|
||||||
Attempts to remove it will be ignored.</p>
|
Attempts to remove it will be ignored.</p>
|
||||||
|
|
||||||
|
<p>If the byte at the current offset is not at the address where it was
|
||||||
|
initially loaded, the "load address" will be shown for reference.</p>
|
||||||
|
|
||||||
|
|
||||||
<h2><a name="flags">Edit Status Flag Override</a></h2>
|
<h2><a name="flags">Edit Status Flag Override</a></h2>
|
||||||
<p>The state of the processor status flags are tracked for every
|
<p>The state of the processor status flags are tracked for every
|
||||||
|
@ -32,7 +32,7 @@ limitations under the License.
|
|||||||
|
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
|
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
|
||||||
<TextBlock Text="Address:"/>
|
<TextBlock Text="Address:"/>
|
||||||
<!--<TextBlock Text="$" FontFamily="{StaticResource GeneralMonoFont}" Margin="4,2,0,0"/>-->
|
|
||||||
<TextBox Name="addrTextBox" Width="100" Margin="4,1,0,0"
|
<TextBox Name="addrTextBox" Width="100" Margin="4,1,0,0"
|
||||||
FontFamily="{StaticResource GeneralMonoFont}"
|
FontFamily="{StaticResource GeneralMonoFont}"
|
||||||
Text="{Binding Path=AddressText, UpdateSourceTrigger=PropertyChanged}"
|
Text="{Binding Path=AddressText, UpdateSourceTrigger=PropertyChanged}"
|
||||||
@ -44,9 +44,13 @@ limitations under the License.
|
|||||||
Color="LightBlue"/>
|
Color="LightBlue"/>
|
||||||
</TextBox.Resources>
|
</TextBox.Resources>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
|
<TextBlock Margin="16,0,0,0" Text="(load address: " Visibility="{Binding LoadAddressVis}"/>
|
||||||
|
<TextBlock Text="{Binding LoadAddressText, FallbackValue=$1234}" Visibility="{Binding LoadAddressVis}"/>
|
||||||
|
<TextBlock Text=")" Visibility="{Binding LoadAddressVis}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,8,0,0">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
|
||||||
<Button Name="okButton" Content="OK" IsDefault="True" Width="70"
|
<Button Name="okButton" Content="OK" IsDefault="True" Width="70"
|
||||||
IsEnabled="{Binding IsValid}" Click="OkButton_Click"/>
|
IsEnabled="{Binding IsValid}" Click="OkButton_Click"/>
|
||||||
<Button Name="cancelButton" Content="Cancel" IsCancel="True"
|
<Button Name="cancelButton" Content="Cancel" IsCancel="True"
|
||||||
|
@ -20,6 +20,8 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
using Asm65;
|
||||||
|
|
||||||
namespace SourceGen.WpfGui {
|
namespace SourceGen.WpfGui {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Edit Address dialog.
|
/// Edit Address dialog.
|
||||||
@ -36,6 +38,16 @@ namespace SourceGen.WpfGui {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private int mMaxAddressValue;
|
private int mMaxAddressValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// What the address would be if there were no addresses set after the initial one.
|
||||||
|
/// </summary>
|
||||||
|
private int mBaseAddr;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Text formatter.
|
||||||
|
/// </summary>
|
||||||
|
private Formatter mFormatter;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bound two-way property.
|
/// Bound two-way property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -46,13 +58,21 @@ namespace SourceGen.WpfGui {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsValid {
|
public bool IsValid {
|
||||||
get { return mIsValid; }
|
get { return mIsValid; }
|
||||||
set {
|
set { mIsValid = value; OnPropertyChanged(); }
|
||||||
mIsValid = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private bool mIsValid;
|
private bool mIsValid;
|
||||||
|
|
||||||
|
public Visibility LoadAddressVis {
|
||||||
|
get { return mLoadAddressVis; }
|
||||||
|
set { mLoadAddressVis = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
public Visibility mLoadAddressVis = Visibility.Collapsed;
|
||||||
|
public string LoadAddressText {
|
||||||
|
get { return mLoadAddressText; }
|
||||||
|
set { mLoadAddressText = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
public string mLoadAddressText = string.Empty;
|
||||||
|
|
||||||
// INotifyPropertyChanged implementation
|
// INotifyPropertyChanged implementation
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
private void OnPropertyChanged([CallerMemberName] string propertyName = "") {
|
private void OnPropertyChanged([CallerMemberName] string propertyName = "") {
|
||||||
@ -60,13 +80,22 @@ namespace SourceGen.WpfGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public EditAddress(Window owner, int initialAddr, int maxAddressValue) {
|
public EditAddress(Window owner, int initialAddr, int loadAddr, int maxAddressValue,
|
||||||
|
Formatter formatter) {
|
||||||
// Set the property before initializing the window -- we don't have a property
|
// Set the property before initializing the window -- we don't have a property
|
||||||
// change notifier.
|
// change notifier.
|
||||||
Address = -2;
|
Address = -2;
|
||||||
mMaxAddressValue = maxAddressValue;
|
mMaxAddressValue = maxAddressValue;
|
||||||
|
mBaseAddr = loadAddr;
|
||||||
|
mFormatter = formatter;
|
||||||
|
|
||||||
AddressText = Asm65.Address.AddressToString(initialAddr, false);
|
AddressText = Asm65.Address.AddressToString(initialAddr, false);
|
||||||
|
|
||||||
|
if (initialAddr != loadAddr) {
|
||||||
|
LoadAddressVis = Visibility.Visible;
|
||||||
|
LoadAddressText = mFormatter.FormatAddress(loadAddr, loadAddr > 0xffff);
|
||||||
|
}
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
DataContext = this;
|
DataContext = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user