Commit Graph

347 Commits

Author SHA1 Message Date
Matt Currie
f863a927c1 Make INCBIN's length argument optional
INCBIN can now be used with just a start position to include everything
from the start position until the end of the file.
2020-08-15 17:24:11 +12:00
Antonio Niño Díaz
daf780c7e6 Refactor warning array for clarity 2020-08-04 22:28:56 +01:00
ISSOtm
762474d3ac Let RGBASM write JR offsets in floating sections
This requires some special-casing for `jr @` because the `jr` opcode has
already been emitted, but not the operand, so PC points to the middle.
Moved the RGBLINK test to RGBASM's folder, and created a new RGBLINK test.
2020-07-27 18:17:29 +02:00
ISSOtm
5481af5093 Release 0.4.1 2020-07-21 23:11:06 +02:00
James Larrowe
e51701acaa Add platform-specific fixes file
Create a new file, platform.h, for platform-specific hacks

for MSVC, this includes defining strncasecmp to _stricmp and
strdup to _strdup, among other things like defining missing
stat macros

Change some things not supported in MSVC, like _Static_assert,
to their counterparts (in this case, static_assert)

Replace usage of VLAs with malloc and free

Update getopt_long and use the getopt implementation from musl
on Windows.

Use comments to show which functions from platform.h are being used
2020-07-21 14:24:22 -04:00
ISSOtm
1f2f797cb9 Add section fragments
Fixes #517, and hopefully enables RGBDS as a SDCC back-end
2020-07-21 19:56:46 +02:00
James Larrowe
240fca0861 Fix Clang warning in linkdefs
This one's really stupid; printing an int with %hhu gives a warning
even though a regular unsigned char is promoted to an int before
printing anyway. Silence it so the build with Clang works.

This is a regression introduced in 5c24de3
2020-06-23 23:29:49 -04:00
aaaaaa123456789
89fb372326 Set max macro arguments to 99,999 2020-05-12 06:46:17 -03:00
aaaaaa123456789
a828f82414 Remove fixed-size array for macro arguments 2020-05-12 06:46:07 -03:00
James Larrowe
5c24de3dc4 Use inttypes for stdint types
This should help make RGBDS portable to systems with 16-bit integers,
like DOS.

For kicks, use the macros for 16-bit and 8-bit integers.

Fix other miscellaneous things, like #include ordering and other
printf-format related things.

Reduce repitition in math.c while I'm there.
2020-05-07 11:10:20 -04:00
Eldred Habert
645473e336 Merge pull request #518 from JL2210/warn-parameterless-dx
Add empty data directive warning
2020-05-06 16:25:03 +02:00
James Larrowe
bdf397bba7 Add empty data directive warning
Fixes #516
2020-05-06 09:50:28 -04:00
ISSOtm
c135e2c6a0 Fix local sym names not being expanded by PURGE
And an additional bug that broke the attached test
2020-05-03 19:06:48 +02:00
Eldred Habert
7c22954fd5 Merge pull request #513 from JL2210/disable-padding-option
Add option to disable padding in rgblink
2020-04-27 11:05:55 +02:00
JL2210
8b1351fc3e Add option to disable padding in rgblink
Fixes #307

RGBFIX can handle padding, so there's no reason why
we can't add an option to disable padding in rgblink.

