mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Remove non-OPT options from Options struct
This commit is contained in:
@@ -18,12 +18,7 @@
|
||||
struct sOptions {
|
||||
char binary[2];
|
||||
char gbgfx[4];
|
||||
bool exportall;
|
||||
int32_t fillchar;
|
||||
bool haltnop;
|
||||
bool optimizeloads;
|
||||
bool verbose;
|
||||
bool warnings; /* True to enable warnings, false to disable them. */
|
||||
};
|
||||
|
||||
extern char *tzNewMacro;
|
||||
@@ -35,6 +30,10 @@ extern uint32_t curOffset; /* Offset into the current section */
|
||||
|
||||
extern struct sOptions DefaultOptions;
|
||||
extern struct sOptions CurrentOptions;
|
||||
extern bool haltnop;
|
||||
extern bool optimizeloads;
|
||||
extern bool verbose;
|
||||
extern bool warnings; /* True to enable warnings, false to disable them. */
|
||||
|
||||
extern FILE *dependfile;
|
||||
extern char *tzTargetFileName;
|
||||
|
||||
@@ -1618,7 +1618,7 @@ z80_ei : T_Z80_EI { out_AbsByte(0xFB); }
|
||||
|
||||
z80_halt : T_Z80_HALT {
|
||||
out_AbsByte(0x76);
|
||||
if (CurrentOptions.haltnop)
|
||||
if (haltnop)
|
||||
out_AbsByte(0x00);
|
||||
}
|
||||
;
|
||||
@@ -1718,8 +1718,8 @@ z80_ld_mem : T_Z80_LD op_mem_ind ',' T_MODE_SP {
|
||||
out_RelWord(&$2);
|
||||
}
|
||||
| T_Z80_LD op_mem_ind ',' T_MODE_A {
|
||||
if (CurrentOptions.optimizeloads &&
|
||||
(rpn_isKnown(&$2)) && ($2.nVal >= 0xFF00)) {
|
||||
if (optimizeloads && rpn_isKnown(&$2)
|
||||
&& $2.nVal >= 0xFF00) {
|
||||
out_AbsByte(0xE0);
|
||||
out_AbsByte($2.nVal & 0xFF);
|
||||
rpn_Free(&$2);
|
||||
@@ -1766,8 +1766,8 @@ z80_ld_a : T_Z80_LD reg_r ',' T_MODE_C_IND {
|
||||
}
|
||||
| T_Z80_LD reg_r ',' op_mem_ind {
|
||||
if ($2 == REG_A) {
|
||||
if (CurrentOptions.optimizeloads &&
|
||||
(rpn_isKnown(&$4)) && ($4.nVal >= 0xFF00)) {
|
||||
if (optimizeloads && rpn_isKnown(&$4)
|
||||
&& $4.nVal >= 0xFF00) {
|
||||
out_AbsByte(0xF0);
|
||||
out_AbsByte($4.nVal & 0xFF);
|
||||
rpn_Free(&$4);
|
||||
|
||||
@@ -434,7 +434,7 @@ void fstk_RunInclude(char *tzFileName)
|
||||
nCurrentStatus = STAT_isInclude;
|
||||
snprintf(tzCurrentFileName, sizeof(tzCurrentFileName), "%s%s",
|
||||
incPathUsed, tzFileName);
|
||||
if (CurrentOptions.verbose)
|
||||
if (verbose)
|
||||
printf("Assembling %s\n", tzCurrentFileName);
|
||||
pCurrentFile = f;
|
||||
CurrentFlexHandle = yy_create_buffer(pCurrentFile);
|
||||
|
||||
@@ -63,6 +63,10 @@ char *tzTargetFileName;
|
||||
|
||||
struct sOptions DefaultOptions;
|
||||
struct sOptions CurrentOptions;
|
||||
bool haltnop;
|
||||
bool optimizeloads;
|
||||
bool verbose;
|
||||
bool warnings; /* True to enable warnings, false to disable them. */
|
||||
|
||||
struct sOptionStackEntry {
|
||||
struct sOptions Options;
|
||||
@@ -360,12 +364,12 @@ int main(int argc, char *argv[])
|
||||
DefaultOptions.gbgfx[3] = '3';
|
||||
DefaultOptions.binary[0] = '0';
|
||||
DefaultOptions.binary[1] = '1';
|
||||
DefaultOptions.exportall = false;
|
||||
DefaultOptions.fillchar = 0;
|
||||
DefaultOptions.optimizeloads = true;
|
||||
DefaultOptions.haltnop = true;
|
||||
DefaultOptions.verbose = false;
|
||||
DefaultOptions.warnings = true;
|
||||
optimizeloads = true;
|
||||
haltnop = true;
|
||||
verbose = false;
|
||||
warnings = true;
|
||||
bool exportall = false;
|
||||
|
||||
opt_SetCurrentOptions(&DefaultOptions);
|
||||
|
||||
@@ -386,7 +390,7 @@ int main(int argc, char *argv[])
|
||||
opt_AddDefine(optarg);
|
||||
break;
|
||||
case 'E':
|
||||
newopt.exportall = true;
|
||||
exportall = true;
|
||||
break;
|
||||
case 'g':
|
||||
if (strlen(optarg) == 4) {
|
||||
@@ -399,13 +403,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
newopt.haltnop = false;
|
||||
haltnop = false;
|
||||
break;
|
||||
case 'i':
|
||||
fstk_AddIncludePath(optarg);
|
||||
break;
|
||||
case 'L':
|
||||
newopt.optimizeloads = false;
|
||||
optimizeloads = false;
|
||||
break;
|
||||
case 'M':
|
||||
if (!strcmp("-", optarg))
|
||||
@@ -439,13 +443,13 @@ int main(int argc, char *argv[])
|
||||
printf("rgbasm %s\n", get_package_version_string());
|
||||
exit(0);
|
||||
case 'v':
|
||||
newopt.verbose = true;
|
||||
verbose = true;
|
||||
break;
|
||||
case 'W':
|
||||
processWarningFlag(optarg);
|
||||
break;
|
||||
case 'w':
|
||||
newopt.warnings = false;
|
||||
warnings = false;
|
||||
break;
|
||||
|
||||
/* Long-only options */
|
||||
@@ -510,7 +514,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
setup_lexer();
|
||||
|
||||
if (CurrentOptions.verbose)
|
||||
if (verbose)
|
||||
printf("Assembling %s\n", tzMainfile);
|
||||
|
||||
if (dependfile) {
|
||||
@@ -528,7 +532,7 @@ int main(int argc, char *argv[])
|
||||
skipElif = true;
|
||||
nUnionDepth = 0;
|
||||
sym_Init();
|
||||
sym_SetExportAll(CurrentOptions.exportall);
|
||||
sym_SetExportAll(exportall);
|
||||
fstk_Init(tzMainfile);
|
||||
opt_ParseDefines();
|
||||
charmap_InitMain();
|
||||
@@ -554,7 +558,7 @@ int main(int argc, char *argv[])
|
||||
nEndClock = clock();
|
||||
timespent = ((double)(nEndClock - nStartClock))
|
||||
/ (double)CLOCKS_PER_SEC;
|
||||
if (CurrentOptions.verbose) {
|
||||
if (verbose) {
|
||||
printf("Success! %u lines in %d.%02d seconds ", nTotalLines,
|
||||
(int)timespent, ((int)(timespent * 100.0)) % 100);
|
||||
if (timespent < FLT_MIN_EXP)
|
||||
|
||||
@@ -416,6 +416,6 @@ void out_WriteObject(void)
|
||||
void out_SetFileName(char *s)
|
||||
{
|
||||
tzObjectname = s;
|
||||
if (CurrentOptions.verbose)
|
||||
if (verbose)
|
||||
printf("Output filename %s\n", s);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ static bool warningsAreErrors; /* Set if `-Werror` was specified */
|
||||
static enum WarningState warningState(enum WarningID id)
|
||||
{
|
||||
/* Check if warnings are globally disabled */
|
||||
if (!CurrentOptions.warnings)
|
||||
if (!warnings)
|
||||
return WARNING_DISABLED;
|
||||
|
||||
/* Get the actual state */
|
||||
|
||||
Reference in New Issue
Block a user