Commit Graph

454 Commits

Author SHA1 Message Date
Christophe Staïesse
424702b272 Fix bug: rgbasm segfault when \@ is used outside a macro
The problem occurs when \@ is accessed outside the definition of a
macro and is not between "" or {}, or when it is used in an argument of
a macro call, i.e. when the access is processed by PutUniqueArg().

PutUniqueArg(), puts back the string value of \@ to the lexer's buffer
(to substitute \@ by the unique label string).
When \@ is not defined, sym_FindMacroArg(-1) returns NULL, which
yyunputstr() doesn't expect and crashes.

Solution:
Generate an error when \@ is not defined.

Regression test:

SECTION "HOME", HOME
        ld a,\@

Will segfault.
On the fixed version, it will return an error as \@ is not available.
2014-10-05 13:32:18 +02:00
Christophe Staïesse
191f98a008 Fix incorrect dependencies in Makefile 2014-10-05 11:37:11 +02:00
Anthony J. Bentley
00de7674af Now that install dirs are created, this error is unlikely to occur. v0.1.1 2014-10-03 15:17:49 -06:00
Anthony J. Bentley
32fa032a62 Makefile: Create install directories if they don’t exist. 2014-10-03 15:14:40 -06:00
Anthony J. Bentley
73e44cb803 Fix dependencies for Yacc files. Improve Makefile POSIX compliance.
Parallel building issue pointed out by murphm8 and chastai.
2014-09-26 15:27:52 -06:00
Anthony J. Bentley
3e4350afa4 Don't cast calls to malloc(). 2014-09-26 00:39:29 -06:00
Anthony J. Bentley
0d07caba60 Remove inconsistent version numbering. 2014-09-25 20:56:15 -06:00
Anthony J. Bentley
3992ce2502 Separate errors that shouldn't have been combined in the first place. 2014-09-25 20:40:25 -06:00
Anthony J. Bentley
215d6f0c5b Revert 97d431d1f4ad404e282e3781bd195be3f053734d; it breaks things. 2014-09-24 03:40:50 -06:00
Anthony J. Bentley
f3394f46b4 Fix MinGW target. 2014-09-24 03:17:33 -06:00
Anthony J. Bentley
e3df758897 Update license. 2014-09-24 03:07:43 -06:00
Anthony J. Bentley
d7319ecd00 Remove rgblib.
I have never used it and it's probably been broken for years.
2014-09-24 03:03:42 -06:00
Anthony J. Bentley
d661b3a532 Now that we replace missing libc functions, switch back to err(). 2014-09-24 02:50:39 -06:00
Anthony J. Bentley
c0be5ddbb2 Remove dead stores. 2014-09-24 01:19:05 -06:00
Anthony J. Bentley
97d431d1f4 rgbasm: Avoid unnecessary filename copying. 2014-09-24 00:52:00 -06:00
Anthony J. Bentley
a849e1107e Improve POSIX compliance in the Makefile.
Set .POSIX and don't use the += operator.
2014-09-24 00:38:19 -06:00
Anthony J. Bentley
a41bdff88f Wrap Makefile to 80 characters. 2014-09-24 00:28:14 -06:00
Anthony J. Bentley
cb383e6b1a Unclutter Makefile: use $Q instead of ${Q}. 2014-09-24 00:26:46 -06:00
Anthony J. Bentley
45b6872e2a rgbasm: Fix TOCTOU and reduce buffering. 2014-09-24 00:23:40 -06:00
Anthony J. Bentley
056109652d rgbasm: Don't allocate an unnecessary buffer. 2014-09-23 22:22:39 -06:00
Anthony J. Bentley
284600ef1f rgblink: Don't allocate unnecessary buffer. Delete unused flag. 2014-09-23 22:17:43 -06:00
YamaArashi
2bf31870a7 Cleaned up lexer
- separated the lexer into multiple functions so it is more readable
- fixed issue with long label names in macro arguments
- added error checking code to prevent buffer overflows
v0.1.0
2014-08-22 21:44:18 -07:00
YamaArashi
6198cc185c Remove __LINE__ 2014-08-22 01:52:21 -07:00
YamaArashi
e4571bc0fc Make _NARG work 2014-08-21 19:53:42 -07:00
Anthony J. Bentley
46269240c8 Merge branch 'update-legacy-instructions' of https://github.com/yenatch/rgbds 2014-08-21 11:29:34 -06:00
YamaArashi
b1269ab53a Improve rgbasm performance 2014-08-21 02:57:43 -07:00
Anthony J. Bentley
3ecd169cd6 Revert previous commit. asmy.y is autogenerated from other .y files. 2014-02-21 03:20:44 -07:00
Anthony J. Bentley
2dab1474b8 asmy.y should not be in gitignore. 2014-02-21 00:56:34 -07:00
Anthony J. Bentley
08b1b97a45 Preserve the ability to set pad_value in rgbfix. 2014-02-09 02:58:00 -07:00
Anthony J. Bentley
17192ea6f0 Improve performance when padding: don't write a byte at a time. 2014-02-08 23:26:43 -07:00
stag019
af506985e5 Added license to charmap.c 2014-02-03 20:46:52 -05:00
yenatch
b2d523acde rgbasm: Evaluate BANK() arguments to verify they exist.
Symbols are created when using a label in the wild, even if they aren't defined. Solely using a symbol as an argument to BANK() skips this, so the symbol is never created.

This evaluates the argument instead of trying to find a symbol. This way, symbols that don't exist are created when passed into BANK().
2014-02-01 21:14:56 -05:00
Anthony J. Bentley
0f488b6759 Remove unused alloca() implementation. 2014-01-31 00:01:42 -07:00
stag019
240d2a7f14 Merge https://github.com/bentley/rgbds 2014-01-29 00:18:10 -05:00
yenatch
2ff286223b add instruction "ld hl, sp+nn"
The previous "ld hl, [sp+nn]" is incorrect, but remains for compatibility.
2014-01-14 11:51:18 -05:00
Anthony J. Bentley
af5f889326 Merge https://github.com/yenatch/rgbds 2014-01-12 21:30:39 -07:00
Anthony J. Bentley
3e92f33319 Provide a friendlier error when manpage directories don’t exist. 2014-01-11 18:46:33 -07:00
yenatch
0ffa4ce9ef rgbasm: let rgblink try to import undefined symbols
Manual imports are inconvenient and don't provide any functionality.
2014-01-07 18:14:58 -05:00
stag019
34656f9e5d Fix a bug where the first charmap entry wasn't added correctly. 2013-12-28 00:35:05 -05:00
stag019
c61c112218 Remove GNU-specific <getopt.h>. getopt() is defined in <unistd.h> in POSIX, which adding #define _XOPEN_SOURCE 500 causes GCC to include. 2013-12-23 14:57:06 -05:00
stag019
55974bc743 Only define _MAX_PATH is it isn't already defined. 2013-12-23 14:52:37 -05:00
stag019
94005513a4 Comment out unused variable dest. 2013-12-23 14:50:37 -05:00
stag019
36edec6231 Add out_BinaryFileSlice() definition to output.h. 2013-12-23 14:47:37 -05:00
stag019
7d176245d8 Remove all implicit definitions of compiler provided functions.
<strings.h> cause strncasecmp to be define.
2013-12-23 14:40:53 -05:00
stag019
c65d58c589 Move local includes below system includes. 2013-12-23 14:37:56 -05:00
stag019
1f9fd0f060 This fixes an error with using long label names in macros. If the label name you're using is longer than the string length of the literal macro text, a syntax error would occur. This fix makes sure it at least allocates enough bytes for the largest allowed label name. 2013-12-22 20:56:31 -05:00
stag019
1218da79a9 Character maps. 2013-12-22 20:55:14 -05:00
yenatch
fd4b5c8925 rgbasm: update manpage to include -v 2013-12-03 21:58:39 -05:00
yenatch
bc99ee2210 rgbasm: -v option (verbose) 2013-12-03 00:25:12 -05:00
Anthony J. Bentley
de269987f7 Add "jp hl" as a valid instruction.
"jp [hl]" has been around for decades even though it makes no sense.
This is better.
2013-09-05 20:51:58 -06:00