Signed-off-by: JL2210 <larrowe.semaj11@gmail.com>
2020-04-15 09:34:51 -04:00
ISSOtm
5fe3a0adb6 Remove non-OPT options from Options struct 2020-04-13 17:15:00 +02:00
ISSOtm
2220f19fa7 Fix use-after-free with include in linker scripts
Fixes #510, and further proves that you *really* should not entrust memory
ownership management to humans :P
2020-04-13 02:36:19 +02:00
ISSOtm
f9f27d6f5a Clean up symbol system
Get rid of Hungarian notation
Improve encapsulation (the rest of the world should not touch PC directly)
2020-04-09 10:42:37 +02:00
ISSOtm
665412c073 Implement mid-section alignment directive
Fixes #254.
2020-04-08 12:29:00 +02:00
ISSOtm
2b0c34ecb5 Fix a few code style errors 2020-04-08 00:44:41 +02:00
ISSOtm
b0ec8468e6 Allow specifying offset in addition to alignment 2020-04-08 00:40:41 +02:00
Eldred Habert
562835308b Merge pull request #504 from runlevel5/gcc10-fix
Fix multiple definitions for GCC10
2020-04-07 15:18:23 +02:00
ISSOtm
927c65e863 Fix incorrect PC in LOAD blocks at link time 2020-04-07 14:44:51 +02:00
Trung Lê
65121e6d5d Fix multiple definitions for GCC10 2020-04-07 14:48:30 +10:00
ISSOtm
82e0e4ffaf Make some RGBLINK errors non-fatal 2020-04-06 00:48:10 +02:00
ISSOtm
4e96cf9875 Release 0.4.0 2020-04-03 12:11:50 +02:00
ISSOtm
bdad1499fe Merge branch 'release' 2020-04-03 11:58:53 +02:00
ISSOtm
a3d8836671 Prevent assertions outside sections from crashing 2020-03-29 12:18:24 +02:00
ISSOtm
95f347dc6a Evaluate assertions after placing sections 2020-03-27 20:00:29 +01:00
ISSOtm
29629245a4 Use new hashmap implementation for symbols 2020-03-24 12:50:53 +01:00
ISSOtm
7deb8d3e8a Allow purging exported symbols 2020-03-24 10:52:02 +01:00
ISSOtm
cb0a882a31 Order warnings alphabetically 2020-03-23 16:03:36 +01:00
ISSOtm
e123b6dec7 Implement unionized sections in RGBLINK 2020-03-22 11:13:39 +01:00
ISSOtm
cb52ae0f26 Implement unionized sections in RGBASM
This touched a lot more code than initially expected, for two reasons.

First, this broke a big RGBASM assumption: that sections are always being
written to at their end. This plus other problems required touching
basically the entirety of `section.c`.

Second, I tried different solutions to solve the above problem, and along
the way I cleaned up many things around. (I believe that keeping this to
"cleanup" commits yields subpar results, and since it's boring they get
postponed anyways.)

RGBLINK support still needs to be added, but this will come next.
2020-03-22 11:06:17 +01:00
Eldred Habert
fe824e0068 Merge pull request #490 from ISSOtm/const
Implement `ISCONST`, reporting compile-time constness
2020-03-21 23:20:01 +01:00
ISSOtm
fb58166e5d Add assertions
Closes #292
2020-03-21 23:00:38 +01:00
ISSOtm
0759c98d91 Increase version number to 0.3.10 2020-03-21 21:18:14 +01:00
ISSOtm
03967bd623 Prevent purging referenced symbols
This is an immediate fix for #492, although #342 is needed to implement the
desired functionality.
2020-03-21 15:42:52 +01:00
ISSOtm
7ddbe44b21 Use hashmap system for charmap 2020-03-15 15:23:32 +01:00
ISSOtm
2f466c2939 Revamp macro arg system
This should significantly improve performance: on pokecrystal builds, perf
reported as much CPU time spent on `yyparse` as on `sym_UseNewMacroArgs`
Measurements show ~6 seconds of improvement on that codebase.

This also fixes #321, as a bonus, due to saner management!
2020-03-14 16:13:40 +01:00
ISSOtm
61897d8b52 Fix warning.h not including a required header 2020-03-14 11:33:51 +01:00
ISSOtm
a259f53b52 Rename macro functions with proper prefix 2020-03-13 23:20:27 +01:00
ISSOtm
ffdb1fbfe5 Split macro arg management into its own file
It has no relation to symbols, and helps a tiny bit deflate `symbol.c`
2020-03-11 02:39:36 +01:00
ISSOtm
4b33b4b387 Remove forward decl of nonexistent function
I can only assume it was for debugging? (No, I'm not looking it
up the history)
2020-03-11 02:21:30 +01:00
ISSOtm
8fcdcb1731 Implement ISCONST, reporting compile-time constness 2020-03-11 02:15:31 +01:00
ISSOtm
55b911654c Get rid of obsoleted function 2020-03-11 01:46:26 +01:00
ISSOtm
7c8eba9fd2 Remove error message causing segfault
This was utterly stupid. The check right above ensured that `sym` was NULL,
ergo that the argument to `yyerror` *would* segfault.

The only two call sites cannot pass a non-NULL pointer anyways, which I'm
betting is why this went unnoticed.
I did what an optimizing compiler would do anyways: remove the dead code.
2020-03-11 00:39:57 +01:00
ISSOtm
23effcc3f0 Fix error messages in sym_GetConstantValue 2020-03-11 00:16:35 +01:00
ISSOtm
ea0c5581a5 Prevent deletion of built-in symbols 2020-03-10 23:25:33 +01:00
ISSOtm
2ea329c920 Make symbol creation funcs return ptr to symbol 2020-03-10 16:36:02 +01:00