diff --git a/SourceGen/Anattrib.cs b/SourceGen/Anattrib.cs index 6d86367..833519d 100644 --- a/SourceGen/Anattrib.cs +++ b/SourceGen/Anattrib.cs @@ -173,6 +173,9 @@ namespace SourceGen { } } public bool NoContinueScript { + get { + return (mAttribFlags & AttribFlags.NoContinueScript) != 0; + } set { if (value) { mAttribFlags |= AttribFlags.NoContinueScript; diff --git a/SourceGen/CodeAnalysis.cs b/SourceGen/CodeAnalysis.cs index 13ee67a..e14e5eb 100644 --- a/SourceGen/CodeAnalysis.cs +++ b/SourceGen/CodeAnalysis.cs @@ -691,8 +691,11 @@ namespace SourceGen { } } - // On first visit, check for BRK inline call. - if (firstVisit) { + // On every visit, check for BRK inline call. The default behavior for BRK + // is no-continue, the opposite of JSR/JSL. + // TODO: Ideally we'd have an explicit flag (maybe make NoContinueScript a + // tri-state) to avoid calling the plugin repeatedly. + //if (firstVisit) { if (op == OpDef.OpBRK_Implied || op == OpDef.OpBRK_StackInt) { bool noContinue = CheckForInlineCall(op, offset, !doContinue); if (!noContinue) { @@ -700,7 +703,7 @@ namespace SourceGen { doContinue = true; } } - } + //} mAnattribs[offset].NoContinue = !doContinue; if (mAnattribs[offset].DoesNotContinue) { @@ -734,6 +737,9 @@ namespace SourceGen { break; } } + } else if (mAnattribs[offset].NoContinueScript) { + // Wanted to stop last time. + break; } // Are we about to walk into inline data? @@ -982,6 +988,7 @@ namespace SourceGen { /// /// Queries script extensions to check to see if a JSR or JSL is actually an inline call. + /// The script may format things. /// /// Instruction being examined. /// File offset of start of instruction. diff --git a/SourceGen/LineListGen.cs b/SourceGen/LineListGen.cs index 8b72449..851112a 100644 --- a/SourceGen/LineListGen.cs +++ b/SourceGen/LineListGen.cs @@ -916,6 +916,7 @@ namespace SourceGen { //Debug.WriteLine("GenerateRange [+" + startOffset.ToString("x6") + ",+" + // endOffset.ToString("x6") + "]"); + Debug.Assert(startOffset >= 0); Debug.Assert(endOffset >= startOffset); @@ -948,6 +949,8 @@ namespace SourceGen { if (startOffset > 0) { int baseOff = DataAnalysis.GetBaseOperandOffset(mProject, startOffset - 1); if (mProject.GetAnattrib(baseOff).DoesNotContinue) { + // TODO(someday): ideally the blank line would come after inline data + // that follows a no-continue JSR/JSL/BRK addBlank = true; } }