diff --git a/SourceGen/AppForms/FormatSplitAddress.Designer.cs b/SourceGen/AppForms/FormatSplitAddress.Designer.cs index 07ea09f..b71dd47 100644 --- a/SourceGen/AppForms/FormatSplitAddress.Designer.cs +++ b/SourceGen/AppForms/FormatSplitAddress.Designer.cs @@ -23,7 +23,7 @@ /// the contents of this method with the code editor. /// private void InitializeComponent() { - System.Windows.Forms.ListViewItem listViewItem5 = new System.Windows.Forms.ListViewItem(new string[] { + System.Windows.Forms.ListViewItem listViewItem8 = new System.Windows.Forms.ListViewItem(new string[] { "12/3456", "+123456", "(+) T_123456"}, -1); @@ -114,9 +114,9 @@ this.pushRtsCheckBox.AutoSize = true; this.pushRtsCheckBox.Location = new System.Drawing.Point(7, 68); this.pushRtsCheckBox.Name = "pushRtsCheckBox"; - this.pushRtsCheckBox.Size = new System.Drawing.Size(167, 17); + this.pushRtsCheckBox.Size = new System.Drawing.Size(184, 17); this.pushRtsCheckBox.TabIndex = 2; - this.pushRtsCheckBox.Text = "Push for RTS/RTL (target - 1)"; + this.pushRtsCheckBox.Text = "Adjusted for RTS/RTL (target - 1)"; this.pushRtsCheckBox.UseVisualStyleBackColor = true; this.pushRtsCheckBox.CheckedChanged += new System.EventHandler(this.pushRtsCheckBox_CheckedChanged); // @@ -154,7 +154,7 @@ this.lowByteGroupBox.Size = new System.Drawing.Size(207, 94); this.lowByteGroupBox.TabIndex = 2; this.lowByteGroupBox.TabStop = false; - this.lowByteGroupBox.Text = "Low Byte"; + this.lowByteGroupBox.Text = "Low Bytes"; // // lowThirdPartRadio // @@ -204,7 +204,7 @@ this.highByteGroupBox.Size = new System.Drawing.Size(207, 120); this.highByteGroupBox.TabIndex = 3; this.highByteGroupBox.TabStop = false; - this.highByteGroupBox.Text = "High Byte"; + this.highByteGroupBox.Text = "High Bytes"; // // highConstantTextBox // @@ -273,7 +273,7 @@ this.bankByteGroupBox.Size = new System.Drawing.Size(207, 70); this.bankByteGroupBox.TabIndex = 4; this.bankByteGroupBox.TabStop = false; - this.bankByteGroupBox.Text = "Bank Byte"; + this.bankByteGroupBox.Text = "Bank Bytes"; // // bankConstantTextBox // @@ -320,7 +320,7 @@ this.outputPreviewListView.FullRowSelect = true; this.outputPreviewListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.outputPreviewListView.Items.AddRange(new System.Windows.Forms.ListViewItem[] { - listViewItem5}); + listViewItem8}); this.outputPreviewListView.Location = new System.Drawing.Point(6, 19); this.outputPreviewListView.MultiSelect = false; this.outputPreviewListView.Name = "outputPreviewListView"; diff --git a/SourceGen/AppForms/FormatSplitAddress.cs b/SourceGen/AppForms/FormatSplitAddress.cs index 7c7f5db..7f23504 100644 --- a/SourceGen/AppForms/FormatSplitAddress.cs +++ b/SourceGen/AppForms/FormatSplitAddress.cs @@ -39,6 +39,12 @@ namespace SourceGen.AppForms { /// public List AllTargetOffsets { get; private set; } + public bool WantCodeHints { + get { + return addCodeHintCheckBox.Checked; + } + } + /// /// Selected offsets. An otherwise contiguous range of offsets can be broken up /// by user-specified labels and address discontinuities, so this needs to be @@ -357,7 +363,6 @@ namespace SourceGen.AppForms { } int addr = ((bank << 16) | (high << 8) | low) + adj; - Debug.WriteLine("GOT " + i + ": " + addr.ToString("x6")); int targetOffset = mProject.AddrMap.AddressToOffset(offsets[0], addr); if (targetOffset < 0) { @@ -409,7 +414,8 @@ namespace SourceGen.AppForms { NewUserLabels = newLabels; AllTargetOffsets = targetOffsets; - mOutputReady = true; + // Don't show ready if all addresses are invalid. + mOutputReady = (AllTargetOffsets.Count > 0); } private void AddPreviewItem(int addr, int offset, string label) { diff --git a/SourceGen/AppForms/ProjectView.cs b/SourceGen/AppForms/ProjectView.cs index 02f9323..2e53a22 100644 --- a/SourceGen/AppForms/ProjectView.cs +++ b/SourceGen/AppForms/ProjectView.cs @@ -2644,23 +2644,24 @@ namespace SourceGen.AppForms { cs.Add(uc); } - // Apply code hints. - TypedRangeSet newSet = new TypedRangeSet(); - TypedRangeSet undoSet = new TypedRangeSet(); + if (dlg.WantCodeHints) { + TypedRangeSet newSet = new TypedRangeSet(); + TypedRangeSet undoSet = new TypedRangeSet(); - foreach (int offset in dlg.AllTargetOffsets) { - if (!mProject.GetAnattrib(offset).IsInstruction) { - CodeAnalysis.TypeHint oldType = mProject.TypeHints[offset]; - if (oldType == CodeAnalysis.TypeHint.Code) { - continue; // already set + foreach (int offset in dlg.AllTargetOffsets) { + if (!mProject.GetAnattrib(offset).IsInstruction) { + CodeAnalysis.TypeHint oldType = mProject.TypeHints[offset]; + if (oldType == CodeAnalysis.TypeHint.Code) { + continue; // already set + } + undoSet.Add(offset, (int)oldType); + newSet.Add(offset, (int)CodeAnalysis.TypeHint.Code); } - undoSet.Add(offset, (int)oldType); - newSet.Add(offset, (int)CodeAnalysis.TypeHint.Code); } - } - if (newSet.Count != 0) { - cs.Add(UndoableChange.CreateTypeHintChange(undoSet, newSet)); + if (newSet.Count != 0) { + cs.Add(UndoableChange.CreateTypeHintChange(undoSet, newSet)); + } } // Finally, apply the change. diff --git a/SourceGen/RuntimeData/Help/index.html b/SourceGen/RuntimeData/Help/index.html index 491e5f1..ecd776c 100644 --- a/SourceGen/RuntimeData/Help/index.html +++ b/SourceGen/RuntimeData/Help/index.html @@ -54,6 +54,7 @@ and 65816 code. The official web site is
  • Info Window
  • Navigation
  • Adding and Removing Hints
  • +
  • Format Split-Address Table
  • Quick Format Toggle
  • Copying to Clipboard
  • diff --git a/SourceGen/RuntimeData/Help/mainwin.html b/SourceGen/RuntimeData/Help/mainwin.html index 3184f37..1b0d0a3 100644 --- a/SourceGen/RuntimeData/Help/mainwin.html +++ b/SourceGen/RuntimeData/Help/mainwin.html @@ -296,6 +296,90 @@ entirely from the project properties editor. +

    Format Split-Address Table

    + +

    Tables of addresses are fairly common. Sometimes you'll find them as a +series of 16-bit words, like this:

    +
    +jmptab   .dd2    func1
    +         .dd2    func2
    +         .dd2    func3
    +
    + +

    While that's fairly common in 16-bit software, 8-bit software often splits +the high and low bytes into separate arrays, like this:

    +
    +jmptabl  .dd1    <func1
    +         .dd1    <func2
    +         .dd1    <func3
    +jmptabh  .dd1    >func1
    +         .dd1    >func2
    +         .dd1    >func3
    +
    + +

    Sometimes the tables contain address - 1, because the +values are to be pushed onto the stack for an RTS call.

    + +

    The split-address table formatter helps you associate symbols with the +addresses in the table. To use it, start by selecting the entire table. +In the example above, you would select all 6 bytes. The number of bytes +in each part must be equal: here, it's 3 low bytes, followed by 3 high +bytes. If the number of bytes selected can't be evenly divided by the +number of parts, the formatter will report an error.

    +

    With the data selected, open the format dialog with +Actions > Format Split-Address Table. The rather complicated dialog +is split into sections.

    + + +

    For a 16-bit address, you have three choices: low byte first, high byte +first, or low byte only with a constant high byte. For a 24-bit address +the set of possibilities expands, but is essentially the same: pick the +order in which things appear, using fixed constants if desired.

    + +

    A message at the top of the screen shows how many bytes are selected. +It also tells you how many groups there are, but unlike the data operand +formatter, the split-address table formatter doesn't care about group +boundaries. For this reason, tables do not have to be contiguous in +memory. The low bytes and high bytes could be on separate 256-byte +pages.

    + +

    It should be mentioned that SourceGen does not record the fact that the +data in question is part of a table. The formatting, labels, and code hints +are applied as if you entered them all individually by hand. The formatter +is just significantly more convenient. It also does everything as a single +undoable action, so if it comes out looking wrong, just hit "undo".

    + +

    Quick Format Toggle

    The "Toggle Single-Byte Format" feature provides a quick way to