1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2026-04-19 18:16:26 +00:00

122 Commits

Author SHA1 Message Date
Radosław Kujawa f09bb28811 Build with or without GNU Lightning (optional JIT)
- Add jit_stub.c: no-op JIT API when HAVE_LIGHTNING is not set; rk65c02_run_jit
  runs interpreter loop so start() still works.
- src/Makefile: HAVE_LIGHTNING ?= 1; with 0 use jit_stub.o, no -llightning/-DHAVE_LIGHTNING.
- jit.c: remove #else branch from rk65c02_jit_enable (file only built with Lightning).
- examples/test Makefiles: LDFLAGS use $(if $(NO_LIGHTNING),,-llightning); test adds
  -DHAVE_LIGHTNING when not NO_LIGHTNING.
- test_mmu.c: register mmu_demand_page_jit only #ifdef HAVE_LIGHTNING.
- README: document building with or without JIT (HAVE_LIGHTNING=0, NO_LIGHTNING=1).

Made-with: Cursor
2026-03-07 16:26:44 +01:00
Radosław Kujawa 1b4e7fe598 MMU/JIT: extended bus, examples (mmu_mpu, mmu_pae), tests, doc
- src: bus extended phys API, MMU/JIT hooks, rk65c02 MMU/tick/stop APIs
- examples: mmu_mpu and mmu_pae, Makefile targets; idle_wait, mmu_cart,
  mmu_multitasking updates
- test: test_mmu, test_bus, test_debug, Makefile
- doc: jit-design.md

Made-with: Cursor
2026-03-07 13:49:52 +01:00
Radosław Kujawa ee826da6ec MMU: host-pluggable translation, TLB, JIT coherence, docs and examples
- Add MMU API: translate and fault callbacks, begin/mark/end_update, TLB
- Translation result: ok, paddr (32-bit), perms (R/W/X), fault_code, no_fill_tlb
- Internal TLB (transparent); no_fill_tlb for context-dependent mappings
- JIT: invalidate only code on changed pages; code-page refcount
- Fault: EMUERROR, mmu_last_fault_*; resume by re-run after mapping update
- doc/MMU.md: design goals, API reference, usage, guest contract, limits
- examples/mmu_cart: C64-style bank switch (host + guest asm)
- examples/mmu_multitasking: minimal task switch (host + guest asm)
- test_mmu: MMU tests; bench_mmu: ns/insn for MMU configs
- README: MMU feature and example links

Made-with: Cursor
2026-03-07 04:05:50 +01:00
Radosław Kujawa 6ad825a983 Harden logging severity and clean runtime/test noise boundaries.
This keeps warnings distinct from info, confines optional JIT/test diagnostics behind debug gates, and removes stale comment/build-artifact clutter so normal runs stay clean and readable.

Made-with: Cursor
2026-03-07 01:36:46 +01:00
Radosław Kujawa 8d532664a4 Add WAI idle-wait host integration and documentation.
Introduce an optional WAI-only host wait callback API with interpreter/JIT loop support, add regression tests and an idle_wait example, and align Doxygen docs to describe callback and IRQ wake semantics clearly.

Made-with: Cursor
2026-03-07 01:05:20 +01:00
Radosław Kujawa 95139173db Expand JIT coverage and use targeted self-mod invalidation.
Add native JIT handlers for BBR/BBS, RMB/SMB, and TRB/TSB while tracking fallback/write/invalidation metrics, and replace run-wide write disable with span-based block invalidation plus a cross-entry self-mod regression test.

Made-with: Cursor
2026-03-06 23:22:55 +01:00
Radosław Kujawa 8f5b74f6f6 Fix JIT self-modifying code correctness within active blocks.
Bail out of compiled execution after write-capable native instructions disable JIT so patched bytes are not executed stale in the same block, persist caller JIT preference across start calls, and add a dedicated self-modifying code regression test.

Made-with: Cursor
2026-03-06 22:55:55 +01:00
Radosław Kujawa 9f5c8c13c4 Stabilize JIT functional runs and fix BBR/BBS branch checks.
Bound JIT cache growth and safely fall back after native stores to handle self-modifying functional ROM code, then correct BBR/BBS test expectations to use the 3-byte instruction base.

Made-with: Cursor
2026-03-06 21:56:55 +01:00
Radosław Kujawa e2571da31a Integrate Klaus Dormann's 6502 functional test suite with ATF/Kyua.
Adapt the imported suite to the rk65c02 memory layout, add an ATF/Kyua harness with PC-trap pass/fail detection, and fix emulator correctness issues surfaced by the suite (LDX ZP,Y size, PLX/PLY flags, zero-page wrapping, and BBR/BBS branch base).

Made-with: Cursor
2026-03-06 20:49:32 +01:00
Radosław Kujawa b980fdaae2 Add host-control callbacks and JIT-safe polling.
Expose stop/tick/request-stop APIs, keep host control active at JIT block boundaries, and document the control model with a fuller host example plus dependency-aware builds.

Made-with: Cursor
2026-03-06 19:58:55 +01:00
Radosław Kujawa 813bc612f5 Add compute-intensive benchmark to compare interpreter vs JIT
- test_emulation_bench_loop.s: tight 256x256 loop (ALU, load/store, branches), STP
- bench_emulation: standalone program times N runs each (interp/JIT), reports speedup
- test/Makefile: bench_emulation target, no ATF
- test_emulation: emul_bench_loop / emul_bench_loop_jit for correctness

