]> git.sur5r.net Git - cc65/blobdiff - src/co65/convert.c
The opcode for BS should be 0x0C.
[cc65] / src / co65 / convert.c
index ef05b6ba0043eae3ea17e39a98a5c11368065cba..af036ebf757b6fd328058d90efda94f1ee959cac 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2003      Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2003-2011, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -54,7 +54,7 @@
 
 
 /*****************************************************************************/
-/*                                          Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
@@ -114,9 +114,9 @@ static const char* LabelPlusOffs (const char* Label, long Offs)
 static const char* RelocExpr (const O65Data* D, unsigned char SegID,
                               unsigned long Val, const O65Reloc* R)
 /* Generate the segment relative relocation expression. R is only used if the
- * expression contains am import, and may be NULL if this is an error (which
- * is then flagged).
- */
+** expression contains am import, and may be NULL if this is an error (which
+** is then flagged).
+*/
 {
     const O65Import* Import;
 
@@ -346,10 +346,10 @@ static void ConvertZeropageSeg (FILE* F, const O65Data* D)
 
     if (Model == O65_MODEL_CC65_MODULE) {
         /* o65 files of type cc65-module are linked together with a definition
-         * file for the zero page, but the zero page is not allocated in the
-         * module itself, but the locations are mapped to the zp locations of
-         * the main file.
-         */
+        ** file for the zero page, but the zero page is not allocated in the
+        ** module itself, but the locations are mapped to the zp locations of
+        ** the main file.
+        */
         fprintf (F, ".import\t__ZP_START__\t\t; Linker generated symbol\n");
         fprintf (F, "%s = __ZP_START__\n", ZeropageLabel);
     } else {
@@ -372,8 +372,8 @@ void Convert (const O65Data* D)
     char*       Author = 0;
 
     /* For now, we do only accept o65 files generated by the ld65 linker which
-     * have a specific format.
-     */
+    ** have a specific format.
+    */
     if (!Debug && D->Header.mode != O65_MODE_CC65) {
         Error ("Cannot convert o65 files of this type");
     }
@@ -382,9 +382,9 @@ void Convert (const O65Data* D)
     PrintO65Stats (D);
 
     /* Walk through the options and print them if verbose mode is enabled.
-     * Check for a os=cc65 option and bail out if we didn't find one (for
-     * now - later we switch to special handling).
-     */
+    ** Check for a os=cc65 option and bail out if we didn't find one (for
+    ** now - later we switch to special handling).
+    */
     for (I = 0; I < CollCount (&D->Options); ++I) {
 
         /* Get the next option */
@@ -448,23 +448,22 @@ void Convert (const O65Data* D)
     }
 
     /* Open the output file */
-    F = fopen (OutputName, "wb");
+    F = fopen (OutputName, "w");
     if (F == 0) {
         Error ("Cannot open `%s': %s", OutputName, strerror (errno));
     }
 
     /* Create a header */
-    fprintf (F, ";\n; File generated by co65 v %u.%u.%u using model `%s'\n;\n",
-             VER_MAJOR, VER_MINOR, VER_PATCH, GetModelName (Model));
+    fprintf (F, ";\n; File generated by co65 v %s using model `%s'\n;\n",
+             GetVersionAsString (), GetModelName (Model));
 
     /* Select the CPU */
     if ((D->Header.mode & O65_CPU_MASK) == O65_CPU_65816) {
-       fprintf (F, ".p816\n");
+        fprintf (F, ".p816\n");
     }
 
     /* Object file options */
-    fprintf (F, ".fopt\t\tcompiler,\"co65 v %u.%u.%u\"\n",
-             VER_MAJOR, VER_MINOR, VER_PATCH);
+    fprintf (F, ".fopt\t\tcompiler,\"co65 v %s\"\n", GetVersionAsString ());
     if (Author) {
         fprintf (F, ".fopt\t\tauthor, \"%s\"\n", Author);
         xfree (Author);
@@ -503,6 +502,3 @@ void Convert (const O65Data* D)
     fprintf (F, ".end\n");
     fclose (F);
 }
-
-
-