1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-01-13 00:29:44 +00:00

Use '*' for full-line Merlin comments

While it's okay to use ';', the classic Merlin editor will treat it
as an end-of-line comment and shove the entire thing off to the right
side of the screen.

This adds a configuration item to the app settings, with a default
value of ';'.
This commit is contained in:
Andy McFadden 2024-06-26 08:27:45 -07:00
parent 18674e6627
commit 9784ad043e
25 changed files with 109 additions and 58 deletions

View File

@ -62,6 +62,7 @@ namespace SourceGen {
public const string FMT_OPERAND_PREFIX_ABS = "fmt-operand-prefix-abs";
public const string FMT_OPERAND_PREFIX_LONG = "fmt-operand-prefix-long";
public const string FMT_EXPRESSION_MODE = "fmt-expression-mode";
public const string FMT_FULL_COMMENT_DELIM = "fmt-full-comment-delim";
public const string FMT_PSEUDO_OP_NAMES = "fmt-pseudo-op-names";
public const string FMT_CHAR_DELIM = "fmt-char-delim";

View File

@ -201,7 +201,7 @@ namespace SourceGen.AsmGen {
config.ForceLongOperandPrefix = string.Empty;
config.LocalVariableLabelPrefix = "]";
config.EndOfLineCommentDelimiter = ";";
config.FullLineCommentDelimiterBase = ";";
config.FullLineCommentDelimiterBase = "*";
config.BoxLineCommentDelimiter = string.Empty;
config.NonUniqueLabelPrefix = ":";
config.CommaSeparatedDense = false;

View File

@ -525,6 +525,9 @@ namespace SourceGen.AsmGen {
string exprMode = settings.GetString(AppSettings.FMT_EXPRESSION_MODE, string.Empty);
config.ExprMode = Formatter.FormatConfig.ParseExpressionMode(exprMode);
config.FullLineCommentDelimiterBase =
settings.GetString(AppSettings.FMT_FULL_COMMENT_DELIM, ";");
// Not doing the delimiter patterns here, because what's in the config file is
// intended for on-screen display, and hence likely to be unsuited for an assembler.

View File

@ -241,6 +241,9 @@ namespace SourceGen {
sb.Append(";varPfx='");
sb.Append(mFormatter.Config.LocalVariableLabelPrefix);
sb.Append('\'');
sb.Append(";flcd='");
sb.Append(mFormatter.Config.FullLineCommentDelimiterBase);
sb.Append('\'');
sb.Append(";labelBrk=");
sb.Append(LongLabelNewLine.ToString());
sb.Append(";notes=");

View File

@ -493,7 +493,6 @@ namespace SourceGen {
AsmGen.GenCommon.ConfigureFormatterFromSettings(AppSettings.Global,
ref mFormatterConfig);
mFormatterConfig.EndOfLineCommentDelimiter = ";";
mFormatterConfig.FullLineCommentDelimiterBase = ";";
mFormatterConfig.BoxLineCommentDelimiter = string.Empty;
mFormatterConfig.NonUniqueLabelPrefix =

View File

@ -1,6 +1,6 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":4,
"_ContentVersion":6,
"FileDataLength":23,
"FileDataCrc32":-1829154192,
"ProjectProps":{
@ -25,7 +25,12 @@
"AddressMap":[{
"Offset":0,
"Addr":4096}],
"Addr":4096,
"Length":-1024,
"PreLabel":"",
"DisallowInward":false,
"DisallowOutward":false,
"IsRelative":false}],
"TypeHints":[{
"Low":0,
"High":0,
@ -37,11 +42,7 @@
},
"LongComments":{
"-2147483647":{
"Text":"6502bench SourceGen v1.7.3-dev2",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0}},
},
"Notes":{
},

View File

@ -1,5 +1,5 @@
;Project file was edited to get all big-endian data types, and to have an
;incorrect .junk alignment directive.
*Project file was edited to get all big-endian data types, and to have an
*incorrect .junk alignment directive.
org $1000
bit L1448
jsr L14A8
@ -70,7 +70,7 @@ UserLabel ds 8,$84
L1448 ds 8,$85
ds 16,$86
asc 8787878787878787
;long comment
*long comment
asc 8787878787878787
ds 16,$88
ds 8,$89

View File

@ -1,4 +1,4 @@
;Project file was edited to get zero-length strings and reverse DCI.
*Project file was edited to get zero-length strings and reverse DCI.
org $1000
rts

View File

@ -1,4 +1,4 @@
;Project file was edited to force ASCII formatting for some operands.
*Project file was edited to force ASCII formatting for some operands.
org $1000
lda $01
lda $0102

View File

@ -1,4 +1,4 @@
;Project file was edited to force ASCII formatting for some operands.
*Project file was edited to force ASCII formatting for some operands.
org $1000
clc
xce

View File

@ -1,5 +1,5 @@
;Project was edited to add a label in the middle of a dense hex region, and add
;a duplicate label.
*Project was edited to add a label in the middle of a dense hex region, and add
*a duplicate label.
BMI equ $30 ;opcode mnemonic
zip equ $cd
absl equ $1029

View File

@ -1,5 +1,5 @@
;Project was edited to add a label in the middle of a dense hex region, and add
;a duplicate label.
*Project was edited to add a label in the middle of a dense hex region, and add
*a duplicate label.
BMI equ $30 ;opcode mnemonic
zip equ $cd
absl equ $1029

View File

@ -1,4 +1,3 @@
;6502bench SourceGen v1.7.3-dev2
.cpu "65816"
* = $1000
.as

View File

@ -1,4 +1,3 @@
;6502bench SourceGen v1.7.3-dev2
!cpu 65816
* = $1000
!as

View File

@ -1,4 +1,3 @@
;6502bench SourceGen v1.7.3-dev2
.setcpu "65816"
.org $1000
.a8

View File

@ -1,4 +1,3 @@
;6502bench SourceGen v1.7.3-dev2
org $1000
nop
L1001 bit L1001

View File

@ -14,25 +14,25 @@
****************************************
plataddr equ $3000 ;address only in platform file
;Short, unboxed comment here!!
;Two spaces after. More hyp-
;hens?
*Short, unboxed comment here!!
*Two spaces after. More hyp-
*hens?
org $1000
lda #$01 ;Comment!
;Comment rulers can be helpful in findin the edges of notes. Comments are hyph-
;enatingly fun. Like the note, this goes out to 80 columns.
*Comment rulers can be helpful in findin the edges of notes. Comments are hyph-
*enatingly fun. Like the note, this goes out to 80 columns.
lda #$02 ;&another comment with &&s!
;Down to 64 columns this time. Why 64? Why not 64. A rose, by
;any other name, would break the line at the same place. Or hy-
;phen split.
*Down to 64 columns this time. Why 64? Why not 64. A rose, by
*any other name, would break the line at the same place. Or hy-
*phen split.
lda #$03
;Ah, the classic 40-column limitation...
;brings back memories. Of, you know, h-
;yphenated things.
*Ah, the classic 40-column limitation...
*brings back memories. Of, you know, h-
*yphenated things.
lda #$04
;Thirty columns. 'cause forty
;felt like too many. Oh, hyp-
;henation!
*Thirty columns. 'cause forty
*felt like too many. Oh, hyp-
*henation!
lda #$05 ;comment ending in backslash\
********************************************************************************
* Short box comment, 80 cols. *

View File

@ -1,4 +1,4 @@
;Projected edited to format non-char operands as chars.
*Projected edited to format non-char operands as chars.
org $1000
lda #'A'
lda #"A"

View File

@ -1,4 +1,4 @@
;Projected edited to format non-char operands as chars.
*Projected edited to format non-char operands as chars.
org $1000
lda #'A'
lda #"A"

View File

@ -1,4 +1,4 @@
;Projected edited to format non-char operands as chars.
*Projected edited to format non-char operands as chars.
org $1000
lda #'A'
lda #"A"

View File

@ -1,4 +1,4 @@
;Edited to have duplicate labels (PROJ_ZERO, DPCODE).
*Edited to have duplicate labels (PROJ_ZERO, DPCODE).
CONST_ZERO equ $f0 ;project const
PROJ_ZERO equ $00 ;project addr
@ -56,8 +56,8 @@ L103C lda #$fe
ldy $12
lda #$10
ora #$13
;Test name redefinition. This is mostly of interest for assemblers without
;redefinable variables, but also of interest to the cross-reference window.
*Test name redefinition. This is mostly of interest for assemblers without
*redefinable variables, but also of interest to the cross-reference window.
]PTR equ $20 ;#1
ldx ]PTR
]PTR equ $22 ;#2

View File

@ -1,4 +1,4 @@
;Edited to have duplicate labels (PROJ_ZERO, DPCODE).
*Edited to have duplicate labels (PROJ_ZERO, DPCODE).
CONST_ZERO equ $f0 ;project const
PROJ_ZERO equ $00 ;project addr
@ -56,8 +56,8 @@ L103C lda #$fe
ldy $12
lda (]CONST0,S),y
sta (]CONST0+3,S),y
;Test name redefinition. This is mostly of interest for assemblers without
;redefinable variables, but also of interest to the cross-reference window.
*Test name redefinition. This is mostly of interest for assemblers without
*redefinable variables, but also of interest to the cross-reference window.
]PTR equ $20 ;#1
ldx ]PTR
]PTR equ $22 ;#2

