1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-12 23:29:32 +00:00

Split "show cycle counts" in two

The "show cycle counts in comments" setting is the only one that
affects both the on-screen display and generated source code.  This
felt a little weird, so it's now two independent settings.  This
also provided an opportunity to move it to the initial tab, so it's
easier to toggle on and off.  Overall it feels less confusing to have
two settings for essentially the same thing, because code generation
is distinct from everything else.

The "spaces between bytes" setting was moved to the Display Format
tab, which seems a better fit.

Documentation and tutorial have been updated.

Also did a little bit of cleanup in EditAppSettings.
This commit is contained in:
Andy McFadden 2020-08-27 13:13:58 -07:00
parent 575b4f25a7
commit 69a9e98a43
6 changed files with 55 additions and 49 deletions

View File

@ -55,7 +55,6 @@ namespace SourceGen {
public const string FMT_UPPER_OPERAND_S = "fmt-upper-operand-s";
public const string FMT_UPPER_OPERAND_XY = "fmt-upper-operand-xy";
public const string FMT_ADD_SPACE_FULL_COMMENT = "fmt-add-space-full-comment";
public const string FMT_SPACES_BETWEEN_BYTES = "fmt-spaces-between-bytes";
public const string FMT_OPERAND_WRAP_LEN = "fmt-operand-wrap-len";
public const string FMT_OPCODE_SUFFIX_ABS = "fmt-opcode-suffix-abs";
@ -69,7 +68,9 @@ namespace SourceGen {
public const string FMT_STRING_DELIM = "fmt-string-delim";
public const string FMT_NON_UNIQUE_LABEL_PREFIX = "fmt-non-unique-label-prefix";
public const string FMT_LOCAL_VARIABLE_PREFIX = "fmt-local-variable-prefix";
public const string FMT_SPACES_BETWEEN_BYTES = "fmt-spaces-between-bytes";
public const string FMT_COMMA_SEP_BULK_DATA = "fmt-comma-sep-bulk-data";
public const string FMT_SHOW_CYCLE_COUNTS = "fmt-show-cycle-counts";
public const string CLIP_LINE_FORMAT = "clip-line-format";

View File

@ -437,7 +437,7 @@ namespace SourceGen {
mLineList = new List<Line>();
mFormattedLineCache = new FormattedOperandCache();
mShowCycleCounts = AppSettings.Global.GetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS,
mShowCycleCounts = AppSettings.Global.GetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS,
false);
mLvLookup = new LocalVariableLookup(mProject.LvTables, mProject, null, false, false);
@ -454,7 +454,7 @@ namespace SourceGen {
mDisplayList.Clear();
// We probably just changed settings, so update this as well.
mShowCycleCounts = AppSettings.Global.GetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS,
mShowCycleCounts = AppSettings.Global.GetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS,
false);
}

View File

@ -60,10 +60,17 @@ 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>The "add spaces in bytes column" checkbox changes the format of the
hex data in the code list "bytes" column from dense (<code>20edfd</code>)
to spaced (<code>20 ed fd</code>). This also affects the format of
clipboard copies and exports.</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
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.
In some cases the variability can be factored out if the state of
certain status flags is known, e.g. 65C02 instructions that take longer
in decimal mode won't be shown as variable if the analyzer can determine
that D=0 or D=1. This checkbox enables display in the on-screen list, but
does not affect generated source code, which can be configured independently
on the Asm Config tab.</p>
<p>Check "use 'dark' color scheme" to change the main disassembly list
to use white text on a black background, and mute the Note highlight
@ -131,6 +138,11 @@ automatically switches to "custom" when you edit a field.
(64tass and ACME use the "common"
expression style, cc65 and Merlin 32 have their own unique styles.)</p>
<p>The "add spaces in Bytes column" checkbox changes the format of the
hex data in the code list "bytes" column from dense (<code>20edfd</code>)
to spaced (<code>20 ed fd</code>). This also affects the format of
clipboard copies and exports.</p>
<p>The "comma-separated format for bulk data" determines whether large
blocks of hex look like <code>ABC123</code> or
<code>$AB,$C1,$23</code>. The former reduces the number of lines
@ -183,16 +195,10 @@ not hard stops: if the contents of a field are too wide, the contents
of the next column will be pushed over. (The comment field width is
not currently being used, but may be used to fold lines in the future.)</p>
<p>When "show cycle counts" is checked, every instruction line will have
an end-of-line comment that indicates the number of cycles required for
that instruction. This is shown in the code list and included in
generated assembly output. 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.
In some cases the variability can be factored out if the state of
certain status flags is known, e.g. 65C02 instructions that take longer
in decimal mode won't be shown as variable if the analyzer can determine
that D=0 or D=1.</p>
<p>When "show cycle counts in comments" is checked, cycle counts are
inserted into end-of-line comments. This works the same as the option
in the Code View tab, but applies to generated source code rather than
the on-screen display.</p>
<p>If "put long labels on separate line" is checked, labels that are
longer than the label column are placed on their own line. This looks

View File

@ -490,8 +490,9 @@ to STRADDR. The symbol parts in the operands at $203d and $2041 update
automatically.</p>
<p>Let's pause briefly to look at the cycle-count feature. Use
Edit &gt; Settings to open the app settings panel, then select the
Asm Config tab. Click the "Show cycle counts" checkbox, then click "OK".</p>
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>
<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
@ -505,7 +506,7 @@ Lower-case 'z' means the zero-flag is clear, upper-case 'Z' means it's
set. The analyzer determined that the flag was clear for instructions
following the <code>BEQ</code> because the branch wasn't taken.)</p>
<p>The cycle-count comments are included in assembled output as well. If
<p>The cycle-count comments can be added to generated code as well. If
you add an end-of-line comment, it appears after the cycle count.
(Try it.)</p>
<p>Hit Ctrl+S to save your project. Make that a habit.</p>

View File

@ -129,10 +129,10 @@ 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"
IsChecked="{Binding ShowCycleCountsScreen}"/>
<CheckBox Content="Use &quot;dark&quot; color scheme" Margin="0,4"
IsChecked="{Binding DarkColorScheme}"/>
<CheckBox Content="Add spaces in bytes column" Margin="0,4"
IsChecked="{Binding SpacesBetweenBytes}"/>
</StackPanel>
</GroupBox>
@ -524,6 +524,9 @@ limitations under the License.
<DockPanel Grid.Column="2" Grid.Row="1" LastChildFill="False">
<CheckBox DockPanel.Dock="Top" Margin="4,12,0,0"
Content="Add spaces in Bytes column"
IsChecked="{Binding SpacesBetweenBytes}"/>
<CheckBox DockPanel.Dock="Top" Margin="4,8,0,0"
Content="Use comma-separated format for bulk data"
IsChecked="{Binding CommaSeparatedBulkData}"/>
@ -792,8 +795,8 @@ limitations under the License.
</GroupBox>
<TextBlock Text="General code generation:" Margin="4,16,0,0"/>
<CheckBox Content="Show cycle counts (also appears on screen)" Margin="4,8,0,0"
IsChecked="{Binding ShowCycleCounts}"/>
<CheckBox Content="Show cycle counts in comments" Margin="4,8,0,0"
IsChecked="{Binding ShowCycleCountsAsm}"/>
<CheckBox Content="Put long labels on separate line" Margin="4,8,0,0"
IsChecked="{Binding LongLabelNewLine}"/>
<CheckBox Content="Identify assembler in output" Margin="4,8,0,0"

View File

@ -275,7 +275,6 @@ namespace SourceGen.WpfGui {
clipboardFormatComboBox.SelectedIndex = clipIndex;
}
SpacesBetweenBytes = mSettings.GetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, false);
EnableDebugMenu = mSettings.GetBool(AppSettings.DEBUG_MENU_ENABLED, false);
}
@ -407,15 +406,14 @@ namespace SourceGen.WpfGui {
IsDirty = true;
}
public bool SpacesBetweenBytes {
get { return mSettings.GetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, false); }
public bool ShowCycleCountsScreen {
get { return mSettings.GetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS, false); }
set {
mSettings.SetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, value);
mSettings.SetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS, value);
OnPropertyChanged();
IsDirty = true;
}
}
public bool DarkColorScheme {
get { return mSettings.GetBool(AppSettings.SKIN_DARK_COLOR_SCHEME, false); }
set {
@ -625,7 +623,7 @@ namespace SourceGen.WpfGui {
}
// checkboxes
public bool ShowCycleCounts {
public bool ShowCycleCountsAsm {
get { return mSettings.GetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS, false); }
set {
mSettings.SetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS, value);
@ -656,13 +654,6 @@ namespace SourceGen.WpfGui {
Debug.Assert(mInitialAsmId == AssemblerInfo.Id.Unknown);
asmConfigComboBox.SelectedIndex = 0;
}
ShowCycleCounts =
mSettings.GetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS, false);
LongLabelNewLine =
mSettings.GetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE, false);
AddIdentComment =
mSettings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false);
}
/// <summary>
@ -888,17 +879,23 @@ namespace SourceGen.WpfGui {
}
}
}
private bool mCommaSeparatedBulkData;
public bool CommaSeparatedBulkData {
get { return mCommaSeparatedBulkData; }
// These are not subject to the "quick set" feature.
public bool SpacesBetweenBytes {
get { return mSettings.GetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, false); }
set {
if (mCommaSeparatedBulkData != value) {
mCommaSeparatedBulkData = value;
OnPropertyChanged();
mSettings.SetBool(AppSettings.FMT_COMMA_SEP_BULK_DATA, value);
UpdateDisplayFormatQuickCombo();
IsDirty = true;
}
mSettings.SetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, value);
OnPropertyChanged();
IsDirty = true;
}
}
public bool CommaSeparatedBulkData {
get { return mSettings.GetBool(AppSettings.FMT_COMMA_SEP_BULK_DATA, true); }
set {
mSettings.SetBool(AppSettings.FMT_COMMA_SEP_BULK_DATA, value);
OnPropertyChanged();
IsDirty = true;
}
}
@ -1033,8 +1030,6 @@ namespace SourceGen.WpfGui {
mSettings.GetString(AppSettings.FMT_NON_UNIQUE_LABEL_PREFIX, string.Empty);
LocalVarPrefix =
mSettings.GetString(AppSettings.FMT_LOCAL_VARIABLE_PREFIX, string.Empty);
CommaSeparatedBulkData =
mSettings.GetBool(AppSettings.FMT_COMMA_SEP_BULK_DATA, false);
string exprMode = mSettings.GetString(AppSettings.FMT_EXPRESSION_MODE, string.Empty);
ExpressionMode mode;