Commit Graph

79 Commits

Author SHA1 Message Date
Rangi
14e6a79adc Deprecate the old macro syntax (#1025)
Fixes #1011
2022-08-28 15:22:21 -04:00
ISSOtm
828b2adcdf Make RGBLINK able to link SDCC object files
This requires a LOT of tricky code, mostly due to the format itself being,
er, not the most straightforward.
Everything is converted to existing RGBLINK concepts (sections, patches,
etc.), so the core code is essentially unchanged.
(A couple of genuine RGBLINK bugs were uncovered along the way, so some of
the core code *is* changed, notably regarding `SECTION FRAGMENT`s.)

All of this code was clean-roomed, so SDCC's GPLv2 license does not apply.
2022-07-11 21:17:34 +02:00
Eldred Habert
6842c831fd Allow binary AND to be sometimes constant (#976) 2022-02-05 14:17:57 -05:00
Rangi
f82603f196 Lowercase "error:" in -Werror output 2021-11-20 11:21:46 +01:00
Rangi
036b6c1b89 Capitalize "FATAL:" in rgblink error messages
"warning:" and "error:" are lowercase
This matches rgbasm's formatting
2021-11-19 19:52:57 -05:00
Rangi
b76819792d Deprecate SET in favor of =
`SET` is redundant with `=`, and is already the name of an instruction.
2021-11-19 00:05:49 +01:00
martendo
0f321bc797 Fix section merge alignment error message (#919)
Co-authored-by: Eldred Habert <eldredhabert0@gmail.com>
2021-08-17 18:03:46 -04:00
ISSOtm
1d01268249 Remove LOAD FRAGMENT
It's very troublesome, with flaky semantics and a very restricted use space.
2021-05-03 10:51:55 +02:00
Rangi
296e5489c9 rgblink adjusts patches' PC offsets when merging FRAGMENTs
Fixes #869
2021-05-02 23:54:42 +02:00
Rangi
ca36422ac9 Parse 'ld hl, sp - <e8>' correctly
Fixes #864
2021-05-01 11:08:01 +02:00
Rangi
43cf20b155 Support Mac OS classic CR line endings in linkerscripts
This also refactors `readChar(file)` to `nextChar()` to be
more like the rgbasm lexer.
2021-04-26 12:05:36 -04:00
Rangi
e27a6d53a0 Support character escapes in linkerscript strings
This allows linkerscripts to refer to section names even if
they contain special characters: '\r' '\n' '\t' '"' '\\'.
2021-04-26 12:05:36 -04:00
Rangi
52797b6f68 Implement SIZEOF("Section") and STARTOF("Section") (#766)
Updates the object file revision to 8

Fixes #765
2021-04-17 18:36:26 -04:00
Rangi
9923fa3eee Fix expansions that start from the end of another expansion (#839)
Do not free an expansion until its offset is *past* its size.
This means potentially freeing a nested stack of expansions
all at once.

Fixes #696
2021-04-17 13:14:40 -04:00
Jakub Kądziołka
1ffd7cb5bb Make tests work on NixOS
Some distributions, such as NixOS and Guix, only have the /bin/sh and
/usr/bin/env binaries in standard locations.
2021-04-16 16:38:04 +02:00
Rangi
a265b85d9d Report "1 error", not "1 errors", when assembly is aborted
This matches other such pluralized error messages
2021-03-28 15:55:32 -04:00
Rangi
7e7f92f18c Assign section locations to all UNIONs/FRAGMENTs
Fixes the test case from #800

The `out.gb` output was corrected, since the two "test"
fragments have a different order in ROM than in SRAM.
It is effectively:

; ROM0[$0000], fragments ordered by size
    jr Label
    dw Label
    db 0

; SRAM[$a000], fragments ordered by .o order
    ds 1  ; db 0
    ds 2  ; jr Label
Label:    ; $a003
    ds 2  ; dw Label
2021-03-28 15:21:17 -04:00
Eldred Habert
7461170956 Add LOAD FRAGMENT pc test (#800)
Reproduces a reported problem, fix pending
2021-03-28 15:11:20 -04:00
Rangi
8d1b56bcf5 rgblink identifies patches' PC sections after reading all sections
Fixes #794
2021-03-18 23:53:54 +01:00
Rangi
e7d6ddf593 Fix linking tiny overlay files (#755)
* Fix compatibility of rgblink -O and -t

The -t "tiny mode" option makes ROM0 cover 0x8000 bytes,
not 0x4000. The -O "overlay" option fills areas uncovered
by sections with data from an overlay file. These needed
to cooperate so that the calculated uncovered overlay size
does not exceed the actual size of the ROM.

Fixes #754

* Print link test names like asm tests do

* Make the three test.sh scripts more similar
2021-02-24 23:04:51 -05:00
Eldred Habert
dafef5a953 Remove column 1 restriction for labels with colons (#635)
Partial fix for #457
2021-02-23 14:42:24 -05:00
Rangi
037bc7abb3 Add an rgblink test case for an $8000-byte ROM0 section with -t 2021-02-21 16:30:02 -05:00
ISSOtm
76446e6d00 Change behavior of merging FRAGMENTs to constrain each fragment individually
Additionally, remove the deprecated merging of non-fragment SECTIONs
2021-02-10 10:19:16 +01:00
ISSOtm
7bc42d468b Clean up temp test files even if interrupted
Avoids "tmp.*" piling up in /tmp
2020-12-26 14:38:04 +01:00
Jakub Kądziołka
b421c983d6 link: Suppress cascading errors. 2020-10-04 18:14:22 +02:00
ISSOtm
baeb180acd Apply error reporting changes to tests 2020-10-04 04:45:58 +02:00
Eldred Habert
c6eacde55e Merge pull request #544 from ISSOtm/atomic_ind
Split register-indirect tokens
2020-08-05 10:52:18 +02:00
ISSOtm
6563133426 Avoid using echo -e in tests 2020-07-27 18:26:05 +02: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
ca6fa6d1d7 Split register-indirect tokens
This allows whitespace between the brackets and the register.
This also fixes #531

Note that `$ff00 + c` is still treated as a single token, because trying to
use an expression on the left side causes a shift/reduce conflict.
This isn't great, but most people seem to be either used to it as-is, or
using the new `ldh a, [c]` syntax.
If this causes problems with a lexer rewrite, it'll be deprecated; but for
now, keep it around, as the support is clunky but bearable.
2020-07-22 15:00:39 +02: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
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
ISSOtm
023a3c037f Properly handle missing symbols
Fixes #512
2020-04-12 22:52:32 +02:00
ISSOtm
b0ec8468e6 Allow specifying offset in addition to alignment 2020-04-08 00:40:41 +02:00
ISSOtm
190678107b Prevent RGBLINK from crashing when getting the bank of a constant 2020-04-07 20:41:29 +02:00
ISSOtm
82e0e4ffaf Make some RGBLINK errors non-fatal 2020-04-06 00:48:10 +02:00
ISSOtm
ffb199a26a Avoid Useless Use of backticks in rgblink testing 2020-04-06 00:44:59 +02:00
ISSOtm
175933d2b1 Remove old scripts for updating references for tests
I much rather prefer correcting everything by hand, and gauging
whether the change is good on a case by case basis
2020-04-06 00:41:37 +02:00
ISSOtm
92134d7684 Add testing for assertions inside unionized sections 2020-03-22 11:14:04 +01:00
ISSOtm
4877bb783c Add more tests for unionized sections + fix bugs
Implementing those tests found a few bugs... oops
2020-03-22 11:14:04 +01:00
ISSOtm
e123b6dec7 Implement unionized sections in RGBLINK 2020-03-22 11:13:39 +01:00
ISSOtm
fb58166e5d Add assertions
Closes #292
2020-03-21 23:00:38 +01:00
ISSOtm
eb445271df Remove carryover from RGBASM in RGBLINK tests 2020-03-20 21:50:38 +01:00
ISSOtm
8c4b473d6f Add more checks to section creation in RGBASM
Fixes rednex#471, but also backports a couple more checks from RGBLINK
2020-02-10 03:35:55 +01:00
ISSOtm
b42a04c24e Add test for jr @
Fun fact: current build *fails* this test!
2020-02-07 13:19:50 +01:00
ISSOtm
9687e6e1dd Allow forcing the second byte of STOP
Fixes #433
2020-02-07 10:06:02 +01:00
ISSOtm
ee34200e5f Output diffs when binary tests fail 2020-02-06 15:36:15 +01:00
ISSOtm
295fc6c619 Improve coverage of db-@ test 2020-02-05 13:24:50 +01:00
ISSOtm
35f7340dc9 Report failing test names in RGBLINK as well 2020-02-04 01:41:35 +01:00
ISSOtm
b1cd730db2 Add link-time RST instruction
This allows using a label as the argument to a `rst` instruction
Fixes rednex#448
2020-02-03 21:07:12 +01:00