mirror of
https://github.com/fadden/6502bench.git
synced 2026-04-27 03:17:45 +00:00
Allow formatting of 32-bit address tables
These are actually 24-bit address tables, with an extra byte to pad each entry to an even number of bytes, so the GUI refers to them as "24-bit + pad byte". The extra byte is not included in the address calculation, and is simply skipped over. (issue #171)
This commit is contained in:
1 parent
65b217908b
commit
8dba2c1de6
3 files changed
+35
-17
No files matched your search
@@ -55,6 +55,8 @@ limitations under the License.
|
||||
Content="16-bit" Checked="WidthRadio_CheckedChanged"/>
|
||||
<RadioButton Name="width24Radio" GroupName="Addr" Margin="0,4,0,0"
|
||||
Content="24-bit" Checked="WidthRadio_CheckedChanged"/>
|
||||
<RadioButton Name="width32Radio" GroupName="Addr" Margin="0,4,0,0"
|
||||
Content="24-bit + pad byte" Checked="WidthRadio_CheckedChanged"/>
|
||||
<CheckBox Margin="0,4,0,0" Content="Parts are split across sub-tables"
|
||||
IsChecked="{Binding IsSplitTable}"/>
|
||||
<CheckBox Margin="0,4,0,0" Content="Adjusted for RTS/RTL (target - 1)"
|
||||
@@ -72,7 +74,7 @@ limitations under the License.
|
||||
Checked="LowByte_CheckedChanged"/>
|
||||
<RadioButton Name="lowThirdPartRadio" GroupName="Low" Margin="0,4,0,0"
|
||||
Content="Third part of selection"
|
||||
IsEnabled="{Binding ElementName=width24Radio, Path=IsChecked}"
|
||||
IsEnabled="{Binding IsBankEnabled}"
|
||||
Checked="LowByte_CheckedChanged"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
@@ -87,7 +89,7 @@ limitations under the License.
|
||||
Checked="HighByte_CheckedChanged"/>
|
||||
<RadioButton Name="highThirdPartRadio" GroupName="High" Margin="0,4,0,0"
|
||||
Content="Third part of selection"
|
||||
IsEnabled="{Binding ElementName=width24Radio, Path=IsChecked}"
|
||||
IsEnabled="{Binding IsBankEnabled}"
|
||||
Checked="HighByte_CheckedChanged"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<RadioButton Name="highConstantRadio" GroupName="High" Margin="0,4,0,0"
|
||||
@@ -99,7 +101,7 @@ limitations under the License.
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Bank Byte Source">
|
||||
<StackPanel IsEnabled="{Binding ElementName=width24Radio, Path=IsChecked}">
|
||||
<StackPanel IsEnabled="{Binding IsBankEnabled}">
|
||||
<RadioButton Name="bankNthPartRadio" GroupName="Bank" Margin="0,4,0,0"
|
||||
Content="Nth part of selection"
|
||||
Checked="BankByte_CheckedChanged"/>
|
||||
@@ -134,9 +136,10 @@ limitations under the License.
|
||||
<!-- We're currently auto-sizing everything outside this, so the width of
|
||||
the columns determines the width of the window. Resizing the columns resizes
|
||||
the window, even though the window isn't resizeable. "It's a feature." -->
|
||||
<!-- We set a fixed height so long lists don't make the window absurdly tall. -->
|
||||
<DataGrid Name="outputPreviewList"
|
||||
Margin="0,2,0,0"
|
||||
Height="318"
|
||||
Height="345"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding OutputPreviewList}"
|
||||
FontFamily="{StaticResource GeneralMonoFont}"
|
||||
|
||||
@@ -44,6 +44,13 @@ namespace SourceGen.WpfGui {
|
||||
/// </summary>
|
||||
public List<int> AllTargetOffsets { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if the addresses are 24-bit or 32-bit, and thus include the bank byte.
|
||||
/// </summary>
|
||||
public bool IsBankEnabled {
|
||||
get { return width24Radio.IsChecked == true || width32Radio.IsChecked == true; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If set, targets are offset by one for RTS/RTL.
|
||||
/// </summary>
|
||||
@@ -194,6 +201,7 @@ namespace SourceGen.WpfGui {
|
||||
if (mProject.CpuDef.HasAddr16) {
|
||||
// Disable the 24-bit option. Having 16-bit selected will disable the rest.
|
||||
width24Radio.IsEnabled = false;
|
||||
width32Radio.IsEnabled = false;
|
||||
}
|
||||
|
||||
mUpdating = false;
|
||||
@@ -210,16 +218,11 @@ namespace SourceGen.WpfGui {
|
||||
}
|
||||
mUpdating = true; // no re-entry
|
||||
|
||||
// handled with XAML bindings
|
||||
//lowThirdPartRadio.Enabled = width24Radio.Checked;
|
||||
//highThirdPartRadio.Enabled = width24Radio.Checked;
|
||||
//bankByteGroupBox.Enabled = width24Radio.Checked;
|
||||
|
||||
lowSecondPartRadio.IsEnabled = true;
|
||||
|
||||
// If the user selects "constant" for high byte or bank byte, then there is no
|
||||
// 3rd part available for low/high, so we need to turn those back off.
|
||||
if (width24Radio.IsChecked == true) {
|
||||
if (width24Radio.IsChecked == true || width32Radio.IsChecked == true) {
|
||||
bool haveThree = !(highConstantRadio.IsChecked == true ||
|
||||
bankConstantRadio.IsChecked == true);
|
||||
lowThirdPartRadio.IsEnabled = haveThree;
|
||||
@@ -268,6 +271,7 @@ namespace SourceGen.WpfGui {
|
||||
}
|
||||
|
||||
private void WidthRadio_CheckedChanged(object sender, RoutedEventArgs e) {
|
||||
OnPropertyChanged(nameof(IsBankEnabled));
|
||||
UpdateControls();
|
||||
}
|
||||
|
||||
@@ -320,7 +324,7 @@ namespace SourceGen.WpfGui {
|
||||
} else {
|
||||
minDiv = 2;
|
||||
}
|
||||
} else {
|
||||
} else /*24 or 32*/ {
|
||||
if (highConstantRadio.IsChecked == true) {
|
||||
if (bankConstantRadio.IsChecked == true) {
|
||||
minDiv = 1;
|
||||
@@ -334,6 +338,9 @@ namespace SourceGen.WpfGui {
|
||||
minDiv = 3;
|
||||
}
|
||||
}
|
||||
if (width32Radio.IsChecked == true) {
|
||||
minDiv++;
|
||||
}
|
||||
}
|
||||
|
||||
IncompatibleSelectionVisibility = InvalidConstantVisibility = false;
|
||||
@@ -404,7 +411,7 @@ namespace SourceGen.WpfGui {
|
||||
} else {
|
||||
highOff = -1; // use constant
|
||||
}
|
||||
if (width24Radio.IsChecked == true) {
|
||||
if (width24Radio.IsChecked == true || width32Radio.IsChecked == true) {
|
||||
if (bankNthPartRadio.IsChecked == true) {
|
||||
// Use whichever part isn't being used by the other two.
|
||||
if (lowOff != 0 && highOff != 0) {
|
||||
@@ -435,6 +442,8 @@ namespace SourceGen.WpfGui {
|
||||
|
||||
if (IsSplitTable) {
|
||||
// Split table, so stride is 1 and each section start is determined by the span.
|
||||
// We don't change anything for the 32-bit width, because we would be ignoring
|
||||
// those bytes anyway.
|
||||
stride = 1;
|
||||
lowOff *= span;
|
||||
highOff *= span;
|
||||
@@ -448,6 +457,9 @@ namespace SourceGen.WpfGui {
|
||||
if (bankOff >= 0) {
|
||||
stride++;
|
||||
}
|
||||
if (width32Radio.IsChecked == true) {
|
||||
stride++;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.WriteLine("FormatAddressTable: stride=" + stride + " span=" + span +
|
||||
@@ -481,7 +493,8 @@ namespace SourceGen.WpfGui {
|
||||
bank = (byte) bankConst;
|
||||
}
|
||||
|
||||
// This is the target address.
|
||||
// This is the target address. We're currently ignoring the extra byte in 32-bit
|
||||
// addresses.
|
||||
int addr = ((bank << 16) | (high << 8) | low) + adj;
|
||||
|
||||
// Map it to a target label. Start by looking for an offset inside file bounds.
|
||||
@@ -546,7 +559,7 @@ namespace SourceGen.WpfGui {
|
||||
// 24-bit table, i.e. low then bank then high. This is not really
|
||||
// a thing, but we should either prevent it or punt to single-byte
|
||||
// like we do for split tables.
|
||||
Debug.Assert(stride >= 1 && stride <= 3);
|
||||
Debug.Assert(stride >= 1 && stride <= 4);
|
||||
newDfds.Add(offsets[0 + i * stride], FormatDescriptor.Create(stride,
|
||||
new WeakSymbolRef(targetLabel, WeakSymbolRef.Part.Low), isBigEndian));
|
||||
}
|
||||
|
||||
@@ -588,9 +588,11 @@ complicated dialog is split into sections.</p>
|
||||
<ul>
|
||||
<li>Address Characteristics: select whether the table has 16-bit
|
||||
addresses or 24-bit addresses. (24-bit addresses are disabled if you
|
||||
don't have the CPU set to 65816.) If the table is split into individual
|
||||
sub-tables for low bytes and high bytes, check the <samp>Parts are split
|
||||
across sub-tables</samp> box. If the address parts are being pushed
|
||||
don't have the CPU set to 65816.) If each 24-bit address is stored as
|
||||
a 32-bit value, use the "24-bit + pad byte" option.
|
||||
If the table is split into individual sub-tables for low bytes and high
|
||||
bytes, check the <samp>Parts are split across sub-tables</samp> box.
|
||||
If the address parts are being pushed
|
||||
on the stack for an <code>RTS</code>/<code>RTL</code>,
|
||||
check the <samp>Adjusted for RTS/RTL</samp> box to adjust them by 1.</li>
|
||||
<li>Low Byte Source: indicate which part of the table or word holds the
|
||||
|
||||
Reference in new issue
Block a user