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

Fix table formatting for embedded destinations

The code for formatting an address table allows you to specify that
code start tags should be placed on all targets.  However, unnecessary
tags are undesirable, and it's not necessary to add a tag if the
target is already treated as executable code.  So the implementation
tested to see if the target address was already an instruction.

The code was incorrectly testing for "is instruction", rather than "is
instruction start", which meant that if the table entry pointed at an
instruction embedded inside another instruction we would conclude that
the tag wasn't necessary, when in fact it was.  Not only weren't we
getting a useful table entry, we were adding a symbolic reference to a
hidden label.

(issue #103)
This commit is contained in:
Andy McFadden 2021-08-01 18:15:44 -07:00
parent d65ab59461
commit 44b483c8d8

View File

@ -2712,7 +2712,11 @@ namespace SourceGen {
TypedRangeSet undoSet = new TypedRangeSet();
foreach (int offset in dlg.AllTargetOffsets) {
if (!mProject.GetAnattrib(offset).IsInstruction) {
// We don't need to add a "code start" tag if this is already the
// start of an instruction. We do need to add one if it's the *middle*
// of an instruction, e.g. the table points inside a "BIT abs". So we
// test against IsInstructionStart, not IsInstruction.
if (!mProject.GetAnattrib(offset).IsInstructionStart) {
CodeAnalysis.AnalyzerTag oldType = mProject.AnalyzerTags[offset];
if (oldType == CodeAnalysis.AnalyzerTag.Code) {
continue; // already set