ref: 665eb916a204fa559a30648a08272c84a562c41c
parent: 04788e15af6878c220602d2248b2b8f5182e96a0
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sat May 1 18:54:26 EDT 2021
`OPT L` acts like `-L` and *dis*ables optimizing LD to LDH Fixes #867
--- a/src/asm/opt.c
+++ b/src/asm/opt.c
@@ -81,7 +81,7 @@
case 'L':
if (s[1] == '\0')
- opt_L(true);
+ opt_L(false);
else
error("Option 'L' does not take an argument\n");
break;
@@ -97,7 +97,7 @@
switch (s[1]) {
case 'L':
if (s[2] == '\0')
- opt_L(false);
+ opt_L(true);
else
error("Option '!L' does not take an argument\n");
break;
--- a/src/asm/rgbasm.5
+++ b/src/asm/rgbasm.5
@@ -1946,7 +1946,7 @@
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 and omitting -L
+ OPT g.oOX, Wdiv, L ; acts like command-line -g.oOX -Wdiv -L
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
@@ -1953,7 +1953,7 @@
POPO
DW `00112233 ; uses the default graphics constant characters
PRINTLN $80000000/-1 ; no warning by default
- LD [$FF88], A ; optimized to use LDH if -L was passed
+ LD [$FF88], A ; optimized to use LDH by default
.Ed
.Pp
The options that OPT can modify are currently:
--- a/test/asm/opt.asm
+++ b/test/asm/opt.asm
@@ -1,7 +1,9 @@
SECTION "test", ROM0
+ opt !L ; already the default, but tests parsing "!L"
+
pusho
- opt p42, !L, Wno-div
+ opt p42, L, Wno-div
ds 1
ld [$ff88], a
println $8000_0000 / -1
--- a/test/asm/opt.err
+++ b/test/asm/opt.err
@@ -1,2 +1,2 @@
-warning: opt.asm(12): [-Wdiv]
+warning: opt.asm(14): [-Wdiv]
Division of -2147483648 by -1 yields -2147483648