Commit Graph

474 Commits

Author SHA1 Message Date
Antonio Niño Díaz
ca3e55cc45 Update remaining dates in man pages
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-08 18:18:59 +01:00
Antonio Niño Díaz
77546e9c58 Make WARN output a warning instead of an error
This is the expected behaviour.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-08 18:09:02 +01:00
Antonio Niño Díaz
540f8597d4 Update history in man pages
Fix format in LICENSE file.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-08 18:08:57 +01:00
Antonio Niño Díaz
e3109af2f8 Rename OPT_CONTWRAM to OPT_DMG_MODE
Now, it will also make sure that VRAM bank 1 isn't used.

Man page updated.

Tests added.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-08 18:08:51 +01:00
AntonioND
928b347dfc Merge pull request #158 from Ben10do/remove-legacy-object-files
Remove support for legacy object files
2017-04-08 13:30:15 +01:00
AntonioND
ce21cfad4e Merge pull request #160 from AntonioND/an/high-low
Implement HIGH() and LOW() operators
2017-04-08 13:30:10 +01:00
Antonio Niño Díaz
dda3a066be Add test for HIGH() and LOW()
It compares the results of the operators with the expected result if
doing the same thing manually.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-06 22:40:38 +01:00
Antonio Niño Díaz
a6a47ff66d Implement HIGH() and LOW() operators
They work with the 16-bit registers BC, DE and HL, returning the
corresponding 8-bit register. HIGH() works with AF as well, returning A.

They also work with any kind of constant or symbol, generating a RPN
patch in the object file if the value is not defined at assembly time.

They work with macro arguments as well.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-06 22:40:34 +01:00
Daniel Hauck
bfcef01211 Add DESTDIR to Makefile
Allow separate definition of binary and manpage directory.

Document Makefile changes in README.
2017-04-06 20:47:14 +01:00
AntonioND
07861b3b4a Output warning with deprecated section types
Code that uses keywords HOME, DATA, CODE or BSS generates warnings.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-06 20:30:21 +01:00
AntonioND
24439003f3 Remove newlines from warning message strings
Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-06 20:30:21 +01:00
AntonioND
3c43cc14d9 Remove unused code
Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-06 20:30:21 +01:00
AntonioND
52081f32f0 Add flag -w to rgbasm to disable warnings
A lot of warnings are being added (and more will come) so it makes sense
to be able to disable them in legacy source that generates warnings but
is otherwise correct.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-06 20:30:21 +01:00
Ben10do
6e5a28226b Include object file version in error message
When an unsupported object file version is encountered, the version number is now printed in the displayed error message.
2017-04-06 08:02:28 +01:00
Antonio Niño Díaz
2783a36b17 Add missing license header to man page
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2017-04-06 00:00:56 +01:00
Anthony J. Bentley
2c3afc833f Add license information to manpages. 2017-04-05 23:39:42 +01:00
AntonioND
0f3b708dce Merge pull request #157 from AntonioND/an/error-undef-diff
Output error message if diff of labels not defined
2017-04-05 23:08:37 +01:00
AntonioND
7eb9101d43 Update README and LICENSE files
Add history of RGBDS and original license.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-05 01:24:36 +01:00
Ben10do
032e698f46 Update the object file documentation
Updates the object file documentation in mylink.h to match the newest object file format.
2017-04-05 01:10:00 +01:00
Ben10do
63103c050d Remove support for old object files
Remove support for RGB0 and RGB1-2 object files, reducing the amount of duplicate work that needs doing when maintaining the linker in the future.

A new error message has also been implemented if an unsupported object file version has been encounted, which informs the user that they should reassemble.
2017-04-05 01:09:51 +01:00
AntonioND
7e107ab41a Update references of linker tests
Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-04 23:13:42 +01:00
AntonioND
a009a372c5 Remove noyywrap from src/link/lexer.l
Workaround for flex version 2.6.3.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-04 23:13:36 +01:00
AntonioND
5f299bfe6c Fix whitespace
Replace spaces by tabs for consistency. The rest of the codebase uses
tabs, so the linkerscript parser has to change.

