<title>sim65 Users Guide
 <author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
-<date>2016-01-05
+<date>2016-07-05
 
 <abstract>
 sim65 is a simulator for 6502 and 65C02 CPUs. It allows to test target
        Usage: sim65 [options] file [arguments]
        Short options:
          -h                    Help (this text)
+         -c                    Print amount of executed CPU cycles
          -v                    Increase verbosity
          -V                    Print the simulator version number
          -x <num>              Exit simulator after <num> cycles
 
        Long options:
          --help                Help (this text)
+         --cycles              Print amount of executed CPU cycles
          --verbose             Increase verbosity
          --version             Print the simulator version number
 </verb></tscreen>
   Print the short option summary shown above.
 
 
+  <tag><tt>-c, --cycles</tt></tag>
+
+  Print the number of executed CPU cycles when the program terminates.
+  The cycles for the final "<tt>jmp exit</tt>" are not included in this
+  count.
+
+
   <tag><tt>-v, --verbose</tt></tag>
 
   Increase the simulator verbosity.
 
 const char* ProgramFile;
 
 /* exit simulator after MaxCycles Cycles */
-unsigned long MaxCycles = 0;
+unsigned long MaxCycles;
 
 /*****************************************************************************/
 /*                                   Code                                    */
     printf ("Usage: %s [options] file [arguments]\n"
             "Short options:\n"
             "  -h\t\t\tHelp (this text)\n"
+            "  -c\t\t\tPrint amount of executed CPU cycles\n"
             "  -v\t\t\tIncrease verbosity\n"
             "  -V\t\t\tPrint the simulator version number\n"
             "  -x <num>\t\tExit simulator after <num> cycles\n"
             "\n"
             "Long options:\n"
             "  --help\t\tHelp (this text)\n"
+            "  --cycles\t\tPrint amount of executed CPU cycles\n"
             "  --verbose\t\tIncrease verbosity\n"
             "  --version\t\tPrint the simulator version number\n",
             ProgName);
 
 
 
+static void OptCycles (const char* Opt attribute ((unused)),
+                       const char* Arg attribute ((unused)))
+/* Set flag to print amount of cycles at the end */
+{
+    PrintCycles = 1;
+}
+
+
+
 static void OptVersion (const char* Opt attribute ((unused)),
                         const char* Arg attribute ((unused)))
 /* Print the simulator version */
     /* Program long options */
     static const LongOpt OptTab[] = {
         { "--help",             0,      OptHelp                 },
+        { "--cycles",           0,      OptCycles               },
         { "--verbose",          0,      OptVerbose              },
         { "--version",          0,      OptVersion              },
     };
                     OptHelp (Arg, 0);
                     break;
 
+                case 'c':
+                    OptCycles (Arg, 0);
+                    break;
+
                 case 'v':
                     OptVerbose (Arg, 0);
                     break;