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>
Previously, some instances of the number of banks for each section remained hardcoded. These have been replaced with BANK_COUNT_* constants.
As a side-effect, this could fix a theoretical bug when using BANK(label) when the label is in a high SRAM bank (≥ 4).