539 Commits

Author SHA1 Message Date
Antonio Niño Díaz
fe65e07cb6 Fail when using negative constants if not allowed
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>
v0.3.2
2017-07-01 14:31:58 +01:00
Antonio Niño Díaz
bb12806da1 Fix indentation
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-07-01 14:31:58 +01:00
Antonio Niño Díaz
fa36042131 Add missing documentation of RL command
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-07-01 14:31:39 +01:00
Antonio Niño Díaz
efaad99f25 Update manpage documentation about labels
- 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>
2017-06-13 20:16:42 +01:00
Antonio Niño Díaz
62d820c261 Merge pull request #181 from Ben10do/reference-local-symbols
Allow local labels to be referenced (and exported)

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-06-12 21:46:32 +01:00
Ben10do
a53d795361 Add tests for explicit definitions of local labels
These check that “Parent.child” may be used in place of “.child”, and that “WrongParent.child” may not be used in the scope of “Parent”.
2017-06-12 19:50:02 +01:00
Sanqui
2e60c4dd2e Add tests for remote local symbols 2017-06-12 19:36:52 +01:00
Ben10do
ce8a13a562 Allow local symbols to be referenced
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().
2017-06-12 19:36:46 +01:00
Antonio Niño Díaz
ff2321a8ce Make fatalerror and yyerror consistent
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>
v0.3.1
2017-04-29 15:02:57 +01:00
Antonio Niño Díaz
4228e3e890 Document dependency problem for EQUS and MACRO
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>
2017-04-26 22:02:47 +01:00
Antonio Niño Díaz
023b574fc5 New warning for rgbasm and fixes in error messages
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-26 00:57:29 +02:00
Antonio Niño Díaz
a77df57f1c Merge pull request #177 from AntonioND/an/section-checks
Improve section size checks and buffer handling

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-25 13:31:06 +02:00
Antonio Niño Díaz
8f553e89ce Merge pull request #176 from makefile-cleanup
Cleanup Makefile

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-25 13:29:52 +02:00
Antonio Niño Díaz
b7810ffdb3 Check for section overflows in rgbasm
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>
2017-04-24 14:29:27 +02:00
Antonio Niño Díaz
0d3401058d Check max section sizes in rgblink
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>
2017-04-24 02:05:30 +02:00
Antonio Niño Díaz
6e123ccc36 Optimize allocation of buffers for sections
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>
2017-04-24 02:05:30 +02:00
Antonio Niño Díaz
f2724df566 Fix rgblink error messages about prohibited sections
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-23 20:45:39 +02:00
Antonio Niño Díaz
646d71d927 Remove unused code
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-23 20:25:19 +02:00
Antonio Niño Díaz
9b9b41e605 Fix install instructions
It isn't needed to create the folders manually, the Makefile does it
automatically.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-23 14:34:33 +02:00
Antonio Niño Díaz
907ccfb280 Cleanup Makefile 2017-04-23 13:32:32 +02:00
Antonio Niño Díaz
fcd7c117e7 Fix man page documentation for dependcy files
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-22 11:43:28 +02:00
Antonio Niño Díaz
323922d854 Merge pull request #174 from makedepend
Generate make-style dependency files

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-22 11:40:16 +02:00
Antonio Niño Díaz
f97e3bad33 Merge pull request #171 from NieDzejkob/master
Implement separate time constants

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-22 11:36:59 +02:00
Antonio Niño Díaz
64415555f1 Merge pull request #175 from NieDzejkob/man
Fix some man installation locations

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-19 19:46:58 +01:00
NieDzejkob
ab2aef3f2b Fix some man installation locations 2017-04-19 13:18:18 +02:00
NieDzejkob
947db1e21b Implement numeric time and date constants 2017-04-19 13:12:08 +02:00
Antonio Niño Díaz
cde607c09c Deps file can only be created if object file specified
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-17 22:02:18 +01:00
Antonio Niño Díaz
739b113f57 Print dependencies of all included files
Files that weren't found with the absolute path weren't added as
dependencies even if they were found after considering the list of
include directories.

