Commit Graph

2818 Commits

Author SHA1 Message Date
ISSOtm
4ce6c9f4a5 Avoid bogus comparisons when linking fails
This avoids drowning RGBLINK's errors in a meaningless `diff` output
2024-08-26 22:58:38 -04:00
ISSOtm
8286d9c462 Check that there is enough room to write a patch when linking
Prevents segfaulting if a patch's offset is too large
2024-08-26 22:58:38 -04:00
Rangi42
fbe28e0def Remove outdated "absolute data" terminology in function names 2024-08-26 22:58:38 -04:00
ISSOtm
23272f028f Update the best proto-pal relative size when a new best is found
*facepalm*
2024-08-23 13:35:48 +02:00
ISSOtm
77129b9e80 Fix a false positive reported by scan-build
Arguably this also makes the logic a little clearer, so might as well
2024-08-23 01:34:36 +02:00
Sylvie
44332ff4be Charmaps cannot map an empty string (#1486) 2024-08-22 13:21:16 -04:00
Sylvie
81ab133566 Enable more testing of RGBGFX output (#1473) 2024-08-22 19:19:39 +02:00
Sylvie
0e8a17ce82 Report any section overflows at the end of assembly (#1482)
* Report any section overflows at the end of assembly

* Immediately handle overflow of the 32-bit size counter
2024-08-22 18:51:52 +02:00
Rangi42
7bc9a24bf0 Edit some documentation of unions and macros 2024-08-22 00:41:07 -04:00
Sylvie
b438c83bda Implement a '#' prefix for raw identifiers that may alias keywords (#1480)
* Implement a '#' prefix for raw identifiers that may alias keywords

* Review comments

* Disallow hashless raw identifiers in interpolations

* Run clang-format
2024-08-21 19:31:44 +02:00
Sylvie
82e81ab1da Test RGBLINK on SDCC object files (#1479) 2024-08-20 17:51:01 -04:00
Sylvie
57c3d74b9e Use a custom generic tagged union Either instead of std::variant for efficiency (#1476)
* Implement custom generic tagged union `Either`

This should be more efficient than `std::variant`, while still
keeping runtime safety as it `assert`s when `get`ting values.

* Use `Either` for RPN expressions

* Use `Either` for file stack node data

* Use `Either` for `File` buffer

* Use `Either` for `STRFMT` args

* Use `Either` for RGBLINK symbol values

* Support an equivalent of `std::monostate` for `Either`

* Use `Either` for lexer tokens

* Use `Either` for symbol values

* Use `Either` for lexer mmap/buffer state
2024-08-20 21:19:11 +02:00
Sylvie
7d98b9a900 Add RGBFIX tests for MBC names (#1477)
RGBFIX tests are now based on .flags files
The .bin and .err files are optional
2024-08-20 21:15:37 +02:00
Eldred Habert
8f47fb494b Improve some documentation (#1474)
* Delete removed symbol from PRINTLN examples

* Touch up `SHIFT` docs

Co-authored-by: Sylvie <35663410+Rangi42@users.noreply.github.com>
2024-08-19 20:29:20 +02:00
Sylvie
8c96293b11 Test the RGBASM state file output (#1472) 2024-08-19 20:13:27 +02:00
Sylvie
57f122a04e Document !cc support alongside HIGH(r16) and LOW(r16) support (#1475) 2024-08-19 18:56:16 +02:00
Sylvie
356367bfd3 Allow mirroring only the X or Y axes (#1468) 2024-08-18 21:47:39 -04:00
Rangi42
b7290366cb Reword some RGBASM docs 2024-08-18 21:38:45 -04:00
Rangi42
731715ff36 Refactor test.sh scripts for consistency 2024-08-18 21:38:45 -04:00
Rangi42
7cf4156003 Add some more tests, and fix some existing ones 2024-08-18 21:38:45 -04:00
Rangi42
ee3a93a442 Test macro args \0 and \<0> 2024-08-18 21:38:45 -04:00
ISSOtm
96a0481cba Pass RGBDS= to make clean as well in downstream tests
Avoids some spurious "command not found" errors when cleaning SameBoy
Fixes #1471
2024-08-18 20:11:01 +02:00
ISSOtm
86140b5b2f Correctly apply section fragment offsets to contained symbols 2024-08-18 19:44:04 +02:00
ISSOtm
369296693c Avoid softlock if linker script contains a comment but no newline 2024-08-18 19:44:04 +02:00
ISSOtm
47b2e0e912 Trap bad __at() values too
Those set the section type earlier than the linker script,
so a check needs to be performed there too
2024-08-18 19:44:04 +02:00
ISSOtm
28733fe312 Implement floating bank in linker script
Turns out that we can solve being unable to choose a bank to change
the PC of, by simply refusing to choose!
2024-08-18 19:44:04 +02:00
ISSOtm
e45a422da3 Clarify error message when a section lacks a type
The previous commit has made this precision possible
2024-08-18 19:44:04 +02:00
ISSOtm
9fd4ba90cc Trap invalid section types in RGBDS objs 2024-08-18 19:44:04 +02:00
ISSOtm
e548ecc6fa Report attempts to assign a SDCC area in a way inconsistent with its data
This actually avoids breaking the (segfaulting) invariant that
a section whose type "has data" has as many bytes of `->data` as
its `->size`.
2024-08-18 19:44:04 +02:00
ISSOtm
00b0914436 Reserve space to avoid file sym array realloc
This line was missing; in its absence, as soon as the array reallocs,
all registered symbol pointers are invalidated, leading to a crash
(e.g. when generating a sym file).

Made the reallocation check into a hard error, too.
Since fileSymbols gets registered with each section, we would have to
change that, and then it cascades throughout all of RGBLINK.
This will be handled correctly in the Rust port.
2024-08-18 19:44:04 +02:00
Ruben Zwietering
60c03ec1e3 Clear the old line buffer when filling the next one in nextLine 2024-08-18 19:44:04 +02:00
Ruben Zwietering
379aa8c267 Use line.reserve in sdobj_ReadFile instead of constructor
Passing a count parameter to the vector constructor does not reserve
count elements but instead fills the vector with count elements.
This caused the endianness check to fail first because the first 256
characters were null bytes.
2024-08-18 19:44:04 +02:00
ISSOtm
589cea47f6 Add a contrib script for visualising the generated palettes as a PNG 2024-08-14 17:55:39 +02:00
ISSOtm
68a6abd00e Fix ProtoPalette::compare
The function only stopped at the end of the *arrays*,
not of *their used portions*!
This could cause false negatives one way or the other.

This appears not to affect the palette packing, since the packing algorithm
deals with them efficiently; but it should speed up processing slightly,
and as the test changes show, it also improves the UX of palette packing
error messages!
2024-08-14 17:36:15 +02:00
Rangi42
c42e856efb Fix charmap state output for inherited characters 2024-08-09 22:13:43 -04:00
Sylvie
b987e5669f Comment the parsers better (#1463) 2024-08-09 21:36:52 -04:00
Eldred Habert
718066c2cf Build “fat binaries” for macOS (#1461)
The same binary, both for Intel and ARM Macs!

Builds libpng manually since the lib Brew distributes only contains code for the host arch.
2024-08-09 13:18:58 -04:00
Sylvie
2d530dbcd6 Fix constant expression detection functions (#1462) 2024-08-09 09:40:53 +02:00
Eldred Habert
a9140e6bb4 Fix incorrect name of macos-static artifact 2024-08-09 01:59:17 +02:00
Eldred Habert
fb6f861a08 Use macOS 14 in CI (#1335) 2024-08-08 22:16:32 +02:00
Rangi42
0adff57e2c Sync warning flags between Makefile and CMakeLists.txt 2024-08-08 16:02:11 -04:00
ISSOtm
784e828219 Enforce C++ compiler when building test binaries in CI too 2024-08-08 20:45:36 +02:00
ISSOtm
b20b2dd28c Pass CXX env var through when compiling RGBGFX test binaries 2024-08-08 20:45:36 +02:00
ISSOtm
2a85009b6b Be verbose about building the RGBGFX test binaries
People may not expect that to happen!
And CI would be easier to debug that way, too.
2024-08-08 20:45:36 +02:00
ISSOtm
809b364958 Be stricter in test scripts
Omitting parameters is not a good idea, but even worse if it fails
mysteriously without any error messages
2024-08-08 20:34:09 +02:00
ISSOtm
60f9e86361 Pass libpng CFLAGS when building rgbgfx_test.cpp too
Don't ask me how this hasn't broken earlier, but hey, now it's fixed
2024-08-08 20:30:31 +02:00
Eldred Habert
817dcfdc70 Improve fixed-point documentation (#1455)
* Clarify the operator relationship of ordinary and fixed-point numbers
* Attempt to clarify description of fixed-point numbers
* Note that RGBASM does not check fixed-point precisions
* Simplify sine table example a bit
* Remove misleading equations describing `DIV`, `MUL`, and `FMOD`
* Various minor style and formatting fixups
2024-08-08 13:56:08 -04:00
Sylvie
a3f9952b9e Advise on how to use -x to make -r work (#1459) 2024-08-08 19:50:51 +02:00
Sylvie
0cd79c33ef Fix RGBGFX reversal (#1425)
* Print all OoB tilemap IDs before aborting

* Rename `nbTileInstances` to `mapSize`

* Check that reversing doesn't overflow the tile array

---------

Co-authored-by: ISSOtm <me@eldred.fr>
2024-08-08 19:40:41 +02:00
ISSOtm
747427e801 Make test/gfx/at-file-ref consistent
The generated `result.pal` can change between platforms, it turns out
(due to "unstable sort" differences), and creates additional churn if
changing anything related to palette generation.

tl;dr this makes the test less flaky in the long run.
2024-08-08 12:23:12 +02:00