This adds two new directives: newcharmap and setcharmap.
newcharmap creates a new charmap and switches to it.
setcharmap switches to an existing charmap.
Should partially cover #178 and close#270.
This allows printing numbers in different bases and without the dollar prefix
This is especially useful in macros because the dollar isnt a valid character
for symbol names, requiring heavy `STRSUB` usage.
The original list only existed because the documentation was split
across multiple files. When all keywords are described in a single
document, Ctrl+F suffices to find them.
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>
Newlines have to be handled before comments or comments won't be able to
handle line endings that don't include at least one LF character.
Also, document an obscure comment syntax: Anything that follows a '*'
placed at the start of a line is also a comment until the end of the
line.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
PRINTV prints integers in hexadecimal, PRINTI prints them in signed
decimal. For example:
PRINTT "Error at line "
PRINTI __LINE__
PRINTT "\n"
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
With permission from the main authors [1], most of the code has been
relicensed under the MIT license.
SPDX license identifiers are used so that the license headers in source
code files aren't too large.
Add CONTRIBUTORS.rst file.
[1] https://github.com/rednex/rgbds/issues/128
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>
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>
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.
- 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>
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>
For some reason, `No` looks weird in the HTML version of the docs.
Some other random fixes.
Tables in src/asm/rgbasm.5 are still broken in the HTML docs.
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>