Remove support for RGB0 and RGB1-2 object files, reducing the amount of duplicate work that needs doing when maintaining the linker in the future.
A new error message has also been implemented if an unsupported object file version has been encounted, which informs the user that they should reassemble.
Replace spaces by tabs for consistency. The rest of the codebase uses
tabs, so the linkerscript parser has to change.
Removed trailing tabs in all codebase.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
getsymbank() is used for more things than just when the code explicitly
has a BANK() operator, which causes a lot of noise when building code
that has more than one object file and places variables on HRAM or OAM.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Instead of converting from ROMX to ROM0 with -t and preventing the use
of WRAMX at all with -w, make each option prohibit the type of section
they affect.
This is a good idea because it can prevent a developer from making
mistakes when switching from using the options to not using them.
Generally, a change from using one single bank to multiple banks is
something that will take a lot of effort, and forgetting sections in
ROM0 or WRAM0 will only make the free space of those areas to be
reduced (and maybe prevent compilation), but it won't cause any problems
because of a forgotten bank swap in the code.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Check all sections when testing BANK().
Add scripts to verify the tests and update the reference if needed.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Improve error messages generated by `errx()`, `warnx()` and similar.
Set `progname` to a static string with the name of the program so that
the path of the binary isn't included in error messages.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Instead of returning the internal representation of the linker, return
0 when using BANK() on a label in HRAM.
Also, generate a warning when calculating the bank of labels in OAM
and HRAM, as there is no valid reason for doing it, so it's likely a
programming mistake.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
- Rename the “Installing RGBDS (UNIX)” section to “Building RGBDS”, as that’s what we’re doing, regardless of platform.
- Update references of Mac OS X to macOS.
- State that only libpng and pkg-config need to be downloaded with Homebrew; the others are pre-installed along with Xcode.
- State that RGBDS itself is available through Homebrew.
Due to recent changes, lots of tests generated a slightly different
error output.
- bank-noexist : This test doesn't generate any error output now as
unknown labels are left for the linker to resolve.
- null-in-macro : This test used to crash. Now, the parser verifies that
a MACRO ends in ENDM, generating an error message if not.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
This patch isn't used because it's meant to be an optimization for
labels in the memory region 0x2000-0x20FF. That memory region doesn't
have anything special on the Game Boy, and there are no instructions
optimized to read or write from there, so it was probably meant for
another hardware that was supported by ASMotor in the past.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
This function produces a similar output to the other error handlers, including printing to stderr, and including a stack trace. However, ‘warning’ is displayed instead of ‘ERROR’, and the compilation does not fail.
This function is now used for the deprecation warnings, ensuring that these errors can be found.
Even though the bank number was read from the linkerscript and the
linker verified that each section could be mapped in the final rom, the
bank number was never actually set by the linkerscript parser.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
To make the behaviour of the linkerscript consistent, every section read
from an object file must have an unique name. This is needed as the
linkerscript uses the name of sections to place them and it expects
every section to have a different name.
This doesn't break compatibility with the old behaviour that allowed to
continue sections if they had the same name, bank number and starting
address. That's still allowed because `rgbasm` outputs a single section
if this functionality is used, it is transparent to `rgblink`.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
They are still working, they just output a warning.
`jp [hl]` is confusing as it may be thought that the CPU reads the value
pointed by hl and jumps to it.
`ldi a,hl` and `ldd a,hl` are also confusing as they load from the
address pointed by `hl`, the correct mnemonic should say `[hl]`.
Signed-off-by: AntonioND <antonio_nd@outlook.com>
Print the name of each section along with the size, base and end
addresses. If a section is empty, don't print the end address, as it
can overflow if the base address is 0.
Signed-off-by: AntonioND <antonio_nd@outlook.com>