From 2c091595e923fce57faff0d7efc084b91d6e8b70 Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Sun, 10 May 2015 01:12:36 +0200 Subject: [PATCH] Add option -yl1 to list pass 1 as well Normally listing is suppressed during the first pass, because there are many unresolved symbols, which will be better in pass 2. Errors are also suppressed because most of them are spurious. With the -yl1 option, listing during pass 1 is not suppressed. If you give the option twice, you also get the error messages. --- listing.c | 7 +++++-- listing.h | 2 ++ macro11.c | 9 ++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/listing.c b/listing.c index 609494b..95acf15 100644 --- a/listing.c +++ b/listing.c @@ -28,6 +28,7 @@ static char *binline; /* for octal expansion */ FILE *lstfile = NULL; +int list_pass_0 = 0;/* Also list what happens during the first pass */ @@ -36,7 +37,9 @@ FILE *lstfile = NULL; static int dolist( void) { - int ok = lstfile != NULL && pass > 0 && list_level > 0; + int ok = lstfile != NULL && + (pass > 0 || list_pass_0) && + list_level > 0; return ok; } @@ -147,7 +150,7 @@ void report( char *name = "**"; int line = 0; - if (!pass) + if (!pass && list_pass_0 < 2) return; /* Don't report now. */ if (str) { diff --git a/listing.h b/listing.h index 9d7a9ea..c9139a5 100644 --- a/listing.h +++ b/listing.h @@ -35,6 +35,8 @@ extern int list_level; /* Listing control level. .LIST extern FILE *lstfile; +extern int list_pass_0; /* Also list what happens during the first pass */ + #endif diff --git a/macro11.c b/macro11.c index 1786367..448a042 100644 --- a/macro11.c +++ b/macro11.c @@ -125,6 +125,7 @@ static void print_help( printf("-ysl Syntax extension: change length of symbols from \n"); printf(" default = %d to larger values, max %d.\n", SYMMAX_DEFAULT, SYMMAX_MAX); printf("-yus Syntax extension: allow underscore \"_\" in symbols.\n"); + printf("-yl1 Extension: list the first pass too, not only the second.\n"); printf("\n"); printf("Options for -e and -d are:\n"); printf("AMA (off) - absolute addressing (versus PC-relative)\n"); @@ -236,7 +237,7 @@ int main( /* The option -l gives the listing file name (.LST) */ /* -l - enables listing to stdout. */ if(arg >= argc-1 || - (argv[arg+1][0] == '-' && argv[arg+1][1] != '\0')) { + (argv[arg+1][0] == '-' && argv[arg+1][1] != '\0')) { usage("-l must be followed by the listing file name (- for standard output)\n"); } lstname = argv[++arg]; @@ -275,6 +276,9 @@ int main( } else if (!stricmp(cp, "yus")) { /* allow underscores */ symbol_allow_underscores = 1; + } else if (!stricmp(cp, "yl1")) { + /* list the first pass, in addition to the second */ + list_pass_0++; } else { fprintf(stderr, "Unknown option %s\n", argv[arg]); print_help(); @@ -324,6 +328,9 @@ int main( assemble_stack(&stack, &tr); + if (list_pass_0 && lstfile) { + list_symbol_table(); + } #if 0 if (enabl_debug) dump_all_macros();