Commit Graph

244 Commits

Author SHA1 Message Date
ISSOtm
5bc8d51a9e Ignore unused arguments in a more standard way 2020-02-29 16:25:54 +01:00
ISSOtm
dac13ba4bb Add string format checking to err.h functions
And fix all problems this detected... oops
2020-02-24 16:58:55 +01:00
ISSOtm
4cc24f4369 Add ds cnt, byte syntax
As suggested by https://github.com/rednex/rgbds/issues/350#issuecomment-498030458
The order `count` then `byte` was decided after some discussion:
- First argument consistent with single-arg syntax
- Intuitive at least to some people other than myself
- Consistent with other assemblers, at least ca65
2020-02-23 22:43:50 +01:00
ISSOtm
cfe21876e5 Make writing patches not affect the expression
This also removes one int member from the struct that shouldn't be there
2020-02-23 22:29:01 +01:00
ISSOtm
ef2bfe4ea0 Store patch file line in the file name
It's more consistent with how it's stored for all other entries in the stack
2020-02-19 09:51:40 +01:00
ISSOtm
f01a227470 Fix non-const labels with callbacks having incorrect values when diffed
Basically, this broke PC, which is currently the only label-typed symbol
with a callback.
2020-02-13 20:16:59 +01:00
ISSOtm
91b65c9380 Add include guards and license header to section.h 2020-02-13 15:57:27 +01:00
ISSOtm
eb0d75711a Implement LOAD/ENDL blocks
Basically implements and closes rednex#274.
2020-02-10 03:39:09 +01:00
ISSOtm
2f60e0a59e Use meaningful types for byte output functions 2020-02-10 03:36:51 +01:00
ISSOtm
a4fe274c25 Unify all section declarations 2020-02-10 03:35:55 +01:00
ISSOtm
34597ce6a0 Mark some section functions as const 2020-02-10 03:34:58 +01:00
ISSOtm
4a2af807b2 Remove legacy forward declaration 2020-02-10 03:34:58 +01:00
ISSOtm
d0ec35628f Split section management into its own file 2020-02-10 03:34:58 +01:00
ISSOtm
bfdbd00092 Do some misc cleanup of output.c 2020-02-10 03:25:03 +01:00
ISSOtm
5014f55c48 Treat PC as a symbol as well 2020-02-10 02:51:48 +01:00
ISSOtm
1d78cd0f03 Axe the constexpr expression evaluator
This avoids redundancy between them (and also having to port fixes and features)
The error messages have been preserved through a string reporting mechanism
2020-02-10 02:51:48 +01:00
ISSOtm
9ce8a9f5f0 Add comments to RPN expr struct 2020-02-10 02:47:12 +01:00
ISSOtm
cc59730c5b Cleanup the RPN evaluator somewhat
Make the bool field an actual bool
Rename `iReloc` to a more exact `isKnown` (as was already pointed out by some
comments)
Make the value of `BANK(symbol)` consistent when the argument is invalid
2020-02-10 02:47:12 +01:00
ISSOtm
0a04904b75 Refactor RPN binary expressions into a single func
This mirrors what the constexpr evaluator is doing, and removes a lot of code shared
between all of them
2020-02-10 02:47:12 +01:00
ISSOtm
ea52e45335 Fix @
The symbol's evaluation by the assembler and linker was very inconsistent
2020-02-07 13:19:50 +01:00
ISSOtm
28473d314a Make implicit truncation a warning 2020-02-05 13:20:51 +01:00
ISSOtm
f363541611 Introduce revision number field 2020-02-03 21:10:05 +01:00
ISSOtm
fa1fba7fd9 Increase object version to RGB9 2020-02-03 21:07:46 +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
ISSOtm
fd32b2252f Define additional variable when doing make develop 2020-02-03 19:58:02 +01:00
ISSOtm
877e0e0b91 Get rid of BANK_COUNT_* symbols
They weren't used save for the definitions right below, so Occam's razor applies
2020-02-03 15:19:48 +01:00
ISSOtm
da1d9f68c7 Remove and reorder bank counts
Why was this an enum in the first place, anyways?
2020-02-03 15:19:48 +01:00
ISSOtm
24f41ef897 Expose link def arrays to RGBASM 2020-02-03 15:19:48 +01:00
ISSOtm
09dff85d5b Merge common.h into linkdefs.h 2020-02-03 14:50:00 +01:00
Eldred Habert
20e5685c1a Merge pull request #424 from ISSOtm/better_deps
Improve dependency generation
2020-02-03 03:50:09 +01:00
Eldred Habert
ac6232bc87 Merge pull request #473 from ISSOtm/shift_ub
Remove undefined behavior from shifts
2020-02-03 03:49:38 +01:00
ISSOtm
ed72baca2a Make more symbol functions const
Can't hurt to specify those as they are now. Perhaps it'll enable slightly more
compiler optimizations, too?
2020-01-30 02:38:33 +01:00
ISSOtm
6d4b128611 Avoid unnecessary copies in symbol init 2020-01-30 02:15:43 +01:00
ISSOtm
b11d121c48 Remove undefined behavior from shifts
`asl` and `asr` in `src/link/patch.c` courtesy of @pinobatch, and rearranged in RGBASM
evaluators.
2020-01-28 12:37:38 +01:00
ISSOtm
08ab34cf57 Fix a few checkpatch warnings in symbol.h 2020-01-26 18:26:57 +01:00
ISSOtm
12f2f654dd Add -MG
This option allows for automatic dependency detection and generation:
as soon as a missing file is found, it is output to the dep file, and
assembly immediately aborts. (No .o file is produced, even if `-o` was
speicified.) This doesn't cause an error, either; the point is that once
the file is added to the dep file, the Makefile is re-parsed, and this
time the file will be generated, so the dep list builds up automatically.
This mimicks GCC's option and behavior.
2020-01-26 15:33:36 +01:00
ISSOtm
1fb9f90f0f Add -MT option
Allows overriding the output file in dependencies, which also allows
outputting those without also outputting the object file.
This, again, mimicks GCC's option.
2020-01-26 15:32:45 +01:00
ISSOtm
bfa8da78a6 Add -MP option
Adds a phony target to every included file, mimicking gcc's
2020-01-26 15:32:45 +01:00
ISSOtm
ab9307ac61 Clean up symbol management
Stop using that bitfield for everything, including what can be determined otherwise
It also makes it easier to have a sane state, since some bits were (supposedly)
mutually exclusive
2020-01-24 02:51:48 +01:00
ISSOtm
e3ef194b4f Remove local label error checking
This is actually not necessary, because RGBLINK would warn about missing labels.
Besides, through semi-esoteric ways, it is possible to define more labels in this scope,
and there's no reason to prevent that.
2020-01-24 02:51:48 +01:00
ISSOtm
a7c0616cd8 Rename export type enum to that
This prevents a conflict in the next commit
2020-01-24 02:51:48 +01:00
ISSOtm
4fe44447a2 Add license headers where missing 2020-01-19 11:11:36 +01:00
Antonio Niño Díaz
6003be3fae Fix declaration of constexpr_BankSymbol() 2020-01-08 23:33:42 +00:00
Eldred Habert
676800476d Merge pull request #430 from ISSOtm/known_selfbank
Make `BANK(@)` and `BANK("section")` known to RGBASM
2020-01-08 18:56:28 +01:00
Eldred Habert
4dfa3157e5 Merge pull request #454 from ISSOtm/unlocked_windows
Fix mingw build
2020-01-08 13:14:13 +01:00
ISSOtm
b49e025703 Allow BANK() in constexpr expressions 2019-12-07 23:43:02 +01:00
ISSOtm
74f43d4e09 Add a way to seek a SECTION by name without creating one 2019-12-07 22:15:07 +01:00
ISSOtm
f710f21ad8 Reorder warnings alphabetically 2019-12-06 12:06:21 +01:00
ISSOtm
b1d4be66e4 Remove deprecated "section charmap" feature 2019-12-04 01:56:06 +01:00
ISSOtm
2d7d9eef9f Fix some make checkcodebase errors
- Reorder checkpatch ignore flags alphabetically
- Fix checkpatch WARNINGs and CHECKs when they make sense
- Add more checkpatch ignores
2019-12-04 00:16:28 +01:00