1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-10-31 19:04:44 +00:00

Add "omit implicit acc operand" feature

By default, implicit acc operands are shown, e.g. "LSR A" rather
than just "LSR".  I like showing operands for instructions that
have multiple address modes.

Not everyone agrees, so now it's a setting.  They're shown by default,
but enabling the option will strip them on-screen, in generated
assembly, and in the instruction chart.

They are always omitted for ACME output, which doesn't allow them.

(issue #162)
This commit is contained in:
Andy McFadden 2024-09-15 13:29:04 -07:00
parent 6c2eee806b
commit ec9017cbc3
8 changed files with 28 additions and 2 deletions

View File

@ -129,6 +129,7 @@ namespace SourceGen {
public const string SRCGEN_ADD_IDENT_COMMENT = "srcgen-add-ident-comment";
public const string SRCGEN_LABEL_NEW_LINE = "srcgen-label-new-line";
public const string SRCGEN_SHOW_CYCLE_COUNTS = "srcgen-show-cycle-counts";
public const string SRCGEN_OMIT_IMPLIED_ACC_OPERAND = "srcgen-omit-implied-acc-operand";
// Label file generation settings.
public const string LABGEN_FORMAT = "labgen-format";

View File

@ -230,7 +230,7 @@ namespace SourceGen.AsmGen {
/// Configures the assembler-specific format items.
/// </summary>
private void SetFormatConfigValues(ref Formatter.FormatConfig config) {
config.SuppressImpliedAcc = true;
config.SuppressImpliedAcc = true; // implied acc not allowed
config.OperandWrapLen = 64;
config.ForceDirectOpcodeSuffix = "+1";

View File

@ -512,6 +512,8 @@ namespace SourceGen.AsmGen {
settings.GetBool(AppSettings.FMT_ADD_SPACE_FULL_COMMENT, true);
config.OperandWrapLen =
settings.GetInt(AppSettings.FMT_OPERAND_WRAP_LEN, 0);
config.SuppressImpliedAcc =
settings.GetBool(AppSettings.SRCGEN_OMIT_IMPLIED_ACC_OPERAND, false);
config.ForceAbsOpcodeSuffix =
settings.GetString(AppSettings.FMT_OPCODE_SUFFIX_ABS, string.Empty);

View File

@ -508,6 +508,8 @@ namespace SourceGen {
settings.GetString(AppSettings.FMT_LOCAL_VARIABLE_PREFIX, string.Empty);
mFormatterConfig.CommaSeparatedDense =
settings.GetBool(AppSettings.FMT_COMMA_SEP_BULK_DATA, true);
mFormatterConfig.SuppressImpliedAcc =
settings.GetBool(AppSettings.SRCGEN_OMIT_IMPLIED_ACC_OPERAND, false);
mFormatterConfig.DebugLongComments = DebugLongComments;
string chrDelCereal = settings.GetString(AppSettings.FMT_CHAR_DELIM, null);

View File

@ -456,6 +456,8 @@ namespace SourceGen.Tests {
// This could be on or off. Off seems less distracting.
settings.SetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS, false);
settings.SetBool(AppSettings.SRCGEN_OMIT_IMPLIED_ACC_OPERAND, false);
IEnumerator<AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
while (iter.MoveNext()) {
AssemblerInfo.Id asmId = iter.Current.AssemblerId;

View File

@ -845,6 +845,8 @@ limitations under the License.
IsChecked="{Binding ShowCycleCountsAsm}"/>
<CheckBox Content="Identify assembler in output" Margin="0,4,0,0"
IsChecked="{Binding AddIdentComment}"/>
<CheckBox Content="Omit implied accumulator operands if allowed" Margin="0,4,0,0"
IsChecked="{Binding OmitImpliedAccOperand}"/>
<StackPanel Orientation="Vertical" Margin="0,6,0,0">
<TextBlock Text="Put labels on their own line..."/>
<RadioButton GroupName="labelLineGroup" Margin="4,4,0,0"

View File

@ -803,6 +803,14 @@ namespace SourceGen.WpfGui {
IsDirty = true;
}
}
public bool OmitImpliedAccOperand {
get { return mSettings.GetBool(AppSettings.SRCGEN_OMIT_IMPLIED_ACC_OPERAND, false); }
set {
mSettings.SetBool(AppSettings.SRCGEN_OMIT_IMPLIED_ACC_OPERAND, value);
OnPropertyChanged();
IsDirty = true;
}
}
// label placement radio buttons
public bool LabelPlacement_PreferSameLine {

View File

@ -214,7 +214,7 @@ 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>The Code Generation Settings affect all assemblers.</p>
<p>The next section, Code Generation Settings, affects all assemblers.</p>
<p>When <samp>show cycle counts in comments</samp> is checked, cycle
counts are inserted into end-of-line comments. This works the same as
@ -229,6 +229,15 @@ file is sent to other people, since it may not otherwise be obvious from
the source file what the intended target assembler is, or what options
are required to process the file correctly.</p>
<p>Some 6502 instructions have an "implied" accumulator address mode, e.g.
<code>LSR</code> and <code>ASL</code>. The operand may be shown as
"<code>A</code>" to make the address mode explicit, but it can also be
omitted. Some assemblers require it to be present, some require it to be
absent, most allow either. By default, the operand is shown, but enabling
<samp>omit implied accumulator operands if allowed</samp> will cause it to
be omitted on-screen, in the instruction chart, and in source generated for
assemblers that don't require it to be present.</p>
<p>Labels can generally be placed either on the same line as a code or data
operand, or on the line before it. Placing them on the same line makes
the output a bit more compact, but if the label is longer than the label