View File

@ -147,7 +147,7 @@ limitations under the License.
<TabItem Name="textDelimitersTab" Header="Text Delimiters">
<DockPanel LastChildFill="False">
<TextBlock DockPanel.Dock="Top" Margin="4,0,0,0"
Text="Select pseudo-op names for display. This does not affect source code generation. Blank entries get a default value."/>
Text="Configure character and string constant delimiters. This does not affect source code generation."/>
<Grid DockPanel.Dock="Top" Height="240" Margin="4,0">
@ -501,6 +501,14 @@ limitations under the License.
</StackPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,8,0,0">
<TextBlock Text="Full-line comment delimiter:"/>
<TextBox Width="14" MaxLength="1" Margin="8,1,0,0"
Text="{Binding FullLineCommentDelim, UpdateSourceTrigger=PropertyChanged,
FallbackValue=;}"
FontFamily="{StaticResource GeneralMonoFont}"/>
</StackPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="4,4,0,0">
<TextBlock Text="Non-unique label prefix:"/>
<TextBox Width="14" MaxLength="1" Margin="8,1,0,0"
Text="{Binding NonUniqueLabelPrefix, UpdateSourceTrigger=PropertyChanged,

View File

@ -1020,13 +1020,14 @@ namespace SourceGen.WpfGui {
OnPropertyChanged();
bool doSave = true;
if (value.Length > 0) {
char ch = value[0];
char ch = value[0]; // disallow A-Za-z_
doSave = !((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') ||
ch == '_');
}
if (doSave) {
mSettings.SetString(AppSettings.FMT_NON_UNIQUE_LABEL_PREFIX, value);
} else {
// Ignore the requested change.
// TODO(someday): add a validation rule
Debug.WriteLine("NOTE: quietly rejecting non-unique prefix '" +
value + "'");
@ -1036,6 +1037,34 @@ namespace SourceGen.WpfGui {
}
}
}
private string mFullLineCommentDelim;
public string FullLineCommentDelim {
get { return mFullLineCommentDelim; }
set {
if (mFullLineCommentDelim != value) {
mFullLineCommentDelim = value;
OnPropertyChanged();
bool doSave = true;
if (value.Length == 0) {
doSave = false; // don't allow this to be blank
} else {
char ch = value[0]; // disallow A-Za-z_
doSave = !((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') ||
ch == '_');
}
if (doSave) {
mSettings.SetString(AppSettings.FMT_FULL_COMMENT_DELIM, value);
} else {
// Ignore the requested change.
// TODO(someday): add a validation rule
Debug.WriteLine("NOTE: quietly rejecting full-line comment delim '" +
value + "'");
}
UpdateDisplayFormatQuickCombo();
IsDirty = true;
}
}
}
private string mLocalVarPrefix;
public string LocalVarPrefix {
get { return mLocalVarPrefix; }
@ -1133,14 +1162,15 @@ namespace SourceGen.WpfGui {
public string OperandPrefixAbs { get; private set; }
public string OperandPrefixLong { get; private set; }
public string NonUniqueLabelPrefix { get; private set; }
public string FullLineCommentDelim { get; private set; }
public string LocalVarPrefix { get; private set; }
public bool CommaSeparatedBulkData { get; private set; }
public ExpressionMode ExpressionStyle { get; private set; }
public DisplayFormatPreset(int id, string name, string opcSuffixAbs,
string opcSuffixLong, string operPrefixAbs, string operPrefixLong,
string nonUniqueLabelPrefix, string localVarPrefix, bool commaSepBulkData,
ExpressionMode expStyle) {
string nonUniqueLabelPrefix, string fullLineCommentDelim,
string localVarPrefix, bool commaSepBulkData, ExpressionMode expStyle) {
Ident = id;
Name = name;
OpcodeSuffixAbs = opcSuffixAbs;
@ -1148,6 +1178,7 @@ namespace SourceGen.WpfGui {
OperandPrefixAbs = operPrefixAbs;
OperandPrefixLong = operPrefixLong;
NonUniqueLabelPrefix = nonUniqueLabelPrefix;
FullLineCommentDelim = fullLineCommentDelim;
LocalVarPrefix = localVarPrefix;
CommaSeparatedBulkData = commaSepBulkData;
ExpressionStyle = expStyle;
@ -1160,11 +1191,11 @@ namespace SourceGen.WpfGui {
DisplayPresets = new DisplayFormatPreset[AssemblerList.Count + 2];
DisplayPresets[0] = new DisplayFormatPreset(DisplayFormatPreset.ID_CUSTOM,
(string)FindResource("str_PresetCustom"), string.Empty, string.Empty,
string.Empty, string.Empty, string.Empty, string.Empty, true,
string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, true,
ExpressionMode.Unknown);
DisplayPresets[1] = new DisplayFormatPreset(DisplayFormatPreset.ID_DEFAULT,
(string)FindResource("str_PresetDefault"), string.Empty, "l", "a:", "f:",
string.Empty, string.Empty, true, ExpressionMode.Common);
string.Empty, ";", string.Empty, true, ExpressionMode.Common);
for (int i = 0; i < AssemblerList.Count; i++) {
AssemblerInfo asmInfo = AssemblerList[i];
AsmGen.IGenerator gen = AssemblerInfo.GetGenerator(asmInfo.AssemblerId);
@ -1176,6 +1207,7 @@ namespace SourceGen.WpfGui {
asmInfo.Name, formatConfig.ForceAbsOpcodeSuffix,
formatConfig.ForceLongOpcodeSuffix, formatConfig.ForceAbsOperandPrefix,
formatConfig.ForceLongOperandPrefix, formatConfig.NonUniqueLabelPrefix,
formatConfig.FullLineCommentDelimiterBase,
formatConfig.LocalVariableLabelPrefix, formatConfig.CommaSeparatedDense,
formatConfig.ExprMode);
}
@ -1198,6 +1230,8 @@ namespace SourceGen.WpfGui {
mSettings.GetString(AppSettings.FMT_OPERAND_PREFIX_LONG, string.Empty);
NonUniqueLabelPrefix =
mSettings.GetString(AppSettings.FMT_NON_UNIQUE_LABEL_PREFIX, string.Empty);
FullLineCommentDelim =
mSettings.GetString(AppSettings.FMT_FULL_COMMENT_DELIM, ";");
LocalVarPrefix =
mSettings.GetString(AppSettings.FMT_LOCAL_VARIABLE_PREFIX, string.Empty);
@ -1279,6 +1313,7 @@ namespace SourceGen.WpfGui {
OperandPrefixAbs = preset.OperandPrefixAbs;
OperandPrefixLong = preset.OperandPrefixLong;
NonUniqueLabelPrefix = preset.NonUniqueLabelPrefix;
FullLineCommentDelim = preset.FullLineCommentDelim;
LocalVarPrefix = preset.LocalVarPrefix;
CommaSeparatedBulkData = preset.CommaSeparatedBulkData;
@ -1305,6 +1340,7 @@ namespace SourceGen.WpfGui {
OperandPrefixAbs == preset.OperandPrefixAbs &&
OperandPrefixLong == preset.OperandPrefixLong &&
NonUniqueLabelPrefix == preset.NonUniqueLabelPrefix &&
FullLineCommentDelim == preset.FullLineCommentDelim &&
LocalVarPrefix == preset.LocalVarPrefix &&
CommaSeparatedBulkData == preset.CommaSeparatedBulkData &&
expMode == preset.ExpressionStyle) {

View File

@ -128,11 +128,17 @@ You may specify values for all of them or none of them.</p>
<p>Different assemblers have different ways of forming expressions.
Sometimes the rules allow expressions to be written simply, other times
explicit grouping with parenthesis is required. Select whichever style
you are most comfortable with.</p>
you are most comfortable with.
(64tass and ACME use the "common"
expression style, cc65 and Merlin 32 have their own unique styles.)</p>
<p>The character used to start a full-line comment is usually
'<code>;</code>', but can be changed here.</p>
<p>Non-unique labels are identified with a prefix character, typically
'@' or ':'. The default is '@', but you can configure it to any character
that isn't valid for the start of a label. (64tass uses '_' for locals,
'<code>@</code>' or '<code>:</code>'. The default is '<code>@</code>',
but you can configure it to any character that isn't valid for the start
of a label. (64tass uses '<code>_</code>' for locals,
but that's a valid label start character, and so isn't allowed here.)
The setting affects label editing as well as display.</p>
@ -147,9 +153,7 @@ required, the latter is more readable.</p>
<p>The "quick set" pop-up configures the fields on the left side of the
tab to match the conventions of the specified assembler. Select your
preferred assembler in the combo box to set the fields. The setting
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>
automatically changes to "custom" when you modify a field.</p>
<p>The <samp>add spaces in Bytes column</samp> checkbox changes the format
of the hex data in the code list "bytes" column from dense