Kugel Fuhr
f43cfd1ad0
Fix the check for CPU flags being used after an instruction that gets removed.
...
Previously only the next instruction was checked for usage of the CPU flags
but this fails for certain code.
2024-09-13 19:30:38 +02:00
Kugel Fuhr
6e18e0880a
Added/improved the optimizations:
...
* Added a new pass that optimizes PHA/PLA sequences
* Added a new pass that optimizes AND/EOR/ORA when an operand is known
* Added a run of an existing pass at later stages to remove code that
otherwise goes unchanged.
* Handle binary operations in OptUnusedLoads in addition to real loads.
2024-09-13 19:30:38 +02:00
Bob Andrews
7260c10062
Merge pull request #2518 from kugelfuhr/kugelfuhr/fix-2515
...
Fix minor preprocessor problems
2024-09-13 17:53:20 +02:00
Bob Andrews
b5135b3ae0
Merge pull request #2502 from kugelfuhr/kugelfuhr/fix-2461
...
Fix issue #2461
2024-09-13 15:53:49 +02:00
Kugel Fuhr
70ca6d4200
Fixed a standard noncompliance: In C99 and above there must be whitespace
...
between a name of an object like macro and its replacement list.
2024-09-11 19:21:19 +02:00
Kugel Fuhr
2f6f5f0da1
Fix problem with #line when there is no whitespace between line number and
...
filename.
y
2024-09-11 19:20:01 +02:00
Bob Andrews
38038fd0d3
Merge pull request #2512 from kugelfuhr/kugelfuhr/fix-2134
...
Warn for braces around a pointer initializer
2024-09-08 16:05:58 +02:00
Kugel Fuhr
3c5269dede
Warn for braces around a pointer initializer.
2024-09-08 09:11:47 +02:00
Bob Andrews
4e2a3bde92
Merge pull request #2499 from kugelfuhr/kugelfuhr/disable-recursive-calls-to-main
...
Disallow recursive calls to main() in cc65 mode
2024-09-07 14:39:28 +02:00
Kugel Fuhr
d996e20c5f
Fix issues #2461 . This was always wrong even in cases where it seemed to work.
...
If it did, it was by coincidence.
2024-09-03 20:21:48 +02:00
Kugel Fuhr
cd4357057f
The change from #2495 didn't take into account that recursive calls to main()
...
are legal in C. With the changes from #2495 , such calls will usually crash the
machine. But recursive calls to main() are rare and on the 6502 every byte
saved is precious. So this change limits the effect of #2495 to cc65 mode and
at the same time disallows recursive calls to main() in this mode. If
recursive calls to main() are actually required, the code must be compiled in
c89 or c99 mode.
2024-09-02 10:39:42 +02:00
Kugel Fuhr
e2014611ef
Improve the usage output for the '-W' option.
2024-09-02 07:02:41 +02:00
Bob Andrews
5e5dd1d6c4
Merge pull request #2498 from kugelfuhr/kugelfuhr/fix-include-in-macros
...
Fix .include within .macro/.repeat
2024-09-01 23:26:33 +02:00
Bob Andrews
2680bc8dec
Merge pull request #2495 from kugelfuhr/kugelfuhr/dont-save-stuff-in-main
...
Generate shorter code for main() in some cases
2024-09-01 22:54:45 +02:00
Kugel Fuhr
b2aceaea24
Fix behavior of .INCLUDE within a macro or .REPEAT. In the original code
...
.INCLUDE was executed after expansion of the macro or .REPEAT - which was
wrong and caused all sorts of unexpected behavior. Related issues/PRs
are #231 , #1473 , #2159 and maybe others.
Note: After this change error messages for nested macro/.include statements
may be wrong. This is an unrelated bug that was always there and got exposed
by this fix. The bug needs to be addressed in a separate PR.
2024-09-01 19:58:07 +02:00
Bob Andrews
7a578be724
Merge pull request #2491 from kugelfuhr/kugelfuhr/fix-2431
...
Fix issue #2431
2024-09-01 19:35:32 +02:00
Bob Andrews
a712fbb8f9
Merge pull request #2493 from kugelfuhr/kugelfuhr/fix-1663
...
Fix issue #1663 .
2024-09-01 18:07:14 +02:00
Bob Andrews
601deab3a2
Merge pull request #2492 from kugelfuhr/kugelfuhr/alternative-pragma-names
...
Allow alternative names for pragmas that contain underlines instead of dashes
2024-09-01 17:57:38 +02:00
Bob Andrews
4b38974918
Merge pull request #2496 from kugelfuhr/kugelfuhr/fix-2458
...
Fix macro preprocessing for #include
2024-09-01 17:54:36 +02:00
Kugel Fuhr
b4aef6eac4
Fix macro preprocessing for #include. Arguments enclosed in "" or <> must not
...
be preprocessed. See ISO/IEC 9899 1990 (E) section 6.8.2.
2024-09-01 13:16:35 +02:00
Kugel Fuhr
b5cc68d6e2
Do not save any register variables when entering main(). Do not restore the C
...
stack when leaving main(). Both are unnecessary and just bloat the executable.
2024-09-01 12:41:25 +02:00
Kugel Fuhr
4b68d19993
Fix issue #1663 .
2024-09-01 10:42:18 +02:00
Kugel Fuhr
35c3fe5d0a
Fix issue #2044 . While doing so, cleanup copy&pasted code.
2024-09-01 10:29:59 +02:00
Kugel Fuhr
ef17250c64
Fixed a compiler warning.
2024-09-01 10:26:45 +02:00
Kugel Fuhr
ba263d13a7
Allow alternative #pragma names using underscores.
2024-09-01 10:22:57 +02:00
Kugel Fuhr
58b1c21996
Removed #pragma names that have been obsolete for over a decade.
2024-09-01 10:22:40 +02:00
Evgeny Vrublevsky
c500cb9086
Add support of unnamed labels with @ (.localchar) prefix.
2024-04-07 13:34:48 +03:00
Bob Andrews
25967e65b5
Merge pull request #2424 from acqn/Cleanup
...
[cc65] Cleanups in src/cc65/declare.c
2024-03-10 02:39:14 +01:00
Bob Andrews
a372ead4de
Merge pull request #2334 from carlo-bramini/fix-sim65-1
...
[SIM65] Support undocumented opcodes for 6502
2024-03-10 00:37:18 +01:00
Bob Andrews
081d18f7d7
Merge pull request #2422 from acqn/SubFix
...
[cc65] Fixed potential errors with subtraction evaluation of identifiers at different memory locations
2024-03-09 13:02:27 +01:00
acqn
731f349b24
Removed ParamTypeCvt().
2024-02-29 18:24:22 +08:00
acqn
98767741ce
Reorganized stuff in src/cc65/declare.c.
2024-02-29 18:24:22 +08:00
acqn
9b2d27d1e1
Fixed the error recovery integer type used for bit-fields.
2024-02-29 18:23:04 +08:00
acqn
23aa562094
Fixed potential errors with subtraction evaluation of identifiers at different memory locations.
2024-02-24 15:34:38 +08:00
Stefan
ab0eb4fe58
oops
2024-02-15 09:03:46 +01:00
Stefan
8d4946b3f4
Fixed segv
...
touch /tmp/xx
grc65 /tmp/xx
2024-02-15 07:52:42 +01:00
Carlo Bramini
b04d79b1da
[SIM65] Support undocumented opcodes for 6502
...
This PR is mostly a complete rewrite of the emulator for 6502/65c02 opcodes.
It provides an easier to maintain implementation of the instructions, by using few macros rather than having hand-written code for each function.
All undocumented, previously missing opcodes for 6502 are also implemented.
The patch also includes a detailed documentation of those opcodes, for reference to developers.
This PR should fix one of the milestones listed here for the next version of CC65:
https://github.com/cc65/wiki/wiki/Before-the-next-release
2024-02-08 12:13:17 +01:00
Bob Andrews
eb503cc542
Merge pull request #2390 from colinleroy/implement-shifts-by-7
...
Implement aslax7/shlax7/asrax7/shrax7
2024-02-02 20:17:48 +01:00
acqn
96d55e3703
Fixed optimization for char-size bitwise XOR/OR/AND when the rhs operand is complicated.
2024-02-02 19:00:33 +08:00
Colin Leroy-Mira
7d7cf2d1e0
Implement aslax7/shlax7/asrax7/shrax7
2024-01-29 07:59:11 +01:00
Colin Leroy-Mira
0dd7b0c3a5
Implement __sysremove for sim65
...
This will allow using unlink()/remove() in sim65 programs
Use it to unlink fgets' test output file
2024-01-28 13:58:57 +01:00
Bob Andrews
6c7106c9d9
Merge pull request #2377 from acqn/Diagnostics
...
[cc65] Diagnosis improvements
2024-01-23 22:16:35 +01:00
Bob Andrews
ea83b9fa53
Merge pull request #2347 from acqn/SrcFile
...
[cc65] fixes and enhancements for source file info in diagnosis and debug output
2024-01-23 22:15:31 +01:00
acqn
ba75a2ac26
Added missing checks for forward declarations of the main() function.
...
More accurate diagnosis on implicit 'int' type specifiers.
2024-01-23 14:33:05 +08:00
Bob Andrews
bea2e86210
Merge pull request #2354 from acqn/Diagnostics
...
[cc65] Improved diagnosis
2024-01-22 19:09:51 +01:00
Bob Andrews
998dfd6fa7
Merge pull request #2370 from acqn/VisibilityFix
...
[cc65] Fixed visibility of undeclared functions and objects
2024-01-22 18:31:47 +01:00
acqn
e9bd9330c0
Added warning on some code patterns of faulty attempt to declare anonymous structs/unions.
...
Removed unnecessary warning on tagless enum/struct/unions that would be invisible out of a function declaration.
2024-01-15 23:56:42 +08:00
acqn
07e349c517
Skipped anonymous tag names in diagnosis on empty structs/unions.
2024-01-15 23:56:39 +08:00
acqn
afdf398a0b
Fixed repeated diagnosis when reading EOF in certain cases.
2024-01-15 23:56:11 +08:00
acqn
de3087a7e9
Removed the extra "unused parameter" warning when the parameter had an duplicated identifier error.
2024-01-14 00:19:11 +08:00