Commit Graph

432 Commits

Author SHA1 Message Date
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
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 8c96293b11 Test the RGBASM state file output (#1472) 2024-08-19 20:13:27 +02: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
Sylvie 2d530dbcd6 Fix constant expression detection functions (#1462) 2024-08-09 09:40:53 +02:00
Sylvie e93190d491 Implement BITWIDTH and TZCOUNT functions (#1450) 2024-08-07 10:39:30 -04:00
Sylvie 7435630d6a Error messages note when a symbol has been purged (#1453) 2024-08-06 15:35:06 -04:00
Sylvie bb480b761c Rephrase numeric-string warning to not be identical to another one (#1449) 2024-08-06 13:56:09 +02:00
Sylvie 2706f94788 Multiple fixes and enhancements to RPN behavior: (#1448)
- FIX: `Label & const` was not actually doing the `& const` masking
  (fixes #1446)
- ADD: `LOW(Label)` can be constant if `Label` is aligned to 8 or more bits
  (resolves #1444)
- ADD: `!expr` can be constant 0 if `expr` has any non-zero bits
  (resolves #1447)
- `LOW()` and `HIGH()` have their own RPN operator values
  (resolves #1445)

The change to RPN values means that the object file version was incremented.

This also refactors unary operators and functions, combining their
evaluation similarly to binary ones.
2024-08-06 13:54:55 +02:00
Sylvie 2f8f99bd94 Implement -Wpurge= (#1443) 2024-08-05 12:50:48 -04:00
Sylvie c5e6a815fa Deprecate treating multi-unit strings as numbers (#1438) 2024-08-05 16:05:50 +02:00
Sylvie 9a5b3f0902 Implement multi-value charmaps (#1429) 2024-08-04 23:32:08 +02:00
Sylvie 92abe24894 Implement EXPORT DEF to define and export symbols (#1422) 2024-07-25 17:40:58 -04:00
Sylvie 13a8895fca Improve the error messages for interpolating undefined or invalid symbols (#1423) 2024-07-25 17:36:02 -04:00
Sylvie e179ba5fd3 Add syntax to push and modify stacks in one line (#1421) 2024-07-25 23:14:59 +02:00
Sylvie 623c3f662c Allow NUL characters in strings (#1405) 2024-06-18 14:26:18 -04:00
Sylvie 8c3ca462fe Add more test cases (#1409) 2024-06-17 15:07:35 -04:00
Sylvie dfec7111e2 X && 0 and X & 0 are constant 0; X || 1 is constant 1 (#1399)
Fixes #977
2024-06-13 11:09:39 -04:00
Sylvie 3e9d2cab12 Make some error messages more consistent (#1393)
* Update some error messages

* Make non-A destination operand syntactically invalid
2024-04-20 23:13:01 +02:00
Sylvie 9ab3446d1a Fix two bugs with RGBASM fixed-point math (#1388)
- Fixed-point formulas are implemented using IEEE-754 floating-point
  internally, which could give infinity or NaN values whose conversion
  to fixed-point integer was platform-dependent.
- Formatting fixed-point $8000_0000 (INT32_MIN, -2147483648) was
  not putting the negative sign in front.
2024-03-31 12:53:20 -04:00
Rangi42 230b1db438 Remove deprecated DEF-less definitions 2024-03-28 17:26:42 -04:00
Rangi42 14b72222b1 Remove the deprecated -H/-h/-L/-l options 2024-03-28 17:26:42 -04:00
Sylvie 96c808810f Remove .simple.err files, since we require Bison 3.0 (#1373) 2024-03-22 15:36:32 -04:00
Rangi42 507439bc25 Refactor macro args to be owned collectively by their fstack contexts 2024-03-22 14:25:36 -04:00
ISSOtm e255af9e10 Do not limit strings to 255 characters 2024-03-22 14:25:36 -04:00
ISSOtm 9f239f6dcc Use std::shared_ptr<std::string> for lexed/parsed strings 2024-03-22 14:25:36 -04:00
Sylvie f792580816 Only restore parent context's \@ value if it had one defined (#1366)
This way, if a child context initializes `\@`, the parent won't
reset it. And if the child context did not initialize `\@`,
then resetting it would be redundant.
2024-03-21 19:53:49 -04:00
Sylvie 554778da5b Built-in symbols are "<builtin>", not "<command-line>" (#1362) 2024-03-19 16:01:45 -04:00
Sylvie fec2266dd8 Use std::string for string-formatted values (#1360)
* Use `std::string` for string-formatted values

* Make `formatString` and `formatNumber` be `const`
2024-03-19 07:43:18 +01:00
Rangi42 d06376c170 Use std::unordered_map and std::vector for sections
This allows us to control the order in which sections are iterated,
instead of it depending on the internals of `std::map`. (This order
is arbitrary, but should be deterministic regardless.)
2024-03-16 11:51:47 -04:00
Rangi42 e701faa1bc Print summaries at the end of test.sh scripts 2024-03-07 16:45:53 -05:00
Rangi42 7663a777d5 Remove 255-character limit on symbol names 2024-03-07 12:40:37 -05:00
Rangi42 75105016f7 Make sure that parsed subexpressions are fully defined
We were not initializing some expressions, and they were using
the values of the previous expressions instead. This just so
happened to not crash the tests, and to sometimes even give valid
results (although `BANK()` of a non-label symbol being $4B4E4142,
the ASCII balue of "BANK", was something we missed).
2024-03-06 16:00:55 -05:00
Rangi42 a24df27cd8 Use std::vector for charmap output 2024-02-29 13:44:08 -05:00
Rangi42 d53bba97e8 Remove our custom hashmap 2024-02-29 13:44:08 -05:00
Sylvie b66212e6d6 Fix fstack traces for macro nodes (#1318)
Since the lexer rewrite, MACRO nodes' fstack traces have not
included their parent REPT nodes' names.
2024-02-24 20:23:25 -05:00
Sylvie c0d534f5ad No more flexible array members (not standard C++) (#1307)
* Replace FAMs with `std::vector`s (or one `std::string`) in four `struct`s

* Anonymous types declared in an anonymous union are also non-standard
  Only Clang complains about this (-Wnested-anon-types)
2024-02-22 16:22:37 -05:00
Sylvie a02687a83e Fix behavior of non-ASCII bytes with INCHARMAP (#1308) 2024-02-19 08:09:55 +01:00
ISSOtm 1b08a12b26 Ensure that mid-section align 16 makes PC constant
This makes `align 16` a sort of `org`, which is *very* useful :)
2024-02-18 17:53:56 -05:00
Sylvie ef0d973187 Truncate long format spec strings before using them (#1299)
Fixes #1293
2024-02-18 14:27:03 +01:00
Rangi 39018174c5 Scramble banks from the end of the ROM (#1273)
This is more likely to test edge cases, such as having content in banks with their highest bit set.
2023-12-17 20:14:03 -05:00
Rangi 34b2543c8b Implement -X/--max-errors for RGBASM (#1262)
Co-authored-by: Eldred Habert <me@eldred.fr>
2023-12-07 11:42:47 +01:00
Rangi 6132b77c1e Add more tests for RGBASM code coverage (#1257)
* Add more tests for RGBASM code coverage

* Use C++ unnamed parameters, not `(void)` casting

* Fix crash in `sect_AlignPC` from #1253
2023-12-01 10:21:43 -05:00
Rangi cee3d1c859 Add more test coverage for RGBASM (#1256)
This also fixes two bugs: `-1 >>> 32` was -1 not 0, and `macro_FreeArgs` should have been called but wasn't.
2023-11-29 15:16:05 -05:00
Rangi42 b46aa0f55b colour->color, behaviour->behavior
These spellings are more common elsewhere in the codebase
2023-11-27 16:02:17 -05:00
Rangi 2ebd7f2ea3 Allow negative alignment offsets (#1255) 2023-11-25 09:40:20 +01:00
Rangi 92836408cc Remove empty .out and .err test files (#1249)
Co-authored-by: ISSOtm <me@eldred.fr>
2023-11-24 17:52:55 -05:00
ISSOtm 6f0defbfe5 Fix shellcheck warnings in the test scripts
Making them more robust to changes.
We ought to automate this some day.

My version of ShellCheck (v0.9.0) errors on test/gfx/test.sh, though...
2023-11-24 20:54:28 +01:00