804 Commits
Author SHA1 Message Date
Bob Andrews 5725066bfb Merge pull request #3018 from avolkov76/fix-3010
Fix incorrect `signed char` promotion in `parseadd()`
2026-10-24 15:48:35 +02:00
Bob Andrews 9df752e3bc Merge pull request #3019 from joliverosh/ca65-bitbranch-star
ca65: Fix '*' in operands of bit branch, block transfer and LDM
2026-10-24 15:19:02 +02:00
Alex Volkov c629423f91 Fix a rare bug in BIT #imm instruction on 65C02 variants. The bug manifests as an extra operand byte after switching CPUs from 65816 in .a16 mode to 65C02 family. It was caused by incorrect AddrMode masks in 65C02 variant tables. 2026-10-22 22:00:03 -04:00
José Luis Oliveros HernándezandClaude Opus 5.5 8aa120967a ca65: Fix '*' in operands of bit branch, block transfer and LDM
PutBitBranch, PutBitBranch_m740, PutBlockTransfer and PutLDM_m740 emitted
the opcode (and the zero page byte) before reading the remaining operands.
Since '*' is evaluated while the operand is read, it pointed one or two
bytes into the instruction instead of at its start:

    bbr0 $12,*          ; was 0F 12 FF, now 0F 12 FD (loops on itself)
    tii  *,$2000,1      ; source address was off by one
    ldm  $12,#<*        ; immediate was off by two

The usual "wait for a port bit" idiom `bbr0 port,*` therefore jumped into
the middle of the next instruction. Branches to labels were not affected.

Now all operands are read first and emitted afterwards, as for every other
instruction.

In addition, the m740 accumulator form `bbs/bbc i,a,rel` is a 2 byte
instruction, but its offset was computed relative to the end of a 3 byte
one, so it was off by one even with labels. da65 had the matching error
(PC+3 instead of PC+2) in OH_AccumulatorBitBranch, which is why the
round trip test did not catch it. Both are fixed.

Reference binaries that encoded the old offsets are regenerated: the only
differences are the 16 bit branch offsets in each file. The 65C02 da65
test used `bbrN $12,*+2` meaning "next instruction"; with correct '*'
that is `*+3`.

