shithub: rgbds

Download patch

ref: bc99ee2210d3850b08ff5c938608fced0ab55515
parent: de269987f75dbf32fe8ddca5ef7501b809f7ed45
author: yenatch <[email protected]>
date: Tue Nov 26 21:43:10 EST 2013

rgbasm: -v option (verbose)

--- a/include/asm/main.h
+++ b/include/asm/main.h
@@ -1,10 +1,13 @@
 #ifndef	ASMOTOR_MAIN_H
 #define	ASMOTOR_MAIN_H
 
+#include <stdbool.h>
+
 struct sOptions {
 	char gbgfx[4];
 	char binary[2];
 	SLONG fillchar;
+	bool verbose;
 	    //-1 == random
 };
 
--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -247,7 +247,7 @@
 {
 	printf("RGBAsm v" ASM_VERSION " (part of ASMotor " ASMOTOR_VERSION
 	    ")\n\n");
-	printf("Usage: rgbasm [-h] [-b chars] [-g chars] [-i path] [-o outfile] [-p pad_value]\n"
+	printf("Usage: rgbasm [-v] [-h] [-b chars] [-g chars] [-i path] [-o outfile] [-p pad_value]\n"
 	    "              file\n");
 	exit(1);
 }
@@ -282,12 +282,13 @@
 	DefaultOptions.binary[0] = '0';
 	DefaultOptions.binary[1] = '1';
 	DefaultOptions.fillchar = 0;
+	DefaultOptions.verbose = false;
 
 	opt_SetCurrentOptions(&DefaultOptions);
 
 	newopt = CurrentOptions;
 
-	while ((ch = getopt(argc, argv, "b:g:hi:o:p:")) != -1) {
+	while ((ch = getopt(argc, argv, "b:g:hi:o:p:v")) != -1) {
 		switch (ch) {
 		case 'b':
 			if (strlen(optarg) == 2) {
@@ -333,6 +334,9 @@
 				exit(1);
 			}
 			break;
+		case 'v':
+			newopt.verbose = true;
+			break;
 		default:
 			PrintUsage();
 		}
@@ -349,7 +353,9 @@
 
 	setuplex();
 
-	printf("Assembling %s\n", tzMainfile);
+	if (CurrentOptions.verbose) {
+		printf("Assembling %s\n", tzMainfile);
+	}
 
 	nStartClock = clock();
 
@@ -361,7 +367,9 @@
 	nErrors = 0;
 	sym_PrepPass1();
 	if (fstk_Init(tzMainfile)) {
-		printf("Pass 1...\n");
+		if (CurrentOptions.verbose) {
+			printf("Pass 1...\n");
+		}
 
 		yy_set_state(LEX_STATE_NORMAL);
 		opt_SetCurrentOptions(&DefaultOptions);
@@ -380,7 +388,9 @@
 				yy_set_state(LEX_STATE_NORMAL);
 				opt_SetCurrentOptions(&DefaultOptions);
 
-				printf("Pass 2...\n");
+				if (CurrentOptions.verbose) {
+					printf("Pass 2...\n");
+				}
 
 				if (yyparse() == 0 && nErrors == 0) {
 					double timespent;
@@ -389,17 +399,19 @@
 					timespent =
 					    ((double) (nEndClock - nStartClock))
 					    / (double) CLOCKS_PER_SEC;
-					printf
-					    ("Success! %ld lines in %d.%02d seconds ",
-					    nTotalLines, (int) timespent,
-					    ((int) (timespent * 100.0)) % 100);
-					if (timespent == 0)
+					if (CurrentOptions.verbose) {
 						printf
-						    ("(INFINITY lines/minute)\n");
-					else
-						printf("(%d lines/minute)\n",
-						    (int) (60 / timespent *
-							nTotalLines));
+						    ("Success! %ld lines in %d.%02d seconds ",
+						    nTotalLines, (int) timespent,
+						    ((int) (timespent * 100.0)) % 100);
+						if (timespent == 0)
+							printf
+							    ("(INFINITY lines/minute)\n");
+						else
+							printf("(%d lines/minute)\n",
+							    (int) (60 / timespent *
+								nTotalLines));
+					}
 					out_WriteObject();
 				} else {
 					printf
--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -594,7 +594,9 @@
 out_SetFileName(char *s)
 {
 	strcpy(tzObjectname, s);
-	printf("Output filename %s\n", s);
+	if (CurrentOptions.verbose) {
+		printf("Output filename %s\n", s);
+	}
 	pSectionList = NULL;
 	pCurrentSection = NULL;
 	pPatchSymbols = NULL;