]> git.sur5r.net Git - cc65/commitdiff
More comment handling
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 17 Feb 2005 17:26:16 +0000 (17:26 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 17 Feb 2005 17:26:16 +0000 (17:26 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3389 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/da65/attrtab.c
src/da65/attrtab.h
src/da65/output.c
src/da65/output.h

index 1eb7d9f2cee07869ae15676fd1b5775d010dd38d..90233e2bb8e8b65c49a1a22098659d86ceca30c3 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2003 Ullrich von Bassewitz                                       */
+/* (C) 2000-2005 Ullrich von Bassewitz                                       */
 /*               Römerstrasse 52                                             */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -387,17 +387,6 @@ unsigned char GetLabelAttr (unsigned Addr)
 
 
 
-static void DefineConst (unsigned Addr)
-/* Define an address constant */
-{
-    Output ("%s", SymTab[Addr]->Name);
-    Indent (AIndent);
-    Output ("= $%04X", Addr);
-    LineFeed ();
-}
-
-
-
 void DefOutOfRangeLabels (void)
 /* Output any labels that are out of the loaded code range */
 {
@@ -409,7 +398,7 @@ void DefOutOfRangeLabels (void)
     Addr = 0;
     while (Addr < CodeStart) {
        if (MustDefLabel (Addr)) {
-           DefineConst (Addr);
+           DefineConst (SymTab[Addr]->Name, SymTab[Addr]->Comment, Addr);
        }
         ++Addr;
     }
@@ -417,7 +406,7 @@ void DefOutOfRangeLabels (void)
     /* Skip areas in code range */
     while (Addr <= CodeEnd) {
         if ((AttrTab[Addr] & atStyleMask) == atSkip && MustDefLabel (Addr)) {
-            DefineConst (Addr);
+           DefineConst (SymTab[Addr]->Name, SymTab[Addr]->Comment, Addr);
         }
         ++Addr;
     }
@@ -425,7 +414,7 @@ void DefOutOfRangeLabels (void)
     /* High range */
     while (Addr < 0x10000) {
        if (MustDefLabel (Addr)) {
-           DefineConst (Addr);
+           DefineConst (SymTab[Addr]->Name, SymTab[Addr]->Comment, Addr);
        }
         ++Addr;
     }
index aba6bd65f513c266370770a4effbda6f14e7e961..42b41a32db5125e4a7d4279fb86ad1394d02b853 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2004 Ullrich von Bassewitz                                       */
+/* (C) 2000-2005 Ullrich von Bassewitz                                       */
 /*               Römerstrasse 52                                             */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
index 60541c93f791edd1320e32b08bca9e572f3ab74d..2a21d329aad670d762125b83816663f07b8cf270 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2003 Ullrich von Bassewitz                                       */
+/* (C) 2000-2005 Ullrich von Bassewitz                                       */
 /*               Römerstrasse 52                                             */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -74,12 +74,12 @@ static void PageHeader (void)
 /* Print a page header */
 {
     fprintf (F,
-                    "; da65 V%u.%u.%u - (C) Copyright 2000-2003 Ullrich von Bassewitz\n"
-            "; Input file: %s\n"
-            "; Page:       %u\n\n",
+                    "; da65 V%u.%u.%u - (C) Copyright 2000-2005 Ullrich von Bassewitz\n"
+            "; Input file: %s\n"
+            "; Page:       %u\n\n",
                     VER_MAJOR, VER_MINOR, VER_PATCH,
-            InFile,
-            Page);
+            InFile,
+            Page);
 }
 
 
@@ -286,17 +286,17 @@ void LineComment (unsigned PC, unsigned Count)
        Output ("; %04X", PC);
        if (Comments >= 3) {
            for (I = 0; I < Count; ++I) {
-               Output (" %02X", CodeBuf [PC+I]);
+               Output (" %02X", CodeBuf [PC+I]);
            }
            if (Comments >= 4) {
-               Indent (TIndent);
-               for (I = 0; I < Count; ++I) {
-                   unsigned char C = CodeBuf [PC+I];
-                   if (!isprint (C)) {
-                       C = '.';
-                   }
-                   Output ("%c", C);
-               }
+               Indent (TIndent);
+               for (I = 0; I < Count; ++I) {
+                   unsigned char C = CodeBuf [PC+I];
+                   if (!isprint (C)) {
+                       C = '.';
+                   }
+                   Output ("%c", C);
+               }
            }
        }
     }
@@ -318,3 +318,20 @@ void OutputSettings (void)
 
 
 
+void DefineConst (const char* Name, const char* Comment, unsigned Addr)
+/* Define an address constant */
+{
+    if (Pass == PassCount) {
+        Output ("%s", Name);
+        Indent (AIndent);
+        Output (":= $%04X", Addr);
+        if (Comment) {
+            Indent (CIndent);
+            Output ("; %s", Comment);
+        }
+        LineFeed ();
+    }
+}
+
+
+
index 161a12f3985dca897312ac07d4f2f60b6d19ea6c..568a1b0af3c88f57be77c149f3195fa8dd200ca0 100644 (file)
@@ -94,6 +94,9 @@ void LineComment (unsigned PC, unsigned Count);
 void OutputSettings (void);
 /* Output CPU and other settings */
 
+void DefineConst (const char* Name, const char* Comment, unsigned Addr);
+/* Define an address constant */
+
 
 
 /* End of output.h */