This patch makes rgbasm print the complete path (including the include
directory path) in these cases.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-17 20:27:58 +01:00
Antonio Niño Díaz
64585eebf6 Merge branch 'makedepend'
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-17 19:29:25 +01:00
Antonio Niño Díaz
1050acc290 Remove useless link in documentation
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-17 18:21:08 +01:00
Antonio Niño Díaz
466bb9ed0b Fix links in man pages
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-17 18:14:49 +01:00
Antonio Niño Díaz
83348100f3 Improve MinGW target of Makefile
It works now with an install of MinGW for both Win32 and Win64. It needs
libpng and zlib.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
v0.3.0
2017-04-17 17:28:07 +01:00
Antonio Niño Díaz
57bf32f35a Point at the documentation from README
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-17 14:49:57 +01:00
Antonio Niño Díaz
0030e0371a Rename object file format description man page
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-17 14:15:46 +01:00
Antonio Niño Díaz
42400ec6a0 Fix links in HTML documentation
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-16 23:08:33 +01:00
Antonio Niño Díaz
2e793fb7dc Clean wwwman target of Makefile
The substitution of OpenBSD by General is not portable.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-16 22:52:10 +01:00
Antonio Niño Díaz
ac69e9863e Fix documentation in HTML format
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>
2017-04-16 22:50:54 +01:00
Antonio Niño Díaz
59c065cf31 Merge pull request #165 from AntonioND/an/rgbasm-manual
Add documentation of rgbds to man pages and cleanup code

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-16 20:13:49 +01:00
Antonio Niño Díaz
729683fb1f Remove RPN_RANGECHECK
Leftover code from ASMotor.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-16 19:55:00 +01:00
Antonio Niño Díaz
ed6e4c4769 Clean object file format code and documentation
Remove unused code.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-16 19:54:58 +01:00
Antonio Niño Díaz
d92c284b85 Add documentation about the object file format
Copied from the HTML documentation and updated.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-16 19:54:55 +01:00
Antonio Niño Díaz
26af7fcffe Add complete documentation of rgbds to man pages
Copied from the old html documentation and fixed where it was needed.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-16 19:54:50 +01:00
Antonio Niño Díaz
f7f697c267 Fix parsing of first line of included linkerscripts
When including a linkerscript from a parent one, the lexer didn't
include a newline character because the INCLUDE command was handled
before reaching the newline. This behaviour is needed to parse the last
line of a linkerscript correctly (it doesn't have a newline character).

However, this meant that when the included file was being parsed, the
first line was considered a continuation of the last line of the parent
script (the INCLUDE command), which means that the first line of an
included linkerscript could only contain a comment (or nothing at all).

This patch adds a newline character to the buffer used by the lexer so
that the parser will receive a newline and it will handle the first line
of the included file as expected.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-14 17:07:01 +01:00
Antonio Niño Díaz
554b5292de Rename ISO 8601 timestamp defines
The previous names were ridiculously long.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-12 22:19:53 +01:00
Antonio Niño Díaz
a7393d7e45 Merge pull request #163 from AntonioND/an/iso-8601
Add equates with ISO 8601 date and time

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-10 23:34:12 +01:00
Antonio Niño Díaz
fe9e4f0583 Merge pull request #169 from AntonioND/an/travis-test
Add Travis CI configuration file

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-10 22:59:10 +01:00
Antonio Niño Díaz
362aea22bd Fix conflict in yacc
`LD HL,n16` and `LD SP,n16` are handled in a different rule as
`LD r16,n16`, but they are also part of that rule.

This patch converts the `LD r16,n16` rule into two rules, one for doing
`LD BC,n16` and other one for `LD DE,n16`.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-10 22:57:05 +01:00
Antonio Niño Díaz
9bc6083e49 Add Travis CI configuration file
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-10 22:10:26 +01:00
Antonio Niño Díaz
2b5ad9dc38 Make test scripts return error code
Make them executable.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-10 22:10:10 +01:00
Antonio Niño Díaz
5679c7066b Restore behaviour of option -w and add option -d
rgblink option -w has been restored to its previous behaviour: make WRAM
a continous section instead of spliting it into WRAM0 and WRAMX.

To enable DMG mode, option -d has to be used instead. This option
automatically enables -w.

Update tests.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-10 20:03:52 +01:00