Made-with: Cursor
2026-03-06 19:18:14 +01:00
Radosław Kujawa 489a3c59a9 Add JIT. Fix bugs. 2026-03-06 18:40:31 +01:00
Radoslaw Kujawa a7b3f77f88 Remove tests for serial device. 2021-01-26 01:16:36 +01:00
Radosław Kujawa affb3f8630 Test for ADC abs, absx, better test for 16bit adc. 2019-01-25 11:10:35 +01:00
Radosław Kujawa aa76f7ba6c Add tests for ADC immediate, zp, zpx. 2019-01-11 15:54:09 +01:00
Radosław Kujawa e6088d2396 Add tests for TSX, TXS. 2019-01-08 23:34:08 +01:00
Radosław Kujawa e3714fe805 Add missing test cases for LDA. 2019-01-08 13:57:10 +01:00
Radosław Kujawa ed39eff773 Add test cases for STX. 2019-01-07 13:35:14 +01:00
Radosław Kujawa 9bcbeb3ca7 Add tests for STY. 2019-01-07 11:43:23 +01:00
Radosław Kujawa b39663db42 No need to use workaround - vasm was fixed. 2019-01-06 00:02:03 +01:00
Radosław Kujawa 84f4c530d8 Add missing test cases for STZ. 2019-01-05 23:57:18 +01:00
Radosław Kujawa 69fb59ee41 Add missing test cases for LDA addressing modes. 2019-01-05 12:13:28 +01:00
Radosław Kujawa 184c23b399 Explicitly enable WDC65C02 mode in vasm. 2019-01-05 00:30:18 +01:00
Radosław Kujawa 9f916885b8 Add missing include. 2018-06-25 14:06:38 +02:00
Radosław Kujawa dfb3bd1fca Try to make this build on Linux, NetBSD and OS X.
Without actually using autoconf etc.
2018-06-25 13:19:35 +02:00
Radosław Kujawa 1ec075518c Split assembler-related things into separate file. 2018-04-27 14:07:42 +02:00
Radosław Kujawa 216450da52 Enable debug-safe optimizations.
Also ggdb for tests.
2018-04-26 14:16:32 +02:00
Radosław Kujawa 8ca86735df Add tests for BBRx, BBSx. 2018-04-16 12:27:53 +02:00
Radosław Kujawa 7445c275e6 Add test cases for ROR and ROL.
Too old to ROR and to ROL.
2018-04-13 12:26:06 +02:00
Radosław Kujawa fae3445e58 Add test cases for TRB and TSB. 2018-04-12 15:28:47 +02:00
Radosław Kujawa e5448f50eb Fix expected PC address. 2018-04-12 15:13:48 +02:00
Radosław Kujawa 578955e4a1 Add test case for invalid opcode handling. 2018-04-12 11:40:33 +02:00
Radosław Kujawa fe94c747e5 Add test case for signed comparison. 2018-04-09 15:00:02 +02:00
Radosław Kujawa 3c684fbf2c Fix zero page wrap for indexed indirect mode. 2018-03-31 15:03:22 +02:00
Radosław Kujawa 7c4d6cea3f Fix indirect indexed with Y addressing.
Also fix test case for this. Problem wasn't detected, because test case
was broken too.
2018-03-31 12:38:45 +02:00
Radosław Kujawa 4f299a6f36 Also fix zero page wrap for bus reads. 2018-03-28 14:18:50 +02:00
Radosław Kujawa b35323cb3d Use logging function instead of printf. 2018-03-28 13:52:07 +02:00
Radosław Kujawa 390bbdc14e Add test cases for LSR and zero page wrap. 2018-03-28 13:47:18 +02:00
Radosław Kujawa 0b2be69481 Add test case for ASL. 2018-03-28 13:18:44 +02:00
Radosław Kujawa ae3e782b74 Use boehm gc to manage memory.
I'm less likely to fuck this up now.
2018-03-26 12:36:47 +02:00
Radosław Kujawa 13a4c73807 Unbreak BRK test case - add RAM for ISR vector. 2018-03-24 23:06:29 +01:00
Radosław Kujawa 63168d6f84 Increase log level for stepping test case. 2018-03-24 23:06:13 +01:00
Radosław Kujawa 5fddf2c5dc More refactoring and improvements to logging! 2018-03-23 13:37:07 +01:00
Radosław Kujawa 5cb6f3488e Further improvements and refactoring to logging. 2018-03-22 15:08:51 +01:00
Radosław Kujawa 065d001135 Add missing header file. 2018-03-20 12:06:40 +01:00
Radosław Kujawa 0735487ed0 Add skeleton for a serial device test.
Not really working yet, so commented out in Kyuafile.
2017-02-26 13:07:39 +01:00
Radosław Kujawa 1dcaa4c53f Adjust test to chnages in bus code (due to device subsystem intro). 2017-02-20 21:30:23 +01:00
Radosław Kujawa 0df6387a41 Simple test case for tracing. 2017-02-15 22:12:56 +01:00
Radosław Kujawa 90ddf4b400 Fix tests for CMP, CPY, CPX. Carry flag test was inverted, duh! 2017-02-15 22:06:04 +01:00
Radosław Kujawa 23492e6533 Refactor due to change in rk65c02_dump_regs. 2017-02-15 21:35:27 +01:00