mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-29 10:50:28 +00:00
Check for bank overrun
If an address map entry wraps around the end of a bank, add a note to the message log. This is Error level, since some assemblers will refuse to handle it.
This commit is contained in:
parent
6a8d6950e5
commit
ceb07c809e
@ -664,6 +664,22 @@ namespace SourceGen {
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateAddressMap() {
|
||||
foreach (AddressMap.AddressMapEntry entry in AddrMap) {
|
||||
if ((entry.Addr & 0xff0000) != ((entry.Addr + entry.Length - 1) & 0xff0000)) {
|
||||
string fmt = Res.Strings.MSG_BANK_OVERRUN_DETAIL_FMT;
|
||||
int firstNext = (entry.Addr & 0xff0000) + 0x010000;
|
||||
int badOffset = entry.Offset + (firstNext - entry.Addr);
|
||||
Messages.Add(new MessageList.MessageEntry(
|
||||
MessageList.MessageEntry.SeverityLevel.Error,
|
||||
entry.Offset,
|
||||
MessageList.MessageEntry.MessageType.BankOverrun,
|
||||
string.Format(fmt, "+" + badOffset.ToString("x6")),
|
||||
MessageList.MessageEntry.ProblemResolution.None));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Analysis
|
||||
|
||||
/// <summary>
|
||||
@ -809,6 +825,7 @@ namespace SourceGen {
|
||||
Validate();
|
||||
reanalysisTimer.EndTask("Validate");
|
||||
#endif
|
||||
ValidateAddressMap();
|
||||
|
||||
reanalysisTimer.EndTask("DisasmProject.Analyze()");
|
||||
//reanalysisTimer.DumpTimes("DisasmProject timers:", debugLog);
|
||||
|
@ -52,6 +52,7 @@ namespace SourceGen {
|
||||
UnresolvedWeakRef,
|
||||
InvalidOffsetOrLength,
|
||||
InvalidDescriptor,
|
||||
BankOverrun,
|
||||
}
|
||||
public MessageType MsgType { get; private set; }
|
||||
|
||||
@ -163,6 +164,9 @@ namespace SourceGen {
|
||||
case MessageEntry.MessageType.InvalidDescriptor:
|
||||
problem = Res.Strings.MSG_INVALID_DESCRIPTOR;
|
||||
break;
|
||||
case MessageEntry.MessageType.BankOverrun:
|
||||
problem = Res.Strings.MSG_BANK_OVERRUN;
|
||||
break;
|
||||
default:
|
||||
problem = "???";
|
||||
break;
|
||||
|
@ -107,6 +107,8 @@ limitations under the License.
|
||||
<system:String x:Key="str_InvalidFormatWordSelUnevenFmt">Unable to format as word: each selected region must have an even number of bytes ({0} region(s) are selected).</system:String>
|
||||
<system:String x:Key="str_LocalVariableTableClear">• Clear variables</system:String>
|
||||
<system:String x:Key="str_LocalVariableTableEmpty">• Empty variable table</system:String>
|
||||
<system:String x:Key="str_MsgBankOverrun">Address bank overrun</system:String>
|
||||
<system:String x:Key="str_MsgBankOverrunDetailFmt">Bank boundary crossed at offset {0}</system:String>
|
||||
<system:String x:Key="str_MsgFormatDescriptorIgnored">Format ignored</system:String>
|
||||
<system:String x:Key="str_MsgHiddenLabel">Hidden label</system:String>
|
||||
<system:String x:Key="str_MsgHiddenLocalVariableTable">Hidden variable table</system:String>
|
||||
|
@ -195,6 +195,10 @@ namespace SourceGen.Res {
|
||||
(string)Application.Current.FindResource("str_LocalVariableTableClear");
|
||||
public static string LOCAL_VARIABLE_TABLE_EMPTY =
|
||||
(string)Application.Current.FindResource("str_LocalVariableTableEmpty");
|
||||
public static string MSG_BANK_OVERRUN =
|
||||
(string)Application.Current.FindResource("str_MsgBankOverrun");
|
||||
public static string MSG_BANK_OVERRUN_DETAIL_FMT =
|
||||
(string)Application.Current.FindResource("str_MsgBankOverrunDetailFmt");
|
||||
public static string MSG_FORMAT_DESCRIPTOR_IGNORED =
|
||||
(string)Application.Current.FindResource("str_MsgFormatDescriptorIgnored");
|
||||
public static string MSG_HIDDEN_LABEL =
|
||||
|
Loading…
Reference in New Issue
Block a user