mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Remove the deprecated -H/-h/-L/-l options
This commit is contained in:
@@ -26,10 +26,6 @@ _rgbasm_completions() {
|
||||
declare -A opts=(
|
||||
[V]="version:normal"
|
||||
[E]="export-all:normal"
|
||||
[H]="nop-after-halt:normal"
|
||||
[h]="halt-without-nop:normal"
|
||||
[L]="preserve-ld:normal"
|
||||
[l]="auto-ldh:normal"
|
||||
[v]="verbose:normal"
|
||||
[w]=":normal"
|
||||
[b]="binary-digits:unk"
|
||||
|
||||
@@ -37,10 +37,6 @@ local args=(
|
||||
'(- : * options)'{-V,--version}'[Print version number]'
|
||||
|
||||
'(-E --export-all)'{-E,--export-all}'[Export all symbols]'
|
||||
'(-H --nop-after-halt)'{-H,--nop-after-halt}'[Output a `nop` after `halt`]'
|
||||
'(-h --halt-without-nop)'{-h,--halt-without-nop}'[Prevent outputting a `nop` after `halt`]'
|
||||
'(-L --preserve-ld)'{-L,--preserve-ld}'[Prevent optimizing `ld` into `ldh`]'
|
||||
'(-l --auto-ldh)'{-l,--auto-ldh}'[Optimize `ld` into `ldh`]'
|
||||
'(-v --verbose)'{-v,--verbose}'[Print additional messages regarding progression]'
|
||||
-w'[Disable all warnings]'
|
||||
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
extern bool haltNop;
|
||||
extern bool warnOnHaltNop;
|
||||
extern bool optimizeLoads;
|
||||
extern bool warnOnLdOpt;
|
||||
extern bool verbose;
|
||||
extern bool warnings; // True to enable warnings, false to disable them.
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ void opt_B(char const chars[2]);
|
||||
void opt_G(char const chars[4]);
|
||||
void opt_P(uint8_t padByte);
|
||||
void opt_Q(uint8_t precision);
|
||||
void opt_L(bool optimize);
|
||||
void opt_W(char const *flag);
|
||||
void opt_Parse(char const *option);
|
||||
|
||||
|
||||
17
man/rgbasm.1
17
man/rgbasm.1
@@ -66,15 +66,6 @@ Export all labels, including unreferenced and local labels.
|
||||
.It Fl g Ar chars , Fl \-gfx-chars Ar chars
|
||||
Change the four characters used for gfx constants.
|
||||
The defaults are 0123.
|
||||
.It Fl H , Fl \-nop-after-halt
|
||||
Inserts a
|
||||
.Ic nop
|
||||
instruction immediately after any
|
||||
.Ic halt
|
||||
instruction.
|
||||
This option is deprecated and will be removed in the next version.
|
||||
.It Fl h , Fl \-halt-without-nop
|
||||
This option is redundant and will be removed in the next version.
|
||||
.It Fl I Ar path , Fl \-include Ar path
|
||||
Add a new
|
||||
.Dq include path ;
|
||||
@@ -90,14 +81,6 @@ is attempted,
|
||||
first looks up the provided path from its working directory; if this fails, it tries again from each of the
|
||||
.Dq include path
|
||||
directories, in the order they were provided.
|
||||
.It Fl L , Fl \-preserve-ld
|
||||
This option is redundant and will be removed in the next version.
|
||||
.It Fl l , Fl \-auto-ldh
|
||||
Optimize loads of the form
|
||||
.Ic LD [$FF00+n8],A
|
||||
into the opcode
|
||||
.Ic LDH [$FF00+n8],A .
|
||||
This option is deprecated and will be removed in the next version.
|
||||
.It Fl M Ar depend_file , Fl \-dependfile Ar depend_file
|
||||
Print
|
||||
.Xr make 1
|
||||
|
||||
32
man/rgbasm.5
32
man/rgbasm.5
@@ -641,23 +641,6 @@ can range from
|
||||
.Ad $FF80
|
||||
to
|
||||
.Ad $FFFE .
|
||||
.Pp
|
||||
.Sy Note :
|
||||
While
|
||||
.Nm
|
||||
will automatically optimize
|
||||
.Ic ld
|
||||
instructions to the smaller and faster
|
||||
.Ic ldh
|
||||
(see
|
||||
.Xr gbz80 7 )
|
||||
whenever possible, it is generally unable to do so when a label is involved.
|
||||
Using the
|
||||
.Ic ldh
|
||||
instruction directly is recommended.
|
||||
This forces the assembler to emit a
|
||||
.Ic ldh
|
||||
instruction and the linker to check if the value is in the correct range.
|
||||
.El
|
||||
.Pp
|
||||
Since RGBDS produces ROMs, code and data can only be placed in
|
||||
@@ -2105,29 +2088,20 @@ can be used to change some of the options during assembling from within the sour
|
||||
takes a comma-separated list of options as its argument:
|
||||
.Bd -literal -offset indent
|
||||
PUSHO
|
||||
OPT g.oOX, Wdiv, L ; acts like command-line -g.oOX -Wdiv -L
|
||||
OPT g.oOX, Wdiv ; acts like command-line -g.oOX -Wdiv
|
||||
DW `..ooOOXX ; uses the graphics constant characters from OPT g
|
||||
PRINTLN $80000000/-1 ; prints a warning about division
|
||||
LD [$FF88], A ; encoded as LD, not LDH
|
||||
POPO
|
||||
DW `00112233 ; uses the default graphics constant characters
|
||||
PRINTLN $80000000/-1 ; no warning by default
|
||||
LD [$FF88], A ; optimized to use LDH by default
|
||||
.Ed
|
||||
.Pp
|
||||
The options that
|
||||
.Ic OPT
|
||||
can modify are currently:
|
||||
.Cm b , g , p , Q , r , h , L ,
|
||||
.Cm b , g , p , Q ,
|
||||
and
|
||||
.Cm W .
|
||||
The Boolean flag options
|
||||
.Cm H , h , L ,
|
||||
and
|
||||
.Cm l
|
||||
can be negated like
|
||||
.Ql OPT !H
|
||||
to act like omitting them from the command-line.
|
||||
.Cm r .
|
||||
.Pp
|
||||
.Ic POPO
|
||||
and
|
||||
|
||||
@@ -27,10 +27,6 @@ bool failedOnMissingInclude = false;
|
||||
bool generatePhonyDeps = false;
|
||||
std::string targetFileName;
|
||||
|
||||
bool haltNop;
|
||||
bool warnOnHaltNop;
|
||||
bool optimizeLoads;
|
||||
bool warnOnLdOpt;
|
||||
bool verbose;
|
||||
bool warnings; // True to enable warnings, false to disable them.
|
||||
|
||||
@@ -52,7 +48,7 @@ static std::string make_escape(std::string &str) {
|
||||
}
|
||||
|
||||
// Short options
|
||||
static char const *optstring = "b:D:Eg:Hhi:I:LlM:o:P:p:Q:r:VvW:wX:";
|
||||
static char const *optstring = "b:D:Eg:i:I:M:o:P:p:Q:r:VvW:wX:";
|
||||
|
||||
// Variables for the long-only options
|
||||
static int depType; // Variants of `-M`
|
||||
@@ -70,11 +66,7 @@ static option const longopts[] = {
|
||||
{"define", required_argument, nullptr, 'D'},
|
||||
{"export-all", no_argument, nullptr, 'E'},
|
||||
{"gfx-chars", required_argument, nullptr, 'g'},
|
||||
{"nop-after-halt", no_argument, nullptr, 'H'},
|
||||
{"halt-without-nop", no_argument, nullptr, 'h'},
|
||||
{"include", required_argument, nullptr, 'I'},
|
||||
{"preserve-ld", no_argument, nullptr, 'L'},
|
||||
{"auto-ldh", no_argument, nullptr, 'l'},
|
||||
{"dependfile", required_argument, nullptr, 'M'},
|
||||
{"MG", no_argument, &depType, 'G'},
|
||||
{"MP", no_argument, &depType, 'P'},
|
||||
@@ -95,7 +87,7 @@ static option const longopts[] = {
|
||||
|
||||
static void printUsage() {
|
||||
fputs(
|
||||
"Usage: rgbasm [-EHhLlVvw] [-b chars] [-D name[=value]] [-g chars] [-I path]\n"
|
||||
"Usage: rgbasm [-EVvw] [-b chars] [-D name[=value]] [-g chars] [-I path]\n"
|
||||
" [-M depend_file] [-MG] [-MP] [-MT target_file] [-MQ target_file]\n"
|
||||
" [-o out_file] [-P include_file] [-p pad_value] [-Q precision]\n"
|
||||
" [-r depth] [-W warning] [-X max_errors] <file>\n"
|
||||
@@ -132,10 +124,6 @@ int main(int argc, char *argv[]) {
|
||||
opt_G("0123");
|
||||
opt_P(0);
|
||||
opt_Q(16);
|
||||
haltNop = false;
|
||||
warnOnHaltNop = true;
|
||||
optimizeLoads = false;
|
||||
warnOnLdOpt = true;
|
||||
verbose = false;
|
||||
warnings = true;
|
||||
sym_SetExportAll(false);
|
||||
@@ -179,21 +167,6 @@ int main(int argc, char *argv[]) {
|
||||
errx("Must specify exactly 4 characters for option 'g'");
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
if (warnOnHaltNop)
|
||||
warning(
|
||||
WARNING_OBSOLETE, "Automatic `nop` after `halt` (the `-H` flag) is deprecated\n"
|
||||
);
|
||||
else
|
||||
errx("`-H` and `-h` don't make sense together");
|
||||
haltNop = true;
|
||||
warnOnHaltNop = false;
|
||||
break;
|
||||
case 'h':
|
||||
if (haltNop)
|
||||
errx("`-H` and `-h` don't make sense together");
|
||||
break;
|
||||
|
||||
// `-i` was the only short option for `--include` until `-I` was
|
||||
// introduced to better match the `-I dir` option of gcc and clang.
|
||||
case 'i':
|
||||
@@ -203,22 +176,6 @@ int main(int argc, char *argv[]) {
|
||||
fstk_AddIncludePath(musl_optarg);
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
if (optimizeLoads)
|
||||
errx("`-L` and `-l` don't make sense together");
|
||||
break;
|
||||
case 'l':
|
||||
if (warnOnLdOpt)
|
||||
warning(
|
||||
WARNING_OBSOLETE,
|
||||
"Automatic `ld` to `ldh` optimization (the `-l` flag) is deprecated\n"
|
||||
);
|
||||
else
|
||||
errx("`-L` and `-l` don't make sense together");
|
||||
optimizeLoads = true;
|
||||
warnOnLdOpt = false;
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
if (dependFile)
|
||||
warnx("Overriding dependfile %s", dependFileName);
|
||||
|
||||
@@ -21,10 +21,6 @@ struct OptStackEntry {
|
||||
char gbgfx[4];
|
||||
uint8_t fixPrecision;
|
||||
uint8_t fillByte;
|
||||
bool haltNop;
|
||||
bool warnOnHaltNop;
|
||||
bool optimizeLoads;
|
||||
bool warnOnLdOpt;
|
||||
bool warningsAreErrors;
|
||||
size_t maxRecursionDepth;
|
||||
WarningState warningStates[numWarningStates];
|
||||
@@ -53,22 +49,6 @@ void opt_R(size_t newDepth) {
|
||||
lexer_CheckRecursionDepth();
|
||||
}
|
||||
|
||||
void opt_H(bool warn) {
|
||||
warnOnHaltNop = warn;
|
||||
}
|
||||
|
||||
void opt_h(bool halt) {
|
||||
haltNop = halt;
|
||||
}
|
||||
|
||||
void opt_L(bool optimize) {
|
||||
optimizeLoads = optimize;
|
||||
}
|
||||
|
||||
void opt_l(bool warn) {
|
||||
warnOnLdOpt = warn;
|
||||
}
|
||||
|
||||
void opt_W(char const *flag) {
|
||||
processWarningFlag(flag);
|
||||
}
|
||||
@@ -150,34 +130,6 @@ void opt_Parse(char const *s) {
|
||||
break;
|
||||
}
|
||||
|
||||
case 'H':
|
||||
if (s[1] == '\0')
|
||||
opt_H(false);
|
||||
else
|
||||
error("Option 'H' does not take an argument\n");
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
if (s[1] == '\0')
|
||||
opt_h(false);
|
||||
else
|
||||
error("Option 'h' does not take an argument\n");
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
if (s[1] == '\0')
|
||||
opt_L(false);
|
||||
else
|
||||
error("Option 'L' does not take an argument\n");
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
if (s[1] == '\0')
|
||||
opt_l(false);
|
||||
else
|
||||
error("Option 'l' does not take an argument\n");
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
if (strlen(&s[1]) > 0)
|
||||
opt_W(&s[1]);
|
||||
@@ -185,42 +137,6 @@ void opt_Parse(char const *s) {
|
||||
error("Must specify an argument for option 'W'\n");
|
||||
break;
|
||||
|
||||
case '!': // negates flag options that do not take an argument
|
||||
switch (s[1]) {
|
||||
case 'H':
|
||||
if (s[2] == '\0')
|
||||
opt_H(true);
|
||||
else
|
||||
error("Option '!H' does not take an argument\n");
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
if (s[2] == '\0')
|
||||
opt_h(true);
|
||||
else
|
||||
error("Option '!h' does not take an argument\n");
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
if (s[2] == '\0')
|
||||
opt_L(true);
|
||||
else
|
||||
error("Option '!L' does not take an argument\n");
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
if (s[2] == '\0')
|
||||
opt_l(true);
|
||||
else
|
||||
error("Option '!l' does not take an argument\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Unknown option '!%c'\n", s[1]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Unknown option '%c'\n", s[0]);
|
||||
break;
|
||||
@@ -243,14 +159,6 @@ void opt_Push() {
|
||||
|
||||
entry.fillByte = fillByte; // Pulled from section.hpp
|
||||
|
||||
// Both of these are pulled from main.hpp
|
||||
entry.haltNop = haltNop;
|
||||
entry.warnOnHaltNop = warnOnHaltNop;
|
||||
|
||||
// Both of these are pulled from main.hpp
|
||||
entry.optimizeLoads = optimizeLoads;
|
||||
entry.warnOnLdOpt = warnOnLdOpt;
|
||||
|
||||
// Both of these pulled from warning.hpp
|
||||
entry.warningsAreErrors = warningsAreErrors;
|
||||
memcpy(entry.warningStates, warningStates, numWarningStates);
|
||||
@@ -273,10 +181,6 @@ void opt_Pop() {
|
||||
opt_G(entry.gbgfx);
|
||||
opt_P(entry.fillByte);
|
||||
opt_Q(entry.fixPrecision);
|
||||
opt_H(entry.warnOnHaltNop);
|
||||
opt_h(entry.haltNop);
|
||||
opt_L(entry.optimizeLoads);
|
||||
opt_l(entry.warnOnLdOpt);
|
||||
opt_R(entry.maxRecursionDepth);
|
||||
|
||||
// opt_W does not apply a whole warning state; it processes one flag string
|
||||
|
||||
@@ -1870,16 +1870,6 @@ z80_ei:
|
||||
z80_halt:
|
||||
Z80_HALT {
|
||||
sect_AbsByte(0x76);
|
||||
if (haltNop) {
|
||||
if (warnOnHaltNop) {
|
||||
warnOnHaltNop = false;
|
||||
warning(
|
||||
WARNING_OBSOLETE,
|
||||
"Automatic `nop` after `halt` (option 'H') is deprecated\n"
|
||||
);
|
||||
}
|
||||
sect_AbsByte(0x00);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
@@ -2002,21 +1992,9 @@ z80_ld_mem:
|
||||
sect_RelWord($2, 1);
|
||||
}
|
||||
| Z80_LD op_mem_ind COMMA MODE_A {
|
||||
if (optimizeLoads && $2.isKnown && $2.val >= 0xFF00) {
|
||||
if (warnOnLdOpt) {
|
||||
warnOnLdOpt = false;
|
||||
warning(
|
||||
WARNING_OBSOLETE,
|
||||
"Automatic `ld` to `ldh` optimization (option 'l') is deprecated\n"
|
||||
);
|
||||
}
|
||||
sect_AbsByte(0xE0);
|
||||
sect_AbsByte($2.val & 0xFF);
|
||||
} else {
|
||||
sect_AbsByte(0xEA);
|
||||
sect_RelWord($2, 1);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
z80_ld_cind:
|
||||
@@ -2059,20 +2037,8 @@ z80_ld_a:
|
||||
}
|
||||
| Z80_LD reg_r COMMA op_mem_ind {
|
||||
if ($2 == REG_A) {
|
||||
if (optimizeLoads && $4.isKnown && $4.val >= 0xFF00) {
|
||||
if (warnOnLdOpt) {
|
||||
warnOnLdOpt = false;
|
||||
warning(
|
||||
WARNING_OBSOLETE,
|
||||
"Automatic `ld` to `ldh` optimization (option 'l') is deprecated\n"
|
||||
);
|
||||
}
|
||||
sect_AbsByte(0xF0);
|
||||
sect_AbsByte($4.val & 0xFF);
|
||||
} else {
|
||||
sect_AbsByte(0xFA);
|
||||
sect_RelWord($4, 1);
|
||||
}
|
||||
} else {
|
||||
::error("Destination operand must be A\n");
|
||||
}
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
SECTION "test", ROM0
|
||||
|
||||
opt !h, !L ; already the default, but tests parsing "!"
|
||||
|
||||
pusho
|
||||
opt p42, Q.4, h, L, Wno-div
|
||||
opt p42, Q.4, Wno-div
|
||||
ds 1
|
||||
ld [$ff88], a
|
||||
halt
|
||||
println $8000_0000 / -1
|
||||
def n = 3.14
|
||||
println "{x:n} = {f:n}"
|
||||
popo
|
||||
|
||||
opt H, l
|
||||
|
||||
ds 1
|
||||
ld [$ff88], a
|
||||
halt
|
||||
println $8000_0000 / -1
|
||||
def n = 3.14
|
||||
println "{x:n} = {f:n}"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
warning: opt.asm(20): [-Wdiv]
|
||||
warning: opt.asm(12): [-Wdiv]
|
||||
Division of -2147483648 by -1 yields -2147483648
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user