From 1a68dd715a1c7b2131028c66c7393b61f787e0b0 Mon Sep 17 00:00:00 2001 From: cuz Date: Mon, 10 May 2004 21:50:13 +0000 Subject: [PATCH] New --list-bytes option git-svn-id: svn://svn.cc65.org/cc65/trunk@3019 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/main.c | 28 ++++++++++++++++++++++++++-- src/cl65/main.c | 10 ++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/ca65/main.c b/src/ca65/main.c index c69fb0d1e..fdff40949 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2003 Ullrich von Bassewitz */ +/* (C) 1998-2004 Ullrich von Bassewitz */ /* Römerstraße 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -111,6 +111,7 @@ static void Usage (void) " --ignore-case\t\tIgnore case of symbols\n" " --include-dir dir\tSet an include directory search path\n" " --listing\t\tCreate a listing if assembly was ok\n" + " --list-bytes n\tMaximum number of bytes per listing line\n" " --memory-model model\tSet the memory model\n" " --pagelength n\tSet the page length for the listing\n" " --smart\t\tEnable smart mode\n" @@ -203,7 +204,7 @@ static void DefineSymbol (const char* Def) static void OptAutoImport (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Mark unresolved symbols as imported */ { AutoImport = 1; @@ -271,6 +272,28 @@ static void OptIncludeDir (const char* Opt attribute ((unused)), const char* Arg +static void OptListBytes (const char* Opt, const char* Arg) +/* Set the maximum number of bytes per listing line */ +{ + unsigned Num; + char Check; + + /* Convert the argument to a number */ + if (sscanf (Arg, "%u%c", &Num, &Check) != 1) { + AbEnd ("Invalid argument for option `%s'", Opt); + } + + /* Check the bounds */ + if (Num != 0 && (Num < MIN_LIST_BYTES || Num > MAX_LIST_BYTES)) { + AbEnd ("Argument for option `%s' is out of range", Opt); + } + + /* Use the value */ + SetListBytes (Num); +} + + + static void OptListing (const char* Opt attribute ((unused)), const char* Arg attribute ((unused))) /* Create a listing file */ @@ -593,6 +616,7 @@ int main (int argc, char* argv []) { "--help", 0, OptHelp }, { "--ignore-case", 0, OptIgnoreCase }, { "--include-dir", 1, OptIncludeDir }, + { "--list-bytes", 1, OptListBytes }, { "--listing", 0, OptListing }, { "--memory-model", 1, OptMemoryModel }, { "--pagelength", 1, OptPageLength }, diff --git a/src/cl65/main.c b/src/cl65/main.c index aa12d191f..2e56bed2b 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -646,6 +646,7 @@ static void Usage (void) " --lib-path path\tSpecify a library search path\n" " --list-targets\tList all available targets\n" " --listing\t\tCreate an assembler listing\n" + " --list-bytes n\tNumber of bytes per assembler listing line\n" " --mapfile name\tCreate a map file\n" " --memory-model model\tSet the memory model\n" " --module\t\tLink as a module\n" @@ -881,6 +882,14 @@ static void OptLibPath (const char* Opt attribute ((unused)), const char* Arg) +static void OptListBytes (const char* Opt attribute ((unused)), const char* Arg) +/* Set the maximum number of bytes per asm listing line */ +{ + CmdAddArg2 (&CA65, "--list-bytes", Arg); +} + + + static void OptListing (const char* Opt attribute ((unused)), const char* Arg attribute ((unused))) /* Create an assembler listing */ @@ -1108,6 +1117,7 @@ int main (int argc, char* argv []) { "--lib-path", 1, OptLibPath }, { "--list-targets", 0, OptListTargets }, { "--listing", 0, OptListing }, + { "--list-bytes", 1, OptListBytes }, { "--mapfile", 1, OptMapFile }, { "--memory-model", 1, OptMemoryModel }, { "--module", 0, OptModule }, -- 2.39.5