Make label files look more like cc65 output

The cc65 docs say VICE labels start with '.'.  Also, output local
labels prefixed with '@', per ca65 convention.  The default output
file is now "labels.lbl".

Added some minimal documentation.

(issue #151)
This commit is contained in:
Andy McFadden 2024-04-22 15:07:54 -07:00
parent 4322a0c231
commit 9e82ff8b88
5 changed files with 21 additions and 4 deletions

View File

@ -70,7 +70,15 @@ namespace SourceGen {
// VICE format is "add_label <address> <label>", but may be abbreviated "al".
// We could also use ACME format ("labelname = $1234 ; Maybe a comment").
foreach (Symbol sym in symList) {
outStream.WriteLine("al " + sym.Value.ToString("x6") + " " + sym.Label);
string label = sym.LabelWithoutTag;
if (sym.IsNonUnique) {
// Use the cc65 convention for local labels.
label = '@' + label;
}
// The cc65 docs (https://www.cc65.org/doc/debugging-4.html) say all labels
// must be prefaced with '.'.
label = '.' + label;
outStream.WriteLine("al " + sym.Value.ToString("x6") + " " + label);
}
}
}

View File

@ -2566,8 +2566,8 @@ namespace SourceGen {
string filter;
switch (dlg.Format) {
case LabelFileGenerator.LabelFmt.VICE:
ext = ".vs";
filter = "VICE commands (*.vs)|*.vs";
ext = ".lbl";
filter = "VICE labels (*.lbl)|*.lbl";
break;
default:
Debug.Assert(false, "bad format");

View File

@ -84,6 +84,7 @@ namespace SourceGen {
/// <remarks>
/// Non-unique labels have extra stuff at the end to make them unique. That is
/// included here, so that the Label field is still viable as a unique identifier.
/// Use <see cref="LabelWithoutTag"/> to get just the label.
/// </remarks>
public string Label { get; private set; }

View File

@ -385,7 +385,7 @@ clipboard and pasting them into a text file, except that you have greater
control over which columns are included. The HTML version is augmented
with links and (optionally) images.</p>
<p>Use File &gt; Export to open the export dialog. You have several
<p>Use <samp>File &gt; Export</samp> to open the export dialog. You have several
options:</p>
<ul>
<li><b>Include only selected lines</b>. This allows you to choose between
@ -425,6 +425,13 @@ will be written to the same directory.</p>
<p>All output uses UTF-8 encoding. Filenames of HTML files will have '#'
replaced with '_' to make linking easier.</p>
<h2 id="generate-labels">Generating Label Files</h2>
<p>Some debuggers allow the import of labels associated with addresses.
To generate such a file, use <samp>File &gt; Generate Label File</samp>.</p>
<p>Select the desired output format (currently only VICE label commands
are supported), and whether or not to include auto-generated labels.</p>
</div>
<div id="footer">

View File

@ -140,6 +140,7 @@ using the <samp>Help &gt; Help</samp> menu item or by hitting
</ul></li>
</ul></li>
<li><a href="codegen.html#export-source">Exporting Source Code</a>
<li><a href="codegen.html#generate-labels">Generating Label Files</a>
</ul></li>
<li><a href="settings.html">Properties &amp; Settings</a>