1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-25 05:29:31 +00:00

Expand "apply platform symbols" feature

This experimental feature applied platform symbols to the project,
setting labels where the platform symbol's address matched an internal
address.  The feature now applies project symbols as well, and has
been renamed to "apply external symbols".

We now report the number of labels set.
This commit is contained in:
Andy McFadden 2020-07-28 10:56:07 -07:00
parent c380b001b7
commit 94d7a30a09
5 changed files with 28 additions and 14 deletions

View File

@ -828,6 +828,7 @@ namespace SourceGen {
private void ApplyUndoableChanges(ChangeSet cs) {
if (cs.Count == 0) {
Debug.WriteLine("ApplyUndoableChanges: change set is empty");
// Apply anyway to create an undoable non-event?
}
ApplyChanges(cs, false);
mProject.PushChangeSet(cs);
@ -4466,11 +4467,12 @@ namespace SourceGen {
}
// Disable "analyze uncategorized data" for best results.
public void Debug_ApplyPlatformSymbols() {
public void Debug_ApplyExternalSymbols() {
ChangeSet cs = new ChangeSet(1);
foreach (Symbol sym in mProject.SymbolTable) {
if (sym.SymbolSource != Symbol.Source.Platform) {
if (sym.SymbolSource != Symbol.Source.Platform &&
sym.SymbolSource != Symbol.Source.Project) {
continue;
}
DefSymbol defSym = (DefSymbol)sym;
@ -4508,7 +4510,12 @@ namespace SourceGen {
cs.Add(uc);
}
ApplyUndoableChanges(cs);
if (cs.Count == 0) {
MessageBox.Show("No changes made.");
} else {
ApplyUndoableChanges(cs);
MessageBox.Show("Set " + cs.Count + " labels.");
}
}
public void Debug_RebootSecuritySandbox() {

View File

@ -440,16 +440,17 @@ not help you debug 6502 projects.</p>
SourceGen Edit Command format. This is an experimental feature.</li>
<li>Apply Edit Commands. Reads a file in SourceGen Edit Command
format and applies the commands.</li>
<li>Apply Platform Symbols. An experimental feature for turning platform
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
<li>Apply External Symbols. An experimental feature for turning platform
and project 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,
and the platform symbol's label isn't already defined elsewhere, the
platform label will be applied. Useful when 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>
properties editor first, as this will not set labels in the middle
of multi-byte data items.)</li>
</ul>

View File

@ -318,6 +318,12 @@ field. Click a second time to reverse the sort direction.</p>
add the previous selection to the navigation stack. This can be a handy
way to move around the file, jumping from label to label.</p>
<p>The "type" column uses a two-letter code to identify the symbol's
type and scope. The first letter is one of A (auto), U (user),
P (platform), J (project), or V (variable). The second letter is one
of N (non-unique local), L (local), G (global), X (exported),
E (external), or C (constant).</p>
<h3><a name="info">Info Window</a></h3>

View File

@ -205,7 +205,7 @@ limitations under the License.
<RoutedUICommand x:Key="Debug_ApplesoftToHtmlCmd" Text="Applesoft to HTML..."/>
<RoutedUICommand x:Key="Debug_ApplyEditCommandsCmd" Text="Apply Edit Commands..."/>
<RoutedUICommand x:Key="Debug_ApplyPlatformSymbolsCmd" Text="Apply Platform Symbols"/>
<RoutedUICommand x:Key="Debug_ApplyExternalSymbolsCmd" Text="Apply External Symbols"/>
<RoutedUICommand x:Key="Debug_ExportEditCommandsCmd" Text="Export Edit Commands..."/>
<RoutedUICommand x:Key="Debug_ExtensionScriptInfoCmd" Text="Extension Script Info..."/>
<RoutedUICommand x:Key="Debug_RebootSecuritySandboxCmd" Text="Reboot Security Sandbox"/>
@ -347,8 +347,8 @@ limitations under the License.
Executed="Debug_ApplesoftToHtmlCmd_Executed"/>
<CommandBinding Command="{StaticResource Debug_ApplyEditCommandsCmd}"
CanExecute="IsProjectOpen" Executed="Debug_ApplyEditCommandsCmd_Executed"/>
<CommandBinding Command="{StaticResource Debug_ApplyPlatformSymbolsCmd}"
CanExecute="IsProjectOpen" Executed="Debug_ApplyPlatformSymbolsCmd_Executed"/>
<CommandBinding Command="{StaticResource Debug_ApplyExternalSymbolsCmd}"
CanExecute="IsProjectOpen" Executed="Debug_ApplyExternalSymbolsCmd_Executed"/>
<CommandBinding Command="{StaticResource Debug_ExportEditCommandsCmd}"
CanExecute="IsProjectOpen" Executed="Debug_ExportEditCommandsCmd_Executed"/>
<CommandBinding Command="{StaticResource Debug_ExtensionScriptInfoCmd}"
@ -482,7 +482,7 @@ limitations under the License.
<MenuItem Command="{StaticResource Debug_ApplesoftToHtmlCmd}"/>
<MenuItem Command="{StaticResource Debug_ExportEditCommandsCmd}"/>
<MenuItem Command="{StaticResource Debug_ApplyEditCommandsCmd}"/>
<MenuItem Command="{StaticResource Debug_ApplyPlatformSymbolsCmd}"/>
<MenuItem Command="{StaticResource Debug_ApplyExternalSymbolsCmd}"/>
</MenuItem>
</Menu>

View File

@ -1398,9 +1398,9 @@ namespace SourceGen.WpfGui {
mMainCtrl.Debug_ApplyEditCommands();
}
private void Debug_ApplyPlatformSymbolsCmd_Executed(object sender,
private void Debug_ApplyExternalSymbolsCmd_Executed(object sender,
ExecutedRoutedEventArgs e) {
mMainCtrl.Debug_ApplyPlatformSymbols();
mMainCtrl.Debug_ApplyExternalSymbols();
}
private void Debug_ExportEditCommandsCmd_Executed(object sender,