1
0
mirror of https://github.com/cc65/cc65.git synced 2024-09-16 09:56:13 +00:00
Commit Graph

3086 Commits

Author SHA1 Message Date
acqn
68f53e69f1 Fixed Issues #420 and #919 by always outputing the code segment before the three data segments for functions. 2020-06-01 22:37:40 +02:00
acqn
33e103fdc6 Fixed Issue #1040: non-byte pointer +=/-= byte codegen bug. 2020-06-01 22:37:40 +02:00
Oliver Schmidt
555282497c Removed --lib option from cl65.
The general approach of cl65 when generating the command lines to be executed is to first put options and the put files. However, this doesn't work well with the --lib option which would rather need to be put when libraries in general are put. I opted to not add this special behavior to cl65 as
* the use case for the --lib option is _VERY_ specific
* cl65 is after all a wrapper for ordinary use cases
2020-05-30 21:03:15 +02:00
laubzega
dc4142e1a9 Minor formatting changes after review. 2020-05-29 10:00:33 +02:00
laubzega
083f3ae26b Fix for #928. 2020-05-29 10:00:33 +02:00
Greg King
f8be35b41e Fixed some typos in the "large alignment" support. 2020-05-15 21:09:02 -04:00
Chris Cacciatore
ad1eadd60d Added support for --large-alignment in ld65.
Implemented the same way as in ca65.
2020-05-15 17:54:41 -04:00
greg-king5
4ea2bfef0a Aligned comment. 2020-03-26 23:08:49 -04:00
marko.lauke
3e12840933 +code style 2020-03-26 23:08:49 -04:00
marko.lauke
68ff89ba0a +cc65 inline asm stp mnemonic support 2020-03-26 23:08:49 -04:00
bbbradsmith
e0cb33d9d4 SEGMENT start of 0 should be valid 2020-03-22 21:03:07 +01:00
Greg King
2fc24847ac Fixed an error message printer.
The disassembler can be built and won't crash if it sees duplicate labels, and one of them is an unnamed label.
2020-03-11 18:07:08 -04:00
Greg King
e2c6648607 Fixed a typo in commit 2e5fbe89cd.
Changed a && to ||.
2020-02-21 08:12:05 -05:00
acqn
dc5114b071 Just disable OptPushPop if N/Z is used after the PLA.
This is a more conservative way to fix Issue #971.
2020-02-01 18:04:32 +01:00
acqn
6d530931bf Quick fix for the OptPushPop bug reported in Issue #337. 2020-02-01 18:04:32 +01:00
acqn
9559625ee8 Always insert a LDA after the removed PLA during the optimization in OptPushPop.
Fixed Issue 971.
2020-02-01 18:04:32 +01:00
acqn
5b11eb4bb9 Corrected check in OptTransfers2 for register usage. Fixed Issue 992. 2020-02-01 18:04:32 +01:00
Greg King
90a2edcfa2 Made cc65 detect a possibly missing argument at the end of a function argument list.
(It could be a stray comma at the end of the list.)
2020-01-25 04:14:58 -05:00
Greg King
5109c0b68f Made ca65 give error messages when it sees duplicate .define commands. 2020-01-02 04:26:02 -05:00
Greg King
3fa253d31f Updated the cx16 library to the Commander X16 Kernal's prerelease 35. 2019-12-25 10:56:32 -05:00
Greg King
fb0d09a277 Changed sim65's internal error codes from 9-bit values to 7-bit values.
Some shells truncate process return codes to 8 bits.  And, the eigth bit often is used to show that a signal stopped the process.
2019-12-06 14:47:47 -05:00
bbbradsmith
c9355734f5 make linker generated export warning conistent with the import warning 2019-11-18 21:50:44 +01:00
bbbradsmith
788fbcc9c8 Fix silent crash failure on warning from linker command line define import size mismatch 2019-11-18 21:50:44 +01:00
Greg King
4f24a06f0e Fixed error handling for missing names in ld65 configure files. 2019-10-12 07:59:49 -04:00
Greg King
2e5fbe89cd Made the "none" CPU allow all address sizes. 2019-10-02 10:09:48 -04:00
Greg King
18afc7c703 Created a target and a library for the Commander X16 prototype computer. 2019-09-27 03:38:51 -04:00
Greg King
0896deedef Added a .ORG keyword to ca65 structs/unions.
Allow 24-bit numbers as operands in ca65 structs/unions.
2019-09-11 19:00:08 -04:00
Greg King
a0db846a97 Allowed old-style (K and R) function declarations to be fastcall.
That lets them match old-style definitions.  It avoids "Type conflict" error messages.  It allows shorter function calls.

