]> git.sur5r.net Git - cc65/blobdiff - src/da65/output.c
Completed the coding of da65's SEGMENT feature.
[cc65] / src / da65 / output.c
index 9098d7d3766c55c8b3464fe665fbcaa7a5b0c9ce..4daacb1ee5222f813dc6f6f82f27d3f7af2d1c0c 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2009, Ullrich von Bassewitz                                      */
+/* (C) 2000-2014, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -63,6 +63,8 @@ static unsigned Col     = 1;            /* Current column */
 static unsigned Line    = 0;            /* Current line on page */
 static unsigned Page    = 1;            /* Current output page */
 
+static const char* SegmentName = 0;     /* Name of current segment */
+
 
 
 /*****************************************************************************/
@@ -223,23 +225,6 @@ void DefConst (const char* Name, const char* Comment, unsigned Addr)
 
 
 
-void StartSegment (const char* Name, unsigned AddrSize)
-/* Start a segment */
-{
-    if (Pass == PassCount) {
-        Output (".segment");
-        Indent (ACol);
-        if (AddrSize == ADDR_SIZE_DEFAULT) {
-            Output ("\"%s\"", Name);
-        } else {
-            Output ("\"%s\": %s", Name, AddrSizeToStr (AddrSize));
-        }
-        LineFeed ();
-    }
-}
-
-
-
 void DataByteLine (unsigned ByteCount)
 /* Output a line with bytes */
 {
@@ -335,6 +320,39 @@ void SeparatorLine (void)
 
 
 
+void StartSegment (const char* Name, unsigned AddrSize)
+/* Start a segment */
+{
+    if (Pass == PassCount) {
+        LineFeed ();
+        Output (".segment");
+        Indent (ACol);
+        SegmentName = Name;
+        Output ("\"%s\"", Name);
+        if (AddrSize != ADDR_SIZE_DEFAULT) {
+            Output (": %s", AddrSizeToStr (AddrSize));
+        }
+        LineFeed ();
+        LineFeed ();
+    }
+}
+
+
+
+void EndSegment (void)
+/* End a segment */
+{
+    LineFeed ();
+    Output ("; End of \"%s\" segment", SegmentName);
+    LineFeed ();
+    SeparatorLine ();
+    Output (".code");
+    LineFeed ();
+    LineFeed ();
+}
+
+
+
 void UserComment (const char* Comment)
 /* Output a comment line */
 {