1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-11 02:29:53 +00:00

Add toolbar button for "show cycle counts"

Sometimes you just want to turn cycle counts on for a bit, and going
through app settings is tiresome.  Now there's a toolbar checkbox
for it.  The icon isn't ideal, but it'll do.
This commit is contained in:
Andy McFadden 2020-09-04 17:49:28 -07:00
parent f30780a9de
commit b962d8715d
7 changed files with 59 additions and 6 deletions

View File

@ -488,7 +488,7 @@ namespace SourceGen {
/// Applies "actionable" settings to the ProjectView, pulling them out of the global
/// settings object. If a project is open, refreshes the display list and all sub-windows.
/// </summary>
private void ApplyAppSettings() {
public void ApplyAppSettings() {
Debug.WriteLine("ApplyAppSettings...");
AppSettings settings = AppSettings.Global;
@ -587,6 +587,10 @@ namespace SourceGen {
mMainWin.ShowDebugMenu =
AppSettings.Global.GetBool(AppSettings.DEBUG_MENU_ENABLED, false);
// Refresh the toolbar checkbox.
mMainWin.DoShowCycleCounts =
AppSettings.Global.GetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS, false);
// Finally, update the display list generator with all the fancy settings.
if (CodeLineList != null) {
// Regenerate the display list with the latest formatter config and
@ -890,20 +894,22 @@ namespace SourceGen {
}
mReanalysisTimer.EndTask(refreshTaskStr);
mReanalysisTimer.StartTask("Restore selection and top position");
DisplayListSelection newSel = savedSel.Restore(CodeLineList, out topItemIndex);
//newSel.DebugDump();
// Restore the selection. The selection-changed event will cause updates to the
// references, notes, and info panels.
mReanalysisTimer.StartTask("Restore selection and top position");
mMainWin.CodeListView_SetSelection(newSel);
mMainWin.CodeListView_SetTopIndex(topItemIndex);
mReanalysisTimer.EndTask("Restore selection and top position");
// Update the Notes and Symbols windows. References should refresh automatically
// when the selection is restored.
mReanalysisTimer.StartTask("Populate Notes and Symbols");
PopulateNotesList();
PopulateSymbolsList();
mReanalysisTimer.EndTask("Populate Notes and Symbols");
mReanalysisTimer.EndTask("ProjectView.ApplyChanges()");

View File

@ -216,4 +216,31 @@
</Rectangle>
</Viewbox>
</ControlTemplate>
<ControlTemplate x:Key="icon_DomainType">
<!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="16" Height="16">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M0,14L16,14 16,0.999000000000001 0,0.999000000000001z" />
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M13.0801,9.0723C13.0061,9.2573 12.8911,9.4183 12.7341,9.5553 12.5801,9.6943 12.3831,9.8023 12.1421,9.8813 11.9021,9.9613 11.6151,10.0003 11.2851,10.0003 11.1641,10.0003 11.0411,9.9943 10.9181,9.9803 10.7971,9.9683 10.6801,9.9513 10.5661,9.9283 10.4531,9.9063 10.3481,9.8793 10.2501,9.8473 10.1541,9.8163 10.0701,9.7833 10.0001,9.7483L10.0001,8.7863C10.0841,8.8463 10.1761,8.9003 10.2711,8.9463 10.3691,8.9943 10.4691,9.0323 10.5701,9.0623 10.6741,9.0933 10.7771,9.1153 10.8811,9.1313 10.9841,9.1463 11.0821,9.1533 11.1761,9.1533 11.4691,9.1533 11.6911,9.0913 11.8461,8.9663 12.0021,8.8423 12.0781,8.6743 12.0781,8.4643 12.0781,8.3443 12.0511,8.2413 11.9961,8.1523 11.9411,8.0643 11.8651,7.9913 11.7671,7.9333 11.6701,7.8773 11.5531,7.8343 11.4181,7.8053 11.2831,7.7783 11.1351,7.7633 10.9761,7.7633L10.5251,7.7633 10.5251,6.9173 10.9411,6.9173C11.1151,6.9173 11.2621,6.9013 11.3871,6.8683 11.5101,6.8363 11.6111,6.7903 11.6911,6.7313 11.7731,6.6743 11.8321,6.6043 11.8711,6.5253 11.9101,6.4463 11.9281,6.3593 11.9281,6.2663 11.9281,6.1773 11.9141,6.0963 11.8851,6.0213 11.8551,5.9473 11.8101,5.8823 11.7481,5.8273 11.6871,5.7723 11.6071,5.7293 11.5121,5.6993 11.4161,5.6703 11.3031,5.6533 11.1701,5.6533 11.0741,5.6533 10.9801,5.6633 10.8871,5.6813 10.7951,5.7013 10.7071,5.7253 10.6251,5.7553 10.5431,5.7863 10.4651,5.8203 10.3911,5.8583 10.3161,5.8973 10.2501,5.9373 10.1891,5.9793L10.1891,5.0763C10.2461,5.0493 10.3141,5.0183 10.3961,4.9873 10.4781,4.9563 10.5701,4.9263 10.6761,4.8993 10.7811,4.8733 10.8961,4.8513 11.0191,4.8353 11.1441,4.8193 11.2791,4.8103 11.4221,4.8103 11.7151,4.8103 11.9651,4.8463 12.1701,4.9213 12.3751,4.9943 12.5411,5.0913 12.6681,5.2083 12.7971,5.3263 12.8891,5.4593 12.9471,5.6063 13.0061,5.7553 13.0351,5.9053 13.0351,6.0563 13.0351,6.1993 13.0161,6.3343 12.9801,6.4643 12.9431,6.5933 12.8871,6.7123 12.8071,6.8213 12.7281,6.9293 12.6251,7.0233 12.5001,7.1043 12.3771,7.1843 12.2261,7.2463 12.0511,7.2883L12.0511,7.3053C12.2341,7.3293 12.3981,7.3753 12.5411,7.4453 12.6841,7.5153 12.8031,7.6023 12.8981,7.7063 12.9941,7.8103 13.0661,7.9283 13.1171,8.0593 13.1661,8.1913 13.1911,8.3313 13.1911,8.4773 13.1911,8.6903 13.1541,8.8883 13.0801,9.0723 M9.3031,9.0843L9.3031,10.0003 6.0001,10.0003 6.0001,9.1393 7.4381,7.7643C7.5901,7.6203 7.7171,7.4893 7.8201,7.3723 7.9221,7.2563 8.0051,7.1473 8.0661,7.0473 8.1281,6.9473 8.1721,6.8503 8.1971,6.7583 8.2241,6.6663 8.2361,6.5713 8.2361,6.4723 8.2361,6.3713 8.2201,6.2773 8.1871,6.1913 8.1541,6.1063 8.1061,6.0343 8.0431,5.9723 7.9801,5.9123 7.9021,5.8653 7.8081,5.8313 7.7131,5.7983 7.6031,5.7803 7.4801,5.7803 7.3611,5.7803 7.2461,5.7943 7.1341,5.8203 7.0211,5.8473 6.9141,5.8843 6.8091,5.9323 6.7031,5.9803 6.6031,6.0353 6.5111,6.0963 6.4181,6.1593 6.3301,6.2243 6.2481,6.2953L6.2481,5.3213C6.3231,5.2723 6.4121,5.2233 6.5161,5.1753 6.6191,5.1263 6.7351,5.0813 6.8631,5.0403 6.9901,5.0003 7.1251,4.9673 7.2701,4.9423 7.4151,4.9183 7.5641,4.9053 7.7191,4.9053 7.9961,4.9053 8.2361,4.9423 8.4411,5.0153 8.6441,5.0893 8.8131,5.1903 8.9461,5.3183 9.0801,5.4473 9.1781,5.5983 9.2421,5.7713 9.3071,5.9453 9.3381,6.1323 9.3381,6.3293 9.3381,6.4793 9.3201,6.6263 9.2841,6.7703 9.2481,6.9163 9.1881,7.0603 9.1051,7.2083 9.0231,7.3543 8.9161,7.5063 8.7831,7.6613 8.6521,7.8163 8.4901,7.9773 8.2991,8.1453L7.2671,9.0623 7.2671,9.0843z M5.1411,10.0003L4.0621,10.0003 4.0671,6.0013 3.0951,6.2113 3.0001,6.2113 3.0001,5.3363 5.1411,4.9043z M2.0001,12.0003L14.0001,12.0003 14.0001,3.0003 2.0001,3.0003z M2.0001,3.0003" />
<GeometryDrawing Brush="#FF414141" Geometry="F1M14,12L2,12 2,3 14,3z M1,13L15,13 15,2 1,2z" />
<GeometryDrawing Brush="#FF414141" Geometry="F1M8.2988,8.1455C8.4898,7.9775 8.6528,7.8165 8.7828,7.6615 8.9158,7.5055 9.0238,7.3545 9.1058,7.2075 9.1888,7.0605 9.2478,6.9165 9.2838,6.7705 9.3198,6.6255 9.3378,6.4795 9.3378,6.3295 9.3378,6.1315 9.3068,5.9455 9.2418,5.7715 9.1778,5.5985 9.0798,5.4475 8.9458,5.3185 8.8138,5.1905 8.6448,5.0885 8.4418,5.0155 8.2358,4.9425 7.9958,4.9055 7.7188,4.9055 7.5648,4.9055 7.4148,4.9175 7.2708,4.9425 7.1248,4.9665 6.9898,4.9995 6.8628,5.0405 6.7358,5.0815 6.6188,5.1255 6.5158,5.1745 6.4118,5.2235 6.3228,5.2725 6.2478,5.3215L6.2478,6.2945C6.3298,6.2245 6.4178,6.1595 6.5108,6.0965 6.6038,6.0355 6.7028,5.9805 6.8088,5.9325 6.9138,5.8845 7.0218,5.8475 7.1338,5.8205 7.2458,5.7935 7.3608,5.7805 7.4808,5.7805 7.6038,5.7805 7.7128,5.7975 7.8078,5.8315 7.9028,5.8655 7.9808,5.9125 8.0428,5.9725 8.1068,6.0345 8.1538,6.1065 8.1878,6.1915 8.2198,6.2775 8.2358,6.3715 8.2358,6.4725 8.2358,6.5715 8.2238,6.6665 8.1968,6.7575 8.1718,6.8505 8.1278,6.9475 8.0668,7.0465 8.0048,7.1475 7.9218,7.2555 7.8198,7.3725 7.7168,7.4895 7.5898,7.6205 7.4388,7.7645L5.9998,9.1395 5.9998,9.9995 9.3028,9.9995 9.3028,9.0835 7.2668,9.0835 7.2668,9.0625z" />
<GeometryDrawing Brush="#FF414141" Geometry="F1M12.8984,7.7061C12.8024,7.6021 12.6834,7.5161 12.5414,7.4451 12.3984,7.3751 12.2344,7.3291 12.0504,7.3061L12.0504,7.2881C12.2264,7.2461 12.3774,7.1851 12.5004,7.1041 12.6254,7.0231 12.7284,6.9301 12.8064,6.8211 12.8864,6.7121 12.9434,6.5941 12.9804,6.4641 13.0154,6.3341 13.0354,6.1991 13.0354,6.0571 13.0354,5.9051 13.0054,5.7551 12.9474,5.6061 12.8884,5.4591 12.7964,5.3261 12.6684,5.2081 12.5414,5.0911 12.3754,4.9941 12.1694,4.9211 11.9644,4.8471 11.7144,4.8101 11.4214,4.8101 11.2794,4.8101 11.1444,4.8191 11.0194,4.8351 10.8964,4.8521 10.7814,4.8731 10.6754,4.8991 10.5704,4.9271 10.4784,4.9561 10.3964,4.9871 10.3144,5.0181 10.2464,5.0491 10.1894,5.0761L10.1894,5.9791C10.2504,5.9371 10.3164,5.8971 10.3904,5.8581 10.4644,5.8201 10.5434,5.7861 10.6254,5.7551 10.7074,5.7261 10.7944,5.7011 10.8864,5.6821 10.9804,5.6631 11.0744,5.6531 11.1694,5.6531 11.3024,5.6531 11.4164,5.6701 11.5114,5.6991 11.6074,5.7291 11.6874,5.7721 11.7484,5.8271 11.8104,5.8821 11.8554,5.9471 11.8844,6.0211 11.9144,6.0971 11.9274,6.1781 11.9274,6.2671 11.9274,6.3591 11.9104,6.4461 11.8714,6.5251 11.8324,6.6041 11.7734,6.6741 11.6914,6.7311 11.6114,6.7901 11.5094,6.8361 11.3864,6.8681 11.2614,6.9011 11.1154,6.9171 10.9414,6.9171L10.5254,6.9171 10.5254,7.7641 10.9764,7.7641C11.1344,7.7641 11.2834,7.7781 11.4184,7.8061 11.5524,7.8341 11.6694,7.8771 11.7674,7.9341 11.8654,7.9911 11.9414,8.0641 11.9964,8.1521 12.0504,8.2411 12.0784,8.3451 12.0784,8.4641 12.0784,8.6741 12.0024,8.8421 11.8454,8.9661 11.6914,9.0911 11.4684,9.1531 11.1754,9.1531 11.0824,9.1531 10.9844,9.1461 10.8804,9.1311 10.7774,9.1151 10.6734,9.0931 10.5704,9.0621 10.4684,9.0321 10.3694,8.9941 10.2714,8.9461 10.1754,8.9001 10.0844,8.8471 10.0004,8.7861L10.0004,9.7481C10.0704,9.7831 10.1544,9.8161 10.2504,9.8481 10.3474,9.8791 10.4534,9.9061 10.5664,9.9291 10.6794,9.9511 10.7964,9.9691 10.9184,9.9801 11.0414,9.9941 11.1644,10.0001 11.2854,10.0001 11.6154,10.0001 11.9024,9.9611 12.1424,9.8811 12.3824,9.8031 12.5804,9.6941 12.7344,9.5561 12.8904,9.4181 13.0054,9.2571 13.0804,9.0721 13.1544,8.8891 13.1914,8.6901 13.1914,8.4771 13.1914,8.3311 13.1664,8.1911 13.1174,8.0601 13.0664,7.9291 12.9944,7.8101 12.8984,7.7061" />
<GeometryDrawing Brush="#FF414141" Geometry="F1M3,6.2109L3.095,6.2109 4.067,6.0009 4.063,9.9999 5.141,9.9999 5.141,4.9039 3,5.3359z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</ControlTemplate>
</ResourceDictionary>

View File

@ -60,8 +60,8 @@ opcode, operand, and comment), like assembly source code does. The
"Disassembly" format adds the address and bytes on the left. Use
the "All Columns" format to get all columns.</p>
<p>When "show cycle counts in comments" is checked, every instruction line
will have an end-of-line comment that indicates the number of cycles
<p>When "show cycle counts for instructions" is checked, every instruction
line will have an end-of-line comment that indicates the number of cycles
required for that instruction. If the cycle count can't be determined
solely from a static analysis, e.g. an extra cycle is required if
<code>LDA (dp),Y</code> crosses a page boundary, a '+' will be shown.

View File

@ -492,7 +492,7 @@ automatically.</p>
<p>Let's pause briefly to look at the cycle-count feature. Use
Edit &gt; Settings to open the app settings panel. In the "miscellaneous"
group on the right side, click the "Show cycle counts in comments"
checkbox, then click "OK".</p>
checkbox, then click "OK". (There's also a toolbar button for this.)</p>
<p>Every line with an instruction now has a cycle count on it. The cycle
counts are adjusted for everything SourceGen can figure out. For example,
the BEQ on line $205a shows "2+" cycles, meaning that it takes at least two

View File

@ -129,7 +129,7 @@ limitations under the License.
<GroupBox Grid.Column="2" Grid.Row="1" Header="Miscellaneous"
Margin="10,0,0,0" Padding="2,4">
<StackPanel>
<CheckBox Content="Show cycle counts in comments" Margin="0,4"
<CheckBox Content="Show cycle counts for instructions" Margin="0,4"
IsChecked="{Binding ShowCycleCountsScreen}"/>
<CheckBox Content="Use &quot;dark&quot; color scheme" Margin="0,4"
IsChecked="{Binding DarkColorScheme}"/>

View File

@ -519,6 +519,9 @@ limitations under the License.
<Button Command="Copy" ToolTip="Copy to clipboard (Ctrl+C)">
<ContentControl Template="{StaticResource icon_CopyToClipboard}"/>
</Button>
<CheckBox IsChecked="{Binding DoShowCycleCounts}" ToolTip="Toggle display of cycle counts">
<ContentControl Template="{StaticResource icon_DomainType}"/>
</CheckBox>
<Separator/>
<Button Command="Help" ToolTip="Help - open manual in browser (F1)">
<ContentControl Template="{StaticResource icon_F1Help}"/>

View File

@ -84,6 +84,23 @@ namespace SourceGen.WpfGui {
}
private double mLongCommentWidth;
/// <summary>
/// Property backing the "show cycle counts" button in the toolbar.
/// </summary>
public bool DoShowCycleCounts {
get { return AppSettings.Global.GetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS, false); }
set {
// We get called when app settings change, so we have to be a little careful to
// avoid an infinite loop. We need to be called to keep the toolbar in sync.
bool curVal = AppSettings.Global.GetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS, false);
if (curVal != value) {
AppSettings.Global.SetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS, value);
mMainCtrl.ApplyAppSettings();
}
OnPropertyChanged();
}
}
/// <summary>
/// Set to true if the DEBUG menu should be visible on the main menu strip.
/// </summary>