New test: test/asm/listing/313-bitbranch-star.s, with hand-computed bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 04:41:05 +00:00
Alex Volkov 4ceb10ef98 Tests for issue #3010: missing sign extension in 'const int + signed char' code generaiton. 2026-10-18 19:38:41 -04:00
Alex Volkov f962339580 Extra tests for load/store through pointer, OptPtrLoadX/OptPtrStoreX optimizer steps. 2026-10-18 14:02:09 -04:00
Alex Volkov 4f04250675 Tests for OptShiftX optimizer steps; incomplete set. 2026-10-14 18:50:11 -04:00
Alex Volkov 03725ef47b Test for bug #3000; LDX #$FF instructions get erroneously removed by the optimizer around shrax runtimes. 2026-10-06 19:10:50 -04:00
Bob Andrews e11fb5c393 Merge pull request #2975 from codemeow/feature-merge-scope
ca65: Add --merge-scopes
2026-08-20 17:54:30 +02:00
Bob Andrews c96204101f Merge pull request #2972 from tlgkccampbell/fix-octal-string-escape
Fix parsing of octal values in escaped strings
2026-08-20 15:49:30 +02:00
codemeow e0dfb5ab85 Windows build fix and sgml update 2026-07-29 19:47:32 +06:00
codemeow 5431997528 Added .feature merge_scopes flag 2026-07-29 19:00:35 +06:00
codemeow 5835c0f38b New --merge-scopes allowing to merge same level scopes in the current context 2026-07-29 17:54:46 +06:00
Cole Campbell 4b49d76f3b Fix parsing of octal values in escaped strings 2026-07-18 13:31:34 -04:00
Cole Campbell f3dc8a511b Assert value returned by PC division 2026-07-18 08:49:11 -04:00
Cole Campbell 89aee58b26 Fix scanning of /* when CComments is disabled 2026-07-17 19:39:16 -04:00
Alex Volkov 69c17a502b Additional synthetic, extreme register load reuse tests future-proofing issues #2942 and #2947. 2026-04-01 18:27:28 -04:00
Alex Volkov 6027487c30 Expand bug2461 tests to other operators and Lhs/Rhs conditions 2026-03-26 18:22:39 -04:00
Alex Volkov 40a20ab973 Expand bug1374 tests to a few other conditions 2026-03-25 19:03:00 -04:00
Alex Volkov 7988d9aefb Regression tests for #2947 expanded to other operators and conditions 2026-03-22 18:44:16 -04:00
Alex Volkov 9732bc2cb7 Correct some printed messages and remove one print in bug2395 test (c&p errors) 2026-03-22 18:42:01 -04:00
Alex Volkov 9c5916866b Prevent stdout/stderr redirect races in the testbench 2026-03-22 14:24:02 -04:00
Alex Volkov d036c4aaae Minimal test for issue #2947 2026-03-20 19:51:55 -04:00
Alex Volkov f464b50495 Minimal test for issue #2946 2026-03-20 19:51:37 -04:00
Alex Volkov 2fd9411f7f Expand bug2395 tests to other operators and conditions 2026-03-20 19:51:04 -04:00
Alex Volkov 76d71aec92 Compare operator test suite: forward and reverse compares; edge and corner cases; literals, autos, statics, simple expressions; signed and unsigned; some special cases. 2026-03-09 20:04:59 -04:00
Kugel Fuhr 3d26a7e1fe Correct test name and test comment. 2026-03-05 18:44:33 +01:00
Kugel Fuhr 380c3f810e Fix an invalid transformation by the optimizer. Introduced by #2811. 2026-03-05 18:40:52 +01:00
Bob Andrews 0fca83500b Merge pull request #2927 from kugelfuhr/kugelfuhr/fix-2926
Fix cc65 not detecting invalid integer and float literal suffixes
2026-02-11 19:54:44 +01:00
Kugel Fuhr 2f62b263f3 Added a test. 2026-02-06 16:36:44 +01:00
Willis Blackburn 789416798f Add terminating NUL after __func__ string literal #2920 2026-01-24 12:32:31 -05:00
Kugel Fuhr 1924e4cc63 Added a test for #2859. 2025-11-18 14:38:10 +01:00
Colin Leroy-Mira f3e43cc5c5 Add a 9% faster ZX02 decompressor 2025-10-26 18:53:26 +01:00
Joshua Bell ce20b6aa48 Explain the expected failures in 311 2025-08-22 09:57:45 -07:00
Joshua Bell 873361ba83 Show used values in listing 2025-08-22 09:49:04 -07:00
Joshua Bell f18de5bc73 Remove accidentally included file 2025-08-22 09:37:23 -07:00
Joshua Bell 939276669f Tests for scopes and issue #479 / PR #1358 2025-08-21 10:07:54 -07:00
Kugel Fuhr 228671b7c4 Added another test. 2025-07-26 10:17:32 +02:00
Kugel Fuhr 8f4a4040d6 Complete unreachable checking for switch statements. 2025-07-26 09:03:27 +02:00
Kugel Fuhr 70c1bd5e3c Improved flow analysis in general and especially for "for" loops. Added more
tests.
2025-07-26 09:03:04 +02:00
Bob Andrews 0a4af6df92 Merge pull request #2808 from kugelfuhr/kugelfuhr/flowanalysis
Simple flow analysis to find unreachable code
2025-07-26 00:10:21 +02:00
Colin Leroy-Mira 095ee0b27c Merge branch 'master' into fix-pr-2778 2025-07-20 16:28:49 +02:00
Colin Leroy-Mira 2b2c082efb Fix bug in PR #2778
Don't replace incaxy like incax[1-8].
2025-07-20 14:36:30 +02:00
Kugel Fuhr 6d45a94127 Do not output a warning about a missing "return" in a function if the function
exit is unreachable.
2025-07-17 17:07:34 +02:00
Kugel Fuhr ed54e9b168 Added several flow control tests. 2025-07-17 16:00:59 +02:00
Kugel Fuhr 93b94d314a Implement a simple flow analysis. Tracks control flow of all statements with
the exception of "switch". Outputs warnings for unreachable code. Tracks also
"return" but doesn't currently make use of this information.
2025-07-17 15:39:45 +02:00
Bob Andrews 89704a6e37 Merge pull request #2802 from kugelfuhr/kugelfuhr/modernize-ld65-diags
Modernize ld65 diagnostics
2025-07-16 00:55:12 +02:00
Kugel Fuhr 4120f35276 Added tests for warnings or errors that now have notifications. 2025-07-14 12:59:52 +02:00
Kugel Fuhr 3dfde7baef For the cpudetect tests, check the binary results for all instructions, not
just for a few selected ones.
2025-07-13 21:43:34 +02:00
Kugel Fuhr 7d963d4490 Change the output format for .assert. Use --no-utf8 for the tests. 2025-07-13 16:33:15 +02:00