Now, when POPS is executed, it restores the symbol scope of the
corresponding PUSHS. That way, the local symbols previously available
can be used again after the POPS.
This is useful in cases like this one:
```
SECTION "Section 1", ROMX
BigFunction:
...
.loop:
...
PUSHS
SECTION "Section 2", ROMX
DataForBigFunction:
DB 1, 2, 3, 4, 5
POPS
ld a,BANK(DataForBigFunction)
ld hl,DataForBigFunction
...
jr .loop
```
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
The bank of a section can be requested with `BANK("Section Name")`, and
the bank of the current section with `BANK(@)`. In both cases, the bank
number is resolved by the linker.
New commands have been added to the list of RPN commands of object
files, and the rest has been moved so that new additions don't force a
new change in the number of the enumerations.
Increase object file version, as it is now incompatible with the old
format.
Update manpages to reflect the new ways of using `BANK()` and the new
format of the object files.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
It made sense to have them in different files when the toolchain
targeted systems other than the GB. Now, there are no generic and
system-specific keywords because there is only one supported system.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
Not all occurrences have been replaced, in some cases they have been
left as they were before (like in rgbgfx and when they are in the
interface of a C standard library function).
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This warning was added in 781c90b940 as a
way of catching the following cases, which are most likely programmer
mistakes:
DB 1,, 2
DB 1, 2,
However, the warning was also triggered in the following case:
DB
It can be used as a replacement of:
DS 1
In this case, it shouldn't output a warning.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
Even though this behaviour is documented (empty elements are treated as
0), it can be misleading. By having a warning, compatibility is
maintained and potential problems in the code can be detected.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
It was removed in commit 6198cc185c, but
the documentation wasn't updated back then.
It makes more sense to reintroduce it now than to remove it from the
docs.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
In some implementations of libc the function fread has the attribute
`warn_unused_result`, that is treated as an error by the compiler as
specified in the flags passed to it.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
Now, the object file in which each definition is (as well as the source
file and line) are printed with the error message.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This is useful to generate error messages when there is a symbol that
appears in more than one object file.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
When trying to define a symbol with a name that is used by another one,
print the location of the first definition in the error message.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
The previous change has broken compatibility of object files, so it is
needed to increment the version number to make the linker reject files
generated with the old code.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
Unions allow multiple memory allocations (using ds, etc.) to share the
same space in memory.
This allows games to use the same memory for different purposes,
depending on their state.
This also adds documentation on how to use the new UNION, NEXTU, and
ENDU keywords.
This option has been added to all programs of the toolchain, and it
prints the version string of the toolchain.
Manpages and help command line output updated.
Add missing 'w' flag to the command line output of rgbasm. It was
correctly documented in the manpages.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
If the folder where the code is compiled is a valid git repository, the
version string is generated with `git describe`. If it isn't a valid
repository, a string included in the source code is used instead. This
one must be updated regularly as the toolchain is developed.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
In addition, make some formatting changes, and add some extra error handling (for when ELIF, ELSE, or ENDC are encountered without a corresponding IF).
This ensures that the test scripts are correctly run with the Bourne shell, regardless of the (potentially more exotic) shell that is used to invoke the script.