Removed trailing tabs in all codebase.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-04 22:14:46 +01:00
AntonioND
07cc4fb8fd Remove warnings when calculating banks
getsymbank() is used for more things than just when the code explicitly
has a BANK() operator, which causes a lot of noise when building code
that has more than one object file and places variables on HRAM or OAM.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-04 21:56:22 +01:00
AntonioND
720ae59af8 Merge pull request #154 from AntonioND/an/tiny-contwram
Make the options -t and -w of rgblink consistent
2017-04-04 21:42:20 +01:00
AntonioND
e63e801e9c Output error message if diff of labels not defined
When calculating the difference of addresses between two labels, for it
to be defined, either:

- Both of them must have their absolute address defined.
- They belong to the same section, so their relative addresses are
  compatible.

This patch adds a check to make sure that any other case is detected so
that the programmer can correct the code.

This applies to rgbasm. The difference of labels can be used, for
example, as argument of DS. The linker can't resize sections, which
means that the final value must be defined when creating the object
file.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-04 21:40:59 +01:00
AntonioND
2abdc9c59d Add whitespace to error and warning messages
Test reference output updated.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-03 23:46:19 +01:00
AntonioND
be200593d6 Fix typo in README
This is the correct name since 2016.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-03 23:43:32 +01:00
AntonioND
43228f16f0 Improve README
Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-03 22:17:20 +01:00
AntonioND
f14b061ea7 Add script to update references of rgbasm tests
Update test references.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-03 21:36:42 +01:00
AntonioND
f431b384a2 Add tests for rgblink options -t and -w
Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-03 21:29:22 +01:00
AntonioND
7e3720b627 Make options -t and -w consistent
Instead of converting from ROMX to ROM0 with -t and preventing the use
of WRAMX at all with -w, make each option prohibit the type of section
they affect.

This is a good idea because it can prevent a developer from making
mistakes when switching from using the options to not using them.
Generally, a change from using one single bank to multiple banks is
something that will take a lot of effort, and forgetting sections in
ROM0 or WRAM0 will only make the free space of those areas to be
reduced (and maybe prevent compilation), but it won't cause any problems
because of a forgotten bank swap in the code.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-03 21:22:16 +01:00
AntonioND
e9ed81074b Rename OPT_SMALL to OPT_TINY
This way it is easier to identify the flag passed to the binary (-t).

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-03 21:22:16 +01:00
AntonioND
e16af28676 Automate and improve rgblink test
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>
2017-04-03 21:19:39 +01:00
AntonioND
25be5c6561 Improve error and warning output
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>
2017-04-03 21:16:43 +01:00
AntonioND
e4b4e427f1 Return bank 0 for labels in HRAM
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>
2017-04-03 21:15:14 +01:00
AntonioND
2138bb46fd Fix generation of html man page in Makefile
Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-02 21:08:53 +01:00
AntonioND
ec5eb4f9ff Merge pull request #152 from Ben10do/update-readme-for-mac
Update the README’s Mac-specific instructions
2017-04-02 18:08:47 +01:00
Ben10do
b31632b51d Update the README’s Mac-specific instructions
- 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.
2017-04-02 17:57:51 +01:00
AntonioND
e50e3e5a23 Remove trailing whitespace
Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-02 17:46:14 +01:00
AntonioND
f63339472e Update reference output of tests
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>
2017-04-02 17:18:08 +01:00
AntonioND
43fd1ee024 Fix some signed/unsigned comparison warnings
Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-02 17:08:12 +01:00
AntonioND
d61a0a8a8f Cleanup Makefile
Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-02 17:07:40 +01:00
AntonioND
ec44b554e8 Merge pull request #150 from Ben10do/deprecation-positions
Add a warning() function, similiar to other error handlers
2017-04-02 17:03:03 +01:00
AntonioND
01a710a47d Remove Zero Page linker patch RPN_PCEZP
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>
2017-04-02 16:19:45 +01:00
Ben10do
ff2ba7290c Add a warning() function, similiar to yyerror()
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.
2017-04-02 13:18:29 +01:00
AntonioND
53842cd07d Create man5 folder when installing
`make install` would blindly try to copy `rgblink.5` even if the
destination folder didn't exist.

Signed-off-by: AntonioND <antonio_nd@outlook.com>
2017-04-02 00:40:35 +01:00
AntonioND
85ff75d2d3 Merge pull request #146 from AntonioND/an/same-name
Prohibit sections from having the same name
2017-04-02 00:36:28 +01:00
AntonioND
adef2e18cc Fix bank assignments from linkerscript
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>
2017-04-02 00:22:37 +01:00
AntonioND
5ba8405dfa Prohibit sections from having the same name
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>
2017-04-01 15:33:17 +01:00