Fixed the types of some variables in "test/ref/otccex.c".  It avoids crashes on 64-bit Windows (32-bit Windows with 64-bit pointers).
2019-07-22 09:26:23 -04:00
Lauri Kasanen
925ea9d544 cc65: Add support for binary literals
Binary literals, 0b001, are a GCC extension in C and a C++14 feature.
2019-07-20 17:21:42 +02:00
Björn Esser
2f3955dbc7 src/Makefile: Simplify BUILD_ID logic. 2019-07-15 12:42:48 +02:00
Greg King
28584b31f1 Made the ld65 configure file's segment offset attribute accept zero as a value.
Expressions are allowed as values.  Therefore, zero might be set explicitly by some conditions.
2019-06-30 22:44:10 -04:00
Björn Esser
83e0c70de5 Replace GIT_SHA with a more versatile BUILD_ID definition.
When compiling cc65, it will by default place the git hash (if available) of
the checked out commit in the version string.  This isn't useful when building
a package for a Linux distribution, since there either won't be an upstream
git hash if there is one at all.

Thus we replace GIT_SHA with a more versatile BUILD_ID, which can be defined
to any arbitrary string.  When building, its contents will be appended to the
version string instead of the git hash.

If BUILD_ID is not defined by the user the behaviour will be exactly the same
as before.  That means BUILD_ID gets automatically defined to Git <GIT_SHA>,
if it can be determined from a checkout.
2019-06-09 20:17:15 +02:00
bbbradsmith
5269552346 sim65 common define for paravirt hooks base location
allows the loaded binary to take up as much space as possible
restored some documentation of the hooks but without reference to specific location
2019-05-31 10:40:04 +02:00
Oliver Schmidt
6efb71bea7 Rearranged paravirt function vector.
- exit right below 6502 vectors.
- keep exit addr stable as it may be called from asm.
2019-05-30 00:10:17 +02:00
bbbradsmith
7e4c4ee53e sim65/main.c spaces were requested 2019-05-29 22:56:51 +02:00
bbbradsmith
fb7d4acd5c versionable header for sim65
load and run address now configured from header
fix error codes not to conflict with test
fix test/misc/endless.c which is supposed to fail if an endless loop does not occur
2019-05-29 22:56:51 +02:00
bbbradsmith
07ca772932 adjust literal width to match variable type 2019-05-29 22:56:51 +02:00
bbbradsmith
2f3cae0d2e movable sp for sim65 2019-05-29 22:56:51 +02:00
bbbradsmith
4642421da4 are more specific version of the comparison removal #895 2019-05-27 10:03:25 +02:00
bbbradsmith
3a3107b244 Disabling too-aggressive optimization in OptCmp8
Generates incorrect code for some 16-bit cases. See: #895
2019-05-27 10:03:25 +02:00
Richard Halkyard
448aa35f50 Fix realloc() bug in gr65
The pointer to the input buffer was not being updated after a call to
realloc(), causing the program to crash if realloc() moved the buffer.
2019-05-22 11:33:43 +02:00
Greg King
644d623d31 Reset the name of the "current bss segment" before writing bss variables into the output Assembly file.
Then, cc65 can notice a single "#pragma bss-name()" at the beginning of the variables list.
2019-05-18 12:16:52 -04:00
bbbradsmith
9299e550a5 fix NearAddr case in comment 2019-05-11 12:32:44 +02:00
bbbradsmith
7d14cff6bb o65.c: missed a link time resolution of EXPR_NEARADDR 2019-05-11 12:32:44 +02:00
bbbradsmith
10cefdb456 move EXPR_NEARADDR to end of enum list to avoid invalidation of existing object binaries? 2019-05-11 12:32:44 +02:00
bbbradsmith
ac2ecb0b2c 65816 now generate EXPR_NEARADDR instead of EXPR_WORD0 for default assumed address mode, which will be validated by the linker's range check rather than blindly truncated. Assuming the assembler correctly validated this, the linker is allowed to truncate. 2019-05-11 12:32:44 +02:00
Christian Groessler
dd53c2ddc3 src/ld65/main.c: fix copy'n'paste error in comment 2019-05-01 10:57:48 +02:00
Christian Groessler
5a05acf936 ld65: implement '--allow-multiple-definition' command line parameter 2019-05-01 10:57:48 +02:00
Christian Groessler
c248c14075 src/ld65/exports.c: Issue an error instead of a warning for duplicate global symbols. 2019-05-01 10:57:48 +02:00
Brad Smith
1a5fa6dc51 goto.c warning fix for implicit truncation 2019-05-01 10:53:41 +02:00
IrgendwerA8
37f80534c9 Fix for #830 supplied by UvB 2019-04-25 15:19:53 +02:00
Greg King
214c90f957 Made the code that logs indirect-goto referals be a little more efficient. 2019-04-23 19:12:02 -04:00
Lauri Kasanen
f328481a48 Replace hard returns with an "else", add an error for non-IDENT tokens, and test for static 2019-04-21 12:46:03 -04:00
Lauri Kasanen
60d8559372 Return after errors, move left bracket consumption down 2019-04-21 12:46:03 -04:00
Lauri Kasanen
654d972288 C90 param, void 2019-04-21 12:46:03 -04:00
Lauri Kasanen
a9cbb5305c Fix missing spaces 2019-04-21 12:46:03 -04:00
Lauri Kasanen
304473d857 Adjustment for '816 2019-04-21 12:46:03 -04:00
Lauri Kasanen
3b3b16ee9c Add support for computed gotos
This is a GCC extension that allows C to use fast jump tables.
2019-04-21 12:46:03 -04:00
Lauri Kasanen
c2220f3c30 Add a goto indirect jump from pointer 2019-04-21 12:46:03 -04:00
Lauri Kasanen
37f00e6644 Export the label symbol table 2019-04-21 12:46:03 -04:00
Lauri Kasanen
2af76c7cff Only for jumps, the lib uses named asm labels in branches 2019-04-21 12:46:03 -04:00
Lauri Kasanen
c3d809b129 Fix jmp-callax.c bug 2019-04-21 12:46:03 -04:00
IrgendwerA8
dcbe03f23b Adjusted to the current multiline-comment style. 2019-04-02 16:34:22 +02:00
IrgendwerA8
1530020a1f Fix for multiplication optimization issue #367 2019-04-02 16:34:22 +02:00
Steven Hugg
ae261e91f2 Code cleanup per code review 2019-03-31 22:33:22 -04:00
Steven Hugg
9faaa0689b cleaned up code per review 2019-03-31 22:33:22 -04:00
Steven Hugg
a71f764c33 fixed optimization bug where array index is 16-bit, e.g. arr16[i & 0x7f7f] 2019-03-31 22:33:22 -04:00
Steven Hugg
dca99d59e5 rearranged order of new optimizations to better handle -Oi flag 2019-03-31 22:33:22 -04:00
Steven Hugg
5d274e4bc5 added optimization for indexed 16-bit array load of form (array[i & 0x7f]) 2019-03-31 22:33:22 -04:00
Steven Hugg
ffc118cd94 added optimization for indexed pointer load of a constant, e.g.: y = ((unsigned char*)0x100)[i] 2019-03-31 22:33:22 -04:00
Olli Savia
f95481fabf Fixed gcc compiler warning (#867)
* Changed spelling FALLTHRU -> FALLTHROUGH
2019-03-30 16:09:16 -04:00
Daniel Serpell
61463e1a70 Don't write INITAD if the memory area is empty. 2019-02-21 19:00:17 -03:00
Daniel Serpell
b03ae76b54 Add support for INITAD to the Atari binary format. 2019-02-21 19:00:03 -03:00
Stefan
08ec9fc392 Fixed 65C02 timing again. 2019-02-12 11:15:47 -05:00
Stefan
50fd96bbab
Fixed 65C02 timing. 2019-02-07 12:19:49 +01:00
Christian Groessler
58484449b4 remove TABs 2019-02-05 23:27:52 +01:00
Daniel Serpell
2aa5b4cafe Rewrites ATARI EXE segment writing to optimally write segment sizes.
We now expand segments as needed to write a minimal set of headers.
2019-02-03 18:13:35 -03:00
Daniel Serpell
4e51fcbdd4 Don't support overwrite segments.
This simplifies the memory area size calculations.
2019-02-03 18:11:53 -03:00
Daniel Serpell
63d9b492b7 Only write full ATARI XEX header in the first chunk. 2019-02-03 18:09:51 -03:00
Daniel Serpell
8e3fe2ef86 Remove unused function. 2019-02-03 18:05:15 -03:00
Daniel Serpell
0e947d594f Add support for Atari XEX file format to LD65 2019-02-03 18:04:46 -03:00
Oliver Schmidt
cd72f816d3
Merge pull request #829 from inexorabletash/string-escapes
ca65: Add string_escapes feature. Resolves #535
2019-01-20 21:58:06 +01:00
Greg King
a6b04f6e97 Changed most "backticks" (grave accents) into apostrophes.
Quotations that are embraced by tick marks now look better, in most fonts.
2019-01-05 14:57:12 -05:00
Joshua Bell
c8bf652982 ca65: Add string_escapes feature. Resolves #535 2019-01-05 11:29:54 -08:00
Greg King
5ac11b5e88 Added an error message, in case there's a typo in the definitions of long command-line options. 2019-01-04 03:35:49 -05:00
Greg King
cd6e167982 Fixed a duplicate-label test.
Don't call strcmp() if either argument is NULL.
2019-01-04 02:29:17 -05:00
Oliver Schmidt
01857cd4de Updated Visual Studio solution files to VS 2017. 2018-11-24 14:10:58 +01:00
Greg King
554448a1f1 .byt "" emits no data; avoid a ca65 crash.
Fixes #775 on GitHub.
2018-10-20 13:41:52 -04:00
Evgeny Vrublevsky
f73aa2af71 '--no-std-lib' was renamed to '--no-target-lib' 2018-10-19 10:57:10 +02:00
Evgeny Vrublevsky
d4088f9eee Don't output a warning about alignment when section address is defined by START or OFFSET and fits required alignment requirements 2018-10-18 15:37:14 +02:00
Oliver Schmidt
96196f00e9 Adjusted library name. 2018-10-18 13:22:26 +02:00
Evgeny Vrublevsky
8084702a58 Renamed to '--no-std-lib' 2018-10-18 13:08:56 +02:00
Evgeny Vrublevsky
23b5cc870e Renamed to '--no-crt-lib' 2018-10-18 13:08:56 +02:00
Evgeny Vrublevsky
2a9bb0d8de CL65: --no-rtl option for disabling default runtime library 2018-10-18 13:08:56 +02:00
laubzega
5fa79be997 Post-review tweaks. 2018-10-16 09:55:02 +02:00
laubzega
7d9485f6bc Typo 2018-10-16 09:55:02 +02:00
laubzega
cf7f3abadd Even more optimization, cleanup, bugfix, comments. 2018-10-16 09:55:02 +02:00
laubzega
d3665b263e Stack adjustment code optimizations. 2018-10-16 09:55:02 +02:00
laubzega
249248ccc8 Formatting tweaks. 2018-10-16 09:45:30 +02:00
laubzega
8eb9f4a8aa Fix for issue #735 2018-10-16 09:45:30 +02:00
Greg King
03e43d1fbf Changed a comment and an error message into more specific text. 2018-10-08 20:39:46 -04:00
laubzega
92defb7a2b Fix crash due to mistaken symbol identity. 2018-10-08 16:27:00 +02:00
Egor
0149de4da7 da65: properly scan empty strings
Previously, doing something like `LABEL { NAME ""; ADDR $1000; };` would
result in $1000 being labeled as NAME: instead of being unnamed.
2018-10-06 21:55:42 +03:00
Greg King
f11ae87ada Always put goto stack-adjustments in the RODATA segment. 2018-10-02 23:19:38 -04:00
Oliver Schmidt
88d1d20cd0
Minor style adjustment. 2018-10-02 18:53:01 +02:00
laubzega
02a914625b Formatting fixes. 2018-10-02 18:49:53 +02:00
laubzega
2ec21c5b7f Fix non-goto jumps (i.e. inline assembly). 2018-10-02 18:49:53 +02:00
laubzega
8845e71161 Another warning. 2018-10-02 18:49:53 +02:00
laubzega
6ad79067ac Fix a warning. 2018-10-02 18:49:53 +02:00
laubzega
c797b3b376 Proper warnings for "risky" gotos. 2018-10-02 18:49:53 +02:00
laubzega
c835f49913 Clean-up 2018-10-02 18:49:53 +02:00
laubzega
2ac2ffcd43 Adjust SP on gotos between blocks with local variables. 2018-10-02 18:49:53 +02:00
laubzega
a48bbc4be0 Switched from warning to error. Tightened the testcase. 2018-10-02 18:49:53 +02:00
Laubzega
a4b6bb63c0 Minor changes after review. 2018-10-02 18:49:53 +02:00
Laubzega
f5b3c5351e Fix for variableless main(). 2018-10-02 18:49:53 +02:00
Laubzega
581c46c213 Add checks for risky goto statements. 2018-10-02 18:49:53 +02:00
Laubzega
d293d766ef New segment type renamed to "overwrite". 2018-09-08 19:18:41 -07:00
Laubzega
c7bb27bac9 Rename more stuff from "overlay" to "replace". 2018-09-06 00:18:39 -07:00
Laubzega
cd9efd53fe Segment OVERLAY renamed to REPLACE. Bugfix for read-only segments. Formatting. 2018-09-04 00:34:28 -07:00
Laubzega
1b0e2cf783 Fix for multiple overlay segments. 2018-08-25 20:21:12 -07:00
Laubzega
8b584cb89f Add segment type "overlay". 2018-08-25 10:18:23 -07:00
Greg King
31461aaf02 Made cc65's "Illegal escaped character" diagnostic show which code was escaped. 2018-08-21 08:58:21 -04:00
Greg King
a76dcdc419 Removed the compiler's recovery code for illegal escaped characters.
It caused the error cascade that it was supposed to prevent.
2018-08-20 17:51:22 -04:00
Stefan
b93b88211c WDM support (#721)
WDM support
2018-08-19 10:29:25 -04:00
Oliver Schmidt
3598fb505d Fixed Visual C++ build (and some style adjustments). 2018-08-19 00:01:40 +02:00
Patrick Pelletier
e549e23a87 Use non-POSIX values for S_IREAD and S_IWRITE.
(As requested in the PR.)
2018-08-17 23:28:45 +02:00
Patrick Pelletier
f72d355b18 sim65: Use mode_t for OMode. 2018-08-17 23:28:45 +02:00
Patrick Pelletier
b30f790587 sim65: Blindly guessing to get Travis build to pass. 2018-08-17 23:28:45 +02:00
Patrick Pelletier
a7d158e077 sim65: Build was failing on Windows, too.
Microsoft loves putting underscores in front of everything!
2018-08-17 23:28:45 +02:00
Patrick Pelletier
12fbdbf418 sim65: S_IREAD and S_IWRITE are nonstandard.
The Linux build was failing with:

sim65/paravirt.c: In function ‘PVOpen’:
sim65/paravirt.c:217:18: error: ‘S_IREAD’ undeclared (first use in this function)
         OMode |= S_IREAD;
                  ^
sim65/paravirt.c:217:18: note: each undeclared identifier is reported only once for each function it appears in
sim65/paravirt.c:220:18: error: ‘S_IWRITE’ undeclared (first use in this function)
         OMode |= S_IWRITE;
                  ^
make[1]: *** [../wrk/sim65/paravirt.o] Error 1
2018-08-17 23:28:45 +02:00
Patrick Pelletier
974188796c sim65: If mode argument is omitted, use a reasonable default. 2018-08-17 23:28:45 +02:00
Patrick Pelletier
aba320eade Allow "mode" argument to open() to be passed from 6502 code.
Implements this suggestion:
https://github.com/cc65/cc65/pull/719#issuecomment-413809096
2018-08-17 23:28:45 +02:00
Patrick Pelletier
d602572bbe Fix permissions for files created by sim65.
Files created by my programs running under sim65 had really weird permissions:
--w-r--r-x  1 ppelleti  staff  19 Aug 16 23:22 json.test.print.tmp

So, for example, my program running under sim65 was not able to read
the file it had just written.

This is because the third argument to open (mode) was not being
specified in paravirt.c, so it was just picking up random crud off the
stack to use as the mode.

I added a mode of 0666, and now my program runs correctly.
2018-08-17 23:28:45 +02:00
Greg King
d13d068e71 Fixed the generation of the opcode byte when BRK is given an operand, in 65816 CPU mode.
The bug was created by commit 7e8bb7b700.
2018-08-16 23:51:04 -04:00
Patrick Pelletier
5cdaa96e4c sim65: Fix "$2C: BIT abs" to access the correct address.
Bug is documented here:
http://forum.6502.org/viewtopic.php?f=2&t=5242
2018-08-10 12:58:48 -07:00
Greg King
ad6c2dbe7b Added code to make the 65816's MVN and MVP instructions handle both immediate (bank) and far-address operands. 2018-07-29 03:50:02 -04:00
Greg King
eeb1b927ce Fixed the order in which the 65816's block-move instructions' operands are written and assembled.
The source bank number is written first; but, assembled second.
The destination bank is written second; but, assembled first.
2018-07-05 10:58:59 -04:00
AIDA Shinra
31fdec2e2e Style fix 2018-06-25 23:50:46 +09:00
AIDA Shinra
fd67284b4d Followed the discussions in the Pull request #682.
* Fixed a misspelling
* Fixed styles
* Added sample codes
2018-06-14 02:02:16 +09:00
AIDA Shinra
2b25329423 Support for preprocessing info file via cpp or m4. 2018-06-14 02:02:16 +09:00
AIDA Shinra
75c4972021 Style and alignment fixes. 2018-06-13 21:24:34 +09:00
AIDA Shinra
03bb2f6a48 Followed discussions in the Pull reequest #681.
In particular, renamed "virtual operands" to "inline parameters".
2018-06-12 00:18:11 +09:00
AIDA Shinra
9283e9ca98 Support for "virtual operands" of subroutines like this:
jsr	SomeProc
.byte	$00, $01 ; argument to SomeProc
; return here from SomeProc
bit	$3F
2018-06-10 18:09:11 +09:00
Oliver Schmidt
b74ab9de89 Allow spaces in path names.
The Microsoft C Library needs to have spawnvp() parameters with spaces quoted manually. We do this only if actually necessary to limit issues with parameters already containing double quotes.
2018-06-08 19:16:18 +02:00
Oliver Schmidt
d861be8ad5 Escape spaces in target path.
cc65 escapes spaces in paths it writes to dependency files (see WriteEscaped() in cc65/input.c). Given that the output of OptPrintTargetPath() is supposed to be used in Makefiles in pretty much the same way it is appropriate to escape spaces here too.
2018-06-07 17:10:33 +02:00
Oliver Schmidt
aea34c5410
Merge pull request #673 from bengdahl/master
Fix `make` failing in parent directories containing spaces
2018-06-07 17:01:42 +02:00
Oliver Schmidt
e99a5ff1fe
Fixed usage indentation. 2018-06-06 18:59:25 +02:00
existensialMemory
4fd17161eb
Update Makefile 2018-06-04 22:17:25 -04:00
Ben
1f245fbc0b Fix make failing in parent directories containing spaces 2018-06-04 21:27:04 -04:00
Greg King
362b6afacf Made a C union declaration know the sizes of anonymous struct/union members when it determines its size.
The bug was located, and the fix was written, by Francesco.
2018-05-13 18:54:45 -04:00