1
0
mirror of https://github.com/fadden/6502bench.git synced 2026-04-19 12:25:05 +00:00

Add selectable auto-label styles

SourceGen creates "auto" labels when it finds a reference to an
address that doesn't have a label associated with it.  The label for
address $1234 would be "L1234".  This change allows the project to
specify alternative label naming conventions, annotating them with
information from the cross-reference data.  For example, a subroutine
entry point (i.e. the target of a JSR) would be "S_1234".  (The
underscore was added to avoid confusion when an annotation letter
is the same as a hex digit.)

Also, tweaked the way the preferred clipboard line format is stored
in the settings file (was an integer, now an enumeration string).
This commit is contained in:
Andy McFadden
2019-04-14 16:36:16 -07:00
parent 47b1363738
commit 97a372a884
17 changed files with 374 additions and 78 deletions
+8 -6
View File
@@ -1731,11 +1731,13 @@ namespace SourceGen.AppForms {
// Edit > Copy (Ctrl+C)
private void copyToolStripMenuItem_Click(object sender, EventArgs e) {
const int AssemblerSource = 0;
const int Disassembly = 1;
const bool addCsv = true;
int format = AppSettings.Global.GetInt(AppSettings.CLIP_LINE_FORMAT, AssemblerSource);
EditAppSettings.ClipLineFormat format =
(EditAppSettings.ClipLineFormat) AppSettings.Global.GetEnum(
AppSettings.CLIP_LINE_FORMAT,
typeof(EditAppSettings.ClipLineFormat),
(int) EditAppSettings.ClipLineFormat.AssemblerSource);
StringBuilder fullText = new StringBuilder(codeListView.SelectedIndices.Count * 50);
StringBuilder csv = new StringBuilder(codeListView.SelectedIndices.Count * 40);
StringBuilder sb = new StringBuilder(100);
@@ -1743,7 +1745,7 @@ namespace SourceGen.AppForms {
int addrAdj = mProject.CpuDef.HasAddr16 ? 6 : 9;
int disAdj = 0;
int bytesWidth = 0;
if (format == Disassembly) {
if (format == EditAppSettings.ClipLineFormat.Disassembly) {
// A limit of 8 gets us 4 bytes from dense display ("20edfd60") and 3 if spaces
// are included ("20 ed fd") with no excess. We want to increase it to 11 so
// we can always show 4 bytes.
@@ -1766,7 +1768,7 @@ namespace SourceGen.AppForms {
case DisplayList.Line.Type.EquDirective:
case DisplayList.Line.Type.RegWidthDirective:
case DisplayList.Line.Type.OrgDirective:
if (format == Disassembly) {
if (format == EditAppSettings.ClipLineFormat.Disassembly) {
if (!string.IsNullOrEmpty(parts.Addr)) {
sb.Append(parts.Addr);
sb.Append(": ");
@@ -1791,7 +1793,7 @@ namespace SourceGen.AppForms {
sb.Append("\r\n");
break;
case DisplayList.Line.Type.LongComment:
if (format == Disassembly) {
if (format == EditAppSettings.ClipLineFormat.Disassembly) {
TextUtil.AppendPaddedString(sb, string.Empty, disAdj);
}
sb.Append(parts.Comment);