1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-25 05:29:31 +00:00

Warn about multi-line start/stop tags

One of the most confusing things you can do is select a bunch of
lines and apply a code start tag (nee "code hint").  We now ask for
confirmation when applying start/stop hints to multiple lines.

(issue #89)
This commit is contained in:
Andy McFadden 2020-10-15 17:18:49 -07:00
parent 49f4017410
commit ae4c90d838
4 changed files with 21 additions and 0 deletions

View File

@ -379,6 +379,9 @@ namespace SourceGen {
// placed here.
OpDef op = mCpuDef.GetOpDef(mFileData[offset]);
if (op == OpDef.OpInvalid) {
// Might want to set the "has tag" value anyway, since it won't
// appear in the "Info" window if we don't. Or maybe we need a
// message about "invisible" code start tags?
LogI(offset, "Ignoring code start tag on illegal opcode");
} else {
mAnattribs[offset].HasAnalyzerTag = true;

View File

@ -3379,7 +3379,19 @@ namespace SourceGen {
sel.Add(offset);
}
}
// "first byte only" is used for code start/stop tags, which should only be
// placed at the start of a region.
if (sel.Count > 1) {
MessageBoxResult result = MessageBox.Show(Res.Strings.ANALYZER_TAG_MULTI_CHK,
Res.Strings.CONFIRMATION_NEEDED,
MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (result == MessageBoxResult.Cancel) {
return;
}
}
} else {
// Inline data or none. Select all bytes.
sel = OffsetSetFromSelected();
}

View File

@ -24,6 +24,7 @@ limitations under the License.
<system:String x:Key="str_AbbrevAddress">Addr</system:String>
<system:String x:Key="str_AbbrevConstant">Const</system:String>
<system:String x:Key="str_AbbrevStackRelative">StkRl</system:String>
<system:String x:Key="str_AnalyzerTagMultiChk">Setting start/stop tags on multiple consecutive bytes is rarely a good idea. Continue?</system:String>
<system:String x:Key="str_AsmLatestVersion">[latest version]</system:String>
<system:String x:Key="str_AsmMatchFailure">output DOES NOT match data file</system:String>
<system:String x:Key="str_AsmMatchSuccess">output matches data file</system:String>
@ -34,6 +35,7 @@ limitations under the License.
<system:String x:Key="str_ClipformatAllColumns">All Columns</system:String>
<system:String x:Key="str_ClipformatAssemblerSource">Assembler Source</system:String>
<system:String x:Key="str_ClipformatDisassembly">Disassembly</system:String>
<system:String x:Key="str_ConfirmationNeeded">Confirmation Needed</system:String>
<system:String x:Key="str_DataBankAutoFmt">{0} (auto)</system:String>
<system:String x:Key="str_DataBankUserFmt">{0}</system:String>
<system:String x:Key="str_DataBankK">K</system:String>

View File

@ -29,6 +29,8 @@ namespace SourceGen.Res {
(string)Application.Current.FindResource("str_AbbrevConstant");
public static string ABBREV_STACK_RELATIVE =
(string)Application.Current.FindResource("str_AbbrevStackRelative");
public static string ANALYZER_TAG_MULTI_CHK =
(string)Application.Current.FindResource("str_AnalyzerTagMultiChk");
public static string ASM_LATEST_VERSION =
(string)Application.Current.FindResource("str_AsmLatestVersion");
public static string ASM_MATCH_FAILURE =
@ -43,6 +45,8 @@ namespace SourceGen.Res {
(string)Application.Current.FindResource("str_AsmMismatchLengthFmt");
public static string ASM_OUTPUT_NOT_FOUND =
(string)Application.Current.FindResource("str_AsmOutputNotFound");
public static string CONFIRMATION_NEEDED =
(string)Application.Current.FindResource("str_ConfirmationNeeded");
public static string DATA_BANK_AUTO_FMT =
(string)Application.Current.FindResource("str_DataBankAutoFmt");
public static string DATA_BANK_USER_FMT =