From 69a9e98a436d47d2ac6078a97783f55ee42c99c5 Mon Sep 17 00:00:00 2001
From: Andy McFadden
Date: Thu, 27 Aug 2020 13:13:58 -0700
Subject: [PATCH] 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.
---
SourceGen/AppSettings.cs | 3 +-
SourceGen/LineListGen.cs | 4 +-
SourceGen/RuntimeData/Help/settings.html | 34 ++++++++++-------
SourceGen/RuntimeData/Help/tutorials.html | 7 ++--
SourceGen/WpfGui/EditAppSettings.xaml | 11 ++++--
SourceGen/WpfGui/EditAppSettings.xaml.cs | 45 ++++++++++-------------
6 files changed, 55 insertions(+), 49 deletions(-)
diff --git a/SourceGen/AppSettings.cs b/SourceGen/AppSettings.cs
index 83a7adc..f6851e3 100644
--- a/SourceGen/AppSettings.cs
+++ b/SourceGen/AppSettings.cs
@@ -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";
diff --git a/SourceGen/LineListGen.cs b/SourceGen/LineListGen.cs
index 851112a..482f20d 100644
--- a/SourceGen/LineListGen.cs
+++ b/SourceGen/LineListGen.cs
@@ -437,7 +437,7 @@ namespace SourceGen {
mLineList = new List();
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);
}
diff --git a/SourceGen/RuntimeData/Help/settings.html b/SourceGen/RuntimeData/Help/settings.html
index c5aa5c2..16462a1 100644
--- a/SourceGen/RuntimeData/Help/settings.html
+++ b/SourceGen/RuntimeData/Help/settings.html
@@ -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.
-The "add spaces in bytes column" checkbox changes the format of the
-hex data in the code list "bytes" column from dense (20edfd
)
-to spaced (20 ed fd
). This also affects the format of
-clipboard copies and exports.
+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
+LDA (dp),Y
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.
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.)
+The "add spaces in Bytes column" checkbox changes the format of the
+hex data in the code list "bytes" column from dense (20edfd
)
+to spaced (20 ed fd
). This also affects the format of
+clipboard copies and exports.
+
The "comma-separated format for bulk data" determines whether large
blocks of hex look like ABC123
or
$AB,$C1,$23
. 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.)
-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
-LDA (dp),Y
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.
+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.
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
diff --git a/SourceGen/RuntimeData/Help/tutorials.html b/SourceGen/RuntimeData/Help/tutorials.html
index d160412..4f98b50 100644
--- a/SourceGen/RuntimeData/Help/tutorials.html
+++ b/SourceGen/RuntimeData/Help/tutorials.html
@@ -490,8 +490,9 @@ to STRADDR. The symbol parts in the operands at $203d and $2041 update
automatically.
Let's pause briefly to look at the cycle-count feature. Use
-Edit > Settings to open the app settings panel, then select the
-Asm Config tab. Click the "Show cycle counts" checkbox, then click "OK".
+Edit > 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".
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 BEQ
because the branch wasn't taken.)
-The cycle-count comments are included in assembled output as well. If
+
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.)
Hit Ctrl+S to save your project. Make that a habit.
diff --git a/SourceGen/WpfGui/EditAppSettings.xaml b/SourceGen/WpfGui/EditAppSettings.xaml
index 16f11b9..5139237 100644
--- a/SourceGen/WpfGui/EditAppSettings.xaml
+++ b/SourceGen/WpfGui/EditAppSettings.xaml
@@ -129,10 +129,10 @@ limitations under the License.
+
-
@@ -524,6 +524,9 @@ limitations under the License.
+
@@ -792,8 +795,8 @@ limitations under the License.
-
+
@@ -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;