diff --git a/SourceGen/AsmGen/AsmCc65.cs b/SourceGen/AsmGen/AsmCc65.cs
index fc6a715..a4b8fa3 100644
--- a/SourceGen/AsmGen/AsmCc65.cs
+++ b/SourceGen/AsmGen/AsmCc65.cs
@@ -722,6 +722,13 @@ namespace SourceGen.AsmGen {
if (!mHighAsciiMacroOutput) {
mHighAsciiMacroOutput = true;
// Output a macro for high-ASCII strings.
+ //
+ // TODO(maybe): the preferred way to do this is apparently
+ // ".macpack apple2" to load some standard macros, then e.g.
+ // scrcode "My high-ASCII string". The macro takes 9 arguments and
+ // recognizes characters and numbers, so it should be possible to
+ // mix strings, string delimiters, and control chars so long as the
+ // argument count is not exceeded.
OutputLine(".macro", "HiAscii", "Arg", string.Empty);
OutputLine(string.Empty, ".repeat", ".strlen(Arg), I", string.Empty);
OutputLine(string.Empty, ".byte", ".strat(Arg, I) | $80", string.Empty);
diff --git a/SourceGen/DisasmProject.cs b/SourceGen/DisasmProject.cs
index 7f59d0f..26c2d80 100644
--- a/SourceGen/DisasmProject.cs
+++ b/SourceGen/DisasmProject.cs
@@ -1541,7 +1541,10 @@ namespace SourceGen {
sym.SymbolSource == Symbol.Source.Platform) {
DefSymbol defSym = sym as DefSymbol;
int adj = 0;
- Debug.Assert(operandOffset < 0); // outside file scope
+ // NOTE: operandOffset may be valid, since you are allowed to
+ // define project symbols for addresses inside the file. I
+ // don't think we need to fiddle with that though.
+ //Debug.Assert(operandOffset < 0);
if (sym.SymbolType != Symbol.Type.Constant &&
attr.OperandAddress >= 0) {
// It's an address operand, so we can compute the offset.
diff --git a/SourceGen/MainController.cs b/SourceGen/MainController.cs
index bc094b1..7d9c5be 100644
--- a/SourceGen/MainController.cs
+++ b/SourceGen/MainController.cs
@@ -1495,7 +1495,7 @@ namespace SourceGen {
// Currently only does something for project symbols; platform symbols
// do nothing.
if (CanEditProjectSymbol()) {
- EditProjectSymbol();
+ EditProjectSymbol((CodeListColumn)col);
}
break;
case LineListGen.Line.Type.OrgDirective:
@@ -2203,7 +2203,7 @@ namespace SourceGen {
return (defSym.SymbolSource == Symbol.Source.Project);
}
- public void EditProjectSymbol() {
+ public void EditProjectSymbol(CodeListColumn col) {
int selIndex = mMainWin.CodeListView_GetFirstSelectedIndex();
int symIndex = LineListGen.DefSymIndexFromOffset(CodeLineList[selIndex].FileOffset);
DefSymbol origDefSym = mProject.ActiveDefSymbolList[symIndex];
@@ -2211,6 +2211,20 @@ namespace SourceGen {
EditDefSymbol dlg = new EditDefSymbol(mMainWin, mFormatter,
mProject.ProjectProps.ProjectSyms, origDefSym, null);
+
+ switch (col) {
+ case CodeListColumn.Operand:
+ dlg.InitialFocusField = EditDefSymbol.InputField.Value;
+ break;
+ case CodeListColumn.Comment:
+ dlg.InitialFocusField = EditDefSymbol.InputField.Comment;
+ break;
+ case CodeListColumn.Label:
+ default:
+ dlg.InitialFocusField = EditDefSymbol.InputField.Label;
+ break;
+ }
+
if (dlg.ShowDialog() == true) {
ProjectProperties newProps = new ProjectProperties(mProject.ProjectProps);
newProps.ProjectSyms.Remove(origDefSym.Label);
diff --git a/SourceGen/WpfGui/EditDefSymbol.xaml b/SourceGen/WpfGui/EditDefSymbol.xaml
index b67b6db..1d2cdc0 100644
--- a/SourceGen/WpfGui/EditDefSymbol.xaml
+++ b/SourceGen/WpfGui/EditDefSymbol.xaml
@@ -72,7 +72,7 @@ limitations under the License.
-
-
diff --git a/SourceGen/WpfGui/EditDefSymbol.xaml.cs b/SourceGen/WpfGui/EditDefSymbol.xaml.cs
index d9384cc..9ab5e37 100644
--- a/SourceGen/WpfGui/EditDefSymbol.xaml.cs
+++ b/SourceGen/WpfGui/EditDefSymbol.xaml.cs
@@ -34,6 +34,14 @@ namespace SourceGen.WpfGui {
///
public DefSymbol NewSym { get; private set; }
+ public enum InputField {
+ Unknown = 0, Label, Value, Comment
+ }
+ ///
+ /// Determines which field gets focus initially.
+ ///
+ public InputField InitialFocusField { get; set; }
+
///
/// Set to true when all fields are valid. Controls whether the OK button is enabled.
///
@@ -234,8 +242,21 @@ namespace SourceGen.WpfGui {
}
private void Window_ContentRendered(object sender, EventArgs e) {
- labelTextBox.SelectAll();
- labelTextBox.Focus();
+ TextBox field;
+ switch (InitialFocusField) {
+ case InputField.Value:
+ field = valueTextBox;
+ break;
+ case InputField.Comment:
+ field = commentTextBox;
+ break;
+ case InputField.Label:
+ default:
+ field = labelTextBox;
+ break;
+ }
+ field.SelectAll();
+ field.Focus();
}
///
diff --git a/SourceGen/WpfGui/MainWindow.xaml.cs b/SourceGen/WpfGui/MainWindow.xaml.cs
index 7b540f8..3586546 100644
--- a/SourceGen/WpfGui/MainWindow.xaml.cs
+++ b/SourceGen/WpfGui/MainWindow.xaml.cs
@@ -1192,7 +1192,7 @@ namespace SourceGen.WpfGui {
}
private void EditProjectSymbolCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
- mMainCtrl.EditProjectSymbol();
+ mMainCtrl.EditProjectSymbol(MainController.CodeListColumn.Label);
}
private void EditStatusFlagsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {