Commit Graph

791 Commits

Author SHA1 Message Date
Ben Hetherington
c4471e3300 Update CONTRIBUTORS.rst
Updated to reflect my current committer identity.
2019-08-16 13:22:19 +01:00
Ben Hetherington
16111f46ef Allow PUSHS to be used before a section
Previously, a PUSHS before a SECTION directive would cause rgbasm to crash when encountering a subsequent POPS.

This is because the subsequently-called out_setCurrentSection() expected the new section to be non-null, which wasn’t the case in this situation. This has been addressed by allowing the ‘null’ section to be set in this function, and only dereferencing it (to set nPC) if a non-null section is to be set.

In practice, this means that PUSHS/POPS can now be used to push/restore a context without a section.
2019-08-16 13:22:19 +01:00
Antonio Niño Díaz
b019b03946 Merge pull request #358 from dbrotz/fix-357
Fix buffer overflow when creating patches with long RPN expressions
2019-07-12 00:49:08 +01:00
Antonio Niño Díaz
605acd24ba Merge pull request #372 from jidoc01/master
Document the feature of input from stdin (resolves #371)
2019-07-12 00:48:25 +01:00
jidoc01
c8630eee95 Document the feature of input from stdin
Since #329, rgbasm can get input from stdin. I updated the manpage
file related to it, which explain the description and usages in
rgbasm.
2019-07-08 23:28:46 +09:00
Antonio Niño Díaz
4040555532 Merge pull request #365 from dbrotz/terminate-bracketed-symbol
Terminate standalone bracketed symbol strings
2019-07-07 11:46:43 +01:00
Antonio Niño Díaz
defb221c98 Merge pull request #360 from jidoc01/master
Improve charmap structure with trie.
2019-07-07 11:46:08 +01:00
jidoc01
e7dc094e56 Improve charmap structure with trie
Charmap's previous structure was using brute-force comparison for
converting the strings in source files. It always compared given
strings to all of the strings in charmap, which was very costly
in huge projects.
For its improvement, I changed its structure into trie, which is
being used in many string-processing areas. It's now much faster
than before.
2019-07-06 19:25:44 +09:00
Antonio Niño Díaz
dfdb107105 Merge pull request #370 from jidoc01/fix_bug
Fix comment bug
2019-07-06 11:10:17 +01:00
Antonio Niño Díaz
9f598dfdb7 Merge pull request #359 from dbrotz/fix-lexer-out-of-bounds
Fix out of bounds array access in lexer
2019-07-06 11:09:43 +01:00
jidoc01
38110a833d Fix comment bug
There is a bug in processing the comments in source files. It's
related to #326. And this bug comes out when you comment something
with the character ';', and include the quotation mark without its
pair in it.

The lastest version of rgbds compiler has a step to parse the given
source to convert its line endings to a unified one, and it
processes quotation marks even before it processes the comments.

I edited a little bit of the source, and it works fine now.
2019-07-05 13:48:24 +09:00
dbrotz
484d15dbb2 Handle unprintable characters more gracefully
* Skip UTF-8 byte order mark at beginning of file
* Error on other unexpected unprintable characters
2019-07-04 17:14:55 -07:00
dbrotz
1decf5d0d4 Fix out of bounds array access in lexer
If the type char is signed, then in the function
yylex_GetFloatMaskAndFloatLen(), *s can have a negative value and be converted
to a negative int32_t which is then used as an array index. It should be
converted to uint8_t instead to ensure that the value is in the bounds of the
tFloatingFirstChar, tFloatingSecondChar, and tFloatingChars arrays.
2019-07-04 17:01:29 -07:00
dbrotz
74e9de1b71 Check for RPN stack overflow in linker 2019-07-04 16:49:23 -07:00
dbrotz
015d2b0830 Fix buffer overflow when creating patches with long RPN expressions
The createpatch() function was using a fixed-size buffer. I've changed it
to be dynamically allocated. I saw that the RPN format used in patches is
slightly different from the one used internally in the assembler, so I
added a new member to the Expression struct to track the patch size.

I've also limited the RPN expression length to 1MB. I realized that the
patch RPN expression could potentially be longer than the internal RPN
expression, so the internal expression would need a limit smaller than
UINT32_MAX. I thought 1MB would be a reasonable limit.
2019-07-04 16:49:09 -07:00
dbrotz
b3120aea25 Terminate standalone bracketed symbol strings
Standalone bracketed symbols like the following weren't being zero-terminated.

X EQUS {Y}

This doesn't apply to bracketed symbols that aren't standalone, but are
instead found in a string. For example, the following works even without this
fix.

X EQUS "{Y}"
2019-07-04 16:01:57 -07:00
Antonio Niño Díaz
54e5bf0f0c Merge pull request #343 from phs/phs/docker
Have a docker file
2019-07-04 23:07:16 +01:00
Antonio Niño Díaz
847cae5b95 Merge pull request #329 from NieDzejkob/allow-stdin-input
Allow using - to indicate input from stdin (resolves #305)
2019-07-04 23:02:42 +01:00
Jakub Kądziołka
df15c97b6e Handle zero-byte files gracefully 2019-07-03 16:38:35 +02:00
Jakub Kądziołka
0d97b58265 Avoid potentially implementation-defined behavior when using a pipe as input 2019-07-03 16:38:00 +02:00
Jakub Kądziołka
f7bc61e874 Automatic tests for input from stdin 2019-07-03 16:05:54 +02:00
Jakub Kądziołka
8d5a53f529 Handle non-seekable input correctly 2019-07-03 15:38:14 +02:00
Jakub Kądziołka
20f9492899 Allow using - to indicate input from stdin 2019-07-03 15:38:14 +02:00
Antonio Niño Díaz
3cd1d46a1b Merge pull request #356 from NieDzejkob/add-narg-test
Add a test for the behavior of NARG after SHIFT
2019-06-16 22:35:37 +01:00
Jakub Kądziołka
88eceec257 Add a test for the behavior of NARG after SHIFT 2019-06-09 12:58:32 +02:00
Antonio Niño Díaz
d00ec024a2 Merge pull request #351 from dbrotz/fix-strsub-strlen
Use code points instead of bytes for STRSUB/STRLEN
2019-06-07 10:31:11 +01:00
Antonio Niño Díaz
0bcd53778a Merge pull request #346 from qguv/tilemap-mirrored-duplicates
gfx: Add mirrored tile check when generating tilemap
2019-06-07 10:29:15 +01:00
Antonio Niño Díaz
7592eaf42b Merge pull request #354 from NieDzejkob/test-runner-stuff
Various test running fixes
2019-06-05 23:23:57 +01:00
Antonio Niño Díaz
12ed9e044a Merge pull request #353 from qguv/checkpatch-path-override
Clarify how to override checkpatch.pl path
2019-06-05 23:15:10 +01:00
Jakub Kądziołka
0a3af87aee Ignore the .git folder of the test repositories
Before this change, doing `git add test` would also add
pokecrystal and the other test repos, even though they
didn't show up on `git status`.
2019-06-05 20:54:21 +02:00
Jakub Kądziołka
4dee999f68 Clean the test repositories before running tests 2019-06-05 20:53:32 +02:00
Jakub Kądziołka
9a4941c794 Allow running the tests from outside of the test folder 2019-06-05 20:52:35 +02:00
Quint Guvernator
2d0fd71159 Clarify how to override checkpatch.pl path 2019-06-04 15:22:45 +02:00
Quint Guvernator
327582be31 Regenerate wwwman 2019-06-04 13:23:33 +02:00
Quint Guvernator
21aea281bd gfx: Add mirrored tile check when generating tilemap 2019-06-04 13:22:59 +02:00
dbrotz
975f85260d Use code points instead of bytes for STRSUB/STRLEN 2019-06-02 16:10:34 -07:00
dbrotz
f29d768989 Set all of expr struct's fields in mergetwoexpressions() 2019-05-31 08:59:50 -07:00
Phil Smith
9bd7ecad4c Have a docker file 2019-05-31 08:26:53 -07:00
Antonio Niño Díaz
cc458a9693 Fix a few checkpatch issues 2019-05-31 12:34:14 +01:00
Antonio Niño Díaz
d2bd9a2368 Merge pull request #337 from dbrotz/one-pass
Use only one pass
2019-05-31 12:10:46 +01:00
dbrotz
b909a5063a Include symbol name in 'symbol too long' error message 2019-05-29 10:56:59 -07:00
Marcus Huderle
b2c1f6122e Properly set all 16 characters in ROM header title 2019-05-18 19:43:54 -05:00
Antonio Niño Díaz
a761e98e18 Run checkpatch against origin/master
The develop branch has been deleted. Remove references to it.
2019-05-10 00:16:27 +01:00
dbrotz
e12e7b2acc Don't assign PC to macro symbols
Macros have nothing to do with the current PC, so this doesn't make any sense.
The value isn't ever used either.
2019-05-09 15:01:06 -07:00
dbrotz
f927c41abb Add test for referencing a symbol before setting it 2019-05-09 14:46:11 -07:00
dbrotz
249acace08 Prevent non-reloc symbol from shadowing reloc symbol 2019-05-09 12:48:10 -07:00
Antonio Niño Díaz
fa37922ca7 Remove develop branch from contributing guide
This branch was meant to contain changes that were considered too risky
to be in master. However, there is not enough activity in the repository
to justify its presence. Both branches are always pointing at the same
commit.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
2019-05-09 18:58:25 +01:00
dbrotz
021990b8e0 Properly check if a symbol's full name is too long 2019-05-05 20:21:55 -07:00
dbrotz
540564694c Add missing space to error message 2019-05-05 18:13:10 -07:00
dbrotz
8da4feb83c Use sym_FindSymbol() where possible 2019-05-05 18:10:05 -07:00