Rangi
3e945679ad
Standardize on "east const" (type const * not const type *)
...
Avoid "WARNING: Move const after static - use 'static const char'"
2021-11-18 09:12:00 +01:00
Rangi
efccf6c931
A few stylistic tweaks
...
- `goto free_romx` -> the more typical `goto cleanup`
- `goto fail` -> the more typical `goto finish`
- Remove a redundant `todo` variable
2021-11-17 23:51:40 -05:00
Rangi
0bb815edc0
Implement -Wnumeric-string[=0|1|2] ( #935 )
...
Fixes #934
2021-11-12 23:09:35 +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
Rangi
a67f5d6e01
SIZEOF("Section") and STARTOF("Section") can be known
...
Fixes #890
2021-06-27 21:03:06 +02:00
ISSOtm
e3b7339dd6
Save UNION stack when using PUSHS as well
...
This allows using the latter within the former
2021-05-21 09:47:27 +02:00
ISSOtm
69d7f84502
Reset LOAD offset when changing SECTIONs
...
This would cause spurious section overflow messages, since the load offset
is added to the section's when computing its size.
2021-05-21 09:37:17 +02:00
ISSOtm
75f1bcde31
Make SECTION size overflow non-fatal
...
Fixes #538
2021-05-04 15:34:20 +02:00
ISSOtm
8bbafb7200
Rename out_ functions in section.c to sect_
...
More consistent with convention used everywhere, and makes it easier to
know which file the functions come from.
2021-05-03 12:22:14 +02:00
ISSOtm
75ce230dce
Make UNION-related errors non-fatal
2021-05-03 10:57:14 +02: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
ISSOtm
02cb5a0526
Avoid performing invalid actions on LOAD errors
...
These are rejected because they could lead to incorrect behavior,
so then don't do it...
2021-05-03 10:46:52 +02:00
ISSOtm
38a9a613da
Make data output outside of a SECTION non-fatal
2021-05-01 23:48:48 +02:00
Eldred Habert
21b59c4651
Reinstate PUSHS clearing the SECTION scope ( #870 )
...
* Reinstate PUSHS clearing the SECTION scope
Otherwise you can use `PUSHS` to simulate the old `ds -21`, and possibly cause bugs
* Have PUSHS push LOAD block state as well
It does not make sense not to, and coud cause bugs.
2021-05-01 23:30:09 +02:00
Rangi
3fdf01c0f5
Resolve some TODO comments
...
- `out_PushSection` should not set `currentSection` to NULL because
PUSHS, PUSHC, and PUSHO consistently keep the current section,
charmap, and options, even though the stack has been pushed.
- `Callback__FILE__` does not need to assert that `fileName` is not
empty because `__FILE__`'s value is quoted, and can safely be empty.
- `YY_FATAL_ERROR` and `YYLMAX` are not needed since the lexer is
not generated with flex.
2021-04-26 15:52:30 -04:00
ISSOtm
6d0a3c75e9
Get rid of Hungarian notation for good
...
Bye bye it was not nice knowing ya
2021-04-19 22:12:10 +02:00
Rangi
c08cf783c8
Remove 'inline' from functions not in headers
2021-04-13 10:27:08 -04:00
Rangi
3e0b7d428f
Fix an unclosed file and unfreed memory in out_BinaryFileSlice
...
Use 'goto cleanup' in both out_BinaryFileSlice and out_BinaryFile
2021-04-13 09:19:59 -04:00
Rangi
576b063519
Fix unattainable alignments to address 0
...
Fixes #818
2021-03-31 16:06:15 -04:00
ISSOtm
aaa4e17454
Add verbose messages for early exit from -MG
...
Should help debugging Make invocations
2021-03-14 18:28:05 +01:00
ISSOtm
60019cf476
Fix a bunch of Clang warnings
...
As reported by #789
Should avoid relying on 32-bit int (for implicit conversions)
and account for more extreme uses of RGBDS.
2021-03-10 10:56:57 +01:00
ISSOtm
714d39c86f
Make some INCBIN errors non-fatal
2021-03-10 01:02:45 +01:00
daid
cb47ac8b97
Change the start position check on INCBIN
...
Currently INCBIN gives an error if your start position == file size.
This means you cannot include an empty file.
It also means the text of the error message is incorrect
(as the start is not greater, but equal to the length of the file)
2021-03-10 01:02:45 +01:00
Rangi
c637447d5d
Make the "db/dw/dl directive without data in ROM" warning more specific
...
Also use uppercase for DB/DW/DL to be consistent
2021-03-02 11:48:20 +01:00
Rangi
76d8862900
Refactor part of getSection into createSection
...
getSection validates its parameters and calls
either mergeSections or createSection.
2021-02-28 16:12:03 -05:00
dannye
929e2a4490
rgbasm: Report conflicting file/line number for duplicate sections
2021-02-23 20:08:59 +01:00
Rangi
8c0275480c
Allow ds to take multiple values to repeat for a count ( #725 )
...
Fixes #722
2021-02-16 22:01:23 -05:00
Rangi
76d6ef8695
Implement LOAD UNION and LOAD FRAGMENT
...
Fix #632
2021-02-17 03:42:06 +01:00
Rangi
ee20d9010e
Make @ relative to the start of a ds even at link time
...
Fix #737
2021-02-16 22:47:07 +01:00
Rangi
dddff0f450
Cannot start a new section that's already on the stack
...
This is only relevant for FRAGMENT or UNION sections, since
normal ones would fail with "Section already defined previously".
Fixes #730
2021-02-16 21:51:48 +01:00
ISSOtm
b3c0db218d
Remove "EOF-newline" lexer hack
...
In preparation for an upcoming change
Makes for nicer error messages, complaining about EOF instead of newlines
The hack had to be kept for the lexer raw mode to avoid a bug;
see the relevant code comment for more info.
2021-02-11 12:48:37 +01: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
a679e02246
Get rid of asm.h and localasm.h
...
No need to make them global
2021-01-22 13:34:16 +01:00
ISSOtm
592e9b3725
Reorganize and comment better main()
2021-01-22 11:09:27 +01:00
ISSOtm
fa0fa4d5ac
Significantly overhaul OPT code
...
Simplify the mess that was option setting (2 redundant variables !?)
Move options to a separate file
Have "modules" own their options, and OPT only access them (less redundancy)
Simplify code, respect naming conventions better
2021-01-22 10:41:09 +01:00
ISSOtm
5be1c0da62
Fix intra-section ALIGN not computing offset correctly
2021-01-09 23:29:08 +01:00
Rangi
063a22ddf9
LOAD blocks cannot create a ROM section
...
Fixes #576
2020-12-19 00:58:54 +01:00
Rangi
165bd8cb71
Allow 'dw' and 'dl' to apply to characters of strings
...
Fixes #568
The old behavior of `dw "string"` can be replicated with `dw ("string")`; likewise for dl
2020-12-11 11:02:20 +01:00
ISSOtm
213d985e17
Fix incorrect "sliced" INCBIN causing memory leaks
...
Oh, how I miss RAII...
2020-11-29 12:47:53 +01:00
ISSOtm
4f842a1248
Create specialized symbol finder functions
...
The old "find symbol with auto scope" function is now three:
- One finds the exact name passed to it, skipping any checks
This is useful e.g. if such checks were already performed.
- One checks that the name is not scoped, and calls the first.
This is useful for names that cannot be scoped, such as checking for EQUS.
Doing this instead of the third should improve performance somehwat, since
this specific case is hit by the lexer each time an identifier is read.
- The last one checks if the name should be expanded (`.loc` → `Glob.loc`),
and that the local part is not scoped. This is essentially the old function.
2020-11-21 01:06:17 +01:00
Jakub Kądziołka
822e4e7c44
Report error when aligning outside of a section
2020-10-12 00:27:54 +02:00
ISSOtm
6dc4ce6599
Implement infrastructure around new lexer
...
The lexer itself is very much incomplete, but this is intended to be a
safe point to revert to should further implementation go south.
2020-10-04 04:37:58 +02:00
ISSOtm
2e3db9d56a
Clean up label generation
...
Only check for localness when we already know we have a local
2020-10-03 21:33:30 +02:00
ISSOtm
a1286e6f0e
Make newlines explicit in error messages
...
In preparation for a change a PR is about to make
2020-09-27 10:54:06 +02:00
ISSOtm
304bb9f902
Remove most Hungarian notation in section module
...
Seriously, it sucks.
2020-09-06 20:43:13 +02:00
ISSOtm
14be01880d
Move UNION code inside section.c
...
Improves organization and locality
2020-09-06 19:18:10 +02:00
ISSOtm
12b7cf3cd4
Move curOffset into section code
...
Improves organization
2020-09-06 18:50:19 +02:00
ISSOtm
9d62b4b9bb
Fix bugs with LOAD section size
...
LOAD blocks did not properly update their parent's size until after closed
Additionally, section size wasn't correctly sanitized inside LOAD blocks
2020-09-03 12:07:12 +02:00
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
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