From 68f53e69f1e72b9c70fae4e0612d894b03640247 Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 1 Jun 2020 01:28:59 +0800 Subject: [PATCH] Fixed Issues #420 and #919 by always outputing the code segment before the three data segments for functions. --- src/cc65/codeseg.c | 5 ++++- src/cc65/segments.c | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cc65/codeseg.c b/src/cc65/codeseg.c index e2fd84a7c..58586affd 100644 --- a/src/cc65/codeseg.c +++ b/src/cc65/codeseg.c @@ -1353,7 +1353,7 @@ void CS_OutputEpilogue (const CodeSeg* S) */ { if (S->Func) { - WriteOutput ("\n.endproc\n\n"); + WriteOutput (".endproc\n\n"); } } @@ -1423,6 +1423,9 @@ void CS_Output (CodeSeg* S) CE_Output (E); } + /* Prettyier formatting */ + WriteOutput ("\n"); + /* If debug info is enabled, terminate the last line number information */ if (DebugInfo) { WriteOutput ("\t.dbg\tline\n"); diff --git a/src/cc65/segments.c b/src/cc65/segments.c index 5e493e8f5..6efbf68b7 100644 --- a/src/cc65/segments.c +++ b/src/cc65/segments.c @@ -289,14 +289,14 @@ void OutputSegments (const Segments* S) /* Output the text segment */ TS_Output (S->Text); + /* Output the code segment */ + CS_Output (S->Code); + /* Output the three data segments */ DS_Output (S->Data); DS_Output (S->ROData); DS_Output (S->BSS); - /* Output the code segment */ - CS_Output (S->Code); - /* Output the code segment epiloque */ CS_OutputEpilogue (S->Code); }