]> git.sur5r.net Git - cc65/blobdiff - src/cc65/segments.c
Working on the new backend
[cc65] / src / cc65 / segments.c
index 654927908c329124f0b0b3e0dcce2e7bfe1da29b..2c6f3e3cd704e77387b3f5209e562195c98bb2fa 100644 (file)
@@ -45,6 +45,7 @@
 /* cc65 */
 #include "codeseg.h"
 #include "dataseg.h"
+#include "textseg.h"
 #include "segments.h"
 
 
@@ -125,6 +126,7 @@ static Segments* NewSegments (SymEntry* Func)
     Segments* S = xmalloc (sizeof (Segments));
 
     /* Initialize the fields */
+    S->Text    = NewTextSeg (Func);
     S->Code    = NewCodeSeg (SegmentNames[SEG_CODE], Func);
     S->Data    = NewDataSeg (SegmentNames[SEG_DATA], Func);
     S->ROData  = NewDataSeg (SegmentNames[SEG_RODATA], Func);
@@ -190,6 +192,18 @@ struct DataSeg* GetDataSeg (void)
 
 
 
+void AddTextLine (const char* Format, ...)
+/* Add a line of code to the current text segment */
+{
+    va_list ap;
+    va_start (ap, Format);
+    CHECK (CS != 0);
+    AddTextEntry (CS->Text, Format, ap);
+    va_end (ap);
+}
+
+
+
 void AddCodeLine (const char* Format, ...)
 /* Add a line of code to the current code segment */
 {
@@ -237,6 +251,9 @@ void OutputSegments (const Segments* S, FILE* F)
        PrintFunctionHeader (S->Code->Func, F);
     }
 
+    /* Output the text segment */
+    OutputTextSeg (S->Text, F);
+
     /* Output the three data segments */
     OutputDataSeg (S->Data, F);
     OutputDataSeg (S->ROData, F);