sim65: add command line parameter to print number of CPU cycles at exit
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
const char* ProgramFile;
|
||||
|
||||
/* exit simulator after MaxCycles Cycles */
|
||||
unsigned long MaxCycles = 0;
|
||||
unsigned long MaxCycles;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
@@ -74,12 +74,14 @@ static void Usage (void)
|
||||
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);
|
||||
@@ -106,6 +108,15 @@ static void OptVerbose (const char* Opt attribute ((unused)),
|
||||
|
||||
|
||||
|
||||
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 */
|
||||
@@ -166,6 +177,7 @@ int main (int argc, char* argv[])
|
||||
/* Program long options */
|
||||
static const LongOpt OptTab[] = {
|
||||
{ "--help", 0, OptHelp },
|
||||
{ "--cycles", 0, OptCycles },
|
||||
{ "--verbose", 0, OptVerbose },
|
||||
{ "--version", 0, OptVersion },
|
||||
};
|
||||
@@ -196,6 +208,10 @@ int main (int argc, char* argv[])
|
||||
OptHelp (Arg, 0);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
OptCycles (Arg, 0);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
OptVerbose (Arg, 0);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user