mirror of
https://github.com/fadden/6502bench.git
synced 2025-02-27 19:29:08 +00:00
Add Apply Platform Symbols experimental feature
This turns platform symbols into address labels. Useful for things like system ROM images that have an established set of entry points.
This commit is contained in:
parent
97a5623599
commit
ff68409398
@ -3952,6 +3952,49 @@ namespace SourceGen {
|
|||||||
showTextDlg.ShowDialog();
|
showTextDlg.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Debug_ApplyPlatformSymbols() {
|
||||||
|
ChangeSet cs = new ChangeSet(1);
|
||||||
|
|
||||||
|
foreach (Symbol sym in mProject.SymbolTable) {
|
||||||
|
if (sym.SymbolSource != Symbol.Source.Platform) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DefSymbol defSym = (DefSymbol)sym;
|
||||||
|
if (defSym.MultiMask != null) {
|
||||||
|
// These would require additional work... probably.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int offset = mProject.AddrMap.AddressToOffset(0, sym.Value);
|
||||||
|
if (offset < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure this is the start of an instruction or data item. (If you
|
||||||
|
// haven't finished hinting code, it's best to disable the string/fill finder.)
|
||||||
|
Anattrib attr = mProject.GetAnattrib(offset);
|
||||||
|
if (!attr.IsStart) {
|
||||||
|
Debug.WriteLine("Found match at non-start +" + offset.ToString("x6") +
|
||||||
|
": " + defSym);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for user label. Okay to overwrite auto label.
|
||||||
|
if (mProject.UserLabels.ContainsKey(offset)) {
|
||||||
|
Debug.WriteLine("User label already exists at +" + offset.ToString("x6"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new user label symbol.
|
||||||
|
Symbol newSym = new Symbol(sym.Label, sym.Value, Symbol.Source.User,
|
||||||
|
Symbol.Type.GlobalAddr, Symbol.LabelAnnotation.None);
|
||||||
|
UndoableChange uc = UndoableChange.CreateLabelChange(offset, null, newSym);
|
||||||
|
cs.Add(uc);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplyUndoableChanges(cs);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Debug features
|
#endregion Debug features
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,10 +306,10 @@ not help you debug 6502 projects.</p>
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Re-analyze (F5). Causes a full re-analysis. Useful if you think
|
<li>Re-analyze (F5). Causes a full re-analysis. Useful if you think
|
||||||
the display is out of sync.</li>
|
the display is out of sync.</li>
|
||||||
<li>Show Problem List Viewer. Opens a floating window that shows some
|
<li>Source Generation Tests. Opens the regression test harness. See
|
||||||
of the problems encountered during the last analysis pass.</li>
|
<code>README.md</code> in the SGTestData directory for more information.
|
||||||
<li>Show Undo/Redo History. Opens a floating window that lets you
|
If the regression tests weren't included in the SourceGen distribution,
|
||||||
watch the contents of the undo buffer while you work.</li>
|
this will have nothing to do.</li>
|
||||||
<li>Show Analyzer Output. Opens a floating window with a text log from
|
<li>Show Analyzer Output. Opens a floating window with a text log from
|
||||||
the most recent analysis pass. The exact contents will vary depending
|
the most recent analysis pass. The exact contents will vary depending
|
||||||
on how the verbosity level is configured internally. Debug messages
|
on how the verbosity level is configured internally. Debug messages
|
||||||
@ -318,9 +318,11 @@ not help you debug 6502 projects.</p>
|
|||||||
timer results from the most recent analysis pass. Times for individual
|
timer results from the most recent analysis pass. Times for individual
|
||||||
stages are noted, as are times for groups of functions. This
|
stages are noted, as are times for groups of functions. This
|
||||||
provides a crude sense of where time is being spent.</li>
|
provides a crude sense of where time is being spent.</li>
|
||||||
|
<li>Show Undo/Redo History. Opens a floating window that lets you
|
||||||
|
watch the contents of the undo buffer while you work.</li>
|
||||||
<li>Extension Script Info. Shows a bit about the currently-loaded
|
<li>Extension Script Info. Shows a bit about the currently-loaded
|
||||||
extension scripts.</li>
|
extension scripts.</li>
|
||||||
<li>Toggle Comment Rulers. Adds a string of digits above every
|
<li>Show Comment Rulers. Adds a string of digits above every
|
||||||
multi-line comment (long comment, note). Useful for confirming that
|
multi-line comment (long comment, note). Useful for confirming that
|
||||||
the width limitation is being obeyed. These are added exactly
|
the width limitation is being obeyed. These are added exactly
|
||||||
as shown, without comment delimiters, into generated assembly output,
|
as shown, without comment delimiters, into generated assembly output,
|
||||||
@ -329,10 +331,18 @@ not help you debug 6502 projects.</p>
|
|||||||
script sandbox every 60 seconds. This seems to be required to avoid
|
script sandbox every 60 seconds. This seems to be required to avoid
|
||||||
an infrequently-encountered Windows bug. (See code for notes and
|
an infrequently-encountered Windows bug. (See code for notes and
|
||||||
stackoverflow.com links.)</li>
|
stackoverflow.com links.)</li>
|
||||||
<li>Source Generation Tests. Opens the regression test harness. See
|
<li>Applesoft to HTML. An experimental feature that formats an
|
||||||
the README.md in the SGTestData directory for more information. If
|
Applesoft program as HTML.</li>
|
||||||
the regression tests weren't included in the SourceGen distribution,
|
<li>Apply Platform Symbols. An experimental feature for turning platform
|
||||||
this will have nothing to do.</li>
|
symbols into address labels. This will run through the list of all
|
||||||
|
symbols loaded from .sym65 files and find addresses that fall within
|
||||||
|
the bounds of the file. If it finds an address that is the start
|
||||||
|
of a code/data line and doesn't already have a user-supplied label,
|
||||||
|
the platform symbol's label will be applied. Useful for
|
||||||
|
disassembling ROM images or other code with an established set of
|
||||||
|
public entry points.
|
||||||
|
(Tip: disable "analyze uncategorized data" from the project
|
||||||
|
properties editor first.)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,6 +176,7 @@ limitations under the License.
|
|||||||
</RoutedUICommand>
|
</RoutedUICommand>
|
||||||
|
|
||||||
<RoutedUICommand x:Key="Debug_ApplesoftToHtmlCmd" Text="Applesoft to HTML..."/>
|
<RoutedUICommand x:Key="Debug_ApplesoftToHtmlCmd" Text="Applesoft to HTML..."/>
|
||||||
|
<RoutedUICommand x:Key="Debug_ApplyPlatformSymbolsCmd" Text="Apply Platform Symbols"/>
|
||||||
<RoutedUICommand x:Key="Debug_ExtensionScriptInfoCmd" Text="Extension Script Info..."/>
|
<RoutedUICommand x:Key="Debug_ExtensionScriptInfoCmd" Text="Extension Script Info..."/>
|
||||||
<RoutedUICommand x:Key="Debug_ShowAnalysisTimersCmd" Text="Show Analysis Timers"/>
|
<RoutedUICommand x:Key="Debug_ShowAnalysisTimersCmd" Text="Show Analysis Timers"/>
|
||||||
<RoutedUICommand x:Key="Debug_ShowAnalyzerOutputCmd" Text="Show Analyzer Output"/>
|
<RoutedUICommand x:Key="Debug_ShowAnalyzerOutputCmd" Text="Show Analyzer Output"/>
|
||||||
@ -296,6 +297,8 @@ limitations under the License.
|
|||||||
CanExecute="IsProjectOpen" Executed="Debug_RefreshCmd_Executed"/>
|
CanExecute="IsProjectOpen" Executed="Debug_RefreshCmd_Executed"/>
|
||||||
<CommandBinding Command="{StaticResource Debug_ApplesoftToHtmlCmd}"
|
<CommandBinding Command="{StaticResource Debug_ApplesoftToHtmlCmd}"
|
||||||
Executed="Debug_ApplesoftToHtmlCmd_Executed"/>
|
Executed="Debug_ApplesoftToHtmlCmd_Executed"/>
|
||||||
|
<CommandBinding Command="{StaticResource Debug_ApplyPlatformSymbolsCmd}"
|
||||||
|
CanExecute="IsProjectOpen" Executed="Debug_ApplyPlatformSymbolsCmd_Executed"/>
|
||||||
<CommandBinding Command="{StaticResource Debug_ExtensionScriptInfoCmd}"
|
<CommandBinding Command="{StaticResource Debug_ExtensionScriptInfoCmd}"
|
||||||
CanExecute="IsProjectOpen" Executed="Debug_ExtensionScriptInfoCmd_Executed"/>
|
CanExecute="IsProjectOpen" Executed="Debug_ExtensionScriptInfoCmd_Executed"/>
|
||||||
<CommandBinding Command="{StaticResource Debug_ShowAnalysisTimersCmd}"
|
<CommandBinding Command="{StaticResource Debug_ShowAnalysisTimersCmd}"
|
||||||
@ -408,6 +411,7 @@ limitations under the License.
|
|||||||
Command="{StaticResource Debug_ToggleKeepAliveHackCmd}" IsCheckable="True"/>
|
Command="{StaticResource Debug_ToggleKeepAliveHackCmd}" IsCheckable="True"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Command="{StaticResource Debug_ApplesoftToHtmlCmd}"/>
|
<MenuItem Command="{StaticResource Debug_ApplesoftToHtmlCmd}"/>
|
||||||
|
<MenuItem Command="{StaticResource Debug_ApplyPlatformSymbolsCmd}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|
||||||
|
@ -1333,6 +1333,11 @@ namespace SourceGen.WpfGui {
|
|||||||
mMainCtrl.Debug_ApplesoftToHtml();
|
mMainCtrl.Debug_ApplesoftToHtml();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Debug_ApplyPlatformSymbolsCmd_Executed(object sender,
|
||||||
|
ExecutedRoutedEventArgs e) {
|
||||||
|
mMainCtrl.Debug_ApplyPlatformSymbols();
|
||||||
|
}
|
||||||
|
|
||||||
private void Debug_ExtensionScriptInfoCmd_Executed(object sender,
|
private void Debug_ExtensionScriptInfoCmd_Executed(object sender,
|
||||||
ExecutedRoutedEventArgs e) {
|
ExecutedRoutedEventArgs e) {
|
||||||
mMainCtrl.Debug_ExtensionScriptInfo();
|
mMainCtrl.Debug_ExtensionScriptInfo();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user