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.
Previously, if the user wanted to modify CFLAGS, it was necessary to add
the options used in the Makefile as well, which doesn't make sense.
This patch splits CFLAGS into CFLAGS and the previously removed
REALCFLAGS so that the user can modify the arguments passed to the
compiler without having to worry about things like passing the list of
include directories.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
Some commands, such as `DS`, `BANK[n]`, etc, don't allow the use of
negative constants, but there wasn't any check to prohibit the code from
trying to do so.
This patch adds the `uconst` type to the parser to use when a constant
is expected, but it mustn't be negative.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
- Local labels can now be exported.
- Local labels can be declared as Scope.Label in addition of .Label.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
Local symbols can now be referenced outside the scope of their parent, by using the syntax “Parent.Chlid”.
- Local symbol names are now stored internally as “Parent.Child”.
- The symbol’s scope field no longer forms a linked list of the prior local symbols; it will now always contain the parent.
- Add the ability use EXPORT and GLOBAL with local symbols.
- Reduce duplication between findsymbol() and findpsymbol(), as well as between sym_AddLocalReloc() and sym_AddReloc().
There are two ways in which the assembly process can fail:
1. If there is a really big problem that compromises the whole process,
the assembler has to stop right there and generate an error message.
This happens with unterminated REPT loops, macros, etc.
2. If the problem isn't that big and the process can still continue,
even though the final result is invalid, the assembler can try to
continue and warn the user about all errors it finds in the code.
This patch clarifies the use of each function and replaces the function
used in two places by the correct one.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This is hard to detect in MACROs, as there are legitimate uses for
MACROs that call themselves recursively.
For an EQUS, the problem is that its value may be modified at different
points in the source code, so the only way to detect a possible problem
is by doing an analysis at each usage of the EQUS.
Also, since an EQUS may expand to the name of a MACRO and a MACRO can
use an EQUS, it becomes even harder to check all possible problems that
come out of it. It's better to let this task to the programmer.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
When allocating a section, allocate only the max possible size for that
type (only applies to ROM0 and ROMX).
When finding an overflow, in any kind of section, output an error with
the location of the line of code that caused the overflow.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
The max size of some section types depends on the flags passed to
rgblink. Instead of doing in rgbasm some checks (for the sections with
fixed size) and others in rgblink, all checks are now done in rgblink.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
Instead of allocating 0x4000 bytes for all sections and resize them as
needed, allocate 0x8000 bytes and don't let them to be resized. This is
the max possible size (ROM0 when ROMX sections aren't present).
Buffers are not needed for RAM sections, this patch changes the code so
that it only allocates buffers for ROM sections.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>