mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 18:52:07 +00:00
Add flag to rgbasm to disable LD->LDH optimization
rgbasm tries to optimize any loads from/to $FF00-$FFFF and generate LDH 2-byte opcodes instead of regular LD 3-byte opcodes. This is a bit inconsistent as it only works for constant values. If a load is trying to access a label in a HRAM floating section, or a section found in a different object file, this optimization doesn't work. This means that a simple refactor or code could allow rgbasm to perform the optimzation or prevent it from doing so. For certain projects, like disassemblies, this is a problem. This patch adds flag -L to rgbasm to disable the optimization, and doesn't change the behaviour of any other existing code. Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
.\"
|
||||
.\" SPDX-License-Identifier: MIT
|
||||
.\"
|
||||
.Dd January 26, 2018
|
||||
.Dd February 24, 2018
|
||||
.Dt RGBASM 1
|
||||
.Os RGBDS Manual
|
||||
.Sh NAME
|
||||
@@ -13,7 +13,7 @@
|
||||
.Nd Game Boy assembler
|
||||
.Sh SYNOPSIS
|
||||
.Nm rgbasm
|
||||
.Op Fl EhVvw
|
||||
.Op Fl EhLVvw
|
||||
.Op Fl b Ar chars
|
||||
.Op Fl D Ar name Ns Op = Ns Ar value
|
||||
.Op Fl g Ar chars
|
||||
@@ -55,6 +55,12 @@ The
|
||||
option disables this behavior.
|
||||
.It Fl i Ar path
|
||||
Add an include path.
|
||||
.It Fl L
|
||||
Disable the optimization that turns loads of the form
|
||||
.Sy LD [$FF00+n8],A
|
||||
into the opcode
|
||||
.Sy LDH [$FF00+n8],A
|
||||
in order to have full control of the result in the final ROM.
|
||||
.It Fl M Ar dependfile
|
||||
Print
|
||||
.Xr make 1
|
||||
@@ -75,7 +81,9 @@ Disable warning output.
|
||||
.Sh EXAMPLES
|
||||
Assembling a basic source file is simple:
|
||||
.Pp
|
||||
.D1 $ rgbasm -o bar.o foo.asm
|
||||
.Bd -literal -offset indent
|
||||
$ rgbasm -o bar.o foo.asm
|
||||
.Ed
|
||||
.Pp
|
||||
The resulting object file is not yet a usable ROM image \(em it must first be
|
||||
run through
|
||||
|
||||
Reference in New Issue
Block a user