mirror of
https://github.com/fadden/6502bench.git
synced 2025-07-18 15:24:09 +00:00
ORG rework, part 5
Updated project file format to save the new map entries. Tweaked appearance of .arend directives to show the .arstart address in the operand field. This makes it easier to match them up on screen. Also, add a synthetic comment on auto-generated .arstart entries. Added .arstart/.arend to the things that respond to Jump to Operand (Ctrl+J). Selecting one jumps to the other end. (Well, it jumps to the code nearest the other, which will do for now.) Added a menu item to display a text rendering of the address map. Helpful when things get complicated. Modified the linear map iterator to return .arend items with the offset of the last byte in the region, rather than the first byte of the following region. While the "exclusive end" approach is pretty common, it caused problems when updating the line list, because it meant that the .arend directives were outside the range of offsets being updated (and, for directives at the end of the file, outside the file itself). This was painful to deal with for partial updates. Changing this required some relatively subtle changes and annoyed some of the debug assertions, such as the one where all Line items have offsets that match the start of a line, but it's the cleaner approach.
This commit is contained in:
@@ -1658,6 +1658,28 @@ namespace SourceGen {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (line.IsAddressRangeDirective) {
|
||||
// TODO(someday): make this jump to the actual directive rather than nearby code
|
||||
AddressMap.AddressRegion region = CodeLineList.GetAddrRegionFromLine(line);
|
||||
if (region == null) {
|
||||
Debug.Assert(false);
|
||||
return false;
|
||||
}
|
||||
if (!testOnly) {
|
||||
if (line.LineType == LineListGen.Line.Type.ArStartDirective) {
|
||||
// jump to end
|
||||
GoToLocation(
|
||||
new NavStack.Location(region.Offset + region.ActualLength - 1, 0, true),
|
||||
GoToMode.JumpToCodeData, true);
|
||||
} else {
|
||||
// jump to start
|
||||
GoToLocation(new NavStack.Location(region.Offset, 0, true),
|
||||
GoToMode.JumpToCodeData, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Anattrib attr = mProject.GetAnattrib(line.FileOffset);
|
||||
FormatDescriptor dfd = attr.DataDescriptor;
|
||||
|
||||
@@ -1828,7 +1850,7 @@ namespace SourceGen {
|
||||
if (CodeLineList[selIndex].LineType == LineListGen.Line.Type.ArStartDirective ||
|
||||
CodeLineList[selIndex].LineType == LineListGen.Line.Type.ArEndDirective) {
|
||||
// First selected line was .arstart/.arend, find the address map entry.
|
||||
curRegion = CodeLineList.GetAddrRegionFromLine(selIndex);
|
||||
curRegion = CodeLineList.GetAddrRegionFromLine(CodeLineList[selIndex]);
|
||||
Debug.Assert(curRegion != null);
|
||||
Debug.WriteLine("Using region from " + CodeLineList[selIndex].LineType +
|
||||
": " + curRegion);
|
||||
@@ -2927,7 +2949,9 @@ namespace SourceGen {
|
||||
}
|
||||
LineListGen.Line.Type lineType = SelectionAnalysis.mLineType;
|
||||
if (lineType != LineListGen.Line.Type.Code &&
|
||||
lineType != LineListGen.Line.Type.Data) {
|
||||
lineType != LineListGen.Line.Type.Data &&
|
||||
lineType != LineListGen.Line.Type.ArStartDirective &&
|
||||
lineType != LineListGen.Line.Type.ArEndDirective) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3884,11 +3908,11 @@ namespace SourceGen {
|
||||
|
||||
case LineListGen.Line.Type.ArStartDirective:
|
||||
isSimple = false;
|
||||
lineTypeStr = "address range start directive";
|
||||
lineTypeStr = "address region start directive";
|
||||
break;
|
||||
case LineListGen.Line.Type.ArEndDirective:
|
||||
isSimple = false;
|
||||
lineTypeStr = "address range end directive";
|
||||
lineTypeStr = "address region end directive";
|
||||
break;
|
||||
case LineListGen.Line.Type.LocalVariableTable:
|
||||
isSimple = false;
|
||||
@@ -3952,7 +3976,7 @@ namespace SourceGen {
|
||||
|
||||
if (line.LineType == LineListGen.Line.Type.ArStartDirective ||
|
||||
line.LineType == LineListGen.Line.Type.ArEndDirective) {
|
||||
AddressMap.AddressRegion region = CodeLineList.GetAddrRegionFromLine(lineIndex);
|
||||
AddressMap.AddressRegion region = CodeLineList.GetAddrRegionFromLine(line);
|
||||
StringBuilder esb = new StringBuilder();
|
||||
esb.Append("Address: ");
|
||||
if (region.Address == AddressMap.NON_ADDR) {
|
||||
@@ -4388,6 +4412,21 @@ namespace SourceGen {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Displays a representation of the address map.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is in the "tools" section, but it's not a tool. It's in the "navigation" menu
|
||||
/// but has nothing to do with navigation. Bit of an oddball.
|
||||
/// </remarks>
|
||||
public void ViewAddressMap() {
|
||||
string mapStr = RenderAddressMap.GenerateString(mProject, mFormatter);
|
||||
|
||||
Tools.WpfGui.ShowText dlg = new Tools.WpfGui.ShowText(mMainWin, mapStr);
|
||||
dlg.Title = "Address Map";
|
||||
dlg.ShowDialog();
|
||||
}
|
||||
|
||||
#endregion Tools
|
||||
|
||||
#region Debug features
|
||||
|
Reference in New Issue
Block a user