mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
rgbasm: -v option (verbose)
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
#ifndef ASMOTOR_MAIN_H
|
#ifndef ASMOTOR_MAIN_H
|
||||||
#define ASMOTOR_MAIN_H
|
#define ASMOTOR_MAIN_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
struct sOptions {
|
struct sOptions {
|
||||||
char gbgfx[4];
|
char gbgfx[4];
|
||||||
char binary[2];
|
char binary[2];
|
||||||
SLONG fillchar;
|
SLONG fillchar;
|
||||||
|
bool verbose;
|
||||||
//-1 == random
|
//-1 == random
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ PrintUsage(void)
|
|||||||
{
|
{
|
||||||
printf("RGBAsm v" ASM_VERSION " (part of ASMotor " ASMOTOR_VERSION
|
printf("RGBAsm v" ASM_VERSION " (part of ASMotor " ASMOTOR_VERSION
|
||||||
")\n\n");
|
")\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");
|
" file\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -282,12 +282,13 @@ main(int argc, char *argv[])
|
|||||||
DefaultOptions.binary[0] = '0';
|
DefaultOptions.binary[0] = '0';
|
||||||
DefaultOptions.binary[1] = '1';
|
DefaultOptions.binary[1] = '1';
|
||||||
DefaultOptions.fillchar = 0;
|
DefaultOptions.fillchar = 0;
|
||||||
|
DefaultOptions.verbose = false;
|
||||||
|
|
||||||
opt_SetCurrentOptions(&DefaultOptions);
|
opt_SetCurrentOptions(&DefaultOptions);
|
||||||
|
|
||||||
newopt = CurrentOptions;
|
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) {
|
switch (ch) {
|
||||||
case 'b':
|
case 'b':
|
||||||
if (strlen(optarg) == 2) {
|
if (strlen(optarg) == 2) {
|
||||||
@@ -333,6 +334,9 @@ main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'v':
|
||||||
|
newopt.verbose = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
PrintUsage();
|
PrintUsage();
|
||||||
}
|
}
|
||||||
@@ -349,7 +353,9 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
setuplex();
|
setuplex();
|
||||||
|
|
||||||
|
if (CurrentOptions.verbose) {
|
||||||
printf("Assembling %s\n", tzMainfile);
|
printf("Assembling %s\n", tzMainfile);
|
||||||
|
}
|
||||||
|
|
||||||
nStartClock = clock();
|
nStartClock = clock();
|
||||||
|
|
||||||
@@ -361,7 +367,9 @@ main(int argc, char *argv[])
|
|||||||
nErrors = 0;
|
nErrors = 0;
|
||||||
sym_PrepPass1();
|
sym_PrepPass1();
|
||||||
if (fstk_Init(tzMainfile)) {
|
if (fstk_Init(tzMainfile)) {
|
||||||
|
if (CurrentOptions.verbose) {
|
||||||
printf("Pass 1...\n");
|
printf("Pass 1...\n");
|
||||||
|
}
|
||||||
|
|
||||||
yy_set_state(LEX_STATE_NORMAL);
|
yy_set_state(LEX_STATE_NORMAL);
|
||||||
opt_SetCurrentOptions(&DefaultOptions);
|
opt_SetCurrentOptions(&DefaultOptions);
|
||||||
@@ -380,7 +388,9 @@ main(int argc, char *argv[])
|
|||||||
yy_set_state(LEX_STATE_NORMAL);
|
yy_set_state(LEX_STATE_NORMAL);
|
||||||
opt_SetCurrentOptions(&DefaultOptions);
|
opt_SetCurrentOptions(&DefaultOptions);
|
||||||
|
|
||||||
|
if (CurrentOptions.verbose) {
|
||||||
printf("Pass 2...\n");
|
printf("Pass 2...\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (yyparse() == 0 && nErrors == 0) {
|
if (yyparse() == 0 && nErrors == 0) {
|
||||||
double timespent;
|
double timespent;
|
||||||
@@ -389,6 +399,7 @@ main(int argc, char *argv[])
|
|||||||
timespent =
|
timespent =
|
||||||
((double) (nEndClock - nStartClock))
|
((double) (nEndClock - nStartClock))
|
||||||
/ (double) CLOCKS_PER_SEC;
|
/ (double) CLOCKS_PER_SEC;
|
||||||
|
if (CurrentOptions.verbose) {
|
||||||
printf
|
printf
|
||||||
("Success! %ld lines in %d.%02d seconds ",
|
("Success! %ld lines in %d.%02d seconds ",
|
||||||
nTotalLines, (int) timespent,
|
nTotalLines, (int) timespent,
|
||||||
@@ -400,6 +411,7 @@ main(int argc, char *argv[])
|
|||||||
printf("(%d lines/minute)\n",
|
printf("(%d lines/minute)\n",
|
||||||
(int) (60 / timespent *
|
(int) (60 / timespent *
|
||||||
nTotalLines));
|
nTotalLines));
|
||||||
|
}
|
||||||
out_WriteObject();
|
out_WriteObject();
|
||||||
} else {
|
} else {
|
||||||
printf
|
printf
|
||||||
|
|||||||
@@ -594,7 +594,9 @@ void
|
|||||||
out_SetFileName(char *s)
|
out_SetFileName(char *s)
|
||||||
{
|
{
|
||||||
strcpy(tzObjectname, s);
|
strcpy(tzObjectname, s);
|
||||||
|
if (CurrentOptions.verbose) {
|
||||||
printf("Output filename %s\n", s);
|
printf("Output filename %s\n", s);
|
||||||
|
}
|
||||||
pSectionList = NULL;
|
pSectionList = NULL;
|
||||||
pCurrentSection = NULL;
|
pCurrentSection = NULL;
|
||||||
pPatchSymbols = NULL;
|
pPatchSymbols = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user